#lang racket/base
  
  (require racket/unit "text-sig.rkt" "editor-sig.rkt")
  
  (provide (prefix-out framework: (except-out (all-defined-out) framework^))
           framework^)
  
  (define-signature number-snip-class^ 
    (snip-class%))
  (define-signature number-snip^ extends number-snip-class^
    (number->string/snip
     make-pretty-print-size
     make-repeating-decimal-snip
     make-fraction-snip
     is-number-snip?
     get-number
     remove-decimal-looking-number-snips-on-insertion-mixin))
  (define-signature number-snip/int^ extends number-snip^
    ())
  
  (define-signature comment-box-class^
    (snip%))
  (define-signature comment-box^ extends comment-box-class^
    (snipclass))

  (define-signature srcloc-snip-class^
    (snip%))
  (define-signature srcloc-snip^ extends srcloc-snip-class^
    (snipclass
     select-srcloc))

  (define-signature menu-class^
    (can-restore<%>
     can-restore-mixin
     can-restore-underscore<%>
     can-restore-underscore-mixin
     can-restore-menu-item%
     can-restore-checkable-menu-item%
     can-restore-underscore-menu%))
  (define-signature menu^ extends menu-class^
    ())
  
  (define-signature version-class^
    ())
  (define-signature version^ extends version-class^
    (add-spec
     version))
  
  (define-signature panel-class^
    (single-mixin
     single<%>
     
     single-window<%>
     single-window-mixin
     
     ;;multi-view-mixin
     ;;multi-view<%>
     
     
     single%
     single-pane%
     ;;multi-view%
     
     dragable<%>
     dragable-mixin
     
     vertical-dragable<%>
     vertical-dragable-mixin
     vertical-dragable%
     
     horizontal-dragable<%>
     horizontal-dragable-mixin
     horizontal-dragable%

     splitter<%>
     splitter-mixin
     
     discrete-sizes<%>
     discrete-child<%>
     discrete-sizes-mixin
     horizontal-discrete-sizes%
     vertical-discrete-sizes%))
  (define-signature panel^ extends panel-class^
    (dragable-container-size
     dragable-place-children))

  (define-signature application-class^
    ())
  (define-signature application^ extends application-class^
    (current-app-name))
  
  (define-signature preferences-class^
    ())
  (define-signature preferences^ extends preferences-class^
    (put-preferences/gui
     get-preference/gui
     add-panel
     add-font-panel
     
     add-editor-checkbox-panel
     add-general-checkbox-panel
     add-warnings-checkbox-panel
     add-scheme-checkbox-panel
     
     add-to-editor-checkbox-panel
     add-to-general-checkbox-panel
     add-to-warnings-checkbox-panel
     add-to-scheme-checkbox-panel
     
     add-on-close-dialog-callback
     add-can-close-dialog-callback
     
     add-check
     add-boolean-option-with-ask-me
     show-dialog
     hide-dialog))
  
  (define-signature autosave-class^
    (autosavable<%>))
  (define-signature autosave^ extends autosave-class^
    (current-toc-path
     toc-path
     register
     restore-autosave-files/gui))
  
  (define-signature exit-class^
    ())
  (define-signature exit^ extends exit-class^
    (set-exiting
     exiting?
     user-oks-exit
     insert-on-callback
     insert-can?-callback
     can-exit?
     on-exit
     exit))
  
  (define-signature path-utils-class^
    ())
  (define-signature path-utils^ extends path-utils-class^
    (generate-autosave-name 
     generate-backup-name))
  
  (define-signature finder-class^
    ())
  (define-signature finder^ extends finder-class^
    (dialog-parent-parameter
     default-extension
     default-filters
     common-put-file 
     common-get-file 
     std-put-file 
     std-get-file 
     get-file
     put-file))

  (define-signature pasteboard-class^
    (basic%
     standard-style-list%
     keymap%
     file%
     backup-autosave%
     info%))
  (define-signature pasteboard^ extends pasteboard-class^
    ())

(define-signature editor-class^
  ((open editor-misc-class^)
   (open editor-autoload^)))

(define-signature editor^ extends editor-class^
  ((open editor-misc-functions^)))
  
(define-signature text-class^
  ((open text-basic-class^)
   (open text-line-numbers^)
   (open text-autocomplete-class^)
   (open text-normalize-paste^)
   (open text-column-guide^)
   (open text-ascii-art^)
   (open text-misc^)
   (open text-delegate^)
   (open text-port-class^)
   (open text-search^)
   (open text-first-line^)
   (open text-inline-overview^)
   (open text-indent-guides^)
   (open text-mixed-in-classes^)))

(define-signature text^ extends text-class^
  ((open text-basic-functions^)
   (open text-port-functions^)
   (open text-autocomplete-functions^)))

  (define-signature canvas-class^
    (basic<%>
     color<%>
     delegate<%>
     info<%>
     wide-snip<%>
     
     basic%
     color%
     info%
     delegate%
     wide-snip%
     
     basic-mixin
     color-mixin
     delegate-mixin
     info-mixin
     wide-snip-mixin))
  (define-signature canvas^ extends canvas-class^
    ())
  
  (define-signature frame-class^
    (basic<%>
     focus-table<%>
     size-pref<%>
     register-group<%>
     status-line<%>
     standard-menus<%>
     editor<%>
     text<%>
     pasteboard<%>
     delegate<%>
     searchable<%>
     searchable-text<%>
     info<%>
     text-info<%>
     pasteboard-info<%>
     
     basic%
     size-pref%
     status-line%
     info%
     text-info%
     pasteboard-info%
     standard-menus%
     editor%
     text%
     searchable%
     delegate%
     pasteboard%
     
     focus-table-mixin
     basic-mixin
     size-pref-mixin
     register-group-mixin
     status-line-mixin
     standard-menus-mixin
     editor-mixin
     text-mixin
     pasteboard-mixin
     delegate-mixin
     searchable-mixin
     searchable-text-mixin
     info-mixin
     text-info-mixin
     pasteboard-info-mixin))
  (define-signature frame^ extends frame-class^
    (current-icon
     reorder-menus
     remove-empty-menus
     add-snip-menu-items
     setup-size-pref))
  
  (define-signature group-class^
    (%))
  (define-signature group^ extends group-class^
    (get-the-frame-group
     on-close-action
     can-close-check
     add-to-windows-menu
     create-windows-menu))
  
  (define-signature handler-class^
    ())
  (define-signature handler^ extends handler-class^
    (handler? 
     handler-name 
     handler-extension
     handler-handler
     insert-format-handler
     find-format-handler 
     find-named-format-handler 
     current-create-new-window
     edit-file
     open-file
     install-recent-items
     add-to-recent
     update-currently-open-files
     set-recent-position
     set-recent-items-frame-superclass
     size-recently-opened-files))
  
  (define-signature icon-class^
    ())
  (define-signature icon^ extends icon-class^
    (get-paren-highlight-bitmap
     get-autowrap-bitmap
     get-eof-bitmap
     
     get-lock-bitmap
     get-unlock-bitmap
     get-anchor-bitmap
     
     get-left/right-cursor
     get-up/down-cursor
     
     get-gc-on-bitmap
     get-gc-off-bitmap))
  
  (define-signature keymap-class^
    (aug-keymap%
     aug-keymap<%>
     aug-keymap-mixin))
  (define-signature keymap^ extends keymap-class^
    (send-map-function-meta
     make-meta-prefix-list
     
     canonicalize-keybinding-string
     
     add-to-right-button-menu
     add-to-right-button-menu/before
     
     setup-global
     setup-search
     setup-file
     setup-editor
     
     get-user
     get-global
     get-search
     get-file
     get-editor
     
     set-chained-keymaps
     remove-chained-keymap
     
     call/text-keymap-initializer
     
     add-user-keybindings-file
     remove-user-keybindings-file
     
     region-click))
  
  (define-signature color-class^
    (text<%>
     text-mixin
     text%
     
     text-mode<%>
     text-mode-mixin
     text-mode%))
  (define-signature color^ extends color-class^
    (get-parenthesis-colors-table
     misspelled-text-color-style-name))
  
  (define-signature color-prefs-class^
    ())
  (define-signature color-prefs^ extends color-prefs-class^
    (register-color-preference
     add-to-preferences-panel
     build-color-selection-panel
     normalize-color-selection-button-widths
     add-background-preferences-panel
     marshall-style-delta
     unmarshall-style-delta
     set-default/color-scheme
     white-on-black
     black-on-white
     
     add-color-scheme-preferences-panel
     set-current-color-scheme
     get-current-color-scheme-name
     known-color-scheme-name?
     color-scheme-style-name?
     color-scheme-color-name?
     lookup-in-color-scheme
     set-in-color-scheme
     register-color-scheme-entry-change-callback
     add-color-scheme-entry
     register-info-based-color-schemes
     get-color-scheme-names
     get-inverted-base-color-scheme))
  
  (define-signature racket-class^
    (text<%>
     text-mixin
     text%
     
     text-mode<%>
     text-mode-mixin
     text-mode%
     
     set-mode-mixin
     
     sexp-snip%
     sexp-snip<%>))
  (define-signature racket^ extends racket-class^
    (get-wordbreak-map
     init-wordbreak-map
     get-keymap
     get-paren-keymap
     get-non-paren-keymap
     setup-keymap
     add-pairs-keybinding-functions
     map-pairs-keybinding-functions
     add-preferences-panel
     add-coloring-preferences-panel
     
     get-color-prefs-table
     get-white-on-black-color-prefs-table
     short-sym->pref-name
     short-sym->style-name
     
     text-balanced?

     default-paren-matches))
  
  (define-signature main-class^ ())
  (define-signature main^ extends main-class^ ())
  
  (define-signature mode-class^ 
    (host-text-mixin
     host-text<%>
     surrogate-text%
     surrogate-text<%>))
  (define-signature mode^ extends mode-class^ ())
  
  (define-signature color-model-class^
    ())
  (define-signature color-model^ extends color-model-class^
    (xyz?
     xyz-x
     xyz-y
     xyz-z
     rgb-color-distance
     rgb->xyz
     xyz->rgb
     hsl->rgb
     rgb->hsl))
  
  (define-signature early-init^ ())
  
  (define-signature framework^
    ((open (prefix application: application^))
     (open (prefix version: version^))
     (open (prefix color-model: color-model^))
     (open (prefix mode: mode^))
     (open (prefix exit: exit^))
     (open (prefix menu: menu^))
     (open (prefix preferences: preferences^))
     (open (prefix number-snip: number-snip^))
     (open (prefix autosave: autosave^))
     (open (prefix path-utils: path-utils^))
     (open (prefix icon: icon^))
     (open (prefix keymap: keymap^))
     (open (prefix editor: editor^))
     (open (prefix pasteboard: pasteboard^))
     (open (prefix text: text^))
     (open (prefix color: color^))
     (open (prefix color-prefs: color-prefs^))
     (open (prefix comment-box: comment-box^))
     (open (prefix srcloc-snip: srcloc-snip^))
     (open (prefix finder: finder^))
     (open (prefix group: group^))
     (open (prefix canvas: canvas^))
     (open (prefix panel: panel^))
     (open (prefix frame: frame^))
     (open (prefix handler: handler^))
     (open (prefix racket: racket^))
     (open (prefix main: main^))))
