From 1d26e97a35e7c2bd67130b70680a7870b41ef45c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 7 Apr 2009 17:12:22 +0000 Subject: [PATCH] Scheme-implemented editor classes; on-demand instantiation of module phases svn: r14445 --- collects/framework/private/editor.ss | 1 + collects/mred/edit.ss | 2 +- collects/mred/mred.ss | 15 +- collects/mred/private/editor.ss | 17 +- collects/mred/private/filedialog.ss | 6 +- collects/mred/private/helper.ss | 1 + collects/mred/private/kernel.ss | 852 +- collects/mred/private/moredialogs.ss | 1 + collects/mred/private/mrmenu.ss | 8 +- collects/mred/private/mrpopup.ss | 5 +- collects/mred/private/path-dialog.ss | 1 + collects/mred/private/repl.ss | 1 + collects/mred/private/seqcontract.ss | 2 +- collects/mred/private/snipfile.ss | 6 +- collects/mred/private/syntax.ss | 266 + collects/mred/private/wxcanvas.ss | 13 +- collects/mred/private/wxme/const.ss | 5 + collects/mred/private/wxme/cycle.ss | 27 + collects/mred/private/wxme/editor-admin.ss | 57 + collects/mred/private/wxme/editor-canvas.ss | 1133 ++ collects/mred/private/wxme/editor-snip.ss | 716 + collects/mred/private/wxme/editor.ss | 1819 +++ collects/mred/private/wxme/keymap.ss | 737 + collects/mred/private/wxme/mline.ss | 1192 ++ collects/mred/private/wxme/pasteboard.ss | 2122 +++ collects/mred/private/wxme/private.ss | 140 + collects/mred/private/wxme/snip-admin.ss | 147 + collects/mred/private/wxme/snip-flags.ss | 92 + collects/mred/private/wxme/snip.ss | 1488 ++ collects/mred/private/wxme/stream.ss | 761 + collects/mred/private/wxme/style.ss | 1438 ++ collects/mred/private/wxme/text.ss | 5482 +++++++ collects/mred/private/wxme/undo.ss | 307 + collects/mred/private/wxme/wordbreak.ss | 151 + collects/mred/private/wxme/wx.ss | 63 + collects/mred/private/wxmenu.ss | 1 + collects/mred/private/wxtextfield.ss | 2 + collects/mred/private/wxtop.ss | 2 + collects/scheme/private/for.ss | 2 +- collects/scheme/private/kw.ss | 5 +- collects/scribblings/gui/clipboard-intf.scrbl | 8 + collects/scribblings/gui/dc-intf.scrbl | 15 + collects/scribblings/gui/editor-intf.scrbl | 124 +- .../gui/editor-stream-in-base-class.scrbl | 16 +- .../gui/editor-stream-out-base-class.scrbl | 10 +- .../gui/editor-stream-out-class.scrbl | 14 +- .../scribblings/gui/pasteboard-class.scrbl | 11 +- collects/scribblings/gui/text-class.scrbl | 130 +- collects/scribblings/guide/proc-macros.scrbl | 4 +- .../scribblings/reference/eval-model.scrbl | 23 +- collects/scribblings/reference/hashes.scrbl | 20 +- .../reference/module-reflect.scrbl | 29 +- .../scribblings/reference/namespaces.scrbl | 16 +- .../scribblings/reference/syntax-model.scrbl | 48 +- collects/scribblings/reference/syntax.scrbl | 13 +- collects/sirmail/readr.ss | 6 +- collects/tests/mred/media8.mre | 66 +- collects/tests/mred/test-editor-admin.ss | 44 + collects/tests/mred/wxme.ss | 1337 ++ collects/tests/mzscheme/module.ss | 8 +- doc/release-notes/mzscheme/HISTORY.txt | 10 +- src/configure | 2 +- src/mred/Makefile.in | 9 +- src/mred/gc2/Makefile.in | 150 +- src/mred/mred.cxx | 470 +- src/mred/mred.h | 17 +- src/mred/mredmac.cxx | 5 +- src/mred/mredmsw.cxx | 2 +- src/mred/mredx.cxx | 2 +- src/mred/wxme/Makefile.in | 136 - src/mred/wxme/wx_cgrec.cxx | 753 - src/mred/wxme/wx_cgrec.h | 231 - src/mred/wxme/wx_gcrct.h | 4 - src/mred/wxme/wx_keym.cxx | 1211 -- src/mred/wxme/wx_keym.h | 131 - src/mred/wxme/wx_madm.h | 154 - src/mred/wxme/wx_mbuf.cxx | 2955 ---- src/mred/wxme/wx_medad.cxx | 1696 --- src/mred/wxme/wx_medad.h | 546 - src/mred/wxme/wx_media.cxx | 4570 ------ src/mred/wxme/wx_media.h | 687 - src/mred/wxme/wx_medio.cxx | 1532 -- src/mred/wxme/wx_medio.h | 262 - src/mred/wxme/wx_medpb.h | 271 - src/mred/wxme/wx_mline.cxx | 1306 -- src/mred/wxme/wx_mline.h | 124 - src/mred/wxme/wx_mpbrd.cxx | 3025 ---- src/mred/wxme/wx_mpriv.cxx | 3090 ---- src/mred/wxme/wx_mpriv.h | 39 - src/mred/wxme/wx_msnip.cxx | 1170 -- src/mred/wxme/wx_mtype.h | 36 - src/mred/wxme/wx_ptreq.h | 8 - src/mred/wxme/wx_snip.cxx | 2211 --- src/mred/wxme/wx_snip.h | 541 - src/mred/wxme/wx_style.cxx | 1894 --- src/mred/wxme/wx_style.h | 258 - src/mred/wxs/Makefile.in | 71 +- src/mred/wxs/ktail.ss | 12 +- src/mred/wxs/wxs_cret.xci | 7 - src/mred/wxs/wxs_dc.cxx | 25 +- src/mred/wxs/wxs_dc.xc | 2 + src/mred/wxs/wxs_eds.xci | 19 - src/mred/wxs/wxs_fcs.xci | 15 - src/mred/wxs/wxs_gdi.cxx | 34 +- src/mred/wxs/wxs_gdi.h | 2 + src/mred/wxs/wxs_gdi.xc | 1 + src/mred/wxs/wxs_madm.cxx | 5526 ------- src/mred/wxs/wxs_madm.h | 122 - src/mred/wxs/wxs_madm.xc | 350 - src/mred/wxs/wxs_madm.xci | 12 - src/mred/wxs/wxs_mbuf.xci | 98 - src/mred/wxs/wxs_mede.cxx | 9058 ----------- src/mred/wxs/wxs_mede.h | 98 - src/mred/wxs/wxs_mede.xc | 327 - src/mred/wxs/wxs_medi.cxx | 2731 ---- src/mred/wxs/wxs_medi.h | 39 - src/mred/wxs/wxs_medi.xc | 223 - src/mred/wxs/wxs_mio.cxx | 2221 --- src/mred/wxs/wxs_mio.h | 44 - src/mred/wxs/wxs_mio.xc | 188 - src/mred/wxs/wxs_misc.cxx | 68 +- src/mred/wxs/wxs_misc.h | 1 + src/mred/wxs/wxs_misc.xc | 16 + src/mred/wxs/wxs_mpb.cxx | 7241 --------- src/mred/wxs/wxs_mpb.h | 176 - src/mred/wxs/wxs_mpb.xc | 106 - src/mred/wxs/wxs_snip.cxx | 12462 ---------------- src/mred/wxs/wxs_snip.h | 296 - src/mred/wxs/wxs_snip.xc | 312 - src/mred/wxs/wxs_snip.xci | 36 - src/mred/wxs/wxs_styl.cxx | 3832 ----- src/mred/wxs/wxs_styl.h | 80 - src/mred/wxs/wxs_styl.xc | 282 - src/mred/wxs/wxscheme.cxx | 391 +- src/mzscheme/configure.ac | 2 +- src/mzscheme/src/env.c | 85 +- src/mzscheme/src/error.c | 14 +- src/mzscheme/src/eval.c | 7 + src/mzscheme/src/module.c | 588 +- src/mzscheme/src/mzmark.c | 8 + src/mzscheme/src/mzmarksrc.c | 3 + src/mzscheme/src/schpriv.h | 11 +- src/mzscheme/src/schvers.h | 4 +- src/mzscheme/src/syntax.c | 6 +- src/worksp/gc2/make.ss | 26 - src/worksp/libmred/libmred.vcproj | 4 +- src/worksp/mred/mred.vcproj | 44 +- src/worksp/wxme/wxme.vcproj | 48 - src/worksp/wxs/wxs.vcproj | 64 +- 149 files changed, 20675 insertions(+), 77299 deletions(-) create mode 100644 collects/mred/private/syntax.ss create mode 100644 collects/mred/private/wxme/const.ss create mode 100644 collects/mred/private/wxme/cycle.ss create mode 100644 collects/mred/private/wxme/editor-admin.ss create mode 100644 collects/mred/private/wxme/editor-canvas.ss create mode 100644 collects/mred/private/wxme/editor-snip.ss create mode 100644 collects/mred/private/wxme/editor.ss create mode 100644 collects/mred/private/wxme/keymap.ss create mode 100644 collects/mred/private/wxme/mline.ss create mode 100644 collects/mred/private/wxme/pasteboard.ss create mode 100644 collects/mred/private/wxme/private.ss create mode 100644 collects/mred/private/wxme/snip-admin.ss create mode 100644 collects/mred/private/wxme/snip-flags.ss create mode 100644 collects/mred/private/wxme/snip.ss create mode 100644 collects/mred/private/wxme/stream.ss create mode 100644 collects/mred/private/wxme/style.ss create mode 100644 collects/mred/private/wxme/text.ss create mode 100644 collects/mred/private/wxme/undo.ss create mode 100644 collects/mred/private/wxme/wordbreak.ss create mode 100644 collects/mred/private/wxme/wx.ss create mode 100644 collects/tests/mred/test-editor-admin.ss create mode 100644 collects/tests/mred/wxme.ss delete mode 100644 src/mred/wxme/Makefile.in delete mode 100644 src/mred/wxme/wx_cgrec.cxx delete mode 100644 src/mred/wxme/wx_cgrec.h delete mode 100644 src/mred/wxme/wx_gcrct.h delete mode 100644 src/mred/wxme/wx_keym.cxx delete mode 100644 src/mred/wxme/wx_keym.h delete mode 100644 src/mred/wxme/wx_madm.h delete mode 100644 src/mred/wxme/wx_mbuf.cxx delete mode 100644 src/mred/wxme/wx_medad.cxx delete mode 100644 src/mred/wxme/wx_medad.h delete mode 100644 src/mred/wxme/wx_media.cxx delete mode 100644 src/mred/wxme/wx_media.h delete mode 100644 src/mred/wxme/wx_medio.cxx delete mode 100644 src/mred/wxme/wx_medio.h delete mode 100644 src/mred/wxme/wx_medpb.h delete mode 100644 src/mred/wxme/wx_mline.cxx delete mode 100644 src/mred/wxme/wx_mline.h delete mode 100644 src/mred/wxme/wx_mpbrd.cxx delete mode 100644 src/mred/wxme/wx_mpriv.cxx delete mode 100644 src/mred/wxme/wx_mpriv.h delete mode 100644 src/mred/wxme/wx_msnip.cxx delete mode 100644 src/mred/wxme/wx_mtype.h delete mode 100644 src/mred/wxme/wx_ptreq.h delete mode 100644 src/mred/wxme/wx_snip.cxx delete mode 100644 src/mred/wxme/wx_snip.h delete mode 100644 src/mred/wxme/wx_style.cxx delete mode 100644 src/mred/wxme/wx_style.h delete mode 100644 src/mred/wxs/wxs_cret.xci delete mode 100644 src/mred/wxs/wxs_eds.xci delete mode 100644 src/mred/wxs/wxs_fcs.xci delete mode 100644 src/mred/wxs/wxs_madm.cxx delete mode 100644 src/mred/wxs/wxs_madm.h delete mode 100644 src/mred/wxs/wxs_madm.xc delete mode 100644 src/mred/wxs/wxs_madm.xci delete mode 100644 src/mred/wxs/wxs_mbuf.xci delete mode 100644 src/mred/wxs/wxs_mede.cxx delete mode 100644 src/mred/wxs/wxs_mede.h delete mode 100644 src/mred/wxs/wxs_mede.xc delete mode 100644 src/mred/wxs/wxs_medi.cxx delete mode 100644 src/mred/wxs/wxs_medi.h delete mode 100644 src/mred/wxs/wxs_medi.xc delete mode 100644 src/mred/wxs/wxs_mio.cxx delete mode 100644 src/mred/wxs/wxs_mio.h delete mode 100644 src/mred/wxs/wxs_mio.xc delete mode 100644 src/mred/wxs/wxs_mpb.cxx delete mode 100644 src/mred/wxs/wxs_mpb.h delete mode 100644 src/mred/wxs/wxs_mpb.xc delete mode 100644 src/mred/wxs/wxs_snip.cxx delete mode 100644 src/mred/wxs/wxs_snip.h delete mode 100644 src/mred/wxs/wxs_snip.xc delete mode 100644 src/mred/wxs/wxs_snip.xci delete mode 100644 src/mred/wxs/wxs_styl.cxx delete mode 100644 src/mred/wxs/wxs_styl.h delete mode 100644 src/mred/wxs/wxs_styl.xc diff --git a/collects/framework/private/editor.ss b/collects/framework/private/editor.ss index a5ae252abd..d76cd944d0 100644 --- a/collects/framework/private/editor.ss +++ b/collects/framework/private/editor.ss @@ -321,6 +321,7 @@ (define/override (on-new-image-snip filename kind relative-path? inline?) (super on-new-image-snip + filename (if (eq? kind 'unknown) 'unknown/mask kind) relative-path? inline?)) diff --git a/collects/mred/edit.ss b/collects/mred/edit.ss index c81e38ebc9..cc887bd707 100644 --- a/collects/mred/edit.ss +++ b/collects/mred/edit.ss @@ -158,7 +158,7 @@ (send c set-editor e) (when file - (if (regexp-match "[.](gif|bmp|jpe?g|xbm|xpm|png)$" file) + (if (regexp-match "[.](gif|bmp|jpe?g|xbm|xpm|png)$" (string-downcase file)) (send e insert (make-object image-snip% file)) (send e load-file file))) diff --git a/collects/mred/mred.ss b/collects/mred/mred.ss index d4397a5498..0ba30ed867 100644 --- a/collects/mred/mred.ss +++ b/collects/mred/mred.ss @@ -6,6 +6,17 @@ scheme/class mzlib/etc (prefix wx: "private/kernel.ss") + (prefix wx: "private/wxme/style.ss") + (prefix wx: "private/wxme/editor.ss") + (prefix wx: "private/wxme/text.ss") + (prefix wx: "private/wxme/pasteboard.ss") + (prefix wx: "private/wxme/snip.ss") + (prefix wx: "private/wxme/keymap.ss") + (prefix wx: "private/wxme/editor-admin.ss") + (prefix wx: "private/wxme/editor-snip.ss") + (prefix wx: "private/wxme/stream.ss") + (prefix wx: "private/wxme/wordbreak.ss") + (prefix wx: "private/wxme/snip-admin.ss") "private/wxtop.ss" "private/app.ss" "private/misc.ss" @@ -182,8 +193,8 @@ (define the-font-list (wx:get-the-font-list)) (define the-pen-list (wx:get-the-pen-list)) (define the-brush-list (wx:get-the-brush-list)) - (define the-style-list (wx:get-the-style-list)) - (define the-editor-wordbreak-map (wx:get-the-editor-wordbreak-map)) + (define the-style-list wx:the-style-list) + (define the-editor-wordbreak-map wx:the-editor-wordbreak-map) (provide button% canvas% diff --git a/collects/mred/private/editor.ss b/collects/mred/private/editor.ss index 1ecb655e25..7740a207f4 100644 --- a/collects/mred/private/editor.ss +++ b/collects/mred/private/editor.ss @@ -5,6 +5,15 @@ mzlib/list mzlib/file (prefix wx: "kernel.ss") + (prefix wx: "wxme/style.ss") + (prefix wx: "wxme/keymap.ss") + (prefix wx: "wxme/editor.ss") + (prefix wx: "wxme/text.ss") + (prefix wx: "wxme/pasteboard.ss") + (prefix wx: "wxme/editor-snip.ss") + (rename "wxme/cycle.ss" wx:set-extended-editor-snip%! set-extended-editor-snip%!) + (rename "wxme/cycle.ss" wx:set-extended-text%! set-extended-text%!) + (rename "wxme/cycle.ss" wx:set-extended-pasteboard%! set-extended-pasteboard%!) "seqcontract.ss" "lock.ss" "check.ss" @@ -324,7 +333,7 @@ (when (and can-wrap? auto-set-wrap?) (let-values ([(current-width) (as-exit (lambda () (get-max-width)))] [(new-width new-height) (max-view-size)]) - (when (and (not (= current-width new-width)) + (when (and (not (equal? current-width new-width)) (< 0 new-width)) (as-exit (lambda () (set-max-width new-width))))))) (as-exit (lambda () (inner (void) on-display-size)))))]) @@ -481,9 +490,9 @@ min-height max-height)))) - (wx:set-editor-snip-maker (lambda args (apply make-object editor-snip% args))) - (wx:set-text-editor-maker (lambda () (make-object text%))) - (wx:set-pasteboard-editor-maker (lambda () (make-object pasteboard%))) + (wx:set-extended-editor-snip%! editor-snip%) + (wx:set-extended-text%! text%) + (wx:set-extended-pasteboard%! pasteboard%) ;; ----------------------- Keymap ---------------------------------------- diff --git a/collects/mred/private/filedialog.ss b/collects/mred/private/filedialog.ss index 8b2e422968..a3d06564df 100644 --- a/collects/mred/private/filedialog.ss +++ b/collects/mred/private/filedialog.ss @@ -3,6 +3,8 @@ mzlib/etc mzlib/list (prefix wx: "kernel.ss") + (prefix wx: "wxme/style.ss") + (prefix wx: "wxme/cycle.ss") "lock.ss" "wx.ss" "cycle.ss" @@ -105,4 +107,6 @@ ((mk-file-selector 'get-directory #f #f #t) message parent directory #f #f style null))) - (set-get-file! get-file)) + (set-get-file! get-file) + (wx:set-editor-get-file! get-file) + (wx:set-editor-put-file! put-file)) diff --git a/collects/mred/private/helper.ss b/collects/mred/private/helper.ss index 2be01a71f1..b11e071849 100644 --- a/collects/mred/private/helper.ss +++ b/collects/mred/private/helper.ss @@ -1,6 +1,7 @@ (module helper mzscheme (require mzlib/class (prefix wx: "kernel.ss") + (prefix wx: "wxme/style.ss") "lock.ss") (provide (protect (struct child-info (x-min y-min x-margin y-margin x-stretch y-stretch)) diff --git a/collects/mred/private/kernel.ss b/collects/mred/private/kernel.ss index f448c6787f..794007f5b7 100644 --- a/collects/mred/private/kernel.ss +++ b/collects/mred/private/kernel.ss @@ -160,147 +160,6 @@ on-size on-set-focus on-kill-focus) - (define-private-class editor% editor<%> object% () #f - dc-location-to-editor-location - editor-location-to-dc-location - set-inactive-caret-threshold - get-inactive-caret-threshold - get-focus-snip - end-write-header-footer-to-file - begin-write-header-footer-to-file - print - insert-image - insert-box - get-filename - is-modified? - is-locked? - lock - set-cursor - get-paste-text-only - set-paste-text-only - get-load-overwrites-styles - set-load-overwrites-styles - set-style-list - get-style-list - get-keymap - set-keymap - can-do-edit-operation? - do-edit-operation - get-max-undo-history - set-max-undo-history - add-undo - clear-undos - redo - undo - select-all - clear - get-view-size - get-dc - local-to-global - global-to-local - locked-for-flow? - locked-for-write? - locked-for-read? - set-admin - get-admin - print-to-dc - find-scroll-line - num-scroll-lines - scroll-line-location - get-snip-location - locations-computed? - in-edit-sequence? - refresh-delayed? - end-edit-sequence - begin-edit-sequence - style-has-changed - set-min-height - set-max-height - get-min-height - get-max-height - set-min-width - set-max-width - get-min-width - get-max-width - insert-file - load-file - insert-port - save-port - default-style-name - get-flattened-text - put-file - get-file - after-edit-sequence - on-edit-sequence - after-load-file - on-load-file - can-load-file? - after-save-file - on-save-file - can-save-file? - on-new-box - on-new-image-snip - size-cache-invalid - invalidate-bitmap-cache - on-paint - write-footers-to-file - write-headers-to-file - read-footer-from-file - read-header-from-file - write-to-file - read-from-file - set-filename - release-snip - on-snip-modified - set-modified - scroll-editor-to - set-snip-data - get-snip-data - needs-update - resized - set-caret-owner - scroll-to - on-display-size-when-ready - on-display-size - on-change - on-focus - on-default-char - on-default-event - on-local-char - on-local-event - find-first-snip - get-space - get-descent - get-extent - blink-caret - own-caret - refresh - adjust-cursor - on-char - on-event - copy-self-to - copy-self - kill - paste-x-selection - paste - copy - cut - insert - change-style) - (define-function get-the-editor-data-class-list) - (define-function get-the-snip-class-list) - (define-function editor-set-x-selection-mode) - (define-function add-pasteboard-keymap-functions) - (define-function add-text-keymap-functions) - (define-function add-editor-keymap-functions) - (define-function write-editor-global-footer) - (define-function write-editor-global-header) - (define-function read-editor-global-footer) - (define-function read-editor-global-header) - (define-function read-editor-version) - (define-function write-editor-version) - (define-function set-editor-print-margin) - (define-function get-editor-print-margin) (define-class bitmap% object% () #f get-argb-pixels get-gl-config @@ -375,6 +234,7 @@ on-event on-paint) (define-private-class dc% dc<%> object% () #f + cache-font-metrics-key get-alpha set-alpha glyph-exists? @@ -711,255 +571,6 @@ on-size on-set-focus on-kill-focus) - (define-class editor-canvas% canvas% () #f - on-char - on-event - on-paint - on-drop-file - pre-on-event - pre-on-char - on-size - on-set-focus - on-kill-focus - popup-for-editor - call-as-primary-owner - get-canvas-background - set-canvas-background - set-y-margin - set-x-margin - get-y-margin - get-x-margin - clear-margins - scroll-to - set-lazy-refresh - get-lazy-refresh - scroll-with-bottom-base - allow-scroll-to-last - force-display-focus - is-focus-on? - on-scroll-on-change - get-editor - set-editor - get-wheel-step - set-wheel-step) - (define-class editor-admin% object% () #f - modified - refresh-delayed? - popup-menu - update-cursor - needs-update - resized - grab-caret - scroll-to - get-max-view - get-view - get-dc) - (define-private-class editor-snip-editor-admin% editor-snip-editor-admin<%> editor-admin% () #f - get-snip) - (define-class snip-admin% object% () #f - modified - popup-menu - update-cursor - release-snip - needs-update - recounted - resized - set-caret-owner - scroll-to - get-view - get-view-size - get-dc - get-editor) - (define-class snip-class% object% () #f - reading-version - write-header - read-header - read - get-classname - set-classname - get-version - set-version) - (define-private-class snip-class-list% snip-class-list<%> object% () #f - nth - number - add - find-position - find) - (define-class keymap% object% () #f - remove-chained-keymap - chain-to-keymap - set-break-sequence-callback - call-function - remove-grab-mouse-function - set-grab-mouse-function - remove-grab-key-function - set-grab-key-function - add-function - map-function - break-sequence - handle-mouse-event - handle-key-event - set-double-click-interval - get-double-click-interval) - (define-class editor-wordbreak-map% object% () #f - get-map - set-map) - (define-function get-the-editor-wordbreak-map) - (define-class text% editor% () #f - call-clickback - remove-clickback - set-clickback - set-wordbreak-func - set-autowrap-bitmap - on-reflow - on-new-tab-snip - on-new-string-snip - caret-hidden? - hide-caret - get-wordbreak-map - set-wordbreak-map - find-wordbreak - set-region-data - get-region-data - get-revision-number - after-merge-snips - after-split-snip - after-set-size-constraint - on-set-size-constraint - can-set-size-constraint? - after-set-position - after-change-style - on-change-style - can-change-style? - after-delete - on-delete - can-delete? - after-insert - on-insert - can-insert? - set-tabs - get-tabs - set-overwrite-mode - get-overwrite-mode - set-file-format - get-file-format - write-to-file - read-from-file - get-character - get-text - find-next-non-string-snip - get-snip-position - get-snip-position-and-location - find-snip - find-string-all - find-string - set-styles-sticky - get-styles-sticky - set-line-spacing - get-line-spacing - set-paragraph-alignment - set-paragraph-margins - last-paragraph - paragraph-end-line - paragraph-start-line - line-paragraph - paragraph-end-position - paragraph-start-position - position-paragraph - last-line - last-position - line-length - line-end-position - line-start-position - line-location - position-locations - position-location - position-line - set-between-threshold - get-between-threshold - find-position-in-line - find-line - find-position - split-snip - change-style - do-paste-x-selection - do-paste - do-copy - kill - paste-next - paste-x-selection - paste - copy - cut - erase - delete - insert - get-top-line-base - flash-off - flash-on - get-anchor - set-anchor - get-visible-line-range - get-visible-position-range - scroll-to-position - move-position - set-position-bias-scroll - set-position - get-end-position - get-start-position - get-position - default-style-name - get-flattened-text - put-file - get-file - after-edit-sequence - on-edit-sequence - after-load-file - on-load-file - can-load-file? - after-save-file - on-save-file - can-save-file? - on-new-box - on-new-image-snip - size-cache-invalid - invalidate-bitmap-cache - on-paint - write-footers-to-file - write-headers-to-file - read-footer-from-file - read-header-from-file - set-filename - release-snip - on-snip-modified - set-modified - scroll-editor-to - set-snip-data - get-snip-data - needs-update - resized - set-caret-owner - scroll-to - on-display-size-when-ready - on-display-size - on-change - on-focus - on-default-char - on-default-event - on-local-char - on-local-event - find-first-snip - get-space - get-descent - get-extent - blink-caret - own-caret - refresh - adjust-cursor - on-char - on-event - copy-self-to - copy-self) (define-class menu% object% () #f select get-font @@ -984,46 +595,13 @@ (define-class menu-item% object% () #f id) (define-function id-to-menu-item) - (define-class editor-stream-in-base% object% () #f - read - bad? - skip - seek - tell) - (define-class editor-stream-out-base% object% () #f - write - bad? - seek - tell) - (define-class editor-stream-in-bytes-base% editor-stream-in-base% () #f) - (define-class editor-stream-out-bytes-base% editor-stream-out-base% () #f - get-bytes) - (define-class editor-stream-in% object% () #f - ok? - jump-to - tell - skip - remove-boundary - set-boundary - get-inexact - get-exact - get-fixed - get-unterminated-bytes - get-bytes - get) - (define-class editor-stream-out% object% () #f - ok? - pretty-finish - jump-to - tell - put-fixed - put) (define-class timer% object% () () stop start notify interval) (define-private-class clipboard% clipboard<%> object% () #f + same-clipboard-client? get-clipboard-bitmap set-clipboard-bitmap get-clipboard-data @@ -1033,6 +611,7 @@ (define-function get-the-x-selection) (define-function get-the-clipboard) (define-class clipboard-client% object% () () + same-eventspace? get-types add-type get-data @@ -1063,123 +642,6 @@ get-command) (define-function show-print-setup) (define-function can-show-print-setup?) - (define-class pasteboard% editor% () #f - set-scroll-step - get-scroll-step - set-selection-visible - get-selection-visible - set-dragable - get-dragable - after-interactive-resize - on-interactive-resize - can-interactive-resize? - after-interactive-move - on-interactive-move - can-interactive-move? - interactive-adjust-resize - interactive-adjust-move - interactive-adjust-mouse - on-double-click - after-select - on-select - can-select? - after-reorder - on-reorder - can-reorder? - after-resize - on-resize - can-resize? - after-move-to - on-move-to - can-move-to? - after-delete - on-delete - can-delete? - after-insert - on-insert - can-insert? - find-next-selected-snip - is-selected? - find-snip - get-center - remove-selected - no-selected - add-selected - set-selected - change-style - set-after - set-before - lower - raise - resize - move - move-to - remove - erase - do-paste-x-selection - do-paste - do-copy - delete - insert - default-style-name - get-flattened-text - put-file - get-file - after-edit-sequence - on-edit-sequence - after-load-file - on-load-file - can-load-file? - after-save-file - on-save-file - can-save-file? - on-new-box - on-new-image-snip - size-cache-invalid - invalidate-bitmap-cache - on-paint - write-footers-to-file - write-headers-to-file - read-footer-from-file - read-header-from-file - write-to-file - read-from-file - set-filename - release-snip - on-snip-modified - set-modified - scroll-editor-to - set-snip-data - get-snip-data - needs-update - resized - set-caret-owner - scroll-to - on-display-size-when-ready - on-display-size - on-change - on-focus - on-default-char - on-default-event - on-local-char - on-local-event - find-first-snip - get-space - get-descent - get-extent - blink-caret - own-caret - refresh - adjust-cursor - on-char - on-event - copy-self-to - copy-self - kill - paste-x-selection - paste - copy - cut) (define-class panel% window% () #f get-label-position set-label-position @@ -1227,302 +689,6 @@ on-size on-set-focus on-kill-focus) - (define-class snip% object% () #f - previous - next - set-unmodified - get-scroll-step-offset - find-scroll-step - get-num-scroll-steps - set-admin - resize - write - match? - can-do-edit-operation? - do-edit-operation - blink-caret - own-caret - adjust-cursor - on-char - on-event - size-cache-invalid - copy - get-text! - get-text - merge-with - split - draw - partial-offset - get-extent - release-from-owner - is-owned? - set-style - set-flags - set-count - get-admin - get-count - get-flags - get-style - get-snipclass - set-snipclass) - (define-class string-snip% snip% () #f - read - insert - set-unmodified - get-scroll-step-offset - find-scroll-step - get-num-scroll-steps - set-admin - resize - write - match? - can-do-edit-operation? - do-edit-operation - blink-caret - own-caret - adjust-cursor - on-char - on-event - size-cache-invalid - copy - get-text! - get-text - merge-with - split - draw - partial-offset - get-extent) - (define-class tab-snip% string-snip% () #f - set-unmodified - get-scroll-step-offset - find-scroll-step - get-num-scroll-steps - set-admin - resize - write - match? - can-do-edit-operation? - do-edit-operation - blink-caret - own-caret - adjust-cursor - on-char - on-event - size-cache-invalid - copy - get-text! - get-text - merge-with - split - draw - partial-offset - get-extent) - (define-class image-snip% snip% (equal<%>) #f - equal-secondary-hash-code-of - equal-hash-code-of - other-equal-to? - equal-to? - set-offset - get-bitmap-mask - get-bitmap - set-bitmap - get-filetype - get-filename - load-file - set-unmodified - get-scroll-step-offset - find-scroll-step - get-num-scroll-steps - set-admin - resize - write - match? - can-do-edit-operation? - do-edit-operation - blink-caret - own-caret - adjust-cursor - on-char - on-event - size-cache-invalid - copy - get-text! - get-text - merge-with - split - draw - partial-offset - get-extent) - (define-class editor-snip% snip% () #f - get-inset - set-inset - get-margin - set-margin - style-background-used? - use-style-background - border-visible? - show-border - set-align-top-line - get-align-top-line - set-tight-text-fit - get-tight-text-fit - get-min-height - get-min-width - set-min-height - set-min-width - get-max-height - get-max-width - set-max-height - set-max-width - set-unmodified - get-scroll-step-offset - find-scroll-step - get-num-scroll-steps - set-admin - resize - write - match? - can-do-edit-operation? - do-edit-operation - blink-caret - own-caret - adjust-cursor - on-char - on-event - size-cache-invalid - copy - get-text! - get-text - merge-with - split - draw - partial-offset - get-extent - set-editor - get-editor) - (define-class editor-data-class% object% () #f - read - get-classname - set-classname) - (define-private-class editor-data-class-list% editor-data-class-list<%> object% () #f - nth - number - add - find-position - find) - (define-class editor-data% object% () #f - set-next - write - get-dataclass - set-dataclass - get-next) - (define-private-class mult-color% mult-color<%> object% () #f - set - get - get-r - set-r - get-g - set-g - get-b - set-b) - (define-private-class add-color% add-color<%> object% () #f - set - get - get-r - set-r - get-g - set-g - get-b - set-b) - (define-class style-delta% object% () #f - copy - collapse - equal? - set-delta-foreground - set-delta-background - set-delta-face - set-delta - get-family - set-family - get-face - set-face - get-size-mult - set-size-mult - get-size-add - set-size-add - get-weight-on - set-weight-on - get-weight-off - set-weight-off - get-smoothing-on - set-smoothing-on - get-smoothing-off - set-smoothing-off - get-style-on - set-style-on - get-style-off - set-style-off - get-underlined-on - set-underlined-on - get-underlined-off - set-underlined-off - get-size-in-pixels-on - set-size-in-pixels-on - get-size-in-pixels-off - set-size-in-pixels-off - get-transparent-text-backing-on - set-transparent-text-backing-on - get-transparent-text-backing-off - set-transparent-text-backing-off - get-foreground-mult - get-background-mult - get-foreground-add - get-background-add - get-alignment-on - set-alignment-on - get-alignment-off - set-alignment-off) - (define-private-class style% style<%> object% () #f - switch-to - set-shift-style - get-shift-style - is-join? - set-delta - get-delta - set-base-style - get-base-style - get-text-width - get-text-space - get-text-descent - get-text-height - get-transparent-text-backing - get-alignment - get-background - get-foreground - get-font - get-size-in-pixels - get-underlined - get-smoothing - get-style - get-weight - get-size - get-face - get-family - get-name) - (define-class style-list% object% () #f - forget-notification - notify-on-change - style-to-index - index-to-style - convert - replace-named-style - new-named-style - find-named-style - find-or-create-join-style - find-or-create-style - number - basic-style) - (define-function get-the-style-list) (define-class tab-group% item% () #f button-focus set @@ -1551,7 +717,6 @@ (define-functions special-control-key special-option-key - map-command-as-meta-key application-file-handler application-quit-handler application-about-handler @@ -1576,20 +741,19 @@ shortcut-visible-in-label? eventspace-shutdown? in-atomic-region - set-editor-snip-maker - set-text-editor-maker - set-pasteboard-editor-maker set-menu-tester location->window set-dialogs set-executer send-event file-creator-and-type - set-snip-class-getter - set-editor-data-class-getter set-ps-procs main-eventspace? - eventspace-handler-thread) + eventspace-handler-thread + begin-refresh-sequence + end-refresh-sequence + run-printout + get-double-click-time) ) ;; end diff --git a/collects/mred/private/moredialogs.ss b/collects/mred/private/moredialogs.ss index 6dbc0e9ca8..3f9b1fc570 100644 --- a/collects/mred/private/moredialogs.ss +++ b/collects/mred/private/moredialogs.ss @@ -3,6 +3,7 @@ mzlib/etc mzlib/list (prefix wx: "kernel.ss") + (prefix wx: "wxme/style.ss") "lock.ss" "const.ss" "check.ss" diff --git a/collects/mred/private/mrmenu.ss b/collects/mred/private/mrmenu.ss index e04f625025..907e42505a 100644 --- a/collects/mred/private/mrmenu.ss +++ b/collects/mred/private/mrmenu.ss @@ -3,6 +3,7 @@ mzlib/class100 mzlib/list (prefix wx: "kernel.ss") + (prefix wx: "wxme/keymap.ss") "lock.ss" "const.ss" "helper.ss" @@ -285,11 +286,12 @@ ":" "")]) (case (system-type) - [(unix windows) (format "~a~a~a~a~a?:~a" + [(unix windows) (format "~a~a~a~a?:~a" exact (if (memq 'shift prefix) "s:" "") - (if (memq 'meta prefix) "m:" "~m:") - (if (memq 'alt prefix) "m:" "~m:") + (if (or (memq 'meta prefix) + (memq 'alt prefix)) + "m:" "~m:") (if (memq 'ctl prefix) "c:" "") base)] [(macosx) (format "~a~a~a~a~a?:~a" diff --git a/collects/mred/private/mrpopup.ss b/collects/mred/private/mrpopup.ss index b9b7f77e28..81a75c6228 100644 --- a/collects/mred/private/mrpopup.ss +++ b/collects/mred/private/mrpopup.ss @@ -3,6 +3,7 @@ mzlib/class100 mzlib/list (prefix wx: "kernel.ss") + (prefix wx: "wxme/cycle.ss") "lock.ss" "const.ss" "helper.ss" @@ -63,4 +64,6 @@ (wx:queue-callback go wx:middle-queue-key) (go)))) (no-val->#f font))) - (super-init wx))))))) + (super-init wx)))))) + + (wx:set-popup-menu%! popup-menu%)) diff --git a/collects/mred/private/path-dialog.ss b/collects/mred/private/path-dialog.ss index 464eedc840..9b81def88a 100644 --- a/collects/mred/private/path-dialog.ss +++ b/collects/mred/private/path-dialog.ss @@ -1,6 +1,7 @@ (module path-dialog mzscheme (require mzlib/class mzlib/list mzlib/string mzlib/file (prefix wx: "kernel.ss") + (prefix wx: "wxme/style.ss") "helper.ss" "mrtop.ss" "mritem.ss" "mrpanel.ss" "mrtextfield.ss" "messagebox.ss" "mrmenu.ss" (only scheme/base compose)) (provide path-dialog%) diff --git a/collects/mred/private/repl.ss b/collects/mred/private/repl.ss index f5c9b7f2f7..8f406c19a9 100644 --- a/collects/mred/private/repl.ss +++ b/collects/mred/private/repl.ss @@ -2,6 +2,7 @@ (require mzlib/class mzlib/class100 (prefix wx: "kernel.ss") + (prefix wx: "wxme/style.ss") "editor.ss" "app.ss" "mrtop.ss" diff --git a/collects/mred/private/seqcontract.ss b/collects/mred/private/seqcontract.ss index c16fd39c57..0bfe0b5bad 100644 --- a/collects/mred/private/seqcontract.ss +++ b/collects/mred/private/seqcontract.ss @@ -245,7 +245,7 @@ Matthew (not (locked-for-read?))) (set-position [(x) (x y) (x y z) (x y z p) (x y z p q)] unlocked) (set-autowrap-bitmap [(bitmap)] unlocked) - (print-to-dc [(dc)] unlocked) + (print-to-dc [(dc) (dc page)] unlocked) (move-position [(code?) (code? extend) (code? extend kind)] unlocked) (split-snip [(pos)] unlocked) (set-line-spacing [(space)] unlocked) diff --git a/collects/mred/private/snipfile.ss b/collects/mred/private/snipfile.ss index 11379e4187..bd8ba41fde 100644 --- a/collects/mred/private/snipfile.ss +++ b/collects/mred/private/snipfile.ss @@ -4,6 +4,8 @@ mzlib/port syntax/moddep (prefix wx: "kernel.ss") + (prefix wx: "wxme/snip.ss") + (prefix wx: "wxme/cycle.ss") "check.ss" "editor.ss") @@ -50,10 +52,10 @@ (error 'load-class "not a ~a% instance" id)))) #f)))]) ;; install the getters: - (wx:set-snip-class-getter + (wx:set-get-snip-class! (lambda (name) (load-one name 'snip-class wx:snip-class%))) - (wx:set-editor-data-class-getter + (wx:set-get-editor-data-class! (lambda (name) (load-one name 'editor-data-class wx:editor-data-class%)))) diff --git a/collects/mred/private/syntax.ss b/collects/mred/private/syntax.ss new file mode 100644 index 0000000000..c195293b23 --- /dev/null +++ b/collects/mred/private/syntax.ss @@ -0,0 +1,266 @@ +#lang scheme/base +(require scheme/class + scheme/stxparam + (for-syntax scheme/base)) + +(provide defclass defclass* + def/public def/override define/top case-args + maybe-box? any? bool? nonnegative-real? make-or-false make-box make-list make-alts + make-literal symbol-in make-procedure + method-name init-name + let-boxes + properties field-properties init-properties + ->long) + +(define-syntax-parameter class-name #f) + +(define-syntax-rule (defclass name super . body) + (defclass* name super () . body)) +(define-syntax-rule (defclass* name super intfs . body) + (define name + (syntax-parameterize ([class-name 'name]) + (class* super intfs . body)))) + +(define-syntax (def/public stx) + #`(def/thing define/public #,stx)) +(define-syntax (def/override stx) + #`(def/thing define/override #,stx)) +(define-syntax (define/top stx) + #`(def/thing define #,stx)) + +(define (method-name class method) + (string->symbol (format "~a in ~a" method class))) +(define (init-name class) + (string->symbol (format "initialization for ~a" class))) + +(define-syntax just-id + (syntax-rules () + [(_ [id default]) id] + [(_ id) id])) + +(define-struct named-pred (pred make-name) + #:property prop:procedure (struct-field-index pred)) + +(define (apply-pred pred val) + (cond + [(procedure? pred) (pred val)] + [(class? pred) (val . is-a? . pred)] + [(interface? pred) (val . is-a? . pred)] + [else (error 'check-arg "unknown predicate type: ~e" pred)])) + +(define (make-or-false pred) + (make-named-pred (lambda (v) + (or (not v) (apply-pred pred v))) + (lambda () + (string-append (predicate-name pred) + " or #f")))) + +(define (make-box pred) + (make-named-pred (lambda (v) + (and (box? v) (apply-pred pred (unbox v)))) + (lambda () + (string-append "boxed " (predicate-name pred))))) + +(define (make-list pred) + (make-named-pred (lambda (v) + (and (list? v) (andmap (lambda (v) (apply-pred pred v)) v))) + (lambda () + (string-append "list of " (predicate-name pred))))) + +(define (make-alts a b) + (make-named-pred (lambda (v) + (or (apply-pred a v) (apply-pred b v))) + (lambda () + (string-append (predicate-name a) + " or " + (predicate-name b))))) + +(define (make-literal lit) + (make-named-pred (lambda (v) (equal? v lit)) + (lambda () (if (symbol? lit) + (format "'~s" lit) + (format "~s" lit))))) + +(define (make-symbol syms) + (make-named-pred (lambda (v) (memq v syms)) + (lambda () + (let loop ([syms syms]) + (cond + [(null? (cdr syms)) + (format "'~s" (car syms))] + [(null? (cddr syms)) + (format "'~s, or '~s" (car syms) (cadr syms))] + [else + (format "'~s, ~a" (car syms) (loop (cdr syms)))]))))) +(define-syntax-rule (symbol-in sym ...) + (make-symbol '(sym ...))) + +(define (make-procedure arity) + (make-named-pred (lambda (p) + (and (procedure? p) + (procedure-arity-includes? p arity))) + (lambda () + (format "procedure (arity ~a)" arity)))) + +(define (check-arg val pred pos) + (if (apply-pred pred val) + #f + (cons (predicate-name pred) + pos))) + +(define (predicate-name pred) + (cond + [(named-pred? pred) ((named-pred-make-name pred))] + [(procedure? pred) (let ([s (symbol->string (object-name pred))]) + (substring s 0 (sub1 (string-length s))))] + [(or (class? pred) (interface? pred)) + (format "~a instance" (object-name pred))] + [else "???"])) + +(define maybe-box? (make-named-pred (lambda (v) (or (not v) (box? v))) + (lambda () "box or #f"))) +(define (any? v) #t) +(define (bool? v) #t) +(define (nonnegative-real? v) (and (real? v) (v . >= . 0))) + +(define (method-of cls nam) + (if cls + (string->symbol (format "~a method of ~a" nam cls)) + nam)) + +(define-syntax (def/thing stx) + (syntax-case stx () + [(_ define/orig (_ (id [arg-type arg] ...))) + (raise-syntax-error #f "missing body" stx)] + [(_ define/orig (_ (id [arg-type arg] ...) . body)) + (with-syntax ([(_ _ orig-stx) stx] + [(pos ...) (for/list ([i (in-range (length (syntax->list #'(arg ...))))]) + i)] + [cname (syntax-parameter-value #'class-name)]) + (syntax/loc #'orig-stx + (define/orig (id arg ...) + (let ([bad (or (check-arg (just-id arg) arg-type pos) + ...)]) + (when bad + (raise-type-error (method-of 'cname 'id) (car bad) (cdr bad) (just-id arg) ...))) + (let () + . body))))])) + +(define-for-syntax lifted (make-hash)) +(define-syntax (lift-predicate stx) + (syntax-case stx () + [(_ id) (identifier? #'id) #'id] + [(_ expr) + (let ([d (syntax->datum #'expr)]) + (or (hash-ref lifted d #f) + (let ([id (syntax-local-lift-expression #'expr)]) + (hash-set! lifted d id) + id)))])) + +(define-syntax (case-args stx) + (syntax-case stx () + [(_ expr [([arg-type arg] ...) rhs ...] ... who) + (with-syntax ([((min-args-len . max-args-len) ...) + (map (lambda (args) + (let ([args (syntax->list args)]) + (cons (let loop ([args args]) + (if (or (null? args) + (not (identifier? (car args)))) + 0 + (add1 (loop (cdr args))))) + (length args)))) + (syntax->list #'((arg ...) ...)))]) + #'(let* ([args expr] + [len (length args)]) + (find-match + (lambda (next) + (if (and (len . >= . min-args-len) + (len . <= . max-args-len)) + (apply + (lambda (arg ...) + (if (and (not (check-arg (just-id arg) (lift-predicate arg-type) 0)) ...) + (lambda () rhs ...) + next)) + args) + next)) + ... + (lambda (next) + (bad-args who args)))))])) + +(define (bad-args who args) + (error who "bad argument combination:~a" + (apply string-append (map (lambda (x) (format " ~e" x)) + args)))) + +(define-syntax find-match + (syntax-rules () + [(_ proc) + ((proc #f))] + [(_ proc1 proc ...) + ((proc1 (lambda () (find-match proc ...))))])) + +(define-syntax-rule (let-boxes ([id init] ...) + call + body ...) + (let ([id (box init)] ...) + call + (let ([id (unbox id)] ...) + body ...))) + +(define-syntax (do-properties stx) + (syntax-case stx () + [(_ define-base check-immutable [[type id] expr] ...) + (let ([ids (syntax->list #'(id ...))]) + (with-syntax ([(getter ...) + (map (lambda (id) + (datum->syntax id + (string->symbol + (format "get-~a" (syntax-e id))) + id)) + ids)] + [(setter ...) + (map (lambda (id) + (datum->syntax id + (string->symbol + (format "set-~a" (syntax-e id))) + id)) + ids)]) + #'(begin + (define-base id expr) ... + (define/public (getter) id) ... + (def/public (setter [type v]) (check-immutable 'setter) (set! id (coerce type v))) ...)))])) + +(define-syntax coerce + (syntax-rules (bool?) + [(_ bool? v) (and v #t)] + [(_ _ v) v])) + +(define-syntax properties + (syntax-rules () + [(_ #:check-immutable check-immutable . props) + (do-properties define check-immutable . props)] + [(_ . props) + (do-properties define void . props)])) +(define-syntax field-properties + (syntax-rules () + [(_ #:check-immutable check-immutable . props) + (do-properties define-field check-immutable . props)] + [(_ . props) + (do-properties define-field void . props)])) +(define-syntax-rule (define-field id val) (field [id val])) +(define-syntax init-properties + (syntax-rules () + [(_ #:check-immutable check-immutable . props) + (do-properties define-init check-immutable . props)] + [(_ . props) + (do-properties define-init void . props)])) +(define-syntax-rule (define-init id val) (begin + (init [(internal id) val]) + (define id internal))) + +(define (->long i) + (cond + [(eqv? -inf.0 i) (- (expt 2 64))] + [(eqv? +inf.0 i) (expt 2 64)] + [(eqv? +nan.0 i) 0] + [else (inexact->exact (floor i))])) diff --git a/collects/mred/private/wxcanvas.ss b/collects/mred/private/wxcanvas.ss index 8f926a6b4d..2bef5bab98 100644 --- a/collects/mred/private/wxcanvas.ss +++ b/collects/mred/private/wxcanvas.ss @@ -2,6 +2,8 @@ (require mzlib/class mzlib/class100 (prefix wx: "kernel.ss") + (prefix wx: "wxme/text.ss") + (prefix wx: "wxme/editor-canvas.ss") "lock.ss" "helper.ss" "wx.ss" @@ -216,6 +218,11 @@ (when mred (as-exit (lambda () (send init-buffer add-canvas mred))))))))) - (define wx-editor-canvas% (make-canvas-glue% - (make-editor-canvas% (make-control% wx:editor-canvas% - 0 0 #t #t))))) + (define wx-editor-canvas% + (class (make-canvas-glue% + (make-editor-canvas% (make-control% wx:editor-canvas% + 0 0 #t #t))) + (inherit editor-canvas-on-scroll) + (define/override (on-scroll e) + (editor-canvas-on-scroll)) + (super-new)))) diff --git a/collects/mred/private/wxme/const.ss b/collects/mred/private/wxme/const.ss new file mode 100644 index 0000000000..37c0eb4aa5 --- /dev/null +++ b/collects/mred/private/wxme/const.ss @@ -0,0 +1,5 @@ +#lang scheme/base + +(provide (all-defined-out)) + +(define CURSOR-WIDTH 2) diff --git a/collects/mred/private/wxme/cycle.ss b/collects/mred/private/wxme/cycle.ss new file mode 100644 index 0000000000..7bc9556321 --- /dev/null +++ b/collects/mred/private/wxme/cycle.ss @@ -0,0 +1,27 @@ +#lang scheme/base + +(define-syntax-rule (decl id set-id) + (begin + (provide id set-id) + (define id #f) + (define (set-id v) (set! id v)))) + +(decl text% set-text%!) +(decl pasteboard% set-pasteboard%!) +(decl snip-admin% set-snip-admin%!) +(decl editor-stream-in% set-editor-stream-in%!) +(decl editor-stream-out% set-editor-stream-out%!) +(decl editor-snip% set-editor-snip%!) +(decl editor-snip-editor-admin% set-editor-snip-editor-admin%!) + +(decl extended-editor-snip% set-extended-editor-snip%!) +(decl extended-text% set-extended-text%!) +(decl extended-pasteboard% set-extended-pasteboard%!) + +(decl get-snip-class set-get-snip-class!) +(decl get-editor-data-class set-get-editor-data-class!) + +(decl editor-get-file set-editor-get-file!) +(decl editor-put-file set-editor-put-file!) + +(decl popup-menu% set-popup-menu%!) diff --git a/collects/mred/private/wxme/editor-admin.ss b/collects/mred/private/wxme/editor-admin.ss new file mode 100644 index 0000000000..8ece0cf2e4 --- /dev/null +++ b/collects/mred/private/wxme/editor-admin.ss @@ -0,0 +1,57 @@ +#lang scheme/base +(require scheme/class + "../syntax.ss" + "snip.ss" + "private.ss" + (only-in "cycle.ss" popup-menu%)) + +(provide editor-admin%) + +(defclass editor-admin% object% + (super-new) + + (define standard 0) ; used to recognize standard display + (define/public (get-s-standard) standard) + (define/public (set-s-standard v) (set! standard v)) + + (def/public (get-dc [maybe-box? [x #f]] [maybe-box? [y #f]]) + (when x (set-box! x 0.0)) + (when y (set-box! y 0.0)) + #f) + + (define/private (do-get-view x y w h) + (when x (set-box! x 0.0)) + (when y (set-box! y 0.0)) + (when w (set-box! w 0.0)) + (when h (set-box! h 0.0))) + + (def/public (get-view [maybe-box? x] [maybe-box? y] + [maybe-box? w] [maybe-box? h] + [any? [full? #f]]) + (do-get-view x y w h)) + + (def/public (get-max-view [maybe-box? x] [maybe-box? y] + [maybe-box? w] [maybe-box? h] + [any? [full? #f]]) + (get-view x y w h)) + + (def/public (scroll-to [real? localx] [real? localy] [real? w] [real? h] [any? [refresh? #t]] + [(symbol-in start none end) [bias 'none]]) + (void)) + + (def/public (grab-caret [(symbol-in immediate display global) dist]) + (void)) + + (def/public (resized [any? redraw-now]) (void)) + + (def/public (needs-update [real? x] [real? y] + [nonnegative-real? w] [nonnegative-real? h]) + (void)) + + (def/public (update-cursor) (void)) + + (def/public (delay-refresh?) #f) + + (def/public (popup-menu [popup-menu% m] [real? x] [real? y]) #f) + + (def/public (modified [any? mod?]) (void))) diff --git a/collects/mred/private/wxme/editor-canvas.ss b/collects/mred/private/wxme/editor-canvas.ss new file mode 100644 index 0000000000..cec33592a0 --- /dev/null +++ b/collects/mred/private/wxme/editor-canvas.ss @@ -0,0 +1,1133 @@ +#lang scheme/base +(require scheme/class + "../syntax.ss" + "editor.ss" + "editor-admin.ss" + "private.ss" + (only-in "cycle.ss" popup-menu%) + "wx.ss") + +(provide editor-canvas%) + +;; FIXME: need contracts on public classes + +;; ---------------------------------------- + +(define simple-scroll% + (class object% + (define horizontal #f) + (define count 0) + (define page-step 0) + (define value 0) + + (init canvas + style + length + steps-per-page + position) + + (super-new) + + (set! count length) + (set! page-step steps-per-page) + (set! value position) + + (set! horizontal (and (memq 'horizontal style) #t)) + (set-scroll length steps-per-page position) + + (define/public (set-value position) + (set! value (max 0 (min count position)))) + + (define/public (set-scroll length steps-per-page position) + (when (length . > . -1) + (set! count length)) + (when (steps-per-page . > . 0) + (set! page-step steps-per-page)) + (when (position . > . -1) + (set! value position)) + + (when (value . < . 0) + (set! value 0)) + (when (value . > . count) + (set! value count))) + + (define/public (get-value) + value))) + +;; ---------------------------------------- + +(define update-cursor-timer% + (class timer% + (inherit start stop) + (init-field admin) + + (super-new) + + (define/override (notify) + (stop) + (when admin + (send admin clear-update-cursor-timer) + (send (send admin get-canvas) update-cursor-now))) + + (define/public (cancel) + (set! admin #f)))) + +;; ---------------------------------------- + +(define BLINK-DELAY 500) + +(define blink-timer% + (class timer% + (inherit stop) + (init-field canvas) + + (super-new) + + (define/override (notify) + (when canvas + (send canvas blink-caret))) + + (define/public (kill) + (set! canvas #f) + (stop)))) + +;; ---------------------------------------- + +(define AUTO-DRAG-DELAY 100) + +(define auto-drag-timer% + (class timer% + (inherit start stop) + (init-field canvas event) + + (super-new) + + (start AUTO-DRAG-DELAY #t) + + (define/override (notify) + (when canvas + (let ([e (make-object mouse-event% (send event get-event-type))]) + (send e set-alt-down (send event get-alt-down)) + (send e set-caps-down (send event get-caps-down)) + (send e set-control-down (send event get-control-down)) + (send e set-left-down (send event get-left-down)) + (send e set-meta-down (send event get-meta-down)) + (send e set-middle-down (send event get-middle-down)) + (send e set-right-down (send event get-right-down)) + (send e set-shift-down (send event get-shift-down)) + (send e set-x (send event get-x)) + (send e set-y (send event get-y)) + (send e set-time-stamp + (+ (send e get-time-stamp) AUTO-DRAG-DELAY)) + (send canvas on-event event)))) + + (define/public (kill) + (set! canvas #f) + (stop)))) + +;; ---------------------------------------- + +(define default-wheel-amt 3) + +(define (INIT-SB style) + (append + (if (or (memq 'no-hscroll style) + (memq 'hide-hscroll style)) + null + '(hscroll)) + (if (or (memq 'no-vscroll style) + (memq 'hide-vscroll style)) + null + '(vscroll)))) + +(define (memq? s l) (and (memq s l) #t)) + +(define (keep-style l s) (if (memq s l) (list s) null)) + +(defclass editor-canvas% canvas% + + (inherit refresh get-canvas-background get-dc + get-client-size get-size set-cursor + get-scroll-pos set-scroll-pos + get-scroll-page set-scroll-page + get-scroll-range set-scroll-range + is-shown-to-root? + show-scrollbars) + + (define blink-timer #f) + (define noloop? #f) + + (define focuson? #f) + (define focusforcedon? #f) + (define/public (get-focusforcedon?) focusforcedon?) + (define lazy-refresh? #f) + (define need-refresh? #f) + + (define auto-dragger #f) + + (define custom-cursor #f) + (define custom-cursor-on? #f) + + (define scroll-to-last? #f) + (define scroll-bottom-based? #f) + (define scroll-offset 0) + + (define lastwidth -1) + (define lastheight -1) + + (define last-x 0) + (define last-y 0) + + (define bg-color #f) + + (define wheel-amt default-wheel-amt) + (define xmargin 5) + (define ymargin 5) + + (set! noloop? #t) + (init parent x y width height + name style + [scrolls-per-page 100] + [editor #f] + [gl-config #f]) + + (super-make-object parent + x y width height + (append (keep-style style 'border) + (INIT-SB style) + (keep-style style 'invisible) + (if (memq 'transparent style) + '(transparent) + '(no-autoclear)) + (keep-style style 'control-border) + (keep-style style 'combo-side) + (keep-style style 'resize-corner)) + name + gl-config) + + (define given-h-scrolls-per-page scrolls-per-page) + + (define allow-x-scroll? (not (memq 'no-hscroll style))) + (define allow-y-scroll? (not (memq 'no-vscroll style))) + + (define fake-x-scroll? (or (not allow-x-scroll?) + (memq? 'hide-hscroll style))) + (define fake-y-scroll? (or (not allow-y-scroll?) + (memq? 'hide-vscroll style))) + + (define auto-x? (and (not fake-x-scroll?) + (memq? 'auto-hscroll style))) + (define auto-y? (and (not fake-y-scroll?) + (memq? 'auto-vscroll style))) + + (define xscroll-on? (and (not fake-x-scroll?) (not auto-x?))) + (define yscroll-on? (and (not fake-y-scroll?) (not auto-y?))) + + (show-scrollbars xscroll-on? yscroll-on?) + (super set-scrollbars + 1 1 ;; Windows fake-{x,y}-scroll => -1 instead of 1 !? + 1 1 ;; + 1 1 0 0 #f) + + (define hscroll + (if fake-x-scroll? + (new simple-scroll% + [canvas this] + [style '(horizontal)] + [length 0] + [steps-per-page 1] + [position 0]) + #f)) + (define vscroll + (if fake-y-scroll? + (new simple-scroll% + [canvas this] + [style '(vertical)] + [length 0] + [steps-per-page 1] + [position 0]) + #f)) + + (define scroll-width (if fake-x-scroll? 1 1)) ;; else used to be 0 + (define scroll-height (if fake-y-scroll? 1 1)) + + (define hscrolls-per-page 1) + (define vscrolls-per-page 1) + (define hpixels-per-scroll 0) + + (set! noloop? #f) + + (define admin (new canvas-editor-admin% + [canvas this])) + (send admin adjust-std-flag) + + (define media editor) + (when media (set-editor media)) + + ;; FIXME: needed? + (define/public (~) + (when auto-dragger + (send auto-dragger kill) + (set! auto-dragger #f)) + (when blink-timer + (send blink-timer kill) + (set! blink-timer #f)) + (send admin set-canvas #f) + #;(super ~)) + + (define/override (on-size w h) + (unless noloop? + (unless (and (= w lastwidth) + (= h lastheight)) + (unless (and media + (send media get-printing)) + (reset-size))))) + + (define/private (reset-size) + (reset-visual #f) + (refresh)) + + (define/public (set-x-margin x) + (unless (= x xmargin) + (set! xmargin x) + (reset-size))) + (define/public (set-y-margin y) + (unless (= y ymargin) + (set! ymargin y) + (reset-size))) + (define/public (get-x-margin) xmargin) + (define/public (get-y-margin) ymargin) + + (define/override (set-canvas-background c) + (super set-canvas-background c) + (refresh)) + + (define-syntax-rule (using-admin body ...) + (let ([oldadmin (send media get-admin)]) + (unless (eq? admin oldadmin) + (send media set-admin admin)) + (begin0 + (begin body ...) + (when media + (unless (eq? admin oldadmin) + ;; FIXME: how do we know that this adminstrator + ;; still wants the editor? + (send media set-admin oldadmin)))))) + + (define/private (get-eventspace) + (send (send this get-top-level) get-eventspace)) + + (define/private (on-focus focus?) + (unless (eq? focus? focuson?) + (set! focuson? focus?) + (when (and media + (not (send media get-printing))) + (using-admin + (when media + (send media own-caret focus?)))) + (when focuson? + (unless blink-timer + (set! blink-timer (parameterize ([current-eventspace (get-eventspace)]) + (new blink-timer% [canvas this])))) + (send blink-timer start BLINK-DELAY #t)))) + + (define/public (blink-caret) + (when focuson? + (when media + (using-admin + (when media + (send media blink-caret)))) + (send blink-timer start BLINK-DELAY #t))) + + (define/public (call-as-primary-owner thunk) + (if media + (using-admin + (thunk)) + (thunk))) + + (define/override (on-set-focus) + (on-focus #t)) + (define/override (on-kill-focus) + (on-focus #f)) + + (define/public (is-focus-on?) focuson?) + + (define (force-display-focus on?) + (let ([old-on? focusforcedon?]) + (set! focusforcedon? on?) + (send admin adjust-std-flag) + (when (not (equal? (or focuson? focusforcedon?) + (or focuson? old-on?))) + (refresh)))) + + + (define/override (on-event event) + ;; Turn off auto-dragger, if there is one + (when auto-dragger + (send auto-dragger kill) + (set! auto-dragger #f)) + + (let ([x (send event get-x)] + [y (send event get-y)]) + (set! last-x x) + (set! last-y y) + + (when (and media + (not (send media get-printing))) + (using-admin + (when media + (set-custom-cursor + (send media adjust-cursor event))) + (when media + (send media on-event event)))) + + (when (send event dragging?) + (let-boxes ([cw 0] + [ch 0]) + (get-client-size cw ch) + (when (or (x . < . 0) + (y . < . 0) + (x . > . cw) + (y . > . ch)) + ;; Dragging outside the canvas: auto-generate more events because the buffer + ;; is probably scrolling. But make sure we're shown. + (when (is-shown-to-root?) + (set! auto-dragger (parameterize ([current-eventspace (get-eventspace)]) + (new auto-drag-timer% + [canvas this] + [event event]))))))))) + + (define/private (update-cursor-now) + (when media + (let ([e (new mouse-event% [type 'motion])]) + (send e set-x last-x) + (send e set-y last-y) + (send e set-timestamp 0) + + (using-admin + (when media + (set-custom-cursor (send media adjust-cursor e))))))) + + (define/public (popup-for-editor b m) #f) + + (define/override (on-char event) + (let ([code (send event get-key-code)]) + (case (and (positive? wheel-amt) + code) + [(wheel-up wheel-down) + (when (and allow-y-scroll? + (not fake-y-scroll?)) + (let-boxes ([x 0] + [y 0]) + (get-scroll x y) + (let ([y (max (+ y + (if (eq? code 'wheel-up) + -1 + 1)) + 0)]) + (scroll x y #t))))] + [else + (when (and media (not (send media get-printing))) + (using-admin + (when media + (send media on-char event))))]))) + + (define/public (clear-margins) + ;; This method is called by `on-paint' in `editor-canvas%' + ;; before it calls the `on-paint' in `canvas%'. It's + ;; essentially a compromise between autoclear mode and + ;; no-autoclear mode. + + (when (or (positive? xmargin) + (positive? ymargin)) + (let ([bg (get-canvas-background)]) + (when bg + (let ([cw (box 0)] + [ch (box 0)] + [b (send the-brush-list find-or-create-brush bg 'solid)] + [p (send the-pen-list find-or-create-pen "BLACK" 0 'transparent)] + [dc (get-dc)]) + (get-client-size cw ch) + (let ([ob (send dc get-brush)] + [op (send dc get-pen)] + [cw (unbox cw)] + [ch (unbox ch)]) + (send dc set-brush b) + (send dc set-pen p) + + (send dc draw-rectangle 0 0 xmargin ch) + (send dc draw-rectangle (- cw xmargin) 0 cw ch) + (send dc draw-rectangle 0 0 cw ymargin) + (send dc draw-rectangle 0 (- ch ymargin) cw ch) + + (send dc set-brush ob) + (send dc set-pen op))))))) + + (define/override (on-paint) + (set! need-refresh? #f) + (if media + (when (not (send media get-printing)) + (let-boxes ([x 0][y 0][w 0][h 0]) + (get-view x y w h) + (redraw x y w h))) + (let ([bg (get-canvas-background)]) + (when bg + (let ([adc (get-dc)]) + (send adc set-background bg) + (send adc clear))))) + (super on-paint)) + + (define/public (repaint) + (unless need-refresh? + (if (or lazy-refresh? (not (get-canvas-background))) + (begin + (set! need-refresh? #t) + (refresh)) + (on-paint)))) + + (define/private (paint-scrolls) (void)) + + (define/public (set-lazy-refresh on?) + (set! lazy-refresh? on?) + (when (and (not on?) + need-refresh?) + (on-paint))) + + (define (get-lazy-refresh) lazy-refresh?) + + (define/public (set-custom-cursor cursor) + (if (not cursor) + (no-custom-cursor) + (begin + (set! custom-cursor-on? #t) + (set! custom-cursor cursor) + (set-cursor custom-cursor)))) + + (define arrow #f) + (define/public (no-custom-cursor) + (when (not arrow) + (set! arrow (make-object cursor% 'arrow))) + (when custom-cursor-on? + (set! custom-cursor-on? #f) + (set-cursor arrow))) + + + (define/public (get-dc-and-offset fx fy) + (when (or fx fy) + (let-boxes ([x 0] + [y 0]) + (get-scroll x y) + (when fx + (set-box! fx (- (* x hpixels-per-scroll) xmargin))) + (when fy + (if (and media + (or (positive? y) + scroll-bottom-based?)) + (let ([v (- (send media scroll-line-location (+ y scroll-offset)) + ymargin)]) + (set-box! fy v) + (when (and scroll-bottom-based? + (or (positive? scroll-height) + scroll-to-last?)) + (let-boxes ([w 0] [h 0]) + (get-client-size w h) + (let ([h (max (- h (* 2 ymargin)) + 0)]) + (set-box! fy (- (unbox fy) h)))))) + (set-box! fy (- ymargin)))))) + (get-dc)) + + (define/public (get-view fx fy fw fh [unused-full? #f]) + (let ([w (box 0)] + [h (box 0)]) + (get-client-size w h) + (get-dc-and-offset fx fy) + (when fx + (set-box! fx (+ (unbox fx) xmargin))) + (when fy + (set-box! fy (+ (unbox fy) ymargin))) + (when fh + (set-box! fh (max 0 (- (unbox h) (* 2 ymargin))))) + (when fw + (set-box! fw (max 0 (- (unbox w) (* 2 xmargin))))))) + + (define/public (redraw localx localy fw fh) + (when (and media + (not (send media get-printing))) + (begin-refresh-sequence) + (let ([x (box 0)] + [y (box 0)] + [w (box 0)] + [h (box 0)]) + (get-view x y w h) + (let ([x (unbox x)] + [y (unbox y)] + [w (unbox w)] + [h (unbox h)]) + (let ([right (+ x w)] + [bottom (+ y h)]) + (let ([x (max x localx)] + [y (max y localy)] + [right (min right (+ localx fw))] + [bottom (min bottom (+ localy fh))]) + (let ([w (max 0 (- right x))] + [h (max 0 (- bottom y))]) + (when (or (positive? w) + (positive? h)) + (using-admin + (when media + (send media refresh + x y w h + (if (or focuson? focusforcedon?) + 'show-caret + 'show-inactive-caret) + (get-canvas-background)))))))))) + (end-refresh-sequence))) + + + (def/public (scroll-to [real? localx] [real? localy] [real? fw] [real? fh] [any? refresh?] + [(symbol-in start none end) [bias 'none]]) + (let ([med media]) + (if (or (not med) + (send med get-printing) + (and (not allow-x-scroll?) + (not allow-y-scroll?))) + #f + (let-boxes ([x 0] + [y 0] + [iw 0] + [ih 0]) + (get-view x y iw ih) + (if (or (zero? iw) + (zero? ih)) + #f + (let ([find-dy (if scroll-bottom-based? + ih + 0)]) + (let-boxes ([cx 0] + [cy 0]) + (get-scroll cx cy) + (let ([sy + (if allow-y-scroll? + (cond + [(or + ;; doesn't fit and bias is set: + (and (eq? bias 'start) (fh . > . ih)) + ;; fits, need to shift down into view: + (and (fh . <= . ih) (localy . < . y) ) + ;; doesn't fit, no conflicting bias, can shift up to see more: + (and (fh . > . ih) (not (eq? bias 'end)) (localy . < . y))) + (- (send med find-scroll-line (+ find-dy localy)) + scroll-offset)] + [(or + ;; doesn't fit, bias is set: + (and (eq? bias 'end) (fh . > . ih)) + ;; fits, need to shift up into view: + (and (fh . <= . ih) ((+ y ih) . < . (+ localy fh)))) + (let ([l (+ find-dy localy (- fh ih))]) + ;; find scroll pos for top of region to show: + (let ([sy (send med find-scroll-line l)]) + ;; unless l is exactly the top of a line, move down to the next whole line: + (let ([sy (if (= (send med scroll-line-location sy) l) + sy + (+ sy 1))]) + (- sy scroll-offset))))] + [(or + ;; doesn't fit, no conflicting bias, maybe shift down to see more: + (and (fh . > . ih) + (not (eq? bias 'start)) + ((+ localy fh) . > . (+ y ih)))) + ;; shift to one more than the first scroll position that shows last line + (let ([my (+ (send med find-scroll-line (+ find-dy localy (- fh ih))) + (- 1 scroll-offset))]) + ;; but only shift down the extra line if doing so doesn't skip the whole area + (cond + [((send med scroll-line-location my) . < . (+ find-dy localy fh)) + my] + [(my . > . 0) + (- my 1)] + [else 0]))] + [else cy]) + cy)] + [sx + (if allow-x-scroll? + (if (positive? hpixels-per-scroll) + (cond + [(or (and (eq? bias 'start) (fw . > . iw)) + (and (fw . < . iw) (localx . < . x)) + (and (fw . > . iw) (not (eq? bias 'end)) (localx . < . x))) + (quotient localx hpixels-per-scroll)] + [(or (and (eq? bias 'end) (fw . > . iw)) + (and (fw . < . iw) ((+ x iw) . < . (+ localx fw))) + (and (fw . > . iw) (not (eq? bias 'start)) ((+ localx fw) . > . (+ x iw)))) + (+ (quotient (+ localx (- fw iw)) hpixels-per-scroll) 1)] + [else cx]) + 0) + cx)]) + (if (or (not (= sy cy)) + (not (= sx cx))) + (begin + (when hscroll + (send hscroll set-value sx)) + (when vscroll + (send vscroll set-value sy)) + (scroll sx sy refresh?) + #t) + #f))))))))) + + (define/public (reset-visual reset-scroll?) + (if (given-h-scrolls-per-page . < . 0) + (begin + (set! given-h-scrolls-per-page -2) + #f) + (let loop ([retval #f]) + (let-boxes ([sx 0] + [sy 0]) + (get-scroll sx sy) + (let-boxes ([lw 0] + [lh 0]) + (get-size lw lh) + (set! lastwidth lw) + (set! lastheight lh) + + (let-values ([(x y vnum-scrolls hnum-scrolls vspp hspp) + (if (and media (or allow-x-scroll? allow-y-scroll?)) + + (let ([med media]) + (let-values ([(x y) + (if reset-scroll? + (values 0 0) + (values sx sy))]) + + (let-boxes ([w 0.0] + [h 0.0]) + (get-view #f #f w h) + (let-boxes ([total-width 0.0] + [total-height 0.0]) + (send med get-extent total-width total-height) + + (let-values ([(vnum-scrolls scroll-offset) + (if (or (zero? h) + (and (not scroll-to-last?) + (h . >= . total-height))) + (values 0 0) + + (if scroll-bottom-based? + (let ([vnum-scrolls (- (send med num-scroll-lines) 1)]) + (if scroll-to-last? + (values vnum-scrolls 1) + (let ([start (- (send med find-scroll-line (+ h 1)) 1)]) + (values (- vnum-scrolls start) + (+ scroll-offset start))))) + (let ([top (max 0 + (- (->long (- total-height + (if scroll-to-last? + 0 + h))) + 1))]) + (let ([vnum-scrolls (+ (send med find-scroll-line top) 1)] + [nsl (send med num-scroll-lines)]) + (values (if (vnum-scrolls . >= . nsl) + (- nsl 1) + vnum-scrolls) + 0)))))]) + + (let-values ([(num-scrolls vspp) + (if (positive? vnum-scrolls) + (let ([num-lines (- (send med num-scroll-lines) 1)]) + (values vnum-scrolls + (max 1 + (- (->long + (/ (* h num-lines) + total-height)) + 1)))) + (values 0 1))]) + + (let-values ([(hnum-scrolls hspp) + (if (total-width . >= . w) + (let ([tw (->long (- total-width w))]) + (set! hpixels-per-scroll + (let ([v (->long (/ w given-h-scrolls-per-page))]) + (if (zero? v) 2 v))) + (let ([tw + (if (modulo tw hpixels-per-scroll) + (+ tw (- hpixels-per-scroll (modulo tw hpixels-per-scroll))) + tw)]) + (values (quotient tw hpixels-per-scroll) + given-h-scrolls-per-page))) + (values 0 1))]) + + (values x y vnum-scrolls hnum-scrolls vspp hspp)))))))) + + (begin0 + (values 0 0 0 0 1 1) + (when (not media) + (let ([dc (get-dc)]) + (send dc set-background (get-canvas-background)) + (send dc clear)))))]) + + (if (not (and (= scroll-width hnum-scrolls) + (= scroll-height vnum-scrolls) + (= vspp vscrolls-per-page) + (= hspp hscrolls-per-page) + (= x sx) + (= y sy))) + (begin + (when hscroll + (send hscroll set-scroll hnum-scrolls hspp x)) + (when vscroll + (send vscroll set-scroll vnum-scrolls vspp y)) + (let ([savenoloop? noloop?] + [save-h-s-p-p given-h-scrolls-per-page]) + (set! noloop? #t) + (set! given-h-scrolls-per-page -1) + + (let ([xon? (and (not fake-x-scroll?) (not (zero? hnum-scrolls)))] + [yon? (and (not fake-y-scroll?) (not (zero? vnum-scrolls)))]) + (let ([go-again? + (if (or (and auto-x? (not (eq? xon? xscroll-on?))) + (and auto-y? (not (eq? yon? yscroll-on?)))) + (begin + (when auto-x? + (set! xscroll-on? xon?)) + (when auto-y? + (set! yscroll-on? yon?)) + (show-scrollbars xscroll-on? yscroll-on?) + (on-scroll-on-change) + #t) + #f)]) + + (unless fake-x-scroll? + (let ([x (min x hnum-scrolls)]) + (when (hspp . < . hscrolls-per-page) + (set-scroll-page 'horizontal hspp)) + (when (x . < . sx) + (set-scroll-pos 'horizontal x)) + (when (not (= scroll-width hnum-scrolls)) + (set-scroll-range 'horizontal hnum-scrolls)) + (when (x . > . sx) + (set-scroll-pos 'horizontal x)) + (when (hspp . > . hscrolls-per-page) + (set-scroll-page 'horizontal hspp)))) + + (unless fake-y-scroll? + (let ([y (min y vnum-scrolls)]) + (when (vspp . < . vscrolls-per-page) + (set-scroll-page 'vertical vspp)) + (when (y . < . sy) + (set-scroll-pos 'vertical y)) + (when (not (= scroll-height vnum-scrolls)) + (set-scroll-range 'vertical vnum-scrolls)) + (when (y . > . sy) + (set-scroll-pos 'vertical y)) + (when (vspp . > . vscrolls-per-page) + (set-scroll-page 'vertical vspp)))) + + (let ([go-again? (or go-again? + (given-h-scrolls-per-page . < . -1))]) + (set! given-h-scrolls-per-page save-h-s-p-p) + (set! noloop? savenoloop?) + (set! hscrolls-per-page hspp) + (set! vscrolls-per-page vspp) + (set! scroll-width hnum-scrolls) + (set! scroll-height vnum-scrolls) + + (if go-again? + (loop #t) + #t)))))) + + retval))))))) + + (define/override scroll + (case-lambda + [(x y refresh?) + (let ([savenoloop? noloop?]) + (set! noloop? #t) + + (when (and (x . > . -1) + (not fake-x-scroll?)) + (when (positive? scroll-width) + (set-scroll-pos 'horizontal (->long (min x scroll-width))))) + + (when (and (y . > . -1) + (not fake-y-scroll?)) + (when (positive? scroll-height) + (set-scroll-pos 'vertical (->long (min y scroll-height))))) + + (set! noloop? savenoloop?) + + (when refresh? (repaint)))] + [(scroll x y) (void)])) + + (define/override (set-scrollbars x y x2 y2 x3 y3 x4 y4 ?) (void)) + + (define/public (get-scroll x y) + ;; get fake scroll values if available + (set-box! x (if hscroll + (send hscroll get-value) + (get-scroll-pos 'horizontal))) + (set-box! y (if vscroll + (send vscroll get-value) + (get-scroll-pos 'vertical)))) + + (define/public (editor-canvas-on-scroll) + (unless noloop? + (repaint))) + + (define/public (on-scroll-on-change) + (void)) + + (define/public (get-editor) media) + + (define/public (set-editor m update?) + (unless (eq? media m) + (when media + (when (eq? admin (send media get-admin)) + (send media set-admin + (or (send admin get-nextadmin) + (send admin get-prevadmin)))) + + (let ([a (send admin get-nextadmin)]) + (when a + (send a set-prevadmin (send admin get-prevadmin)) + (send a adjust-std-flag))) + (let ([a (send admin get-prevadmin)]) + (when a + (send a set-nextadmin (send admin get-nextadmin)) + (send a adjust-std-flag))) + (send admin set-nextadmin #f) + (send admin set-prevadmin #f) + (when custom-cursor + (no-custom-cursor) + (set! custom-cursor #f))) + (set! media m) + (when media + (let ([oldadmin (send media get-admin)]) + (if (and oldadmin + (not (send oldadmin get-s-standard))) + (set! media #f) + (if oldadmin + (begin + (send admin set-nextadmin oldadmin) + (send admin set-prevadmin (send oldadmin get-prevadmin)) + (send oldadmin set-prevadmin admin) + (send oldadmin adjust-std-flag) + (let ([a (send admin get-prevadmin)]) + (when a + (send a set-nextadmin admin) + (send a adjust-std-flag))) + ;; get the right cursor: + (send admin update-cursor)) + (begin + (send admin set-nextadmin #f) + (send admin set-prevadmin #f) + (send media set-admin admin) + (send media own-caret focuson?)))))) + (send admin adjust-std-flag) + (reset-visual #t) + (when update? + (repaint)))) + + (define/public (allow-scroll-to-last to-last?) + (set! scroll-to-last? to-last?) + (reset-visual #f) + (repaint)) + + (define (scroll-with-bottom-base bottom?) + (set! scroll-bottom-based? bottom?) + (reset-visual #f) + (repaint))) + +;; ---------------------------------------- + +(defclass canvas-editor-admin% editor-admin% + (init-field canvas) + + (super-new) + + (inherit set-s-standard) + + (define reset? #f) + (properties [[any? nextadmin] #f] + [[any? prevadmin] #f]) + + (define update-cursor-timer #f) + + (define update-block? #f) + (define resized-block? #f) + + ;; FIXME: needed? + (define/private (~) + (when update-cursor-timer + (send update-cursor-timer cancel) + (set! update-cursor-timer #f)) + (set! canvas #f)) + + (define/public (do-get-canvas) canvas) + + (define canvasless-offscreen #f) + + (define/override (get-dc [fx #f] [fy #f]) + (cond + [(not canvas) + (unless canvasless-offscreen + (set! canvasless-offscreen (new bitmap-dc%))) + (when fx (set-box! fx 0)) + (when fy (set-box! fy 0)) + canvasless-offscreen] + [(let ([m (send canvas get-editor)]) + (and m (send m get-printing))) + => (lambda (p) + (when fx (set-box! fx 0)) + (when fy (set-box! fy 0)) + p)] + [else + (send canvas get-dc-and-offset fx fy)])) + + (define/override (get-view fx fy fh fw [full? #f]) + (cond + [(not canvas) + (when fx (set-box! fx 0)) + (when fy (set-box! fy 0)) + (when fh (set-box! fh 1)) + (when fw (set-box! fw 1))] + [(let ([m (send canvas get-editor)]) + (and m (send m get-printing))) + (when fx (set-box! fx 0)) + (when fy (set-box! fy 0)) + (when fh (set-box! fh 10000)) + (when fw (set-box! fw 10000))] + [else + (send canvas get-view fx fy fh fw full?)])) + + (define/override (get-max-view fx fy fw fh [full? #f]) + (if (or (and (not nextadmin) + (not prevadmin)) + (not canvas) + (and (let ([m (send canvas get-editor)]) + (and m (send m get-printing))))) + (get-view fx fy fw fh full?) + (let ([a (let loop ([a this]) + (let ([a2 (send a get-prevadmin)]) + (if a2 + (loop a2) + a)))]) + (let-boxes ([cx 0] [cy 0] [cw 0] [ch 0]) + (send a get-view cx cy cw ch) + (let loop ([a (send a get-nextadmin)] + [cx cx][cy cy][cr (+ cx cw)][cb (+ cy ch)]) + (if (not a) + (let ([cw (- cr cx)] + [ch (- cb cy)]) + (when fx (set-box! fx cx)) + (when fy (set-box! fy cy)) + (when fw (set-box! fw cw)) + (when fh (set-box! fh ch))) + (let-boxes ([x 0] [y 0] [w 0] [h 0]) + (send a get-view x y w h) + (loop (send a get-nextadmin) + (min x cx) + (min y cy) + (max (+ x w) cr) + (max (+ y h) cb))))))))) + + (def/override (scroll-to [real? localx] [real? localy] [real? w] [real? h] [any? [refresh? #t]] + [(symbol-in start none end) [bias 'none]]) + (let ([v (do-scroll-to localx localy w h refresh? bias #t #t #f)]) + (and v (car v)))) + + (define/private (do-scroll-to localx localy w h refresh? bias prev? next? only-focus?) + (and canvas + (or (and (not (send canvas is-focus-on?)) + (or + (and prev? + prevadmin + (send prevadmin do-scroll-to localx localy w h refresh? bias #t #f #t)) + (and next? + nextadmin + (send nextadmin do-scroll-to localx localy w h refresh? bias #f #t #t)))) + (and (or (not only-focus?) + (send canvas is-focus-on?)) + (list (send canvas scroll-to localx localy w h refresh? bias)))))) + + (def/override (grab-caret [(symbol-in immediate display global) dist]) + (when canvas + (when (eq? dist 'global) + (send canvas set-focus)))) + + (define/public all-in-chain + (case-lambda + [(proc) (all-in-chain proc #t #t)] + [(proc backward? forward?) + (proc this) + (when (and forward? nextadmin) + (send nextadmin all-in-chain proc #f #t)) + (when (and backward? prevadmin) + (send prevadmin all-in-chain proc #t #f))])) + + (def/override (needs-update [real? localx] [real? localy] + [nonnegative-real? w] [nonnegative-real? h]) + (all-in-chain (lambda (a) (send a do-needs-update localx localy w h)))) + + (define/public (do-needs-update localx localy w h) + (when canvas + (let ([is-shown? (send canvas is-shown-to-root?)]) + + (cond + [reset? + (when is-shown? (send canvas repaint)) + (set! reset? #f)] + [is-shown? + (if (not (send canvas get-canvas-background)) + (send canvas repaint) + (send canvas redraw localx localy w h))])))) + + (define/override (resized update?) + (all-in-chain (lambda (a) (send a do-resized update?)))) + + (define/public (do-resized update?) + (when canvas + (when (send canvas reset-visual #f) + (set! reset? #t)) + + (when update? + (send canvas repaint) + (set! reset? #f)))) + + (define/override (update-cursor) + (all-in-chain (lambda (a) (send a do-update-cursor)))) + + (define/public (do-update-cursor) + (when (not update-cursor-timer) + (set! update-cursor-timer (new update-cursor-timer% [admin this])))) + + (def/override (popup-menu [popup-menu% m] [real? x] [real? y]) + (and canvas + (let ([e (send canvas get-editor)]) + (and e + (let ([m (send canvas popup-for-editor e m)]) + (let-boxes ([dx 0.0] + [dy 0.0]) + (send canvas get-dc-and-offset dx dy) + (send canvas popup-menu m (->long (- x dx)) (->long (- y dy))))))))) + + (define/public (adjust-std-flag) + ;; 1 indicates that this is the sole, main admin. + ;; this info is used for quick (xor) caret refreshing + ;; by an editor buffer + (set-s-standard (if (or nextadmin + prevadmin + (and canvas (send canvas get-focusforcedon?))) + -1 + 1))) + + (def/override (modified [bool? modified?]) (void))) + + +;; For editor-admin%: +#;( + (define/override (get-max-view fx fy fw fh full?) + (get-view fx fy fh fw full?)) + + (define/override (delay-refresh?) #f) +) diff --git a/collects/mred/private/wxme/editor-snip.ss b/collects/mred/private/wxme/editor-snip.ss new file mode 100644 index 0000000000..791925d18b --- /dev/null +++ b/collects/mred/private/wxme/editor-snip.ss @@ -0,0 +1,716 @@ +#lang scheme/base +(require scheme/class + "../syntax.ss" + "private.ss" + "const.ss" + "snip.ss" + "snip-flags.ss" + "editor.ss" + "editor-admin.ss" + "snip-admin.ss" + "text.ss" + "pasteboard.ss" + "wx.ss" + (except-in "cycle.ss" + text% + pasteboard% + editor-snip% + editor-snip-editor-admin% + snip-admin%)) + +(provide editor-snip% + editor-snip-editor-admin<%>) + +;; FIXME: use "type"s +(define-syntax-rule (private-inits [[type id] val] ...) + (begin + (define-init id val) + ...)) +(define-syntax-rule (define-init id v) + (begin + (init [(init-tmp id) v]) + (define id init-tmp))) + +;; see also "private.ss" +(define-local-member-name + with-dc + do-get-left-margin do-get-right-margin do-get-bottom-margin do-get-top-margin + do-get-extent) + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defclass editor-snip% snip% + (private-inits + [[(make-or-false editor<%>) editor] #f] + [[bool? with-border?] #t] + [[exact-nonnegative-integer? left-margin] 5] + [[exact-nonnegative-integer? top-margin] 5] + [[exact-nonnegative-integer? right-margin] 5] + [[exact-nonnegative-integer? bottom-margin] 5] + [[exact-nonnegative-integer? left-inset] 1] + [[exact-nonnegative-integer? top-inset] 1] + [[exact-nonnegative-integer? right-inset] 1] + [[exact-nonnegative-integer? bottom-inset] 1] + [[(make-alts (symbol-in none) nonnegative-real?) min-width] 'none] + [[(make-alts (symbol-in none) nonnegative-real?) max-width] 'none] + [[(make-alts (symbol-in none) nonnegative-real?) min-height] 'none] + [[(make-alts (symbol-in none) nonnegative-real?) max-height] 'none]) + + (unless (symbol? min-width) (set! min-width (exact->inexact min-width))) + (unless (symbol? max-width) (set! max-width (exact->inexact max-width))) + (unless (symbol? min-height) (set! min-height (exact->inexact min-height))) + (unless (symbol? max-height) (set! max-height (exact->inexact max-height))) + + (define align-top-line? #f) + (define tight-fit? #f) + (define use-style-bg? #f) + + (super-new) + + (inherit set-snipclass + do-copy-to) + (inherit-field s-admin + s-flags + s-style) + + (set-snipclass the-editor-snip-class) + + (when (and editor (send editor get-admin)) + (set! editor #f)) + (unless editor + (set! editor (new extended-text%))) + + (define my-admin (new editor-snip-editor-admin% [owner this])) + + (set! s-flags (add-flag s-flags HANDLES-EVENTS)) + (when (no-permanent-filename? editor) + (set! s-flags (add-flag s-flags USES-BUFFER-PATH))) + + (send editor own-caret #f) + + ;; ---------------------------------------- + + (define/private (no-permanent-filename? editor) + (let ([temp (box #f)]) + (let ([fn (send editor get-filename temp)]) + (or (not fn) (unbox temp))))) + + (def/override (set-admin [(make-or-false snip-admin%) a]) + + (when (not (eq? a s-admin)) + (super set-admin a) + (when editor + (if a + (begin + (when (send editor get-admin) + ;; traitor! - get rid of it + (set! editor #f)) + (send editor set-admin my-admin)) + (send editor set-admin #f)))) + + (when (and s-admin + (has-flag? s-flags USES-BUFFER-PATH)) + ;; propogate a filename change: + (if (and editor + (no-permanent-filename? editor)) + (let ([b (send s-admin get-editor)]) + (when b + (let ([fn (send b get-filename)]) + (when fn + (send editor set-filename fn #t))))) + (set! s-flags (remove-flag s-flags USES-BUFFER-PATH)))) ;; turn off the flag; not needed + + (void)) + + (def/public (set-editor [editor<%> b]) + (unless (eq? editor b) + (when (and editor s-admin) + (send editor set-admin #f)) + (set! editor b) + (when b + (cond + [(send b get-admin) + (set! editor #f)] + [s-admin + (send editor set-admin my-admin)])) + (when s-admin + (send s-admin resized this #t)))) + + (def/public (get-editor) + editor) + + (def/override (adjust-cursor [dc<%> dc] [real? x] [real? y] [real? ex] [real? ey] [mouse-event% event]) + (if (not editor) + #f + (send my-admin + with-dc + dc x y + (lambda () + (send editor adjust-cursor event))))) + + (def/override (on-event [dc<%> dc] [real? x] [real? y] [real? ex] [real? ey] [mouse-event% event]) + (when editor + (send my-admin + with-dc + dc x y + (lambda () + (send editor on-event event))))) + + (def/override (on-char [dc<%> dc] [real? x] [real? y] [real? ex] [real? ey] [key-event% event]) + (when editor + (send my-admin + with-dc + dc x y + (lambda () + (send editor on-char event))))) + + (def/override (own-caret [bool? own?]) + (when editor + (send editor own-caret own?))) + + (def/override (blink-caret [dc<%> dc] [real? x] [real? y]) + (when editor + (send my-admin + with-dc + dc x y + (lambda () + (send editor blink-caret))))) + + (def/override (do-edit-operation [symbol? op] [any? [recur? #t]] [exact-integer? [timestamp 0]]) + (when editor + (send editor do-edit-operation op recur? timestamp))) + + (def/override (can-do-edit-operation? [symbol? op] [any? [recur? #t]]) + (and editor + (send editor can-do-edit-operation? op recur?))) + + (def/override (match [snip% s]) + #f) + + (def/override (size-cache-invalid) + (when editor + (send editor size-cache-invalid))) + + (def/override (get-text [exact-nonnegative-integer? offset] [exact-integer? num] + [any? [flattened? #f]]) + (cond + [(or (offset . >= . 1) + (zero? num)) + ""] + [(not flattened?) + "."] + [editor + (send editor get-flattened-text)] + [else ""])) + + (define/public (do-get-extent dc x y w h -descent -space lspace rspace) + (send my-admin + with-dc + dc x y + (lambda () + (let ([h2 (or h (box 0.0))]) + (if editor + (send editor get-extent w h2) + (begin + (when w (set-box! w 0.0)) + (set-box! h2 0.0))) + (let ([orig-h (if align-top-line? + (unbox h2) + 0.0)]) + + (when w + (when (editor . is-a? . text%) + (set-box! + w + (- (unbox w) + (if tight-fit? + CURSOR-WIDTH + 1)))) ;; it still looks better to subtract 1 + (when ((unbox w) . < . (if (symbol? min-width) -inf.0 min-width)) + (set-box! w min-width)) + (when ((unbox w) . > . (if (symbol? max-width) +inf.0 max-width)) + (set-box! w max-width)) + (set-box! w (+ (unbox w) (+ right-margin left-margin)))) + + (when h + (when (editor . is-a? . text%) + (when tight-fit? + (set-box! h + (max 0.0 + (- (unbox h) + (send editor get-line-spacing)))))) + (when ((unbox h) . < . (if (symbol? min-height) -inf.0 min-height)) + (set-box! h min-height)) + (when ((unbox h) . > . (if (symbol? max-height) +inf.0 max-height)) + (set-box! h max-height)) + (set-box! h (+ (unbox h) (+ top-margin bottom-margin)))) + + (let* ([descent (+ (if editor + (send editor get-descent) + 0.0) + bottom-margin)] + [descent + (if (editor . is-a? . text%) + (let ([descent (if align-top-line? + (- orig-h + (+ (send editor get-top-line-base) + bottom-margin)) + descent)]) + (if tight-fit? + (max (- descent (send editor get-line-spacing)) 0.0) + descent)) + descent)] + [space (+ (if editor + (send editor get-space) + 0.0) + top-margin)]) + (let-values ([(space descent) + (if (and (not (symbol? max-height)) + ((+ descent space) . >= . (+ max-height top-margin bottom-margin))) + ;; just give up on spaces in this case: + (values top-margin bottom-margin) + (values space descent))]) + (when -descent (set-box! -descent descent)) + (when -space (set-box! -space space)))) + + (when lspace (set-box! lspace left-margin)) + (when rspace (set-box! rspace right-margin))))))) + + (def/override (get-extent [dc<%> dc] [real? x] [real? y] + [maybe-box? [w #f]] [maybe-box? [h #f]] + [maybe-box? [-descent #f]] [maybe-box? [-space #f]] + [maybe-box? [lspace #f]] [maybe-box? [rspace #f]]) + (do-get-extent dc x y w h -descent -space lspace rspace)) + + (def/override (draw [dc<%> dc] [real? x] [real? y] + [real? left] [real? top] [real? right] [real? bottom] + [real? dx] [real? dy] [symbol? caret]) + (send my-admin + with-dc + dc x y + (lambda () + (let-boxes ([w 0.0] + [h 0.0]) + (when editor + (send editor get-extent w h) + (when (editor . is-a? . text%) + (set-box! w (max 0.0 + (- (unbox w) + (if tight-fit? + CURSOR-WIDTH + 1)))) ;; it still looks better to subtract 1 + (when tight-fit? + (set-box! h (max 0.0 + (- (unbox h) + (send editor get-line-spacing))))))) + (let* ([w (min (max w (if (symbol? min-width) -inf.0 min-width)) + (if (symbol? max-width) +inf.0 max-width))] + [h (min (max h (if (symbol? min-height) -inf.0 min-height)) + (if (symbol? max-height) +inf.0 max-height))] + [orig-x x] + [orig-y y] + [x (+ x left-margin)] + [y (+ y top-margin)] + [r (+ x w)] + [b (+ y h)] + [l (max x left)] + [t (max y top)] + [r (min r right)] + [b (min b bottom)]) + + (let ([bg-color + (cond + [(not use-style-bg?) + (make-object color% 255 255 255)] + [(send s-style get-transparent-text-backing) + #f] + [else + (let ([bg-color (send s-style get-background)]) + (let ([l (+ orig-x left-inset)] + [t (+ orig-y top-inset)] + [r (+ l w left-margin right-margin + (- (+ left-inset right-inset)) + -1)] + [b (+ t h top-margin bottom-margin + (- (+ top-inset bottom-inset)) + -1)]) + (let ([trans-pen (send the-pen-list + find-or-create-pen + bg-color 0 'transparent)] + [fill (send the-brush-list + find-or-create-brush + bg-color 'solid)] + [savep (send dc get-pen)] + [saveb (send dc get-brush)]) + (send dc set-pen trans-pen) + (send dc set-brush fill) + + (send dc draw-rectangle l t (- r l) (- b t)) + + (send dc set-brush saveb) + (send dc set-pen savep))) + bg-color)])]) + + (when editor + (send editor refresh + (- l x) (- t y) (max 0.0 (- r l)) (max 0.0 (- b t)) + caret bg-color)) + + (when with-border? + (let* ([l (+ orig-x left-inset)] + [t (+ orig-y top-inset)] + [r (+ l w left-margin right-margin + (- (+ left-inset right-inset)) + -1)] + [b (+ t h top-margin bottom-margin + (- (+ top-inset bottom-inset)) + -1)]) + (let ([ml (max (min l right) left)] + [mr (max (min r right) left)] + [mt (max (min t bottom) top)] + [mb (max (min b bottom) top)]) + (when (and (l . >= . left) + (l . < . right) + (mt . < . mb)) + (send dc draw-line l mt l mb)) + (when (and (r . >= . left) + (r . < . right) + (mt . < . mb)) + (send dc draw-line r mt r mb)) + (when (and (t . >= . top) + (t . < . bottom) + (ml . < . mr)) + (send dc draw-line ml t mr t)) + (when (and (b . >= . top) + (b . < . bottom) + (ml . < . mr)) + (send dc draw-line ml b mr b))))))))))) + + (def/override (copy) + (let* ([mb (and editor + (send editor copy-self))] + [ms (make-object extended-editor-snip% + mb + with-border? + left-margin top-margin + right-margin bottom-margin + left-inset top-inset + right-inset bottom-inset + min-width max-width + min-height max-height)]) + (do-copy-to ms) + + (send ms do-set-graphics tight-fit? align-top-line? use-style-bg?) + (when (not editor) + (send ms set-editor #f)) + ms)) + + (define/public (do-set-graphics tf? atl? usb?) + (set! tight-fit? tf?) + (set! align-top-line? atl?) + (set! use-style-bg? usb?)) + + (def/override (write [editor-stream-out% f]) + (send f put (if editor + (if (editor . is-a? . pasteboard%) 2 1) + 0)) + (send f put (if with-border? 1 0)) + (send f put left-margin) + (send f put top-margin) + (send f put right-margin) + (send f put bottom-margin) + (send f put left-inset) + (send f put top-inset) + (send f put right-inset) + (send f put bottom-inset) + (send f put (if (symbol? min-width) -1.0 min-width)) + (send f put (if (symbol? max-width) -1.0 max-width)) + (send f put (if (symbol? min-height) -1.0 min-height)) + (send f put (if (symbol? max-height) -1.0 max-height)) + (send f put (if tight-fit? 1 0)) + (send f put (if align-top-line? 1 0)) + (send f put (if use-style-bg? 1 0)) + (when editor + (send editor write-to-file f))) + + (define/private (resize-me) + (when s-admin (send s-admin resized this #t))) + + (def/public (set-max-width [(make-alts (symbol-in none) nonnegative-real?) w]) + (set! max-width w) + (resize-me)) + + (def/public (set-min-width [(make-alts (symbol-in none) nonnegative-real?) w]) + (set! min-width w) + (resize-me)) + + (def/public (set-max-height [(make-alts (symbol-in none) nonnegative-real?) h]) + (set! max-height h) + (resize-me)) + + (def/public (set-min-height [(make-alts (symbol-in none) nonnegative-real?) h]) + (set! min-height h) + (resize-me)) + + (def/public (get-max-width) max-width) + (def/public (get-min-width) min-width) + (def/public (get-max-height) max-height) + (def/public (get-min-height) min-height) + + (def/public (get-tight-text-fit) + tight-fit?) + (def/public (set-tight-text-fit [bool? t]) + (set! tight-fit? t) + (resize-me)) + + (def/public (get-align-top-line) + align-top-line?) + (def/public (set-align-top-line [bool? t]) + (set! align-top-line? t) + (resize-me)) + + (def/public (style-background-used?) + use-style-bg?) + (def/public (use-style-background [bool? u]) + (unless (eq? use-style-bg? u) + (set! use-style-bg? u) + (request-refresh))) + + (def/override (resize [real? w] [real? h]) + (let ([w (max 0.0 (- w (+ left-margin right-margin)))] + [h (max 0.0 (- h (+ top-margin bottom-margin)))]) + (set! min-width w) + (set! max-width w) + (set! min-height h) + (set! max-height h) + + (when editor + (send editor set-max-width w) + (send editor set-min-width w)) + + (resize-me) + #t)) + + (define/private (request-refresh) + (when s-admin + (let ([dc (send s-admin get-dc)]) + (when dc + (let-boxes ([w 0.0] + [h 0.0]) + (get-extent dc 0 0 w h) + (send s-admin needs-update + this left-inset top-inset + (+ w (- right-margin right-inset)) + (+ h (- bottom-margin bottom-inset)))))))) + + (def/public (show-border [bool? show]) + (unless (eq? with-border? show) + (set! with-border? show) + (request-refresh))) + (def/public (border-visible?) + with-border?) + + (def/public (set-margin [exact-nonnegative-integer? lm] + [exact-nonnegative-integer? tm] + [exact-nonnegative-integer? rm] + [exact-nonnegative-integer? bm]) + (set! left-margin lm) + (set! top-margin tm) + (set! right-margin rm) + (set! bottom-margin bm) + (resize-me)) + + (def/public (get-margin [box? lm] [box? tm] [box? rm] [box? bm]) + (set-box! lm left-margin) + (set-box! tm top-margin) + (set-box! rm right-margin) + (set-box! bm bottom-margin)) + + (def/public (set-inset [exact-nonnegative-integer? lm] + [exact-nonnegative-integer? tm] + [exact-nonnegative-integer? rm] + [exact-nonnegative-integer? bm]) + (set! left-margin lm) + (set! top-margin tm) + (set! right-margin rm) + (set! bottom-margin bm) + (request-refresh)) + + (def/public (get-inset [box? lm] [box? tm] [box? rm] [box? bm]) + (set-box! lm left-inset) + (set-box! tm top-inset) + (set-box! rm right-inset) + (set-box! bm bottom-inset)) + + (def/override (get-num-scroll-steps) + (if editor + (send editor num-scroll-lines) + 1)) + + (def/override (find-scroll-step [real? y]) + (if editor + (send editor find-scroll-line (- y top-margin)) + 0)) + + (def/override (get-scroll-step-offset [exact-integer? n]) + (if editor + (+ (send editor scroll-line-location n) top-margin) + 0)) + + (def/override (set-unmodified) + (when editor + (send editor set-modified #f))) + + (def/public (do-get-left-margin) left-margin) + (def/public (do-get-right-margin) right-margin) + (def/public (do-get-bottom-margin) bottom-margin) + (def/public (do-get-top-margin) top-margin)) + +(set-editor-snip%! editor-snip%) + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define-struct state (dc x y)) + +(defclass editor-snip-editor-admin% editor-admin% + (init owner) + (define snip owner) + (define state #f) + + (super-new) + + (define/public (get-snip) snip) + + (define/public (with-dc dc x y thunk) + (let* ([other (make-state dc + (+ x (send snip do-get-left-margin)) + (+ y (send snip do-get-top-margin)))] + [swap (lambda () + (let ([s state]) + (set! state other) + (set! other s)))]) + (dynamic-wind swap thunk swap))) + + (def/override (get-dc [maybe-box? [x #f]] [maybe-box? [y #f]]) + (let-values ([(xv yv) + (if state + (values (- (state-x state)) + (- (state-y state))) + (values 0 0))]) + (when x (set-box! x xv)) + (when y (set-box! y yv)) + (if state + (state-dc state) + (let ([sadmin (send snip get-admin)]) + (if sadmin + (send sadmin get-dc) + #f))))) + + (def/override (get-view [maybe-box? x] [maybe-box? y] + [maybe-box? w] [maybe-box? h] + [any? [full? #f]]) + (let ([sadmin (send snip get-admin)]) + (cond + [(not sadmin) + (when x (set-box! x 0.0)) + (when y (set-box! y 0.0)) + (when w (set-box! w 0.0)) + (when h (set-box! h 0.0))] + [full? + (send sadmin get-view x y w h #f)] + [else + (let-boxes ([sx 0.0] + [sy 0.0] + [sw 0.0] + [sh 0.0]) + (send sadmin get-view sx sy sw sh snip) + (when x + (set-box! x (max 0.0 (- sx (send snip do-get-left-margin))))) + (when y + (set-box! y (max 0.0 (- sy (send snip do-get-top-margin))))) + (when (or w h) + (if (or (positive? sw) (positive? sh)) + ;; w and h might be too big due to margins - but + ;; they might be small enough already because + ;; part of the snip itself is not viewed + (let-boxes ([rw 0.0] + [rh 0.0]) + ;; we want the internal, non-overridden method: + (send snip do-get-extent (and state (state-dc state)) 0 0 rw rh #f #f #f #f) + + ;; remember: sx and sy are in snip coordinates + + (when w + (let* ([left-margin (max 0.0 (- (send snip do-get-left-margin) sx))] + [sw (- sw left-margin)] + [rw (- rw (send snip do-get-left-margin))] + [right-margin (max 0.0 (- (send snip do-get-right-margin) (- rw sw)))] + [sw (max 0.0 (- sw right-margin))]) + (set-box! w sw))) + + (when h + (let* ([top-margin (max 0.0 (- (send snip do-get-top-margin) sy))] + [sh (- sh top-margin)] + [rh (- rh (send snip do-get-top-margin))] + [bottom-margin (max 0.0 (- (send snip do-get-bottom-margin) (- rh sh)))] + [sh (max 0.0 (- sh bottom-margin))]) + (set-box! h sh)))) + + (begin + (when w (set-box! w 0.0)) + (when h (set-box! h 0.0))))))]))) + + (def/override (scroll-to [real? localx] [real? localy] [real? w] [real? h] [any? [refresh? #t]] + [(symbol-in start none end) [bias 'none]]) + (let ([sadmin (send snip get-admin)]) + (and sadmin + (send sadmin scroll-to snip (+ localx (send snip do-get-left-margin)) + (+ localy (send snip do-get-top-margin)) + w h refresh? bias)))) + + (def/override (grab-caret [(symbol-in immediate display global) dist]) + (let ([sadmin (send snip get-admin)]) + (when sadmin + (send sadmin set-caret-owner snip dist)))) + + (def/override (resized [any? redraw-now]) + (let ([sadmin (send snip get-admin)]) + (when sadmin + (send sadmin resized snip redraw-now)))) + + (def/override (needs-update [real? localx] [real? localy] + [nonnegative-real? w] [nonnegative-real? h]) + (let ([sadmin (send snip get-admin)]) + (when sadmin + (send sadmin needs-update snip + (+ localx (send snip do-get-left-margin)) + (+ localy (send snip do-get-top-margin)) + w h)))) + + (def/override (update-cursor) + (let ([sadmin (send snip get-admin)]) + (when sadmin + (send sadmin update-cursor)))) + + (def/override (popup-menu [popup-menu% m] [real? x] [real? y]) + (let ([sadmin (send snip get-admin)]) + (and sadmin + (send sadmin popup-menu m snip + (+ x (send snip do-get-left-margin)) + (+ y (send snip do-get-top-margin)))))) + + (def/override (delay-refresh?) + (let ([sadmin (send snip get-admin)]) + (or (not sadmin) + (and (sadmin . is-a? . standard-snip-admin%) + (send (send sadmin get-editor) refresh-delayed?))))) + + (def/override (modified [any? mod?]) + (let ([sadmin (send snip get-admin)]) + (when sadmin + (send sadmin modified snip mod?))))) + +(set-editor-snip-editor-admin%! editor-snip-editor-admin%) + +(define editor-snip-editor-admin<%> (class->interface editor-snip-editor-admin%)) + diff --git a/collects/mred/private/wxme/editor.ss b/collects/mred/private/wxme/editor.ss new file mode 100644 index 0000000000..6e191f869d --- /dev/null +++ b/collects/mred/private/wxme/editor.ss @@ -0,0 +1,1819 @@ +#lang scheme/base +(require scheme/class + (for-syntax scheme/base) + scheme/file + "../syntax.ss" + "private.ss" + "style.ss" + "snip.ss" + "snip-flags.ss" + "editor-admin.ss" + "stream.ss" + "undo.ss" + "keymap.ss" + (only-in "cycle.ss" + text% + pasteboard% + editor-snip% + editor-snip-editor-admin% + editor-get-file + editor-put-file) + "wx.ss") + +(provide editor% + editor<%> + add-editor-keymap-functions + ALLOW-X-STYLE-SELECTION? + copy-style-list + set-common-copy-region-data! + cons-common-copy-buffer! + cons-common-copy-buffer2! + editor-set-x-selection-mode + editor-x-selection-allowed + editor-x-selection-mode? + editor-x-selection-owner + detect-wxme-file + read-editor-version + read-editor-global-header + read-editor-global-footer + write-editor-version + write-editor-global-header + write-editor-global-footer + write-snips-to-file + get-default-print-size) + +;; ---------------------------------------- + +(define RIDICULOUS-SIZE 2000) +(define ALLOW-X-STYLE-SELECTION? (eq? 'unix (system-type))) + +(defclass offscreen% object% + (define bitmap #f) + (define dc (make-object bitmap-dc%)) + (define bm-width 0) + (define bm-height 0) + (define in-use? #f) + (define last-used #f) + + (define/public (is-in-use?) in-use?) + (define/public (set-in-use v) (set! in-use? (and v #t))) + (define/public (get-bitmap) bitmap) + (define/public (get-dc) dc) + (define/public (get-last-used) last-used) + (define/public (set-last-used v) (set! last-used v)) + + (define/public (ready-offscreen width height) + (if (or (width . > . RIDICULOUS-SIZE) + (height . > . RIDICULOUS-SIZE) + (eq? (system-type) 'macosx)) + #f + (if (and (not in-use?) + (or (height . > . bm-height) + (width . > . bm-width))) + (let ([oldbm bitmap]) + (set! bm-height (max (add1 (->long height)) bm-height)) + (set! bm-width (max (add1 (->long width)) bm-width)) + (set! bitmap (make-object bitmap% bm-width bm-height)) + (send dc set-bitmap #f) + (when (send bitmap ok?) + (send dc set-bitmap bitmap)) + #t) + #f))) + + (super-new)) + +(define the-offscreen (new offscreen%)) + +;; ---------------------------------------- + +;; 8.5" x 11" paper, 0.5" margin; usually not used +(define PAGE-WIDTH 612) +(define PAGE-HEIGHT 792) + +(define (get-printer-orientation) + (send (current-ps-setup) get-orientation)) + +(define (get-default-print-size w h) + (set-box! w PAGE-WIDTH) + (set-box! h PAGE-HEIGHT) + (when (eq? (get-printer-orientation) 'landscape) + (let ([tmp h]) + (set! h w) + (set! w tmp)))) + +;; ---------------------------------------- + +(define emacs-style-undo? (and (get-preference 'MrEd:emacs-undo) #t)) +(define (max-undo-value? v) (or (exact-nonnegative-integer? v) + (eq? v 'forever))) + +(define global-lock (make-semaphore 1)) + +(defclass editor% object% + + (field [s-offscreen the-offscreen] + [s-admin #f] + [s-keymap (new keymap%)] + [s-own-caret? #f] + [s-temp-filename? #f] + [s-user-locked? #f] + [s-modified? #f] + [s-noundomode 0]) + (def/public (is-modified?) s-modified?) + + (define undomode? #f) + (define redomode? #f) + (define interceptmode? #f) + (define loadoverwritesstyles? #f) + + (field [s-custom-cursor-overrides? #f] + [s-need-on-display-size? #f]) + (define paste-text-only? #f) + + (define num-parts-modified 0) + + (field [s-caret-snip #f] + [s-style-list (new style-list%)]) + (define/public (get-focus-snip) s-caret-snip) + (define/public (get-s-style-list) s-style-list) + + (send s-style-list new-named-style "Standard" (send s-style-list basic-style)) + (define notify-id + (send s-style-list notify-on-change (lambda (which) (style-has-changed which)))) + + (field [s-filename #f]) ; last loaded file + + (define max-undos 0) + + (define changes #()) + (define changes-start 0) + (define changes-end 0) + (define changes-size 0) + + (define redochanges #()) + (define redochanges-start 0) + (define redochanges-end 0) + (define redochanges-size 0) + + (define savedchanges #f) ;; for emacs-style undo + (define intercepted null) + + (field [s-custom-cursor #f] + [s-inactive-caret-threshold 'show-inactive-caret]) + + (define printing #f) + (define/public (get-printing) printing) + + (define num-extra-headers 0) + (define seq-lock #f) + + (super-new) + + (define/public (~) + (send s-style-list forget-notification notify-id) + (clear-undos)) + + (define/public (is-printing?) (and printing #t)) + + ;; ---------------------------------------- + + (def/public (blink-caret) (void)) + + (def/public (size-cache-invalid) (void)) + (def/public (locked-for-read?) #f) + (def/public (locked-for-write?) #f) + + (def/public (resized) (void)) + (def/public (recounted) (void)) + (define/public (invalidate-bitmap-cache) (void)) + (def/public (needs-update) (void)) + (def/public (release-snip) (void)) + + (def/public (scroll-line-location) (void)) + (def/public (num-scroll-lines) (void)) + (def/public (find-scroll-line) (void)) + + ;; ---------------------------------------- + + (define/public (on-event event) (void)) + (define/public (on-char event) (void)) + + (def/public (on-local-event [mouse-event% event]) + (unless (and s-keymap + (or (send s-keymap handle-mouse-event this event) + (begin + (when (not (send event moving?)) + (send s-keymap break-sequence)) + #f))) + (on-default-event event))) + + (def/public (on-local-char [key-event% event]) + (unless (and s-keymap + (or (send s-keymap handle-key-event this event) + (begin + (send s-keymap break-sequence) + #f))) + (on-default-char event))) + + (define/public (on-default-event event) (void)) + (define/public (on-default-char event) (void)) + + (def/public (on-focus [any? on?]) (void)) + + ;; ---------------------------------------- + + (def/public (set-admin [(make-or-false editor-admin%) administrator]) + (setting-admin administrator) + + (set! s-admin administrator) + (when (not s-admin) + (set! s-own-caret? #f)) + (when s-admin + (init-new-admin))) + + (def/public (setting-admin [(make-or-false editor-admin%) a]) (void)) + + (def/public (init-new-admin) (void)) + + (def/public (get-admin) s-admin) + + ;; ---------------------------------------- + + (def/public (own-caret [any? ownit?]) (void)) + + (def/public (do-own-caret [any? ownit?]) + (let ([ownint? (and ownit? #t)]) + (let ([refresh? (and (not s-caret-snip) + (not (eq? s-own-caret? ownit?)))]) + (set! s-own-caret? ownit?) + (when s-caret-snip + (send s-caret-snip own-caret ownit?)) + (when (and s-keymap (not ownint?) refresh?) + (send s-keymap break-sequence)) + + (when ALLOW-X-STYLE-SELECTION? + (cond + [(and ownit? (not s-caret-snip)) + (set! editor-x-selection-allowed this)] + [(eq? editor-x-selection-allowed this) + (set! editor-x-selection-allowed #f)])) + + (when s-admin + (send s-admin update-cursor)) + + refresh?))) + + (def/public (get-dc) + ;; this can be called by snips to get a DC appropriate for + ;; sizing text, etc., outside of draws. it isn't the destination + ;; for draws, though + (if s-admin + (send s-admin get-dc #f #f) + #f)) + + (def/public (get-view-size [(make-or-false box?) w][(make-or-false box?) h]) + (if s-admin + (send s-admin get-view #f #f w h) + (begin + (when w (set-box! w 0.0)) + (when h (set-box! h 0.0))))) + + (define/public (get-snip-location snip x y) + (when x (set-box! x 0.0)) + (when y (set-box! y 0.0)) + #t) + + (def/public (do-set-caret-owner [(make-or-false snip%) snip] [symbol? dist]) + (let ([same? (eq? snip s-caret-snip)]) + (if (and same? + (or (not s-admin) (eq? dist 'immediate))) + #f + (begin + (when same? + (send s-admin grab-caret dist)) + + (let ([vis-caret? s-own-caret?]) + (cond + [(or (not snip) + (not (has-flag? (snip->flags snip) HANDLES-EVENTS))) + + (let ([old-caret s-caret-snip] + [refresh? #f]) + (set! s-caret-snip #f) + (when old-caret + (send old-caret own-caret #f) + (when vis-caret? + (set! refresh? #t))) + (when ALLOW-X-STYLE-SELECTION? + (set! editor-x-selection-allowed this)) + (when s-admin + (send s-admin update-cursor)) + refresh?)] + [(not (get-snip-location snip #f #f)) #f] + [else + (let ([had-caret? (and s-own-caret? + (not s-caret-snip))] + [old-caret s-caret-snip] + [refresh? #f]) + + (set! s-caret-snip snip) + + (begin-edit-sequence) + (cond + [old-caret (send old-caret own-caret #f)] + [vis-caret? (set! refresh? #t)]) + (send snip own-caret s-own-caret?) + (end-edit-sequence) + + (when (and s-admin + (not (eq? dist 'immediate))) + (send s-admin grab-caret dist)) + + (when s-admin + (send s-admin update-cursor)) + + refresh?)])))))) + + (define/private (convert-coords admin x y to-local?) + (let-values ([(lx ly) + (if admin + (if (admin . is-a? . editor-snip-editor-admin%) + (let* ([snip (send admin get-snip)] + [sa (send snip get-admin)]) + (if sa + (let ([mbuf (send sa get-editor)]) + (if mbuf + (let-boxes ([bx 0.0][by 0.0] + [lx 0.0][ly 0.0] + [l 0.0][t 0.0][r 0.0][b 0.0]) + (begin + (send mbuf local-to-global bx by) + (send mbuf get-snip-location snip lx ly #f) + (send snip get-margin l t r b)) + (values (+ lx bx l) + (+ ly by t))) + (values 0.0 0.0))) + (values 0.0 0.0))) + (let-boxes ([lx 0.0][ly 0.0]) + (send admin get-dc lx ly) + (values (- lx) (- ly)))) + (values 0.0 0.0))]) + (when x (set-box! x (+ (unbox x) (if to-local? (- lx) lx)))) + (when y (set-box! y (+ (unbox y) (if to-local? (- ly) ly)))))) + + (def/public (editor-location-to-dc-location [real? x] [real? y]) + (let-boxes ([x x] [y y]) + (local-to-global x y) + (values x y))) + + (def/public (dc-location-to-editor-location [real? x] [real? y]) + (let-boxes ([x x] [y y]) + (global-to-local x y) + (values x y))) + + (def/public (global-to-local [maybe-box? x] [maybe-box? y]) + (convert-coords s-admin x y #t)) + + (def/public (local-to-global [maybe-box? x] [maybe-box? y]) + (convert-coords s-admin x y #f)) + + (def/public (set-cursor [(make-or-false cursor%) c] [any? [override? #t]]) + (set! s-custom-cursor c) + (set! s-custom-cursor-overrides? override?) + (when s-admin + (send s-admin update-cursor))) + + (def/public (adjust-cursor [mouse-event% event]) (void)) + + ;; ---------------------------------------- + + (def/public (set-keymap [keymap% k]) + (set! s-keymap k)) + (def/public (get-keymap) s-keymap) + (def/public (get-style-list) s-style-list) + + (def/public (set-style-list [style-list% new-list]) + (send s-style-list forget-notification notify-id) + (set! notify-id + (send new-list notify-on-change (lambda (which) (style-has-changed which)))) + (set! s-style-list new-list) + ;; create "Standard" if it's not there: + (send s-style-list new-named-style "Standard" (send s-style-list basic-style))) + + (define/public (style-has-changed which) (void)) + + (def/public (default-style-name) "Standard") + + (def/public (get-default-style) + (send s-style-list find-named-style (default-style-name))) + + ;; ---------------------------------------- + + (define/public (set-max-width w) (void)) + (define/public (set-min-width v) (void)) + (define/public (get-max-width) 0.0) + (define/public (get-min-width) 0.0) + (define/public (set-min-height w) (void)) + (define/public (set-max-height w) (void)) + (define/public (get-min-height) 0.0) + (define/public (get-max-height) 0.0) + + (define/public (find-first-snip) #f) + + (define/public (get-extent) (void)) + (define/public (get-descent) (void)) + (define/public (get-space) (void)) + + (define/public (get-flattened-text) (void)) + + ;; ---------------------------------------- + + (define/public (clear) (void)) + (define/public (cut ? time) (void)) + (define/public (copy ? time) (void)) + (define/public (paste time) (void)) + (define/public (paste-x-selection time) (void)) + (define/public (kill time) (void)) + (define/public (select-all) (void)) + (define/public (insert snip) (void)) + (define/public (insert-paste-snip snip) (void)) + (define/public (insert-paste-string str) (void)) + (define/public (do-read-insert snip) (void)) + (define/public (set-caret-owner snip focus) (void)) + (define/public (read-from-file mf) #f) + + (define/public (do-copy time) (void)) + (define/public (do-paste time) (void)) + (define/public (do-paste-x-selection time) (void)) + + (def/public (do-edit-operation [symbol? op] [any? [recursive? #t]] [exact-integer? [time 0]]) + (if (and recursive? + s-caret-snip) + (send s-caret-snip do-edit-operation op #t time) + (case op + [(undo) (undo)] + [(redo) (redo)] + [(clear) (clear)] + [(cut) (cut #f time)] + [(copy) (copy #f time)] + [(paste) (paste time)] + [(kill) (kill time)] + [(insert-text-box) (insert-box 'text)] + [(insert-pasteboard-box) (insert-box 'pasteboard)] + [(insert-image) (insert-image)] + [(select-all) (select-all)]))) + + (def/public (can-do-edit-operation? [symbol? op] [any? [recursive? #t]]) + (if (and recursive? + s-caret-snip) + (send s-caret-snip can-do-edit-operation? op #t) + (cond + [(and (is-locked?) + (not (or (eq? op 'copy) (eq? op 'select-all)))) + #f] + [(and (eq? op 'undo) + (= changes-start changes-end)) + #f] + [(and (eq? op 'redo) + (= redochanges-start redochanges-end)) + #f] + [else (really-can-edit? op)]))) + + (define/public (really-can-edit?) #f) + + (def/public (insert-box [symbol? type]) + (let ([snip (on-new-box type)]) + (when snip + (let ([sname (default-style-name)]) + + (begin-edit-sequence) + (send snip set-s-style (or (send s-style-list find-named-style sname) + (send s-style-list basic-style))) + (insert snip) + (set-caret-owner snip) + (end-edit-sequence))))) + + (def/public (on-new-box [symbol? type]) + (let* ([media (if (eq? type 'text) + (new text%) + (new pasteboard%))] + [snip (make-object editor-snip% media)]) + (send media set-keymap s-keymap) + (send media set-style-list s-style-list) + snip)) + + (def/public (insert-image [(make-or-false path-string?) [filename #f]] + [symbol? [type 'unknown]] + [any? [relative? #f]] + [any? [inline-img? #t]]) + (let ([filename (or filename + (get-file #f))]) + (when filename + (let ([snip (on-new-image-snip filename type + (and relative? #t) + (and inline-img? #t))]) + (insert snip))))) + + (def/public (on-new-image-snip [path-string? filename] + [symbol? type] + [any? relative?] + [any? inline-img?]) + (make-object image-snip% filename type relative? inline-img?)) + + ;; ---------------------------------------- + + (def/public (get-snip-data [snip% s]) #f) + (def/public (set-snip-data [snip% s] [editor-data% v]) (void)) + + ;; ---------------------------------------- + + (def/public (read-header-from-file [editor-stream-in% f] [string? header-name]) + (error 'read-header-from-file "unknown header data: ~s" header-name)) + (def/public (read-footer-from-file [editor-stream-in% f] [string? header-name]) + (error 'read-header-from-file "unknown footer data: ~s" header-name)) + (def/public (write-headers-to-file [editor-stream-out% f]) #t) + (def/public (write-footers-to-file [editor-stream-out% f]) #t) + + (def/public (begin-write-header-footer-to-file [editor-stream-out% f] + [string? header-name] + [box? data-buffer]) + (set-box! data-buffer (send f tell)) + (send f put-fixed 0) + (send f put-bytes (string->bytes/utf-8 header-name)) + #t) + + (def/public (end-write-header-footer-to-file [editor-stream-out% f] + [exact-integer? data]) + (let ([end (send f tell)]) + (send f jump-to data) + (send f put-fixed 0) + (let ([pos (send f tell)]) + (send f jump-to data) + (send f put-fixed (- end pos)) + (send f jump-to end) + (set! num-extra-headers (add1 num-extra-headers)) + #t))) + + (def/public (read-headers-footers [editor-stream-in% f] [any? headers?]) + (let-boxes ([num-headers 0]) + (send f get-fixed num-headers) + (for/fold ([ok? #t]) ([i (in-range num-headers)] #:when ok?) + (let-boxes ([len 0]) + (send f get-fixed len) + (and (send f ok?) + (if (positive? len) + (let ([pos (send f tell)]) + (send f set-boundary len) + (let ([header-name (bytes->string/utf-8 (send f get-unterminated-bytes) #\?)]) + (and (if headers? + (read-header-from-file f header-name) + (read-footer-from-file f header-name)) + (send f ok?) + (begin + (send f remove-boundary) + (let ([len (- len (- (send f tell) pos))]) + (when (positive? len) + (send f skip len)) + (send f ok?)))))) + #t)))))) + + (define/public (do-write-headers-footers f headers?) + (let ([all-start (send f tell)]) + (send f put-fixed 0) + (set! num-extra-headers 0) + + (and + (if headers? + (write-headers-to-file f) + (write-footers-to-file f)) + (begin + (when (positive? num-extra-headers) + (let ([all-end (send f tell)]) + (send f jump-to all-start) + (send f put-fixed num-extra-headers) + (send f jump-to all-end)) + #t))))) + + ;; ---------------------------------------- + + (def/public (read-snips-from-file [editor-stream-in% f] + [any? overwritestylename?]) + (and (read-headers-footers f #t) + (let* ([list-id (box 0)] + [new-list (read-styles-from-file s-style-list f overwritestylename? list-id)]) + (and new-list + (begin + (unless (eq? new-list s-style-list) + (set-style-list new-list)) + (let-boxes ([num-headers 0]) + (send f get-fixed num-headers) + (and + ;; Read headers + (for/and ([i (in-range num-headers)]) + (let-boxes ([n 0] + [len 0]) + (begin + (send f get n) + (send f get-fixed len)) + (and (send f ok?) + (or (zero? len) + (let ([sclass (send (send f get-s-scl) find-by-map-position f n)]) + (and + (if sclass + (let ([start (send f tell)]) + (send f set-boundary len) + (and (send sclass read-header f) + (send f ok?) + (begin + (send f do-set-header-flag sclass) + (let ([rcount (- (send f tell) start)]) + (when (rcount . < . len) + (error 'read-snips-from-file "underread (caused by file corruption?)")) + (send f skip (- len rcount))) + (send f remove-boundary) + #t))) + (begin (send f skip len) #t)) + (send f ok?))))))) + ;; Read snips + (let-boxes ([num-snips 0]) + (send f get num-snips) + (let ([accum? (this . is-a? . text%)]) + (let ([accum + (for/fold ([accum null]) ([i (in-range num-snips)] #:when accum) + (let-boxes ([n 0]) + (send f get n) + (let ([sclass (if (n . >= . 0) + (send (send f get-s-scl) find-by-map-position f n) + #f)]) ; -1 => unknown + (let-boxes ([len 0]) + (if (or (not sclass) + (not (send sclass get-s-required?))) + (send f get-fixed len) + (set-box! len -1)) + (and (send f ok?) + (or (and (zero? len) accum) + (and + (if sclass + (let ([start (send f tell)]) + (when (len . >= . 0) + (send f set-boundary len)) + (let-boxes ([style-index 0]) + (send f get style-index) + (let ([snip (send sclass read f)]) + (and + snip + (begin + (when (has-flag? (snip->flags snip) OWNED) + (send snip set-s-flags (remove-flag (snip->flags snip) OWNED))) + (send snip set-s-style + (or + (send s-style-list map-index-to-style f style-index (unbox list-id)) + (send s-style-list basic-style))) + (let ([accum + (if accum? + (cons snip accum) + (do-read-insert snip))]) + (and + accum + (let ([data (read-buffer-data f)]) + (and + (send f ok?) + (let ([accum + (if accum? + (cons (cons (car accum) data) (cdr accum)) + (when data + (set-snip-data snip data)))]) + (and + accum + (begin + (when (len . >= . 0) + (let ([rcount (- (send f tell) start)]) + (when (rcount . < . len) + (error 'read-snips-from-file + "underread (caused by file corruption?)")) + (send f skip (- len rcount)) + (send f remove-boundary))) + accum)))))))))))) + (begin + (send f skip len) + (and (send f ok?) + accum))))))))))]) + (and accum + (begin + (when accum? + (let ([accum (reverse accum)]) + (send this do-read-insert (map car accum)) + (for ([p (in-list accum)]) + (when (cdr p) + (set-snip-data (car p) (cdr p)))))) + + (read-headers-footers f #f))))))))))))) + + ;; ---------------------------------------- + + (define/public (insert-port) (void)) + (define/public (insert-file) (void)) + (define/public (save-port) (void)) + (define/public (load-file) (void)) + (define/public (set-filename) (void)) + (define/public (write-to-file) (void)) + + (def/public (get-filename [(make-or-false box?) [temp #f]]) + (when temp (set-box! temp s-temp-filename?)) + s-filename) + + (define/private (extract-parent) + (and s-admin + ((send s-admin get-s-standard) . > . 0) + (let ([w (send s-admin do-get-canvas)]) + (send w get-top-level)))) + + (define/public (do-begin-print) (void)) + (define/public (print-to-dc) (void)) + (define/public (do-end-print) (void)) + (define/public (do-has-print-page?) (void)) + + (def/public (print [bool? [interactive? #t]] + [bool? [fit-to-page? #t]] + [(symbol-in standard postscript) [output-mode 'standard]] + [any? [parent #f]] ; checked in ../editor.ss + [bool? [force-page-bbox? #t]] + [bool? [as-eps? #f]]) + (let ([ps? (case (system-type) + [(macosx windows) (eq? output-mode 'postscript)] + [else #t])] + [parent (or parent + (extract-parent))]) + (cond + [ps? + (let ([dc (make-object post-script-dc% interactive? parent force-page-bbox? as-eps?)]) + (when (send dc ok?) + (send dc start-doc "printing buffer") + (set! printing dc) + (let ([data (do-begin-print dc fit-to-page?)]) + (print-to-dc dc) + (set! printing #f) + (do-end-print dc data) + (send dc end-doc) + (invalidate-bitmap-cache 0.0 0.0 'end 'end))))] + [else + (let ([data #f]) + (run-printout ;; from wx + parent + interactive? + fit-to-page? + ;; begin-doc: + (lambda (dc) + (set! printing dc) + (set! data (do-begin-print printing fit-to-page?))) + ;; has page?: + (lambda (dc n) (do-has-print-page? dc n)) + ;; print-page: + (lambda (dc n) (print-to-dc dc n)) + ;; end-doc + (lambda () + (let ([pr printing]) + (set! printing #f) + (do-end-print printing data)) + (invalidate-bitmap-cache 0.0 0.0 'end 'end))))]))) + + (def/public (undo) + (when (and (not undomode?) + (not redomode?)) + (set! undomode? #t) + (perform-undos #f) + (set! undomode? #f))) + + (def/public (redo) + (when (and (not undomode?) + (not redomode?)) + (set! redomode? #t) + (perform-undos #t) + (set! redomode? #f))) + + (define/private (do-clear-undos changes start end size) + (let loop ([i start]) + (unless (= i end) + (send (vector-ref changes i) cancel) + (vector-set! changes i #f) + (loop (modulo (+ i 1) size))))) + + (define/public (add-undo-rec rec) + (cond + [interceptmode? + (send intercepted append rec)] + [undomode? + (append-undo rec #t)] + [(zero? s-noundomode) + (when (not redomode?) + (cond + [emacs-style-undo? + (when (not (= redochanges-start redochanges-end)) + (let loop ([e redochanges-end]) + (unless (= redochanges-start e) + (let ([e (modulo (+ e -1 redochanges-size) redochanges-size)]) + (append-undo (vector-ref redochanges (send (vector-ref redochanges e) inverse)) #f) + (loop e)))) + (let loop () + (unless (= redochanges-start redochanges-end) + (append-undo (vector-ref redochanges redochanges-start) #f) + (vector-set! redochanges redochanges-start #f) + (set! redochanges-start (modulo (add1 redochanges-start) redochanges-size)))) + (set! redochanges-start 0) + (set! redochanges-end 0))] + [else + (do-clear-undos redochanges redochanges-start redochanges-end redochanges-size) + (set! redochanges-start 0) + (set! redochanges-end 0)])) + (append-undo rec #f)] + [else (send rec cancel)])) + + (def/public (add-undo [(make-procedure 0) proc]) + (add-undo-rec (new proc-record% [proc proc]))) + + (define/private (append-undo rec redos?) + (if (or (eq? max-undos 'forever) (positive? max-undos)) + (let-values ([(start end size c) (get-undos redos?)]) + (let-values ([(size c) (if (zero? size) + (let ([size (min 128 (if (eq? max-undos 'forever) 128 max-undos))]) + (values size + (make-vector size #f))) + (values size c))]) + (vector-set! c end rec) + (let ([end (modulo (add1 end) size)]) + (let-values ([(start end size c) + (if (= end start) + (if (or (eq? max-undos 'forever) + (size . < . max-undos) + emacs-style-undo?) + ;; make more room + (let* ([s (min (* size 2) (if (eq? max-undos 'forever) (* size 2) max-undos))] + [naya (make-vector s #f)]) + (for ([j (in-range size)]) + (vector-set! naya j (vector-ref c (modulo (+ start j) size)))) + (values 0 size s naya)) + ;; no room to grow, so drop an undo record + (begin + (send c cancel) + (vector-set! c start #f) + (values (modulo (add1 start) size) + end + size + c))) + (values start end size c))]) + (put-undos-back redos? start end size c))))) + (send rec cancel))) + + (define/private (get-undos redos?) + (if redos? + (values redochanges-start redochanges-end redochanges-size redochanges) + (values changes-start changes-end changes-size changes))) + + (define/private (put-undos-back redos? start end size c) + (if redos? + (begin + (set! redochanges-start start) + (set! redochanges-end end) + (set! redochanges-size size) + (set! redochanges c)) + (begin + (set! changes-start start) + (set! changes-end end) + (set! changes-size size) + (set! changes c)))) + + (def/public (begin-edit-sequence) (void)) + (def/public (end-edit-sequence) (void)) + (def/public (in-edit-sequence?) #f) + (def/public (refresh-delayed?) #f) + (def/public (locations-computed?) #f) + + (define/private (perform-undos redos?) + (let ([id #f] [parity #f]) + (let-values ([(start end size c) (get-undos redos?)]) + (begin-edit-sequence) + (let loop ([end end]) + (unless (= start end) + (let ([end (modulo (+ end -1 size) size)]) + (let ([rec (vector-ref c end)]) + (vector-set! c end #f) + (put-undos-back redos? start end size c) + (when emacs-style-undo? + (set! id (send rec get-id)) + (set! parity (send rec get-parity))) + (when (send rec undo this) + (loop end)))))) + (end-edit-sequence) + (when (and emacs-style-undo? + (not redos?)) + ;; combine all new steps into one undo record, and + ;; set/generate id + (let-values ([(start end size c) (get-undos #t)]) + (unless (= start end) + (let ([cnt (let loop ([e end][cnt 0]) + (if (= start e) + cnt + (let ([e (modulo (+ e -1 size) size)]) + (if (send (vector-ref c e) is-composite?) + cnt + (loop e (add1 cnt))))))]) + (when (positive? cnt) + (let ([cu (new composite-record% [cnt cnt] [id id] [parity (not parity)])]) + (for ([i (in-range cnt)]) + (let ([e (modulo (+ (- end cnt) i size) size)]) + (send cu add-undo i (vector-ref c e)) + (vector-set! c e #f))) + (let ([e (modulo (+ (- end cnt) cnt size) size)]) + (vector-set! c e cu) + (set! redochanges-end (modulo (add1 e) size)))))))))))) + + (define/public (perform-undo-list changes) + (begin-edit-sequence) + (let loop ([changes changes]) + (unless (null? changes) + (when (send (car changes) undo this) + (loop (cdr changes))))) + (end-edit-sequence)) + + (define/public (clear-undos) + (do-clear-undos changes changes-start changes-end changes-size) + (set! changes-start 0) + (set! changes-end 0) + (do-clear-undos redochanges redochanges-start redochanges-end redochanges-size) + (set! redochanges-start 0) + (set! redochanges-end 0)) + + (def/public (set-max-undo-history [max-undo-value? v]) + (unless (or undomode? + redomode? + (eq? v max-undos)) + (when (equal? 0 v) + (clear-undos) + (set! changes #f) + (set! redochanges #f) + (set! changes-size 0) + (set! redochanges-size 0)) + ;; should we bother downsizing if max-undos gets smaller but stays + ;; non-0? + (set! max-undos v))) + + (def/public (get-max-undo-history) max-undos) + + (def/public (s-start-intercept) + (set! interceptmode? #t) + (set! intercepted null)) + + (def/public (s-end-intercept) + (begin0 + intercepted + (set! interceptmode? #f) + (set! intercepted null))) + + ;; ---------------------------------------- + + ;; see top-level functions below, at "copy ring" + + (define/public (copy-ring-next) + (vector-set! copy-ring-buffer1 copy-ring-pos common-copy-buffer) + (vector-set! copy-ring-buffer2 copy-ring-pos common-copy-buffer2) + (vector-set! copy-ring-data copy-ring-pos common-copy-region-data) + (vector-set! copy-ring-style copy-ring-pos copy-style-list) + + (set! copy-ring-pos (sub1 copy-ring-pos)) + (when (copy-ring-pos . < . 0) + (set! copy-ring-pos (sub1 copy-ring-max))) + + (set! common-copy-buffer (vector-ref copy-ring-buffer1 copy-ring-pos)) + (set! common-copy-buffer2 (vector-ref copy-ring-buffer2 copy-ring-pos)) + (set! common-copy-region-data (vector-ref copy-ring-data copy-ring-pos)) + (set! copy-style-list (vector-ref copy-ring-style copy-ring-pos))) + + (define/public (begin-copy-buffer) + (set! copy-depth (add1 copy-depth))) + (define/public (end-copy-buffer) + (set! copy-depth (sub1 copy-depth))) + + (define/public (free-old-copies) + (when copy-style-list + (if (copy-depth . > . 1) + ;; delete current "ring" occupant: + (begin + (set! common-copy-buffer null) + (set! common-copy-buffer2 null) + (set! common-copy-region-data #f) + (set! copy-style-list #f)) + + (begin + (vector-set! copy-ring-buffer1 copy-ring-pos common-copy-buffer) + (vector-set! copy-ring-buffer2 copy-ring-pos common-copy-buffer2) + (vector-set! copy-ring-data copy-ring-pos common-copy-region-data) + (vector-set! copy-ring-style copy-ring-pos copy-style-list) + + (when (copy-ring-max . > . copy-ring-dest) + ;; no more space: delete current ring occupant: + (vector-set! copy-ring-buffer1 copy-ring-dest #f) + (vector-set! copy-ring-buffer2 copy-ring-dest #f) + (vector-set! copy-ring-data copy-ring-dest #f)) + + (set! common-copy-buffer null) + (set! common-copy-buffer2 null) + (set! common-copy-region-data #f) + (set! copy-style-list #f) + (set! copy-ring-pos copy-ring-dest) + + (set! copy-ring-dest (add1 copy-ring-dest)) + (when (copy-ring-max . < . copy-ring-dest) + (set! copy-ring-max copy-ring-dest)) + (when (copy-ring-dest . >= . copy-ring-size) + (set! copy-ring-dest 0)))))) + + (define/public (install-copy-buffer time sl) + (set! copy-style-list sl) + + (when (not (= copying-self copy-depth)) + (when (or (not ALLOW-X-STYLE-SELECTION?) + (not x-clipboard-hack?)) + (send the-clipboard set-clipboard-client the-editor-clipboard-client time)))) + + (define/public (do-buffer-paste cb time local?) + ;; cut and paste to ourself? (same eventspace?) + (if (or local? + (and (not paste-text-only?) + (send cb same-clipboard-client? the-editor-clipboard-client) + (send the-editor-clipboard-client same-eventspace? (current-eventspace)))) + ;; local direct copy: + (begin + (set! copy-depth (add1 copy-depth)) + (map (lambda (snip bd) + (insert-paste-snip (send snip copy) bd)) + (reverse common-copy-buffer) + (reverse common-copy-buffer2)) + (set! copy-depth (sub1 copy-depth)) + (when (and common-copy-region-data + (this . is-a? . text%)) + (send this paste-region-data common-copy-region-data))) + ;; general paste: + (or + (and (not paste-text-only?) + (let ([str (send cb get-clipboard-data "WXME" time)]) + (and str + (let* ([b (make-object editor-stream-in-bytes-base% str)] + [mf (make-object editor-stream-in% b)]) + (and (read-editor-version mf b #t #f) + (begin + (when (read-editor-global-header mf) + (when (send mf ok?) + (when (read-from-file mf) + (let ([data (read-buffer-data mf)]) + (and data + (this . is-a? . text%) + (send this paste-region-data data)))))) + (read-editor-global-footer mf) + #t)))))) + (and (not paste-text-only?) + (let ([bm (send cb get-clipboard-bitmap time)]) + (and bm + (begin + (insert-paste-snip (make-object image-snip% bm) #f) + #t)))) + (let ([str (send cb get-clipboard-string time)]) + ;; no data => empty string + (insert-paste-string str))))) + + (def/public (copy-self) (void)) + + (def/public (copy-self-to [editor<%> m]) + ;; copy style list + (send (send m get-s-style-list) copy s-style-list) + ;; copy all the snips: + (let ([save-buffer common-copy-buffer] + [save-buffer2 common-copy-buffer2] + [save-styles copy-style-list] + [save-data common-copy-region-data] + [save-cs copying-self]) + + (send m begin-edit-sequence) + + (set! common-copy-buffer null) + (set! common-copy-buffer2 null) + (set! copy-style-list #f) + (set! common-copy-region-data #f) + (set! copying-self (add1 copy-depth)) + + (cond + [(this . is-a? . text%) + (send this copy #t 0 0 (send this last-position))] + [(this . is-a? . pasteboard%) + (begin-edit-sequence) + (let ([unselect + (let loop ([s (send this find-first-snip)]) + (if s + (if (send this is-selected? s) + (begin + (send this add-selected s) + (cons s (loop (snip->next s)))) + (loop (snip->next s))) + null))]) + (send this copy #t 0) + (for-each (lambda (s) + (send this remove-selected s)) + unselect)) + (end-edit-sequence)]) + + (let ([copy-snips (reverse common-copy-buffer)] + [copy-snips2 (reverse common-copy-buffer2)]) + + (set! common-copy-buffer save-buffer) + (set! common-copy-buffer2 save-buffer2) + (set! copy-style-list save-styles) + (set! common-copy-region-data save-data) + (set! copying-self save-cs) + + (when (this . is-a? . text%) + (send m do-insert-snips copy-snips 0)) + + (for-each (lambda (s bfd) + (unless (this . is-a? . text%) + (send m insert s s)) ;; before itself -> at end + (when bfd + (send m set-snip-data s bfd))) + copy-snips + copy-snips2) + + (send m size-cache-invalid) + + (send m set-min-width (get-min-width)) + (send m set-max-width (get-max-width)) + (send m set-min-height (get-min-height)) + (send m set-max-height (get-max-height)) + + (let-boxes ([temp? (box #f)] + [f (box #f)]) + (set-box! f (get-filename temp?)) + (send m set-filename f temp?)) + + (send m set-max-undo-history (get-max-undo-history)) + + (send m set-keymap (get-keymap)) + + (send m set-inactive-caret-threshold (get-inactive-caret-threshold)) + (send m set-load-overwrites-styles (get-load-overwrites-styles)) + + (send m end-edit-sequence)))) + + ;; ---------------------------------------- + + (define/public (own-x-selection) (void)) + + (define/public (do-own-x-selection on? force?) + (if on? + (if (and (not force?) + (not (eq? editor-x-selection-allowed this))) + #f + (begin + (when editor-x-selection-owner + (send editor-x-selection-owner own-x-selection #f #t #f) + (set! editor-x-selection-owner #f)) + (set! x-selection-copied? #f) + (send the-x-selection-clipboard set-clipboard-client the-editor-x-clipboard-client 0) + (set! editor-x-selection-owner this) + #t)) + (begin + (when (eq? this editor-x-selection-owner) + (set! editor-x-selection-owner #f) + (when (and (not x-selection-copied?) + (send the-x-selection-clipboard same-clipboard-client? + the-editor-x-clipboard-client)) + (send the-x-selection-clipboard set-clipboard-string "" 0))) + #t))) + + (define/public (copy-out-x-selection) + (when (eq? this editor-x-selection-owner) + (copy-into-selection) + (set! x-selection-copied? #t))) + + (def/public (get-paste-text-only) + paste-text-only?) + + (def/public (set-paste-text-only [any? pto?]) + (set! paste-text-only? (and pto? #t))) + + ;; ---------------------------------------- + + (def/public (lock [any? lock?]) + (set! s-user-locked? (and lock? #t))) + + (def/public (is-locked?) s-user-locked?) + + (def/public (modified?) s-modified?) + + (def/public (set-modified [any? mod?]) + (let ([mod? (and mod? #t)]) + (unless (eq? mod? s-modified?) + (set! s-modified? mod?) + (when mod? + (set! num-parts-modified 1)) + + (when (and (not mod?) + (not undomode?)) + ;; get rid of undos that reset the modification state + (set! num-parts-modified 0) + (let loop ([i changes-end]) + (unless (= i changes-start) + (let ([i (modulo (+ i -1 changes-size) changes-size)]) + (send (vector-ref changes i) drop-set-unmodified) + (loop i)))) + (let loop ([i redochanges-end]) + (unless (= i redochanges-start) + (let ([i (modulo (+ i -1 redochanges-size) redochanges-size)]) + (send (vector-ref redochanges i) drop-set-unmodified) + (loop i))))) + + (when s-admin + (send s-admin modified s-modified?)) + + (when (and (not mod?) (not undomode?)) + ;; tell all snips that they should now consider themselves unmodified: + (let loop ([snip (find-first-snip)]) + (when snip + (send snip set-unmodified) + (loop (snip->next snip)))))))) + + (def/public (on-snip-modified [snip% s] [any? mod?]) + (if (not mod?) + (when (= num-parts-modified 1) + (set! num-parts-modified 0) + (when s-modified? + (set-modified #f))) + (if s-modified? + (set! num-parts-modified (add1 num-parts-modified)) + (set-modified #t)))) + + (def/public (get-inactive-caret-threshold) + s-inactive-caret-threshold) + + (def/public (set-inactive-caret-threshold [(symbol-in no-caret show-inactive-caret show-caret) v]) + (set! s-inactive-caret-threshold v)) + + (define/public (scroll-editor-to localx localy w h refresh? bias) + (if s-admin + (send s-admin scroll-to localx localy w h refresh? bias) + #f)) + + (def/public (refresh [real? left] [real? top] [nonnegative-real? width] [nonnegative-real? height] + [(symbol-in no-caret show-inactive-caret show-caret) show-caret] + [(make-or-false color%) bg-color]) + (void)) + + (def/public (on-paint [any? pre?] [dc<%> dc] + [real? l] [real? t] [real? r] [real? b] + [real? dx] [real? dy] + [(symbol-in no-caret show-inactive-caret show-caret) show-caret]) + (void)) + + (def/public (can-save-file? [path-string? filename] + [symbol? format]) + #t) + + (def/public (on-save-file [path-string? filename] + [symbol? format]) + (void)) + + (def/public (after-save-file [any? ok?]) + (void)) + + (def/public (can-load-file? [path-string? filename] + [symbol? format]) + #t) + + (def/public (on-load-file [path-string? filename] + [symbol? format]) + (void)) + + (def/public (after-load-file [any? ok?]) + (void)) + + (def/public (on-edit-sequence) (void)) + + (def/public (after-edit-sequence) (void)) + + (def/public (on-display-size) (void)) + + (def/public (on-change) (void)) + + (def/public (on-display-size-when-ready) + (cond + [(in-edit-sequence?) + (set! s-need-on-display-size? #t)] + [(or (not seq-lock) + (semaphore-try-wait? seq-lock)) + (when seq-lock + (semaphore-post seq-lock)) + (on-display-size)] + [else (set! s-need-on-display-size? #t)])) + + (def/public (begin-sequence-lock) + (call-with-semaphore + global-lock + (lambda () + (unless seq-lock + (set! seq-lock (make-semaphore 1))))) + + ;; "Try" really should succeed, because multiple refreshes are + ;; prevented through other flags. Still, we don't want to block if + ;; someone previously escaped from a repaint. + (void (semaphore-try-wait? seq-lock))) + + (def/public (end-sequence-lock) + (semaphore-post seq-lock)) + + (def/public (wait-sequence-lock) + (when seq-lock + (sync seq-lock) + (semaphore-post seq-lock))) + + (def/public (get-file [(make-or-false path-string?) path]) + (editor-get-file "choose a file" (extract-parent) #f path)) + + (def/public (put-file [(make-or-false path-string?) dir] + [(make-or-false string?) suggested-name]) + (editor-put-file "save file as" (extract-parent) dir suggested-name)) + + (def/public (set-load-overwrites-styles [any? b?]) + (set! loadoverwritesstyles? (and b? #t))) + + (def/public (get-load-overwrites-styles) loadoverwritesstyles?)) + +(define editor<%> (class->interface editor%)) + +;; ------------------------------------------------------------ + +(define/top (add-editor-keymap-functions [keymap% tab]) + (let ([add (lambda (n f) + (send tab add-function n f))]) + (add "copy-clipboard" (lambda (e event) (send e copy #f (send event get-time-stamp)))) + (add "copy-append-clipboard" (lambda (e event) (send e copy #t (send event get-time-stamp)))) + (add "paste-clipboard" (lambda (e event) (send e paste (send event get-time-stamp)))) + (add "paste-x-selection" (lambda (e event) (send e paste-x-selection (send event get-time-stamp)))) + (add "cut-clipboard" (lambda (e event) (send e cut #f (send event get-time-stamp)))) + (add "cut-append-clipboard" (lambda (e event) (send e cut #t (send event get-time-stamp)))) + (add "delete-to-end-of-line" (lambda (e event) (send e kill (send event get-time-stamp)))) + (add "undo" (lambda (e event) (send e undo))) + (add "redo" (lambda (e event) (send e redo))) + (add "delete-selection" (lambda (e event) (send e clear))) + (add "clear-selection" (lambda (e event) (send e clear))) + (add "select-all" (lambda (e event) (send e select-all))))) + +;; ------------------------------------------------------------ + +(define (write-buffer-data f data) + (let loop ([data data]) + (if data + (let ([mp (send f do-map-position (send data get-s-dataclass))]) + (send f put mp) + (let ([req? (send (send data get-s-dataclass) get-s-required?)]) + (let-values ([(data-start data-pos) + (if req? + (values #f #f) + (values (send f tell) + (begin + (send f put-fixed 0) + (send f tell))))]) + (if (not (send data write f)) + #f + (begin + (unless req? + (let ([data-end (send f tell)]) + (send f jump-to data-start) + (send f put-fixed (- data-end data-pos)) + (send f jump-to data-end))) + (loop (send data get-s-next))))))) + (begin + (send f put 0) + #t)))) + +(define (write-snips-to-file f style-list snip-list + start-snip end-snip + extra-data buffer) + (and + (write-styles-to-file style-list f) + (let ([all-start (send f tell)]) + (send f put-fixed 0) + + (let ([snip-list + (if snip-list + (reverse snip-list) + (let loop ([snip start-snip]) + (if (and snip + (not (eq? snip end-snip))) + (cons snip (loop (snip->next snip))) + null)))]) + + (let ([num-headers + (let loop ([num-headers 0] + [snips snip-list]) + (if (null? snips) + num-headers + (let ([snip (car snips)]) + (let ([sclass (snip->snipclass snip)]) + (unless sclass + (error 'write-snips-to-file "snip has no snipclass")) + (if (send f do-get-header-flag sclass) + (begin + (send f put (send f do-map-position sclass)) + (let ([header-start (send f tell)]) + (send f put-fixed 0) + (let ([header-pos (send f tell)]) + (if (not (send sclass write-header f)) + #f + (begin + (send f do-set-header-flag sclass) + (let ([header-end (send f tell)]) + (send f jump-to header-start) + (send f put-fixed (- header-end header-pos)) + (send f jump-to header-end) + (if (send f ok?) + (loop (add1 num-headers) + (cdr snips)) + #f))))))) + (loop num-headers (cdr snips)))))))]) + + (and + num-headers + (let ([all-end (send f tell)]) + (send f jump-to all-start) + (send f put-fixed num-headers) + (send f jump-to all-end) + + (send f put (length snip-list)) + + (andmap + (lambda (snip data) + (let ([sclass (snip->snipclass snip)]) + (if sclass + (send f put (send f do-map-position sclass)) + (send f put -1)) + (let-values ([(snip-start snip-pos) + (if (or (not sclass) + (not (send sclass get-s-required?))) + (values (send f tell) + (begin + (send f put-fixed 0) + (send f tell))) + (values #f #f))]) + (let ([style-index (send style-list style-to-index (snip->style snip))]) + (when (not style-index) + (error 'write-snips-to-file "bad style discovered")) + (send f put style-index)) + (send snip write f) + (and (write-buffer-data f data) + (begin + (when snip-start + (let ([snip-end (send f tell)]) + (send f jump-to snip-start) + (send f put-fixed (- snip-end snip-pos)) + (send f jump-to snip-end))) + (send f ok?)))))) + snip-list + (if extra-data + (reverse extra-data) + (map (lambda (snip) + (send buffer get-snip-data snip)) + snip-list)))))))))) + +;; ------------------------------------------------------------ + +;; Copy and the copy ring: the current clipboard content is stored in +;; common-copy-buffer, etc. to implement the copy ring, then when a +;; copy is started, we moved the wxmb_common-copy-buffer, etc. values +;; into a copy ring. yanking from the ring swaps the values in +;; wxmb_common-copy-buffer, etc. and the ring values and adjust the +;; pointer into the ring. + +(define copy-depth 0) + +(define copy-ring-size 30) +(define copy-ring-pos 0) +(define copy-ring-max 1) +(define copy-ring-dest 1) + +(define copy-ring-buffer1 (make-vector copy-ring-size #f)) +(define copy-ring-buffer2 (make-vector copy-ring-size #f)) + +(define copy-ring-style (make-vector copy-ring-size #f)) +(define copy-ring-data (make-vector copy-ring-size #f)) + +(define common-copy-buffer null) +(define common-copy-buffer2 null) +(define copy-style-list #f) +(define common-copy-region-data #f) + +(define selection-copy-buffer #f) +(define selection-copy-buffer2 #f) +(define selection-copy-style-list #f) +(define selection-copy-region-data #f) + +(define (set-common-copy-region-data! v) (set! common-copy-region-data v)) +(define (cons-common-copy-buffer! v) (set! common-copy-buffer (cons v common-copy-buffer))) +(define (cons-common-copy-buffer2! v) (set! common-copy-buffer2 (cons v common-copy-buffer2))) + +(define copying-self 0) + +(define editor-x-selection-mode? ALLOW-X-STYLE-SELECTION?) +(define editor-x-selection-owner #f) +(define editor-x-selection-allowed #f) +(define x-selection-copied? #f) +(define x-clipboard-hack? #f) + +(define (generic-get-data fformat copy-buffer copy-buffer2 copy-styles copy-region-data) + (cond + [(equal? fformat "TEXT") + (string->bytes/utf-8 + (let ([out (open-output-string)]) + (for-each (lambda (snip) + (let ([s (send snip get-text 0 (snip->count snip) #t)]) + (display s out))) + (reverse copy-buffer)) + (let ([s (get-output-string out)]) + (cond + [(eq? 'macosx (system-type)) + ;; change newline to return + (regexp-replace* #rx"\r" s "\n")] + [(eq? 'windows (system-type)) + ;; change newline to return-newline: + (regexp-replace* #rx"\n" s "\r\n")] + [else s]))))] + [(equal? fformat "WXME") + (let* ([b (make-object editor-stream-out-bytes-base%)] + [mf (make-object editor-stream-out% b)]) + (write-editor-version mf b) + (write-editor-global-header mf) + (and (send mf ok?) + (begin + (send mf put-fixed 0) + (and (write-snips-to-file mf copy-styles copy-buffer #f #f copy-buffer2 #f) + (begin + (send mf put-fixed 0) + (write-buffer-data mf copy-region-data)))) + (write-editor-global-footer mf) + (send b get-bytes)))] + [else #""])) + +(defclass editor-clipboard-client% clipboard-client% + (inherit add-type) + (super-new) + (add-type "TEXT") + (add-type "WXME") + (define/override (get-data format) + (generic-get-data format + common-copy-buffer + common-copy-buffer2 + copy-style-list + common-copy-region-data)) + (define/override (on-replaced) + (void))) + +(defclass editor-x-clipboard-client% clipboard-client% + (inherit add-type) + (super-new) + (add-type "TEXT") + (add-type "WXME") + (define/override (get-data format) + (cond + [(and (not x-selection-copied?) + (not editor-x-selection-owner)) + ""] + [else + (when (or (not x-selection-copied?) + editor-x-selection-owner) + (copy-into-selection)) + + ;; if nothing is copied (e.g., do-copy is overriden to not copy anything + ;; or copies directly to clipboard): + (if (not selection-copy-style-list) + (if (send the-x-selection-clipboard same-clipboard-client? this) + #f + (send the-x-selection-clipboard get-clipboard-data format 0)) + (generic-get-data format + selection-copy-buffer + selection-copy-buffer2 + selection-copy-style-list + selection-copy-region-data))])) + (define/override (on-replaced) + (if editor-x-selection-owner + ;; in case this client replaced itself somewhere along the way: + (when (not (send the-x-selection-clipboard same-clipboard-client? this)) + (let ([b editor-x-selection-owner]) + (set! editor-x-selection-owner #f) + (set! x-selection-copied? #f) + (send b own-x-selection #f #t #f))) + (set! x-selection-copied? #f)))) + +(define the-editor-clipboard-client + (new editor-clipboard-client%)) +(define the-editor-x-clipboard-client + (new editor-x-clipboard-client%)) + +(define/top (editor-set-x-selection-mode [any? on?]) + (when ALLOW-X-STYLE-SELECTION? + (set! editor-x-selection-mode? (and on? #t)) + (when (and (not on?) + (send the-x-selection-clipboard same-clipboard-client? + the-editor-x-clipboard-client)) + (send the-x-selection-clipboard set-clipboard-string "" 0)))) + +(define (copy-into-selection) + ;; copy all the snips: + (set! x-clipboard-hack? #t) + + ;; save normal buffers: + (let ([save-buffer common-copy-buffer] + [save-buffer2 common-copy-buffer2] + [save-styles copy-style-list] + [save-data common-copy-region-data]) + + ;; set up new selection buffers, and redirect: + (set! common-copy-buffer null) + (set! common-copy-buffer2 null) + (set! copy-style-list #f) + (set! common-copy-region-data #f) + + (send editor-x-selection-owner copy #f 0) + + ;; move "normal" buffers to selection: + (set! selection-copy-buffer common-copy-buffer) + (set! selection-copy-buffer2 common-copy-buffer2) + (set! selection-copy-style-list copy-style-list) + (set! selection-copy-region-data common-copy-region-data) + + ;; restore normal buffers: + (set! common-copy-buffer save-buffer) + (set! common-copy-buffer2 save-buffer2) + (set! copy-style-list save-styles) + (set! common-copy-region-data save-data)) + + (set! x-clipboard-hack? #f)) + +;; ------------------------------------------------------------ + +(define (read-buffer-data f) + (let loop ([data #f]) + (let-boxes ([extra-data-index 0]) + (send f get extra-data-index) + (if (zero? extra-data-index) + data + (let ([dclass (send (send f get-s-bdl) find-by-map-position f extra-data-index)]) + (let ([datalen (if (or (not dclass) + (not (send dclass get-s-required?))) + (let-boxes ([datalen 0]) + (send f get datalen) + datalen) + -1)]) + (if dclass + (let ([start (send f tell)]) + (when (datalen . >= . 0) + (send f set-boundary datalen)) + (let ([newdata (send dclass read f)]) + (and + newdata + (begin + (send newdata set-s-next data) + (let ([data newdata]) + (when (datalen . >= . 0) + (let ([rcount (- (send f tell) start)]) + (when (rcount . < . datalen) + (error 'read-buffer-data "underread (caused by file corruption?)")) + (send f skip (- datalen rcount))) + (send f remove-boundary)) + (and (send f ok?) + (loop data))))))) + ;; unknown extra data + (begin + (send f skip datalen) + (and (send f ok?) + (loop data)))))))))) + +;; ------------------------------------------------------------ + +(define MRED-READER-STR #"#reader(lib\"read.ss\"\"wxme\")") +(define MRED-START-STR #"WXME") +(define MRED-FORMAT-STR #"01") +(define MRED-VERSION-STR #"08") +(define MRED-VERSION-RX #rx"^0[1-8]$") + +(define (write-editor-version f b) + (send b write-bytes MRED-READER-STR) + (send b write-bytes MRED-START-STR) + (send b write-bytes MRED-FORMAT-STR) + (send b write-bytes MRED-VERSION-STR) + (send b write-bytes #" ## ") + (not (send b bad?))) + +(define MRED-READER+START-STR (bytes-append MRED-READER-STR MRED-START-STR)) + +(define (detect-wxme-file who f peek?) + (let* ([l1 (bytes-length MRED-START-STR)] + [s (if peek? + (peek-bytes l1 0 f) + (read-bytes l1 f))]) + (or (equal? s MRED-START-STR) + (and (equal? s (subbytes MRED-READER-STR 0 l1)) + (let ([s (bytes-append + s + (let ([v (if peek? + (peek-bytes (- (bytes-length MRED-READER+START-STR) l1) l1 f) + (read-bytes (- (bytes-length MRED-READER+START-STR) l1) f))]) + (if (eof-object? v) + "" + v)))]) + (equal? s MRED-READER+START-STR)))))) + +(define (read-editor-version mf b parse-format? show-errors?) + (and + (or + (not parse-format?) + (let* ([n1 (bytes-length MRED-START-STR)] + [vbuf (make-vector n1)]) + (let ([n (send b read vbuf)]) + (or (and (= n (vector-length vbuf)) + (bytes=? MRED-START-STR (string->bytes/latin-1 (list->string (vector->list vbuf))))) + ;; maybe we have a #reader... prefix? + (let* ([n2 (bytes-length MRED-READER-STR)] + [vbuf2 (make-vector (- n2 n1))]) + (let ([n (send b read vbuf2)]) + (and (= n (- n2 n1)) + (bytes=? MRED-READER-STR + (string->bytes/latin-1 + (string-append (list->string (vector->list vbuf)) + (list->string (vector->list vbuf2))))) + ;; yes, so try reading start again. + (let ([n (send b read vbuf)]) + (and (= n (vector-length vbuf)) + (bytes=? MRED-START-STR (string->bytes/latin-1 (list->string (vector->list vbuf))))))))) + (if show-errors? + (error (method-name 'pasteboard%: 'insert-file) "not a WXME file") + #f))))) + (begin + (let* ([n1 (bytes-length MRED-FORMAT-STR)] + [vbuf (make-vector n1)]) + (let ([n (send b read vbuf)]) + (send mf set-s-read-format (string->bytes/latin-1 (list->string (vector->list vbuf)))))) + (let* ([n1 (bytes-length MRED-VERSION-STR)] + [vbuf (make-vector n1)]) + (let ([n (send b read vbuf)]) + (and (= n n1) + (send mf set-s-read-version (string->bytes/latin-1 (list->string (vector->list vbuf))))))) + (check-format-and-version mf b show-errors?)))) + +(define (read-editor-global-header f) + (send (send f get-s-scl) reset-header-flags f) + (if (not (send (send f get-s-scl) read f)) + #f + (begin + (setup-style-reads-writes f) + (send (send f get-s-bdl) read f)))) + +(define (read-editor-global-footer f) + (done-style-reads-writes f) + (send (send f get-s-scl) reset-header-flags f) + #t) + +(define (write-editor-global-header f) + (send f pretty-start) + (send (send f get-s-scl) reset-header-flags f) + (if (not (send (send f get-s-scl) write f)) + #f + (begin + (setup-style-reads-writes f) + (send (send f get-s-bdl) write f)))) + +(define (write-editor-global-footer f) + (done-style-reads-writes f) + (send (send f get-s-scl) reset-header-flags f) + (send f pretty-finish) + #t) + +(define (check-format-and-version s b show-errors?) + (and + (or (bytes=? (send s get-s-read-format) MRED-FORMAT-STR) + (if show-errors? + (error 'load-file "unknown format number in WXME file format: ~s" + (send s get-s-read-format)) + #f)) + (or (regexp-match MRED-VERSION-RX (send s get-s-read-format)) + (if show-errors? + (error 'load-file "unknown version number in WXME file format") + #f)) + (if ((send s get-wxme-version) . > . 3) + ;; need to skip " ## " + (let* ([v (make-vector 4)] + [n (send b read v)]) + (or (and (= n 4) + (char=? (vector-ref v 0) #\space) + (char=? (vector-ref v 1) #\#) + (char=? (vector-ref v 2) #\#) + (member (vector-ref v 3) '(#\space #\return #\newline))) + (if show-errors? + (error 'load-file "WXME file missing ' ## ' mark") + #f))) + #t))) diff --git a/collects/mred/private/wxme/keymap.ss b/collects/mred/private/wxme/keymap.ss new file mode 100644 index 0000000000..4f2f66a92f --- /dev/null +++ b/collects/mred/private/wxme/keymap.ss @@ -0,0 +1,737 @@ +#lang scheme/base +(require scheme/class + "../syntax.ss" + "wx.ss") + +(provide keymap% + map-command-as-meta-key) + +(define map-command-as-meta? #f) + +(define/top (map-command-as-meta-key [bool? v]) + (set! map-command-as-meta? v)) + +(define (as-meta-key k) + (case (system-type) + [(macosx) (if map-command-as-meta? + k + #f)] + [else k])) + +(define (as-cmd-key k) + (case (system-type) + [(macosx) k] + [else #f])) + +(define keylist + #hash(("leftbutton" . mouse-left) + ("rightbutton" . mouse-right) + ("middlebutton" . mouse-middle) + ("leftbuttondouble" . mouse-left-double) + ("rightbuttondouble" . mouse-right-double) + ("middlebuttondouble" . mouse-middle-double) + ("leftbuttontriple" . mouse-left-triple) + ("rightbuttontriple" . mouse-right-triple) + ("middlebuttontriple" . mouse-middle-triple) + ("leftbuttonseq" . mouse-left) + ("rightbuttonseq" . mouse-right) + ("middlebuttonseq" . mouse-middle) + ("wheelup" . wheel-up) + ("wheeldown" . wheel-down) + ("esc" . escape) + ("delete" . delete) + ("del" . #\rubout) + ("insert" . insert) + ("ins" . insert) + ("add" . add) + ("subtract" . subtract) + ("multiply" . multiply) + ("divide" . divide) + ("backspace" . back) + ("back" . back) + ("return" . #\return) + ("enter" . #\return) + ("tab" . #\tab) + ("space" . #\space) + ("right" . right) + ("left" . left) + ("up" . up) + ("down" . down) + ("home" . home) + ("end" . end) + ("pageup" . prior) + ("pagedown" . next) + ("semicolon" . #\;) + ("colon" . #\:) + ("numpad0" . numpad0) + ("numpad1" . numpad1) + ("numpad2" . numpad2) + ("numpad3" . numpad3) + ("numpad4" . numpad4) + ("numpad5" . numpad5) + ("numpad6" . numpad6) + ("numpad7" . numpad7) + ("numpad8" . numpad8) + ("numpad9" . numpad9) + ("numpadenter" . #\u3) + ("f1" . f1) + ("f2" . f2) + ("f3" . f3) + ("f4" . f4) + ("f5" . f5) + ("f6" . f6) + ("f7" . f7) + ("f8" . f8) + ("f9" . f9) + ("f10" . f10) + ("f11" . f11) + ("f12" . f12) + ("f13" . f13) + ("f14" . f14) + ("f15" . f15) + ("f16" . f16) + ("f17" . f17) + ("f18" . f18) + ("f19" . f19) + ("f20" . f20) + ("f21" . f21) + ("f22" . f22) + ("f23" . f23) + ("f24" . f24))) +(define rev-keylist + (make-immutable-hash + (hash-map keylist (lambda (k v) (cons v k))))) + +(define-struct kmfunc (name f)) + +(define-struct key (code + + shift-on? + shift-off? + ctrl-on? + ctrl-off? + alt-on? + alt-off? + meta-on? + meta-off? + cmd-on? + cmd-off? + caps-on? + caps-off? + + score + + check-other? + fullset? + + [fname #:mutable] + + isprefix? + seqprefix)) + +(define-local-member-name + chain-handle-key-event + get-best-score + chain-handle-mouse-event + get-best-mouse-score + cycle-check) + +(defclass keymap% object% + + (super-new) + + (define functions (make-hash)) + (define keys (make-hash)) + + (define prefix #f) + (define prefixed? #f) + + (define active-mouse-function #f) + + (define grab-key-function #f) + (define grab-mouse-function #f) + (define on-break #f) + + (define chain-to null) + + (define last-time 0) + (define last-x 0) + (define last-y 0) + (define click-count 0) + (define last-code #f) + (define last-button #f) + + (define double-interval (get-double-click-threshold)) + + (def/public (reset) + (set! prefix #f) + (set! prefixed? #f) + + (for-each (lambda (c) + (send c reset)) + chain-to)) + + (def/public (break-sequence) + (set! prefix #f) + + (when on-break + (let ([f on-break]) + (set! on-break #f) + (f))) + + (for-each (lambda (c) + (send c break-sequence)) + chain-to)) + + (def/public (set-break-sequence-callback [(make-procedure 0) f]) + (let ([old on-break]) + (set! on-break f) + (when old (old)))) + + (define/private (find-key code other-code alt-code other-alt-code caps-code + shift? ctrl? alt? meta? cmd? caps? + prefix) + (for*/fold ([best-key #f] + [best-score -1]) + ([findk (in-list (list code other-code alt-code other-alt-code caps-code))] + [key (in-list (hash-ref keys findk null))]) + (if (and (or (eqv? (key-code key) code) + (and (key-check-other? key) + (or (eqv? (key-code key) other-code) + (eqv? (key-code key) alt-code) + (eqv? (key-code key) other-alt-code) + (eqv? (key-code key) caps-code)))) + (or (and (key-shift-on? key) shift?) + (and (key-shift-off? key) (not shift?)) + (and (not (key-shift-on? key)) (not (key-shift-off? key)))) + (or (and (key-ctrl-on? key) ctrl?) + (and (key-ctrl-off? key) (not ctrl?)) + (and (not (key-ctrl-on? key)) (not (key-ctrl-off? key)))) + (or (and (key-alt-on? key) alt?) + (and (key-alt-off? key) (not alt?)) + (and (not (key-alt-on? key)) (not (key-alt-off? key)))) + (or (and (key-meta-on? key) meta?) + (and (key-meta-off? key) (not meta?)) + (and (not (key-meta-on? key)) (not (key-meta-off? key)))) + (or (and (key-cmd-on? key) cmd?) + (and (key-cmd-off? key) (not cmd?)) + (and (not (key-cmd-on? key)) (not (key-cmd-off? key)))) + (or (and (key-caps-on? key) caps?) + (and (key-caps-off? key) (not caps?)) + (and (not (key-caps-on? key)) (not (key-caps-off? key)))) + (eq? (key-seqprefix key) prefix)) + (let ([score (+ (key-score key) + (if (eqv? (key-code key) code) + 0 + (if (eqv? (key-code key) other-alt-code) + -4 + -2)))]) + (if (score . > . best-score) + (values key score) + (values best-key best-score))) + (values best-key best-score)))) + + (define/private (do-map-function code shift ctrl alt meta cmd caps check-other? + fname prev isprefix? fullset?) + ;; look for existing key mapping: + (let ([key + (ormap (lambda (key) + (and (eqv? (key-code key) code) + (eq? (key-shift-on? key) (shift . > . 0)) + (eq? (key-shift-off? key) (shift . < . 0)) + (eq? (key-ctrl-on? key) (ctrl . > . 0)) + (eq? (key-ctrl-off? key) (ctrl . < . 0)) + (eq? (key-alt-on? key) (alt . > . 0)) + (eq? (key-alt-off? key) (alt . < . 0)) + (eq? (key-meta-on? key) (meta . > . 0)) + (eq? (key-meta-off? key) (meta . < . 0)) + (eq? (key-cmd-on? key) (cmd . > . 0)) + (eq? (key-cmd-off? key) (cmd . < . 0)) + (eq? (key-caps-on? key) (caps . > . 0)) + (eq? (key-caps-off? key) (caps . < . 0)) + (eq? (key-check-other? key) check-other?) + (eq? (key-seqprefix key) prev) + key)) + (hash-ref keys code null))]) + + (if key + ;; Found existing + (if (not (eq? isprefix? (key-isprefix? key))) + ;; prefix vs no-prefix mismatch: + (let ([s + (string-append + (if (meta . > . 0) "m:" "") + (if (meta . < . 0) "~m:" "") + (if (cmd . > . 0) "d:" "") + (if (cmd . < . 0) "~d:" "") + (if (alt . > . 0) "a:" "") + (if (alt . < . 0) "~a:" "") + (if (ctrl . > . 0) "c:" "") + (if (ctrl . < . 0) "~c:" "") + (if (shift . > . 0) "s:" "") + (if (shift . < . 0) "~s:" "") + (or (hash-ref rev-keylist code) + (format "~c" code)))]) + (error (method-name 'keymap% 'map-function) + "~s is already mapped as a ~aprefix key" + s (if isprefix? "non-" ""))) + (begin + (set-key-fname! key (string->immutable-string fname)) + key)) + ;; Create new + (let ([newkey (make-key + code + (shift . > . 0) (shift . < . 0) + (ctrl . > . 0) (ctrl . < . 0) + (alt . > . 0) (alt . < . 0) + (meta . > . 0) (meta . < . 0) + (cmd . > . 0) (cmd . < . 0) + (caps . > . 0) (caps . < . 0) + (+ (if (shift . > . 0) 1 0) + (if (shift . < . 0) 5 0) + (if (ctrl . > . 0) 1 0) + (if (ctrl . < . 0) 5 0) + (if (alt . > . 0) 1 0) + (if (alt . < . 0) 5 0) + (if (meta . > . 0) 1 0) + (if (meta . < . 0) 5 0) + (if (cmd . > . 0) 1 0) + (if (cmd . < . 0) 5 0) + (if (caps . > . 0) 1 0) + (if (caps . < . 0) 5 0) + (if check-other? 6 30)) + check-other? + fullset? + (string->immutable-string fname) + isprefix? + prev)]) + (hash-set! keys code (cons newkey (hash-ref keys code null))) + newkey)))) + + (define/private (get-code str) + (let ([code (hash-ref keylist (string-downcase str) #f)]) + (if code + (values code (member str '("leftbuttonseq" + "middlebuttonseq" + "rightbuttonseq"))) + (if (= 1 (string-length str)) + (values (string-ref str 0) + #f) + (values #f #f))))) + + (def/public (map-function [string? keys] + [string? fname]) + (if (string=? keys "") + (error (method-name 'keymap% 'map-function) + "bad key string: ~e" + keys) + (let loop ([seq (regexp-split #rx";" keys)] + [prev-key #f]) + (let ([str (car seq)]) + (define (bad-string msg) + (error (method-name 'keymap% 'map-function) + "bad keymap string: ~e~a: ~a" + str + (if (equal? str keys) + "" + (format " within ~e" keys)) + msg)) + (let-values ([(str default-off?) + (if (regexp-match? #rx"^:" str) + (values (substring str 1) #t) + (values str #f))]) + (let sloop ([str str] + [downs null] + [ups null] + [others? #f]) + (cond + [(regexp-match? #rx"^[?]:" str) + (sloop (substring str 2) downs ups #t)] + [(regexp-match? #rx"^~[SsCcAaMmDdLl]:" str) + (let ([c (char-downcase (string-ref str 1))]) + (if (memv c downs) + (bad-string (format "inconsistent ~a: modifier state" c)) + (sloop (substring str 3) downs (cons c ups) others?)))] + [(regexp-match? #rx"^[SsCcAaMmDdLl]:" str) + (let ([c (char-downcase (string-ref str 0))]) + (if (memv c ups) + (bad-string (format "inconsistent ~a: modifier state" c)) + (sloop (substring str 2) (cons c downs) ups others?)))] + [else + (let-values ([(code fullset?) (get-code str)]) + (if (not code) + (bad-string "unrecognized key name") + (let-values ([(downs code) + (if (and (char? code) + ((char->integer code) . > . 0) + ((char->integer code) . < . 127) + (char-alphabetic? code)) + (cond + [(memq #\s downs) + (if (or (and (eq? (system-type) 'macosx) + (not (memq #\m downs)) + (not (memq #\d downs))) + (and (eq? (system-type) 'windows) + (or (not (memq #\c downs)) + (memq #\m downs)))) + (values downs (char-upcase code)) + (values downs code))] + [(char-upper-case? code) + (values (cons #\s downs) code)] + [else + (values downs code)]) + (values downs code))]) + (let ([newkey + (let ([modval (lambda (c) + (cond + [(memq c downs) 1] + [(memq c ups) -1] + [else (if default-off? -1 0)]))]) + (do-map-function code + (modval #\s) + (modval #\c) + (modval #\a) + (modval #\m) + (modval #\d) + (modval #\l) + others? + fname + prev-key + (not (null? (cdr seq))) + fullset?))]) + (if (null? (cdr seq)) + (void) + (loop (cdr seq) newkey))))))]))))))) + + (define/private (handle-event code other-code alt-code other-alt-code caps-code + shift? ctrl? alt? meta? cmd? caps? + score) + (let-values ([(key found-score) + (find-key code other-code alt-code other-alt-code caps-code + shift? ctrl? alt? meta? cmd? caps? prefix)]) + (set! prefix #f) + + (if (and key (found-score . >= . score)) + (if (key-isprefix? key) + (begin + (set! prefix key) + (values #t #f #f)) + (values #t + (key-fname key) + (key-fullset? key))) + (values #f #f #f)))) + + (define/public (get-best-score code other-code alt-code other-alt-code caps-code + shift? ctrl? alt? meta? cmd? caps?) + (let-values ([(key score) + (find-key code other-code alt-code other-alt-code caps-code + shift? ctrl? alt? meta? cmd? caps? prefix)]) + (for/fold ([s (if key score -1)]) + ([c (in-list chain-to)]) + (max s + (send c get-best-score code other-code alt-code other-alt-code caps-code + shift? ctrl? alt? meta? cmd? caps?))))) + + (def/public (set-grab-key-function [(make-procedure 4) grab]) + (set! grab-key-function grab)) + + (def/public (remove-grab-key-function) + (set! grab-key-function #f)) + + (def/public (handle-key-event [any? obj] [key-event% event]) + (let ([code (send event get-key-code)]) + (or (eq? code 'shift) + (eq? code 'control) + (eq? code 'release) + (let ([score (get-best-score + code + (send event get-other-shift-key-code) + (send event get-other-altgr-key-code) + (send event get-other-shift-altgr-key-code) + (send event get-other-caps-key-code) + (send event get-shift-down) + (send event get-control-down) + (send event get-alt-down) + (as-meta-key (send event get-meta-down)) + (as-cmd-key (send event get-meta-down)) + (send event get-caps-down))]) + (let ([was-prefixed? prefixed?]) + + (let* ([r (chain-handle-key-event obj event #f prefixed? score)] + [r (if (and (zero? r) + was-prefixed?) + (begin + (reset) + ;; try again without prefix: + (chain-handle-key-event obj event #f #f score)) + r)]) + (when (r . >= . 0) + (reset)) + (not (zero? r)))))))) + + (define/private (other-handle-key-event obj event grab try-prefixed? score) + (for/fold ([r 0]) + ([c (in-list chain-to)] + #:when (r . <= . 0)) + (let ([r (send c chain-handle-key-event obj event grab try-prefixed? score)]) + (if (r . > . 0) + (begin + (reset) + r) + r)))) + + (define/public (chain-handle-key-event obj event grab only-prefixed? score) + ;; results: 0 = no match, 1 = match, -1 = matched prefix + (set! last-time (send event get-time-stamp)) + (set! last-button #f) + (let ([grab (or grab-key-function + grab)]) + (if (and only-prefixed? (not prefixed?)) + 0 + (let ([sub-result (other-handle-key-event obj event grab only-prefixed? score)]) + (if (sub-result . > . 0) + sub-result + (let-values ([(h? fname fullset?) + (handle-event (send event get-key-code) + (send event get-other-shift-key-code) + (send event get-other-altgr-key-code) + (send event get-other-shift-altgr-key-code) + (send event get-other-caps-key-code) + (send event get-shift-down) + (send event get-control-down) + (send event get-alt-down) + (as-meta-key (send event get-meta-down)) + (as-cmd-key (send event get-meta-down)) + (send event get-caps-down) + score)]) + (if h? + (if fname + (begin + (reset) + (if (and grab + (grab fname this obj event)) + 1 + (if (call-function fname obj event) + 1 + 0))) + (if prefix + (begin + (set! prefixed? #t) + -1) + ;; shouldn't get here + 0)) + (let ([result + (if (sub-result . < . 0) + (begin + (set! prefixed? #t) + -1) + 0)]) + (if (and (zero? result) + grab-key-function + (grab-key-function #f this obj event)) + 1 + result))))))))) + + (def/public (set-grab-mouse-function [(make-procedure 4) grab]) + (set! grab-mouse-function grab)) + + (def/public (remove-grab-mouse-function) + (set! grab-mouse-function #f)) + + (define/private (adjust-button-code code click-count) + (case click-count + [(0) code] + [(1) (case code + [(mouse-right) 'mouse-right-double] + [(mouse-left) 'mouse-left-double] + [(mouse-middle) 'mouse-middle-double])] + [else (case code + [(mouse-right) 'mouse-right-triple] + [(mouse-left) 'mouse-left-triple] + [(mouse-middle) 'mouse-middle-triple])])) + + (def/public (handle-mouse-event [any? obj][mouse-event% event]) + (let ([score (get-best-mouse-score event)]) + (not (zero? (chain-handle-mouse-event obj event #f 0 score))))) + + (define/public (get-best-mouse-score event) + (cond + [(not (send event button-down?)) + (if active-mouse-function + 100 + (or (ormap (lambda (c) + (and (not (zero? (send c get-best-mouse-score event))) + 100)) + chain-to) + -1))] + [else + (let ([code (cond + [(send event get-right-down) 'mouse-right] + [(send event get-left-down) 'mouse-left] + [(send event get-middle-down) 'mouse-middle] + [else #f])]) + (if (not code) + -1 + (let ([code + (if (and (eq? code last-button) + (= (send event get-x) last-x) + (= (send event get-y) last-y) + ((abs (- (send event get-time-stamp) last-time)) . < . double-interval)) + (adjust-button-code code click-count) + code)]) + (get-best-score code #f #f #f #f + (send event get-shift-down) + (send event get-control-down) + (send event get-alt-down) + (as-meta-key (send event get-meta-down)) + (as-cmd-key (send event get-meta-down)) + (send event get-caps-down)))))])) + + (define/private (other-handle-mouse-event obj event grab try-state score) + (for/fold ([result 0]) + ([c (in-list chain-to)] + #:when (result . <= . 0)) + (let ([r (send c chain-handle-mouse-event obj event grab try-state score)]) + (cond + [(r . > . 0) + (reset) + r] + [(zero? r) result] + [else r])))) + + (define/public (chain-handle-mouse-event obj event grab try-state score) + (let ([grab (or grab-mouse-function grab)]) + (define (step1) + (cond + [(and (not prefix) + (try-state . >= . 0)) + (let ([r (other-handle-mouse-event obj event grab 1 score)]) + (cond + [(r . > . 0) r] + [(try-state . > . 0) r] + [else (step2 -1)]))] + [(and prefix (try-state . < . 0)) + (other-handle-mouse-event obj event grab -1 score)] + [else (step2 try-state)])) + (define (step2 try-state) + (cond + [(not (send event button-down?)) + (when (and (not (send event dragging?)) + (not (send event button-up?))) + ;; we must have missed the button-up + (set! active-mouse-function #f)) + (if (not active-mouse-function) + (other-handle-mouse-event obj event grab -1 score) + (let ([v (if (and grab + (grab active-mouse-function this obj event)) + 1 + (if (call-function active-mouse-function obj event) + 1 + 0))]) + (when (send event button-up?) + (set! active-mouse-function #f)) + v))] + [else + (let ([code (cond + [(send event get-right-down) 'mouse-right] + [(send event get-left-down) 'mouse-left] + [(send event get-middle-down) 'mouse-middle] + [else #f])]) + (if (not code) + 0 ;; FIXME: should we call grab here? + (let ([orig-code code] + [code + (if (and (eq? code last-button) + (= (send event get-x) last-x) + (= (send event get-y) last-y)) + (if ((abs (- (send event get-time-stamp) last-time)) . < . double-interval) + (begin0 + (adjust-button-code code click-count) + (set! click-count (add1 click-count))) + (begin + (set! click-count 1) + code)) + (begin + (set! last-button code) + (set! click-count 1) + code))]) + (set! last-time (send event get-time-stamp)) + (set! last-x (send event get-x)) + (set! last-y (send event get-y)) + + (let loop ([code code]) + (let-values ([(h? fname fullset?) (handle-event code + #f #f #f #f + (send event get-shift-down) + (send event get-control-down) + (send event get-alt-down) + (as-meta-key (send event get-meta-down)) + (as-cmd-key (send event get-meta-down)) + (send event get-caps-down) + score)]) + (cond + [(and h? fname) + (reset) + (when fullset? + (set! active-mouse-function fname)) + (cond + [(and grab (grab fname this obj event)) 1] + [(call-function fname obj event) 1] + [else 0])] + [h? + (let ([r (other-handle-mouse-event obj event grab try-state score)]) + (if (r . > . 0) + r + -1))] + [else + (set! last-code code) + (if (not (eqv? last-code orig-code)) + (loop orig-code) + (let ([result (other-handle-mouse-event obj event grab try-state score)]) + (if (and (zero? result) + grab-mouse-function + (grab-mouse-function #f this obj event)) + 1 + result)))]))))))])) + (step1))) + + (def/public (add-function [string? name] [(make-procedure 2) f]) + (hash-set! functions + (string->immutable-string name) + f)) + + (def/public (call-function [string? name] [any? obj] [event% event] [any? [try-chained? #f]]) + (let ([f (hash-ref functions name #f)]) + (cond + [f + (f obj event) + #t] + [try-chained? + (ormap (lambda (c) + (send c call-function name obj event #t)) + chain-to)] + [else + (error 'keymap "no function ~e" name)]))) + + (def/public (get-double-click-interval) + double-interval) + + (def/public (set-double-click-interval [exact-positive-integer? d]) + (set! double-interval d)) + + (define/public (cycle-check km) + (ormap (lambda (c) + (or (eq? km c) + (send c cycle-check km))) + chain-to)) + + (def/public (chain-to-keymap [keymap% km] [any? prefix?]) + (unless (or (eq? km this) + (cycle-check km) + (send km cycle-check this)) + (set! chain-to (if prefix? + (cons km chain-to) + (append chain-to (list km)))))) + + (def/public (remove-chained-keymap [keymap% km]) + (set! chain-to (remq km chain-to)))) diff --git a/collects/mred/private/wxme/mline.ss b/collects/mred/private/wxme/mline.ss new file mode 100644 index 0000000000..1af464b976 --- /dev/null +++ b/collects/mred/private/wxme/mline.ss @@ -0,0 +1,1192 @@ +#lang scheme/base +(require scheme/class + "../syntax.ss" + "const.ss" + "snip.ss" + "snip-flags.ss" + "private.ss") + +(provide create-mline + (struct-out mline) + (struct-out paragraph) + mline-next + mline-prev + (prefix-out + mline- + (for-meta + 0 + NIL + clone-paragraph + get-line-max-width + adjust-offsets + deadjust-offsets + move-parent! + rotate-left + rotate-right + insert + delete + find-line + find-position + find-scroll + find-location + find-paragraph + get-line + get-position + get-scroll + get-location + get-paragraph + get-paragraph-style + set-length + set-scroll-length + set-height + calc-line-length + set-starts-paragraph + starts-paragraph + adjust-max-width + set-width + scroll-offset + find-extra-scroll + mark-recalculate + adjust-need-calc + mark-check-flow + adjust-need-flow + update-flow + update-graphics + get-root + check-consistent + first + last + get-left-location + get-right-location + number))) + +(define RED #x1) +(define BLACK #x2) +(define MAX-W-HERE #x4) +(define MAX-W-LEFT #x8) +(define MAX-W-RIGHT #x10) +(define CALC-HERE #x20) +(define CALC-LEFT #x40) +(define CALC-RIGHT #x80) +(define FLOW-HERE #x100) +(define FLOW-LEFT #x200) +(define FLOW-RIGHT #x400) +(define STARTS-PARA #x800) + +(define MAX-W-MASK (bitwise-ior MAX-W-HERE MAX-W-LEFT MAX-W-RIGHT)) +(define COLOR-MASK (bitwise-ior RED BLACK)) +(define CALC-MASK (bitwise-ior CALC-HERE CALC-LEFT CALC-RIGHT)) +(define FLOW-MASK (bitwise-ior FLOW-HERE FLOW-LEFT FLOW-RIGHT)) + +(define-struct mline (prev next parent left right + + flags paragraph + + ;; relative values: + line pos scroll parno y + + max-width + + snip last-snip scroll-snip + + len numscrolls + last-h last-w ;; height/width of last snip in line + h w ;; height/width of line + bottombase topbase ;; bottom baseline, top baseline (relative) + ) + #:mutable #:transparent) + +(define NIL #f) + +(define (create-mline) + (make-mline #f #f NIL NIL NIL + (bitwise-ior BLACK MAX-W-HERE CALC-HERE) #f + 0 0 0 0 0.0 + 0.0 + #f #f #f + 0 1 + 0.0 0.0 + 0.0 0.0 + 0.0 0.0)) + +(set! NIL (create-mline)) +(set-mline-parent! NIL NIL) +(set-mline-left! NIL NIL) +(set-mline-right! NIL NIL) + +(define (mline-destroy! m) + ;; Doesn't need to to anything, but this may be helpful for debugging + (begin + (set-mline-prev! m 'BAD) + (set-mline-parent! m 'BAD) + (set-mline-left! m 'BAD) + (set-mline-right! m 'BAD) + (set-mline-flags! m 'BAD) + (set-mline-paragraph! m 'BAD) + (set-mline-line! m 'BAD) + (set-mline-pos! m 'BAD) + (set-mline-scroll! m 'BAD) + (set-mline-parno! m 'BAD) + (set-mline-y! m 'BAD) + (set-mline-max-width! m 'BAD) + (set-mline-snip! m 'BAD) + (set-mline-last-snip! m 'BAD) + (set-mline-scroll-snip! m 'BAD) + (set-mline-len! m 'BAD) + (set-mline-numscrolls! m 'BAD) + (set-mline-last-h! m 'BAD) + (set-mline-last-w! m 'BAD) + (set-mline-h! m 'BAD) + (set-mline-w! m 'BAD) + (set-mline-bottombase! m 'BAD) + (set-mline-topbase! m 'BAD)) + (void)) + +(define (set-red! mline) + (set-mline-flags! mline (bitwise-ior RED (bitwise-and (mline-flags mline) + (bitwise-not COLOR-MASK))))) +(define (set-black! mline) + (set-mline-flags! mline (bitwise-ior BLACK (bitwise-and (mline-flags mline) + (bitwise-not COLOR-MASK))))) + +(define (bit-overlap? a b) + (not (zero? (bitwise-and a b)))) + +(define (red? mline) + (bit-overlap? (mline-flags mline) RED)) +(define (black? mline) + (bit-overlap? (mline-flags mline) BLACK)) + +(define (starts-paragraph mline) + (if (bit-overlap? STARTS-PARA (mline-flags mline)) + 1 + 0)) + +;; ---------------------------------------- + +(define-struct paragraph (left-margin-first + left-margin + right-margin + alignment) + #:mutable) + +(define plain-paragraph (make-paragraph 0.0 0.0 0.0 'left)) + +(define (clone-paragraph p) + (make-paragraph (paragraph-left-margin-first p) + (paragraph-left-margin p) + (paragraph-right-margin p) + (paragraph-alignment p))) + +(define (get-line-max-width p max-width first?) + (if (max-width . <= . 0) + max-width + (max 1 + (- max-width + (if first? + (paragraph-left-margin-first p) + (paragraph-left-margin p)) + (paragraph-right-margin p))))) + +;; ---------------------------------------- + +(define (adjust-offsets mline newchild) + (unless (eq? newchild NIL) + ;; Adjust relative values: + (set-mline-line! newchild (- (mline-line newchild) (+ (mline-line mline) 1))) + (set-mline-pos! newchild (- (mline-pos newchild) (+ (mline-pos mline) (mline-len mline)))) + (set-mline-scroll! newchild (- (mline-scroll newchild) (+ (mline-scroll mline) (mline-numscrolls mline)))) + (set-mline-y! newchild (- (mline-y newchild) (+ (mline-y mline) (mline-h mline)))) + (set-mline-parno! newchild (- (mline-parno newchild) (+ (mline-parno mline) (starts-paragraph mline)))))) + +(define (deadjust-offsets mline oldchild) + (unless (eq? oldchild NIL) + ;; Adjust relative values: + (set-mline-line! oldchild (+ (mline-line oldchild) (+ (mline-line mline) 1))) + (set-mline-pos! oldchild (+ (mline-pos oldchild) (+ (mline-pos mline) (mline-len mline)))) + (set-mline-scroll! oldchild (+ (mline-scroll oldchild) (+ (mline-scroll mline) (mline-numscrolls mline)))) + (set-mline-y! oldchild (+ (mline-y oldchild) (+ (mline-y mline) (mline-h mline)))) + (set-mline-parno! oldchild (+ (mline-parno oldchild) (+ (mline-parno mline) (starts-paragraph mline)))))) + +(define (move-parent! v x root-box) + ;; replace v with x + (let ([parent (mline-parent v)]) + (set-mline-parent! x parent) ; x can be NIL! + (cond + [(eq? parent NIL) + (set-box! root-box x)] + [(eq? v (mline-left parent)) + (set-mline-left! parent x)] + [else + (set-mline-right! parent x)]))) + +(define (rotate-left mline root-box) + (let ([oldright (mline-right mline)]) + (deadjust-offsets mline oldright) + + (let ([right (mline-left oldright)]) + (set-mline-right! mline right) + (unless (eq? right NIL) + (set-mline-parent! right mline))) + + (move-parent! mline oldright root-box) + + (set-mline-left! oldright mline) + (set-mline-parent! mline oldright) + + (adjust-max-width mline) + (adjust-need-calc mline) + (adjust-need-flow mline) + (adjust-max-width oldright) + (adjust-need-calc oldright) + (adjust-need-flow oldright))) + +(define (rotate-right mline root-box) + (let ([oldleft (mline-left mline)]) + (adjust-offsets oldleft mline) + + (let ([left (mline-right oldleft)]) + (set-mline-left! mline left) + (unless (eq? left NIL) + (set-mline-parent! left mline))) + + (move-parent! mline oldleft root-box) + + (set-mline-right! oldleft mline) + (set-mline-parent! mline oldleft) + + (adjust-max-width mline) + (adjust-need-calc mline) + (adjust-need-flow mline) + (adjust-max-width oldleft) + (adjust-need-calc oldleft) + (adjust-need-flow oldleft))) + +(define (insert mline root-box before?) + (let ([newline (create-mline)]) + (if (eq? (unbox root-box) NIL) + (begin + (set-box! root-box newline) + newline) + (begin + (set-red! newline) + + (if before? + (let ([prev (mline-prev mline)]) + (set-mline-prev! newline prev) + (when prev + (set-mline-next! prev newline)) + (set-mline-next! newline mline) + (set-mline-prev! mline newline)) + (let ([next (mline-next mline)]) + (set-mline-prev! newline mline) + (set-mline-next! newline next) + (when next + (set-mline-prev! next newline)) + (set-mline-next! mline newline))) + + (let ([node + (if before? + (let ([left (mline-left mline)]) + (if (eq? left NIL) + (begin + (set-mline-left! mline newline) + mline) + (let loop ([node left]) + (let ([right (mline-right node)]) + (if (not (eq? right NIL)) + (loop right) + (begin + (set-mline-right! node newline) + node)))))) + (let ([right (mline-right mline)]) + (if (eq? right NIL) + (begin + (set-mline-right! mline newline) + mline) + (let loop ([node right]) + (let ([left (mline-left node)]) + (if (not (eq? left NIL)) + (loop left) + (begin + (set-mline-left! node newline) + node)))))))]) + (set-mline-parent! newline node) + (adjust-need-calc node #t)) + + (let loop ([node newline]) + (let ([parent (mline-parent node)]) + (unless (eq? parent NIL) + (when (eq? node (mline-left parent)) + (deadjust-offsets newline parent)) + (loop parent)))) + + (let loop ([node newline]) + (when (and (not (eq? node (unbox root-box))) + (red? (mline-parent node))) + (let ([parent (mline-parent node)]) + (if (eq? parent (mline-left (mline-parent parent))) + (let ([v (mline-right (mline-parent parent))]) + (if (red? v) + (begin + (set-black! parent) + (set-black! v) + (let ([node (mline-parent parent)]) + (set-red! node) + (loop node))) + (let* ([node (if (eq? node (mline-right parent)) + (begin + (rotate-left parent root-box) + parent) + node)] + [parent (mline-parent node)]) + (set-black! parent) + (let ([node (mline-parent parent)]) + (set-red! node) + (rotate-right node root-box) + (loop node))))) + (let ([v (mline-left (mline-parent parent))]) + (if (red? v) + (begin + (set-black! parent) + (set-black! v) + (let ([node (mline-parent parent)]) + (set-red! node) + (loop node))) + (let* ([node (if (eq? node (mline-left parent)) + (begin + (rotate-right parent root-box) + parent) + node)] + [parent (mline-parent node)]) + (set-black! parent) + (let ([node (mline-parent parent)]) + (set-red! node) + (rotate-left node root-box) + (loop node))))))))) + + (set-black! (unbox root-box)) + + newline)))) + +(define (delete mline root-box) + + ;; adjust ancestor offsets + (let ([len (mline-len mline)] + [numscrolls (mline-numscrolls mline)] + [h (mline-h mline)]) + (let loop ([v mline]) + (let ([parent (mline-parent v)]) + (unless (eq? parent NIL) + (if (eq? v (mline-right parent)) + (loop parent) + (let ([v parent]) + (set-mline-line! v (- (mline-line v) 1)) + (set-mline-pos! v (- (mline-pos v) len)) + (set-mline-scroll! v (- (mline-scroll v) numscrolls)) + (set-mline-y! v (- (mline-y v) h)) + (set-mline-parno! v (- (mline-parno v) (starts-paragraph mline))) + (loop v))))))) + + (let ([v (if (or (eq? (mline-left mline) NIL) + (eq? (mline-right mline) NIL)) + mline + (let ([v (mline-next mline)]) + (let loop ([x v]) + (unless (eq? mline (mline-parent x)) + (let ([parent (mline-parent x)]) + (if (eq? x (mline-right parent)) + (loop parent) + (let ([x parent]) + (set-mline-line! x (- (mline-line x) 1)) + (set-mline-pos! x (- (mline-pos x) (mline-len v))) + (set-mline-scroll! x (- (mline-scroll x) (mline-numscrolls v))) + (set-mline-y! x (- (mline-y x) (mline-h v))) + (set-mline-parno! x (- (mline-parno x) (starts-paragraph v))) + (loop x)))))) + v))]) + + (let ([x (if (eq? (mline-left v) NIL) + (mline-right v) + (mline-left v))]) + (move-parent! v x root-box) + + (let ([was-black? (black? v)]) + + (if (not (eq? v mline)) + (let ([oldparent (mline-parent v)]) + (if (black? mline) + (set-black! v) + (set-red! v)) + + (let ([left (mline-left mline)]) + (set-mline-left! v left) + (unless (eq? left NIL) + (set-mline-parent! left v))) + (let ([right (mline-right mline)]) + (set-mline-right! v right) + (unless (eq? right NIL) + (set-mline-parent! right v))) + (move-parent! mline v root-box) + (let ([prev (mline-prev mline)]) + (set-mline-prev! v prev) + (when prev + (set-mline-next! prev v))) + + (set-mline-line! v (mline-line mline)) + (set-mline-pos! v (mline-pos mline)) + (set-mline-scroll! v (mline-scroll mline)) + (set-mline-y! v (mline-y mline)) + (set-mline-parno! v (mline-parno mline)) + + (adjust-max-width oldparent #t) + (adjust-need-calc oldparent #t) + (adjust-need-flow oldparent #t) + + (adjust-max-width v #t) + (adjust-need-calc v #t) + (adjust-need-flow v #t) + + (when (eq? (mline-parent x) mline) + (set-mline-parent! x v))) + (begin + (let ([prev (mline-prev mline)] + [next (mline-next mline)]) + (when prev + (set-mline-next! prev next)) + (when next + (set-mline-prev! next prev))))) + + (when was-black? + ;; fixup + (let loop ([x x]) + (if (and (not (eq? x (unbox root-box))) + (black? x)) + (let ([parent (mline-parent x)]) + (if (eq? x (mline-left parent)) + (let* ([z (mline-right parent)] + [z (if (red? z) + (begin + (set-black! z) + (set-red! parent) + (rotate-left parent root-box) + (mline-right (mline-parent x))) + z)] + [x (if (and (black? (mline-left z)) + (black? (mline-right z))) + (begin + (set-red! z) + (mline-parent x)) + (let ([z (if (black? (mline-right z)) + (begin + (set-black! (mline-left z)) + (set-red! z) + (rotate-right z root-box) + (mline-right (mline-parent x))) + z)]) + (if (red? (mline-parent x)) + (set-red! z) + (set-black! z)) + (set-black! (mline-parent x)) + (set-black! (mline-right z)) + (rotate-left (mline-parent x) root-box) + (unbox root-box)))]) + (loop x)) + (let* ([z (mline-left parent)] + [z (if (red? z) + (begin + (set-black! z) + (set-red! parent) + (rotate-right parent root-box) + (mline-left (mline-parent x))) + z)] + [x (if (and (black? (mline-right z)) + (black? (mline-left z))) + (begin + (set-red! z) + (mline-parent x)) + (let ([z (if (black? (mline-left z)) + (begin + (set-black! (mline-right z)) + (set-red! z) + (rotate-left z root-box) + (mline-left (mline-parent x))) + z)]) + (if (red? (mline-parent x)) + (set-red! z) + (set-black! z)) + (set-black! (mline-parent x)) + (set-black! (mline-left z)) + (rotate-right (mline-parent x) root-box) + (unbox root-box)))]) + (loop x)))) + (set-black! x))))))) + + ;; In case we set the parent of NIL: + (set-mline-parent! NIL NIL) + + (mline-destroy! mline)) + +;; ---------------------------------------- + +(define (search mline v v-sel size-sel) + (let loop ([v v][node mline][prev #f]) + (if (not (eq? node NIL)) + (let ([v2 (v-sel node)] + [size (size-sel node)]) + (cond + [(v . < . v2) + (loop v (mline-left node) node)] + [(v . >= . (+ v2 size)) + (loop (- v (+ v2 size)) + (mline-right node) node)] + [else node])) + prev))) + + (define (find-line mline line) + (search mline line mline-line (lambda (mline) 1))) + +(define (find-position mline pos) + (search mline pos mline-pos mline-len)) + +(define (find-scroll mline scroll) + (search mline scroll mline-scroll mline-numscrolls)) + +(define (find-location mline y) + (search mline y mline-y mline-h)) + +(define (find-paragraph mline parno) + (search mline parno mline-parno starts-paragraph)) + +;; ---------------------------------------- + +(define (sum mline v-sel size-sel) + (let loop ([node mline][v (v-sel mline)]) + (let ([parent (mline-parent node)]) + (if (not (eq? parent NIL)) + (if (eq? node (mline-left parent)) + (loop parent v) + (loop parent (+ v (v-sel parent) (size-sel parent)))) + v)))) + +(define (get-line mline) + (sum mline mline-line (lambda (mline) 1))) + +(define (get-position mline) + (sum mline mline-pos mline-len)) + +(define (get-scroll mline) + (sum mline mline-scroll mline-numscrolls)) + +(define (get-location mline) + (sum mline mline-y mline-h)) + +(define (get-paragraph mline) + (+ (sum mline mline-parno starts-paragraph) + (sub1 (starts-paragraph mline)))) + +(define (get-paragraph-style mline [first-box #f]) + (if (bit-overlap? (mline-flags mline) STARTS-PARA) + (begin + (when first-box (set-box! first-box #t)) + (mline-paragraph mline)) + (begin + (when first-box (set-box! first-box #f)) + (let ([root (get-root mline)] + [p (get-paragraph mline)]) + (let ([pstart (find-paragraph root p)]) + (mline-paragraph pstart)))))) + +;; ---------------------------------------- + +(define (adjust mline new-val val-sel val-mut! sel mut!) + (let ([delta (- new-val (val-sel mline))]) + (val-mut! mline new-val) + (let loop ([node mline]) + (let ([parent (mline-parent node)]) + (unless (eq? parent NIL) + (if (eq? node (mline-left parent)) + (begin + (mut! parent (+ delta (sel parent))) + (loop parent)) + (loop parent))))))) + +(define (set-length mline len) + (adjust mline + len mline-len set-mline-len! + mline-pos set-mline-pos!)) + +(define (set-scroll-length mline numscrolls) + (adjust mline + numscrolls mline-numscrolls set-mline-numscrolls! + mline-scroll set-mline-scroll!)) + +(define (set-height mline h) + (adjust mline + h mline-h set-mline-h! + mline-y set-mline-y!)) + +(define (calc-line-length mline) + (let ([l + (let ([nexts (snip->next (mline-last-snip mline))]) + (let loop ([asnip (mline-snip mline)][l 0]) + (if (eq? asnip nexts) + l + (let ([l (+ l (snip->count asnip))]) + (when (has-flag? (snip->count asnip) WIDTH-DEPENDS-ON-X) + (send asnip size-cache-invalid)) + (loop (snip->next asnip) l)))))]) + + (when (not (= l (mline-len mline))) + (set-length mline l))) + + (let ([next (mline-next mline)]) + (cond + [(and next + (has-flag? (snip->flags (mline-last-snip mline)) + HARD-NEWLINE)) + (when (zero? (starts-paragraph next)) + (set-starts-paragraph next #t))] + [next + (when (starts-paragraph next) + (set-starts-paragraph next #f))])) + + (let ([prev (mline-prev mline)]) + (cond + [(or (not prev) + (has-flag? (snip->flags (mline-last-snip prev)) + HARD-NEWLINE)) + (when (zero? (starts-paragraph mline)) + (set-starts-paragraph mline #t))] + [(positive? (starts-paragraph mline)) + (set-starts-paragraph mline #f)]))) + +(define (set-starts-paragraph mline starts?) + (unless (= (if starts? 1 0) (starts-paragraph mline)) + (if starts? + (begin + (set-mline-flags! mline + (bitwise-ior (mline-flags mline) STARTS-PARA)) + (unless (mline-paragraph mline) + (set-mline-paragraph! mline plain-paragraph))) + (begin + (set-mline-flags! mline (- (mline-flags mline) STARTS-PARA)) + (set-mline-paragraph! mline #f))) + + (let loop ([node mline]) + (let ([parent (mline-parent node)]) + (unless (eq? parent NIL) + (when (eq? node (mline-left parent)) + (set-mline-parno! parent (+ (mline-parno parent) + (if starts? 1 -1)))) + (loop parent)))))) + +;; ------------------------------------------------------------ + +(define (adjust-max-width mline [recur? #f]) + (when (not (eq? mline NIL)) + (let loop ([node mline]) + (let ([old (bitwise-and (mline-flags node) MAX-W-MASK)]) + (let ([which + (cond + [(and (not (eq? (mline-right node) NIL)) + ((mline-max-width (mline-right node)) . > . (mline-w node)) + (or (eq? (mline-left node) NIL) + ((mline-max-width (mline-right node)) . > . (mline-max-width (mline-left node))))) + (set-mline-max-width! node (mline-max-width (mline-right node))) + MAX-W-RIGHT] + [(and (not (eq? (mline-left node) NIL)) + ((mline-max-width (mline-left node)) . > . (mline-w node))) + (set-mline-max-width! node (mline-max-width (mline-left node))) + MAX-W-LEFT] + [else + (set-mline-max-width! node (mline-w node)) + MAX-W-HERE])]) + (unless (= old which) + (set-mline-flags! node + (bitwise-ior + (bitwise-and (mline-flags node) + (bitwise-not MAX-W-MASK)) + which))) + (when recur? + (let ([parent (mline-parent node)]) + (unless (eq? parent NIL) + (loop parent))))))))) + +(define (set-width mline w) + (set-mline-w! mline w) + (adjust-max-width mline #t)) + +;; ---------------------------------------- + +(define (scroll-offset mline p) + (let ([scroll-snip (mline-scroll-snip mline)]) + (cond + [(not scroll-snip) + 0.0] + [(p . >= . (mline-numscrolls mline)) + (mline-h mline)] + [else + (send scroll-snip get-scroll-step-offset p)]))) + +(define (find-extra-scroll mline y) + (cond + [(y . >= . (mline-h mline)) + (mline-numscrolls mline)] + [(y . <= . 0) + 0] + [else + (let ([scroll-snip (mline-scroll-snip mline)]) + (if (not scroll-snip) + 0 + (send scroll-snip find-scroll-step y)))])) + +;; ---------------------------------------- + +(define (mark-need mline HERE recur) + (unless (bit-overlap? (mline-flags mline) HERE) + (set-mline-flags! mline (bitwise-ior (mline-flags mline) HERE)) + (let ([parent (mline-parent mline)]) + (unless (eq? parent NIL) + (recur parent #t))))) + +(define (adjust-need-flag mline MASK HERE RIGHT LEFT recur?) + (let loop ([node mline]) + (let ([old (bitwise-and (mline-flags node) MASK)]) + (let* ([which (bitwise-and old HERE)] + [which (if (and (not (eq? (mline-right node) NIL)) + (bit-overlap? (mline-flags (mline-right node)) MASK)) + (bitwise-ior which RIGHT) + which)] + [which (if (and (not (eq? (mline-left node) NIL)) + (bit-overlap? (mline-flags (mline-left node)) MASK)) + (bitwise-ior which LEFT) + which)]) + (when (not (= old which)) + (set-mline-flags! node + (bitwise-ior + (bitwise-and (mline-flags node) + (bitwise-not MASK)) + which)) + (when recur? + (let ([parent (mline-parent node)]) + (unless (eq? parent NIL) + (loop parent))))))))) + +(define (mark-recalculate mline) + (mark-need mline CALC-HERE adjust-need-calc)) + +(define (adjust-need-calc mline [recur? #f]) + (adjust-need-flag mline CALC-MASK CALC-HERE CALC-RIGHT CALC-LEFT recur?)) + +(define (mark-check-flow mline) + (mark-need mline FLOW-HERE adjust-need-flow)) + +(define (adjust-need-flow mline [recur? #f]) + (adjust-need-flag mline FLOW-MASK FLOW-HERE FLOW-RIGHT FLOW-LEFT recur?)) + +;; ---------------------------------------- + +(define (get-root mline) + (let ([parent (mline-parent mline)]) + (if (not (eq? parent NIL)) + (get-root parent) + mline))) + +;; ---------------------------------------- + +(define (check-consistent root) + (unless (black? root) + (error "root is not black")) + (let ([l1 (let loop ([mline root]) + (if (eq? mline NIL) + null + (begin + (when (red? mline) + (unless (black? (mline-left mline)) + (error "red left child is not black")) + (unless (black? (mline-right mline)) + (error "red right child is not black"))) + (unless (or (eq? (mline-left mline) NIL) + (eq? (mline-parent (mline-left mline)) mline)) + (error "left and up doesn't work")) + (unless (or (eq? (mline-right mline) NIL) + (eq? (mline-parent (mline-right mline)) mline)) + (error "right and up doesn't work")) + (append + (loop (mline-left mline)) + (list mline) + (loop (mline-right mline))))))] + [l2 (let loop ([mline root]) + (let ([prev (mline-prev mline)]) + (if prev + (begin + (unless (eq? (mline-next prev) mline) + (error "back doesn't go forward")) + (loop prev)) + (let loop ([mline mline]) + (if mline + (cons mline (loop (mline-next mline))) + null)))))]) + (unless (= (length l1) (length l2)) + (error 'check-consistent "different lengths: ~s ~s" (length l1) (length l2))) + (unless (andmap eq? l1 l2) + (error "different elems"))) + (let loop ([mline root]) + (if (eq? mline NIL) + 0 + (let ([left (loop (mline-left mline))] + [right (loop (mline-right mline))]) + (unless (= left right) + (error "different black counts:" left right)) + (if (black? mline) + (+ 1 left) + left)))) + (unless (eq? (mline-parent root) NIL) + (error "root has non-NIL parent")) + (unless (black? NIL) + (error "NIL is non-black")) + (unless (eq? NIL (mline-parent NIL)) + (error "NIL parent changed")) + (unless (eq? NIL (mline-left NIL)) + (error "NIL left changed")) + (unless (eq? NIL (mline-left NIL)) + (error "NIL right changed"))) + +#| + +Debugging tools: + +(define (draw p) + (for-each (lambda (l) + (display l) + (newline)) + (paint p))) + +(define (paint p) + (if (eq? p NIL) + '("*") + (let ([l (paint (mline-left p))] + [r (paint (mline-right p))]) + (let ([ll (string-length (car l))] + [rl (string-length (car r))] + [s ((if (red? p) string-upcase values) (format "~s" (mline-sym p)))]) + (cons + (string-append (make-string ll #\space) + s + (make-string rl #\space)) + (let loop ([l l][r r]) + (cond + [(null? l) (if (null? r) + null + (map (lambda (r) + (string-append + (make-string (+ ll (string-length s)) #\space) + r)) + r))] + [(null? r) (map (lambda (l) + (string-append + l + (make-string (+ rl (string-length s)) #\space))) + l)] + [else (cons (string-append (car l) + (make-string (string-length s) #\space) + (car r)) + (loop (cdr l) (cdr r)))]))))))) + +(define (find? root m) + (or (eq? root m) + (if (eq? root NIL) + #f + (or (find? (mline-left root) m) + (find? (mline-right root) m))))) + +|# + +;; ------------------------------------------------------------ + +(define (update-flow mline root-box media max-width dc) + (define (flow-left) + (if (bit-overlap? (mline-flags mline) FLOW-LEFT) + (if (and (not (eq? (mline-left mline) NIL)) + (update-flow (mline-left mline) root-box media max-width dc)) + #t + (begin + (set-mline-flags! mline (- (mline-flags mline) FLOW-LEFT)) + (flow-here))) + (flow-here))) + (define (flow-here) + (if (bit-overlap? (mline-flags mline) FLOW-HERE) + (begin + (set-mline-flags! mline (- (mline-flags mline) FLOW-HERE)) + (let* ([first-line (box #f)] + [para (get-paragraph-style mline first-line)] + [line-max-width (get-line-max-width para max-width (unbox first-line))]) + (if (send media check-flow line-max-width dc (get-location mline) (get-position mline) (mline-snip mline)) + (do-flow) + (flow-right)))) + (flow-right))) + (define (flow-right) + (if (bit-overlap? (mline-flags mline) FLOW-RIGHT) + (if (and (not (eq? (mline-right mline) NIL)) + (update-flow (mline-right mline) root-box media max-width dc)) + #t + (begin + (set-mline-flags! mline (- (mline-flags mline) FLOW-RIGHT)) + #f)) + #f)) + (define (do-flow) + (let loop ([asnip (mline-snip mline)]) + (if (eq? asnip (mline-last-snip mline)) + (begin + (do-extend-line asnip) + #t) + (if (has-flag? (snip->flags asnip) NEWLINE) + (begin + (do-new-line asnip) + #t) + (begin + (set-snip-line! asnip mline) + (loop (snip->next asnip))))))) + (define (do-new-line asnip) + ;; items pushed to next line or new line was inserted + (let ([next (mline-next mline)]) + (let ([nextsnip (if next + (let loop ([nextsnip (snip->next asnip)]) + (if (and nextsnip + (not (eq? nextsnip (mline-last-snip next))) + (not (has-flag? (snip->flags nextsnip) NEWLINE))) + (loop (snip->next nextsnip)) + nextsnip)) + #f)]) + (if (or (not next) + (not (eq? nextsnip (mline-last-snip next)))) + ;; it was a new line + (let ([newline (insert mline root-box #f)]) + (set-mline-snip! newline (snip->next asnip)) + (set-mline-last-snip! newline (mline-last-snip mline)) + (set-mline-last-snip! mline asnip) + + (snips-to-line! newline)) + ;; just pushed to next line + (begin + (set-mline-last-snip! mline asnip) + (set-snip-line! asnip mline) + + (set-mline-snip! next (snip->next asnip)) + + (snips-to-line! next))) + + (calc-line-length mline) + (mark-recalculate mline)))) + (define (snips-to-line! next) + (let ([nextsnip (snip->next (mline-last-snip next))]) + (let loop ([asnip (mline-snip next)]) + (unless (eq? asnip nextsnip) + (set-snip-line! asnip next) + (loop (snip->next asnip))))) + (mark-check-flow next) + (mark-recalculate next) + (calc-line-length next)) + (define (maybe-delete-line! asnip mline) + (if (and (mline-next mline) + (eq? asnip (mline-last-snip (mline-next mline)))) + ;; a line was deleted + (begin (delete (mline-next mline) root-box) #t) + #f)) + (define (do-extend-line asnip) + ;; this line was extended + (let ([asnip + (if asnip + (let loop ([asnip asnip]) + (if (and (snip->next asnip) + (not (has-flag? (snip->flags asnip) NEWLINE))) + (begin + (set-snip-line! asnip mline) + (maybe-delete-line! asnip mline) + (loop (snip->next asnip))) + (begin + (maybe-delete-line! asnip mline) + (set-mline-last-snip! mline asnip) + asnip))) + (begin + (set-mline-last-snip! mline (send media get-s-last-snip)) + (let loop () + (let ([next (mline-next mline)]) + (when next + (delete next root-box) + (loop)))) + #f))]) + + (set-snip-line! (mline-last-snip mline) mline) + + (when (mline-next mline) + (let ([asnip (snip->next asnip)] + [next (mline-next mline)]) + (when (or (not (eq? (mline-snip next) asnip)) + (not (has-flag? (snip->flags (mline-last-snip next)) NEWLINE))) + ;; Effect can propogate to more lines, merging the + ;; next several. (Handle prefixing the remains of the source of + ;; the extension to this line onto the next line. Implemented + ;; as the next line eating the next->next line.) + (set-mline-snip! next asnip) + (let ([asnip + (let loop ([asnip asnip]) + (if (and (snip->next asnip) + (not (has-flag? (snip->flags asnip) NEWLINE))) + (begin + (maybe-delete-line! asnip next) + (set-snip-line! asnip next) + (loop (snip->next asnip))) + asnip))]) + (set-snip-line! asnip next) + (set-mline-last-snip! next asnip) + (when (mline-next next) + (unless (maybe-delete-line! asnip next) + (set-mline-snip! (mline-next next) (snip->next asnip)))) + (calc-line-length next) + (mark-recalculate next) + (mark-check-flow next))))) + + (calc-line-length mline) + (mark-recalculate mline))) + ;; Try left first.... + (flow-left)) + +;; ---------------------------------------- + +(define (update-graphics mline media dc) + (define (update-left) + (and (bit-overlap? (mline-flags mline) CALC-LEFT) + (not (eq? (mline-left mline) NIL)) + (update-graphics (mline-left mline) media dc))) + (define (update-here) + (and + (bit-overlap? (mline-flags mline) CALC-HERE) + (let ([y (get-location mline)] + [nextsnip (snip->next (mline-last-snip mline))]) + (let loop ([asnip (mline-snip mline)] + [maxbase 0.0] + [maxdescent 0.0] + [maxspace 0.0] + [maxantidescent 0.0] + [maxantispace 0.0] + [totalwidth 0.0] + [maxscroll 1] + [scroll-snip #f] + [last-w 0.0] + [last-h 0.0]) + (if (not (eq? asnip nextsnip)) + (let-boxes ([w 0.0] + [h 0.0] + [descent 0.0] + [space 0.0]) + (send asnip get-extent dc totalwidth y w h descent space #f #f) + (let* ([align (send (snip->style asnip) get-alignment)] + [scroll (send asnip get-num-scroll-steps)] + [maxbase (max maxbase (- h descent space))] + [maxdescent (if (eq? align 'bottom) + (max maxdescent descent) + maxdescent)] + [maxantispace (if (eq? align 'bottom) + maxantispace + (max maxantispace (- h space)))] + [maxspace (if (eq? align 'top) + (max maxspace space) + maxspace)] + [maxantidescent (if (eq? align 'top) + maxantidescent + (max maxantidescent (- h descent)))] + [scroll-snip (if (scroll . > . maxscroll) + asnip + scroll-snip)] + [maxscroll (max maxscroll scroll)] + [totalwidth (+ w totalwidth)]) + (loop (snip->next asnip) + maxbase maxdescent maxspace maxantidescent maxantispace + totalwidth maxscroll scroll-snip + w h))) + (let ([maxspace (max maxspace (- maxantidescent maxbase))] + [maxdescent (max maxdescent (- maxantispace maxbase))]) + (set-mline-scroll-snip! mline scroll-snip) + (set-mline-last-h! mline last-h) + (set-mline-last-w! mline last-w) + (set-mline-topbase! mline maxspace) + (set-mline-bottombase! mline (+ maxspace maxbase)) + (let ([maxh (+ maxbase + maxdescent + maxspace + (send media get-s-line-spacing))] + [bigwidth (+ (if ((mline-w mline) . > . totalwidth) + (mline-w mline) + totalwidth) + CURSOR-WIDTH + (let-boxes ([is-first? #f] + [para #f]) + (set-box! para (get-paragraph-style mline is-first?)) + (if is-first? + (paragraph-left-margin-first para) + (paragraph-left-margin para))))]) + (set-width mline totalwidth) + (unless (= maxscroll (mline-numscrolls mline)) + (set-scroll-length mline maxscroll)) + (if (= maxh (mline-h mline)) + (send media refresh-box 0 y bigwidth maxh) + (begin + (set-height mline maxh) + (let ([bigwidth (max 1e5 ;; really want viewable width, but > ok + (send media get-s-total-width))] + [bigheight (+ maxh (send media get-s-total-height))]) + (send media refresh-box 0 y bigwidth bigheight)))))))) + #t))) + (define (update-right) + (and (bit-overlap? (mline-flags mline) CALC-RIGHT) + (not (eq? (mline-right mline) NIL)) + (update-graphics (mline-right mline) media dc))) + + (let ([left? (update-left)] + [here? (update-here)] + [right? (update-right)]) + (set-mline-flags! mline (bitwise-and + (mline-flags mline) + (bitwise-not CALC-MASK))) + (or left? here? right?))) + +;; ------------------------------------------------------------ + +(define (number mline) + (add1 (get-line (last mline)))) + +(define (first mline) + (let ([left (mline-left mline)]) + (if (eq? left NIL) + mline + (first left)))) + +(define (last mline) + (let ([right (mline-right mline)]) + (if (eq? right NIL) + mline + (last right)))) + +;; ------------------------------------------------------------ + +(define (get-left-location mline max-width) + (let-values ([(para left) + (if (bit-overlap? (mline-flags mline) STARTS-PARA) + (let ([para (mline-paragraph mline)]) + (values para + (paragraph-left-margin-first para))) + (let ([para (get-paragraph-style mline)]) + (values para + (paragraph-left-margin para))))]) + (if (and (max-width . > . 0) + (not (eq? (paragraph-alignment para) 'left))) + (let ([delta (max 0 (- max-width (mline-w mline)))]) + (if (eq? (paragraph-alignment para) 'right) + (+ left delta) + (+ left (/ delta 2)))) + left))) + +(define (get-right-location mline max-width) + (+ (get-left-location mline max-width) (mline-w mline))) diff --git a/collects/mred/private/wxme/pasteboard.ss b/collects/mred/private/wxme/pasteboard.ss new file mode 100644 index 0000000000..98366e7d0c --- /dev/null +++ b/collects/mred/private/wxme/pasteboard.ss @@ -0,0 +1,2122 @@ +#lang scheme/base +(require scheme/class + scheme/port + scheme/file + "../syntax.ss" + "const.ss" + "private.ss" + "editor.ss" + "undo.ss" + "style.ss" + "snip.ss" + "snip-flags.ss" + "snip-admin.ss" + "keymap.ss" + (only-in "cycle.ss" set-pasteboard%!) + "wordbreak.ss" + "stream.ss" + "wx.ss") + +(provide pasteboard% + add-pasteboard-keymap-functions) + +;; ---------------------------------------- + +(define LINE-HEIGHT 16.0) + +(define DOT-WIDTH 5.0) +(define HALF-DOT-WIDTH 2.0) + +(define (inbox? lx x) + (and ((- lx HALF-DOT-WIDTH) . <= . x) + ((+ (- lx HALF-DOT-WIDTH) DOT-WIDTH) . >= . x))) + +(define black-brush (send the-brush-list find-or-create-brush "black" 'xor)) +(define white-brush (send the-brush-list find-or-create-brush "white" 'solid)) +(define invisi-pen (send the-pen-list find-or-create-pen "black" 1 'transparent)) +(define rb-brush (send the-brush-list find-or-create-brush "black" 'transparent)) +(define rb-pen (send the-pen-list find-or-create-pen "black" 1 'xor-dot)) + +(define arrow (make-object cursor% 'arrow)) + +;; ---------------------------------------- + +(define-struct loc (x y w h r b hm vm + startx starty + selected? need-resize? + snip) + #:mutable) + +;; ---------------------------------------- + +(defclass pasteboard% editor% + (inherit-field s-admin + s-custom-cursor + s-custom-cursor-overrides? + s-own-caret? + s-caret-snip + s-keymap + s-style-list + s-noundomode + s-modified? + s-offscreen + s-filename + s-temp-filename? + s-user-locked? + s-need-on-display-size?) + (inherit on-change + get-default-style + set-modified + on-paint + wait-sequence-lock + begin-sequence-lock + end-sequence-lock + do-own-caret + on-focus + scroll-editor-to + do-set-caret-owner + install-copy-buffer + begin-copy-buffer + end-copy-buffer + free-old-copies + do-write-headers-footers + read-snips-from-file + do-own-x-selection + do-buffer-paste + add-undo-rec + get-dc + on-local-event + on-local-char + on-edit-sequence + after-edit-sequence + on-display-size) + + (define dragable? #t) + (define selection-visible? #t) + + (define snips #f) + (define last-snip #f) + + (define snip-location-list (make-hasheq)) + (define/private (snip-loc snip) (hash-ref snip-location-list snip #f)) + + (define snip-admin (new standard-snip-admin% [editor this])) + + (define last-time 0) + (define start-x 0.0) + (define start-y 0.0) + (define last-x 0.0) + (define last-y 0.0) + + (define orig-x 0.0) + (define orig-y 0.0) + (define orig-w 0.0) + (define orig-h 0.0) + + (define max-width 'none) + (define min-width 'none) + (define max-height 'none) + (define min-height 'none) + + (define keep-size? #f) + (define dragging? #f) + (define rubberband? #f) + + (define need-resize? #f) + + (define resizing #f) ; a snip + (define sizedxm 0.0) + (define sizedym 0.0) + + (define scroll-step LINE-HEIGHT) + + (define total-width 0.0) + (define total-height 0.0) + (define real-width 0.0) + (define real-height 0.0) + + (define update-left 0.0) + (define update-right 0.0) + (define update-top 0.0) + (define update-bottom 0.0) + (define update-nonempty? #f) + (define no-implicit-update? #f) + + (define size-cache-invalid? #f) + (define write-locked 0) + (define flow-locked? #f) + + (define sequence 0) + + (define delayedscrollbias 'none) + (define delayedscrollsnip #f) + (define delayedscroll-x 0.0) + (define delayedscroll-y 0.0) + (define delayedscroll-w 0.0) + (define delayedscroll-h 0.0) + + (define sequence-streak? #f) + + (define changed? #f) + + + (super-new) + + ;; ---------------------------------------- + + (define/private (rubber-band x y w h) + (when (and s-admin + (positive? w) + (positive? h)) + (let-values ([(x w) + (if (w . < . 0) + (values (+ x w) (- w)) + (values x w))] + [(y h) + (if (h . < . 0) + (values (+ y h) (- h)) + (values y h))]) + (let ([r (+ x w)] + [b (+ y h)]) + (let-boxes ([vx 0.0] + [vy 0.0] + [vw 0.0] + [vh 0.0]) + (send s-admin get-view vx vy vw vh) + (let ([x (max x vx)] + [y (max y vy)] + [r (min r (+ vx vw))] + [b (min b (+ vy vh))]) + (unless (or (x . >= . r) + (y . >= . b)) + (let-boxes ([dc #f] + [dx 0.0] + [dy 0.0]) + (set-box! dc (send s-admin get-dc dx dy)) + (let ([old-pen (send dc get-pen)] + [old-brush (send dc get-brush)]) + (send dc set-pen rb-pen) + (send dc set-brush rb-brush) + + (send dc draw-rectangle + (- x dx) (- y dy) + (- r x) + (- b y)) + + (send dc set-pen old-pen) + (send dc set-brush old-brush)))))))))) + + (def/override (adjust-cursor [mouse-event% event]) + (if (not s-admin) + #f + (let-boxes ([scrollx 0.0] + [scrolly 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc scrollx scrolly)) + (if (not dc) + #f + (let ([x (+ (send event get-x) scrollx)] + [y (+ (send event get-y) scrolly)]) + (or (and (not s-custom-cursor-overrides?) + (or (and s-caret-snip (send event dragging?) + (let-boxes ([x 0.0] + [y 0.0]) + (get-snip-location s-caret-snip x y) + (let ([c (send s-caret-snip adjust-cursor dc + (- x scrollx) (- y scrolly) + x y event)]) + c))) + ;; find snip: + (let ([snip (find-snip x y)]) + (and snip + (eq? snip s-caret-snip) + (let-boxes ([x 0.0] [y 0.0]) + (get-snip-location snip x y) + (let ([c (send snip adjust-cursor dc (- x scrollx) (- y scrolly) + x y event)]) + c)))))) + s-custom-cursor + arrow)))))) + + (def/override (on-event [mouse-event% event]) + (when s-admin + (let-values ([(dc x y scrollx scrolly) + (if (or (send event button-down?) s-caret-snip) + ;; first, find clicked-on snip: + (let ([x (send event get-x)] + [y (send event get-y)]) + (let-boxes ([scrollx 0.0] + [scrolly 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc scrollx scrolly)) + ;; FIXME: old code returned if !dc + (values dc (+ x scrollx) (+ y scrolly) scrollx scrolly))) + (values #f 0.0 0.0 0.0 0.0))]) + (let ([snip (if (send event button-down?) + (find-snip x y) + s-caret-snip)]) + (if (and snip + (eq? snip s-caret-snip)) + (let ([loc (snip-loc snip)]) + (send s-caret-snip on-event + dc (- (loc-x loc) scrollx) (- (loc-y loc) scrolly) + (loc-x loc) (loc-y loc) + event)) + (on-local-event event)))))) + + (def/override (on-default-event [mouse-event% event]) + (when s-admin + (let-boxes ([scrollx 0.0] + [scrolly 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc scrollx scrolly)) + (when dc + (let-boxes ([x (+ (send event get-x) scrollx)] + [y (+ (send event get-y) scrolly)]) + + (interactive-adjust-mouse x y) + + (when (or (send event button-down?) + (and (send event moving?) (not (send event dragging?))) + (send event button-up?)) + (set! keep-size? #f) + + (when dragging? + (if resizing + (begin + (begin-edit-sequence) + ;; move & resize back without undo + (when (or (sizedxm . < . 0.0) + (sizedym . < . 0.0)) + (move-to resizing orig-x orig-y)) + (resize resizing orig-w orig-h) + (set! dragging? #f) + ;; re-move and re-size with undo: + (do-event-resize last-x last-y) + (after-interactive-resize resizing) + (end-edit-sequence) + (set! resizing #f)) + (finish-dragging event))) + + (when rubberband? + (set! rubberband? #f) + (rubber-band start-x start-y (- last-x start-x) (- last-y start-y)) + (add-selected start-x start-y (- last-x start-x) (- last-y start-y)) + (update-all))) + + (if (or (send event button-down?) + (and (send event dragging?) + (not dragging?) + (not rubberband?))) + + (let ([snip (find-snip x y)]) + (if dragable? + (begin + (if snip + (let ([loc (snip-loc snip)]) + (set! orig-x (loc-x loc)) + (set! orig-y (loc-y loc)) + (set! orig-w (loc-w loc)) + (set! orig-h (loc-h loc)) + (if (not (loc-selected? loc)) + (begin + (unless (send event get-shift-down) + (no-selected)) + (set-caret-owner #f) + (add-selected snip) + (init-dragging event)) + (let ([interval (abs (- (send event get-time-stamp) + last-time))]) + (if (and (send event button-down?) + (interval . < . (if s-keymap + (send s-keymap get-double-click-interval) + (get-double-click-threshold)))) + (on-double-click snip event) + (let-boxes ([dx sizedxm] + [dy sizedym] + [f? #f]) + (set-box! f? (find-dot loc x y dx dy)) + (set! sizedxm dx) + (set! sizedxm dy) + (when f? + (set! resizing snip)) + (init-dragging event))))) + (when (send event button-down?) + (set! last-time (send event get-time-stamp)))) + (begin + (unless (send event get-shift-down) + (no-selected)) + (set-caret-owner #f) + (set! rubberband? #t))) + (set! start-x x) + (set! last-x x) + (set! start-y y) + (set! last-y y)) + ;; not dragable: + (set-caret-owner snip))) + + ;; not a new click: + (when dragable? + (when (send event dragging?) + (cond + [rubberband? + ;; erase old + (rubber-band start-x start-y (- last-x start-x) (- last-y start-y)) + ;; draw new: + (rubber-band start-x start-y (- x start-x) (- y start-y))] + [resizing + (do-event-resize x y)] + [else + (do-event-move x y)])) + (set! last-x x) + (set! last-y y)))))))) + + (def/public (on-double-click [snip% snip] [mouse-event% evt]) + (when (has-flag? (snip->flags snip) HANDLES-EVENTS) + (no-selected) + (set-caret-owner snip))) + + (def/override (on-char [key-event% event]) + (when s-admin + (let-boxes ([scrollx 0.0] + [scrolly 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc scrollx scrolly)) + (when dc + (let ([x (+ (send event get-x) scrollx)] + [y (+ (send event get-y) scrolly)]) + (if s-caret-snip + (let ([loc (snip-loc s-caret-snip)]) + (send s-caret-snip on-char + dc (loc-x loc) (loc-y loc) (- x scrollx) (- y scrolly) + event)) + (on-local-char event))))))) + + (def/override (on-default-char [key-event% event]) + (when s-admin + (let ([code (send event get-key-code)]) + (case code + [(#\rubout #\backspace) + (delete)] + [(right) + (move 1 0)] + [(left) + (move -1 0)] + [(up) + (move 0 -1)] + [(down) + (move 0 1)])))) + + (define/private (init-dragging e) + (define (phase1) + (if resizing + (if (not (can-interactive-resize? resizing)) + (set! resizing #f) + (begin + (on-interactive-resize resizing) + (phase2))) + (when (can-interactive-move? e) + (on-interactive-move e) + (phase2)))) + (define (phase2) + (set! dragging? #t) + (set! keep-size? #t) + (let loop ([s #f]) + (let ([s (find-next-selected-snip s)]) + (when s + (let ([loc (snip-loc s)]) + (set-loc-startx! loc (loc-x loc)) + (set-loc-starty! loc (loc-y loc))) + (loop s))))) + (phase1)) + + (define/private (finish-dragging e) + (begin-edit-sequence) + + ;; move back without undo and remember final + (let loop ([s #f]) + (let ([s (find-next-selected-snip s)]) + (when s + (let* ([loc (snip-loc s)] + [x (loc-startx loc)] + [y (loc-starty loc)]) + (set-loc-startx! loc (loc-x loc)) + (set-loc-starty! loc (loc-y loc)) + (move-to s x y)) + (loop s)))) + + (set! dragging? #f) + + ;; move to final position with undo: + (let loop ([s #f]) + (let ([s (find-next-selected-snip s)]) + (when s + (let* ([loc (snip-loc s)]) + (move-to s (loc-startx loc) (loc-starty loc))) + (loop s)))) + + (after-interactive-move e) + (end-edit-sequence)) + + (define/private (do-event-move event-x event-y) + (let ([dx (- event-x start-x)] + [dy (- event-y start-y)]) + (begin-edit-sequence) + + (let loop ([s #f]) + (let ([s (find-next-selected-snip s)]) + (when s + (let ([loc (snip-loc s)]) + (let-boxes ([x (+ (loc-startx loc) dx)] + [y (+ (loc-starty loc) dy)]) + (interactive-adjust-move s x y) + (move-to s x y))) + (loop s)))) + + (end-edit-sequence))) + + (define/private (do-event-resize event-x event-y) + (let ([dx (- event-x start-x)] + [dy (- event-y start-y)]) + (let-boxes ([w (max 0.0 (+ orig-w (* dx sizedxm)))] + [h (max 0.0 (+ orig-h (* dy sizedym)))]) + (interactive-adjust-resize resizing w h) + (let ([w (max 0.0 w)] + [h (max 0.0 h)]) + (let ([x (+ orig-x + (if (sizedxm . < . 0) + (- orig-w w) + 0.0))] + [y (+ orig-y + (if (sizedym . < . 0) + (- orig-h h) + 0.0))]) + + (begin-edit-sequence) + + (when (resize resizing w h) + (when (or (sizedxm . < . 0) + (sizedym . < . 0)) + (move-to resizing x y))) + + (end-edit-sequence)))))) + + (def/public (interactive-adjust-mouse [(make-box real?) x] [(make-box real?) y]) + (set-box! x (max 0.0 (unbox x))) + (set-box! y (max 0.0 (unbox y)))) + + (def/public (interactive-adjust-resize [snip% s] [(make-box real?) w] [(make-box real?) h]) + (void)) + + (def/public (interactive-adjust-move [snip% s][(make-box real?) x] [(make-box real?) y]) + (set-box! x (max 0.0 (unbox x))) + (set-box! y (max 0.0 (unbox y)))) + + ;; ---------------------------------------- + + (def/public (set-selected [snip% snip]) + (begin-edit-sequence) + (no-selected) + (add-selected snip) + (end-edit-sequence)) + + (define/private (do-select snip on?) + (let ([loc (snip-loc snip)]) + (when (and loc + (not (eq? (loc-selected? loc) on?))) + (set! write-locked (add1 write-locked)) + (if (can-select? snip on?) + (begin + (on-select snip on?) + (set! write-locked (sub1 write-locked)) + (set-loc-selected?! loc on?) + (after-select snip on?) + (update-location loc)) + (set! write-locked (sub1 write-locked)))))) + + (def/public (remove-selected [snip% snip]) + (do-select snip #f)) + + (define/private (add-selected-region x y w h) + (let-values ([(x w) + (if (w . < . 0) + (values (+ x w) (- w)) + (values x w))] + [(y h) + (if (h . < . 0) + (values (+ y h) (- h)) + (values y h))]) + (let ([r (+ x w)] + [b (+ y h)]) + + (begin-edit-sequence) + + (let loop ([s snips]) + (when s + (let ([loc (snip-loc s)]) + (when (and + loc + (not (loc-selected? loc)) + ((loc-x loc) . <= . r) + ((loc-y loc) . <= . b) + ((loc-r loc) . >= . x) + ((loc-b loc) . >= . y)) + (add-selected s))) + (loop (snip->next s)))) + + (end-edit-sequence)))) + + (define/public (add-selected . args) + (case-args + args + [([real? x] [real? y] [real? w] [real? h]) + (add-selected-region x y w h)] + [([snip% snip]) + (do-select snip #t)] + (method-name 'pasteboard% 'add-selected))) + + (def/override (select-all) + (begin-edit-sequence) + (let loop ([s snips]) + (when s + (add-selected s) + (loop (snip->next s)))) + (end-edit-sequence)) + + (def/public (no-selected) + (begin-edit-sequence) + (let loop ([s snips]) + (when s + (remove-selected s) + (loop (snip->next s)))) + (end-edit-sequence)) + + ;; ---------------------------------------- + + (define/private (do-insert snip before x y) + (unless (or s-user-locked? + (not (zero? write-locked)) + (send snip is-owned?)) + (when (not (snip->snipclass snip)) + (error (method-name 'pasteboard% 'insert) + "cannot insert a snip without a snipclass: ~e" + snip)) + + (set! write-locked (add1 write-locked)) + (begin-edit-sequence) + (let ([ok? + (or (can-insert? snip before x y) + (begin + (end-edit-sequence) + (set! write-locked (sub1 write-locked)) + #f))]) + (when ok? + (on-insert snip before x y) + (set! write-locked (sub1 write-locked)) + + (let ([snip (if (send snip is-owned?) + ;; disaster: can/on-insert made the snip owned + (new image-snip%) + snip)]) + + (let ([search (and (snip-loc before) + before)]) + + (set-snip-next! snip search) + (if search + (begin + (set-snip-prev! snip (snip->prev search)) + (set-snip-prev! search snip)) + (begin + (set-snip-prev! snip last-snip) + (set! last-snip snip))) + (if (snip->prev snip) + (set-snip-next! (snip->prev snip) snip) + (set! snips snip))) + + (let ([loc (make-loc + x y 0.0 0.0 0.0 0.0 0.0 0.0 + 0.0 0.0 + #f #t + snip)]) + (hash-set! snip-location-list snip loc) + + (set-snip-style! snip (send s-style-list convert (snip->style snip))) + (when (eq? (snip->style snip) + (send s-style-list basic-style)) + (let ([s (get-default-style)]) + (when s + (set-snip-style! snip s)))) + + (send snip size-cache-invalid) + + (snip-set-admin snip snip-admin) + + (when (zero? s-noundomode) + (let ([is (make-object insert-snip-record% snip sequence-streak?)]) + (add-undo-rec is))) + (when (positive? sequence) + (set! sequence-streak? #t)) + + (set! changed? #t) + + (unless s-modified? + (set-modified #t)) + + (set! need-resize? #t) + (update-location loc) + + (set! write-locked (add1 write-locked)) + (end-edit-sequence) + (set! write-locked (sub1 write-locked)) + + (when (zero? sequence) + (update-needed)) + + (after-insert snip before x y))))))) + + (define/override (insert . args) + (case-args + args + [([snip% snip] [(make-or-false snip%) [before #f]]) + (let-values ([(x y) (get-center)]) + (do-insert snip before x y))] + [([snip% snip] [(make-or-false snip%) before] [real? x] [real? y]) + (do-insert snip before x y)] + [([snip% snip] [real? x] [real? y]) + (do-insert snip #f x y)] + (method-name 'pasteboard% 'insert))) + + (define/private (delete-some del?) + (unless (or s-user-locked? + (not (zero? write-locked))) + (let ([del (make-object delete-snip-record% sequence-streak?)]) + (when (positive? sequence) + (set! sequence-streak? #t)) + + (begin-edit-sequence) + + (let loop ([s snips]) + (when s + (let ([next (snip->next s)]) + (when (del? s) + (-delete s del)) + (loop next)))) + + (when (zero? s-noundomode) + (add-undo-rec del)) + + (end-edit-sequence)))) + + (define/public (delete . args) + (case-args + args + [() + (delete-some (lambda (s) (loc-selected? (snip-loc s))))] + [([snip% s]) + (unless (or s-user-locked? + (not (zero? write-locked))) + (let ([del (make-object delete-snip-record% sequence-streak?)]) + (when (positive? sequence) + (set! sequence-streak? #t)) + (-delete s del) + (when (zero? s-noundomode) + (add-undo-rec del))))] + (method-name 'pasteboard% 'insert))) + + (def/public (erase) + (delete-some (lambda (s) #t))) + + (define/private (-delete del-snip del) + (when (snip-loc del-snip) + (set! write-locked (add1 write-locked)) + (begin-edit-sequence) + (let ([ok? (or (can-delete? del-snip) + (begin + (end-edit-sequence) + (set! write-locked (sub1 write-locked)) + #f))]) + (and + ok? + (begin + (on-delete del-snip) + (set! write-locked (sub1 write-locked)) + + (let ([update-cursor? + (and (eq? del-snip s-caret-snip) + (begin + (send s-caret-snip own-caret #f) + (set! s-caret-snip #f) + #t))]) + + (update-snip del-snip) + + (if (snip->prev del-snip) + (set-snip-next! (snip->prev del-snip) (snip->next del-snip)) + (set! snips (snip->next del-snip))) + (if (snip->next del-snip) + (set-snip-prev! (snip->next del-snip) (snip->prev del-snip)) + (set! last-snip (snip->prev del-snip))) + + (let ([loc (snip-loc del-snip)]) + (hash-remove! snip-location-list del-snip) + (when del + (send del insert-snip del-snip (snip->next del-snip) (loc-x loc) (loc-y loc)))) + + (set-snip-next! del-snip #f) + (set-snip-prev! del-snip #f) + + (set-snip-flags! del-snip (add-flag CAN-DISOWN (snip->flags del-snip))) + (snip-set-admin del-snip #f) + (set-snip-flags! del-snip (remove-flag CAN-DISOWN (snip->flags del-snip))) + (unless del + (when (send del-snip get-admin) + (set-snip-flags! del-snip (remove-flag OWNED (snip->flags del-snip))))) + + (unless s-modified? + (set-modified #t)) + + (after-delete del-snip) + (set! changed? #t) + + (set! need-resize? #t) + + (set! write-locked (add1 write-locked)) + (end-edit-sequence) + (set! write-locked (sub1 write-locked)) + + (when (zero? sequence) + (update-needed)) + + (when update-cursor? + (when s-admin + (send s-admin update-cursor))) + + #t)))))) + + (def/public (remove [snip% del-snip]) + (unless (or s-user-locked? + (not (zero? write-locked))) + (-delete del-snip #f))) + + ;; ---------------------------------------- + + + (def/public (move-to [snip% snip] [real? x] [real? y]) + (unless (or s-user-locked? + (not (zero? write-locked))) + (let ([loc (snip-loc snip)]) + (when (and loc + (not (and + (= (loc-x loc) x) + (= (loc-y loc) y)))) + (set! write-locked (add1 write-locked)) + (begin-edit-sequence) + (if (not (can-move-to? snip x y dragging?)) + (begin + (end-edit-sequence) + (set! write-locked (sub1 write-locked))) + (begin + (on-move-to snip x y dragging?) + (set! write-locked (sub1 write-locked)) + + (update-location loc) + + (unless dragging? + (let ([rec (make-object move-snip-record% + snip + (loc-x loc) + (loc-y loc) + #f + sequence-streak?)]) + (when (positive? sequence) + (set! sequence-streak? #t)) + (when (zero? s-noundomode) + (add-undo-rec rec)))) + + (set-loc-x! loc x) + (set-loc-y! loc y) + (set-loc-r! loc (+ x (loc-w loc))) + (set-loc-b! loc (+ y (loc-h loc))) + (set-loc-hm! loc (+ x (/ (loc-w loc) 2))) + (set-loc-vm! loc (+ y (/ (loc-h loc) 2))) + (update-location loc) + + (when (and (not dragging?) + (not s-modified?)) + (set-modified #t)) + + (after-move-to snip x y dragging?) + + (set! need-resize? #t) + + (set! write-locked (add1 write-locked)) + (end-edit-sequence) + (set! write-locked (sub1 write-locked)) + + (set! changed? #t) + + (when (zero? sequence) + (update-needed)))))))) + + (define/public (move . args) + (case-args + args + [([snip% snip] [real? dx] [real? dy]) + (unless (or s-user-locked? + (not (zero? write-locked))) + (let ([loc (snip-loc snip)]) + (when loc + (move-to snip (+ (loc-x loc) dx) (+ (loc-y loc) dy)))))] + [([real? dx] [real? dy]) + (unless (or s-user-locked? + (not (zero? write-locked))) + (begin-edit-sequence) + (for ([loc (in-hash-values snip-location-list)]) + (when (loc-selected? loc) + (move (loc-snip loc) dx dy))) + (end-edit-sequence))] + (method-name 'pasteboard% 'move))) + + (def/public (resize [snip% snip] [real? w] [real? h]) + (if (not s-admin) + #f + (let ([loc (snip-loc snip)]) + (if (not loc) + #f + (let ([oldw (loc-w loc)] + [oldh (loc-h loc)]) + (set! write-locked (add1 write-locked)) + (begin-edit-sequence) + (if (not (can-resize? snip w h)) + (begin + (end-edit-sequence) + (set! write-locked (sub1 write-locked)) + #f) + (begin + (on-resize snip w h) + (set! write-locked (sub1 write-locked)) + + (let ([rv? + (and (send snip resize w h) + (begin + (when (not dragging?) + (when (zero? s-noundomode) + (let ([rs (make-object resize-snip-record% + snip oldw oldh + sequence-streak?)]) + (add-undo-rec rs)) + (when (positive? sequence) + (set! sequence-streak? #t)))) + #t))]) + (when (and rv? + (not dragging?) + (not s-modified?)) + (set-modified #t)) + + (after-resize snip w h rv?) + + (set! write-locked (add1 write-locked)) + (end-edit-sequence) + (set! write-locked (sub1 write-locked)) + + (set! changed? #t) + + (when (zero? sequence) + (update-needed)) + + rv?)))))))) + + ;; ---------------------------------------- + + (define/private (do-change-style style delta snip) + (unless (or s-user-locked? + (not (zero? write-locked))) + (let ([rec (make-object style-change-snip-record% sequence-streak?)]) + (when (positive? sequence) + (set! sequence-streak? #t)) + + (let ([style (or style + (and (not delta) + (or (get-default-style) + (send s-style-list basic-style))))]) + + (begin-edit-sequence) + + (let ([didit? + (if snip + (begin + (send rec add-style-change snip (snip->style snip)) + (set-snip-style! + snip + (or style + (send s-style-list find-or-create-style (snip->style snip) delta))) + (send snip size-cache-invalid) + (update-snip snip) + #t) + (for/fold ([didit? #f]) + ([loc (in-hash-keys snip-location-list)]) + (if (loc-selected? loc) + (let ([snip (loc-snip loc)]) + (send rec add-style-change (loc-snip loc) (snip->style snip)) + (set-snip-style! + snip + (or style + (send s-style-list find-or-create-style (snip->style snip) delta))) + (send snip size-cache-invalid) + (set-loc-need-resize?! loc #t) + (set! need-resize? #t) + (update-location loc) + #t) + didit?)))]) + + (when didit? + (when (zero? s-noundomode) + (add-undo-rec rec)) + + (set! changed? #t) + (when (not s-modified?) + (set-modified #t)))) + + (end-edit-sequence))))) + + (define/public (change-style . args) + (case-args + args + [([style-delta% delta]) + (do-change-style #f delta #f)] + [([style-delta% delta] [snip% snip]) + (do-change-style #f delta snip)] + [([style<%> style] [snip% snip]) + (do-change-style style #f snip)] + (method-name 'pasteboard% 'change-style))) + + ;; ---------------------------------------- + + (define/private (set-between snip before after) + (unless (or s-user-locked? + (not (zero? write-locked)) + (not (snip-loc snip)) + (eq? snip before) + (eq? snip after) + (and before (not (snip-loc before))) + (and after (not (snip-loc after)))) + (set! write-locked (add1 write-locked)) + (if (not (can-reorder? snip (or before after) (and before #t))) + (set! write-locked (sub1 write-locked)) + (begin + (on-reorder snip (or before after) (and before #t)) + (set! write-locked (sub1 write-locked)) + + ;; remove snip from current pos: + (if (snip->prev snip) + (set-snip-next! (snip->prev snip) (snip->next snip)) + (set! snips (snip->next snip))) + (if (snip->next snip) + (set-snip-prev! (snip->next snip) (snip->prev snip)) + (set! last-snip (snip->prev snip))) + + ;; insert before `before' or after `after': + (if before + (begin + (set-snip-prev! snip (snip->prev before)) + (set-snip-next! snip before) + (set-snip-prev! before snip) + (if (snip->prev snip) + (set-snip-next! (snip->prev snip) snip) + (set! snips snip))) + (begin + (set-snip-next! snip (snip->next after)) + (set-snip-prev! snip after) + (set-snip-next! after snip) + (if (snip->next snip) + (set-snip-prev! (snip->next snip) snip) + (set! last-snip snip)))) + + (set! changed? #t) + (unless s-modified? + (set-modified #t)) + + (update-snip snip) + + (after-reorder snip (or before after) (and before #t)))))) + + (def/public (set-before [snip% snip] [(make-or-false snip%) before]) + (set-between snip (or before snips) #f)) + + (def/public (set-after [snip% snip] [(make-or-false snip%) after]) + (set-between snip #f (or after last-snip))) + + (def/public (raise [snip% snip]) + (set-between snip (snip->prev snip) #f)) + + (def/public (lower [snip% snip]) + (set-between snip #f (snip->next snip))) + + ;; ---------------------------------------- + + (define/private (snip-set-admin snip a) + (let ([orig-admin (snip->admin snip)]) + ;; lock during set-admin! [???] + (send snip set-admin a) + + (if (not (eq? (send snip get-admin) a)) + ;; something went wrong + (cond + [(and (not a) + (eq? (snip->admin snip) orig-admin)) + ;; force admin to null + (set-snip-admin! snip #f) + snip] + [a + ;; snip didn't accept membership into this editor; give up on it + (let ([naya (new snip%)]) + (set-snip-prev! naya (snip->prev snip)) + (set-snip-next! naya (snip->next snip)) + (if (snip->prev snip) + (set-snip-next! (snip->prev naya) naya) + (set! snips naya)) + (if (snip->next snip) + (set-snip-prev! (snip->next naya) naya) + (set! last-snip naya)) + (set-snip-admin! snip #f) + (send naya set-admin a) + naya)] + [else snip]) + snip))) + + ;; ---------------------------------------- + + (define/override (really-can-edit? op) + (if (and (not (eq? op 'copy)) + (positive? write-locked)) + #f + (case op + [(clear cut copy kill) + (and (find-next-selected-snip #f) + #t)] + [(select-all) + (and snips #t)] + [else #t]))) + + ;; ---------------------------------------- + + (define/private (find-dot loc x y dxm dym) + (define (check-y) + (cond + [(inbox? (loc-y loc) y) + (set-box! dym -1) #t] + [(inbox? (loc-vm loc) y) + (set-box! dym 0) #t] + [(inbox? (loc-b loc) y) + (set-box! dym 1) #t] + [else #f])) + (cond + [(inbox? (loc-x loc) x) + (set-box! dxm -1) + (check-y)] + [(inbox? (loc-hm loc) x) + (set-box! dxm 0) + (check-y)] + [(inbox? (loc-r loc) x) + (set-box! dxm 1) + (check-y)] + [else #f])) + + (def/public (find-snip [real? x] [real? y] [(make-or-false snip%) [after #f]]) + (let ([dummy (box 0)]) + (let loop ([s (if after + (if (snip-loc after) + (snip->next after) + #f) + snips)]) + (and s + (let ([loc (snip-loc s)]) + (cond + [(and ((loc-x loc) . <= . x) + ((loc-y loc) . <= . y) + ((loc-r loc) . >= . x) + ((loc-b loc) . >= . y)) + s] + [(and (loc-selected? loc) + (find-dot loc x y dummy dummy)) + s] + [else (loop (snip->next s))])))))) + + (def/override (find-first-snip) snips) + + (def/public (is-selected? [snip% asnip]) + (let ([loc (snip-loc asnip)]) + (and loc + (loc-selected? loc)))) + + (def/public (find-next-selected-snip [(make-or-false snip%) start]) + (let loop ([s (if start + (if (snip-loc start) + (snip->next start) + #f) + snips)]) + (and s + (if (loc-selected? (snip-loc s)) + s + (loop (snip->next s)))))) + + ;; ---------------------------------------- + + (define/private (draw dc dx dy cx cy cw ch show-caret bg-color) + (when s-admin + (set! write-locked (add1 write-locked)) + (set! flow-locked? #t) + + (let ([dcx (+ cx dx)] + [dcy (+ cy dy)] + [cr (+ cx cw)] + [cb (+ cy ch)]) + (let ([dcr (+ dcx cw)] + [dcb (+ dcy ch)]) + + (when bg-color + (let ([save-pen (send dc get-pen)] + [save-brush (send dc get-brush)]) + + (let ([wb (if (and (= 255 (send bg-color red)) + (= 255 (send bg-color green)) + (= 255 (send bg-color blue))) + white-brush + (send the-brush-list find-or-create-brush bg-color 'solid))]) + (send dc set-brush wb) + (send dc set-pen invisi-pen) + (send dc draw-rectangle dcx dcy cw ch) + (send dc set-brush save-brush) + (send dc set-pen save-pen)))) + + (on-paint #t dc cx cy cr cb dx dy + (if (not s-caret-snip) + show-caret + 'no-caret)) + + (let loop ([snip last-snip] + [old-style #f]) + (if snip + (let ([loc (snip-loc snip)]) + (when (and ((loc-x loc) . <= . cr) + ((loc-y loc) . <= . cb) + ((loc-r loc) . >= . cx) + ((loc-b loc) . >= . cy)) + (send (snip->style snip) switch-to dc old-style) + (let ([old-style (snip->style snip)]) + (let ([x (+ (loc-x loc) dx)] + [y (+ (loc-y loc) dy)]) + + (send snip draw + dc x y dcx dcy dcr dcb dx dy + (if (eq? snip s-caret-snip) + show-caret + 'no-caret)) + + (when (and (eq? show-caret 'show-caret) + s-own-caret? + selection-visible? + (loc-selected? loc)) + (let ([oldbrush (send dc get-brush)] + [oldpen (send dc get-pen)]) + (send dc set-brush black-brush) + (send dc set-pen invisi-pen) + + (let ([r (+ (loc-r loc) dx)] + [b (+ (loc-b loc) dy)] + [hm (+ (loc-hm loc) dx)] + [vm (+ (loc-vm loc) dy)] + [rect + (lambda (x y) + (send dc draw-rectangle + (- x HALF-DOT-WIDTH) (- y HALF-DOT-WIDTH) + DOT-WIDTH DOT-WIDTH))]) + (rect x y) + (rect hm y) + (rect r y) + (rect r vm) + (rect r b) + (rect hm b) + (rect x b) + (rect x vm)) + + (send dc set-pen oldpen) + (send dc set-brush oldbrush)))))) + + (loop (snip->prev snip) old-style)) + (let ([bs (send s-style-list basic-style)]) + (send bs switch-to dc old-style)))) + + (on-paint #f dc cx cy cr cb dx dy + (if (not s-caret-snip) + show-caret + 'no-caret)) + + (set! flow-locked? #f) + (set! write-locked (sub1 write-locked)))))) + + ;; called by the administrator to trigger a redraw + (def/override (refresh [real? left] [real? top] [nonnegative-real? width] [nonnegative-real? height] + [(symbol-in no-caret show-inactive-caret show-caret) show-caret] + [(make-or-false color%) bg-color]) + + (cond + [(not s-admin) (void)] + [(or (width . <= . 0) (height . <= . 0)) (void)] + [(or flow-locked? (positive? sequence)) + ;; we're busy. invalidate so that everything is refreshed later. + (update left top width height)] + [else + (let-boxes ([x 0.0] + [y 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc x y)) + (when dc + (begin-sequence-lock) + + (send s-offscreen ready-offscreen width height) + + ;; make sure all location information is integral, + ;; so we can shift the coordinate system and generally + ;; update on pixel boundaries + (let ([x (->long (floor x))] + [y (->long (floor y))] + [bottom (->long (ceiling (+ top height)))] + [right (->long (ceiling (+ left width)))] + [top (->long (floor top))] + [left (->long (floor left))]) + (let ([width (- right left)] + [height (- bottom top)] + [ps? (or (dc . is-a? . post-script-dc%) + (dc . is-a? . printer-dc%))]) + + (if (and bg-color + (not (send s-offscreen is-in-use?)) + (send s-offscreen get-bitmap) + (send (send s-offscreen get-bitmap) ok?) + (send (send s-offscreen get-dc) ok?) + (not ps?)) + ;; draw to offscreen + (begin + (draw (send s-offscreen get-dc) (- left) (- top) left top width height show-caret bg-color) + + (send dc draw-bitmap-section + (send (send s-offscreen get-dc) get-bitmap) + (- left x) (- top y) + 0 0 width height 'solid) + + (send s-offscreen set-last-used #f) + (send s-offscreen set-in-use #f)) + ;; draw directly + (let ([pen (send dc get-pen)] + [brush (send dc get-brush)] + [font (send dc get-font)] + [fg (send dc get-text-foreground)] + [bg (send dc get-text-background)] + [bgmode (send dc get-text-mode)] + [rgn (send dc get-clipping-region)]) + + (send dc set-clipping-rect (- left x) (- top y) width height) + + (draw dc (- x) (- y) left top width height show-caret bg-color) + + (send dc set-clipping-region rgn) + + (send dc set-brush brush) + (send dc set-pen pen) + (send dc set-font font) + (send dc set-text-foreground fg) + (send dc set-text-background bg) + (send dc set-text-mode bgmode))))) + + (end-sequence-lock)))])) + ;; ---------------------------------------- + + (define/private (loc-resize loc dc) + (let-boxes ([ww 0.0] + [hh 0.0]) + (send (loc-snip loc) get-extent dc (loc-x loc) (loc-y loc) ww hh #f #f #f #f) + (set-loc-w! loc ww) + (set-loc-h! loc hh) + (set-loc-r! loc (+ (loc-x loc) ww)) + (set-loc-b! loc (+ (loc-y loc) hh)) + (set-loc-hm! loc (+ (loc-x loc) (/ ww 2))) + (set-loc-vm! loc (+ (loc-y loc) (/ hh 2))) + (set-loc-need-resize?! loc #f))) + + (define/private (check-recalc) + (when s-admin + (let ([dc (send s-admin get-dc)]) + (when dc + (when need-resize? + (let-values ([(r b) + (for/fold ([r 0.0] + [b 0.0]) + ([loc (in-hash-values snip-location-list)]) + (when size-cache-invalid? + (send (loc-snip loc) size-cache-invalid) + (set-loc-need-resize?! loc #t)) + (when (loc-need-resize? loc) + (loc-resize loc dc)) + (values (max r (+ (loc-r loc) HALF-DOT-WIDTH)) + (max b (+ (loc-b loc) HALF-DOT-WIDTH))))]) + + (set! real-width (max (min r (if (symbol? max-width) +inf.0 max-width)) + (if (symbol? min-width) -inf.0 min-width))) + (set! real-height (max (min b (if (symbol? max-height) +inf.0 max-height)) + (if (symbol? min-height) -inf.0 min-height))) + + (set! need-resize? #f))) + + (set! size-cache-invalid? #f) + + (when (not keep-size?) + (when (or (not (= real-width total-width)) + (not (= real-height total-height))) + (set! total-width real-width) + (set! total-height real-height) + (send s-admin resized #f))))))) + + (define/private (update x y w h) + (unless (and delayedscrollsnip + (zero? sequence) + (not flow-locked?) + (let ([s delayedscrollsnip]) + (set! delayedscrollsnip #f) + (scroll-to s + delayedscroll-x delayedscroll-y + delayedscroll-w delayedscroll-h + #t delayedscrollbias))) + (let ([r (+ x w)] + [b (+ y h)]) + (let ([x (max x 0.0)] + [y (max y 0.0)] + [r (max r 0.0)] + [b (max b 0.0)]) + + (set! no-implicit-update? #f) + + (if (not update-nonempty?) + (begin + (set! update-top y) + (set! update-left x) + (set! update-bottom (if (h . < . 0) h b)) + (set! update-right (if (w . < . 0) w r)) + (set! update-nonempty? #t)) + (begin + (set! update-top (min y update-top)) + (set! update-left (min x update-left)) + (let ([ub (if (and (h . < . 0) (update-bottom . > . 0)) + (- update-bottom) + update-bottom)]) + (set! update-bottom + (if (ub . < . 0) + (if (and (h . < . 0) (h . < . ub)) + h + (if (and (h . > . 0) + ((- b) . < . ub)) + (- b) + ub)) + (max b ub)))) + (let ([ur (if (and (w . < . 0) (update-right . > . 0)) + (- update-right) + update-right)]) + (set! update-right + (if (ur . < . 0) + (if (and (w . < . 0) (w . < . ur)) + w + (if (and (w . > . 0) + ((- r) . < . ur)) + (- r) + ur)) + (max r ur)))))) + + (unless (or (positive? sequence) + (not s-admin) + flow-locked?) + (check-recalc) + + (when (update-bottom . < . 0) + (set! update-bottom (- update-bottom)) + (when (update-bottom . < . real-height) + (set! update-bottom real-height))) + + (when (update-right . < . 0) + (set! update-right (- update-right)) + (when (update-right . < . real-width) + (set! update-right real-width))) + + (set! update-nonempty? #f) + + (when changed? + (set! changed? #f) + (set! write-locked (add1 write-locked)) + (on-change) + (set! write-locked (sub1 write-locked))) + + (when (or (not (= update-top update-bottom)) + (not (= update-left update-right))) + (let ([w (+ (- update-right update-left) 1)] + [h (+ (- update-bottom update-top) 1)]) + (when (and (w . > . 0) (h . > . 0)) + (send s-admin needs-update update-left update-top w h))))))))) + + + (define/private (update-location loc) + (when s-admin + (when (loc-need-resize? loc) + (let ([dc (send s-admin get-dc)]) + (when dc + (loc-resize loc dc)) + ;; otherwise, still need resize... + )) + (update (- (loc-x loc) HALF-DOT-WIDTH) + (- (loc-y loc) HALF-DOT-WIDTH) + (+ (loc-w loc) DOT-WIDTH) + (+ (loc-h loc) DOT-WIDTH)))) + + (define/private (update-snip snip) + (let ([loc (snip-loc snip)]) + (when loc + (update-location loc)))) + + (define/private (update-selected) + (begin-edit-sequence) + (for ([loc (in-hash-values snip-location-list)]) + (when (loc-selected? loc) + (update-location loc))) + (end-edit-sequence)) + + (define/private (update-all) + (update 0.0 0.0 -1.0 -1.0)) + + (define/private (update-needed) + (when (or (and update-nonempty? + (not no-implicit-update?)) + delayedscrollsnip) + (update update-left update-top 0 0))) + + (def/override (invalidate-bitmap-cache [real? [x 0.0]] + [real? [y 0.0]] + [(make-alts nonnegative-real? (symbol-in end)) [w 'end]] + [(make-alts nonnegative-real? (symbol-in end)) [h 'end]]) + (update x y (if (symbol? w) -1.0 w) (if (symbol? h) -1.0 h))) + + ;; ---------------------------------------- + + (def/override (own-caret [any? ownit?]) + (when (do-own-caret ownit?) + (update-selected) + (on-focus ownit?))) + + (def/override (blink-caret) + (when s-caret-snip + (let-boxes ([dc #f] + [dx 0.0] + [dy 0.0]) + (set-box! dc (send s-admin get-dc dx dy)) + (when dc + (let-boxes ([x 0.0] + [y 0.0] + [ok? #f]) + (set-box! ok? (get-snip-location s-caret-snip y)) + (when ok? + (send s-caret-snip blink-caret dc (- x dx) (- y dy)))))))) + + (def/override (size-cache-invalid) + (set! size-cache-invalid? #t) + (set! need-resize? #t)) + + (def/override (get-extent [maybe-box? w] [maybe-box? h]) + (check-recalc) + (when w (set-box! w total-width)) + (when h (set-box! h total-height))) + + ;; ---------------------------------------- + + (def/public (scroll-to [snip% snip] [real? localx] [real? localy] + [nonnegative-real? w] [nonnegative-real? h] + [any? refresh?] + [(symbol-in start end none) [bias 'none]]) + (cond + [(positive? sequence) + (set! delayedscrollsnip snip) + (set! delayedscroll-x localx) + (set! delayedscroll-y localy) + (set! delayedscroll-w w) + (set! delayedscroll-h h) + #f] + [s-admin + (let-boxes ([x 0.0] + [y 0.0]) + (get-snip-location snip x y) + (if (scroll-editor-to (+ x localx) (+ y localy) w h refresh? bias) + (begin + (set! update-top 0.0) + (set! update-left 0.0) + (set! update-bottom -1.0) + (set! update-right -1.0) + (set! update-nonempty? #t) + #t) + #f))] + [else #f])) + + (def/override (set-caret-owner [(make-or-false snip%) snip] + [(symbol-in immediate display global) [dist 'immediate]]) + (when (do-set-caret-owner snip dist) + (update-all) + (on-focus (not snip)))) + + (def/override (resized [snip% snip] [any? redraw-now?]) + (let ([loc (snip-loc snip)]) + (when (and loc + (not (loc-need-resize? loc))) + (set! changed? #t) + + (let ([niu? (or (not update-nonempty?) + no-implicit-update?)]) + + (when (not redraw-now?) + (set! sequence (add1 sequence))) + (begin-edit-sequence) + + (update-location loc) + + (set-loc-need-resize?! loc #t) + (set! need-resize? #t) + + (update-location loc) + + (end-edit-sequence) + (when (not redraw-now?) + (set! sequence (sub1 sequence))) + (when niu? + (set! no-implicit-update? #t)))))) + + (def/override (recounted [snip% snip] [any? redraw-now?]) + (resized snip redraw-now?) + #t) + + (def/override (needs-update [snip% snip] + [real? localx] [real? localy] + [nonnegative-real? w] [nonnegative-real? h]) + (let-boxes ([x 0.0] + [y 0.0]) + (get-snip-location snip x y) + (update (+ x localx) (+ y localy) w h))) + + (def/override (release-snip [snip% snip]) + (if (-delete snip #f) + (begin + (when (and (not (snip->admin snip)) + (has-flag? (snip->flags snip) OWNED)) + (set-snip-flags! snip (remove-flag (snip->flags snip) OWNED))) + #t) + #f)) + + ;; ---------------------------------------- + + (def/override (scroll-line-location [exact-integer? line]) + (* line scroll-step)) + + (def/override (num-scroll-lines) + (->long (/ (- (+ total-height scroll-step) 1) scroll-step))) + + (def/override (find-scroll-line [real? y]) + (->long (/ y scroll-step))) + + (def/public (set-scroll-step [real? s]) + (unless (= scroll-step s) + (set! scroll-step s) + (when s-admin + (send s-admin resized #t)))) + + (def/public (get-scroll-step) + scroll-step) + + ;; ---------------------------------------- + + (def/override (set-min-width [real? w]) + (set! min-width (if (w . <= . 0) 'none w)) + (set! need-resize? #t) + (update-all)) + + (def/override (set-max-width [real? w]) + (set! max-width (if (w . <= . 0) 'none w)) + (set! need-resize? #t) + (update-all)) + + (def/override (set-min-height [real? h]) + (set! min-height (if (h . <= . 0) 'none h)) + (set! need-resize? #t) + (update-all)) + + (def/override (set-max-height [real? h]) + (set! max-height (if (h . <= . 0) 'none h)) + (set! need-resize? #t) + (update-all)) + + (def/override (get-min-width) min-width) + (def/override (get-max-width) max-width) + (def/override (get-min-height) min-height) + (def/override (get-max-height) max-height) + + ;; ---------------------------------------- + + (def/override (copy-self) + (let ([pb (new pasteboard%)]) + (copy-self-to pb) + pb)) + + (def/override (copy-self-to [editor<%> pb]) + (when (pb . is-a? . pasteboard%) + (super copy-self-to pb) + (send pb set-dragable (get-dragable)) + (send pb set-selection-visible (get-selection-visible)) + (send pb set-scroll-step (get-scroll-step)))) + + ;; ---------------------------------------- + + (def/override (get-descent) 0.0) + (def/override (get-space) 0.0) + + (define/private (get-center) + (let-boxes ([x 0.0] + [y 0.0] + [w 0.0] + [h 0.0]) + (if (not s-admin) + (begin + (set-box! w total-width) + (set-box! h total-height)) + (send s-admin get-view x y w h #t)) + (let ([w (if (w . > . 1000.0) + 500.0 ; don't belive it + w)] + [h (if (h . > . 1000.0) + 500.0 ; don't belive it + h)]) + (values (/ w 2) + (/ h 2))))) + + ;; ---------------------------------------- + + (def/override (get-flattened-text) + (let ([p (open-output-string)]) + (let loop ([s snips]) + (when s + (display (send s get-text 0 (snip->count s) #t) p) + (loop (snip->next s)))) + (get-output-string p))) + + (def/override (clear) (delete)) + + (def/override (cut [any? [extend? #f]] [exact-integer? [time 0]]) + (copy extend? time) + (clear)) + + (def/override (do-copy [exact-integer? time] [bool? extend?]) + (set-common-copy-region-data! #f) + (let ([sl (if (and extend? + copy-style-list) + copy-style-list + s-style-list)]) + (let loop ([snip snips]) + (when snip + (let ([loc (snip-loc snip)]) + (when (loc-selected? loc) + (let ([asnip (send snip copy)]) + (send asnip set-admin #f) + (set-snip-style! asnip (send sl convert (snip->style asnip))) + (cons-common-copy-buffer! asnip) + (cons-common-copy-buffer2! (get-snip-data snip))))) + (loop (snip->next snip)))) + (install-copy-buffer time sl))) + + (def/override (copy [bool? extend?] [exact-integer? time]) + (begin-copy-buffer) + (when (not extend?) + (free-old-copies)) + (do-copy time extend?) + (end-copy-buffer)) + + (define/private (do-generic-paste cb time) + (unless (or s-user-locked? + (positive? write-locked)) + (let-values ([(start) snips] + [(cx cy) (get-center)]) + + (do-buffer-paste cb time) + + (if (and s-admin + (not (eq? snips start))) + (let ([dc (get-dc)]) + (when dc + ;; get top/left/bottom/right of pasted group: + (let loop ([snip snips] + [left +inf.0] + [top +inf.0] + [right -inf.0] + [bottom -inf.0]) + (if (eq? snip start) + (let ([dx (- cx (/ (left + right) 2))] + [dy (- cy (/ (top + bottom) 2))]) + ;; shift the pasted group to center: + (move dx dy)) + (let ([loc (snip-loc snip)]) + (add-selected snip) + (when (loc-need-resize? loc) + (loc-resize loc dc)) + (loop (snip->next snip) + (min (loc-x loc) left) + (min (loc-y loc) top) + (max (loc-r loc) right) + (max (loc-b loc) bottom))))))) + ;; just select them: + (let loop ([snip snips]) + (unless (eq? snip start) + (add-selected snip) + (loop (snip->next snip)))))))) + + (def/override (do-paste [exact-integer? time]) + (do-generic-paste the-clipboard time)) + + (def/override (do-paste-x-selection [exact-integer? time]) + (do-generic-paste the-x-selection-clipboard time)) + + (define/private (generic-paste x-sel? time) + (unless (or s-user-locked? + (positive? write-locked)) + (begin-edit-sequence) + (no-selected) + (if x-sel? + (do-paste-x-selection time) + (do-paste time)) + (end-edit-sequence))) + + (def/override (paste [exact-integer? time]) + (generic-paste #f time)) + + (def/override (paste-x-selection [exact-integer? time]) + (generic-paste #t time)) + + (define/override (insert-paste-snip snip data) + (insert snip snip) + (set-snip-data snip data)) + + (define/override (insert-paste-string str) + (let ([snip (new string-snip%)]) + (set-snip-style! snip (or (get-default-style) + (send s-style-list basic-style))) + (send snip insert str) + (insert-paste-snip snip #f))) + + (def/override (kill [exact-integer? time]) + (cut time)) + + (define/override (own-x-selection on? update? force?) + (do-own-x-selection on? force?)) + + ;; ---------------------------------------- + + (def/override (get-snip-location [snip% thesnip] + [maybe-box? [x #f]] + [maybe-box? [y #f]] + [bool? [bottom-right? #f]]) + (if (and bottom-right? + (not s-admin)) + #f + (begin + (when bottom-right? + (check-recalc)) + + (let ([loc (snip-loc thesnip)]) + (and loc + (begin + (when x (set-box! x (+ (loc-x loc) + (if bottom-right? + (loc-w loc) + 0.0)))) + (when y (set-box! y (+ (loc-y loc) + (if bottom-right? + (loc-h loc) + 0.0)))) + #t)))))) + + ;; ---------------------------------------- + + (def/override (get-snip-data [snip% snip]) + (let ([loc (snip-loc snip)] + [sup (super get-snip-data snip)]) + (if (not loc) + sup + (let ([data (new location-editor-data% + [x (loc-x loc)] + [y (loc-y loc)])]) + (send data set-next sup) + data)))) + + (def/override (set-snip-data [snip% snip] [editor-data% data]) + (let loop ([data data]) + (when data + (let ([c (send data get-dataclass)]) + (when c + (let ([name (send c get-classname)]) + (when (equal? name "wxloc") + (move-to snip (send data get-x) (send data get-y)))))) + (loop (send data get-next))))) + + (def/override (insert-port [input-port? f] + [(symbol-in guess same copy standard text text-force-cr) [format 'guess]] + [any? [replace-styles? #f]]) + (if (or s-user-locked? + (not (zero? write-locked))) + 'guess ;; FIXME: docs say that this is more specific + (do-insert-file (method-name 'pasteboard% 'insert-file) f replace-styles?))) + + (define/private (do-insert-file who f clear-styles?) + (when (not (detect-wxme-file who f #f)) + (error who "not a WXME file")) + (let* ([b (make-object editor-stream-in-file-base% f)] + [mf (make-object editor-stream-in% b)]) + (when (not (and (read-editor-version mf b #f #t) + (read-editor-global-header mf) + (send mf ok?) + (read-from-file mf clear-styles?) + (read-editor-global-footer mf) + (begin + ;; if STD-STYLE wasn't loaded, re-create it: + (send s-style-list new-named-style "Standard" (send s-style-list basic-style)) + (send mf ok?)))) + (error who "error loading the file"))) + 'standard) + + (def/override (save-port [output-port? f] + [(symbol-in guess same copy standard text text-force-cr) [format 'same]] + [any? [show-errors? #t]]) + + (let* ([b (make-object editor-stream-out-file-base% f)] + [mf (make-object editor-stream-out% b)]) + (when (not (and (write-editor-version mf b) + (write-editor-global-header mf) + (send mf ok?) + (write-to-file mf) + (write-editor-global-footer mf) + (send mf ok?))) + (error (method-name 'pasteboard% 'save-port) "error writing the file")) + #t)) + + (def/override (write-to-file [editor-stream-out% f]) + (and (do-write-headers-footers f #t) + (write-snips-to-file f s-style-list #f snips #f #f this) + (do-write-headers-footers f #f))) + + (def/override (read-from-file [editor-stream-in% f] [bool? overwritestyle?]) + (if (or s-user-locked? + (not (zero? write-locked))) + #f + (read-snips-from-file f overwritestyle?))) + + (define/override (do-read-insert snip) + (insert snip #f) + #t) + + (def/override (set-filename [(make-or-false path-string?) name][any? [temp? #f]]) + (set! s-filename (if (string? name) + (string->path name) + name)) + (set! s-temp-filename? temp?) + (let loop ([snip snips]) + (when snip + (when (has-flag? (snip->flags snip) USES-BUFFER-PATH) + ;; just a notification + (send snip set-admin snip-admin)) + (loop (snip->next snip))))) + + ;; ---------------------------------------- + + (def/override (style-has-changed [(make-or-false style<%>) style]) + (when (not style) + (set! changed? #t) + (update-all))) + + ;; ---------------------------------------- + + (def/override (begin-edit-sequence [any? [undoable? #t]] [any? [interrupt-seqs? #t]]) + (wait-sequence-lock) + (when (or (positive? s-noundomode) + (not undoable?)) + (set! s-noundomode (add1 s-noundomode))) + (when (and (zero? sequence) + (zero? write-locked)) + (on-edit-sequence)) + (set! sequence (add1 sequence))) + + (def/override (end-edit-sequence) + (set! sequence (sub1 sequence)) + (when (and (zero? sequence) + (zero? write-locked)) + (set! sequence-streak? #f) + (update-needed) + (after-edit-sequence)) + (when (positive? s-noundomode) + (set! s-noundomode (sub1 s-noundomode))) + (when (and (zero? sequence) + s-need-on-display-size?) + (set! s-need-on-display-size? #f) + (on-display-size))) + + (def/override (refresh-delayed?) + (or (positive? sequence) + (not s-admin) + (send s-admin delay-refresh?))) + + (def/override (in-edit-sequence?) + (positive? sequence)) + + (def/override (locations-computed?) + (not need-resize?)) + + ;; ---------------------------------------- + + (def/public (get-dragable) dragable?) + + (def/public (set-dragable [bool? d?]) + (set! dragable? d?)) + + (def/public (get-selection-visible) selection-visible?) + + (def/public (set-selection-visible [bool? v]) + (set! selection-visible? v)) + + ;; ---------------------------------------- + + (def/public (can-insert? [snip% a] [(make-or-false snip%) b] [real? x] [real? y]) + #t) + (def/public (on-insert [snip% a] [(make-or-false snip%) b] [real? x] [real? y]) + (void)) + (def/public (after-insert [snip% a] [(make-or-false snip%) b] [real? x] [real? y]) + (void)) + + (def/public (can-delete? [snip% s]) + #t) + (def/public (on-delete [snip% s]) + (void)) + (def/public (after-delete [snip% s]) + (void)) + + (def/public (can-move-to? [snip% s] [real? x] [real? y] [bool? dragging?]) + #t) + (def/public (on-move-to [snip% s] [real? x] [real? y] [bool? dragging?]) + (void)) + (def/public (after-move-to [snip% s] [real? x] [real? y] [bool? dragging?]) + (void)) + + (def/public (can-resize? [snip% s] [real? w] [real? h]) + #t) + (def/public (on-resize [snip% s] [real? w] [real? h]) + (void)) + (def/public (after-resize [snip% s] [real? w] [real? h] [any? resized?]) + (void)) + + (def/public (can-select? [snip% s] [bool? on?]) + #t) + (def/public (on-select [snip% s] [bool? on?]) + (void)) + (def/public (after-select [snip% s] [bool? on?]) + (void)) + + (def/public (can-reorder? [snip% s] [(make-or-false snip%) other] [bool? before?]) + #t) + (def/public (on-reorder [snip% s] [(make-or-false snip%) other] [bool? before?]) + (void)) + (def/public (after-reorder [snip% s] [(make-or-false snip%) other] [bool? before?]) + (void)) + + (def/public (can-interactive-move? [mouse-event% e]) + #t) + (def/public (on-interactive-move [mouse-event% e]) + (void)) + (def/public (after-interactive-move [mouse-event% e]) + (void)) + + (def/public (can-interactive-resize? [snip% s]) + #t) + (def/public (on-interactive-resize [snip% s]) + (void)) + (def/public (after-interactive-resize [snip% s]) + (void)) + + (define/override (do-begin-print dc fit?) + (size-cache-invalid) + (set! write-locked (add1 write-locked)) + (on-change) + (set! write-locked (sub1 write-locked)) + #f) + + (define/override (do-end-print dc data) + (size-cache-invalid) + (set! write-locked (add1 write-locked)) + (on-change) + (set! write-locked (sub1 write-locked))) + + (define/override (do-has-print-page? dc page) + (do-has/print-page dc page #f)) + + (def/override (print-to-dc [dc<%> dc] [exact-integer? [page -1]]) + (do-has/print-page dc page #t) + (void)) + + (define/private (do-has/print-page dc page print?) + (check-recalc) + + (let-values ([(w h) (send dc get-size)]) + (let-boxes ([w w] + [h h] + [hm 0] + [vm 0]) + (begin + (when (or (zero? (unbox w)) + (zero? (unbox h))) + (get-default-print-size w h)) + (send (current-ps-setup) get-editor-marginhm vm)) + (let ([W (- w (* 2 hm))] + [H (- h (* 2 vm))]) + (let-boxes ([w 0.0] + [h 0.0]) + (get-extent w h) + + (let ([hcount (->long (ceiling (/ W w)))] + [vcount (->long (ceiling (/ H h)))]) + + (if (not print?) + (page . <= . (* hcount vcount)) + (let-values ([(start end) + (if (negative? page) + (values 1 (* hcount vcount)) + (values page page))]) + (for ([p (in-range start end)]) + (let ([vpos (quotient (- p 1) hcount)] + [hpos (modulo (- p 1) hcount)]) + (let ([x (* hpos w)] + [y (* vpos h)]) + (when (negative? page) + (send dc start-page) + + (draw dc (+ (- x) hm) (+ (- y) vm) + x y (+ x w) (+ y h) + #f + #f) + (when (negative? page) + (send dc end-page)))))))))))))) + + ;; ---------------------------------------- + ) + +(set-pasteboard%! pasteboard%) + +;; ------------------------------------------------------------ + +(define/top (add-pasteboard-keymap-functions [keymap% tab]) + (void)) diff --git a/collects/mred/private/wxme/private.ss b/collects/mred/private/wxme/private.ss new file mode 100644 index 0000000000..816cf7c247 --- /dev/null +++ b/collects/mred/private/wxme/private.ss @@ -0,0 +1,140 @@ +#lang scheme/base +(require scheme/class) + +(provide (all-defined-out)) + +;; snip% and editor% +(define-local-member-name + s-admin) + +;; snip% +(define-local-member-name + s-prev set-s-prev + s-next set-s-next + s-count + s-style set-s-style + s-line set-s-line + s-snipclass set-s-snipclass + s-flags set-s-flags + s-dtext get-s-dtext + s-buffer get-s-buffer + str-w set-str-w + s-set-flags + do-copy-to) + +;; string-snip% +(define-local-member-name + insert-with-offset) + +;; snip-class% +(define-local-member-name + get-s-required?) + +;; editor-data% +(define-local-member-name + get-s-dataclass + get-s-next) + +;; standard-snip-class-list%, editor-data-class-list% +(define-local-member-name + reset-header-flags + find-by-map-position) + +;; editor% +(define-local-member-name + s-offscreen + s-custom-cursor + s-custom-cursor-overrides? + s-keymap + s-style-list + get-s-style-list + s-user-locked? + s-modified? + s-noundomode + s-caret-snip + s-inactive-caret-threshold + s-filename + s-need-on-display-size? + really-can-edit? + copy-out-x-selection + own-x-selection + do-own-x-selection + perform-undo-list + copy-ring-next + begin-copy-buffer + end-copy-buffer + free-old-copies + install-copy-buffer + add-undo-rec + read-snips-from-file + admin-scroll-to + do-buffer-paste + insert-paste-snip + insert-paste-string + paste-region-data + setting-admin + init-new-admin + do-read-insert + do-set-caret-owner + do-own-caret + s-start-intercept + s-end-intercept + wait-sequence-lock + begin-sequence-lock + end-sequence-lock + check-flow + get-printing + is-printing? + do-begin-print + do-end-print + do-has-print-page?) + +;; text% +(define-local-member-name + get-s-line-spacing + get-s-last-snip + get-s-total-width + get-s-total-height + refresh-box + add-back-clickback + do-insert-snips) + +;; editor-admin% +(define-local-member-name + get-s-standard + set-s-standard) + +;; editor-canvas-editor-admin% +(define-local-member-name + do-get-canvas) + +;; editor-stream% +(define-local-member-name + get-sl + get-dl + set-sl + set-dl + add-sl + add-dl + set-s-sll + get-s-sll + get-s-scl + get-s-bdl + get-s-style-count + set-s-style-count + do-reading-version + do-map-position + do-get-header-flag + do-set-header-flag) + +;; editor-stream-in% +(define-local-member-name + set-s-read-format + get-s-read-format + set-s-read-version + get-wxme-version) + +;; editor-snip% +(define-local-member-name + do-set-graphics) + diff --git a/collects/mred/private/wxme/snip-admin.ss b/collects/mred/private/wxme/snip-admin.ss new file mode 100644 index 0000000000..73a23f3a91 --- /dev/null +++ b/collects/mred/private/wxme/snip-admin.ss @@ -0,0 +1,147 @@ +#lang scheme/base +(require scheme/class + "../syntax.ss" + "snip.ss" + (only-in "cycle.ss" + set-snip-admin%! + popup-menu%) + "wx.ss") + +(provide snip-admin% + standard-snip-admin%) + +(defclass snip-admin% object% + (super-new) + + (def/public (get-editor) #f) + (def/public (get-dc) #f) + (def/public (get-view-size [maybe-box? w] [maybe-box? h]) + #f) + + (def/public (get-view [maybe-box? x] [maybe-box? y] [maybe-box? w] [maybe-box? h] + [(make-or-false snip%) snip]) + #f) + + (def/public (scroll-to [snip% s] + [real? x] [real? y] + [nonnegative-real? w] [nonnegative-real? h] + [any? refresh?] + [(symbol-in start end none) [bias 'none]]) + #f) + + (def/public (set-caret-owner [snip% s] [(symbol-in imeditorte display global) dist]) + (void)) + + (def/public (resized [snip% s] [any? redraw?]) (void)) + + (def/public (recounted [snip% s] [any? redraw?]) (void)) + + (def/public (needs-update [snip% s] [real? x] [real? y] + [nonnegative-real? w] [nonnegative-real? h]) + (void)) + + (def/public (release-snip [snip% s]) #f) + + (def/public (update-cursor) (void)) + + (def/public (popup-menu [popup-menu% p][snip% snip][real? x][real? y]) + #f) + + (def/public (modified [snip% s] [any? modified?]) + (void))) + +(set-snip-admin%! snip-admin%) + +(defclass standard-snip-admin% snip-admin% + (init-field editor) + + (super-new) + + (def/override (get-editor) editor) + (def/override (get-dc) (send editor get-dc)) + (def/override (get-view-size [maybe-box? w] [maybe-box? h]) + (get-view #f #f w h #f)) + + (def/override (get-view [maybe-box? x] [maybe-box? y] [maybe-box? w] [maybe-box? h] + [(make-or-false snip%) snip]) + (let ([admin (send editor get-admin)] + [zeros (lambda () + (when x (set-box! x 0.0)) + (when y (set-box! y 0.0)) + (when w (set-box! w 0.0)) + (when h (set-box! h 0.0)))]) + (if snip + (if admin + (let-boxes ([mx 0.0] [my 0.0] + [mw 0.0] [mh 0.0]) + (send admin get-view mx my mw mh #f) + (let ([mb (+ my mh)] + [mr (+ mx mw)]) + (let-boxes ([ok? #f] + [sl 0.0] + [st 0.0]) + (set-box! ok? (send editor get-snip-location snip sl st #f)) + (if ok? + (let-boxes ([sr 0.0][sb 0.0]) + (send editor get-snip-location snip sr sb #t) + (let ([l (max mx sl)] + [t (max my st)] + [r (min mr sr)] + [b (min mb sb)]) + (when x (set-box! x (- l sl))) + (when y (set-box! y (- t st))) + (when w (set-box! w (max 0 (- r l)))) + (when h (set-box! h (max 0 (- b t)))))) + (zeros))))) + (zeros)) + (if admin + (send admin get-view x y w h #t) + (zeros))))) + + (def/override (scroll-to [snip% s] + [real? localx] [real? localy] + [nonnegative-real? w] [nonnegative-real? h] + [any? [refresh? #t]] + [(symbol-in start end none) [bias 'none]]) + (and (eq? (send s get-admin) this) + (send editor scroll-to s localx localy w h refresh? bias))) + + (def/override (set-caret-owner [snip% s] [(symbol-in imeditorte display global) dist]) + (when (eq? (send s get-admin) this) + (send editor set-caret-owner s dist))) + + (def/override (resized [snip% s] [any? redraw?]) + (when (eq? (send s get-admin) this) + (send editor resized s redraw?))) + + (def/override (recounted [snip% s] [any? redraw?]) + (when (eq? (send s get-admin) this) + (send editor recounted s redraw?))) + + (def/override (needs-update [snip% s] [real? localx] [real? localy] + [nonnegative-real? w] [nonnegative-real? h]) + (when (eq? (send s get-admin) this) + (send editor needs-update s localx localy w h))) + + (def/override (release-snip [snip% s]) + (and (eq? (send s get-admin) this) + (send editor release-snip s))) + + (def/override (update-cursor) + (let ([admin (send editor get-admin)]) + (when admin + (send admin update-cursor)))) + + (def/override (popup-menu [popup-menu% m][snip% snip][real? x][real? y]) + (let ([admin (send editor get-admin)]) + (and admin + (let-boxes ([sl 0.0] + [st 0.0] + [ok? #f]) + (set-box! ok? (send editor get-snip-location snip sl st #f)) + (and ok? + (send admin popup-menu m (+ x sl) (+ y st))))))) + + (def/override (modified [snip% s] [any? modified?]) + (when (eq? (send s get-admin) this) + (send editor on-snip-modified s modified?)))) \ No newline at end of file diff --git a/collects/mred/private/wxme/snip-flags.ss b/collects/mred/private/wxme/snip-flags.ss new file mode 100644 index 0000000000..6634484061 --- /dev/null +++ b/collects/mred/private/wxme/snip-flags.ss @@ -0,0 +1,92 @@ +#lang scheme/base +(require (for-syntax scheme/base)) + +(provide (all-defined-out)) + +(define NO-FLAGS 0) + +(define IS-TEXT #x1) +(define CAN-APPEND #x2) +(define INVISIBLE #x4) +(define NEWLINE #x8) ;; Soft newline, typically inserted by text% +(define HARD-NEWLINE #x10) ;; => Snip must be follwed by newline +(define HANDLES-EVENTS #x20) +(define WIDTH-DEPENDS-ON-X #x40) +(define HEIGHT-DEPENDS-ON-Y #x80) +(define WIDTH-DEPENDS-ON-Y #x100) +(define HEIGHT-DEPENDS-ON-X #x200) +(define ANCHORED #x400) +(define USES-BUFFER-PATH #x800) +(define CAN-SPLIT #x1000) ;; safety feature +(define OWNED #x2000) +(define CAN-DISOWN #x4000) + +(define-syntax-rule (has-flag? flags flag) + (not (zero? (bitwise-and flags flag)))) + +(define-syntax-rule (add-flag flags flag) + (bitwise-ior flags flag)) + +(define-syntax-rule (remove-flag flags flag) + (bitwise-and flags (bitwise-not flag))) + +(define (copy-flag from to flag) + (if (has-flag? from flag) + (add-flag to flag) + (remove-flag to flag))) + +(define (flags->symbols flag) + (let-syntax ([syms + (lambda (stx) + (syntax-case stx () + [(_ id ...) + (with-syntax ([(sym ...) + (map (lambda (s) + (string->symbol + (string-downcase + (symbol->string + (syntax-e s))))) + (syntax->list #'(id ...)))]) + #'(append + (if (has-flag? flag id) + '(sym) + null) + ...))]))]) + (syms IS-TEXT + CAN-APPEND + INVISIBLE + NEWLINE + HARD-NEWLINE + HANDLES-EVENTS + WIDTH-DEPENDS-ON-X + HEIGHT-DEPENDS-ON-Y + WIDTH-DEPENDS-ON-Y + HEIGHT-DEPENDS-ON-X))) + +(define (symbols->flags symbols) + (let-syntax ([syms + (lambda (stx) + (syntax-case stx () + [(_ id ...) + (with-syntax ([(sym ...) + (map (lambda (s) + (string->symbol + (string-downcase + (symbol->string + (syntax-e s))))) + (syntax->list #'(id ...)))]) + #'(bitwise-ior + (if (memq 'sym symbols) + id + 0) + ...))]))]) + (syms IS-TEXT + CAN-APPEND + INVISIBLE + NEWLINE + HARD-NEWLINE + HANDLES-EVENTS + WIDTH-DEPENDS-ON-X + HEIGHT-DEPENDS-ON-Y + WIDTH-DEPENDS-ON-Y + HEIGHT-DEPENDS-ON-X))) \ No newline at end of file diff --git a/collects/mred/private/wxme/snip.ss b/collects/mred/private/wxme/snip.ss new file mode 100644 index 0000000000..762892138c --- /dev/null +++ b/collects/mred/private/wxme/snip.ss @@ -0,0 +1,1488 @@ +#lang scheme/base +(require scheme/class + scheme/file + "../syntax.ss" + "snip-flags.ss" + "private.ss" + "style.ss" + "cycle.ss" + "wx.ss") + +(define (symbol-list? l) + (and (list? l) (andmap symbol? l))) +(define (mutable-string? s) + (and (string? s) (not (immutable? s)))) + +(provide snip% + snip-class% + string-snip% + tab-snip% + image-snip% + editor-data% + editor-data-class% + location-editor-data% + snip-class-list<%> + editor-data-class-list<%> + get-the-snip-class-list + get-the-editor-data-class-list + the-editor-snip-class + + (struct-out snip-class-link) + (struct-out editor-data-class-link) + + snip->admin + snip->count + snip->next + snip->prev + snip->flags + snip->line + snip->style + snip->snipclass + + set-snip-admin! + set-snip-line! + set-snip-style! + set-snip-flags! + set-snip-count! + set-snip-prev! + set-snip-next! + + snip%-get-text + + string-snip-buffer + string-snip-dtext) + +;; ------------------------------------------------------------ + +(define MAX-WASTE 3) +(define MIN-WASTE-CHECK 24) +(define IMAGE-PIXELS-PER-SCROLL 20.0) +(define IMAGE-VOID-SIZE 20.0) + +(define TAB-WIDTH 20) + +(define (replace-nuls s) + (if (for/or ([c (in-string s)]) (eq? #\nul c)) + (regexp-replace* #rx"\0" s " ") + s)) + +;; ------------------------------------------------------------ + +(defclass snip-class% object% + (define classname "wxbad") + (def/public (set-classname [string? s]) + (set! classname (string->immutable-string s))) + (def/public (get-classname) classname) + + (properties [[exact-nonnegative-integer? version] 0]) + (field [s-required? #f]) + (define/public (get-s-required?) s-required?) + + (super-new) + + (def/public (read-header [editor-stream-in% f]) #t) + (def/public (write-header [editor-stream-out% f]) #t) + (def/public (reading-version [editor-stream-in% f]) + (send f do-reading-version this)) + + (def/public (read [editor-stream-in% f]) (error "should have been overridden"))) + +;; ------------------------------------------------------------ + +(defclass snip% object% + ;; For use only by the owning editor: + (field [s-prev #f] + [s-next #f] + [s-line #f]) + (define/public (set-s-prev p) (set! s-prev p)) + (define/public (set-s-next p) (set! s-next p)) + (define/public (set-s-line l) (set! s-line l)) + + (field [s-admin #f] + [s-count 1] + [s-flags NO-FLAGS] + [s-snipclass #f] + [s-style (send the-style-list basic-style)]) + (define/public (set-s-admin a) (set! s-admin a)) + (define/public (set-s-count v) (set! s-count v)) + (define/public (set-s-flags v) (set! s-flags v)) + (define/public (set-s-snipclass v) (set! s-snipclass v)) + (define/public (set-s-style s) (set! s-style s)) + + (def/public (set-snipclass [snip-class% c]) + (set! s-snipclass c)) + (def/public (get-snipclass) s-snipclass) + + (def/public (get-count) s-count) + (def/public (get-flags) (flags->symbols s-flags)) + + (super-new) + + (def/public (~) + (set! s-next #f) + (set! s-prev #f) + (set! s-line #f)) + + (def/public (next) s-next) + (def/public (previous) s-next) + (def/public (get-admin) s-admin) + + (def/public (set-admin [(make-or-false snip-admin%) a]) + (unless (and (not (eq? a s-admin)) + (has-flag? s-flags OWNED) + (or a + (not (has-flag? s-flags CAN-DISOWN)))) + (set! s-admin a) + (size-cache-invalid) + (if (not a) + (begin + (set! s-prev #f) + (set! s-next #f) + (set! s-line #f)) + (set! s-flags (add-flag OWNED s-flags))))) + + (def/public (set-count [exact-nonnegative-integer? new-count]) + (let ([old-count s-count] + [new-count (max new-count 1)]) + (set! s-count new-count) + (when s-admin + (unless (send s-admin recounted this #t) + (set! s-count old-count))))) + + (def/public (set-flags [symbol-list? new-flags]) + (s-set-flags (symbols->flags new-flags))) + + (define/public (s-set-flags new-flags) + (let* (;; make sure that wxSNIP-HARD_NEWLINE implies a wxSNIP-NEWLINE + [new-flags (if (has-flag? new-flags HARD-NEWLINE) + (add-flag new-flags NEWLINE) + (remove-flag new-flags NEWLINE))] + ;; make sure ownership and splitness flags don't change + [new-flags (copy-flag s-flags new-flags OWNED)] + [new-flags (copy-flag s-flags new-flags CAN-DISOWN)] + [new-flags (copy-flag s-flags new-flags CAN-SPLIT)]) + (set! s-flags new-flags) + (when s-admin + (send s-admin resized this #t)))) + + (def/public (on-event [dc<%> dc] [real? x] [real? y] [real? ex] [real? ey] [mouse-event% event]) + (void)) + + (def/public (adjust-cursor [dc<%> dc] [real? x] [real? y] [real? ex] [real? ey] [mouse-event% event]) + #f) + + (def/public (on-char [dc<%> dc] [real? x] [real? y] [real? ex] [real? ey] [key-event% event]) + (void)) + + (def/public (do-edit-operation [symbol? op] [any? [recur? #t]] [exact-integer? [timestamp 0]]) + (void)) + + (def/public (can-do-edit-operation? [symbol? op] [any? [recur? #t]]) + #f) + + (def/public (match [snip% other]) + (and (eq? s-snipclass (snip->snipclass other)) + (= s-count (get-field s-count other)))) + + (def/public (own-caret [any? own?]) + (void)) + + (def/public (blink-caret [dc<%> dc] [real? ex] [real? ey]) + (void)) + + (def/public (size-cache-invalid) + (void)) + + (def/public (get-extent [dc<%> dc] [real? ex] [real? ey] + [maybe-box? [w #f]] [maybe-box? [h #f]] + [maybe-box? [descent #f]] [maybe-box? [space #f]] + [maybe-box? [lspace #f]] [maybe-box? [rspace #f]]) + (when w (set-box! w 0.0)) + (when h (set-box! h 0.0)) + (when descent (set-box! descent 0.0)) + (when space (set-box! space 0.0)) + (when lspace (set-box! lspace 0.0)) + (when rspace (set-box! rspace 0.0))) + + (def/public (partial-offset [dc<%> dc] [real? ex] [real? ey] [exact-nonnegative-integer? offset]) + (if (zero? offset) + 0.0 + (let-boxes ([w 0.0]) + (get-extent dc ex ey w #f #f #f #f #f) + w))) + + (def/public (draw [dc<%> dc] [real? x] [real? y] + [real? left] [real? top] [real? bottom] [real? right] + [real? dx] [real? dy] [symbol? caret]) + (void)) + + (def/public (split [exact-nonnegative-integer? position] [box? first] [box? second]) + (let ([snip (new snip%)]) + (send snip set-s-count position) + (set! s-count (- s-count position)) + + (set-box! first snip) + (set-box! second this) + + (when (and (not (has-flag? s-flags CAN-SPLIT)) s-admin) + (send s-admin resized this #t)))) + + (def/public (merge-with [snip% other]) + #f) + + (def/public (get-text! [mutable-string? s] [exact-nonnegative-integer? offset] + [exact-integer? num] [exact-nonnegative-integer? dt]) + (unless (num . <= . 0) + (let ([str (get-text (+ offset dt) num #f)]) + (if (not str) + (for ([i (in-range num)]) + (string-set! s i #\.)) + (string-copy! s 0 str 0 num))))) + + (def/public (get-text [exact-nonnegative-integer? offset] [exact-integer? num] + [any? [flattened? #f]]) + (make-string (min num (max 0 (- s-count (max 0 offset)))) #\.)) + + (def/public (set-style [style<%> s]) + (unless (has-flag? s-flags OWNED) + (set! s-style s))) + + (def/public (get-style) + s-style) + + (def/public (copy) + (do-copy-to (new snip%))) + + (define/public (do-copy-to dest) + (send dest set-s-count s-count) + (send dest set-s-flags + (remove-flag (remove-flag (remove-flag s-flags OWNED) + CAN-DISOWN) + CAN-SPLIT)) + (send dest set-s-snipclass s-snipclass) + (send dest set-s-style s-style)) + + (def/public (write [editor-stream-out% f]) + (void)) + + (def/public (resize [real? w] [real? h]) + #f) + + (def/public (get-num-scroll-steps) + 1) + + (def/public (find-scroll-step [real? n]) + 0) + + (def/public (get-scroll-step-offset [exact-integer? n]) + 0) + + (def/public (is-owned?) + (has-flag? s-flags OWNED)) + + (def/public (release-from-owner) + (if (not (has-flag? s-flags OWNED)) + #t + (if (not s-admin) + #f + (if (send s-admin release-snip this) + (not (has-flag? s-flags OWNED)) + #f)))) + + (def/public (set-unmodified) + void)) + +(defclass internal-snip% snip% + (super-new) + (def/override (set-count [exact-integer? c]) + ;; reject change + (void))) + +;; ------------------------------------------------------------ + +(defclass string-snip-class% snip-class% + (inherit set-classname + set-version) + (inherit-field s-required?) + + (super-new) + + (set-classname "wxtext") + (set-version 3) + (set! s-required? #t) + + (def/override (read [editor-stream-in% f]) + (s-read (make-object string-snip% 0) f)) + + (def/public (s-read [string-snip% snip] [editor-stream-in% f]) + (let-boxes ([flags 0]) + (send f get flags) + (let ([pos (send f tell)]) + (let-boxes ([count 0]) + (send f get count) + (send f jump-to pos) + (let ([count (if (count . < . 0) + 10; this is a failure; we make up something + count)]) + (send snip read count f)) + (send snip set-s-flags flags) + snip))))) + +;; ------------------------------------------------------------ + +(defclass string-snip% internal-snip% + (inherit-field s-style + s-count + s-flags + s-admin + s-snipclass) + + (init-rest args) + + (super-new) + (set! s-count 0) + + (field [str-w -1.0] + [s-dtext 0] + [s-buffer ""]) + (define/public (set-str-w v) (set! str-w v)) + (define/public (get-s-dtext) s-dtext) + + (let-values ([(str len) + (cond + ;; handle common case for split, first: + [(and (pair? args) + (exact-nonnegative-integer? (car args)) + (null? (cdr args))) + (values "" (car args))] + [else + (case-args + args + [() (values "" 0)] + [([exact-nonnegative-integer? len]) + (values "" len)] + [([string? str]) + (values str (string-length str))] + [([string? str] [exact-nonnegative-integer? len]) + (values str len)] + (init-name 'string-snip%))])]) + + (set! s-flags (add-flag (add-flag s-flags IS-TEXT) CAN-APPEND)) + + (let ([len (max 20 (* 2 (min len 5000)))]) + (set! s-buffer (make-string len))) + + (set! s-snipclass the-string-snip-class) + + (unless (equal? str "") + (insert str (min (string-length str) len) 0))) + + (def/override (~) + (set! s-buffer "")) + + (def/override (size-cache-invalid) + (set! str-w -1.0)) + + (define/private (get-text-extent dc count) + (let ([font (send s-style get-font)]) + (let-values ([(w h d a) + (send dc get-text-extent (replace-nuls (substring s-buffer s-dtext (+ s-dtext count))) + font #f)]) + w))) + + (def/override (get-extent [dc<%> dc] [real? ex] [real? ey] + [maybe-box? [wo #f]] [maybe-box? [ho #f]] + [maybe-box? [dso #f]] [maybe-box? [so #f]] + [maybe-box? [ls #f]] [maybe-box? [rs #f]]) + (when (str-w . < . 0) + (let ([count s-count]) + (if (or (has-flag? s-flags INVISIBLE) + (zero? count) + (and (= count 1) + (or (eq? (string-ref s-buffer s-dtext) #\newline) + (eq? (string-ref s-buffer s-dtext) #\tab)))) + (if (and (= count 1) + (eq? (string-ref s-buffer s-dtext) #\tab)) + (set! str-w (send s-style get-text-width dc)) + (set! str-w 0.0)) + (set! str-w (get-text-extent dc count))))) + + (when wo (set-box! wo str-w)) + (when ho + (set-box! ho (send s-style get-text-height dc))) + (when dso + (set-box! dso (send s-style get-text-descent dc))) + (when so + (set-box! so (send s-style get-text-space dc))) + (when ls (set-box! ls 0.0)) + (when rs (set-box! rs 0.0))) + + (def/override (partial-offset [dc<%> dc] [real? ex] [real? ey] + [exact-nonnegative-integer? offset]) + (get-text-extent dc (min offset s-count))) + + (def/override (draw [dc<%> dc] [real? x] [real? y] + [real? left] [real? top] [real? bottom] [real? right] + [real? dx] [real? dy] [symbol? caret]) + (unless (has-flag? s-flags INVISIBLE) + (send dc draw-text (replace-nuls (substring s-buffer s-dtext (+ s-dtext s-count))) x y #f) + (when (eq? (system-type) 'unix) + (when (send s-style get-underlined) + (let ([descent (send s-style get-text-descent dc)] + [h (send s-style get-text-height dc)]) + (let ([y (if (descent . >= . 2) + (+ y (- h (/ descent 2))) + (+ y (- h descent)))]) + (send dc draw-line x y (+ x str-w) y))))))) + + (def/override (split [exact-nonnegative-integer? position] [box? first] [box? second]) + (let ([count s-count]) + (unless (or (position . < . 0) + (position . > . count)) + (let ([snip (make-object string-snip% position)]) + + (set! str-w -1.0) + + (let ([s (string-snip-buffer snip)]) + (unless ((string-length s) . >= . position) + (set-string-snip-buffer! s (make-string position)))) + + (string-copy! (string-snip-buffer snip) + 0 + s-buffer + s-dtext + (+ position s-dtext)) + (set-snip-count! snip position) + (set! s-dtext (+ s-dtext position)) + + (let ([count (- count position)]) + (set! s-count count) + + (when ((string-length s-buffer) . > . (max MIN-WASTE-CHECK (* MAX-WASTE (add1 count)))) + (let ([s (make-string count)]) + (string-copy! s 0 s-buffer s-dtext (+ s-dtext count)) + (set! s-dtext 0) + (set! s-buffer s)))) + + (set-box! first snip) + (set-box! second this) + + (when (and s-admin (not (has-flag? s-flags CAN-SPLIT))) + (send s-admin resized this #t)))))) + + (def/override (merge-with [snip% pred]) + (set! str-w -1.0) + (insert-with-offset (string-snip-buffer pred) + (snip->count pred) + (string-snip-dtext pred) + 0) + (when (not (has-flag? s-flags CAN-SPLIT)) + (send s-admin resized this #t)) + this) + + (define/public (insert-with-offset s len delta pos) + (unless (or (len . <= . 0) + (pos . < . 0)) + (let ([count s-count]) + (cond + [((string-length s-buffer) . < . (+ count len)) + (let ([s (make-string (* 2 (+ count len)))]) + (string-copy! s 0 s-buffer s-dtext (+ s-dtext count)) + (set! s-buffer s) + (set! s-dtext 0))] + [((+ s-dtext count len) . > . (string-length s-buffer)) + (string-copy! s-buffer 0 s-buffer s-dtext (+ s-dtext count)) + (set! s-dtext 0)]) + + (when (pos . < . count) + (string-copy! s-buffer (+ s-dtext pos len) + s-buffer (+ s-dtext pos) + (+ s-dtext count))) + (string-copy! s-buffer + (+ s-dtext pos) + s + delta + (+ delta len)) + (set! s-count (+ count len)) + (set! str-w -1.0) + (when (not (has-flag? s-flags CAN-SPLIT)) + (when s-admin + (unless (send s-admin recounted this #t) + (set! s-count count))))))) + + (def/public (insert [string? str] [exact-nonnegative-integer? len] + [exact-nonnegative-integer? [pos 0]]) + (insert-with-offset str len 0 pos)) + + (def/override (get-text! [mutable-string? s] [exact-nonnegative-integer? offset] + [exact-integer? num] [exact-nonnegative-integer? dt]) + (when (positive? num) + (string-copy! s dt s-buffer (+ s-dtext offset) (+ s-dtext (min (+ offset num) s-count))))) + + (def/override (get-text [exact-nonnegative-integer? offset] [exact-integer? num] + [any? [flat? #f]]) + (let ([num (min num (max 0 (- s-count offset)))]) + (if (num . <= . 0) + "" + (let ([s (make-string num)]) + (get-text! s offset num 0) + s)))) + + (def/override (copy) + (let ([snip (new string-snip%)]) + (do-copy-to snip) + snip)) + + (def/override (do-copy-to [snip% snip]) + (super do-copy-to snip) + (set-snip-count! snip 0) + (send snip insert-with-offset s-buffer s-count s-dtext 0)) + + (def/override (write [editor-stream-out% f]) + (let* ([write-flags s-flags] + [write-flags (remove-flag write-flags OWNED)] + [write-flags (remove-flag write-flags CAN-DISOWN)] + [write-flags (remove-flag write-flags CAN-SPLIT)]) + (send f put write-flags) + (let ([bytes (string->bytes/utf-8 s-buffer 0 s-dtext (+ s-dtext s-count))]) + (send f put (bytes-length bytes) bytes)))) + + (def/public (read [exact-integer? len] [editor-stream-in% f]) + (unless (len . <= . 0) + (when ((string-length s-buffer) . < . len) + (set! s-buffer (make-string (* 2 len)))) + (set! s-dtext 0) + (let ([rv (send f do-reading-version the-string-snip-class)]) + (cond + [(not (= rv 2)) + ;; read latin-1 (version < 2) or utf-8 (version > 2) + (let ([b (make-bytes len)] + [l2 (box len)]) + (send f get-unterminated-bytes! l2 b) + (let ([len (unbox l2)] + [s (if (rv . < . 2) + (bytes->string/latin-1 b #\? 0 len) + (bytes->string/utf-8 b #\? 0 len))]) + (string-copy! s-buffer 0 s 0 (string-length s)) + (set! s-count (string-length s))))] + [else + ;; version 2 wrote out UTF-32 directly -- bad idea, + ;; because it uses the machine's endianness. + (let ([b (make-bytes (* len 4))] + [l2 (box len)] + [big? (system-big-endian?)]) + (send f get-unterminated-bytes! len b) + (let ([len (unbox l2)]) + (for ([i (in-range len)]) + (let ([c (integer-bytes->integer b #f big? (* i 4) (* (add1 i) 4))]) + (string-set! s-buffer i (char->integer c))))))])) + (set! str-w -1.0)))) + +(define string-snip-buffer (class-field-accessor string-snip% s-buffer)) +(define string-snip-dtext (class-field-accessor string-snip% s-dtext)) +(define set-string-snip-buffer! (class-field-mutator string-snip% s-buffer)) + +;; ------------------------------------------------------------ + +(defclass tab-snip-class% string-snip-class% + (inherit set-classname + set-version) + (inherit-field s-required?) + + (super-new) + + (set-classname "wxtab") + (set-version 1) + (set! s-required? #t) + + (def/override (read [editor-stream-in% f]) + (let ([ts (new tab-snip%)]) + (super read ts f)))) + +;; ------------------------------------------------------------ + +(defclass tab-snip% string-snip% + (inherit-field s-snipclass + s-flags + s-admin + str-w) + (inherit set-str-w + set-s-snipclass + do-copy-to) + + (super-new) + + (set-s-snipclass the-tab-snip-class) + (set! s-flags (remove-flag (add-flag s-flags WIDTH-DEPENDS-ON-X) + CAN-APPEND)) + + (def/override (get-extent [dc<%> dc] [real? ex] [real? ey] + [maybe-box? [wi #f]] [maybe-box? [h #f]] + [maybe-box? [descent #f]] [maybe-box? [space #f]] + [maybe-box? [lspace #f]] [maybe-box? [rspace #f]]) + (let* ([old-w str-w] + [changed? (old-w . < . 0)]) + (super get-extent dc ex ey wi h descent space lspace rspace) + + (when changed? + ;; w is now width of a space + (let* ([admin s-admin] + [media (and admin + (send admin get-editor))]) + (let-values ([(n tabs tabspace mult) + (if (media . is-a? . text%) + (let-boxes ([n 0] + [space 0] + [units? #f] + [tabs null]) + (set-box! tabs (send media get-tabs n space units?)) + (values n + tabs + space + (if units? 1 str-w))) + (values 0 + #() + TAB-WIDTH + 1))]) + (set-str-w + (let loop ([i 0]) + (if (= i n) + (let ([base (if (zero? n) + 0 + (vector-ref tabs (- n 1)))]) + (let ([tabspace (* tabspace mult)]) + (+ base (- (->long tabspace) + (modulo (->long (- ex base)) + (->long tabspace)))))) + (let ([v (vector-ref tabs i)]) + (if ((* mult v) . > . ex) + (- (* mult v) ex) + (loop (add1 i)))))))))) + + (when wi (set-box! wi str-w)))) + + (def/override (partial-offset [dc<%> dc] [real? x] [real? y] + [exact-nonnegative-integer? offset]) + (if (zero? offset) + 0.0 + (let-boxes ([w 0.0]) + (get-extent dc x y w #f #f #f #f #f) + w))) + + (def/override (draw [dc<%> dc] [real? x] [real? y] + [real? left] [real? top] [real? bottom] [real? right] + [real? dx] [real? dy] [symbol? caret]) + ;; draw nothing + (void)) + + (def/override (copy) + (let ([snip (new tab-snip%)]) + (do-copy-to snip) + snip))) + +;; ------------------------------------------------------------ + +(define IMG-MOVE-BUF-SIZE 500) + +(define (int->img-type type) + (case type + [(#x2) 'bmp] + [(#x8) 'xbm] + [(#x200) 'xpm] + [(#x1000) 'gif] + [(#x11000) 'gif/mask] + [(#x4000) 'jpeg] + [(#x8000) 'png] + [(#x18000) 'png/mask] + [(#x12000) 'unknown/mask] + [else 'unknown])) + +(define (img-type->int type) + (case type + [(bmp) #x2] + [(xbm) #x8] + [(xpm) #x200] + [(gif) #x1000] + [(gif/mask) #x11000] + [(jpeg) #x4000] + [(png) #x8000] + [(png/mask) #x18000] + [(unknown/mask) #x12000] + [else #x2000])) + +(defclass image-snip-class% snip-class% + (inherit set-classname + set-version) + (inherit-field s-required?) + + (super-new) + + (set-classname "wximage") + (set-version 2) + + (def/override (read [editor-stream-in% f]) + (let ([scl (get-the-snip-class-list)] + [can-inline? ((send f do-reading-version this) . > . 1)]) + (let ([filename (let ([s (send f get-bytes #f)]) + (subbytes s 0 (max 0 (sub1 (bytes-length s)))))]) + (let-boxes ([type 0] + [w 0.0] + [h 0.0] + [dx 0.0] + [dy 0.0] + [relative 0]) + (begin + (send f get type) + (send f get w) + (send f get h) + (send f get dx) + (send f get dy) + (send f get relative)) + + (let-values ([(loadfile + type + inlined? + delfile) + (if (and (equal? filename #"") + can-inline? + (positive? type)) + ;; read inlined image + (let-boxes ([len 0]) + (send f get-fixed len) + (if (and (len . > . 0) + (send f ok?)) + (let ([fname (make-temporary-file "img~a")]) + (call-with-output-file* + fname + #:exists 'truncate + (lambda (fi) + (for ([i (in-range len)]) + (display (send f get-unterminated-bytes) fi)))) + (values fname + 'unknown/mask + #t + fname)) + (values filename + (int->img-type type) + #f + #f))) + (values filename + (int->img-type type) + #f + #f))]) + (let ([snip (make-object image-snip% + (if (equal? loadfile #"") + #f + (if (bytes? loadfile) + (bytes->path loadfile) + loadfile)) + type + (positive? relative) + inlined?)]) + (when delfile + (delete-file delfile)) + (send snip resize w h) + (send snip set-offset dx dy) + + snip))))))) + +;; ------------------------------------------------------------ + +;; old implementation prevented bitmap modifications while installed +;; in an image snip +(define (marked-as-selected? bm) #f) +(define (mark-as-selected bm) (void)) +(define (unmark-as-selected bm) (void)) + +(define black-color (make-object color% 0 0 0)) + +(defclass* image-snip% internal-snip% (equal<%>) + (inherit-field s-admin + s-flags) + (inherit set-snipclass) + + (init-rest args) + + (super-new) + + (define filename #f) + (define filetype 0) ; file != #f => type of file, otherwise loaded 1 => XBM and 2 => XPM + (define bm #f) + (define mask #f) + (define relative-path? #f) + + (define w 0.0) + (define h 0.0) + (define vieww -1.0) + (define viewh -1.0) + (define viewdx 0.0) + (define viewdy 0.0) + (define contents-changed? #f) + + (set-snipclass the-image-snip-class) + + (case-args + args + [([bitmap% bm] [(make-or-false bitmap%) [mask #f]]) + (set-bitmap bm mask)] + [([(make-or-false path-string?) [name #f]] + [(symbol-in unknown unknown/mask gif gif/mask + jpeg png png/mask + xbm xpm bmp pict) + [kind 'unknown]] + [bool? [relative-path? #f]] + [bool? [inline? #t]]) + (load-file name kind relative-path? inline?)] + (init-name 'bitmap%)) + + (define (size-cache-invalid) + (set! contents-changed? #t)) + + (def/override (get-extent [dc<%> dc] [real? ex] [real? ey] + [maybe-box? [wi #f]] [maybe-box? [hi #f]] + [maybe-box? [descent #f]] [maybe-box? [space #f]] + [maybe-box? [lspace #f]] [maybe-box? [rspace #f]]) + (when contents-changed? + (let-values ([(_w _h) + (if (and bm (send bm ok?)) + (values + (if (vieww . < . 0) + (send bm get-width) + vieww) + (if (viewh . < . 0) + (send bm get-height) + viewh)) + (values 0 0))]) + (set! w (if (zero? _w) + IMAGE-VOID-SIZE + _w)) + (set! h (if (zero? _h) + IMAGE-VOID-SIZE + _h)))) + (when wi (set-box! wi w)) + (when hi (set-box! hi h)) + (when descent + (if (or (not bm) + (not (send bm ok?))) + (set-box! descent 1.0) + (set-box! descent 0.0))) + (when space (set-box! space 0.0)) + (when lspace (set-box! lspace 0.0)) + (when rspace (set-box! rspace 0.0))) + + (def/override (draw [dc<%> dc] [real? x] [real? y] + [real? left] [real? top] [real? bottom] [real? right] + [real? dx] [real? dy] [symbol? caret]) + (if (or (not bm) + (not (send bm ok?))) + (begin + (send dc draw-rectangle + (+ x 1) (+ y 1) + (- w 2) (- h 2)) + (send dc draw-line + (+ x 1) (+ y 1) + (+ x w -2) (+ y h -2)) + (send dc draw-line + (+ x 1) (+ y h -2) + (+ x w -2) (+ y 1))) + (let ([msk (or mask + (let ([mask (send bm get-loaded-mask)]) + (and mask + (send mask ok?) + (= w (send mask get-width)) + (= w (send mask get-height)) + mask)))]) + (send dc draw-bitmap-section bm x y 0 0 w h + 'solid black-color msk)))) + + (def/override (copy) + (let ([s (new image-snip%)]) + (do-copy-to s) + s)) + + (def/override (write [editor-stream-out% f]) + (send f put (if (path? filename) + (path->bytes filename) + #"")) + (let ([write-mode + (if filename + (begin + (send f put (img-type->int filetype)) + #f) + (cond + [(not bm) (send f put 0) #f] + [(= (send bm get-depth) 1) + (send f put 1) + 'bm] + [else + (send f put 2) + 'pm]))]) + (send f put vieww) + (send f put viewh) + (send f put viewdx) + (send f put viewdy) + (send f put (if relative-path? 1 0)) + + (when write-mode + ;; inline the image + (let ([lenpos (send f tell)]) + (send f put-fixed 0) + + (let ([num-lines + (let ([fname (make-temporary-file "img~a")]) + (send bm save-file fname 'png) + (begin0 + (call-with-input-file* + fname + (lambda (fi) + (let loop ([numlines 0]) + (let ([s (read-bytes IMG-MOVE-BUF-SIZE fi)]) + (if (eof-object? s) + numlines + (begin + (send f put-unterminated s) + (loop (add1 numlines)))))))) + (delete-file fname)))]) + + (let ([end (send f tell)]) + (send f jump-to lenpos) + (send f put-fixed num-lines) + (send f jump-to end))))))) + + (def/public (load-file [(make-or-false path-string?) [name #f]] + [(symbol-in unknown unknown/mask gif gif/mask + jpeg png png/mask + xbm xpm bmp pict) + [kind 'unknown]] + [bool? [rel-path? #f]] + [bool? [inline? #t]]) + (do-set-bitmap #f #f #f) + + (let* ([rel-path? (and rel-path? + name + (relative-path? rel-path?))] + [name (if rel-path? + name + (and name (path->complete-path name)))]) + (set! s-flags + (if rel-path? + (add-flag s-flags USES-BUFFER-PATH) + (remove-flag s-flags USES-BUFFER-PATH))) + + (let ([name (and name (if (string? name) + (string->path name) + name))]) + (unless inline? + (set! filename name) + (set! filetype kind)) + + (when name + (let ([fullpath (if rel-path? + (path->complete-path + name + (or (and s-admin + (let ([e (send s-admin get-editor)]) + (and e + (let ([fn (send e get-filename)]) + (and fn + (let-values ([(base name dir?) (split-path fn)]) + (and (path? base) + (path->complete-path base)))))))) + (current-directory))) + name)]) + + (let ([nbm (dynamic-wind + begin-busy-cursor + (lambda () + (make-object bitmap% fullpath kind)) + end-busy-cursor)]) + (when (send nbm ok?) + (do-set-bitmap nbm #f #f)))))) + + ;; for refresh: + (set-bitmap bm mask))) + + (define/override (do-copy-to d) + (if (d . is-a? . snip%) + ((send d do-copy-to #f) + filename + filetype + relative-path? + vieww + viewh + viewdx + viewdy + bm mask) + (lambda (-filename -filetype -relative-path? + -vieww -viewh -viewdx -viewdy + -bm -mask) + (set! filename -filename) + (set! filetype -filetype) + (set! relative-path? -relative-path?) + (set! vieww -vieww) + (set! viewh -viewh) + (set! viewdx -viewdx) + (set! viewdy -viewdy) + (set! bm -bm) + (set! mask -mask) + (mark-as-selected bm) + (mark-as-selected mask)))) + + (def/public (get-filename [maybe-box? [rel? #f]]) + (when rel? + (set-box! rel? (and filename relative-path?))) + filename) + + (def/public (get-filetype) + (if filename + filetype + 'unknown)) + + (def/public (set-bitmap [(make-or-false bitmap%) map] + [(make-or-false bitmap%) msk]) + (do-set-bitmap map msk #t)) + + (define/private (do-set-bitmap map msk refresh?) + (unless (or (marked-as-selected? map) + (marked-as-selected? msk)) + (unmark-as-selected bm) + (unmark-as-selected mask) + + (set! bm #f) + (set! mask #f) + + (let ([map (and map (send map ok?) map)] + [msk (and msk (send msk ok?) msk)]) + (set! bm map) + (set! mask msk) + + (mark-as-selected bm) + (mark-as-selected msk)) + + (when refresh? + (set! contents-changed? #t) + (when s-admin + (send s-admin resized this #t))))) + + (def/public (get-bitmap) + bm) + + (def/public (get-bitmap-mask) + mask) + + (def/public (equal-to? [image-snip% other] [any? recur]) + (send other other-equal-to? this recur)) + + (def/public (other-equal-to? [image-snip% one] [image-snip% other] [any? recur]) + (let ([bm (send one get-bitmap)] + [bm2 (send other get-bitmap)]) + (and + bm (send bm ok?) + bm2 (send bm ok?) + (= (send bm get-depth) (send bm2 get-depth)) + (let ([w (send bm get-width)] + [h (send bm get-height)]) + (and + (= w (send bm2 get-width)) + (= h (send bm2 get-height)) + (let ([s1 (make-bytes (* w h 4))] + [s2 (make-bytes (* w h 4))]) + (send bm get-argb-pixels 0 0 w h s1 #f) + (send bm2 get-argb-pixels 0 0 w h s2 #f) + (let ([mask (send one get-bitmap-mask)]) + (when (and mask + (send mask ok?) + (= w (send mask get-width)) + (= h (send mask get-height))) + (send mask get-argb-pixels 0 0 w h s1 #t))) + (let ([mask2 (send other get-bitmap-mask)]) + (when (and mask2 + (send mask2 ok?) + (= w (send mask2 get-width)) + (= h (send mask2 get-height))) + (send mask get-argb-pixels 0 0 w h s1 #t))) + (equal? s1 s2))))))) + + (define/private (do-hash-code hash-code) + (if (and bm + (send bm ok?)) + (let ([w (send bm get-width)] + [h (send bm get-height)]) + (let ([s1 (make-bytes (* w h 4))]) + (send bm get-argb-pixels 0 0 w h s1 #f) + (when (and mask + (send mask ok?) + (= w (send mask get-width)) + (= h (send mask get-height))) + (send mask get-argb-pixels 0 0 w h s1 #t)) + (hash-code s1))) + 0)) + + (def/public (equal-hash-code-of [any? recur]) + (do-hash-code equal-hash-code)) + (def/public (equal-secondary-hash-code-of [any? recur]) + (do-hash-code equal-secondary-hash-code)) + + (def/public (set-offset [real? x] [real? y]) + (set! viewdx x) + (set! viewdy y) + (set! contents-changed? #t) + (when s-admin + (send s-admin needs-update this 0 0 w h))) + + (def/override (resize [real? w] [real? h]) + (set! vieww w) + (set! viewh h) + (set! contents-changed? #t) + (when s-admin + (send s-admin resized this #t)) + #t) + + (def/override (get-num-scroll-steps) + (max (->long (/ h IMAGE-PIXELS-PER-SCROLL)) + 1)) + + (def/override (find-scroll-step [real? y]) + (->long (/ y IMAGE-PIXELS-PER-SCROLL))) + + (def/override (get-scroll-step-offset [exact-integer? i]) + (* i IMAGE-PIXELS-PER-SCROLL)) + + (def/override (set-admin [(make-or-false snip-admin%) a]) + (when (not (eq? a s-admin)) + (super set-admin a)) + (when (and s-admin relative-path? filename) + (load-file filename filetype #t)))) + +;; ------------------------------------------------------------ + +(defclass editor-snip-class% snip-class% + (inherit set-classname + set-version) + (inherit-field s-required?) + + (super-new) + + (set-classname "wxmedia") + (set-version 4) + (set! s-required? #t) + + (def/override (read [editor-stream-in% f]) + (let ([vers (send f do-reading-version this)]) + (let ([ed% (case (send f get-exact) + [(1) extended-text%] + [(2) extended-pasteboard%] + [else #f])] + [border? (positive? (send f get-exact))] + [lm (max 0 (send f get-exact))] + [tm (max 0 (send f get-exact))] + [rm (max 0 (send f get-exact))] + [bm (max 0 (send f get-exact))] + [li (max 0 (send f get-exact))] + [ti (max 0 (send f get-exact))] + [ri (max 0 (send f get-exact))] + [bi (max 0 (send f get-exact))] + [min-w (send f get-inexact)] + [max-w (send f get-inexact)] + [min-h (send f get-inexact)] + [max-h (send f get-inexact)] + [tf? (and (vers . > . 1) + (positive? (send f get-exact)))] + [atl? (and (vers . > . 2) + (positive? (send f get-exact)))] + [ubs? (and (vers . > . 3) + (positive? (send f get-exact)))]) + (let ([e (and ed% (new ed%))]) + (let ([snip (make-object extended-editor-snip% + e + border? + lm tm rm bm li ti ri bi + (if (negative? min-w) 'none min-w) + (if (negative? max-w) 'none max-w) + (if (negative? min-h) 'none min-h) + (if (negative? max-h) 'none max-h))]) + (send snip do-set-graphics tf? atl? ubs?) + (if e + (begin + (send e get-style-list) + (send e read-from-file f #t)) + (send snip set-editor #f)) + snip)))))) + +;; ------------------------------------------------------------ + +(defclass snip-class-list% object% + (define ht (make-hash)) + (define pos-ht (make-hash)) + (define rev-pos-ht (make-hash)) + + (super-new) + + (def/public (find [string? name]) + (let ([c (hash-ref ht name #f)]) + (or c + (let ([c (get-snip-class name)]) + (when c (add c)) + c)))) + + (def/public (find-position [snip-class% c]) + (hash-ref pos-ht c -1)) + + (def/public (add [snip-class% c]) + (let ([name (send c get-classname)]) + (hash-set! ht name c) + (let ([n (hash-count pos-ht)]) + (hash-set! pos-ht c n) + (hash-set! rev-pos-ht n c)))) + + (def/public (number) (hash-count ht)) + + (def/public (nth [exact-nonnegative-integer? n]) (hash-ref rev-pos-ht n #f))) + +(define snip-class-list<%> (class->interface snip-class-list%)) + +;; ------------------------------------------------------------ + +(define the-string-snip-class (new string-snip-class%)) +(define the-tab-snip-class (new tab-snip-class%)) +(define the-image-snip-class (new image-snip-class%)) +(define the-editor-snip-class (new editor-snip-class%)) + +(define-struct snip-class-link ([c #:mutable] [name #:mutable] [header-flag #:mutable] map-position reading-version)) + +(defclass standard-snip-class-list% snip-class-list% + (inherit add + number + nth + find) + (super-new) + + (add the-string-snip-class) + (add the-tab-snip-class) + (add the-editor-snip-class) + (add the-image-snip-class) + + (define/public (reset-header-flags s) + (send s set-sl null) + (send s set-dl null)) + + (def/public (write [editor-stream-out% f]) + (let ([n (number)]) + (send f put n) + (for ([i (in-range n)]) + (let ([c (nth i)]) + (send f put (string->bytes/utf-8 (send c get-classname))) + (send f put (send c get-version)) + (send f put (if (send c get-s-required?) 1 0)) + + (send f add-sl (make-snip-class-link c + #f + 0 + i + 0))))) + #t) + + (def/public (read [editor-stream-in% f]) + (let-boxes ([count 0]) + (send f get count) + (for/and ([i (in-range count)]) + (let ([s (send f get-bytes)]) + (let-boxes ([version 0] + [required 0]) + (begin + (send f get version) + (send f get required)) + (and (send f ok?) + (send f add-sl (make-snip-class-link + #f + (bytes->string/utf-8 s #\?) + 0 + i + version)) + #t)))))) + + (define/public (find-by-map-position f n) + (ormap (lambda (s) + (and (= n (snip-class-link-map-position s)) + (begin + (when (snip-class-link-name s) + (let ([c (find (snip-class-link-name s))]) + (when (or (not c) + ((send c get-version) . < . (snip-class-link-reading-version s))) + ;; unknown class/version; + ;; since we #f out sl->name, error is only shown once + (log-error (format "unknown snip class: ~e or version: ~e" + (snip-class-link-name s) + (snip-class-link-reading-version s)))) + (set-snip-class-link-name! s #f) + (set-snip-class-link-c! s c))) + (snip-class-link-c s)))) + (send f get-sl)))) + +(define (make-the-snip-class-list) + (new standard-snip-class-list%)) + +(define the-snip-class-list (make-the-snip-class-list)) +(define (get-the-snip-class-list) + the-snip-class-list) + +;; ------------------------------------------------------------ + +(defclass editor-data% object% + (properties [[(make-or-false editor-data-class%) dataclass] #f] + [[(make-or-false editor-data%) next] #f]) + (super-new) + (def/public (write [editor-stream-out% f]) + (error 'write "should have overridden")) + + (define/public (get-s-dataclass) dataclass) + (define/public (get-s-next) next) + (define/public (set-s-next v) (set! next v))) + + +(defclass location-editor-data% editor-data% + (inherit set-dataclass) + (init-field x y) + (super-new) + (set-dataclass the-location-editor-data-class) + + (define/public (get-x) x) + (define/public (get-y) y) + + (def/override (write [editor-stream-out% f]) + (send f put x) + (send f put y) + #t)) + +;; ------------------------------------------------------------ + +(defclass editor-data-class% object% + (define classname "wxbad") + (def/public (set-classname [string? s]) + (set! classname (string->immutable-string s))) + (def/public (get-classname) classname) + + (properties [[bool? required?] #f]) + (define/public (get-s-required?) required?) + + (super-new)) + +(defclass location-editor-data-class% editor-data-class% + (inherit set-classname + set-required?) + + (super-new) + + (set-classname "wxloc") + (set-required? #t) + + (def/public (read [editor-stream-in% f]) + (let ([x (send f get-inexact)] + [y (send f get-inexact)]) + (new location-editor-data% [x x][y y])))) + +(define the-location-editor-data-class + (new location-editor-data-class%)) + +;; ------------------------------------------------------------ + +(define-struct editor-data-class-link ([c #:mutable] [name #:mutable] map-position)) + +(defclass editor-data-class-list% object% + (define ht (make-hash)) + (define pos-ht (make-hash)) + (define rev-pos-ht (make-hash)) + + (super-new) + + (add the-location-editor-data-class) + + (def/public (find [string? name]) + (let ([c (hash-ref ht name #f)]) + (or c + (let ([c (get-editor-data-class name)]) + (when c (add c)) + c)))) + + (def/public (find-position [editor-data-class% c]) + (hash-ref pos-ht c 0)) + + (def/public (add [editor-data-class% c]) + (let ([name (send c get-classname)]) + (hash-set! ht name c) + (let ([n (add1 (hash-count pos-ht))]) + (hash-set! pos-ht c n) + (hash-set! rev-pos-ht n c)))) + + (def/public (number) (hash-count ht)) + + (def/public (nth [exact-nonnegative-integer? n]) (hash-ref rev-pos-ht n #f)) + + (def/public (write [editor-stream-out% f]) + (let ([n (number)]) + (send f put n) + (for ([i (in-range 1 (add1 n))]) + (let ([c (nth i)]) + (send f put (string->bytes/utf-8 (send c get-classname))) + + (send f add-dl (make-editor-data-class-link c + #f + i))))) + #t) + + (def/public (read [editor-stream-in% f]) + (let-boxes ([count 0]) + (send f get count) + (for/and ([i (in-range count)]) + (let ([s (send f get-bytes)]) + (and (send f ok?) + (send f add-dl (make-editor-data-class-link + #f + (bytes->string/utf-8 s #\?) + (add1 i))) + #t))))) + + (define/public (find-by-map-position f n) + (ormap (lambda (s) + (and (= n (editor-data-class-link-map-position s)) + (begin + (when (editor-data-class-link-name s) + (let ([c (find (editor-data-class-link-name s))]) + (when (not c) + ;; unknown class/version + (log-error (format "unknown editor data class: ~e" + (editor-data-class-link-name s)))) + (set-editor-data-class-link-name! s #f) + (set-editor-data-class-link-c! s c))) + (editor-data-class-link-c s)))) + (send f get-dl)))) + +(define editor-data-class-list<%> (class->interface editor-data-class-list%)) + +(define (make-the-editor-data-class-list) + (new editor-data-class-list%)) + +(define the-editor-data-class-list (make-the-editor-data-class-list)) +(define (get-the-editor-data-class-list) + the-editor-data-class-list) + +;; ------------------------------------------------------------ + +(define snip->admin (class-field-accessor snip% s-admin)) +(define snip->count (class-field-accessor snip% s-count)) +(define snip->next (class-field-accessor snip% s-next)) +(define snip->prev (class-field-accessor snip% s-prev)) +(define snip->flags (class-field-accessor snip% s-flags)) +(define snip->line (class-field-accessor snip% s-line)) +(define snip->style (class-field-accessor snip% s-style)) +(define snip->snipclass (class-field-accessor snip% s-snipclass)) + +(define set-snip-admin! (class-field-mutator snip% s-admin)) +(define set-snip-line! (class-field-mutator snip% s-line)) +(define set-snip-style! (class-field-mutator snip% s-style)) +(define set-snip-flags! (class-field-mutator snip% s-flags)) +(define set-snip-count! (class-field-mutator snip% s-count)) +(define set-snip-prev! (class-field-mutator snip% s-prev)) +(define set-snip-next! (class-field-mutator snip% s-next)) + +(define snip%-get-text (generic snip% get-text)) diff --git a/collects/mred/private/wxme/stream.ss b/collects/mred/private/wxme/stream.ss new file mode 100644 index 0000000000..10aa45c172 --- /dev/null +++ b/collects/mred/private/wxme/stream.ss @@ -0,0 +1,761 @@ +#lang scheme/base +(require scheme/class + "../syntax.ss" + "private.ss" + "snip.ss" + (only-in "cycle.ss" + set-editor-stream-in%! + set-editor-stream-out%!)) + +(provide editor-stream-in% + editor-stream-out% + editor-stream-in-base% + editor-stream-in-bytes-base% + editor-stream-in-file-base% + editor-stream-out-base% + editor-stream-out-bytes-base% + editor-stream-out-file-base%) + +;; ---------------------------------------- + +(defclass editor-stream% object% + + (super-new) + + (define scl (get-the-snip-class-list)) + (define bdl (get-the-editor-data-class-list)) + (define/public (get-s-scl) scl) + (define/public (get-s-bdl) bdl) + + (define sl null) + (define dl null) + + (define/public (get-sl) sl) + (define/public (get-dl) dl) + (define/public (set-sl n) (set! sl n)) + (define/public (set-dl n) (set! dl n)) + (define/public (add-sl v) (set! sl (cons v sl))) + (define/public (add-dl v) (set! dl (cons v dl))) + + (define sll null) + (define style-count 0) + (define/public (get-s-sll) sll) + (define/public (set-s-sll v) (set! sll v)) + (define/public (get-s-style-count) style-count) + (define/public (set-s-style-count v) (set! style-count v)) + + (define/public (do-reading-version sclass) + (or (ormap (lambda (scl) + (and (eq? (snip-class-link-c scl) sclass) + (snip-class-link-reading-version scl))) + sl) + ;; Class didn't show up in the header? + ;; Assume we're reading the current version. + (send sclass get-version))) + + (define/public (do-map-position sclass-or-dclass) + (if (sclass-or-dclass . is-a? . snip-class%) + (or (ormap (lambda (scl) + (and (eq? (snip-class-link-c scl) sclass-or-dclass) + (snip-class-link-map-position scl))) + sl) + -1) + (or (ormap (lambda (dcl) + (and (eq? (editor-data-class-link-c dcl) sclass-or-dclass) + (editor-data-class-link-map-position dcl))) + dl) + -1))) + + (define/public (do-get-header-flag sclass) + (or (ormap (lambda (scl) + (and (eq? (snip-class-link-c scl) sclass) + (snip-class-link-header-flag scl))) + sl) + 0)) + + (define/public (do-set-header-flag sclass) + (ormap (lambda (scl) + (and (eq? (snip-class-link-c scl) sclass) + (begin + (set-snip-class-link-header-flag! scl #t) + #t))) + sl) + (void))) + +;; ---------------------------------------- + +(defclass editor-stream-in-base% object% + (super-new) + (def/public (tell) 0) + (def/public (seek [exact-nonnegative-integer? i]) (void)) + (def/public (skip [exact-nonnegative-integer? i]) (void)) + (def/public (bad?) #t) + (def/public (read [vector? v]) + (let ([s (make-bytes (vector-length v))]) + (let ([n (read-bytes s)]) + (for ([i (in-range n)]) + (vector-set! v i (integer->char (bytes-ref s i)))) + n))) + (def/public (read-bytes [bytes? v] + [exact-nonnegative-integer? [start 0]] + [exact-nonnegative-integer? [end (bytes-length v)]]) + 0)) + +(defclass editor-stream-out-base% object% + (super-new) + (def/public (tell) 0) + (def/public (seek [exact-nonnegative-integer? i]) (void)) + (def/public (skip [exact-nonnegative-integer? i]) (void)) + (def/public (bad?) #t) + (def/public (write [(make-list char?) v]) + (write-bytes (string->bytes/latin-1 (list->string v) (char->integer #\?)))) + (def/public (write-bytes [bytes? v] + [exact-nonnegative-integer? [start 0]] + [exact-nonnegative-integer? [end (bytes-length v)]]) + (void))) + +;; ---------------------------------------- + +(defclass editor-stream-in-port-base% editor-stream-in-base% + (init-field port) + (super-new) + + (def/override (tell) + (file-position port)) + + (def/override (seek [exact-nonnegative-integer? i]) + (file-position port i)) + + (def/override (skip [exact-nonnegative-integer? i]) + (file-position port (+ i (file-position port)))) + + (def/override (bad?) #f) + + (def/override (read-bytes [bytes? v] + [exact-nonnegative-integer? [start 0]] + [exact-nonnegative-integer? [end (bytes-length v)]]) + (let ([r (read-bytes! v port start end)]) + (if (eof-object? r) + 0 + r)))) + +(defclass editor-stream-in-file-base% editor-stream-in-port-base% + (super-new)) + +(defclass editor-stream-in-bytes-base% editor-stream-in-port-base% + (init s) + (super-new [port (open-input-bytes s)])) + +;; ---------------------------------------- + +(define write-bytes-proc write-bytes) + +(defclass editor-stream-out-port-base% editor-stream-out-base% + (init-field port) + (super-new) + + (def/override (tell) + (file-position port)) + + (def/override (seek [exact-nonnegative-integer? i]) + (file-position port i)) + + (def/override (skip [exact-nonnegative-integer? i]) + (file-position port (+ i (file-position port)))) + + (def/override (bad?) #f) + + (def/override (write-bytes [bytes? v] + [exact-nonnegative-integer? [start 0]] + [exact-nonnegative-integer? [end (bytes-length v)]]) + (write-bytes-proc v port start end))) + +(defclass editor-stream-out-file-base% editor-stream-out-port-base% + (super-new)) + +(defclass editor-stream-out-bytes-base% editor-stream-out-port-base% + (define s (open-output-bytes)) + (super-new [port s]) + + (def/public (get-bytes) + (get-output-bytes s))) + +;; ---------------------------------------- + +(defclass editor-stream-in% editor-stream% + (init-rest args) + + (define f + (case-args + args + [([editor-stream-in-base% base]) base] + (init-name 'editor-stream-in%))) + + (define boundaries null) + (define is-bad? #f) + (define items 0) + (define pos-map (make-hash)) + + (define read-version 8) + (define s-read-version #"08") + + (super-new) + + (define/public (set-s-read-version bstr) + (set! s-read-version bstr) + (set! read-version (or (string->number (bytes->string/utf-8 bstr)) 0))) + (define/public (get-wxme-version) read-version) + + (define s-read-format #"WXME") + (define/public (set-s-read-format bstr) + (set! s-read-format bstr)) + (define/public (get-s-read-format) + s-read-format) + + (define/private (do-skip-whitespace) + (define (bad!) (set! is-bad? #t) 0) + (if is-bad? + 0 + (let ([s (make-bytes 1)]) + (let loop ([prev-byte 0]) + (if (not (= 1 (send f read-bytes s))) + (bad!) + (let ([b (bytes-ref s 0)]) + (case (integer->char b) + [(#\#) + (let ([pos (send f tell)]) + (if (and (= 1 (send f read-bytes s)) + (= (bytes-ref s 0) (char->integer #\|))) + ;; skip to end of comment + (let cloop ([saw-bar? #f] + [saw-hash? #f] + [nesting 0]) + (if (not (= 1 (send f read-bytes s))) + (bad!) + (cond + [(and saw-bar? (= (bytes-ref s 0) (char->integer #\#))) + (if (zero? nesting) + (loop (char->integer #\space)) + (cloop #f #f (sub1 nesting)))] + [(and saw-hash? (= (bytes-ref s 0) (char->integer #\|))) + (cloop #t #f (add1 nesting))] + [else (cloop (= (bytes-ref s 0) (char->integer #\|)) + (= (bytes-ref s 0) (char->integer #\#)) + nesting)]))) + (begin + (send f seek pos) + (char->integer #\#))))] + [(#\;) + ;; skip to end of comment + (let cloop () + (if (not (= 1 (send f read-bytes s))) + (bad!) + (if (or (= (bytes-ref s 0) (char->integer #\newline)) + (= (bytes-ref s 0) (char->integer #\return))) + (loop (char->integer #\space)) + (cloop))))] + [else + (if (char-whitespace? (integer->char b)) + (loop b) + b)]))))))) + + (define/private (skip-whitespace [buf #f]) + (let ([c (do-skip-whitespace)]) + (when buf + (bytes-set! buf 0 c)) + c)) + + (define/private (is-delim? b) + (cond + [(char-whitespace? (integer->char b)) #t] + [(= b (char->integer #\#)) + (let ([pos (send f tell)] + [s (make-bytes 1)]) + (send f read-bytes s) + (let ([d? (= (bytes-ref s 0) (char->integer #\|))]) + (send f seek (if d? (sub1 pos) pos)) + d?))] + [(= b (char->integer #\;)) + (send f seek (sub1 (send f tell))) + #t] + [else #f])) + + (define/private (get-number get-exact?) + (let ([c0 (skip-whitespace)]) + (if (check-boundary) + (if get-exact? 0 0.0) + (let* ([s (make-bytes 1)] + [l (cons (integer->char c0) + (let loop ([counter 50]) + (if (zero? counter) + null + (if (= 1 (send f read-bytes s)) + (let ([s (bytes-ref s 0)]) + (if (is-delim? s) + null + (cons (integer->char s) + (loop (sub1 counter))))) + null))))]) + (inc-item-count) + (let ([n (string->number (list->string l))]) + (cond + [(or (not n) + (not (real? n)) + (and get-exact? (not (exact-integer? n)))) + (set! is-bad? #t) + (if get-exact? 0 0.0)] + [get-exact? n] + [else + (exact->inexact n)])))))) + + (define/private (get-a-string limit recur?) + (let* ([orig-len (if recur? + (if (limit . < . 16) + limit + 16) + (get-exact))] + [buf (make-bytes 32)] + [fail (lambda () + (set! is-bad? #t) + #"")]) + (if recur? + (bytes-set! buf 0 (char->integer #\#)) + (begin + (skip-whitespace buf) + (when is-bad? + (bytes-set! buf 0 0)))) + (cond + [(= (bytes-ref buf 0) (char->integer #\#)) + (if (and (= (send f read-bytes buf 1 2) 1) + (= (bytes-ref buf 1) (char->integer #\"))) + (let-values ([(si s) (make-pipe)] + [(tmp) (make-bytes (+ orig-len 2))]) + (display "#\"" s) + (let loop ([get-amt (add1 orig-len)]) ;; add 1 for closing quote + (let ([got-amt (send f read-bytes tmp 0 get-amt)]) + (if (not (= got-amt get-amt)) + (fail) + (begin + (write-bytes tmp s 0 got-amt) + (let ([done? + (let loop ([i 0]) + (cond + [(= i got-amt) #f] + [(= (bytes-ref tmp i) (char->integer #\")) #t] + [(= (bytes-ref tmp i) (char->integer #\\)) + (if (= (add1 i) got-amt) + ;; need to read escaped character + (if (not (= (send f read-bytes tmp got-amt (add1 got-amt)) 1)) + (fail) + (begin + (write-bytes tmp s got-amt (add1 got-amt)) + #f)) + (loop (+ i 2)))] + [else (loop (+ i 1))]))]) + (if done? + (begin + (close-output-port s) + (unless recur? (inc-item-count)) + (let ([s (with-handlers ([exn:fail:read? (lambda (x) #f)]) + (read si))]) + (if (or (not s) + (not (eof-object? (read-byte si)))) + (fail) + (if (if recur? + ((bytes-length s) . <= . limit) + (= (bytes-length s) orig-len)) + s + (fail))))) + (loop 1)))))))) + (fail))] + [(and (not recur?) (= (bytes-ref buf 0) (char->integer #\())) + ;; read a sequence of strings + (let loop ([accum null] + [left-to-get orig-len]) + (skip-whitespace buf) + (if (or is-bad? + (negative? left-to-get)) + (fail) + (cond + [(= (bytes-ref buf 0) (char->integer #\))) + ;; got all byte strings + (if (zero? left-to-get) + (begin + (inc-item-count) + (apply bytes-append (reverse accum))) + (fail))] + [(= (bytes-ref buf 0) (char->integer #\#)) + (let ([v (get-a-string left-to-get #t)]) + (if is-bad? + (fail) + (loop (cons v accum) + (- left-to-get (bytes-length v)))))] + [else (fail)])))] + [else (fail)]))) + + (define/private (inc-item-count) + (set! items (add1 items)) + (tell)) + + (define/private (skip-one recur?) + (let ([buf (make-bytes 1)] + [fail (lambda () (set! is-bad? #t) (void))] + [success (lambda () (unless recur? (inc-item-count)))]) + (if recur? + (bytes-set! buf 0 (char->integer #\#)) + (skip-whitespace buf)) + (unless is-bad? + (cond + [(= (bytes-ref buf 0) (char->integer #\#)) + ;; byte string + (if (and (= 1 (send f read-bytes buf)) + (= (bytes-ref buf 0) (char->integer #\"))) + (let loop () + (if (= 1 (send f read-bytes buf)) + (cond + [(= (bytes-ref buf 0) (char->integer #\\)) + (if (= 1 (send f read-bytes buf)) + (loop) + (fail))] + [(= (bytes-ref buf 0) (char->integer #\")) + (success)] + [else (loop)]) + (fail))) + (fail))] + [(= (bytes-ref buf 0) (char->integer #\))) + ;; list of byte strings + (let loop () + (if is-bad? + (fail) + (if (not (= (send f read-bytes buf) 1)) + (fail) + (if (is-delim? (bytes-ref buf 0)) + (cond + [(= (bytes-ref buf 0) (char->integer #\))) + (success)] + [(= (bytes-ref buf 0) (char->integer #\#)) + (skip-one #t) + (loop)] + [else (fail)]) + (loop)))))] + [else + ;; number -- skip anything delimited + (let loop () + (if (not (= (send f read-bytes buf) 1)) + (fail) + (if (is-delim? (bytes-ref buf 0)) + (success) + (loop))))])))) + + (def/public (get-fixed [box? vb]) + (let ([v (if (check-boundary) + 0 + (if (read-version . < . 8) + (let ([buf (make-bytes 4)]) + (send f read-bytes buf) + (integer-bytes->integer + buf + #t + (if (= read-version 1) + (system-big-endian?) + #t))) + (get-exact)))]) + (set-box! vb v))) + + #| + integer format specified by first byte: + bit 8: 0 - read 7-bit (positive) number + bit 8: 1 - ... + bit 7: 0 - read abother byte for 15-bit (positive) number + bit 7: 1 - negative and long numbers... + bit 1: 1 - read another 8-bit (signed) number + bit 1: 0 - ... + bit 2: 1 - read another 16-bit (signed) number + bit 2: 0 - read another 32-bit (signed) number + |# + + (def/public (get-exact) + (if (check-boundary) + 0 + (if (read-version . < . 8) + (let ([buf (make-bytes 4)] + [fail (lambda () (set! is-bad? #t) 0)]) + (if (not (= 1 (send f read-bytes buf 0 1))) + (fail) + (let ([b (bytes-ref buf 0)]) + (if (positive? (bitwise-and b #x80)) + (if (positive? (bitwise-and b #x40)) + (cond + [(positive? (bitwise-and b #x01)) + (if (= 1 (send f read-bytes buf 0 1)) + (let ([b (bytes-ref buf 0)]) + (if (b . > . 127) + (- b 256) + b)) + (fail))] + [(positive? (bitwise-and b #x02)) + (if (= 2 (send f read-bytes buf 0 2)) + (integer-bytes->integer b #t #t) + (fail))] + [else + (if (= 4 (send f read-bytes buf 0 2)) + (integer-bytes->integer buf #t #t) + (fail))]) + (if (= 1 (send f read-bytes buf 0 1)) + (+ (arithmetic-shift (bitwise-and b #x3F) 8) + (bytes-ref buf 0)) + (fail))) + b)))) + (get-number #t)))) + + (def/public (get-inexact) + (if (check-boundary) + 0 + (if (read-version . < . 8) + (let ([buf (make-bytes 8)]) + (send f read-bytes buf) + (floating-point-bytes->real + buf + (if (= read-version 1) + (system-big-endian?) + #t))) + (get-number #f)))) + + (define/private (do-get-bytes) + (if (check-boundary) + #"" + (if (read-version . < . 8) + (let* ([len (get-exact)] + [s (make-bytes len)]) + (send f read-bytes s) + s) + (get-a-string #f #f)))) + + (def/public (get-bytes [maybe-box? [len #f]]) + (let ([s (do-get-bytes)]) + (when len + (set-box! len (max 1 (bytes-length s)))) + (subbytes s 0 (max 0 (sub1 (bytes-length s)))))) + + (def/public (get-unterminated-bytes [maybe-box? [len #f]]) + (let ([s (do-get-bytes)]) + (when len + (set-box! len (bytes-length s))) + s)) + + (def/public (get-unterminated-bytes! [(make-box exact-nonnegative-integer?) len] + [(lambda (s) (and (bytes? s) (not (immutable? s)))) s]) + (let ([s2 (do-get-bytes)]) + (if ((bytes-length s2) . <= . (unbox len)) + (begin + (bytes-copy! s 0 s2) + (set-box! len (bytes-length s2))) + (set! is-bad? #t)))) + + (def/public (get [(make-box real?) b]) + (unless (check-boundary) + (if (exact-integer? (unbox b)) + (set-box! b (get-exact)) + (set-box! b (get-inexact))))) + + (def/public (set-boundary [exact-nonnegative-integer? n]) + (set! boundaries (cons (+ (tell) n) boundaries))) + + (def/public (remove-boundary) + (set! boundaries (cdr boundaries))) + + (define/private (check-boundary) + (if is-bad? + #t + (cond + [(and (pair? boundaries) + ((tell) . > . (car boundaries))) + (set! is-bad? #t) + (error 'editor-stream-in% + "overread (caused by file corruption?; ~a vs ~a)" (tell) (car boundaries))] + [(send f bad?) + (set! is-bad? #t) + (error 'editor-stream-in% "stream error")] + [else #f]))) + + (def/public (skip [exact-nonnegative-integer? n]) + (if (read-version . < . 8) + (send f skip n) + (jump-to (+ n items)))) + + (def/public (tell) + (if (read-version . < . 8) + (send f tell) + (let ([pos (send f tell)]) + (hash-set! pos-map items pos) + items))) + + (def/public (jump-to [exact-nonnegative-integer? pos]) + (if (read-version . < . 8) + (send f seek pos) + (let ([p (hash-ref pos-map pos #f)]) + (if (not p) + (begin + (let loop () + (when (and (items . < . pos) (not is-bad?)) + (skip-one #f) + (loop))) + (unless (= items pos) + (set! is-bad? #t))) + (begin + (send f seek p) + (set! items pos)))))) + + (def/public (ok?) (not is-bad?))) + +(set-editor-stream-in%! editor-stream-in%) + +;; ---------------------------------------- + +(defclass editor-stream-out% editor-stream% + (init-rest args) + + (define f + (case-args + args + [([editor-stream-out-base% base]) base] + (init-name 'editor-stream-out%))) + + (define is-bad? #f) + (define col 72) + (define items 0) + (define pos-map (make-hash)) + + (super-new) + + (define/private (check-ok) + (unless is-bad? + (when (send f bad?) + (error 'editor-stream-out% "stream error")))) + + (def/public (put-fixed [exact-integer? v]) + (check-ok) + (let-values ([(new-col spc) + (if ((+ col 12) . > . 72) + (values 11 #"\n") + (values (+ col 12) #" "))]) + (let ([s (number->string v)]) + (send f + write-bytes + (bytes-append spc + (make-bytes (- 11 (string-length s)) (char->integer #\space)) + (string->bytes/latin-1 s)))) + (set! items (add1 items))) + this) + + (define/public (put . args) + (case-args + args + [([exact-nonnegative-integer? n][bytes? s]) + (do-put-bytes (subbytes s 0 n))] + [([bytes? s]) + (do-put-bytes (bytes-append s #"\0"))] + [([exact-integer? n]) + (do-put-number n)] + [([real? n]) + (do-put-number (exact->inexact n))] + (method-name 'editor-stream-out% 'put))) + + (def/public (put-unterminated [bytes? s]) + (do-put-bytes s)) + + (define/private (do-put-bytes orig-s) + (define (single-string) + (if ((bytes-length orig-s) . < . 72) + (let ([s (open-output-bytes)]) + (write orig-s s) + (let* ([v (get-output-bytes s)] + [len (bytes-length v)]) + (if (len . >= . 72) + (multiple-strings) + (begin + (if ((+ col len 1) . > . 72) + (send f write-bytes #"\n") + (send f write-bytes #" ")) + (send f write-bytes v) + (set! col 72))))) ;; forcing a newline after every string makes the file more readable + (multiple-strings))) + (define (multiple-strings) + (send f write-bytes #"\n(") + (let loop ([offset 0][remain (bytes-length orig-s)]) + (unless (zero? remain) + (let lloop ([amt (min 50 remain)][retry? #t]) + (let ([s (open-output-bytes)]) + (write (subbytes orig-s offset (+ offset amt)) s) + (let* ([v (get-output-bytes s)] + [len (bytes-length v)]) + (if (len . <= . 71) + (if (and (len . < . 71) + retry? + (amt . < . remain)) + (lloop (add1 amt) #t) + (begin + (send f write-bytes #"\n ") + (send f write-bytes v) + (loop (+ offset amt) (- remain amt)))) + (lloop (sub1 amt) #f))))))) + (send f write-bytes #"\n)") + (set! col 1)) + + (check-ok) + (do-put-number (bytes-length orig-s)) + (single-string) + (set! items (add1 items)) + this) + + (define/private (do-put-number v) + (check-ok) + (let* ([s (string->bytes/latin-1 (format " ~a" v))] + [len (bytes-length s)]) + (if ((+ col len) . > . 72) + (begin + (set! col (sub1 len)) + (bytes-set! s 0 (char->integer #\newline))) + (set! col (+ col len))) + (send f write-bytes s) + (set! items (add1 items)) + this)) + + (def/public (tell) + (let ([pos (send f tell)]) + (hash-set! pos-map items (cons pos col)) + items)) + + (def/public (jump-to [exact-nonnegative-integer? icount]) + (unless is-bad? + (let ([p (hash-ref pos-map icount #f)]) + (when p + (send f seek (car p)) + (set! col (cdr p)) + (set! items icount))))) + + (def/public (ok?) (not is-bad?)) + + (def/public (pretty-finish) + (unless is-bad? + (when (positive? col) + (send f write-bytes #"\n") + (set! col 0)))) + + (def/public (pretty-start) + (define (show s) + (send f write-bytes (if (string? s) (string->bytes/latin-1 s) s))) + (when (positive? col) + (show #"\n")) + (show #"#|\n This file is in plt scheme editor format.\n") + (show (format " Open this file in dr-scheme version ~a or later to read it.\n" (version))) + (show #"\n") + (show #" Most likely, it was created by saving a program in DrScheme,\n") + (show #" and it probably contains a program with non-text elements\n") + (show #" (such as images or comment boxes).\n") + (show #"\n") + (show #" http://www.plt-scheme.org\n|#\n") + (set! col 0))) + +(set-editor-stream-out%! editor-stream-out%) + diff --git a/collects/mred/private/wxme/style.ss b/collects/mred/private/wxme/style.ss new file mode 100644 index 0000000000..28aa45ea7f --- /dev/null +++ b/collects/mred/private/wxme/style.ss @@ -0,0 +1,1438 @@ +#lang scheme/base +(require scheme/class + (for-syntax scheme/base) + "../syntax.ss" + "cycle.ss" + "private.ss" + "wx.ss") + +(define font-directory #f) + +(provide mult-color<%> + add-color<%> + style-delta% + style<%> + style-list% + the-style-list + setup-style-reads-writes + done-style-reads-writes + read-styles-from-file + write-styles-to-file) + +(define default-size + (case (system-type) + [(windows) 10] + [else 12])) + +(define black-color (make-object color% 0 0 0)) + +(defclass mult-color% object% + (define r 0.0) + (define g 0.0) + (define b 0.0) + + (super-new) + + (def/public (get [box? rb] [box? gb] [box? bb]) + (set-box! rb r) + (set-box! gb g) + (set-box! bb b)) + + (def/public (set [real? rf] [real? gf] [real? bf]) + (set! r rf) + (set! g gf) + (set! b bf)) + + (def/public (get-r) r) + (def/public (get-g) g) + (def/public (get-b) b) + + (def/public (set-r [real? v]) + (set! r v)) + (def/public (set-g [real? v]) + (set! g v)) + (def/public (set-b [real? v]) + (set! b v))) + +(define mult-color<%> (class->interface mult-color%)) + + +(defclass add-color% object% + (define r 0) + (define g 0) + (define b 0) + + (super-new) + + (def/public (get [box? rb] [box? gb] [box? bb]) + (set-box! rb r) + (set-box! gb g) + (set-box! bb b)) + + (def/public (set [exact-integer? rf] [exact-integer? gf] [exact-integer? bf]) + (set! r rf) + (set! g gf) + (set! b bf)) + + (def/public (get-r) r) + (def/public (get-g) g) + (def/public (get-b) b) + + (def/public (set-r [exact-integer? v]) + (set! r v)) + (def/public (set-g [exact-integer? v]) + (set! g v)) + (def/public (set-b [exact-integer? v]) + (set! b v))) + +(define add-color<%> (class->interface add-color%)) + +(define-syntaxes (-on -off -set-on! -set-off! -don -doff -d -send-get define-delta) + (let ([mk (lambda (form) + (lambda (stx) + (syntax-case stx () + [(_ fld) + (datum->syntax #'fld + (string->symbol (format form (syntax-e #'fld))) + #'fld)])))] + [mk-set (lambda (mk-id) + (lambda (stx) + (syntax-case stx () + [(_ fld val) + #`(set! #,(mk-id #'(_ fld)) val)])))]) + (values (mk "~a-on") + (mk "~a-off") + (mk-set (mk "~a-on")) + (mk-set (mk "~a-off")) + (mk "style-delta-~a-on") + (mk "style-delta-~a-off") + (mk "style-delta-~a") + (let ([mk-id (mk "get-~a")]) + (lambda (stx) + (syntax-case stx () + [(_ fld obj) + #`(send obj #,(mk-id #'(* fld)))]))) + (let ([mk-id (mk "style-delta-~a")]) + (lambda (stx) + (syntax-case stx () + [(_ fld) + #`(define #,(mk-id stx) + (class-field-accessor style-delta% fld))])))))) + +;; style-delta fields directly accessible only within this module: +(define-local-member-name + family + face + size-mult + size-add + weight-on + weight-off + style-on + style-off + smoothing-on + smoothing-off + underlined-on + underlined-off + size-in-pixels-on + size-in-pixels-off + transparent-text-backing-on + transparent-text-backing-off + foreground-mult + background-mult + foreground-add + background-add + alignment-on + alignment-off) + +(define (family-delta? s) + (or (eq? s 'base) (family-symbol? s))) +(define (style-delta? s) + (or (eq? s 'base) (style-symbol? s))) +(define (weight-delta? s) + (or (eq? s 'base) (weight-symbol? s))) +(define (smoothing-delta? s) + (or (eq? s 'base) (smoothing-symbol? s))) +(define (alignment-delta? s) + (memq s '(base top bottom center))) + +(defclass style-delta% object% + (field-properties [[family-delta? family] 'base] + [[(make-or-false string?) face] #f] + [[real? size-mult] 1.0] + [[exact-integer? size-add] 0] + [[weight-delta? weight-on] 'base] + [[weight-delta? weight-off] 'base] + [[style-delta? style-on] 'base] + [[style-delta? style-off] 'base] + [[smoothing-delta? smoothing-on] 'base] + [[smoothing-delta? smoothing-off] 'base] + [[bool? underlined-on] #f] + [[bool? underlined-off] #f] + [[bool? size-in-pixels-on] #f] + [[bool? size-in-pixels-off] #f] + [[bool? transparent-text-backing-on] #f] + [[bool? transparent-text-backing-off] #f] + [[alignment-delta? alignment-on] 'base] + [[alignment-delta? alignment-off] 'base]) + + (field [foreground-mult (new mult-color%)] + [background-mult (new mult-color%)] + [foreground-add (new add-color%)] + [background-add (new add-color%)]) + + (def/public (get-foreground-mult) foreground-mult) + (def/public (get-background-mult) background-mult) + (def/public (get-foreground-add) foreground-add) + (def/public (get-background-add) background-add) + + (send background-mult set 1.0 1.0 1.0) + (send foreground-mult set 1.0 1.0 1.0) + + (init [change-command 'change-nothing] + [param 0]) + (super-new) + (set-delta change-command param) + + (def/public (set-delta [symbol? change-command] [any? [param 0]]) + (case change-command + [(change-nothing) + (set! family 'base) + (set! face #f) + (set! size-mult 1) + (set! size-add 0) + (set! weight-on 'base) + (set! weight-off 'base) + (set! style-on 'base) + (set! style-off 'base) + (set! smoothing-on 'base) + (set! smoothing-off 'base) + (set! underlined-on #f) + (set! underlined-off #f) + (set! size-in-pixels-off #f) + (set! size-in-pixels-on #f) + (set! transparent-text-backing-off #f) + (set! transparent-text-backing-on #f) + (set! foreground-mult (new mult-color%)) + (send foreground-mult set 1 1 1) + (set! foreground-add (new add-color%)) + (set! background-mult (new mult-color%)) + (send background-mult set 1 1 1) + (set! background-add (new add-color%)) + (set! alignment-on 'base) + (set! alignment-off 'base)] + [(change-style) + (set! style-on param) + (set! style-off 'base)] + [(change-weight) + (set! weight-on param) + (set! weight-off 'base)] + [(change-smoothing) + (set! smoothing-on param) + (set! smoothing-off 'base)] + [(change-underline) + (set! underlined-on param) + (set! underlined-off (not param))] + [(change-size-in-pixels) + (set! size-in-pixels-on param) + (set! size-in-pixels-off (not param))] + [(change-size) + (set! size-mult 0) + (set! size-add param)] + [(change-family) + (set! family param) + (set! face #f)] + [(change-alignment) + (set! alignment-on param) + (set! alignment-off 'base)] + [(change-bold) + (set! weight-on 'bold) + (set! weight-off 'base)] + [(change-italic) + (set! style-on 'italic) + (set! style-off 'base)] + [(change-toggle-style) + (set! style-on param) + (set! style-off param)] + [(change-toggle-weight) + (set! weight-on param) + (set! weight-off param)] + [(change-toggle-smoothing) + (set! smoothing-on param) + (set! smoothing-off param)] + [(change-toggle-underline) + (set! underlined-on #t) + (set! underlined-off #t)] + [(change-toggle-size-in-pixels) + (set! size-in-pixels-on #t) + (set! size-in-pixels-off #t)] + [(change-bigger) + (set! size-mult 1) + (set! size-add param)] + [(change-smaller) + (set! size-mult 1) + (set! size-add (- param))] + [(change-normal) + (set! family 'default) + (set! face #f) + (set! size-mult 0) + (set! size-add default-size) + (set! weight-on 'normal) + (set! weight-off 'base) + (set! style-on 'normal) + (set! style-off 'base) + (set! smoothing-on 'default) + (set! smoothing-off 'base) + (set! underlined-on #f) + (set! underlined-off #t) + (set! size-in-pixels-on #f) + (set! size-in-pixels-off #t) + (set! alignment-on 'bottom) + (set! alignment-off 'base) + (set-delta 'change-normal-color)] + [(change-normal-color) + (send foreground-mult set 0 0 0) + (send foreground-add set 0 0 0) + (send background-mult set 0 0 0) + (send background-add set 255 255 255)]) + this) + + (def/public (set-delta-face [string? name] [symbol? [fam 'default]]) + (set! face (and name (string->immutable-string name))) + (set! family fam) + this) + + (def/public (set-delta-background [(lambda (x) (or (string? x) (x . is-a? . color%))) col]) + (let ([col (if (string? col) + (or (send the-color-database find-color col) + black-color) + col)]) + (set! transparent-text-backing-on #f) + (set! transparent-text-backing-off #t) + (send background-mult set 0 0 0) + (send background-add set (send col red) (send col green) (send col blue)) + this)) + + (def/public (set-delta-foreground [(lambda (x) (or (string? x) (x . is-a? . color%))) col]) + (let ([col (if (string? col) + (or (send the-color-database find-color col) + black-color) + col)]) + (send foreground-mult set 0 0 0) + (send foreground-add set (send col red) (send col green) (send col blue)) + this)) + + (def/public (collapse [style-delta% delta-in]) + (define-syntax noncollapsable? + (syntax-rules () + [(_ fld base) + (not (or (and (eq? (-on fld) ((-don fld) delta-in)) (eq? (-off fld) ((-doff fld) delta-in))) + (and (eq? (-on fld) base) (eq? (-off fld) base)) + (and (eq? ((-don fld) delta-in) base) (eq? ((-doff fld) delta-in) base)) + (and (eq? (-on fld) base) (not (eq? (-off fld) base))) + (and (eq? (-off fld) base) (not (eq? (-on fld) base)))))])) + + ;; is collapsing possible? + ;; it may not be if add & multiply sequence occurs, + ;; or certain toggling settings conflict + (if (and (not (zero? size-mult)) + (not (= size-mult 1.0)) + (not (zero? (style-delta-size-add delta-in)))) + #f ; no collapse + (let-boxes ([ambr 0] [ambb 0] [ambg 0] + [amfr 0] [amfb 0] [amfg 0] + [babr 0] [babb 0] [babg 0] + [bafr 0] [bafb 0] [bafg 0]) + (begin + (send foreground-mult get amfr amfb amfg) + (send background-mult get ambr ambb ambg) + (send (style-delta-foreground-add delta-in) get bafr bafb bafg) + (send (style-delta-background-add delta-in) get babr babb babg)) + (cond + [(or (and (not (zero? amfr)) (not (= amfr 1.0)) (not (zero? bafr))) + (and (not (zero? amfg)) (not (= amfg 1.0)) (not (zero? bafg))) + (and (not (zero? amfb)) (not (= amfb 1.0)) (not (zero? bafb))) + (and (not (zero? ambr)) (not (= ambr 1.0)) (not (zero? babr))) + (and (not (zero? ambg)) (not (= ambg 1.0)) (not (zero? babg))) + (and (not (zero? ambb)) (not (= ambb 1.0)) (not (zero? babb)))) + #f] ; no collapse + ;; cases: simple or double toggle + ;; no further change + ;; formerly no change + ;; style definitely on + ;; style definitely off + [(noncollapsable? style 'base) #f] + [(noncollapsable? weight 'base) #f] + [(noncollapsable? smoothing 'base) #f] + [(noncollapsable? alignment 'base) #f] + [(noncollapsable? underlined #f) #f] + [(noncollapsable? size-in-pixels #f) #f] + [(noncollapsable? transparent-text-backing #f) #f] + [else + ;; collapsing is possible + (let-boxes ([bmbr 0] [bmbb 0] [bmbg 0] + [bmfr 0] [bmfb 0] [bmfg 0] + [aabr 0] [aabb 0] [aabg 0] + [aafr 0] [aafb 0] [aafg 0]) + (begin (send (style-delta-foreground-mult delta-in) get bmfr bmfb bmfg) + (send (style-delta-background-mult delta-in) get bmbr bmbb bmbg) + (send foreground-add get aafr aafb aafg) + (send background-add get aabr aabb aabg)) + + (set! size-add (+ size-add + (->long (* size-mult (style-delta-size-add delta-in))))) + (set! size-mult (* size-mult (style-delta-size-mult delta-in))) + + (send foreground-mult set (* amfr bmfr) (* amfb bmfb) (* amfg bmfg)) + (send background-mult set (* ambr bmbr) (* ambb bmbb) (* ambg bmbg)) + (send foreground-add set + (+ aafr (->long (* amfr bafr))) + (+ aafb (->long (* amfb bafb))) + (+ aafg (->long (* amfg bafg)))) + (send background-add set + (+ aabr (->long (* ambr babr))) + (+ aabb (->long (* ambb babb))) + (+ aabg (->long (* ambg babg)))) + + (when (eq? family 'base) + (set! family (style-delta-family delta-in)) + (when (not face) + (set! face (style-delta-face delta-in)))) + + (let-syntax ([update! + (syntax-rules () + [(_ fld base) + (cond + [(and (eq? (-on fld) base) (eq? (-off fld) base)) + (-set-on! fld ((-don fld) delta-in)) + (-set-off! fld ((-doff fld) delta-in))] + [(and (not (eq? (-on fld) base)) (not (eq? (-off fld) base))) + (when (and (eq? (-on fld) (-off fld)) + (or (not (eq? ((-don fld) delta-in) 'base)) + (not (eq? ((-doff fld) delta-in) 'base)))) + ;; double toggle + (-set-on! fld 'base) + (-set-off! fld 'base))])])]) + (update! style 'base) + (update! weight 'base) + (update! smoothing 'base) + (update! alignment 'base) + (update! underlined #f) + (update! size-in-pixels #f) + (update! transparent-text-backing #f) + + #t))])))) + + (def/public (equal [style-delta% delta-in]) + (define-syntax-rule (same? fld) + (and (eq? (-on fld) ((-don fld) delta-in)) + (eq? (-off fld) ((-doff fld) delta-in)))) + (define-syntax-rule (same-color? fld) + (let-boxes ([r1 0] [g1 0] [b1 0] + [r2 0] [g2 0] [b2 0]) + (begin + (send fld get r1 g1 b1) + (send ((-d fld) delta-in) get r2 g2 b2)) + (and (= r1 r2) (= g1 g2) (= b1 b2)))) + (and (eq? family (style-delta-family delta-in)) + (or (eq? face (style-delta-face delta-in)) + (and (string? face) + (string? (style-delta-face delta-in)) + (string=? face (style-delta-face delta-in)))) + (= size-mult (style-delta-size-mult delta-in)) + (= size-add (style-delta-size-add delta-in)) + (same? weight) + (same? style) + (same? smoothing) + (same? alignment) + (same? underlined) + (same? size-in-pixels) + (same? transparent-text-backing) + (same-color? foreground-mult) + (same-color? background-mult) + (same-color? foreground-add) + (same-color? background-add))) + + (def/public (copy [style-delta% in]) + (define-syntax-rule (DCOPY fld) + (set! fld ((-d fld) in))) + (define-syntax-rule (DCOPY/c fld) + (let-boxes ([r 0][g 0][b 0]) + (send ((-d fld) in) get r g b) + (send fld set r g b))) + (DCOPY family) + (DCOPY face) + (DCOPY size-mult) + (DCOPY size-add) + (DCOPY weight-on) + (DCOPY weight-off) + (DCOPY smoothing-on) + (DCOPY smoothing-off) + (DCOPY style-on) + (DCOPY style-off) + (DCOPY underlined-on) + (DCOPY underlined-off) + (DCOPY size-in-pixels-on) + (DCOPY size-in-pixels-off) + (DCOPY transparent-text-backing-on) + (DCOPY transparent-text-backing-off) + (DCOPY/c foreground-mult) + (DCOPY/c foreground-add) + (DCOPY/c background-mult) + (DCOPY/c background-add) + (DCOPY alignment-on) + (DCOPY alignment-off))) + +(define-delta family) +(define-delta face) +(define-delta size-mult) +(define-delta size-add) +(define-delta weight-on) +(define-delta weight-off) +(define-delta style-on) +(define-delta style-off) +(define-delta smoothing-on) +(define-delta smoothing-off) +(define-delta underlined-on) +(define-delta underlined-off) +(define-delta size-in-pixels-on) +(define-delta size-in-pixels-off) +(define-delta transparent-text-backing-on) +(define-delta transparent-text-backing-off) +(define-delta foreground-mult) +(define-delta background-mult) +(define-delta foreground-add) +(define-delta background-add) +(define-delta alignment-on) +(define-delta alignment-off) + +;; ------------------------------------------------------------ + +(define-local-member-name + s-add-child + s-remove-child + s-set-as-basic + s-update + get-s-font + get-s-pen + get-s-brush + get-s-alignment + get-s-trans-text? + get-s-foreground + get-s-background + get-s-base-style + get-s-join-shift-style + get-s-nonjoin-delta + get-s-name + set-s-font + set-s-alignment + set-s-style-list + set-s-base-style + set-s-join-shift-style + set-s-nonjoin-delta + set-s-name + set-s-cached-sizes + set-s-pen + set-s-brush + set-s-shift-style) + +(defclass style% object% + (super-new) + + (define style-list #f) ;; points back to the list owning the style + (define/public (set-s-style-list sl) (set! style-list sl)) + + (define name #f) + + (define base-style #f) + + (define join-shift-style #f) + (define nonjoin-delta #f) + + (define/public (get-s-name) name) + (define/public (set-s-name v) (set! name v)) + (define/public (get-s-base-style) base-style) + (define/public (set-s-base-style v) (set! base-style v)) + (define/public (get-s-join-shift-style) join-shift-style) + (define/public (get-s-nonjoin-delta) nonjoin-delta) + (define/public (set-s-join-shift-style v) (set! join-shift-style v)) + (define/public (set-s-nonjoin-delta v) (set! nonjoin-delta v)) + + ;; cache computation: + (define trans-text? #f) + (define foreground (new color%)) + (define background (new color%)) + (define font #f) + (define pen #f) + (define brush #f) + (define alignment 'bottom) + + (define cached-sizes 0) + (define/public (set-s-cached-sizes v) (set! cached-sizes v)) + (define text-width 0.0) + (define text-height 0.0) + (define text-descent 0.0) + (define text-space 0.0) + + (define children null) + + (define/public (s-set-as-basic slist) + (set! style-list slist) + + (set! name "basic") + (set! base-style #f) + + (set! nonjoin-delta (new style-delta%)) + (send nonjoin-delta set-delta 'change-normal) + + (set! font (send the-font-list find-or-create-font + default-size 'default 'normal 'normal)) + (send foreground set 0 0 0) + (send background set 255 255 255) + (set! pen (send the-pen-list find-or-create-pen foreground 0 'solid)) + (set! brush (send the-brush-list find-or-create-brush background 'solid)) + (set! alignment 'bottom) + (set! trans-text? #t)) + + (define/public (s-update basic target propagate? top-level? send-notify?) + (let ([base (if basic + (if (or (not style-list) + (eq? base-style (send style-list basic-style))) + basic + (begin + (send base-style s-update basic target #f #f #t) + target)) + base-style)] + [target (or target this)]) + + (if join-shift-style + + ;; join style + (when style-list + (if (not (eq? join-shift-style + (send style-list basic-style))) + (send join-shift-style s-update base target #f top-level? #t) + (begin + (send target set-s-alignment (send base get-s-alignment)) + (send target set-s-font (send base get-s-font)) + (send target set-s-pen (send base get-s-pen)) + (send target set-s-brush (send base get-s-brush)) + (send target set-s-cached-sizes 0) + (send (send target get-s-foreground) copy-from (send base get-s-foreground)) + (send (send target get-s-background) copy-from (send base get-s-background)) + + (send style-list style-was-changed target) + (when top-level? + (send style-list style-was-changed #f))))) + + ;; not a join style + (let () + (define-syntax-rule (match-field* fld default fld-src) + (let* ([v (-send-get fld fld-src)] + [match? (eq? v ((-doff fld) nonjoin-delta))] + [v (if match? default v)]) + (if (or (not match?) + (and match? + (not (eq? ((-don fld) nonjoin-delta) + ((-doff fld) nonjoin-delta))))) + (if (not (eq? ((-don fld) nonjoin-delta) 'base)) + ((-don fld) nonjoin-delta) + v) + v))) + (define-syntax-rule (match-field fld default) + (match-field* fld default (send base get-s-font))) + (define-syntax-rule (match-bool fld orig) + (cond + [(and ((-doff fld) nonjoin-delta) + ((-don fld) nonjoin-delta)) + (not orig)] + [((-doff fld) nonjoin-delta) + #f] + [((-don fld) nonjoin-delta) + #t] + [else orig])) + + (let ([size (min 255 + (max 1 + (+ (->long (* (style-delta-size-mult nonjoin-delta) + (send (send base get-s-font) get-point-size))) + (style-delta-size-add nonjoin-delta))))] + [fam+face (if (and (not (style-delta-face nonjoin-delta)) + (eq? (style-delta-family nonjoin-delta) 'base)) + (let ([font (send base get-s-font)]) + (cons (send font get-family) + (send font get-face))) + (let ([fam (style-delta-family nonjoin-delta)]) + (if (eq? fam 'base) + (cons (send (send base get-s-font) get-family) + #f) + (if (style-delta-face nonjoin-delta) + (cons fam (style-delta-face nonjoin-delta)) + (cons fam #f)))))] + [style (match-field style 'normal)] + [weight (match-field weight 'normal)] + [smoothing (match-field smoothing 'default)] + [alignment (match-field* alignment 'bottom target)] + [underlined (match-bool underlined (-send-get underlined (send base get-s-font)))] + [size-in-pixels (match-bool size-in-pixels (-send-get size-in-pixels (send base get-s-font)))]) + + (send target set-s-alignment alignment) + + (let ([font (if (cdr fam+face) + (send the-font-list + find-or-create-font + size (cdr fam+face) (car fam+face) + style weight underlined smoothing size-in-pixels) + (send the-font-list + find-or-create-font + size (car fam+face) + style weight underlined smoothing size-in-pixels))]) + (send target set-s-font font) + (send target set-s-cached-sizes 0) + + (set! trans-text? (match-bool transparent-text-backing + (send base get-s-trans-text?))) + + (let ([combine-colors! (lambda (src-col src-mul src-add dest) + (let ([r (send src-col red)] + [g (send src-col green)] + [b (send src-col blue)]) + (let-boxes ([rm 0.0] [gm 0.0] [bm 0.0] + [rp 0] [gp 0] [bp 0]) + (begin + (send src-mul get rm gm bm) + (send src-add get rp gp bp)) + (let ([->color + (lambda (v) + (max (min 255 (->long v)) 0))]) + (send dest set + (->color (+ (* r rm) rp)) + (->color (+ (* g gm) gp)) + (->color (+ (* b bm) bp)))))))]) + (combine-colors! (send base get-s-foreground) + (style-delta-foreground-mult nonjoin-delta) + (style-delta-foreground-add nonjoin-delta) + (send target get-s-foreground)) + (combine-colors! (send base get-s-background) + (style-delta-background-mult nonjoin-delta) + (style-delta-background-add nonjoin-delta) + (send target get-s-background)) + + (send target set-s-pen + (send the-pen-list find-or-create-pen foreground 0 'solid)) + (send target set-s-brush + (send the-brush-list find-or-create-brush background 'solid)) + + (when propagate? + (for-each (lambda (child) + (send child s-update #f #f #t #f #t)) + children)) + + (when send-notify? + (when style-list + (send style-list style-was-changed target) + (when top-level? + (send style-list style-was-changed #f))))))))))) + + (def/public (get-name) name) + (def/public (get-family) (send font get-family)) + (def/public (get-face) (send font get-face)) + (def/public (get-font) font) + (def/public (get-size) (send font get-point-size)) + (def/public (get-weight) (send font get-weight)) + (def/public (get-style) (send font get-style)) + (def/public (get-smoothing) (send font get-smoothing)) + (def/public (get-underlined) (send font get-underlined)) + (def/public (get-size-in-pixels) (send font get-size-in-pixels)) + (def/public (get-transparent-text-backing) trans-text?) + (def/public (get-foreground) (make-object color% foreground)) + (def/public (get-background) (make-object color% background)) + (def/public (get-alignment) alignment) + (def/public (is-join?) (and join-shift-style #t)) + + (def/public (get-delta [style-delta% d]) + (if join-shift-style + (send d set-delta 'change-nothing) + (send d copy nonjoin-delta))) + + (def/public (set-delta [style-delta% d]) + (unless (or join-shift-style + (and style-list + (eq? this (send style-list basic-style)))) + (send nonjoin-delta copy d) + (s-update #f #f #t #t #t))) + + (def/public (get-shift-style) + (or join-shift-style + (and style-list + (send style-list basic-style)) + (send the-style-list basic-style))) + + (def/public (set-shift-style [style<%> style]) + (unless (or (not join-shift-style) + (not style-list) + (not (send style-list style-to-index style)) + (send style-list check-for-loop this style)) + (when join-shift-style + (send join-shift-style s-remove-child this)) + (send style s-add-child this) + + (set! join-shift-style style) + (send style-list style-has-new-child style this) + (s-update #f #f #t #t #t) + + ;; Why twice? Was this a typo in the original code? + (set! join-shift-style style) + (s-update #f #f #t #t #t))) + + (define/public (set-s-shift-style s) + (set! join-shift-style s)) + + (def/public (get-base-style) + base-style) + + (def/public (set-base-style [(make-or-false style<%>) style]) + (when (and style-list + (not (eq? this (send style-list basic-style)))) + (let ([style (or style + (send style-list basic-style))]) + (unless (not (send style-list style-to-index style)) + (unless (send style-list check-for-loop this style) + (when base-style + (send base-style s-remove-child this)) + + (set! base-style style) + (send style s-add-child this) + + (send style-list style-has-new-child style this) + + (s-update #f #f #t #t #t)))))) + + (define/private (color->rgb c) + (values (send c red) (send c green) (send c blue))) + + (def/public (switch-to [dc<%> dc] [(make-or-false style<%>) old-style]) + (let-values ([(afr afg afb) (if old-style (color->rgb (send old-style get-s-foreground)) (values 0 0 0))] + [(bfr bfg bfb) (color->rgb foreground)] + [(abr abg abb) (if old-style (color->rgb (send old-style get-s-background)) (values 0 0 0))] + [(bbr bbg bbb) (color->rgb background)]) + (when (or (not old-style) + (not (eq? (send old-style get-s-font) font))) + (send dc set-font font)) + (when (or (not old-style) + (not (= afr bfr)) + (not (= afb bfb)) + (not (= afg bfg))) + (send dc set-text-foreground foreground)) + (when (or (not old-style) + (not (= abr bbr)) + (not (= abb bbb)) + (not (= abg bbg))) + (send dc set-text-background background)) + (when (or (not old-style) + (not (eq? (send old-style get-s-pen) pen))) + (send dc set-pen pen)) + (when (or (not old-style) + (not (eq? (send old-style get-s-trans-text?) trans-text?))) + (send dc set-text-mode (if trans-text? 'transparent 'solid))))) + + (def/public (reset-text-metrics [dc<%> dc]) + (let ([can-cache (send dc cache-font-metrics-key)]) + (unless (and (not (zero? cached-sizes)) + (eq? cached-sizes can-cache)) + (let-values ([(w h d s) (send dc get-text-extent " " font)]) + (set! text-width w) + (set! text-height h) + (set! text-descent d) + (set! text-space s) + (set! cached-sizes can-cache))))) + + (def/public (get-text-width [dc<%> dc]) + (reset-text-metrics dc) + text-width) + + (def/public (get-text-height [dc<%> dc]) + (reset-text-metrics dc) + text-height) + + (def/public (get-text-descent [dc<%> dc]) + (reset-text-metrics dc) + text-descent) + + (def/public (get-text-space [dc<%> dc]) + (reset-text-metrics dc) + text-space) + + (define/public (s-add-child c) + (set! children (cons c children))) + + (define/public (s-remove-child c) + (set! children (remq c children))) + + (define/public (get-s-font) font) + (define/public (set-s-font v) (set! font v)) + (define/public (get-s-pen) pen) + (define/public (set-s-pen v) (set! pen v)) + (define/public (get-s-brush) brush) + (define/public (set-s-brush v) (set! brush v)) + (define/public (get-s-alignment) alignment) + (define/public (set-s-alignment v) (set! alignment v)) + (define/public (get-s-trans-text?) trans-text?) + (define/public (get-s-foreground) foreground) + (define/public (get-s-background) background)) + +(define style<%> (class->interface style%)) + +;; ---------------------------------------- + +(define-local-member-name + do-named-style + check-for-loop + get-s-members) + +(define-struct notify-key (f)) + +(defclass style-list% object% + + (super-new) + + (define notifications (make-weak-hash)) + + (define basic (new style%)) + ;; note: the file-reader relies on having a new `basic' when the + ;; list is cleared: + + (send basic s-set-as-basic this) + + ;; children are before parents (reverse order used for reading + ;; and writing a style list to a stream): + (define members (list basic)) + (define member-count 1) + (define/public (get-s-members) members) + + (define (add-member s) + (set! members (cons s members)) + (set! member-count (add1 member-count))) + + (def/public (copy [style-list% other]) + (map (lambda (k) (convert k #t)) + (send other get-s-members))) + + (define/public-final (basic-style) basic) + + (def/public (find-or-create-style [(make-or-false style<%>) base-style] + [style-delta% deltain]) + (let ([base-style + (if (or (not base-style) + (not (style-to-index base-style))) + basic + base-style)]) + + ;; collapse deltas: + (let ([delta (new style-delta%)]) + (send delta copy deltain) + (let loop ([base-style base-style]) + (if (and (not (send base-style get-s-name)) + (not (send base-style get-s-join-shift-style)) + (send delta collapse (send base-style get-s-nonjoin-delta))) + (loop (send base-style get-s-base-style)) + + (or + ;; Find existing style that matches: + (for/or ([s (in-list members)]) + (and (not (send s get-s-name)) + (not (send s get-s-join-shift-style)) + (eq? (send s get-s-base-style) base-style) + (send delta equal (send s get-s-nonjoin-delta)) + s)) + + ;; Create style + (let ([s (new style%)]) + (send s set-s-style-list this) + (send s set-s-name #f) + (send s set-s-nonjoin-delta delta) + (send s set-s-base-style base-style) + (send base-style s-add-child s) + (send s s-update #f #f #f #f #f) ;; no need to propagate/notify, because we just created it + (add-member s) + s))))))) + + (def/public (find-or-create-join-style [style% base-style] + [style% shift-style]) + (let ([base-style (if (or (not base-style) + (not (style-to-index base-style))) + basic + base-style)] + [shift-style (if (or (not shift-style) + (not (style-to-index shift-style))) + basic + shift-style)]) + + (or (for/or ([s (in-list members)]) + (and (not (send s get-s-name)) + (eq? (send s get-s-base-style) base-style) + (eq? (send s get-s-join-shift-style) shift-style) + s)) + (let ([s (new style%)]) + (send s set-s-style-list this) + (send s set-s-name #f) + (send s set-s-shift-style shift-style) + (send shift-style s-add-child s) + (send s set-s-base-style base-style) + (send base-style s-add-child s) + (send s s-update #f #f #t #t #t) + (add-member s) + s)))) + + (def/public (find-named-style [string? name]) + (for/or ([s (in-list members)]) + (and (equal? name (send s get-s-name)) + s))) + + (define/public (do-named-style name plain-style replac?) + (let ([plain-style (if (or (not plain-style) + (not (style-to-index plain-style))) + basic + plain-style)] + [name (string->immutable-string name)]) + + (let ([style (for/or ([s (in-list members)]) + (and (equal? name (send s get-s-name)) + s))]) + (if (or (and style (not replac?)) + ;; can't replace basic style: + (eq? style basic)) + style + + (let ([found-style style] + [style (or style + (let ([s (new style%)]) + (send s set-s-name name) + (send s set-s-style-list this) + (send s set-s-base-style basic) + s))]) + + ;; plain-style must not depend on this style + ;; (otherwise, we'd create a dependency cycle) + (if (check-for-loop style plain-style) + style + + (begin + (let ([base (send style get-s-base-style)]) + (send base s-remove-child style)) + (let ([shift (send style get-s-join-shift-style)]) + (when shift + (send shift s-remove-child style))) + + (let ([shift (send style get-s-join-shift-style)]) + (if shift + (begin + (send style set-s-join-shift-style shift) + (send shift s-add-child style)) + (let ([delta (new style-delta%)]) + (send style set-s-nonjoin-delta delta) + (unless (eq? plain-style basic) + (send delta copy (send plain-style get-s-nonjoin-delta)))))) + + (let ([base (if (eq? plain-style basic) + basic + (send plain-style get-s-base-style))]) + (send style set-s-base-style base) + (send base s-add-child style)) + + (send style s-update #f #f #t #t #t) + + (unless found-style + (add-member style)) + + style))))))) + + (def/public (new-named-style [string? name] [style<%> plain-style]) + (do-named-style name plain-style #f)) + + (def/public (replace-named-style [string? name] [style<%> plain-style]) + (do-named-style name plain-style #t)) + + (def/public (convert [style% style] [any? [overwrite? #f]]) + (or + (and (style-to-index style) + style) + (and (send style get-s-name) + (not overwrite?) + (find-named-style (send style get-s-name))) + + (let ([base (or (let ([s (send style get-s-base-style)]) + (and s (convert s))) + (basic-style))]) + + (let ([newstyle + (let ([shift (send style get-s-join-shift-style)]) + (if shift + (find-or-create-join-style + base + (convert shift)) + (find-or-create-style base (send style get-s-nonjoin-delta))))]) + + (let ([name (send style get-s-name)]) + (if name + (if overwrite? + (replace-named-style name newstyle) + (new-named-style name newstyle)) + newstyle)))))) + + (def/public (style-was-changed [(make-or-false style%) which]) + (for ([k (in-hash-keys notifications)]) + (k which))) + + (def/public (notify-on-change [procedure? f]) + (hash-set! notifications f #t) + (make-notify-key f)) + + (def/public (forget-notification [notify-key? id]) + (hash-remove! notifications (notify-key-f id))) + + (def/public (check-for-loop [style<%> s] [style<%> p]) + (or (eq? s p) + (let ([base (send p get-s-base-style)]) + (cond + [(not base) #f] + [(send p get-s-join-shift-style) + => (lambda (j) + (or (check-for-loop s (send p get-s-base-style)) + (check-for-loop s j)))] + [else (check-for-loop s base)])))) + + (def/public (style-has-new-child [style<%> s] [style<%> c]) + ;; need to maintain the invariant that children are in the list + ;; before parents... + (let ([new-members + (let loop ([members members][insert? #f]) + (let ([m (car members)]) + (cond + [(eq? m c) (if insert? + (cons c (cons s (cdr members))) + #f)] + [(eq? m s) (loop (cdr members) #t)] + [else (let ([rest (loop (cdr members) insert?)]) + (and rest (cons m rest)))])))]) + (when new-members + (set! members new-members) + ;; May have moved parent after its own parents + (style-has-new-child (send s get-s-base-style) s) + (let ([join (send s get-s-join-style)]) + (when join + (style-has-new-child join s)))))) + + (def/public (number) member-count) + + (def/public (index-to-style [exact-nonnegative-integer? i]) + (and (i . < . member-count) + (list-ref members (- member-count i 1)))) + + (def/public (style-to-index [style<%> s]) + (let loop ([members members][i (sub1 member-count)]) + (cond + [(null? members) #f] + [(eq? (car members) s) i] + [else (loop (cdr members) (sub1 i))]))) + + + (def/public (write-to-file [editor-stream-out% f]) + (write-styles-to-file this f)) + + (define/public (map-index-to-style s i list-id) + (let loop ([sll (send s get-s-sll)]) + (cond + [(null? sll) + (error 'map-index-to-style "bad style list index for snip")] + [(= (style-list-link-list-id (car sll)) list-id) + (if (eq? (style-list-link-basic (car sll)) basic) + ;; if basic changes, that means list was cleared + (if (and (style-list-link-style-map (car sll)) + (i . < . (style-list-link-num-mapped-styles (car sll)))) + (vector-ref (style-list-link-style-map (car sll)) i) + (error 'map-index-to-style "bad style index for snip")) + basic)] + [else (loop (cdr sll))]))) + + (define/public (read-style-list f) + (read-styles-from-file (new style-list%) f 0 (box 0)))) + +(define the-style-list (new style-list%)) + +;; ---------------------------------------- + +(define-struct style-list-link (style-list + list-id + basic + num-mapped-styles + style-map)) + +(define (setup-style-reads-writes s) + (send s set-s-sll null)) + +(define (done-style-reads-writes s) + (send s set-s-sll null)) + +(define (invert ht) + (make-immutable-hasheq + (hash-map ht (lambda (k v) (cons v k))))) + +(define family-ints + #hasheq((base . -1) + (decorative . 71) + (roman . 72) + (script . 73) + (swiss . 74) + (modern . 75) + (teletype . 76) + (system . 77) + (symbol . 78) + (default . 70))) +(define int-families (invert family-ints)) + +(define (family-standard-to-this v) + (hash-ref int-families v 'default)) +(define (family-this-to-standard v) + (hash-ref family-ints v 70)) + +(define weight-ints + #hasheq((base . -1) + (light . 91) + (bold . 92) + (normal . 90))) +(define int-weights (invert weight-ints)) + +(define (weight-standard-to-this v) + (hash-ref int-weights v 'normal)) +(define (weight-this-to-standard v) + (hash-ref weight-ints v 90)) + +(define style-ints + #hasheq((base . -1) + (italic . 93) + (slant . 94) + (normal . 90))) +(define int-styles (invert style-ints)) + +(define (style-standard-to-this v) + (hash-ref int-styles v 'normal)) +(define (style-this-to-standard v) + (hash-ref style-ints v 90)) + +(define smoothing-ints + #hasheq((base . -1) + (partly-smoothed . 0) + (smoothed . 1) + (unsmoothed . 2) + (default . 3))) +(define int-smoothings (invert smoothing-ints)) + +(define (smoothing-standard-to-this v) + (hash-ref int-smoothings v 'default)) +(define (smoothing-this-to-standard v) + (hash-ref smoothing-ints v 3)) + +(define align-ints + #hasheq((base . -1) + (top . 0) + (bottom . 1) + (center . 2))) +(define int-aligns (invert align-ints)) + +(define (align-standard-to-this v) + (hash-ref int-aligns v 'bottom)) +(define (align-this-to-standard v) + (hash-ref align-ints v 1)) + +(define (read-styles-from-file style-list f overwritename? _list-id) + (let-boxes ([list-id 0]) + (send f get list-id) + (set-box! _list-id list-id) + + (or + (ormap (lambda (sll) + (and (= (style-list-link-list-id sll) list-id) + (style-list-link-style-list sll))) + (send f get-s-sll)) + + (let-boxes ([nms 0]) + (send f get nms) + + (let* ([map-vec (make-vector nms)] + [sll (make-style-list-link style-list + list-id + (send style-list basic-style) + nms + map-vec)]) + (send f set-s-sll (cons sll (send f get-s-sll))) + + (vector-set! map-vec 0 (send style-list basic-style)) + + (for ([i (in-range 1 nms)]) + (let-boxes ([base-index 0]) + (send f get base-index) + + (when (base-index . >= . i) + (error 'map-index-to-style "bad style index")) + + (let ([name (bytes->string/utf-8 (send f get-bytes))]) + (let-boxes ([is-join 0]) + (send f get is-join) + (if (positive? is-join) + (let-boxes ([shift-index 0]) + (send f get shift-index) + (when (shift-index . >= . i) + (error 'map-index-to-style "bad shift-style index")) + (let ([js + (send style-list + find-or-create-join-style + (vector-ref map-vec base-index) + (vector-ref map-vec shift-index))]) + (vector-set! map-vec i js))) + (let ([delta (new style-delta%)] + [get-float (lambda (f) + (let-boxes ([v 0.0]) + (send f get v) + v))] + [get-int (lambda (f) + (let-boxes ([v 0]) + (send f get v) + v))]) + (let-boxes ([fam 0]) + (send f get fam) + + (send delta set-family (family-standard-to-this fam)) + (let ([name (bytes->string/utf-8 (send f get-bytes))]) + (when (not (equal? name "")) + (send delta set-face (string->immutable-string name)))) + + (send delta set-size-mult (get-float f)) + (send delta set-size-add (get-int f)) + (send delta set-weight-on (weight-standard-to-this (get-int f))) + (send delta set-weight-off (weight-standard-to-this (get-int f))) + (send delta set-style-on (style-standard-to-this (get-int f))) + (send delta set-style-off (style-standard-to-this (get-int f))) + (unless (<= 1 (send f get-wxme-version) 4) + (send delta set-smoothing-on (smoothing-standard-to-this (get-int f))) + (send delta set-smoothing-off (smoothing-standard-to-this (get-int f)))) + (send delta set-underlined-on (positive? (get-int f))) + (send delta set-underlined-off (positive? (get-int f))) + (unless (<= 1 (send f get-wxme-version) 4) + (send delta set-size-in-pixels-on (positive? (get-int f))) + (send delta set-size-in-pixels-off (positive? (get-int f)))) + (unless (<= 1 (send f get-wxme-version) 2) + (send delta set-transparent-text-backing-on (positive? (get-int f))) + (send delta set-transparent-text-backing-off (positive? (get-int f)))) + + (let-boxes ([r 0.0][g 0.0][b 0.0]) + (begin (send f get r) (send f get g) (send f get b)) + (send (send delta get-foreground-mult) set r g b)) + (let-boxes ([r 0.0][g 0.0][b 0.0]) + (begin (send f get r) (send f get g) (send f get b)) + (send (send delta get-background-mult) set r g b)) + (let-boxes ([r 0][g 0][b 0]) + (begin (send f get r) (send f get g) (send f get b)) + (send (send delta get-foreground-add) set r g b)) + (let-boxes ([r 0][g 0][b 0]) + (begin (send f get r) (send f get g) (send f get b)) + (send (send delta get-background-add) set r g b) + + (when (<= 1 (send f get-wxme-version) 2) + (when (or (positive? r) (positive? g) (positive? b)) + (send delta set-transparent-text-backing-off #t)))) + + (send delta set-alignment-on (align-standard-to-this (get-int f))) + (send delta set-alignment-off (align-standard-to-this (get-int f))) + + (vector-set! map-vec i (send style-list find-or-create-style + (vector-ref map-vec base-index) + delta)))))) + + (when (not (equal? name "")) + (let ([ns + (if overwritename? + (send style-list replace-named-style name (vector-ref map-vec i)) + (send style-list new-named-style name (vector-ref map-vec i)))]) + (vector-set! map-vec i ns))))))) + style-list)))) + +(define (write-styles-to-file style-list f) + (or + (ormap (lambda (sll) + (and (eq? (style-list-link-style-list sll) style-list) + (begin + (send f put (style-list-link-list-id sll)) + #t))) + (send f get-s-sll)) + (let ([lid (send f get-s-style-count)]) + (send f set-s-style-count (add1 lid)) + + (let ([sll (make-style-list-link style-list + lid + #f + #f + #f)]) + (send f set-s-sll (cons sll (send f get-s-sll))) + + (send f put lid) + + (let ([count (send style-list number)]) + (send f put count) + + (for ([i (in-range 1 count)]) + (let ([style (send style-list index-to-style i)]) + + (send f put (send style-list style-to-index (send style get-base-style))) + + (send f put (let ([name (send style get-name)]) + (if name + (string->bytes/utf-8 name) + #""))) + + (if (send style is-join?) + (begin + (send f put 1) + (send f put (send style-list style-to-index (send style get-shift-style)))) + (let ([delta (new style-delta%)]) + (send style get-delta delta) + + (send f put 0) + + (send f put (family-this-to-standard (style-delta-family delta))) + (send f put (let ([face (style-delta-face delta)]) + (if face + (string->bytes/utf-8 face) + #""))) + + (send f put (style-delta-size-mult delta)) + (send f put (style-delta-size-add delta)) + (send f put (weight-this-to-standard (style-delta-weight-on delta))) + (send f put (weight-this-to-standard (style-delta-weight-off delta))) + (send f put (style-this-to-standard (style-delta-style-on delta))) + (send f put (style-this-to-standard (style-delta-style-off delta))) + (send f put (smoothing-this-to-standard (style-delta-smoothing-on delta))) + (send f put (smoothing-this-to-standard (style-delta-smoothing-off delta))) + (send f put (if (style-delta-underlined-on delta) 1 0)) + (send f put (if (style-delta-underlined-off delta) 1 0)) + (send f put (if (style-delta-size-in-pixels-on delta) 1 0)) + (send f put (if (style-delta-size-in-pixels-off delta) 1 0)) + (send f put (if (style-delta-transparent-text-backing-on delta) 1 0)) + (send f put (if (style-delta-transparent-text-backing-off delta) 1 0)) + + (let-boxes ([r 0.0][g 0.0][b 0.0]) + (send (style-delta-foreground-mult delta) get r g b) + (send f put r) (send f put g) (send f put b)) + (let-boxes ([r 0.0][g 0.0][b 0.0]) + (send (style-delta-background-mult delta) get r g b) + (send f put r) (send f put g) (send f put b)) + (let-boxes ([r 0][g 0][b 0]) + (send (style-delta-foreground-add delta) get r g b) + (send f put r) (send f put g) (send f put b)) + (let-boxes ([r 0][g 0][b 0]) + (send (style-delta-background-add delta) get r g b) + (send f put r) (send f put g) (send f put b)) + + (send f put (align-this-to-standard (style-delta-alignment-on delta))) + (send f put (align-this-to-standard (style-delta-alignment-off delta))))))) + + #t))))) diff --git a/collects/mred/private/wxme/text.ss b/collects/mred/private/wxme/text.ss new file mode 100644 index 0000000000..037fdfc55d --- /dev/null +++ b/collects/mred/private/wxme/text.ss @@ -0,0 +1,5482 @@ +#lang scheme/base +(require scheme/class + scheme/port + scheme/file + (for-syntax scheme/base) + "../syntax.ss" + "const.ss" + "mline.ss" + "private.ss" + "editor.ss" + "undo.ss" + "style.ss" + "snip.ss" + "snip-flags.ss" + "snip-admin.ss" + "keymap.ss" + (only-in "cycle.ss" set-text%!) + "wordbreak.ss" + "stream.ss" + "wx.ss") + +(provide text% + add-text-keymap-functions) + +;; ---------------------------------------- + +(define flash-timer% + (class timer% + (init editor) + (define for-editor editor) + (super-new) + (define/override (notify) + (send for-editor flash-off)))) + +;; ---------------------------------------- + +(define arrow (make-object cursor% 'arrow)) +(define i-beam (make-object cursor% 'ibeam)) + +(define MAX-COUNT-FOR-SNIP 500) +(define A-VERY-BIG-NUMBER 1e50) + +(define TAB-WIDTH 20.0) + +(define show-outline-for-inactive? + (and (get-preference 'MrEd:outline-inactive-selection) #t)) + +(define caret-pen (send the-pen-list find-or-create-pen "BLACK" 1 'xor)) +(define outline-pen (send the-pen-list find-or-create-pen "BLACK" 0 'transparent)) +(define outline-inactive-pen (send the-pen-list find-or-create-pen "BLACK" 1 'hilite)) +(define outline-brush (send the-brush-list find-or-create-brush "BLACK" 'hilite)) +(define xpattern #"\x88\x88\0\0\x22\x22\0\0\x88\x88\0\0\x22\x22\0\0\x88\x88\0\0\x22\x22\0\0\x88\x88\0\0\x22\x22\0\0") +(define outline-nonowner-brush (let ([b (new brush%)]) + (send b set-color "BLACK") + (send b set-stipple (make-object bitmap% xpattern 16 16)) + (send b set-style 'xor) + b)) +(define clear-brush (send the-brush-list find-or-create-brush "WHITE" 'solid)) + +(define (showcaret>= a b) + (memq a (memq b '(no-caret show-inactive-caret show-caret)))) + +(define-struct clickback (start end f call-on-down? delta hilited? unhilite) #:mutable) + +(defclass text% editor% + (inherit-field s-admin + s-offscreen + s-custom-cursor + s-custom-cursor-overrides? + s-keymap + s-own-caret? + s-style-list + s-user-locked? + s-modified? + s-noundomode + s-caret-snip + s-inactive-caret-threshold + s-filename + s-temp-filename? + s-need-on-display-size?) + (inherit on-change + on-local-event + on-local-char + scroll-editor-to + free-old-copies + install-copy-buffer + begin-copy-buffer + end-copy-buffer + do-buffer-paste + copy-ring-next + do-write-headers-footers + do-set-caret-owner + perform-undo-list + s-start-intercept + s-end-intercept + do-own-x-selection + copy-out-x-selection + add-undo-rec + set-modified + get-default-style + get-snip-data + set-snip-data + read-snips-from-file + on-paint + on-focus + default-style-name + wait-sequence-lock + begin-sequence-lock + end-sequence-lock + do-own-caret + on-edit-sequence + after-edit-sequence + on-display-size) + + (define is-locked-for-read? #f) + (define is-locked-for-flow? #f) + (define is-locked-for-write? #f) + + (define read-locked? #f) + (define flow-locked? #f) + (define write-locked? #f) + + (define hilite-on? #t) + + (define changed? #f) ;; set if on-change() needs to be called + + (define flash? #f) + (define flashautoreset? #f) + (define flashdirectoff? #f) + + (define posateol? #f) ;; display the caret at the end of a line? + (define flashposateol? #f) + (define flashscroll? #f) ;; scroll back after unflashing? + + (define graphics-invalid? #f) + (define flow-invalid? #f) + (define snip-cache-invalid? #f) + (define graphic-maybe-invalid? #f) + (define graphic-maybe-invalid-force? #f) + + (define typing-streak? #f) + (define deletion-streak? #f) + (define delayed-streak? #f) + (define vcursor-streak? #f) + (define kill-streak? #f) + (define anchor-streak? #f) + (define extend-streak? #f) + (define insert-force-streak? #f) + (define delete-force-streak? #f) + + (define keep-anchor-streak? #f) + + (define streaks-pushed? #f) + (define save-typing-streak? #f) + (define save-deletion-streak? #f) + (define save-delayed-streak? #f) + (define save-vcursor-streak? #f) + (define save-kill-streak? #f) + (define save-anchor-streak? #f) + (define save-extend-streak? #f) + + (define dragging? #f) + (define tracking? #f) + (define extra-line? #f) ;; empty line at end of file with no representative + + (define delayedscrollateol? #f) + (define delayedscrollbox? #f) + (define draw-cached-in-bitmap? #f) + (define refresh-unset? #f) + (define refresh-box-unset? #f) + (define refresh-all? #f) + + (define tab-space-in-units? #f) + (define sticky-styles? #t) + (define overwrite-mode? #f) + + (def/public (set-styles-sticky [bool? s?]) (set! sticky-styles? s?)) + (def/public (get-styles-sticky) sticky-styles?) + + (def/public (get-overwrite-mode) overwrite-mode?) + (def/public (set-overwrite-mode [bool? v]) (set! overwrite-mode? v)) + + (def/public (get-sticky-styles) sticky-styles?) + (def/public (set-sticky-styles [bool? v]) (set! sticky-styles? v)) + + (define need-x-copy? #f) + + (define caret-blinked? #f) ;; whether we want to hide an active caret or not + + (define initial-style-needed? #t) + + (define last-draw-caret 0) + (define last-draw-x-sel? #f) + + (define max-width 0.0) + (define min-width 0.0) + (define max-height 0.0) + (define min-height 0.0) + (define wrap-bitmap-width 0.0) + + (define auto-wrap-bitmap #f) + + (define delay-refresh 0) + + (define len 0) ; total length in "characters" == number of positions - 1 + + (define startpos 0) + (define endpos 0) + (define extendstartpos 0) + (define extendendpos 0) ; for extendstreak + (define vcursorloc 0.0) ; for vcursor-streak + + (define flash-timer #f) + (define flashstartpos 0) + (define flashendpos 0) + + (define snips #f) + (define last-snip #f) ; the contents of this edit session + (define snip-count 0) + + (define snip-admin (new standard-snip-admin% [editor this])) + + (define line-root-box (box #f)) + (define first-line #f) + (define last-line #f) + (define num-valid-lines 0) + + (define extra-line-h 0.0) + + (define total-height 0.0) ; total height/width in canvas units + (define total-width 0.0) + (define final-descent 0.0) ; descent of last line + (define initial-space 0.0) ; space from first line + (define initial-line-base 0.0) ; inverse descent from first line + + (define/public (get-s-last-snip) last-snip) + (define/public (get-s-total-width) total-width) + (define/public (get-s-total-height) total-height) + + (define caret-style #f) + + (define dragstart 0) + + (define track-clickback #f) + + (define refresh-start 0) + (define refresh-end 0) + (define refresh-l 0.0) + (define refresh-t 0.0) + (define refresh-r 0.0) + (define refresh-b 0.0) + + (define last-draw-l 0.0) + (define last-draw-t 0.0) + (define last-draw-r 0.0) + (define last-draw-b 0.0) + (define last-draw-red 0) + (define last-draw-green 0) + (define last-draw-blue 0) + + (define delayedscroll -1) + (define delayedscrollend 0) + (define delayedscrollbias 'none) + (define delayedscrollsnip #f) + (define delayedscroll-x 0.0) + (define delayedscroll-y 0.0) + (define delayedscroll-w 0.0) + (define delayedscroll-h 0.0) + + (define clickbacks null) + + (define file-format 'standard) + + (define between-threshold 2.0) + + (define tab-space TAB-WIDTH) ; inexact + + (define read-insert 0) + (define read-insert-start 0) + + (define prev-paste-start 0) + (define prev-paste-end 0) + (define save-prev-paste-start 0) + (define save-prev-paste-end 0) + + (define revision-count 0.0) + + (define word-break standard-wordbreak) + (define word-break-map the-editor-wordbreak-map) + + (define offscreen-key (gensym)) + + (init [(ls line-spacing) 1.0] + [tab-stops null] + [auto-wrap #f]) + + (super-new) + + (define line-spacing ls) + (define/public (get-s-line-spacing) line-spacing) + (define tabs (list->vector tab-stops)) + + (make-only-snip) + + (def/override (~) + (set! word-break-map standard-wordbreak) + (let loop ([snip snips]) + (when snip + (let ([next (snip->next snip)]) + (send snip ~) + (loop next)))) + (set! snips #f) + (set! clickbacks null)) + + (def/override (copy-self) + (let ([m (new text% [line-spacing line-spacing])]) + (copy-self-to m) + m)) + + (def/override (copy-self-to [editor<%> m]) + (when (m . is-a? . text%) + ;; copy parameters, such as tab settings: */ + (send m set-tabs (vector->list tabs) tab-space tab-space-in-units?) + (super copy-self-to m) + (when (zero? (send m last-position)) + ;; make sure only snip in m has a good style (since we called + ;; (send m->style-list copy) in copy-self-to). + (let* ([sname (default-style-name)] + [bs (send (send m get-s-style-list) find-named-style sname)]) + (set-snip-style! (send m get-s-snips) + (or bs + (send (send m get-s-style-list) basic-style))))) + + (send m set-file-format (get-file-format)) + + (send m set-wordbreak-func word-break) + (send m set-wordbreak-map (get-wordbreak-map)) + (send m set-between-threshold (get-between-threshold)) + (send m hide-caret (caret-hidden)) + (send m set-overwrite-mode (get-overwrite-mode)) + + (send m set-autowrap-bitmap auto-wrap-bitmap) + + (send m set-sticky-styles sticky-styles?))) + + ;; ---------------------------------------- + + (def/override (adjust-cursor [mouse-event% event]) + (if (not s-admin) + #f + (let-boxes ([scrollx 0.0] + [scrolly 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc scrollx scrolly)) + (if (not dc) + #f + (let ([x (+ (send event get-x) scrollx)] + [y (+ (send event get-y) scrolly)]) + (if tracking? + (or s-custom-cursor arrow) + (if (too-busy-to-refresh?) + ;; we're too busy; ask again later + (or (and s-custom-cursor-overrides? s-custom-cursor) + i-beam) + (begin + (begin-sequence-lock) + (begin0 + (or (and (not s-custom-cursor-overrides?) + (or (and s-caret-snip (send event dragging?) + (let-boxes ([x 0.0] + [y 0.0]) + (get-snip-position-and-location s-caret-snip #f x y) + (let ([c (send s-caret-snip adjust-cursor dc + (- x scrollx) (- y scrolly) + x y event)]) + c))) + ;; find snip: + (let-boxes ([onit? #f] + [how-close 0.0] + [pos 0]) + (set-box! pos (find-position x y #f onit? how-close)) + ;; FIXME: the following refinement of `onit?' seems pointless + (let ([onit? (and onit? + (not (zero? how-close)) + ((abs how-close) . > . between-threshold))]) + (let ([snip (and onit? + (find-snip pos 'after))]) + (and snip + (let-boxes ([x 0.0] [y 0.0]) + (get-snip-position-and-location snip #f x y) + (let ([c (send snip adjust-cursor dc (- x scrollx) (- y scrolly) + x y event)]) + c)))))))) + s-custom-cursor + (if (x . >= . 0) + (let ([cb? (find-clickback (find-position x y #f) y)]) + (if cb? arrow i-beam)) + i-beam)) + (end-sequence-lock)))))))))) + + (def/override (on-event [mouse-event% event]) + (when s-admin + (when (and (not (send event moving?)) + (not (send event entering?)) + (not (send event leaving?))) + (end-streaks '(except-key-sequence cursor delayed))) + (let-values ([(dc x y scrollx scrolly) + (if (or (send event button-down?) s-caret-snip) + ;; first, find clicked-on snip: + (let ([x (send event get-x)] + [y (send event get-y)]) + (let-boxes ([scrollx 0.0] + [scrolly 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc scrollx scrolly)) + ;; FIXME: old code returned if !dc + (values dc (+ x scrollx) (+ y scrolly) scrollx scrolly))) + (values #f 0.0 0.0 0.0 0.0))]) + (when (send event button-down?) + (let ([snip + (let-boxes ([onit? #f] + [how-close 0.0] + [now 0]) + (set-box! now (find-position x y #f onit? how-close)) + ;; FIXME: the following refinement of `onit?' seems pointless + (let ([onit? (and onit? + (not (zero? how-close)) + ((abs how-close) . > . between-threshold))]) + (if onit? + ;; we're in the snip's horizontal region... + (let ([snip (find-snip now 'after)]) + ;; ... but maybe the mouse is above or below it. + (let-boxes ([top 0.0] + [bottom 0.0] + [dummy 0.0]) + (begin + (get-snip-location snip dummy top #f) + (get-snip-location snip dummy bottom #t)) + (if (or (top . > . y) (y . > . bottom)) + #f + snip))) + #f)))]) + (set-caret-owner snip))) + (if (and s-caret-snip (has-flag? (snip->flags s-caret-snip) HANDLES-EVENTS)) + (let-boxes ([x 0.0] [y 0.0]) + (get-snip-position-and-location s-caret-snip #f x y) + (send s-caret-snip on-event dc (- x scrollx) (- y scrolly) x y event)) + (on-local-event event))))) + + (def/override (on-default-event [mouse-event% event]) + (when s-admin + (let-boxes ([scrollx 0.0] + [scrolly 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc scrollx scrolly)) + (let ([x (+ (send event get-x) scrollx)] + [y (+ (send event get-y) scrolly)]) + (when dc + + (let-boxes ([now 0] + [ateol? #f] + [how-close 0.0]) + (set-box! now (find-position x y ateol? #f how-close)) + (let ([now (if (and (how-close . > . 0) + (how-close . <= . between-threshold)) + (add1 now) + now)]) + (cond + [(send event button-down?) + (set! tracking? #f) + (let ([click (and (x . >= . 0) (find-clickback now y))]) + (if click + (if (clickback-call-on-down? click) + ((clickback-f click) this (clickback-start click) (clickback-end click)) + (begin + (set! tracking? #t) + (set! track-clickback click) + (when s-admin + (send s-admin update-cursor)) + (set-clickback-hilited?! track-clickback #t))) + (begin + (set! dragstart now) + (set! dragging? #t) + (when (send event get-shift-down) + (if (dragstart . > . startpos) + (set! dragstart startpos) + (set! dragstart endpos))) + (if (now . < . dragstart) + (set-position-bias-scroll 'start-only now dragstart ateol?) + (set-position-bias-scroll 'end-only dragstart now ateol?)))))] + [(send event dragging?) + (cond + [dragging? + (if (now . < . dragstart) + (when (or (not (= startpos now)) (not (= endpos dragstart))) + (set-position-bias-scroll 'start-only now dragstart ateol?)) + (when (or (not (= endpos now)) (not (= startpos dragstart))) + (set-position-bias-scroll 'end-only dragstart now ateol?)))] + [tracking? + (let ([cb (if (x . >= . 0) + (find-clickback now y) + #f)]) + (set-clickback-hilited?! track-clickback (eq? cb track-clickback)))])] + [(send event button-up?) + (cond + [dragging? + (set! dragging? #f)] + [tracking? + (set! tracking? #f) + (when (clickback-hilited? track-clickback) + (set-clickback-hilited?! track-clickback #f) + (let ([click track-clickback]) + ((clickback-f click) this (clickback-start click) (clickback-end click)))) + (when s-admin + (send s-admin update-cursor))])] + [(send event moving?) + (set! dragging? #f) + (when tracking? + (set! tracking? #f) + (when (clickback-hilited? track-clickback) + (set-clickback-hilited?! track-clickback #f) + (let ([click track-clickback]) + ((clickback-f click) this (clickback-start click) (clickback-end click))))) + (when s-admin + (send s-admin update-cursor))])))))))) + + (def/override (on-char [key-event% event]) + (when s-admin + (if (and s-caret-snip + (has-flag? (snip->flags s-caret-snip) HANDLES-EVENTS)) + (let-boxes ([scrollx 0.0] + [scrolly 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc scrollx scrolly)) + (let-boxes ([x 0.0] [y 0.0]) + (get-snip-position-and-location s-caret-snip #f x y) + (send s-caret-snip on-char dc (- x scrollx) (- y scrolly) x y event))) + (let ([code (send event get-key-code)]) + (when (and (not (eq? 'release code)) + (not (eq? 'shift code)) + (not (eq? 'control code)) + (not (eq? 'menu code)) + (not (equal? code #\nul))) + (hide-cursor)) + (on-local-char event))))) + + (def/override (on-default-char [key-event% event]) + (when s-admin + (let ([code (send event get-key-code)] + [ins (lambda (ch) + (if (and overwrite-mode? (= endpos startpos)) + (insert ch startpos (add1 startpos)) + (insert ch)))]) + (case code + [(#\backspace) (delete)] + [(#\rubout) + (if (= endpos startpos) + (when (endpos . < . len) + (delete endpos (add1 endpos))) + (delete))] + [(right left up down home end prior next) + (move-position code (send event get-shift-down))] + [(numpad0) (ins #\0)] + [(numpad1) (ins #\1)] + [(numpad2) (ins #\2)] + [(numpad3) (ins #\3)] + [(numpad4) (ins #\4)] + [(numpad5) (ins #\5)] + [(numpad6) (ins #\6)] + [(numpad7) (ins #\7)] + [(numpad8) (ins #\8)] + [(numpad9) (ins #\9)] + [(multiply) (ins #\*)] + [(divide) (ins #\/)] + [(add) (ins #\+)] + [(subtract) (ins #\-)] + [(decimal) (ins #\.)] + [(#\u3) (ins #\return)] ; NUMPAD-ENTER + [(#\return #\tab) (ins code)] + [else + (let ([vcode (if (char? code) + (char->integer code) + 0)]) + (when (and (vcode . >= . 32) + (or (vcode . <= . #xd800) + (vcode . > . #xdf00))) + (ins code)))])))) + + (def/override (own-caret [any? ownit?]) + (when (do-own-caret (and ownit? #t)) + (need-caret-refresh) + (on-focus (and ownit? #t)))) + + (def/override (blink-caret) + (if s-caret-snip + (let-boxes ([dx 0.0] + [dy 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc dx dy)) + (when dc + (let-boxes ([x 0.0] [y 0.0]) + (get-snip-location s-caret-snip x y) + (send s-caret-snip blink-caret dc (- x dx) (- y dy))))) + (if (too-busy-to-refresh?) + ;; we're busy; go away + (void) + (when (and (= endpos startpos) + (not flash?) + hilite-on?) + (set! caret-blinked? (not caret-blinked?)) + (need-caret-refresh))))) + + (def/override (size-cache-invalid) + (set! graphic-maybe-invalid? #t) + (set! graphics-invalid? #t) + (when (max-width . > . 0.0) + (set! flow-invalid? #t)) + (set! snip-cache-invalid? #t)) + + (def/override (locked-for-read?) + read-locked?) + (def/public (locked-for-flow?) + flow-locked?) + (def/override (locked-for-write?) + write-locked?) + + ;; ---------------------------------------- + + (def/public (can-insert? [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + #t) + (def/public (on-insert [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + (void)) + (def/public (after-insert [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + (void)) + + (def/public (can-delete? [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + #t) + (def/public (on-delete [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + (void)) + (def/public (after-delete [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + (void)) + + (def/public (can-change-style? [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + #t) + (def/public (on-change-style [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + (void)) + (def/public (after-change-style [exact-nonnegative-integer? start] + [exact-nonnegative-integer? len]) + (void)) + + (def/public (after-set-position) (void)) + + (def/public (can-set-size-constraint?) #t) + (def/public (on-set-size-constraint) (void)) + (def/public (after-set-size-constraint) (void)) + + (def/public (after-split-snip [exact-nonnegative-integer? pos]) (void)) + (def/public (after-merge-snips [exact-nonnegative-integer? pos]) (void)) + + ;; ---------------------------------------- + + (def/override (begin-edit-sequence [any? [undoable? #t]] [any? [interrupt-seqs? #t]]) + (wait-sequence-lock) + + (when (and (zero? delay-refresh) + (not interrupt-seqs?)) + (push-streaks)) + + (end-streaks '(delayed)) + + (when (or (positive? s-noundomode) + (not undoable?)) + (set! s-noundomode (add1 s-noundomode))) + + (if (zero? delay-refresh) + (begin + (when ALLOW-X-STYLE-SELECTION? + (set! need-x-copy? #t)) + (set! delay-refresh 1) + (on-edit-sequence)) + (set! delay-refresh (add1 delay-refresh)))) + + (def/override (end-edit-sequence) + (if (zero? delay-refresh) + (log-error "end-edit-sequence without begin-edit-sequence") + (begin + (set! delay-refresh (sub1 delay-refresh)) + (when (zero? delay-refresh) + (end-streaks null) + (pop-streaks) + (redraw) + (when ALLOW-X-STYLE-SELECTION? + (set! need-x-copy? #f)) + (after-edit-sequence)) + (when (positive? s-noundomode) + (set! s-noundomode (sub1 s-noundomode))) + (when (and (zero? delay-refresh) + s-need-on-display-size?) + (set! s-need-on-display-size? #f) + (on-display-size))))) + + (def/override (refresh-delayed?) + (or (delay-refresh . > . 0) + (not s-admin) + (send s-admin delay-refresh?))) + + (def/override (in-edit-sequence?) + (delay-refresh . > . 0)) + + (def/override (locations-computed?) + (not graphic-maybe-invalid?)) + + (def/public (recalculate) (void)) + + (def/public (get-position [maybe-box? start] [maybe-box? [end #f]]) + (when start (set-box! start startpos)) + (when end (set-box! end endpos))) + + (def/public (get-start-position) startpos) + (def/public (get-end-position) endpos) + + (def/public (set-position [exact-nonnegative-integer? start] + [(make-alts exact-nonnegative-integer? (make-literal 'same)) [end 'same]] + [any? [ateol? #f]] + [any? [scroll? #t]] + [(symbol-in default x local) [seltype 'default]]) + (do-set-position #f 'none start end ateol? scroll? seltype)) + + (def/public (set-position-bias-scroll [symbol? bias] + [exact-nonnegative-integer? start] + [(make-alts exact-nonnegative-integer? (make-literal 'same)) [end 'same]] + [any? [ateol? #f]] + [any? [scroll? #t]] + [(symbol-in default x local) [seltype 'default]]) + (do-set-position #f bias start end ateol? scroll? seltype)) + + (define/private (do-set-position setflash? bias start end ateol? scroll? seltype) + (unless flow-locked? + (when (and (not setflash?) + (or (not flash?) (not flashautoreset?) (not flashdirectoff?))) + (end-streaks '(delayed))) + + (unless (or (start . < . 0) + (and (number? end) + (start . > . end))) + (let* ([start (min start len)] + [end (if (symbol? end) + start + (min end len))] + [ateol? + (and ateol? + (= end start) + (let-values ([(snip s-pos) + (find-snip/pos start 'before)]) + (and (has-flag? (snip->flags snip) NEWLINE) + (not (has-flag? (snip->flags snip) INVISIBLE)) + (= start (+ s-pos (snip->count snip))))))]) + (let-values ([(oldstart oldend oldateol?) + (if flash? + (values flashstartpos flashendpos flashposateol?) + (values startpos endpos posateol?))]) + (when (and (not setflash?) + flash? + flashautoreset?) + (set! flash? #f) + (when flash-timer + (send flash-timer stop) + (set! flash-timer #f))) + (let* ([need-refresh? (not (and (= oldstart start) + (= oldend end) + (eq? oldateol? ateol?)))] + [changed-pos? need-refresh?]) + + (if setflash? + (begin + (set! flashstartpos start) + (set! flashendpos end) + (set! flashposateol? ateol?)) + (begin + (when ALLOW-X-STYLE-SELECTION? + (when (or (= end start) + (not (eq? editor-x-selection-allowed this)) + (eq? 'local seltype)) + (when (or (zero? delay-refresh) need-x-copy?) + (set! need-x-copy? #f) + (copy-out-x-selection)))) + + (check-merge-snips startpos) + (check-merge-snips endpos) + + (set! caret-style #f) + (set! startpos start) + (set! endpos end) + (set! posateol? ateol?))) + + (let-values ([(need-refresh? need-full-refresh?) + (let ([refresh? (and ALLOW-X-STYLE-SELECTION? + (not setflash?) + editor-x-selection-mode? + (or (and (not (eq? 'local seltype)) + (not (= start end )) + (not (eq? editor-x-selection-owner this)) + (eq? (own-x-selection #t #f seltype) 'x)) + (and (or (= start end) + (not (eq? editor-x-selection-allowed this)) + (eq? 'local seltype)) + (eq? editor-x-selection-owner this) + (own-x-selection #f #f #f))))]) + (values (or refresh? need-refresh?) + refresh?))]) + (when setflash? + (set! flash? #t)) + + (let ([need-refresh? + (or + (and scroll? + (let-values ([(scroll-start scroll-end bias) + (cond + [(eq? bias 'start-only) + (values start start 'none)] + [(eq? bias 'end-only) + (values end end 'none)] + [else + (values start end bias)])]) + (let ([was-blinked? caret-blinked?]) + (set! caret-blinked? #f) + (if (scroll-to-position/refresh scroll-start posateol? #t scroll-end bias) + #t + (begin + (set! caret-blinked? was-blinked?) + #f))))) + need-refresh?)]) + + (when need-refresh? + (set! caret-blinked? #f) + (if (or (start . >= . oldend) + (end . <= . oldstart) + need-full-refresh?) + (begin + ;; no overlap: + (need-refresh oldstart oldend) + (need-refresh start end)) + (begin + (when (start . < . oldstart) + (need-refresh start oldstart)) + (when (oldstart . < . start) + (need-refresh oldstart start)) + (when (end . < . oldend) + (need-refresh end oldend)) + (when (oldend . < . end) + (need-refresh oldend end))))))) + + (when (and changed-pos? (not setflash?)) + (after-set-position)))))))) + + (define/private (scroll-to-position/refresh start + [ateol? #f] + [refresh? #t] + [end 'same] + [bias 'none]) + (and + (not flow-locked?) + (let ([end (if (eq? end 'same) start (max start end))]) + (cond + [(positive? delay-refresh) + (when s-admin + (set! delayedscrollbox? #f) + (set! delayedscroll start) + (set! delayedscrollend end) + (set! delayedscrollateol? ateol?) + (set! delayedscrollbias bias)) + #f] + [(not (check-recalc #t #f)) + #f] + [else + (set! delayedscroll -1) + + (let-boxes ([topx 0.0] [topy 0.0] + [botx 0.0] [boty 0.0]) + (begin + (position-location start topx topy #t ateol? #t) + (position-location end botx boty #f ateol? #t)) + (let-values ([(topx botx) + (if (botx . < . topx) + ;; when the end position is to the left of the start position + (values 0 total-width) + (values topx botx))]) + (scroll-editor-to topx topy (- botx topx) (- boty topy) refresh? bias)))])))) + + (def/public (scroll-to-position [exact-nonnegative-integer? start] + [any? [ateol? #f]] + [(make-alts exact-nonnegative-integer? (make-literal 'same)) [end 'same]] + [(symbol-in start end none) [bias 'none]]) + (scroll-to-position/refresh start ateol? #t end bias)) + + (define/private (get-visible-X-range start end all? find) + (when (check-recalc #t #f) + (let-boxes ([x 0.0] [y 0.0] [w 0.0] [h 0.0]) + (if all? + (send s-admin get-max-view x y w h) + (send s-admin get-view x y w h)) + (begin + (when start + (set-box! start (find x y))) + (when end + (set-box! end (find (+ x w) (+ y h)))))))) + + (def/public (get-visible-position-range [maybe-box? start] [maybe-box? end] [any? [all? #t]]) + (get-visible-X-range start end all? (lambda (x y) (find-position x y)))) + + (def/public (get-visible-line-range [maybe-box? start] [maybe-box? end] [any? [all? #t]]) + (get-visible-X-range start end all? (lambda (x y) (find-line y)))) + + ;; ---------------------------------------- + + (def/public (move-position [(make-alts symbol? char?) code] + [any? [extend-selection? #f]] + [(symbol-in simple word page line) [kind 'simple]]) + (unless (or flow-locked? + (not (check-recalc (max-width . > . 0.0) #f #t))) + + (let-values ([(anchor?) anchor-streak?] + [(vcursor?) vcursor-streak?] + [(extendstart extendend) + (if (or extend-streak? anchor-streak?) + (values extendstartpos extendendpos) + (values startpos endpos))] + [(kas?) keep-anchor-streak?]) + + (set! keep-anchor-streak? anchor-streak?) + + (end-streaks '(delayed)) + + (let* ([extend? (or anchor? extend-selection?)] + ;; rightshrink: motion to right shrinks the selected region + [rightshrink? (and extend? (startpos . < . extendstart))] + [leftshrink? (and extend? (endpos . > . extendend))]) + (let-values ([(code kind) + (cond + [(eq? 'prior code) (values 'up 'page)] + [(eq? 'next code) (values 'down 'page)] + [else (values code kind)])]) + (cond + [(eq? 'home code) + (if leftshrink? + (set-position-bias-scroll 'start-only extendstart extendend) + (set-position-bias-scroll 'start-only 0 (if extend? extendend 0)))] + [(eq? 'end code) + (if rightshrink? + (set-position-bias-scroll 'end-only extendstart extendend) + (set-position-bias-scroll 'end-only (if extend? extendstart len) len))] + [(eq? 'left code) + (if (and (not (eq? 'line kind)) + (not (eq? 'word kind)) + (not extend?) + (not (= endpos startpos))) + (set-position startpos) + (begin + ;; pick a starting place + (let ([start + (let ([start (if leftshrink? + endpos + startpos)]) + (cond + [(eq? 'word kind) + (let-boxes ([start start]) + (find-wordbreak start #f 'caret) + start)] + [(eq? 'line kind) + (line-start-position (position-line start posateol?))] + [else (max 0 (sub1 start))]))]) + (let-values ([(start end) + (if extend? + (if leftshrink? + (let ([start (max start extendend)]) ;; collapse to original + (values startpos start)) + (values start endpos)) + (values start start))]) + (set-position-bias-scroll 'start-only start end)))))] + [(eq? 'right code) + (if (and (not (eq? 'line kind)) + (not (eq? 'word kind)) + (not extend?) + (not (= endpos startpos))) + (set-position endpos endpos #t) + (begin + ;; pick a starting place + (let ([end + (let ([end (if rightshrink? + startpos + endpos)]) + (cond + [(eq? 'word kind) + (let-boxes ([end end]) + (find-wordbreak #f end 'caret) + end)] + [(eq? 'line kind) + (line-end-position (position-line end posateol?))] + [else (add1 end)]))]) + (let-values ([(start end) + (if extend? + (if rightshrink? + (let ([end (min end extendstart)]) ;; collapse to original + (values end endpos)) + (values startpos end)) + (values end end))]) + (set-position-bias-scroll 'end-only start end #t)))))] + [(or (eq? 'up code) (eq? 'down code)) + (let ([special-scroll? (eq? 'page kind)]) ;; used when paging + (let-values ([(start end ateol? special-scroll? + scroll-left scroll-top scroll-width scroll-height + bias) + (if (eq? 'up code) + (let ([start (if leftshrink? + endpos + startpos)]) + (let-boxes ([vcl vcursorloc]) + (when (not vcursor?) + (position-location start vcl #f #t posateol? #t)) + (set! vcursorloc vcl) + (let ([cline (position-line start posateol?)]) + (let-values ([(i scroll-left scroll-top scroll-width scroll-height) + (if (eq? 'page kind) + ;; the current top line should become the next-to bottom line. + ;; the caret should go to line above current top line, but + ;; watch out for: + ;; - especially tall lines + ;; - already at top + (let-boxes ([scroll-left 0.0] [vy 0.0] + [scroll-width 0.0] [scroll-height 0.0]) + (send s-admin get-view scroll-left vy scroll-width scroll-height) + ;; top line should be completely visible as bottom line after + ;; scrolling + (let* ([top (find-scroll-line vy)] + [ty (scroll-line-location (+ top 1))] + [newtop (find-scroll-line (- ty scroll-height))] + [y (scroll-line-location newtop)] + [newtop (if (y . < . (- ty scroll-height)) + (add1 newtop) + newtop)] + [y (scroll-line-location newtop)] + ;; y is the new top location + [y (if (y . >= . vy) + ;; no or backward progess + (scroll-line-location (max 0 (sub1 top))) + y)]) + (let ([i (if (= vy y) + ;; must be at the top: + (find-line y) + (let ([i (find-line (+ y scroll-height))]) + (if ((line-location (max 0 (- i 1))) . > . y) + (sub1 i) + i)))]) + (values i scroll-left y scroll-width scroll-height)))) + (values (- cline 1) 0.0 0.0 0.0 0.0))]) + (let-boxes ([start 0] [ateol? #f]) + (if (i . >= . 0) + (set-box! start (find-position-in-line i vcursorloc ateol?)) + (begin (set-box! start 0) (set-box! ateol? #f))) + (let-values ([(start end special-scroll?) + (if extend? + (if leftshrink? + (if (start . < . extendend) + (if (and (not (eq? 'page kind)) + (start . < . extendstart)) + ;; inversion! + (values start extendend special-scroll?) + ;; Collapse to original + (values startpos extendend #f)) + (values startpos start special-scroll?)) + (values start endpos special-scroll?)) + (values start start special-scroll?))]) + (values start end ateol? special-scroll? + scroll-left scroll-top scroll-width scroll-height + (if leftshrink? 'end-only 'start-only)))))))) + ;; (eq? code 'down) + (let ([end (if rightshrink? + startpos + endpos)]) + (let-boxes ([vcl vcursorloc]) + (when (not vcursor?) + (position-location end vcl #f #t posateol? #t)) + (set! vcursorloc vcl) + (let ([cline (position-line end posateol?)]) + (let-values ([(i scroll-left scroll-top scroll-width scroll-height) + (if (eq? 'page kind) + (let-boxes ([scroll-left 0.0] [vy 0.0] + [scroll-width 0.0] [scroll-height 0.0]) + (send s-admin get-view scroll-left vy scroll-width scroll-height) + ;; last fully-visible line is the new top line + (let* ([newtop (find-scroll-line (+ vy scroll-height))] + [y (scroll-line-location (+ newtop 1))] + [newtop (if (y . > . (+ vy scroll-height)) + (sub1 newtop) + newtop)] + [y (scroll-line-location newtop)]) + ;; y is the new top location + (let-values ([(newtop y) + (if (y . <= . vy) + ;; no or backwards movement; scroll back one + (let ([newtop (+ (find-scroll-line vy) 1)]) + (values newtop (scroll-line-location newtop))) + (values newtop y))]) + ;; compute top line, for caret + (let* ([i (find-line y)] + [i (if ((line-location i #t) . < . y) + (add1 i) + i)]) + ;; Now, suppose we're scrolling down while extending the + ;; selection. We want to be able to see that we're + ;; selecting. So try moving the line `i' down one more, if + ;; there's room: + (let ([i (if ((line-location (+ i 1) #f) . < . (+ y scroll-height)) + (add1 i) + i)]) + (values i scroll-left (- y 1) scroll-width scroll-height)))))) + (values (+ cline 1) 0.0 0.0 0.0 0.0))]) + (let-values ([(end ateol?) + (if (i . <= . (sub1 num-valid-lines)) + (let-boxes ([ateol? #f] [end 0]) + (set-box! end (find-position-in-line i vcursorloc ateol?)) + (values end ateol?)) + (values len #f))]) + (let-values ([(start end special-scroll?) + (if extend? + (if rightshrink? + (if (end . > . extendstart) + (if (and (not (eq? 'page kind)) + (end . > . extendend)) + ;; inversion! + (values extendstart end special-scroll?) + ;; collapse to original + (values extendstart endpos #f)) + (values end endpos special-scroll?)) + (values startpos end special-scroll?)) + (values end end special-scroll?))]) + (values start end ateol? special-scroll? + scroll-left scroll-top scroll-width scroll-height + (if rightshrink? 'start-only 'end-only)))))))))]) + (when special-scroll? + (begin-edit-sequence)) + + ;; scroll only if !special-scroll + (set-position-bias-scroll bias start end ateol? (not special-scroll?)) + + (when special-scroll? + ;; special scrolling intructions: + (do-scroll-to #f scroll-left scroll-top scroll-width scroll-height #f 'none) + + (end-edit-sequence)) + + (set! vcursor-streak? #t)))]) + + (set! keep-anchor-streak? kas?) + (when extend? + (set! extend-streak? #t)) + + (when (or extend-streak? anchor-streak?) + (set! extendendpos extendend) + (set! extendstartpos extendstart))))))) + + (def/public (set-anchor [any? on?]) + (let ([wason? anchor-streak?]) + (set! anchor-streak? (and on? #t)) + (when (and on? (not wason?)) + (set! extendendpos endpos) + (set! extendstartpos startpos)))) + + (def/public (get-anchor) + anchor-streak?) + + ;; ---------------------------------------- + + (define/private (do-insert isnip str snipsl start end scroll-ok?) + (unless (or write-locked? + s-user-locked? + (start . < . 0)) + (let ([start (min start len)]) + ;; turn off pending style, if it doesn't apply + (when caret-style + (when (or (not (equal? end start)) (not (= startpos start))) + (set! caret-style #f))) + (let ([deleted? (and (not (eq? end 'same)) + (start . < . end) + (begin + (when ALLOW-X-STYLE-SELECTION? + (when (zero? delay-refresh) + (set! need-x-copy? #t))) + (when (or isnip str snipsl) + (begin-edit-sequence)) + (delete start end scroll-ok?) + (when ALLOW-X-STYLE-SELECTION? + (when (zero? delay-refresh) + (set! need-x-copy? #f))) + #t))]) + (when (or isnip str snipsl) + (set! write-locked? #t) + (let ([success-finish + (lambda (addlen inserted-line?) + (set! initial-style-needed? #f) + (set! revision-count (add1 revision-count)) + + (adjust-clickbacks start start addlen #f) + + (unless s-modified? + (add-undo-rec (make-object unmodify-record% delayed-streak?))) + (unless (positive? s-noundomode) + (add-undo-rec + (make-object insert-record% + start addlen + (or deleted? typing-streak? delayed-streak? + insert-force-streak? + (not s-modified?)) + startpos endpos))) + (when (positive? delay-refresh) + (set! delayed-streak? #t)) + + (let ([scroll? (= start startpos)]) + + (when (startpos . >= . start) + (set! startpos (+ startpos addlen))) + (when (endpos . >= . start) + (set! endpos (+ endpos addlen))) + (unless refresh-unset? + (when (refresh-start . >= . start) + (set! refresh-start (+ refresh-start addlen))) + (when (refresh-end . >= . start) + (set! refresh-end (+ refresh-end addlen)))) + + (set! extra-line? (has-flag? (snip->flags last-snip) NEWLINE)) + + (set! write-locked? #f) + (set! flow-locked? #f) + + (when scroll? + (set! caret-blinked? #f)) + + (when (and scroll? scroll-ok?) + (set! delay-refresh (add1 delay-refresh)) + (scroll-to-position/refresh startpos) + (set! delay-refresh (sub1 delay-refresh))) + + (set! changed? #t) + + (set! caret-style #f) + + (if inserted-line? + (begin + (set! graphic-maybe-invalid? #t) + (need-refresh start)) + (refresh-by-line-demand)) + + (when deleted? + (end-edit-sequence)) + + (unless s-modified? + (set-modified #t)) + + (after-insert start addlen)))] + [fail-finish + (lambda () + (set! write-locked? #f) + (set! flow-locked? #f) + (when deleted? + (end-edit-sequence)))]) + (cond + [(or isnip snipsl) + (insert-snips (if isnip (list isnip) snipsl) start success-finish fail-finish)] + [else (insert-string str start success-finish fail-finish)]))))))) + + (define/private (insert-snips snipsl start success-finish fail-finish) + (let ([addlen (for/fold ([addlen 0]) + ([isnip (in-list snipsl)] + #:when addlen) + (let ([c (snip->count isnip)]) + (and (positive? c) + (not (send isnip is-owned?)) + (+ addlen c))))]) + + (if (or (not addlen) + (zero? addlen) + (not (can-insert? start addlen))) + (fail-finish) + (begin + (on-insert start addlen) + + (set! flow-locked? #t) + + ;; make sure on-insert didn't do something bad to the snips: + (if (not (for/and ([isnip (in-list snipsl)]) + (and (positive? (snip->count isnip)) + (not (send isnip is-owned?))))) + + (fail-finish) + + (let loop ([did-one? #f] + [before-snip #f] + [inserted-line? #f] + [snipsl snipsl]) + + (if (null? snipsl) + (success-finish addlen inserted-line?) + (let ([isnip (car snipsl)]) + (when (and (has-flag? (snip->flags isnip) NEWLINE) + (not (has-flag? (snip->flags isnip) HARD-NEWLINE))) + (set-snip-flags! isnip (remove-flag (snip->flags isnip) NEWLINE))) + + (let-values ([(before-snip inserted-new-line?) + (if (and (zero? len) (not did-one?)) + + ;; special case: ignore the empty snip + (begin + (set! snips isnip) + (set! last-snip isnip) + (let ([line-root (create-mline)]) + (set-box! line-root-box line-root) + (set-snip-line! isnip line-root) + (set-mline-snip! line-root isnip) + (set-mline-last-snip! line-root isnip) + (when (max-width . > . 0) + (mline-mark-check-flow line-root))) + (values before-snip #f)) + + (let* ([gsnip (if (not did-one?) + (begin + (make-snipset start start) + (find-snip start 'after-or-none)) + before-snip)] + [before-snip (or before-snip gsnip)] + [inserted-new-line? + (if (not gsnip) + (begin + (append-snip isnip) + (let ([gsnip (mline-last-snip last-line)]) + (if (and gsnip (has-flag? (snip->flags gsnip) HARD-NEWLINE)) + (let ([line (mline-insert last-line line-root-box #f)]) + (set-snip-line! isnip line) + (set-mline-snip! line isnip) + (set-mline-last-snip! line isnip) + (set! num-valid-lines (add1 num-valid-lines)) + #t) + (begin + (set-snip-line! isnip last-line) + (when (not (mline-snip last-line)) + (set-mline-snip! last-line isnip)) + (set-mline-last-snip! last-line isnip) + ;; maybe added extra ghost line: + (has-flag? (snip->flags isnip) HARD-NEWLINE))))) + (begin + (insert-snip gsnip isnip) + (if (has-flag? (snip->flags isnip) HARD-NEWLINE) + (let* ([gline (snip->line gsnip)] + [line (mline-insert gline line-root-box #t)]) + (set-snip-line! isnip line) + (set! num-valid-lines (add1 num-valid-lines)) + (if (eq? gsnip (mline-snip gline)) + (set-mline-snip! line isnip) + (set-mline-snip! line (mline-snip gline))) + (set-mline-last-snip! line isnip) + (set-mline-snip! gline gsnip) + + (let loop ([c-snip (mline-snip line)]) + (unless (eq? c-snip isnip) + (set-snip-line! c-snip line) + (loop (snip->next c-snip)))) + + (mline-calc-line-length gline) + (mline-mark-recalculate gline) + #t) + (let ([gline (snip->line gsnip)]) + (set-snip-line! isnip gline) + (when (eq? (mline-snip gline) gsnip) + (set-mline-snip! gline isnip)) + #f))))]) + + (when (max-width . > . 0) + (mline-mark-check-flow (snip->line isnip)) + (let ([prev (snip->prev isnip)]) + (when (and prev + (not (has-flag? (snip->flags isnip) NEWLINE))) + (mline-mark-check-flow (snip->line prev)))) + (let ([next (mline-next (snip->line isnip))]) + (when (and next + (has-flag? (snip->flags isnip) HARD-NEWLINE)) + (mline-mark-check-flow next)))) + + (values before-snip inserted-new-line?)))]) + + (set-snip-style! isnip (send s-style-list convert (or (snip->style isnip) + (send s-style-list basic-style)))) + + (send isnip size-cache-invalid) + + (mline-calc-line-length (snip->line isnip)) + (mline-mark-recalculate (snip->line isnip)) + + (set! len (+ len (snip->count isnip))) + + (snip-set-admin isnip snip-admin) + + (set! first-line (mline-first (unbox line-root-box))) + (set! last-line (mline-last (unbox line-root-box))) + + (loop #t + before-snip + (or inserted-line? inserted-new-line?) + (cdr snipsl))))))))))) + + (define/private (insert-string str start success-finish fail-finish) + (let ([addlen (string-length str)]) + (if (not (can-insert? start addlen)) + (fail-finish) + (begin + (on-insert start addlen) + + (set! flow-locked? #t) + + (let-values ([(snip s-pos inserted-line?) + (if (zero? len) + + (let* ([style (if (and sticky-styles? + (not initial-style-needed?)) + (snip->style snips) + (get-default-style))] + [snip (insert-text-snip start style)]) + (set! caret-style #f) + (set-mline-snip! (unbox line-root-box) snip) + (set-mline-last-snip! (unbox line-root-box) snip) + (values snip 0 #f)) + + (let-values ([(gsnip s-pos) + (if (positive? start) + (find-snip/pos start 'before) + (values #f 0))]) + (let-values ([(snip s-pos) + (if (or (not gsnip) + (and caret-style (not (eq? caret-style (snip->style gsnip)))) + (not (has-flag? (snip->flags gsnip) IS-TEXT)) + ((+ (snip->count gsnip) addlen) . > . MAX-COUNT-FOR-SNIP) + (and (not sticky-styles?) + (not (eq? (snip->style gsnip) (get-default-style))))) + + (let ([style (or caret-style + (if sticky-styles? + (if gsnip + (snip->style gsnip) + (snip->style snips)) + (get-default-style)))]) + (let ([snip (insert-text-snip start style)]) + (set! caret-style #f) + (values snip start))) + + (let ([snip gsnip]) + (if (has-flag? (snip->flags snip) CAN-APPEND) + (values snip s-pos) + (let ([style (if sticky-styles? + (snip->style snip) + (get-default-style))]) + (values (insert-text-snip start style) + start)))))]) + + (if (and gsnip + (has-flag? (snip->flags gsnip) HARD-NEWLINE) + (eq? (snip->next gsnip) snip)) + ;; preceeding snip was a newline, so the new slip belongs on the next line: + (let* ([oldline (snip->line gsnip)] + [inserted-new-line? + (if (mline-next oldline) + #f + (begin + (mline-insert oldline line-root-box #f) + (set! num-valid-lines (add1 num-valid-lines)) + (set-mline-last-snip! (mline-next oldline) snip) + #t))]) + (let ([newline (mline-next oldline)]) + (set-snip-line! snip newline) + + (set-mline-last-snip! oldline gsnip) + (set-mline-snip! newline snip) + + (mline-calc-line-length oldline) + (mline-mark-recalculate oldline) + (values snip s-pos inserted-new-line?))) + + (values snip s-pos #f)))))]) + + (let ([s (- start s-pos)]) + (set-snip-flags! snip (add-flag (snip->flags snip) CAN-SPLIT)) + (send snip insert str addlen s) + (when (has-flag? (snip->flags snip) CAN-SPLIT) + (set-snip-flags! snip (remove-flag (snip->flags snip) CAN-SPLIT))) + + (mline-calc-line-length (snip->line snip)) + (mline-mark-recalculate (snip->line snip)) + + (when (max-width . > . 0) + (mline-mark-check-flow (snip->line snip)) + (let ([prev (mline-prev (snip->line snip))]) + (when (and prev + (not (has-flag? (snip->flags (mline-last-snip prev)) HARD-NEWLINE))) + (mline-mark-check-flow prev)))) + + ;; The text is inserted, but all into one big snip. If the + ;; inserted text contains any newlines or tabs, we need to split + ;; it up to use tab snips or the HARD-NEWLINE flag: + (let loop ([snip-start-pos start] + [str (string-snip-buffer snip)] + [sp (+ s (string-snip-dtext snip))] + [i 0] + [cnt 0] + [inserted-line? inserted-line?]) + (if (= i addlen) + (begin + (set! first-line (mline-first (unbox line-root-box))) + (set! last-line (mline-last (unbox line-root-box))) + (set! len (+ len addlen)) + (unless (= (last-position) (+ (mline-get-position last-line) + (mline-len last-line))) + (error "yuck out")) + (success-finish addlen inserted-line?)) + (begin + (when (equal? (string-ref str sp) #\return) + (string-set! str sp #\newline)) + (let ([c (string-ref str sp)]) + (cond + [(or (equal? c #\newline) (equal? c #\tab)) + (let ([newline? (equal? c #\newline)]) + (make-snipset (+ i start) (+ i start 1)) + (let ([snip (find-snip (+ i start) 'after)]) + (if newline? + + ;; forced return - split the snip + (begin + (set-snip-flags! snip + (remove-flag + (add-flag (add-flag (add-flag (snip->flags snip) + NEWLINE) + HARD-NEWLINE) + INVISIBLE) + CAN-APPEND)) + (if (not (eq? snip (mline-last-snip (snip->line snip)))) + (let* ([old-line (snip->line snip)] + [line (mline-insert old-line line-root-box #t)]) + (set-snip-line! snip line) + (set! num-valid-lines (add1 num-valid-lines)) + (set-mline-last-snip! line snip) + (set-mline-snip! line (mline-snip old-line)) + + ;; retarget snips moved to new line: + (let loop ([c-snip (mline-snip old-line)]) + (unless (eq? c-snip snip) + (set-snip-line! c-snip line) + (loop (snip->next c-snip)))) + + (set-mline-snip! old-line (snip->next snip)) + + (mline-calc-line-length old-line) + (mline-mark-recalculate old-line) + (when (max-width . > . 0) + (mline-mark-check-flow old-line)) + + (mline-calc-line-length line) + (mline-mark-recalculate line) + (when (max-width . > . 0) + (mline-mark-check-flow line))) + + ;; carriage-return inserted at the end of a auto-wrapped line; + ;; line lengths stay the same, but next line now starts + ;; a paragraph + (let ([next (mline-next (snip->line snip))]) + (when next + (when (zero? (mline-starts-paragraph next)) + (mline-set-starts-paragraph next #t)))))) + + ;; convert a tab to a tab-snip% + (let ([tabsnip (let ([ts (on-new-tab-snip)]) + (if (or (send ts is-owned?) + (positive? (snip->count ts))) + ;; uh-oh + (new tab-snip%) + ts))]) + (set-snip-style! tabsnip (snip->style snip)) + (let* ([rsnip (snip-set-admin tabsnip snip-admin)] + [tabsnip (if (not (eq? rsnip tabsnip)) + ;; uh-oh + (let ([tabsnip (new tab-snip%)]) + (set-snip-style! tabsnip (snip->style snip)) + (send tabsnip set-admin snip-admin) + tabsnip) + tabsnip)]) + + (set-snip-flags! tabsnip + (add-flag (snip->flags tabsnip) CAN-SPLIT)) + (send tabsnip insert "\t" 1 0) + (when (has-flag? (snip->flags tabsnip) CAN-SPLIT) + (set-snip-flags! tabsnip + (remove-flag (snip->flags tabsnip) CAN-SPLIT))) + + (splice-snip tabsnip (snip->prev snip) (snip->next snip)) + (set-snip-line! tabsnip (snip->line snip)) + (when (eq? (mline-snip (snip->line snip)) snip) + (set-mline-snip! (snip->line tabsnip) tabsnip)) + (when (eq? (mline-last-snip (snip->line snip)) snip) + (set-mline-last-snip! (snip->line tabsnip) tabsnip)))))) + + (let ([snip (find-snip (+ i start 1) 'after)]) + (let ([i (add1 i)]) + (loop (+ i start) + (if (= i addlen) #f (string-snip-buffer snip)) + (if (= i addlen) #f (string-snip-dtext snip)) + i + 0 + (or inserted-line? newline?)))))] + + [(cnt . > . MAX-COUNT-FOR-SNIP) + ;; divide up snip, because it's too large: + (make-snipset (+ i start) (+ i start)) + (let ([snip (find-snip (+ i start) 'after)]) + (loop (+ i start) + (string-snip-buffer snip) + (add1 (string-snip-dtext snip)) + (add1 i) + 1 + inserted-line?))] + + [else + (loop start str (+ sp 1) (+ i 1) (+ cnt 1) inserted-line?)]))))))))))) + + (define/override (insert . args) + (case-args + args + [([string? str]) + (do-insert #f str #f startpos endpos #t)] + [([string? str] + [exact-nonnegative-integer? start] + [(make-alts exact-nonnegative-integer? (symbol-in same)) [end 'same]] + [any? [scroll-ok? #t]]) + (do-insert #f str #f start end scroll-ok?)] + [([exact-nonnegative-integer? len] + [string? str]) + (do-insert #f str #f startpos endpos #t)] + [([exact-nonnegative-integer? len] + [string? str] + [exact-nonnegative-integer? start] + [(make-alts exact-nonnegative-integer? (symbol-in same)) [end 'same]] + [any? [scroll-ok? #t]]) + (do-insert #f (substring str 0 len) #f start end scroll-ok?)] + [([snip% snip] + [exact-nonnegative-integer? [start startpos]] + [(make-alts exact-nonnegative-integer? (symbol-in same)) [end 'same]] + [any? [scroll-ok? #t]]) + (do-insert snip #f #f start end scroll-ok?)] + [([char? ch]) + (do-insert-char ch startpos endpos)] + [([char? ch] + [exact-nonnegative-integer? start] + [(make-alts exact-nonnegative-integer? (symbol-in same)) [end 'same]]) + (do-insert-char ch start end)] + (method-name 'text% 'insert))) + + (define/public (do-insert-snips snips pos) + (do-insert #f #f snips pos pos #t)) + + (define/private (do-insert-char ch start end) + (let ([streak? typing-streak?] + [ifs? insert-force-streak?]) + (end-streaks '(delayed)) + (set! insert-force-streak? streak?) + (do-insert #f (string ch) #f start end #t) + (set! insert-force-streak? ifs?) + (set! typing-streak? #t))) + + (define/private (do-delete start end with-undo? [scroll-ok? #t]) + (unless (or write-locked? s-user-locked?) + (let-values ([(start end set-caret-style?) + (if (eq? end 'back) + (if (zero? start) + (values 0 0 #f) + (values (sub1 start) start #t)) + (values start end (and (= start startpos) + (= end endpos))))]) + (unless (or (start . >= . end) + (start . < . 0) + (start . >= . len)) + (let ([end (min end len)]) + (when ALLOW-X-STYLE-SELECTION? + (when (and (start . <= . startpos) (end . >= . endpos)) + (when (or (zero? delay-refresh) need-x-copy?) + (set! need-x-copy? #f) + (copy-out-x-selection)))) + + (set! write-locked? #t) + + (if (not (can-delete? start (- end start))) + (begin + (set! write-locked? #f) + (set! flow-locked? #f)) + (begin + (on-delete start (- end start)) + + (set! flow-locked? #t) + + (make-snipset start end) + (set! revision-count (add1 revision-count)) + + (let* ([start-snip (find-snip start 'before-or-none)] + [end-snip (find-snip end 'before)] + [with-undo? (and with-undo? + (zero? s-noundomode))] + [rec (if with-undo? + (begin + (when (not s-modified?) + (add-undo-rec (make-object unmodify-record% delayed-streak?))) + (make-object delete-record% + start end + (or deletion-streak? delayed-streak? + delete-force-streak? (not s-modified?)) + startpos endpos)) + #f)]) + + (when (and set-caret-style? sticky-styles?) + (set! caret-style (if start-snip + (snip->style (snip->next start-snip)) + (snip->style snips)))) + + (let-values ([(deleted-line? update-cursor?) + (let loop ([snip end-snip] + [deleted-line? #f] + [update-cursor? #f]) + (if (eq? snip start-snip) + (values deleted-line? update-cursor?) + (let ([update-cursor? + (or (and (eq? snip s-caret-snip) + (begin + (send s-caret-snip own-caret #f) + (set! s-caret-snip #f) + #t)) + update-cursor?)]) + + (when with-undo? + (send rec insert-snip snip)) + + (let* ([prev (snip->prev snip)] + [deleted-another-line? + (let ([line (snip->line snip)]) + (cond + [(eq? (mline-snip line) snip) + (if (eq? (mline-last-snip line) snip) + (begin + (mline-delete line line-root-box) + (set! num-valid-lines (sub1 num-valid-lines)) + #t) + (begin + (set-mline-snip! line (snip->next snip)) + #f))] + [(eq? (mline-last-snip line) snip) + (if (mline-next line) + (begin + (set-mline-last-snip! line (mline-last-snip (mline-next line))) + (mline-delete (mline-next line) line-root-box) + (set! num-valid-lines (sub1 num-valid-lines)) + #t) + (begin + (set-mline-last-snip! line prev) + ;; maybe deleted extra ghost line: + extra-line?))] + [else #f]))]) + (delete-snip snip) + (loop prev + (or deleted-line? + deleted-another-line?) + update-cursor?)))))]) + + (when (zero? snip-count) + (make-only-snip) + (when caret-style + (set-snip-style! snips caret-style) + (set! caret-style #f))) + + (set! first-line (mline-first (unbox line-root-box))) + (set! last-line (mline-last (unbox line-root-box))) + + (let-values ([(line moved-to-next?) + (if start-snip + (if (has-flag? (snip->flags start-snip) NEWLINE) + (if (mline-next (snip->line start-snip)) + (values (mline-next (snip->line start-snip)) + #t) + (begin + (mline-mark-check-flow (snip->line start-snip)) + (values #f #f))) + (values (snip->line start-snip) #f)) + (values first-line #f))]) + + (when line + ;; fix line references from possibly moved snips: + (let ([next (snip->next (mline-last-snip line))]) + (let loop ([snip (mline-snip line)]) + (unless (eq? snip next) + (set-snip-line! snip line) + (loop (snip->next snip))))) + + (mline-calc-line-length line) + (mline-mark-recalculate line) + + (when (max-width . >= . 0) + (mline-mark-check-flow line) + (let ([prev (mline-prev line)]) + (when (and prev + (has-flag? (snip->flags (mline-last-snip prev)) HARD-NEWLINE)) + (mline-mark-check-flow prev) + (when (and moved-to-next? + deleted-line? + (mline-prev prev) + (not (has-flag? (snip->flags (mline-last-snip (mline-prev prev))) + HARD-NEWLINE))) + ;; maybe the deleted object was in the middle of a long word, + ;; and maybe now the long word can be folded into the previous + ;; line + (mline-mark-check-flow (mline-prev prev))))))) + + (adjust-clickbacks start end (- start end) rec) + + (when with-undo? + (add-undo-rec rec) + (when (positive? delay-refresh) + (set! delayed-streak? #t))) + + (let ([dellen (- end start)]) + (set! len (- len dellen)) + + (check-merge-snips start) + + (set! flow-locked? #f) + (set! write-locked? #f) + + (cond + [(and (startpos . >= . start) (startpos . <= . end)) + (set! caret-blinked? #f) + (set! startpos start)] + [(startpos . > . end) + (set! caret-blinked? #f) + (set! startpos (- startpos dellen))]) + + (cond + [(and (endpos . >= . start) (endpos . <= . end)) + (set! endpos start)] + [(endpos . > . end) + (set! endpos (- endpos dellen))]) + + (unless refresh-unset? + (cond + [(and (refresh-start . >= . start) (refresh-start . <= . end)) + (set! refresh-start start)] + [(refresh-start . >= . end) + (set! refresh-start (- refresh-start dellen))]) + (cond + [(and (refresh-end . >= . start) (refresh-end . <= . end)) + (set! refresh-end start)] + [(refresh-end . >= . end) + (set! refresh-end (- refresh-end dellen))])) + + (set! extra-line? (has-flag? (snip->flags last-snip) NEWLINE)) + + (when (and scroll-ok? (= start startpos)) + (set! delay-refresh (add1 delay-refresh)) + (scroll-to-position/refresh startpos) + (set! delay-refresh (sub1 delay-refresh))) + + (set! changed? #t) + + (unless set-caret-style? + (set! caret-style #f)) + + (when (= len start) + ;; force recheck extra line state: + (set! graphic-maybe-invalid? #t) + (set! graphic-maybe-invalid-force? #t)) + + (if deleted-line? + (begin + (set! graphic-maybe-invalid? #t) + (need-refresh start)) + (refresh-by-line-demand)) + + (unless s-modified? + (set-modified #t)) + + (after-delete start dellen) + + (when update-cursor? + (when s-admin + (send s-admin update-cursor)))))))))))))) + + (define/public (delete . args) + (case-args + args + [() + (let ([streak? (= endpos startpos)] + [dstreak? deletion-streak?] + [dfs? delete-force-streak?]) + (end-streaks '(delayed)) + (set! delete-force-streak? dstreak?) + + (delete startpos (if (= startpos endpos) 'back endpos)) + + (set! delete-force-streak? dfs?) + (set! deletion-streak? streak?))] + [([(make-alts exact-nonnegative-integer? (symbol-in start)) start] + [(make-alts exact-nonnegative-integer? (symbol-in back)) [end 'back]] + [any? [scroll-ok? #t]]) + (do-delete (if (symbol? start) startpos start) end scroll-ok?)] + (method-name 'text% 'delete))) + + (def/public (erase) + (do-delete 0 len #t)) + + (def/override (clear) + (delete startpos endpos #t)) + + ;; ---------------------------------------- + + (def/override (cut [any? [extend? #f]] [exact-integer? [time 0]] + [(make-alts exact-nonnegative-integer? (symbol-in start)) [start 'start]] + [(make-alts exact-nonnegative-integer? (symbol-in end)) [end 'end]]) + (let* ([start (if (symbol? start) + startpos + start)] + [end (if (symbol? end) + endpos + end)] + [end (min end len)]) + (unless (start . >= . end) + (copy extend? time start end) + (delete start end)))) + + (def/override (do-copy [exact-nonnegative-integer? startp] + [exact-nonnegative-integer? endp] + [exact-integer? time] + [bool? extend?]) + (let ([startp (max startp 0)] + [endp (min endp len)]) + (unless (endp . <= . startp) + + (make-snipset startp endp) + + (let ([sl (or (and extend? copy-style-list) + s-style-list)]) + (set-common-copy-region-data! (get-region-data startp endp)) + + (let ([start (find-snip startp 'after)] + [end (find-snip endp 'after-or-none)] + [wl? write-locked?] + [fl? flow-locked?]) + + (set! write-locked? #t) + (set! flow-locked? #t) + + (let loop ([snip start]) + (unless (eq? snip end) + (let ([asnip (send snip copy)]) + (snip-set-admin asnip #f) + (set-snip-style! asnip (send sl convert (snip->style asnip))) + (cons-common-copy-buffer! asnip) + (cons-common-copy-buffer2! (get-snip-data snip))) + (loop (snip->next snip)))) + + (set! write-locked? wl?) + (set! flow-locked? fl?) + + (install-copy-buffer time sl)))))) + + (def/override (copy [any? [extend? #f]] [exact-integer? [time 0]] + [(make-alts exact-nonnegative-integer? (symbol-in start)) [start 'start]] + [(make-alts exact-nonnegative-integer? (symbol-in end)) [end 'end]]) + (let* ([start (if (symbol? start) + startpos + start)] + [end (if (symbol? end) + endpos + end)] + [end (min end len)]) + (unless (start . >= . end) + (begin-copy-buffer) + (unless extend? + (free-old-copies)) + (do-copy start end time extend?) + (end-copy-buffer)))) + + (define/private (do-generic-paste cb start time) + (set! read-insert start) + (set! read-insert-start start) + (let ([orig-len len]) + (do-buffer-paste cb time #f) + (let ([delta (- len orig-len)]) + (set! prev-paste-start start) + (set! prev-paste-end (+ start delta))))) + + (define/override (do-paste start time) + (do-generic-paste the-clipboard start time)) + + (define/override (do-paste-x-selection start time) + (do-generic-paste the-x-selection-clipboard start time)) + + (define/private (generic-paste x-sel? time start end) + (let* ([end (if (symbol? end) + (if (symbol? start) + endpos + start) + end)] + [start (if (eq? start 'start) + startpos + (if (symbol? start) + endpos + start))] + [end (min end len)]) + (unless (start . > . end) + + (begin-edit-sequence) + (when (start . < . end) + (delete start end)) + + (if x-sel? + (do-paste-x-selection start time) + (do-paste start time)) + + (let ([save-prev-paste prev-paste-start]) + (end-edit-sequence) + (set! prev-paste-start save-prev-paste))))) + + (def/override (paste [exact-integer? [time 0]] + [(make-alts exact-nonnegative-integer? (symbol-in start end)) [start 'start]] + [(make-alts exact-nonnegative-integer? (symbol-in same)) [end 'same]]) + (generic-paste #f time start end)) + + (def/override (paste-x-selection [exact-integer? [time 0]] + [(make-alts exact-nonnegative-integer? (symbol-in start end)) [start 'start]] + [(make-alts exact-nonnegative-integer? (symbol-in same)) [end 'same]]) + (generic-paste #t time start end)) + + (define/override (insert-paste-snip snip data) + (let ([addpos (snip->count snip)]) + (insert snip read-insert) + (when data + (let ([snip (find-snip read-insert 'after)]) + (set-snip-data snip data))) + (set! read-insert (+ read-insert addpos)))) + + (define/public (paste-region-data data) + (set-region-data read-insert-start read-insert data)) + + (define/override (insert-paste-string str) + (let* ([str (if (eq? 'windows (system-type)) + (regexp-replace* #rx"\r\n" str "\n") + str)] + ;; change non-breaking space to space: + [str (regexp-replace* #rx"\xA0" str " ")]) + + (insert str read-insert) + (set! read-insert (+ read-insert (string-length str))))) + + (def/public (paste-next) + (unless (prev-paste-start . < . 0) + (let ([start prev-paste-start] + [end prev-paste-end]) + + (copy-ring-next) + (begin-edit-sequence) + (delete start end) + (set! read-insert start) + (set! read-insert-start start) + + (let ([orig-len len]) + (do-buffer-paste the-clipboard 0 #t) + + (end-edit-sequence) + + (let ([delta (- len orig-len)]) + + (set! prev-paste-start start) + (set! prev-paste-end (+ start delta))))))) + + (define/private (do-kill time start end) + (let ([streak? kill-streak?]) + + (begin-edit-sequence) + (let-values ([(start end) + (if (symbol? start) + (let ([newend (paragraph-end-position (position-paragraph endpos posateol?))]) + (if (= newend startpos) + (set-position startpos (+ startpos 1) #f #t 'local) + (begin + (set-position startpos newend #f #t 'local) + + (let ([text (get-text startpos endpos)]) + (let loop ([i (- endpos startpos)]) + (if (zero? i) + ;; line has all spaces: move one more + (set-position startpos (+ endpos 1) #f #t 'local) + (let ([i (sub1 i)]) + (when (char-whitespace? (string-ref text i)) + (loop i)))))))) + (values startpos endpos)) + (values start end))]) + + (cut streak? time start end) + (end-edit-sequence) + + (set! kill-streak? #t)))) + + (define/override (kill . args) + (case-args + args + [([exact-integer? [time 0]]) + (do-kill 0 'start 'end)] + [([exact-integer? time] + [exact-nonnegative-integer? start] + [exact-nonnegative-integer? end]) + (do-kill time start end)] + (method-name 'text% 'kill))) + + (def/override (select-all) + (set-position 0 len)) + + (define/override (really-can-edit? op) + (cond + [read-locked? #f] + [(and (not (eq? 'copy op)) + (or flow-locked? write-locked?)) + #f] + [else + (case op + [(clear cut copy) + (not (= endpos startpos))] + [(kill) + (not (= len endpos))] + [(select-all) + (positive? len)] + [else #t])])) + + ;; ---------------------------------------- + + (def/public (split-snip [exact-nonnegative-integer? pos]) + (unless (or flow-locked? + (pos . <= . 0) + (pos . >= . len)) + (let ([wl? write-locked?]) + + (set! write-locked? #t) + (set! flow-locked? #t) + (make-snipset pos pos) + (set! write-locked? wl?) + (set! flow-locked? #f)))) + + (def/public (get-revision-number) + revision-count) + + (def/override (get-flattened-text) + (get-text 0 'eof #t #f)) + + (def/public (get-text [exact-nonnegative-integer? [start 0]] + [(make-alts exact-nonnegative-integer? (symbol-in eof)) [end 'eof]] + [any? [flat? #f]] + [any? [force-cr? #f]]) + (if read-locked? + "" + (let* ([end (if (eq? end 'eof) + len + end)] + [start (min start len)] + [end (max end start)] + [end (min end len)] + [count (- end start)]) + (if (zero? count) + "" + (let ([wl? write-locked?] + [fl? flow-locked?] + [p (open-output-string)]) + (set! write-locked? #t) + (set! flow-locked? #t) + + (let-values ([(snip s-pos) (find-snip/pos start 'after)]) + (let loop ([snip snip] + [offset (- start s-pos)] + [count count]) + (let ([num (min (- (snip->count snip) offset) + count)]) + (if (not flat?) + (display (send-generic snip snip%-get-text offset num #f) p) + (begin + (display (send-generic snip snip%-get-text offset num #t) p) + (when (and force-cr? + (has-flag? (snip->flags snip) NEWLINE) + (not (has-flag? (snip->flags snip) HARD-NEWLINE))) + (display "\n" p)))) + (let ([count (- count num)]) + (if (zero? count) + (begin + (set! write-locked? wl?) + (set! flow-locked? fl?) + (get-output-string p)) + (loop (snip->next snip) + 0 + count))))))))))) + + (def/public (get-character [exact-nonnegative-integer? start]) + (if read-locked? + #\nul + (let-values ([(snip s-pos) (find-snip/pos (max 0 (min start len)) 'after)]) + (let ([buffer (make-string 1)]) + (send snip get-text! buffer (- start s-pos) 1 0) + (string-ref buffer 0))))) + + ;; ---------------------------------------- + + (def/public (set-clickback [exact-nonnegative-integer? start] + [exact-nonnegative-integer? end] + [procedure? f] + [(make-or-false style-delta%) [c-delta #f]] + [any? [call-on-down? #f]]) + (let ([delta (make-object style-delta%)]) + (when c-delta + (send delta copy c-delta)) + + (let ([cb (make-clickback start + end + f + call-on-down? + delta + #f + null)]) + (set! clickbacks (cons cb clickbacks))))) + + (define/public (add-back-clickback cb) + (set! clickbacks (cons cb clickbacks))) + + (def/public (remove-clickback [exact-nonnegative-integer? start] + [exact-nonnegative-integer? end]) + (set! clickbacks + (filter (lambda (cb) + (not (and (= start (clickback-start cb)) + (= end (clickback-start cb))))) + clickbacks))) + + (def/public (call-clickback [exact-nonnegative-integer? start] + [exact-nonnegative-integer? end]) + (for-each (lambda (cb) + (when (and ((clickback-start cb) . <= . start) + ((clickback-end cb) . >= . end)) + ((clickback-f cb) this (clickback-start cb) (clickback-end cb)))) + clickbacks)) + + + (define/private (adjust-clickbacks start end d rec) + (when (pair? clickbacks) + (set! clickbacks + (filter (lambda (c) + (if (and ((clickback-start c) . >= . start) + ((clickback-end c) . <= . end)) + (begin + (when rec + (send rec add-clickback c)) + #f) + #t)) + clickbacks)) + (for-each (lambda (c) + (cond + [((clickback-start c) . >= . end) + (set-clickback-start! c (+ (clickback-start c) d)) + (set-clickback-end! c (+ (clickback-end c) d))] + [(and ((clickback-start c) . <= . start) + ((clickback-end c) . >= . end)) + (when (or (d . < . 0) ((clickback-end c) . > . end)) + (set-clickback-end! c (+ (clickback-end c) d)))] + [(and ((clickback-start c) . > . start) + ((clickback-end c) . > . end)) + (set-clickback-start! c start) + (set-clickback-end! c (+ (clickback-end c) d))])) + clickbacks) + (set! clickbacks + (filter (lambda (c) + (if (= (clickback-start c) (clickback-end c)) + (when rec + (send rec add-clickback c) + #f) + #t)) + clickbacks)))) + + (define/private (find-clickback start y) + (ormap (lambda (c) + (and ((clickback-start c) . <= . start) + ((clickback-end c) . > . start) + ;; we're in the right horizontal region, but maybe the mouse + ;; is above or below the clickback + (let ([start (find-snip (clickback-start c) 'after)] + [end (find-snip (clickback-end c) 'before)]) + (and start + end + (let-boxes ([top 0.0] + [bottom 0.0]) + (begin + (get-snip-location start #f top #f) + (get-snip-location start #f bottom #t)) + (let loop ([start start] + [top top] + [bottom bottom]) + (if (eq? end start) + (and (y . >= . top) + (y . <= . bottom) + c) + (let ([start (snip->next start)]) + (let-boxes ([ntop 0.0] + [nbottom 0.0]) + (begin + (get-snip-location start #f ntop #f) + (get-snip-location start #f nbottom #t)) + (loop start + (min ntop top) + (max nbottom bottom))))))))))) + clickbacks)) + + (define/private (set-clickback-hilited c on?) + (when (not (eq? (and on? #t) + (clickback-hilited? c))) + (cond + [on? + (s-start-intercept) + + (begin-edit-sequence) + (flash-on (clickback-start c) (clickback-end c) #f #f 0) + (do-change-style (clickback-start c) (clickback-end c) #f (clickback-delta c) #f) + (end-edit-sequence) + + (set-clickback-unhilite! c (s-end-intercept))] + [else + (perform-undo-list (clickback-unhilite c)) + (set-clickback-unhilite! c null) + (flash-off)]) + (set-clickback-hilited?! (and on? #t)))) + + ;; ---------------------------------------- + + (def/public (flash-on [exact-nonnegative-integer? start] + [exact-nonnegative-integer? end] + [any? [ateol? #f]] + [any? [scroll? #t]] + [exact-nonnegative-integer? [timeout 500]]) + (do-set-position #t 'none start end ateol? scroll? 'default) + (when (timeout . > . 0) + (set! flashautoreset? #t) + (when flash-timer + (send flash-timer stop)) + (set! flash-timer (new flash-timer% [editor this])) + (send flash-timer start timeout)) + (set! flashscroll? scroll?)) + + (def/public (flash-off) + (when flash? + (set! flashautoreset? #t) + (set! flashdirectoff? #t) + (do-set-position #f 'none startpos endpos posateol? flashscroll? 'default))) + + ;; ---------------------------------------- + + (def/public (set-wordbreak-func [procedure? f]) + (set! word-break f)) + + (def/public (find-wordbreak [(make-or-false (make-box exact-nonnegative-integer?)) start] + [(make-or-false (make-box exact-nonnegative-integer?)) end] + [(symbol-in caret line selection user1 user2) reason]) + (unless read-locked? + (let ([oldstart (if start (unbox start) 0)] + [oldend (if end (unbox end) 0)]) + (word-break this start end reason) + + (when (and start ((unbox start) . > . oldstart)) + (set-box! start oldstart)) + (when (and end ((unbox end) . < . oldend)) + (set-box! end oldend))))) + + (def/public (get-wordbreak-map) + word-break-map) + + (def/public (set-wordbreak-map [(make-or-false editor-wordbreak-map%) map]) + (set! word-break-map map)) + + ;; ---------------------------------------- + + (def/public (set-line-spacing [nonnegative-real? s]) + (unless (or flow-locked? + (= line-spacing s)) + (set! line-spacing s) + (size-cache-invalid) + (set! changed? #t) + (need-refresh -1 -1))) + + (def/public (get-line-spacing) line-spacing) + + (def/override (get-max-width) + (if (max-width . <= . 0) + 'none + (+ max-width wrap-bitmap-width))) + + (def/override (get-min-width) + (if (min-width . <= . 0) + 'none + min-width)) + + (def/override (set-max-width [(make-alts nonnegative-real? (symbol-in none)) w]) + (unless flow-locked? + (let* ([w (if (eq? w 'none) 0.0 w)] + [w (if (and (positive? wrap-bitmap-width) (w . > . 0)) + (let ([w (- w wrap-bitmap-width)]) + (if (w . <= . 0.0) + (+ CURSOR-WIDTH 1) + w)) + w)]) + (unless (or (= max-width w) + (and (w . <= . 0) (max-width . <= . 0)) + (not (can-set-size-constraint?))) + (on-set-size-constraint) + + (let ([w (if (and (w . > . 0) + (w . < . (+ CURSOR-WIDTH 1))) + (+ CURSOR-WIDTH 1) + w)]) + (set! max-width w) + (set! flow-invalid? #t) + (set! graphic-maybe-invalid? #t) + (set! changed? #t) + (need-refresh -1 -1) + + (after-set-size-constraint)))))) + + (define/private (set-m-x v current setter) + (let ([v (if (eq? v 'none) 0.0 v)]) + (unless (or flow-locked? + (= current v) + (and (v . <= . 0) (current . <= . 0)) + (not (can-set-size-constraint?))) + (on-set-size-constraint) + + (set! graphic-maybe-invalid? #t) + (set! graphic-maybe-invalid-force? #t) + (setter v) + (set! changed? #t) + (need-refresh -1 -1) + + (after-set-size-constraint)))) + + (def/override (set-min-width [(make-alts nonnegative-real? (symbol-in none)) w]) + (set-m-x w min-width (lambda (w) (set! min-width w)))) + + (def/override (set-min-height [(make-alts nonnegative-real? (symbol-in none)) h]) + (set-m-x h min-height (lambda (h) (set! min-height h)))) + + (def/override (set-max-height [(make-alts nonnegative-real? (symbol-in none)) h]) + (set-m-x h max-height (lambda (h) (set! max-height h)))) + + (def/override (get-min-height) + (if (min-height . <= . 0) + 'none + min-height)) + + (def/override (get-max-height) + (if (max-height . <= . 0) + 'none + max-height)) + + ;; ---------------------------------------- + + (def/override (insert-port [input-port? f] + [(symbol-in guess same copy standard text text-force-cr) [format 'guess]] + [any? [replace-styles? #f]]) + (if (or write-locked? s-user-locked?) + 'guess ;; FIXME: docs say that this is more specific + (do-insert-file (method-name 'text% 'insert-file) f format replace-styles?))) + + (define/private (do-insert-file who f format clear-styles?) + (let ([format + (cond + [(or (eq? 'guess format) (eq? 'same format) (eq? 'copy format)) + (if (not (detect-wxme-file who f #t)) + 'text + 'standard)] + [else format])]) + + (let ([fileerr? + (cond + [(eq? 'standard format) + (if (not (detect-wxme-file who f #f)) + (error who "not a WXME file") + (let* ([b (make-object editor-stream-in-file-base% f)] + [mf (make-object editor-stream-in% b)]) + (not (and (read-editor-version mf b #f #t) + (read-editor-global-header mf) + (send mf ok?) + (read-from-file mf clear-styles?) + (read-editor-global-footer mf) + (begin + ;; if STD-STYLE wasn't loaded, re-create it: + (send s-style-list new-named-style "Standard" (send s-style-list basic-style)) + (send mf ok?))))))] + [(or (eq? format 'text) (eq? format 'text-force-cr)) + (let loop () + (let ([l (read-string 256 f)]) + (unless (eof-object? l) + (insert l) + (loop)))) + #f])]) + + (when fileerr? + (error who "error loading the file")) + + format))) + + (def/override (save-port [output-port? f] + [(symbol-in guess same copy standard text text-force-cr) [format 'same]] + [any? [show-errors? #t]]) + (when read-locked? + (error (method-name 'text% 'save-file) "editor locked for reading")) + + (let ([format + (cond + [(or (eq? 'same format) (eq? 'guess format) (eq? 'copy format)) + file-format] + [else format])]) + + (let ([fileerr? + (cond + [(or (eq? 'text format) (eq? 'text-force-cr format)) + (display (get-text 0 'eof #t (eq? format 'text-force-cr)) f) + #f] + [else + (let* ([b (make-object editor-stream-out-file-base% f)] + [mf (make-object editor-stream-out% b)]) + (not (and (write-editor-version mf b) + (write-editor-global-header mf) + (send mf ok?) + (write-to-file mf) + (write-editor-global-footer mf) + (send mf ok?))))])]) + (when fileerr? + (error (method-name 'text% 'save-port) "error writing editor content")) + #t))) + + + (define/private (do-read-from-file f start overwritestyle?) + (if write-locked? + #f + (let ([start (if (symbol? start) + startpos + start)]) + (set! read-insert start) + (let ([result (read-snips-from-file f overwritestyle?)]) + + (when (zero? len) + ;; we probably destructively changed the style list; reset the dummy snip + (set-snip-style! snips (or (get-default-style) + (send s-style-list basic-style)))) + + result)))) + + (define/override (read-from-file . args) + (case-args + args + [([editor-stream-in% f] [exact-nonnegative-integer? start] [any? [overwritestyle? #t]]) + (do-read-from-file f start overwritestyle?)] + [([editor-stream-in% f] [any? [overwritestyle? #t]]) + (do-read-from-file f 'start overwritestyle?)] + (method-name 'text% 'read-from-file))) + + (define/override (do-read-insert snip) + (if (list? snip) + (let ([oldlen len]) + (do-insert #f #f snip startpos startpos #t) + (set! read-insert (+ read-insert (- len oldlen))) + #t) + (let ([addpos (snip->count snip)]) + (do-insert snip #f #f startpos startpos #t) + (set! read-insert (+ addpos read-insert)) + #t))) + + (def/override (write-to-file [editor-stream-out% f] + [exact-nonnegative-integer? [start 0]] + [(make-alts exact-nonnegative-integer? (symbol-in eof)) [end 'eof]]) + (if read-locked? + #f + (let ([end (max (if (eq? end 'eof) + len + end) + start)]) + (let ([start-snip (if (zero? len) #f (find-snip start 'after))] + [end-snip (if (zero? len) #f (find-snip end 'after-or-none))]) + (and (do-write-headers-footers f #t) + (write-snips-to-file f s-style-list #f start-snip end-snip #f this) + (do-write-headers-footers f #f)))))) + + (def/public (get-file-format) file-format) + (def/public (set-file-format [(symbol-in standard text text-force-cr) format]) + (set! file-format format)) + + (def/override (set-filename [(make-or-false path-string?) name][any? [temp? #f]]) + (set! s-filename (if (string? name) + (string->path name) + name)) + (set! s-temp-filename? temp?) + (let ([wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + + (let loop ([snip snips]) + (when snip + (when (has-flag? (snip->flags snip) USES-BUFFER-PATH) + (send snip set-admin snip-admin)) + (loop (snip->next snip)))) + + (set! write-locked? wl?) + (set! flow-locked? fl?))) + + ;; ---------------------------------------- + + (def/public (get-region-data [exact-nonnegative-integer? start] + [exact-nonnegative-integer? end]) + #f) + + (def/public (set-region-data [exact-nonnegative-integer? start] + [exact-nonnegative-integer? end] + [editor-data% d]) + (void)) + + ;; ---------------------------------------- + + (def/public (get-tabs [maybe-box? [count #f]] + [maybe-box? [space #f]] + [maybe-box? [in-units #f]]) + (when count + (set-box! count (vector-length tabs))) + (when space + (set-box! space (if (symbol? tab-space) + #f + tab-space))) + (when in-units + (set-box! in-units tab-space-in-units?)) + + (vector->list tabs)) + + (def/public (set-tabs [(make-list real?) newtabs] + [(make-alts real? (symbol-in tab-width)) [tab-width 20]] + [any? [in-units? #t]]) + (unless flow-locked? + (set! tabs (list->vector newtabs)) + + (if (and (number? tab-width) (tab-width . >= . 1)) + (set! tab-space (exact->inexact tab-width)) + (set! tab-space TAB-WIDTH)) + + (set! tab-space-in-units? in-units?) + + (size-cache-invalid) + (set! changed? #t) + (need-refresh -1 -1))) + + ;; ---------------------------------------- + + (define/private (do-find-position-in-line internal? i x ateol?-box onit?-box how-close-box) + (when onit?-box + (set-box! onit?-box #f)) + (when ateol?-box + (set-box! ateol?-box #f)) + (when how-close-box + (set-box! how-close-box 100.0)) + + (cond + [(and (not internal?) (not (check-recalc #t #f))) + 0] + [(i . < . 0) 0] + [(i . >= . num-valid-lines) len] + [else + (let* ([line (mline-find-line (unbox line-root-box) i)] + [x (- x (mline-get-left-location line max-width))]) + (if (x . <= . 0) + (find-first-visible-position line) + (let ([p (mline-get-position line)]) + (let-values ([(snip s-pos p) + (if (x . >= . (mline-w line)) + ;; snip == the last one + (let ([snip (mline-last-snip line)]) + (values snip + (+ p (- (mline-len line) (snip->count snip))) + (+ p (mline-len line)))) + (begin + (when onit?-box + (set-box! onit?-box #t)) + + (let ([dc (send s-admin get-dc)] + [X 0] + [wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + + ;; linear seach for snip + (let ([topy (mline-get-location line)]) + (let loop ([snip (mline-snip line)] + [X X] + [x x] + [p p]) + (let-boxes ([w 0.0]) + (when dc (send snip get-extent dc X topy w #f #f #f #f #f)) + (if (and (x . > . w) (snip->next snip) dc) + (loop (snip->next snip) + (+ X w) + (- x w) + (+ p (snip->count snip))) + ;; found the right snip + (let ([s-pos p] + [p (+ p (do-find-position-in-snip dc X topy snip x how-close-box))]) + (set! write-locked? wl?) + (set! flow-locked? fl?) + (values snip s-pos p)))))))))]) + + ;; back up over invisibles + (let ([atsnipend? (- (- p s-pos) (snip->count snip))]) + (let-boxes ([p p] + [snip snip]) + (when atsnipend? + (find-last-visible-position line p snip)) + (when (and ateol?-box + atsnipend? + snip + (eq? snip (mline-last-snip line))) + (set-box! ateol?-box #t)) + p))))))])) + + (define/private (find-first-visible-position line [snip #f]) + (if read-locked? + 0 + (let* ([snip (or snip (mline-snip line))] + [startp (mline-get-position line)] + [p startp] + [next-snip (snip->next (mline-last-snip line))]) + (let loop ([snip snip] + [p p]) + (cond + [(eq? snip next-snip) + ;; if everything is invisible, then presumably the CR is forced, + ;; so go to the beginning of the line anyway + startp] + [(has-flag? (snip->flags snip) INVISIBLE) + (loop (snip->next snip) (+ p (snip->count snip)))] + [else p]))))) + + (define/private (find-last-visible-position line p-box [snip-box #f]) + (unless read-locked? + (let ([snip (or (if snip-box + (unbox snip-box) + #f) + (mline-last-snip line))] + [p (unbox p-box)]) + (let loop ([p p] + [snip snip]) + (let ([p (if (has-flag? (snip->flags snip) INVISIBLE) + (- p (snip->count snip)) + p)]) + (if (eq? snip (mline-snip line)) + (begin + (set-box! p-box p) + (when snip-box + (set-box! snip-box snip))) + (loop p (snip->prev snip)))))))) + + (def/public (find-position-in-line [exact-nonnegative-integer? i] + [real? x] + [maybe-box? [ateol? #f]] + [maybe-box? [onit? #f]] + [maybe-box? [how-close #f]]) + (do-find-position-in-line #f i x ateol? onit? how-close)) + + (define/private (do-find-position-in-snip dc X Y snip x how-close) + (cond + [read-locked? 0] + [(x . < . 0) + (when how-close + (set-box! how-close -100.0)) + 0] + [else + (let ([wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + + (let ([c (snip->count snip)]) + (if ((send snip partial-offset dc X Y c) . <= . x) + (begin + (when how-close + (set-box! how-close 100.0)) + (set! write-locked? wl?) + (set! flow-locked? fl?) + c) + + ;; binary search for position within snip: + (let loop ([range c] + [i (quotient c 2)] + [offset 0]) + (let ([dl (send snip partial-offset dc X Y (+ offset i))]) + (if (dl . > . x) + (loop i (quotient i 2) offset) + (let ([dr (send snip partial-offset dc X Y (+ offset i 1))]) + (if (dr . <= . x) + (let ([range (- range i)]) + (loop range (quotient range 2) (+ offset i))) + (begin + (when how-close + (set-box! how-close + (if ((- dr x) . < . (- x dl)) + (- dr x) + (- dl x)))) + (set! write-locked? wl?) + (set! flow-locked? fl?) + (+ i offset))))))))))])) + + (def/public (find-line [real? y] [maybe-box? [onit? #f]]) + (when onit? + (set-box! onit? #f)) + + (cond + [(not (check-recalc #t #f)) 0] + [(y . <= . 0) 0] + [(or (y . >= . total-height) (and extra-line? (y . >= . (- total-height extra-line-h)))) + (- num-valid-lines (if extra-line? 0 1))] + [else + (when onit? + (set-box! onit? #t)) + (mline-get-line (mline-find-location (unbox line-root-box) y))])) + + (def/public (find-position [real? x] [real? y] + [maybe-box? [ateol? #f]] + [maybe-box? [onit? #f]] + [maybe-box? [how-close #f]]) + (if read-locked? + 0 + (begin + (when ateol? + (set-box! ateol? #f)) + + (let* ([online (box #f)] + [i (find-line y online)]) + (if (and (i . >= . (- num-valid-lines 1)) + (not (unbox online)) + (y . > . 0)) + (begin + (when onit? + (set-box! onit? #f)) + (when how-close + (set-box! how-close 100.0)) + len) + (let ([p (find-position-in-line i x ateol? onit? how-close)]) + (when onit? + (set-box! onit? (and (unbox online) (unbox onit?)))) + p)))))) + + (def/public (position-line [exact-nonnegative-integer? start] + [any? [eol? #f]]) + (cond + [(not (check-recalc (max-width . > . 0) #f #t)) 0] + [(start . <= . 0) 0] + [(start . >= . len) + (if (and extra-line? (not eol?)) + num-valid-lines + (- num-valid-lines 1))] + [else + (let* ([line (mline-find-position (unbox line-root-box) start)] + [line (if (and eol? (= (mline-get-position line) start)) + (mline-prev line) + line)]) + (mline-get-line line))])) + + + (def/public (get-snip-position-and-location [snip% thesnip] [maybe-box? pos] + [maybe-box? [x #f]] [maybe-box? [y #f]]) + (cond + [(not (check-recalc (or x y) #f)) + #f] + [(or (not (snip->line thesnip)) + (not (eq? (mline-get-root (snip->line thesnip)) (unbox line-root-box)))) + #f] + [(or pos x y) + (let* ([line (snip->line thesnip)] + [p (mline-get-position line)]) + (let loop ([snip (mline-snip line)] + [p p]) + (if (eq? snip thesnip) + (begin + (when pos + (set-box! pos p)) + (when (or x y) + (position-location p x y)) + #t) + (loop (snip->next snip) + (+ p (snip->count snip))))))] + [else #t])) + + (def/override (get-snip-location [snip% thesnip] [maybe-box? [x #f]] [maybe-box? [y #f]] [any? [bottom-right? #f]]) + (let ([x (or x (and bottom-right? (box 0.0)))] + [y (or y (and bottom-right? (box 0.0)))]) + (if (get-snip-position-and-location thesnip #f x y) + (if bottom-right? + (let ([wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + + (let ([dc (send s-admin get-dc)]) + (let-boxes ([w 0.0] + [h 0.0]) + (send thesnip get-extent dc (unbox x) (unbox y) w h #f #f #f #f) + + (set! write-locked? wl?) + (set! flow-locked? fl?) + + (set-box! x (+ (unbox x) w)) + (set-box! y (+ (unbox y) h)) + #t))) + #t) + #f))) + + (def/public (get-snip-position [snip% thesnip]) + (let-boxes ([pos 0]) + (unless (get-snip-position-and-location thesnip pos) + (set-box! pos #f)) + pos)) + + (def/public (position-locations [exact-nonnegative-integer? start] + [maybe-box? [tx #f]] + [maybe-box? [ty #f]] + [maybe-box? [bx #f]] + [maybe-box? [by #f]] + [any? [eol? #f]] + [any? [whole-line? #f]]) + (when (check-recalc #t #f) + + ;; handle boundary cases first: + (let ([line + (cond + [(start . <= . 0) + (if whole-line? + (begin + (when (or tx bx) + (let ([xl (mline-get-left-location first-line max-width)]) + (when tx (set-box! tx xl)) + (when bx (set-box! bx xl)))) + (when (or ty by) + (let ([yl (mline-get-location first-line)]) + (when ty (set-box! ty yl)) + (when by (set-box! by (+ yl (mline-h first-line)))))) + #f) + first-line)] + [(start . >= . len) + (if (and extra-line? (not eol?)) + (begin + (when ty (set-box! ty (- total-height extra-line-h))) + (when by (set-box! by total-height)) + (when tx (set-box! tx 0)) + (when bx (set-box! bx 0)) + #f) + (if (or whole-line? (zero? len)) + (begin + (when (or tx bx) + (let ([xl (mline-get-right-location last-line max-width)]) + (when tx (set-box! tx xl)) + (when bx (set-box! bx xl)))) + (when (or ty by) + (let ([yl (mline-get-location last-line)]) + (when ty (set-box! ty yl)) + (when by (set-box! by (+ yl (mline-h last-line)))))) + #f) + last-line))] + [else + (let ([line (mline-find-line (unbox line-root-box) (position-line start eol?))]) + (if whole-line? + (begin + (when (or by ty) + (let ([yl (mline-get-location line)]) + (when ty (set-box! ty yl)) + (when by (set-box! by (+ yl (mline-h line)))))) + (if (not (or tx bx)) + #f + line)) + line))])]) + (when line + (let ([wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + + (let ([horiz (mline-get-left-location line max-width)] + [topy (mline-get-location line)] + [start (- start (mline-get-position line))]) + (let-values ([(snip horiz start dc) + (cond + [(zero? start) (values (mline-snip line) horiz start #f)] + [(start . >= . (mline-len line)) + (values (mline-last-snip line) (+ horiz (- (mline-w line) (mline-last-w line))) + start #f)] + [else + ;; linear seach for snip + (let loop ([snip (mline-snip line)] + [start start] + [horiz horiz] + [dc #f]) + (if (or (start . > . (snip->count snip)) + (and (or whole-line? (positive? start)) + (= start (snip->count snip)))) + (let* ([start (- start (snip->count snip))] + [dc (or dc (send s-admin get-dc))]) + (let-boxes ([v 1.0]) + (when dc + (send snip get-extent dc horiz topy v #f #f #f #f #f)) + (loop (snip->next snip) start (+ horiz v) dc))) + ;; found snip + (values snip horiz start dc)))])]) + (let ([dc + (if (or tx bx) + (let ([dc (or dc + (and (positive? start) + (send s-admin get-dc)))]) + (let ([xv (+ horiz + (if (and dc (positive? start)) + (send snip partial-offset dc horiz topy start) + 0))]) + (when tx (set-box! tx xv)) + (when bx (set-box! bx xv))) + dc) + dc)]) + (when (and (not whole-line?) + (or ty by)) + (let ([dc (or dc (send s-admin get-dc))]) + (let-boxes ([h 0.0] + [descent 0.0] + [space 0.0]) + (send snip get-extent dc horiz topy #f h descent space #f #F) + (let ([align (send (snip->style snip) get-alignment)]) + (cond + [(eq? 'bottom align) + (let ([yl (+ topy (mline-bottombase line) descent)]) + (when ty (set-box! ty (- yl h))) + (when by (set-box! by yl)))] + [(eq? 'top align) + (let ([yl (- (+ topy (mline-topbase line)) space)]) + (when ty (set-box! ty yl)) + (when by (set-box! by (+ yl h))))] + [else + (let* ([h (/ (- h descent space) 2)] + [yl (+ topy (/ (+ (mline-topbase line) (mline-bottombase line)) 2))]) + (when ty (set-box! ty (- yl h space))) + (when by (set-box! by (+ yl h descent))))]))))) + + (set! write-locked? wl?) + (set! flow-locked? fl?))))))))) + + (def/public (position-location [exact-nonnegative-integer? start] + [maybe-box? [x #f]] + [maybe-box? [y #f]] + [any? [top? #t]] + [any? [eol? #f]] + [any? [whole-line? #f]]) + (position-locations start + (if top? x #f) (if top? y #f) + (if top? #f x) (if top? #f y) + eol? whole-line?)) + + (def/public (line-location [exact-nonnegative-integer? i] + [any? [top? #t]]) + (cond + [(not (check-recalc #t #f)) 0.0] + [(i . < . 0) 0.0] + [(i . > . num-valid-lines) total-height] + [(= num-valid-lines i) + (if extra-line? + (- total-height extra-line-h) + total-height)] + [else + (let* ([line (mline-find-line (unbox line-root-box) i)] + [y (mline-get-location line)]) + (if top? + y + (+ y (mline-h line))))])) + + (define/private (do-line-position start? i visible-only?) + (cond + [(not (check-recalc (max-width . > . 0) #f #t)) + 0] + [(and (i . >= . num-valid-lines) extra-line?) + len] + [else (let* ([i (max 0 (min i (sub1 num-valid-lines)))] + [line (mline-find-line (unbox line-root-box) i)]) + (if start? + (if visible-only? + (find-first-visible-position line) + (mline-get-position line)) + (let ([p (+ (mline-get-position line) (mline-len line))]) + (if visible-only? + (let-boxes ([p p]) + (find-last-visible-position line p) + p) + p))))])) + + (def/public (line-start-position [exact-nonnegative-integer? i] + [any? [visible-only? #t]]) + (do-line-position #t i visible-only?)) + + (def/public (line-end-position [exact-nonnegative-integer? i] + [any? [visible-only? #t]]) + (do-line-position #f i visible-only?)) + + + (def/public (line-length [exact-nonnegative-integer? i]) + (cond + [(not (check-recalc (max-width . > . 0) #f #t)) + 0] + [(i . < . 0) 0] + [(i . >= . num-valid-lines) 0] + [else (let ([line (mline-find-line (unbox line-root-box) i)]) + (mline-len line))])) + + (def/public (position-paragraph [exact-nonnegative-integer? i] + [any? [at-eol? #f]]) + (cond + [(not (check-recalc #f #f #t)) 0] + [else (let ([delta (if (and (i . >= . len) extra-line?) + 1 + 0)] + [i (max 0 (min i len))]) + (let ([line (mline-find-position (unbox line-root-box) i)]) + (+ (mline-get-paragraph line) delta)))])) + + (def/public (paragraph-start-position [exact-nonnegative-integer? i] + [any? [visible-only? #t]]) + (if (not (check-recalc #f #f #t)) + 0 + (if (i . > . (+ (last-paragraph) (if extra-line? -1 0))) + len + (let* ([i (max 0 i)] + [l (mline-find-paragraph (unbox line-root-box) i)] + [l (if (not l) + (if extra-line? + len + (let loop ([l last-line]) + (if (and (mline-prev l) + (not (mline-starts-paragraph l))) + (loop (mline-prev l)) + l))) + l)]) + (if visible-only? + (find-first-visible-position l) + (mline-get-position l)))))) + + (def/public (paragraph-end-position [exact-nonnegative-integer? i] + [any? [visible-only? #t]]) + (if (not (check-recalc #f #f #t)) + 0 + (let* ([i (max 0 i)] + [l (mline-find-paragraph (unbox line-root-box) i)] + [l (if l + (let loop ([l l]) + (if (and (mline-next l) + (zero? (mline-starts-paragraph (mline-next l)))) + (loop (mline-next l)) + l)) + (if extra-line? + len + last-line))]) + (if (mline? l) + (let ([p (+ (mline-get-position l) (mline-len l))]) + (if visible-only? + (let-boxes ([p p]) + (find-last-visible-position l p) + p) + p)) + l)))) + + (def/public (line-paragraph [exact-nonnegative-integer? i]) + (cond + [(not (check-recalc (max-width . > . 0) #f #t)) + 0] + [(i . < . 0) 0] + [(i . >= . num-valid-lines) + (+ (mline-get-paragraph last-line) (if extra-line? 1 0))] + [else + (let ([l (mline-find-line (unbox line-root-box) i)]) + (mline-get-paragraph l))])) + + (def/public (paragraph-start-line [exact-nonnegative-integer? i]) + (if (not (check-recalc (max-width . > . 0) #f #t)) + 0 + (let* ([i (max i 0)] + [l (mline-find-paragraph (unbox line-root-box) i)]) + (if (not l) + (last-line) + (mline-get-line l))))) + + (def/public (paragraph-end-line [exact-nonnegative-integer? i]) + (if (not (check-recalc (max-width . > . 0) #f #t)) + 0 + (let* ([i (max i 0)] + [l (mline-find-paragraph (unbox line-root-box) i)]) + (mline-get-line + (if l + (let loop ([l l]) + (if (and (mline-next l) + (not (mline-starts-paragraph (mline-next l)))) + (loop (mline-next l)) + l)) + last-line))))) + + (def/public (last-position) len) + + (public [/last-line last-line]) + (define (/last-line) + (if (not (check-recalc (max-width . > . 0) #f #t)) + 0 + (- num-valid-lines (if extra-line? 0 1)))) + + (def/public (last-paragraph) + (if (not (check-recalc #f #f #t)) + 0 + (+ (mline-get-paragraph last-line) (if extra-line? 1 0)))) + + ;; ---------------------------------------- + + (def/override (get-extent [maybe-box? w] [maybe-box? h]) + (check-recalc #t #f) + (when w (set-box! w total-width)) + (when h (set-box! h total-height))) + + (def/override (get-descent) + (check-recalc #t #f) + final-descent) + + (def/override (get-space) + (check-recalc #t #f) + initial-space) + + (def/public (get-top-line-base) + (check-recalc #t #f) + initial-line-base) + + (def/override (scroll-line-location [exact-nonnegative-integer? scroll]) + (if read-locked? + 0.0 + (begin + (check-recalc #t #f) + (let ([total (+ (mline-get-scroll last-line) (mline-numscrolls last-line))]) + (cond + [(= total scroll) + (if extra-line? + (- total-height extra-line-h) + total-height)] + [(scroll . > . total) + total-height] + [else + (let* ([line (mline-find-scroll (unbox line-root-box) scroll)] + [p (mline-get-scroll line)] + [y (mline-get-location line)]) + (if (p . < . scroll) + (+ y (mline-scroll-offset line (- scroll p))) + y))]))))) + + (def/override (num-scroll-lines) + (if read-locked? + 0 + (begin + (check-recalc (max-width . > . 0) #f #t) + (+ (mline-get-scroll last-line) + (mline-numscrolls last-line) + (if extra-line? 1 0))))) + + (def/override (find-scroll-line [real? p]) + (if read-locked? + 0 + (begin + (check-recalc #t #f) + (if (and extra-line? + (p . >= . (- total-height extra-line-h))) + (- (num-scroll-lines) 1) + (let* ([line (mline-find-location (unbox line-root-box) p)] + [s (mline-get-scroll line)]) + (if ((mline-numscrolls line) . > . 1) + (let ([y (mline-get-location line)]) + (+ s (mline-find-extra-scroll line (- p y)))) + s)))))) + + ;; ---------------------------------------- + + (def/public (find-string [string? str] + [(symbol-in forward backward) [direction 'forward]] + [(make-alts exact-nonnegative-integer? (symbol-in start)) [start 'start]] + [(make-alts exact-nonnegative-integer? (symbol-in eof)) [end 'eof]] + [any? [bos? #t]] + [any? [case-sens? #t]]) + (if (not (check-recalc #f #f)) + #f + (do-find-string-all str direction start end #t bos? case-sens?))) + + (def/public (find-string-all [string? str] + [(symbol-in forward backward) [direction 'forward]] + [(make-alts exact-nonnegative-integer? (symbol-in start)) [start 'start]] + [(make-alts exact-nonnegative-integer? (symbol-in eof)) [end 'eof]] + [any? [bos? #t]] + [any? [case-sens? #t]]) + (if (not (check-recalc #f #f)) + null + (reverse (do-find-string-all str direction start end #f bos? case-sens?)))) + + (def/public (find-newline [(symbol-in forward backward) [direction 'forward]] + [(make-alts exact-nonnegative-integer? (symbol-in start)) [start 'start]] + [(make-alts exact-nonnegative-integer? (symbol-in eof)) [end 'eof]]) + (let* ([para (position-paragraph (if (symbol? start) + startpos + start) + (eq? direction 'backward))] + [pos (if (eq? direction 'backward) + (paragraph-start-position para) + (if (para . >= . (last-paragraph)) + len + (paragraph-start-position (add1 para))))] + [end (if (symbol? end) len end)]) + (if (eq? direction 'forward) + (if (pos . > . end) + #f + pos) + (if (pos . < . end) + #f + pos)))) + + (define/private (do-find-string-all str direction + start end + just-one? + bos? + case-sens?) + + (let ([start (min (if (symbol? start) + startpos + start) + len)] + [end (min (if (symbol? end) + (if (eq? direction 'forward) + len + 0) + end) + len)]) + (let ([total-count + (if (eq? direction 'backward) + (- start end) + (- end start))]) + (if (or (negative? total-count) + (string=? str "")) + (if just-one? #f null) + + (let ([slen (string-length str)] + [str (if case-sens? + str + (string-foldcase str))]) + (let-values ([(snip s-pos) (find-snip/pos start (if (eq? direction 'forward) 'after 'before))]) + + (if (not snip) + (if just-one? #f null) + + ;; Knuth-Bendix + + (let-values ([(offset shorten sbase beyond sgoal direction) + (if (eq? direction 'forward) + (values (- start s-pos) 0 0 -1 slen 1) + (values 0 (- (+ s-pos (snip->count snip)) start) (- slen 1) slen -1 -1))] + [(smap) (make-vector slen 0)]) + + ;; initialize smap: + (vector-set! smap sbase beyond) + (let loop ([s beyond] + [i (+ sbase direction)]) + (unless (= i sgoal) + (let iloop ([s s]) + (if (and (not (= beyond s)) + (not (char=? (string-ref str (+ s direction)) (string-ref str i)))) + (iloop (vector-ref smap s)) + (let ([s (if (char=? (string-ref str (+ s direction)) + (string-ref str i)) + (+ s direction) + s)]) + (vector-set! smap i s) + (loop s (+ i direction))))))) + + (let a-loop ([s beyond] + [s-pos s-pos] + [snip snip] + [total-count total-count] + [offset offset] + [shorten shorten] + [results null]) + (if (and snip (positive? total-count)) + (let*-values ([(need) (- (snip->count snip) shorten offset)] + [(need offset) + (if (need . > . total-count) + (if (direction . < . 0) + (values total-count (+ offset (- need total-count))) + (values total-count offset)) + (values need offset))] + [(total-count) (- total-count need)]) + + (let b-loop ([checked 0] + [need need] + [results results]) + (let* ([thistime (min need 255)] + [need (- need thistime)] + [thisoffset (+ offset (if (direction . < . 0) need checked))] + [wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + (let ([text (send snip get-text thisoffset thistime #f)]) + (set! write-locked? wl?) + (set! flow-locked? fl?) + + (let c-loop ([i (if (direction . > . 0) 0 (- thistime 1))] + [n thistime] + [s s] + [results results]) + (if (zero? n) + (if (positive? need) + + (b-loop (add1 checked) + need + results) + + (let* ([s-pos (if (direction . > . 0) + (+ s-pos (snip->count snip)) + s-pos)] + [snip (if (direction . > . 0) + (snip->next snip) + (snip->prev snip))] + [s-pos (if (and snip (direction . < . 0)) + (- s-pos (snip->count snip)) + s-pos)]) + (a-loop s + s-pos + snip + total-count + 0 + 0 + results))) + + (let* ([n (sub1 n)] + [c (string-ref text i)] + [c (if case-sens? (char-foldcase c) c)] + [s (let loop ([s s]) + (if (and (not (= beyond s)) + (not (char=? (string-ref str (+ s direction)) c))) + (loop (vector-ref smap s)) + s))]) + (if (char=? (string-ref str (+ s direction)) c) + (let ([s (+ s direction)]) + (if (= (+ s direction) sgoal) + (let* ([p (+ s-pos i thisoffset)] + [p (if bos? + (if (direction . < . 0) + (+ p slen) + (- p (- slen 1))) + (if (direction . > . 0) + (add1 p) + p))]) + (if just-one? + p ;; <------ single result returned here + (c-loop (+ i direction) + n + beyond + (cons p results)))) + (c-loop (+ i direction) + n + s + results))) + (c-loop (+ i direction) + n + s + results))))))))) + (if just-one? + #f + results))))))))))) + + ;; ---------------------------------------- + + (define/private (do-change-style start end new-style delta restore-sel? counts-as-mod?) + (unless (or write-locked? + s-user-locked? + (and new-style + (not (send s-style-list style-to-index new-style)))) + (let* ([start (max 0 (min len start))] + [end (min end len)]) + (unless (start . > . end) + (let ([new-style (if (and (not new-style) (not delta)) + (or (get-default-style) + (send s-style-list basic-style)) + new-style)]) + (cond + [(and (= start startpos) (= end endpos) (= end start) (positive? len)) + (when sticky-styles? + (set! caret-style + (cond + [new-style new-style] + [caret-style (send s-style-list find-or-create-style caret-style delta)] + [else (let ([gsnip (find-snip start 'before)]) + (send s-style-list find-or-create-style (snip->style gsnip) delta))])))] + [else + (set! write-locked? #t) + + (if (not (can-change-style? start (- end start))) + (set! write-locked? #f) + + (begin + (on-change-style start (- end start)) + + (set! flow-locked? #t) + + (make-snipset start end) + + (let-values ([(start-snip end-snip) + (if (zero? len) + (begin + (set! initial-style-needed? #f) + (values snips #f)) + (values (find-snip start 'after) (find-snip end 'after-or-none)))] + [(rec) + (and (zero? s-noundomode) + (make-object style-change-record% start end + (or delayed-streak? (not s-modified?)) + startpos endpos restore-sel?))]) + (let loop ([something? #f] + [extra-check-pos #f] + [prev-style #f] + [prev-style-pos start] + [p start] + [gsnip start-snip]) + (if (not (eq? gsnip end-snip)) + ;; Change a snip style: + (let* ([style (snip->style gsnip)] + [style2 (or new-style + (send s-style-list find-or-create-style style delta))]) + (if (not (eq? style style2)) + (begin + (set-snip-style! gsnip style2) + (let-values ([(prev-style prev-style-pos) + (if (and rec (not (eq? prev-style style))) + (begin + (when prev-style + (send rec add-style-change prev-style-pos p prev-style)) + (values style p)) + (values prev-style prev-style-pos))]) + (send gsnip size-cache-invalid) + (mline-mark-recalculate (snip->line gsnip)) + (when (max-width . > . 0) + (mline-mark-check-flow (snip->line gsnip))) + (loop #t + p + prev-style + prev-style-pos + (+ p (snip->count gsnip)) + (snip->next gsnip)))) + (let ([prev-style + (if (and rec prev-style) + (begin + (send rec add-style-change prev-style-pos p prev-style) + #f) + prev-style)]) + (loop something? + extra-check-pos + prev-style + prev-style-pos + (+ p (snip->count gsnip)) + (snip->next gsnip))))) + ;; All snips changed + (begin + (when (and rec prev-style) + (send rec add-style-change prev-style-pos p prev-style)) + + (if something? + ;; Something changed, so recalc and refresh: + (let ([line (snip->line start-snip)]) + (when (and (mline-prev line) + (not (has-flag? (snip->flags (mline-snip (mline-prev line))) HARD-NEWLINE))) + (mline-mark-check-flow (mline-prev line))) + (when (not s-modified?) + (add-undo-rec (make-object unmodify-record% delayed-streak?))) + (when rec + (add-undo-rec rec)) + (when (positive? delay-refresh) + (set! delayed-streak? #t)) + + (check-merge-snips start) + (when extra-check-pos + (check-merge-snips extra-check-pos)) + (when (not (= end extra-check-pos)) + (check-merge-snips end)) + + (when (and (not s-modified?) counts-as-mod?) + (set-modified #t)) + + (set! write-locked? #f) + (set! flow-locked? #f) + + (refresh-by-line-demand)) + ;; Nothing changed after all: + (begin + (set! write-locked? #f) + (set! flow-locked? #f) + + (check-merge-snips start) + (check-merge-snips end))) + + (after-change-style start (- end start))))))))])))))) + + (def/public (change-style [(make-or-false (make-alts style<%> style-delta%)) st] + [(make-alts exact-nonnegative-integer? (symbol-in start)) [start 'start]] + [(make-alts exact-nonnegative-integer? (symbol-in end)) [end 'end]] + [any? [counts-as-mod? #t]]) + (do-change-style (if (symbol? start) startpos start) + (if (symbol? end) (if (symbol? start) endpos len) end) + (and (st . is-a? . style<%>) st) + (and (st . is-a? . style-delta%) st) + 1 + counts-as-mod?)) + + (def/override (set-style-list [style-list% new-list]) + (unless write-locked? + (let ([delta (new style-delta%)] + [count (send s-style-list number)]) + (when (positive? count) + (let ([smap (make-vector count #f)]) + (vector-set! smap 0 (send new-list index-to-style 0)) + (for ([index (in-range 1 count)]) + (let* ([style (send s-style-list index-to-style index)] + [name (send style get-name)]) + (vector-set! + smap + index + (cond + [(and name (send new-list find-named-style name)) + => (lambda (new-style) new-style)] + [else + (let ([new-style + (let* ([base-style (send style get-base-style)] + [base-index (send s-style-list style-to-index base-style)]) + (if (send style is-join?) + (let* ([ss (send style get-shift-style)] + [shift-index (send s-style-list style-to-index ss)]) + (send new-list find-or-create-join-style + (vector-ref smap base-index) + (vector-ref smap shift-index))) + (begin + (send style get-delta delta) + (send new-list find-or-create-style + (vector-ref smap base-index) + delta))))]) + (if name + (send new-list new-named-style name new-style) + new-style))])))) + (let loop ([snip snips]) + (when snip + (let* ([index (send s-style-list style-to-index (snip->style snip))] + [index (if (not index) + ;; bad! snip had style not from this buffer's style list + 0 + index)]) + (set-snip-style! snip (vector-ref smap index))) + (loop (snip->next snip)))))) + + (super set-style-list new-list) + + (size-cache-invalid) + (set! changed? #t) + (need-refresh -1 -1)))) + + (def/override (style-has-changed [(make-or-false style<%>) style]) + (unless read-locked? + (if (not style) + ;; our cue to repaint + (begin + (set! changed? #t) + (need-refresh -1 -1)) + ;; notify snips: + (let ([wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + + (let loop ([snip snips]) + (when snip + (when (eq? style (snip->style snip)) + (send snip size-cache-invalid) + (let ([line (snip->line snip)]) + (mline-mark-recalculate line) + (when (max-width . >= . 0) + (mline-mark-check-flow line) + (when (and (mline-prev line) + (not (has-flag? (snip->flags (mline-last-snip (mline-prev line))) + HARD-NEWLINE))) + (mline-mark-check-flow (mline-prev line)))))) + (loop (snip->next snip)))) + (set! write-locked? wl?) + (set! flow-locked? fl?))))) + + ;; ---------------------------------------- + + (define/private (do-scroll-to snip localx localy w h refresh? [bias 'none]) + (cond + [flow-locked? #f] + [(positive? delay-refresh) + (when s-admin + (set! delayedscroll -1) + (set! delayedscrollbox? #t) + (set! delayedscrollsnip snip) + (set! delayedscroll-x localx) + (set! delayedscroll-y localy) + (set! delayedscroll-w w) + (set! delayedscroll-h h) + (set! delayedscrollbias bias)) + #f] + [else + (let-boxes ([x 0.0] + [y 0.0] + [ok? #t]) + (when snip + (set-box! ok? (get-snip-position-and-location snip #f x y))) + (cond + [(not ok?) #f] + [(scroll-editor-to (+ x localx) (+ y localy) w h refresh? bias) + (unless refresh? + (set! refresh-all? #t)) + #t] + [else #f]))])) + + (def/public (scroll-to [snip% snip] [real? localx] [real? localy] + [nonnegative-real? w] [nonnegative-real? h] + [any? refresh?] + [(symbol-in start end none) [bias 'none]]) + (do-scroll-to snip localx localy w h refresh? bias)) + + (def/override (resized [snip% snip] [any? redraw-now?]) + (when (get-snip-position-and-location snip #f #f #f) + + (let ([line (snip->line snip)]) + (mline-mark-recalculate line) + (when (max-width . >= . 0) + (mline-mark-check-flow line) + ;; maybe something can now move to the previous line + (when (and (mline-prev line) + (not (has-flag? (snip->flags (mline-last-snip (mline-prev line))) + HARD-NEWLINE))) + (mline-mark-check-flow (mline-prev line))))) + + (set! graphic-maybe-invalid? #t) + + (let ([redraw-now? (and redraw-now? + (not flow-locked?))]) + + (set! changed? #t) + + (unless redraw-now? (set! delay-refresh (add1 delay-refresh))) + (refresh-by-line-demand) + (unless redraw-now? (set! delay-refresh (sub1 delay-refresh)))))) + + (def/override (recounted [snip% snip] [any? redraw-now?]) + (if write-locked? + #f + (begin + (set! revision-count (add1 revision-count)) + (resized snip redraw-now?) + #t))) + + (def/override (set-caret-owner [(make-or-false snip%) snip] + [(symbol-in immediate display global) [dist 'immediate]]) + (when (do-set-caret-owner snip dist) + (need-refresh startpos endpos) ;; (need-caret-refresh); <- doesn't work; local caret ownership weirdness + (on-focus (not snip)))) + + (def/override (release-snip [snip% snip]) + (let ([pos (get-snip-position snip)]) + (and pos + (begin + (do-delete pos (+ pos (snip->count snip)) #f #f) + (when (and (not (snip->admin snip)) + (has-flag? (snip->flags snip) OWNED)) + (set-snip-flags! snip (remove-flag (snip->flags snip) OWNED))) + #t)))) + + (define/public (refresh-box L T w h) + (let ([B (+ T h)] + [R (+ L w)]) + (if refresh-box-unset? + (begin + (set! refresh-l L) + (set! refresh-r R) + (set! refresh-t T) + (set! refresh-b B) + (set! refresh-box-unset? #f)) + (begin + (when (L . < . refresh-l) + (set! refresh-l L)) + (when (R . > . refresh-r) + (set! refresh-r R)) + (when (T . < . refresh-t) + (set! refresh-t T)) + (when (B . > . refresh-b) + (set! refresh-b B)))) + + (set! draw-cached-in-bitmap? #f))) + + (def/override (needs-update [snip% snip] + [real? localx] [real? localy] + [nonnegative-real? w] [nonnegative-real? h]) + (let-boxes ([x 0.0] + [y 0.0] + [ok? #t]) + (set-box! ok? (get-snip-location snip x y)) + (when ok? + (refresh-box (+ x localx) (+ y localy) w h) + (when (zero? delay-refresh) + (redraw))))) + + (def/override (invalidate-bitmap-cache [real? [x 0.0]] + [real? [y 0.0]] + [(make-alts nonnegative-real? (symbol-in end)) [w 'end]] + [(make-alts nonnegative-real? (symbol-in end)) [h 'end]]) + (let ([w (if (symbol? w) (- total-width x) w)] + [h (if (symbol? h) (- total-height y) h)]) + + (refresh-box x y w h) + (when (zero? delay-refresh) + (redraw)))) + + (def/public (hide-caret [any? hide?]) + (unless (eq? hilite-on? (not hide?)) + (set! hilite-on? (not hide?)) + (when (or s-own-caret? (not (= endpos startpos))) + (need-caret-refresh)))) + + (def/public (caret-hidden) (not hilite-on?)) + + (def/public (get-between-threshold) between-threshold) + + (def/public (set-between-threshold [nonnegative-real? t]) + (set! between-threshold (min t 99.0))) + + ;; ---------------------------------------- + + (define/private (make-only-snip) + (set! snips (new string-snip%)) + (set-snip-style! snips (or (get-default-style) + (send s-style-list basic-style))) + (set-snip-count! snips 0) + (send snips set-s-admin snip-admin) + + (let ([line (create-mline)]) + (set-snip-line! snips line) + (set-box! line-root-box line) + (set! first-line line) + (set! last-line line) + (mline-set-starts-paragraph line #t) + + (set-mline-snip! line snips) + (set-mline-last-snip! line snips) + + (set! last-snip snips) + (set! snip-count 1) + + (set! num-valid-lines 1))) + + (define/private (splice-snip snip prev next) + (if prev + (set-snip-next! prev snip) + (set! snips snip)) + (set-snip-prev! snip prev) + (set-snip-next! snip next) + (if next + (set-snip-prev! next snip) + (set! last-snip snip))) + + (define/private (insert-snip before snip) + (if (and (eq? snips last-snip) (zero? (snip->count snips))) + (append-snip snip) + (begin + (splice-snip snip (snip->prev before) before) + (set! snip-count (add1 snip-count))))) + + (define/private (append-snip snip) + (if (and (eq? snips last-snip) (zero? (snip->count snips))) + ;; get rid of empty snip + (begin + (set! snips snip) + (set! last-snip snip)) + (begin + (splice-snip snip last-snip #f) + (set! snip-count (add1 snip-count))))) + + (define/private (delete-snip snip) + (cond + [(snip->next snip) + (splice-snip (snip->next snip) (snip->prev snip) (snip->next (snip->next snip)))] + [(snip->prev snip) + (splice-snip (snip->prev snip) (snip->prev (snip->prev snip)) (snip->next snip))] + [else + (set! last-snip #f) + (set! snips #f)]) + (set! snip-count (sub1 snip-count)) + (set-snip-flags! snip (add-flag (snip->flags snip) CAN-DISOWN)) + (snip-set-admin snip #f) + (set-snip-line! snip #f) + (set-snip-prev! snip #f) + (set-snip-next! snip #f) + (set-snip-flags! snip (remove-flag (snip->flags snip) CAN-DISOWN))) + + (define/private (snip-set-admin snip a) + (let ([orig-count (snip->count snip)] + [line (snip->line snip)] + [orig-admin (snip->admin snip)] + [wl? write-locked?] + [fl? flow-locked?]) + + (set! read-locked? #t) + (set! write-locked? #t) + (set! flow-locked? #t) + + (send snip set-admin a) + + (set! read-locked? #f) + (set! write-locked? wl?) + (set! flow-locked? fl?) + + (let ([snip + (if (not (eq? (snip->admin snip) a)) + ;; something went wrong + (cond + [(and (not a) (eq? (snip->admin snip) orig-admin)) + ;; force admin to NULL + (send snip set-s-admin #f) + snip] + [a + ;; snip didn't accept membership into this editor; give up on it + (let ([naya (new snip%)]) + (set-snip-count! naya orig-count) + (splice-snip naya (snip->prev snip) (snip->next snip)) + (set-snip-line! naya line) + + (when line + (when (eq? (mline-snip line) snip) + (set-mline-snip! line naya)) + (when (eq? (mline-last-snip line) snip) + (set-mline-last-snip! line naya))) + + (send snip set-s-admin #f) + + (send naya set-admin a) + (set! snip naya) + naya)] + [else snip]) + snip)]) + + ;; force count to be consistent: + (when (and a (not (= (snip->count snip) orig-count))) + (set-snip-count! snip orig-count)) + + snip))) + + (define/private (snip-split snip pos a-ptr b-ptr) + (let ([c (snip->count snip)] + [nl? (has-flag? (snip->flags snip) NEWLINE)] + [hnl? (has-flag? (snip->flags snip) HARD-NEWLINE)] + [orig snip]) + + (set-snip-flags! snip (add-flag (snip->flags snip) CAN-SPLIT)) + + (delete-snip snip) + + (set-snip-flags! orig (remove-flag (snip->flags orig) OWNED)) + + (set! revision-count (add1 revision-count)) + + (let ([wl? write-locked?] + [fl? flow-locked?]) + + (set! read-locked? #t) + (set! write-locked? #t) + (set! flow-locked? #t) + + (set-box! a-ptr #f) + (set-box! b-ptr #f) + (send snip split pos a-ptr b-ptr) + + (set! read-locked? #f) + (set! write-locked? wl?) + (set! flow-locked? fl?)) + + (let* ([a (or (unbox a-ptr) + (new snip%))] + [a (if (send a is-owned?) + (new snip%) + a)] + [b (or (unbox b-ptr) + (new snip%))] + [b (if (send b is-owned?) + (new snip%) + b)]) + + (set-box! a-ptr a) + (set-box! b-ptr b) + + (set-snip-flags! a (remove-flag (snip->flags a) CAN-SPLIT)) + (set-snip-flags! b (remove-flag (snip->flags b) CAN-SPLIT)) + (set-snip-flags! orig (remove-flag (snip->flags orig) CAN-SPLIT)) + + ;; make sure that count is right + (set-snip-count! a pos) + (set-snip-count! b (- c pos)) + + ;; make sure that NEWLINE & HARD-NEWLINE is consistent: + (when nl? + (set-snip-flags! b (add-flag (snip->flags b) NEWLINE))) + (when hnl? + (set-snip-flags! b (add-flag (snip->flags b) HARD-NEWLINE))) + (set-snip-flags! a (remove-flag (remove-flag (snip->flags b) NEWLINE) + HARD-NEWLINE))))) + + (define/private (split-one pos s-pos snip extra) + (let ([line (snip->line snip)] + [prev (snip->prev snip)] + [next (snip->next snip)] + [style (snip->style snip)]) + (let ([at-start? (eq? (mline-snip line) snip)] + [at-end? (eq? (mline-last-snip line) snip)] + [orig snip]) + (let-boxes ([ins-snip #f] + [snip #f]) + (snip-split orig (- pos s-pos) ins-snip snip) + + (set-snip-style! snip style) + (set-snip-style! ins-snip style) + + (set-snip-line! snip line) + (set-snip-line! ins-snip line) + + (when at-start? + (set-mline-snip! line ins-snip)) + (when at-end? + (set-mline-last-snip! line snip)) + + (splice-snip snip prev next) + (set! snip-count (add1 snip-count)) + (insert-snip snip ins-snip) + (extra snip) + + (snip-set-admin snip snip-admin) + (snip-set-admin ins-snip snip-admin) + + (after-split-snip (- pos s-pos)))))) + + (define/private (make-snipset start end) + ;; BEWARE: `len' may not be up-to-date + (when (positive? start) + (let-values ([(snip s-pos) (find-snip/pos start 'after-or-none)]) + (when snip + (unless (= s-pos start) + (split-one start s-pos snip void))))) + (when (positive? end) + (let-values ([(snip s-pos) (find-snip/pos end 'before)]) + (unless (= (+ s-pos (snip->count snip)) end) + (split-one end s-pos snip void))))) + + (define/private (insert-text-snip start style) + (let* ([snip (on-new-string-snip)] + [snip (if (or (send snip is-owned?) + (positive? (snip->count snip))) + ;; uh-oh; resort to string-snip% + (new string-snip%) + snip)] + [style (or style + (get-default-style) + (send s-style-list basic-style))]) + (set-snip-style! snip style) + (let ([snip (let ([rsnip (snip-set-admin snip snip-admin)]) + (if (not (eq? snip rsnip)) + ;; uh-oh; resort to string-snip%: + (let ([snip (new string-snip%)]) + (set-snip-style! snip style) + (send snip set-s-admin snip-admin)) + snip))]) + (set-snip-count! snip 0) + + (let-values ([(gsnip s-pos) (find-snip/pos start 'before-or-none)]) + (if (and gsnip + (= (+ (snip->count gsnip) s-pos) start) + (has-flag? (snip->flags gsnip) NEWLINE) + (not (has-flag? (snip->flags gsnip) HARD-NEWLINE))) + (begin + ;; we want the snip on the same line as the preceeding snip: + (if (snip->next gsnip) + (insert-snip (snip->next gsnip) snip) + (append-snip snip)) + (set-snip-flags! gsnip (remove-flag (snip->flags gsnip) NEWLINE)) + (set-snip-flags! snip (add-flag (snip->flags snip) NEWLINE)) + (set-snip-line! snip (snip->line gsnip)) + (set-mline-last-snip! (snip->line snip) snip) + snip) + (let-values ([(gsnip s-pos) (find-snip/pos start 'after-or-none)]) + (cond + [(not gsnip) + (append-snip snip) + (set-snip-line! snip last-line) + (when (eq? (mline-last-snip last-line) last-snip) + (set! last-snip snip)) + (set-mline-last-snip! last-line snip) + snip] + [(= s-pos start) + (insert-snip gsnip snip) + (set-snip-line! snip (snip->line gsnip)) + (when (eq? (mline-snip (snip->line snip)) gsnip) + (set-mline-snip! (snip->line snip) snip)) + snip] + [else + (split-one start s-pos gsnip + (lambda (gsnip) + (set-snip-line! snip (snip->line gsnip)) + (insert-snip gsnip snip))) + snip]))))))) + + (define/private (check-merge-snips start) + (when (let loop ([did-something? #f]) + (let-values ([(snip1 s-pos1) (find-snip/pos start 'before)] + [(snip2 s-pos2) (find-snip/pos start 'after)]) + (if (eq? snip1 snip2) + did-something? + (if (not (and (snip->snipclass snip1) + (eq? (snip->snipclass snip1) (snip->snipclass snip2)) + (eq? (snip->style snip1) (snip->style snip2)))) + did-something? + (if (not (and + (not (has-flag? (snip->flags snip1) NEWLINE)) + (has-flag? (snip->flags snip1) CAN-APPEND) + (has-flag? (snip->flags snip2) CAN-APPEND) + ((+ (snip->count snip1) (snip->count snip2)) . < . MAX-COUNT-FOR-SNIP) + (eq? (snip->line snip1) (snip->line snip2)))) + did-something? + (cond + [(zero? (snip->count snip1)) + (when (eq? (mline-snip (snip->line snip1)) snip1) + (set-mline-snip! (snip->line snip1) snip2)) + (delete-snip snip1) + (set-snip-flags! snip1 (remove-flag (snip->flags snip1) OWNED)) + (loop #t)] + [(zero? (snip->count snip2)) + (when (eq? (mline-last-snip (snip->line snip2)) snip2) + (set-mline-last-snip! (snip->line snip2) snip1) + (mline-mark-recalculate (snip->line snip1)) ; need last-w updated + (set! graphic-maybe-invalid? #t)) + (delete-snip snip2) + (set-snip-flags! snip2 (remove-flag (snip->flags snip2) OWNED)) + (loop #t)] + [else + (let ([c (+ (snip->count snip1) (snip->count snip2))] + [prev (snip->prev snip1)] + [next (snip->next snip2)] + [line (snip->line snip1)]) + (let ([at-start? (eq? (mline-snip line) snip1)] + [at-end? (eq? (mline-last-snip line) snip2)] + [wl? write-locked?] + [fl flow-locked?]) + (set! read-locked? #t) + (set! write-locked? #t) + (set! flow-locked? #t) + + (set-snip-flags! snip2 (add-flag (snip->flags snip2) CAN-SPLIT)) + (let ([naya (send snip2 merge-with snip1)]) + (set! read-locked? #t) + (set! write-locked? wl?) + (set! flow-locked? wl?) + + (if naya + (begin + ;; claim snip1 & snip2 unowned for naya test: + (set-snip-flags! snip1 (remove-flag (remove-flag (snip->flags snip1) CAN-SPLIT) + OWNED)) + (set-snip-flags! snip2 (remove-flag (remove-flag (snip->flags snip2) CAN-SPLIT) + OWNED)) + + (let ([naya (if (send naya is-owned?) + ;; uh-oh; make dummy + (new snip%) + naya)]) + (set-snip-flags! naya (remove-flag (snip->flags naya) CAN-SPLIT)) + (set-snip-flags! snip1 (add-flag (snip->flags snip1) OWNED)) + (set-snip-flags! snip2 (add-flag (snip->flags snip2) OWNED)) + + (delete-snip snip1) + (set-snip-flags! snip1 (remove-flag (snip->flags snip1) OWNED)) + (delete-snip snip2) + (set-snip-flags! snip2 (remove-flag (snip->flags snip2) OWNED)) + + (splice-snip naya prev next) + (set! snip-count (add1 snip-count)) + + ;; make sure that count is right: + (set-snip-count! naya c) + + (set! revision-count (add1 revision-count)) + + (let ([naya (snip-set-admin naya snip-admin)]) + + (set-snip-line! naya line) + (when at-start? + (set-mline-snip! line naya)) + (when at-end? + (set-mline-last-snip! line naya) + (mline-mark-recalculate line) ;; need last-w updated + (set! graphic-maybe-invalid? #t)) + #t))) + (begin + (set-snip-flags! snip2 (remove-flag (snip->flags snip2) CAN-SPLIT)) + #t)))))])))))) + (after-merge-snips start))) + + ;; ---------------------------------------- + + (def/public (on-new-string-snip) + (new string-snip%)) + + (def/public (on-new-tab-snip) + (new tab-snip%)) + + ;; ---------------------------------------- + + (def/override (find-first-snip) + (if (zero? len) + #f + snips)) + + (def/public (find-snip [exact-nonnegative-integer? p] + [(symbol-in before-or-none before after after-or-none) direction] + [maybe-box? [s-pos #f]]) + ;; BEWARE: `len' may not be up-to-date + (let-values ([(snip pos) (find-snip/pos p direction)]) + (when s-pos (set-box! s-pos pos)) + snip)) + + (define/private (find-snip/pos p direction) + ;; BEWARE: `len' may not be up-to-date + (cond + [(and (eq? direction 'before-or-none) (zero? p)) + (values #f 0)] + [(and (eq? direction 'after-or-none) (p . >= . (let ([l (mline-last (unbox line-root-box))]) + (+ (mline-get-position l) + (mline-len l))))) + (values #f 0)] + [else + (let* ([line (mline-find-position (unbox line-root-box) p)] + [pos (mline-get-position line)] + [p (- p pos)]) + + (let-values ([(snip pos p) + (let ([snip (mline-snip line)]) + (if (and (zero? p) (snip->prev snip)) + ;; back up one: + (let ([snip (snip->prev snip)]) + (values snip + (- pos (snip->count snip)) + (+ p (snip->count snip)))) + (values snip pos p)))]) + + (let loop ([snip snip] + [pos pos] + [p p]) + (if snip + (let ([p (- p (snip->count snip))]) + (cond + [(or (and (eq? direction 'on) + (zero? p)) + (and (or (eq? direction 'before) + (eq? direction 'before-or-none)) + (p . <= . 0)) + (and (or (eq? direction 'after) + (eq? direction 'after-or-none)) + (p . < . 0))) + (values snip pos)] + [(and (eq? direction 'on) + (p . < . 0)) + (values #f 0)] + [else + (loop (snip->next snip) (+ pos (snip->count snip)) p)])) + (if (not (eq? direction 'after-or-none)) + (values last-snip (- pos (snip->count last-snip))) + (values #f 0))))))])) + + (def/public (find-next-non-string-snip [(make-or-false snip%) snip]) + (if (or (and snip + (not (eq? (snip->admin snip) snip-admin))) + (zero? len)) + #f + (let loop ([snip (if snip + (snip->next snip) + snips)]) + (if (and snip (snip . is-a? . string-snip%)) + (loop (snip->next snip)) + snip)))) + + ;; ---------------------------------------- + + (define/override (setting-admin admin) (void)) + + (define/override (init-new-admin) + (when (and (zero? delay-refresh) + (or (not s-admin) (not (send s-admin delay-refresh?)))) + (redraw))) + + (define/private (end-streaks exceptions) + (when (and s-keymap + (not (memq 'key-sequence exceptions)) + (not streaks-pushed?)) + (send s-keymap break-sequence)) + (when (and flash? flashautoreset? (not flashdirectoff?)) + (flash-off)) + + (set! typing-streak? #f) + (set! deletion-streak? #f) + (when (not (memq 'cursor exceptions)) + (set! vcursor-streak? #f) + (set! extend-streak? #f)) + + (when (and anchor-streak? (not keep-anchor-streak?)) + (set-anchor #f)) + + (when (not (memq 'delayed exceptions)) + (set! delayed-streak? #f)) + + (set! kill-streak? #f) + + (set! prev-paste-start -1)) + + (define/private (push-streaks) + (set! streaks-pushed? #t) + (set! save-typing-streak? typing-streak?) + (set! save-deletion-streak? deletion-streak?) + (set! save-delayed-streak? delayed-streak?) + (set! save-vcursor-streak? vcursor-streak?) + (set! save-kill-streak? kill-streak?) + (set! save-anchor-streak? anchor-streak?) + (set! save-extend-streak? extend-streak?) + (set! save-prev-paste-start prev-paste-start) + (set! save-prev-paste-end prev-paste-end)) + + (define/private (pop-streaks) + (when streaks-pushed? + (set! streaks-pushed? #f) + (set! typing-streak? save-typing-streak?) + (set! deletion-streak? save-deletion-streak?) + (set! delayed-streak? save-delayed-streak?) + (set! vcursor-streak? save-vcursor-streak?) + (set! kill-streak? save-kill-streak?) + (set! anchor-streak? save-anchor-streak?) + (set! extend-streak? save-extend-streak?) + (set! prev-paste-start save-prev-paste-start) + (set! prev-paste-end save-prev-paste-end))) + + ;; ---------------------------------------- + + (define/private (check-recalc [need-graphic? #t] [need-write? #t] [no-display-ok? #f]) + (and (not read-locked?) + (not (and write-locked? need-write?)) + (if (not need-graphic?) + #t + (if (not s-admin) + no-display-ok? + (if (not graphic-maybe-invalid?) + #t + (if flow-locked? + #f + (let ([dc (send s-admin get-dc)]) + (if (not dc) + no-display-ok? + (recalc-lines dc need-graphic?))))))))) + + (define/public (check-flow maxw dc Y startp start) + ;; this method is called with write-locked and flow-locked already #t + (let ([p startp] + [checking-underflow? #f] ;; start by ensuring no overflow + [checking-underflow-at-next? #f] + [no-change-if-end-of-snip? #t] ;; because an immediate overflow can't be helped + [no-change-if-start-of-snip? #f] + [the-first-snip? #t] + [first-underflow? #f] + [deleted-a-newline? #f] + [had-newline? #f]) + + (define (done snip) + (cond + [(and (not snip) + (has-flag? (snip->flags last-snip) NEWLINE) + (not (has-flag? (snip->flags last-snip) HARD-NEWLINE))) + (begin + (set-snip-flags! last-snip (remove-flag (snip->flags last-snip) NEWLINE)) + (set! refresh-all? #t) + #t)] + [(or (not checking-underflow?) no-change-if-end-of-snip?) + deleted-a-newline?] + [else + (set! refresh-all? #t) + #t])) + + (let loop ([snip start] + [p p] + [_total-width 0]) + (if (and snip (not (has-flag? (snip->flags snip) HARD-NEWLINE))) + (begin + (when (not checking-underflow?) + (set! checking-underflow? checking-underflow-at-next?) + (when checking-underflow? + (set! first-underflow? #t))) + (set! no-change-if-start-of-snip? no-change-if-end-of-snip?) + + (if (has-flag? (snip->flags snip) NEWLINE) + (begin + (set! no-change-if-end-of-snip? (not checking-underflow?)) + (set-snip-flags! snip (remove-flag (snip->flags snip) NEWLINE)) + (set! checking-underflow-at-next? #t) + (set! had-newline? #t) + (set! deleted-a-newline? #t) + ;; note: if the newline is restored, then + ;; we leave the loop + ) + (begin + (set! no-change-if-end-of-snip? #f) + (set! checking-underflow-at-next? #f) + (set! had-newline? #f))) + + (let-boxes ([w 0.0]) + (send snip get-extent dc _total-width Y w #f #f #f #f #f) + (let ([_total-width (+ _total-width w)]) + (if (_total-width . > . maxw) + (let ([_total-width (- _total-width w)]) + ;; get best breaking position: + ;; (0.1 is hopefully a positive value smaller than any character) + (let ([origc (do-find-position-in-snip dc _total-width Y snip (- maxw _total-width 0.1) #f)]) + ;; get legal breaking position before optimal: + (let-boxes ([b (+ p origc 1)]) + (find-wordbreak b #f 'line) + (let ([c (min (- b p) origc)]) + (let ([p + (if (c . <= . 0) + (cond + [(and (b . <= . startp) checking-underflow? (positive? origc)) + ;; the word was currently force-broken; shift some part to here + (+ p origc)] + [(or (and checking-underflow? + first-underflow? + (or (b . <= . startp) (c . >= . 0))) + (and (not the-first-snip?) + (or (zero? c) + (and (zero? origc) + (c . < . 0) + (b . <= . startp))))) + ;; can't fit this snip in the line + (when (snip->prev snip) + (set-snip-flags! (snip->prev snip) (add-flag (snip->flags (snip->prev snip)) NEWLINE))) + (when (and had-newline? (snip->next snip)) + (set-snip-flags! snip (add-flag (snip->flags snip) NEWLINE))) + (if (and no-change-if-start-of-snip? + (or (not had-newline?) + (snip->next snip))) + #f + (begin + (set! refresh-all? #t) + #t))] + [(and (c . < . 0) (b . > . startp)) + ;; overflow, but previous wordbreak was before this snip + b] + [else + ;; overflow: we have to break the word anyway + (if (zero? origc) + (if (and (= (snip->count snip) 1) + (snip->next snip) + (has-flag? (snip->flags (snip->next snip)) NEWLINE)) + ;; don't insert a break before a real newline + (done snip) + (+ p 1)) + (+ p origc))]) + (+ p c))]) + (if (not (number? p)) + p ;; the result + (begin + (make-snipset p p) + (let ([snip (find-snip p 'before)]) + (when (snip->next snip) + (set-snip-flags! snip (add-flag (snip->flags snip) NEWLINE))) + (set! refresh-all? #t) + #t)))))))) + (begin + (set! the-first-snip? #f) + (set! first-underflow? #f) + (loop (snip->next snip) + (+ p (snip->count snip)) + _total-width)))))) + (done snip))))) + + (define/private (recalc-lines dc [calc-graphics? #t]) + (when calc-graphics? + (when snip-cache-invalid? + (let loop ([snip snips]) + (when snip + (send snip size-cache-invalid) + (loop (snip->next snip))))) + + (let ([old-max-width max-width]) + (when (and flow-invalid? + (max-width . <= . 0)) + (set! max-width A-VERY-BIG-NUMBER)) + + (when (or graphics-invalid? + flow-invalid? + snip-cache-invalid?) + ;; set all lines invalid + (let loop ([line first-line]) + (when line + (mline-mark-recalculate line) + (when flow-invalid? + (mline-mark-check-flow line)) + (loop (mline-next line))))) + + (let ([-changed? + (if (max-width . > . 0) + (let ([wl? write-locked?] + [fl? flow-locked?]) + ;; if any flow is updated, snip sizing methods will be called + (set! write-locked? #t) + (set! flow-locked? #t) + + (let ([w (- max-width CURSOR-WIDTH)]) + (let loop ([-changed? #f]) + (if (mline-update-flow (unbox line-root-box) line-root-box this w dc) + (loop #t) + + (begin + (set! flow-locked? fl?) + (set! write-locked? wl?) + -changed?))))) + #f)]) + + (when (not (= max-width old-max-width)) + (set! max-width old-max-width)) + + (when -changed? + (set! refresh-all? #t) + (set! first-line (mline-first (unbox line-root-box))) + (set! last-line (mline-last (unbox line-root-box))) + (set! num-valid-lines (mline-number (unbox line-root-box)))) + + (let ([-changed? + (or (mline-update-graphics (unbox line-root-box) this dc) + -changed?)]) + + (if (and (not -changed?) + (not graphic-maybe-invalid-force?)) + (begin + (set! graphic-maybe-invalid? #f) + (void)) + (begin + (set! graphic-maybe-invalid? #f) + (set! graphic-maybe-invalid-force? #f) + + (let* ([Y (+ (mline-get-location last-line) (mline-h last-line))] + [Y (if (has-flag? (snip->flags last-snip) NEWLINE) + (begin + (set! extra-line? #t) + (set! extra-line-h (+ (mline-last-h last-line) line-spacing)) + (+ Y extra-line-h)) + (begin + (set! extra-line? #f) + (set! extra-line-h 0) + Y))] + [X (+ (mline-max-width (unbox line-root-box)) CURSOR-WIDTH)] + [X (if (min-width . > . 0.0) + (max X min-width) + X)] + [Y (if (min-height . > . 0.0) + (max Y min-height) + Y)] + [Y (if (max-height . > . 0.0) + (min Y max-height) + Y)]) + (let ([descent (- (mline-h last-line) (mline-bottombase last-line))] + [space (mline-topbase first-line)] + [line-base (mline-bottombase first-line)]) + (let ([resized? + (if (or (not (= total-height Y)) + (not (= total-width X)) + (not (= final-descent descent)) + (not (= initial-space space)) + (not (= line-base initial-line-base))) + (begin + (set! total-height Y) + (set! total-width X) + (set! final-descent descent) + (set! initial-space space) + (set! initial-line-base line-base) + #t) + #f)]) + + (set! graphics-invalid? #f) + (set! flow-invalid? #f) + (set! snip-cache-invalid? #f) + + (set! draw-cached-in-bitmap? #f) + + (when (and resized? s-admin) + (send s-admin resized #f)) + + (on-reflow))))))))))) + + (def/public (on-reflow) (void)) + + (def/public (set-autowrap-bitmap [(make-or-false bitmap%) bm]) + (if flow-locked? + #f + (let ([old auto-wrap-bitmap] + [old-width wrap-bitmap-width]) + + (set! auto-wrap-bitmap bm) + (if auto-wrap-bitmap + (set! wrap-bitmap-width (send auto-wrap-bitmap get-width)) + (set! wrap-bitmap-width 0)) + + (when (max-width . > . 0) + (set-max-width (+ max-width old-width))) + + old))) + + ;; ---------------------------------------- + + ;; notifies the administrator that we need to be redrawn + (define/private (redraw) + + (unless (or flow-locked? (not s-admin)) + (let-values ([(continue? notify?) + (if (send s-admin delay-refresh?) + ;; does the admin know the refresh box already? + (if (and (not (= delayedscroll -1)) + (not delayedscrollbox?) + (or refresh-all? refresh-unset?)) + ;; yes... + (if (and (not refresh-all?) refresh-box-unset?) + ;; nothing to do + (values #f #f) + (values #t #t)) + (values #t #t)) + (values #t #f))]) + (when continue? + + (when notify? + (let-boxes ([x 0.0] [y 0.0] [w 0.0] [h 0.0]) + (send s-admin get-max-view x y w h) + (let ([top y] + [bottom (+ y h)] + [left x] + [right (+ x w)]) + (let-values ([(left right top bottom) + (if refresh-all? + (values left right top bottom) + (values + (max refresh-l left) + (min refresh-r right) + (max refresh-t top) + (min refresh-b bottom)))]) + (set! refresh-unset? #t) + (set! refresh-box-unset? #t) + (set! refresh-all? #f) + (let ([height (- bottom top)] + [width (- right left)]) + (when (and (width . > . 0) (height . > . 0)) + (send s-admin needs-update left top width height))))))) + + (let-boxes ([dc #f] + [x 0.0] + [y 0.0]) + (set-box! dc (send s-admin get-dc x y)) + (if (not dc) + (begin + (set! delayedscroll -1) + (set! delayedscrollbox? #f)) + + (let ([origx x] + [origy y]) + + (recalc-lines dc) + + (cond + [(not (= delayedscroll -1)) + (scroll-to-position/refresh delayedscroll delayedscrollateol? #f + delayedscrollend delayedscrollbias) + (set! refresh-all? #t)] + [delayedscrollbox? + (set! delayedscrollbox? #f) + (when (do-scroll-to delayedscrollsnip delayedscroll-x delayedscroll-y + delayedscroll-w delayedscroll-h #f delayedscrollbias) + (set! refresh-all? #t))]) + (let-boxes ([x 0.0] + [y 0.0]) + (send s-admin get-dc x y) + (when (or (not (= origx x)) (not (= origy y))) + (set! refresh-all? #t))) + + (let-boxes ([x 0.0] [y 0.0] [w 0.0] [h 0.0]) + (send s-admin get-max-view x y w h) + (let ([top y] + [bottom (+ y h)] + [left x] + [right (+ x w)]) + + ;; figure out the minimal refresh area; the refresh area may be + ;; determined by character position ranges, box coordinates, or + ;; both; if neither is specified, we have to assume that everything + ;; needs to be refreshed + (let-values ([(left top right bottom needs-update?) + (if (and (not refresh-all?) + (or (not refresh-unset?) (not refresh-box-unset?))) + (if (not refresh-unset?) + (let ([top (if (refresh-start . > . -1) + (let-boxes ([fy 0.0]) + (position-location refresh-start #f fy #t #t #t) + (max top fy)) + top)] + [bottom (if (refresh-end . > . -1) + (let-boxes ([fy 0.0]) + (position-location refresh-end #f fy #f #f #t) + (min bottom fy)) + bottom)]) + (values left (if (not refresh-box-unset?) + (min refresh-t top) + top) + right (if (not refresh-box-unset?) + (max bottom refresh-b) + bottom) + #t)) + (values (max refresh-l left) + (max top refresh-t) + (min right refresh-r) + (min bottom refresh-b) + #t)) + (values left top right bottom refresh-all?))]) + + (set! refresh-unset? #t) + (set! refresh-box-unset? #t) + (set! refresh-all? #f) + + (let ([height (- bottom top)] + [width (- right left)]) + + (when changed? + (set! changed? #f) + (let ([wl? write-locked?] + [fl? flow-locked?]) + + (set! write-locked? #t) + (set! flow-locked? #t) + (on-change) + (set! write-locked? wl?) + (set! flow-locked? fl?))) + + (when (and needs-update? + (width . > . 0) + (height . > . 0)) + (send s-admin needs-update left top width height))))))))))))) + + (define/private (too-busy-to-refresh?) + (or graphic-maybe-invalid? + flow-locked? + (positive? delay-refresh))) + + ;; called by the administrator to trigger a redraw + (def/override (refresh [real? left] [real? top] [nonnegative-real? width] [nonnegative-real? height] + [(symbol-in no-caret show-inactive-caret show-caret) show-caret] + [(make-or-false color%) bg-color]) + (cond + [(or (width . <= . 0) (height . <= . 0)) (void)] + [(too-busy-to-refresh?) + ;; this refresh command was not requested by us and we're busy + ;; (probably in the middle of a begin-/end-edit-sequnce); + ;; add the given region to our own invalid-region tracking, and + ;; we'll get back to it when we're done with whatever + (refresh-box left top width height)] + [(not s-admin) + (void)] + [else + (let-boxes ([x 0.0] + [y 0.0] + [dc #f]) + (set-box! dc (send s-admin get-dc x y)) + (when dc + (begin-sequence-lock) + + (let ([show-caret + (if (and caret-blinked? + (not (eq? show-caret 'no-caret)) + (not s-caret-snip)) + ;; maintain caret-blinked invariant + 'no-caret + show-caret)]) + + (when (send s-offscreen ready-offscreen width height) + (set! draw-cached-in-bitmap? #f)) + + ;; make sure all location information is integral, + ;; so we can shift the coordinate system and generally + ;; update on pixel boundaries + (let ([x (->long (floor x))] + [y (->long (floor y))] + [bottom (->long (ceiling (+ top height)))] + [right (->long (ceiling (+ left width)))] + [top (->long (floor top))] + [left (->long (floor left))]) + (let ([width (- right left)] + [height (- bottom top)] + [ps? (or (dc . is-a? . post-script-dc%) + (dc . is-a? . printer-dc%))] + [show-xsel? + (and ALLOW-X-STYLE-SELECTION? + (or (not (eq? 'show-caret show-caret)) s-caret-snip) + (eq? this editor-x-selection-owner) + (not flash?) + (not (= endpos startpos)))]) + + (if (and bg-color + (not (send s-offscreen is-in-use?)) + (send s-offscreen get-bitmap) + (send (send s-offscreen get-bitmap) ok?) + (send (send s-offscreen get-dc) ok?) + (not ps?)) + ;; draw to offscreen + (let ([red (send bg-color red)] + [green (send bg-color green)] + [blue (send bg-color blue)]) + (send s-offscreen set-in-use #t) + + (when (or + (not draw-cached-in-bitmap?) + (not (eq? offscreen-key (send s-offscreen get-last-used))) + (not (= last-draw-t top)) + (not (= last-draw-b bottom)) + (not (= last-draw-l left)) + (not (= last-draw-r right)) + (not (eq? show-caret last-draw-caret)) + (not (eq? show-xsel? last-draw-x-sel?)) + (not (= last-draw-red red)) + (not (= last-draw-green green)) + (not (= last-draw-blue blue))) + + (do-redraw (send s-offscreen get-dc) top bottom left right + (- top) (- left) show-caret show-xsel? bg-color) + + (set! last-draw-l left) + (set! last-draw-t top) + (set! last-draw-r right) + (set! last-draw-b bottom) + (set! last-draw-caret show-caret) + (set! last-draw-x-sel? show-xsel?) + (set! last-draw-red red) + (set! last-draw-green green) + (set! last-draw-blue blue) + (set! draw-cached-in-bitmap? #t)) + + (send dc draw-bitmap-section + (send (send s-offscreen get-dc) get-bitmap) + (- left x) (- top y) + 0 0 width height 'solid) + + (send s-offscreen set-last-used offscreen-key) + (send s-offscreen set-in-use #f)) + + ;; draw to given DC: + (let ([pen (send dc get-pen)] + [brush (send dc get-brush)] + [font (send dc get-font)] + [fg (make-object color% (send dc get-text-foreground))] + [bg (make-object color% (send dc get-text-background))] + [bgmode (send dc get-text-mode)] + [rgn (send dc get-clipping-region)]) + + (send dc set-clipping-rect (- left x) (- top y) width height) + + (do-redraw dc top bottom left right (- y) (- x) show-caret show-xsel? bg-color) + + (send dc set-clipping-region rgn) + + (send dc set-brush brush) + (send dc set-pen pen) + (send dc set-font font) + (send dc set-text-foreground fg) + (send dc set-text-background bg) + (send dc set-text-mode bgmode)))))) + + (end-sequence-lock)))])) + + ;; performs the actual drawing operations + (define/private (do-redraw dc starty endy leftx rightx dy dx show-caret show-xsel? bg-color) + (let ([wl? write-locked?]) + + (set! flow-locked? #t) + (set! write-locked? #t) + + (let-values ([(-startpos -endpos pos-at-eol?) + (if flash? + (values flashstartpos flashendpos flashposateol?) + (values startpos endpos posateol?))]) + + (send dc set-text-mode 'solid) + + (let ([line (mline-find-location (unbox line-root-box) starty)]) + + (when bg-color + (let ([lsave-pen (send dc get-pen)] + [lsave-brush (send dc get-brush)]) + (let ([wb (if (and (= 255 (send bg-color red)) + (= 255 (send bg-color green)) + (= 255 (send bg-color blue))) + clear-brush + (send the-brush-list find-or-create-brush bg-color 'solid))]) + (send dc set-brush wb) + (send dc set-pen outline-pen) + + (send dc draw-rectangle + (+ leftx dx) (+ starty dy) + (- rightx leftx) (- endy starty)) + + (send dc set-brush lsave-brush) + (send dc set-pen lsave-pen)))) + + (let* ([call-on-paint + (lambda (pre?) + (on-paint pre? dc leftx starty rightx endy dx dy + (if (not s-caret-snip) + show-caret + 'no-caret)))] + [paint-done + (lambda () + (call-on-paint #f) + (set! write-locked? wl?) + (set! flow-locked? #f))]) + + (call-on-paint #t) + + (when line + (let ([tleftx (+ leftx dx)] + [tstarty (+ starty dy)] + [trightx (+ rightx dx)] + [tendy (+ endy dy)]) + (let lloop ([line line] + [old-style #f] + [ycounter (mline-get-location line)] + [pcounter (mline-get-position line)] + [prevwasfirst 0.0]) + (cond + [(not line) + (send (send s-style-list basic-style) switch-to dc old-style) + (when (and (eq? 'show-caret show-caret) (not s-caret-snip) + extra-line? + (not pos-at-eol?) + (= len -startpos) + (= -endpos -startpos) + hilite-on?) + (let ([y ycounter] + [save-pen (send dc get-pen)]) + (send dc set-pen caret-pen) + (send dc draw-line dx (+ y dy) dx (sub1 (+ y extra-line-h dy))) + (send dc set-pen save-pen))) + (paint-done)] + [(ycounter . >= . endy) + (paint-done)] + [line + (let ([first (mline-snip line)] + [last (snip->next (mline-last-snip line))] + [bottombase (+ ycounter (mline-bottombase line))] + [topbase (+ ycounter (mline-topbase line))]) + (let-values ([(hilite-some? hsxs hsxe hsys hsye old-style) + (let sloop ([snip first] + [p pcounter] + [x (mline-get-left-location line max-width)] + [hilite-some? #f] + [hsxs 0.0] + [hsxe 0.0] + [hsys 0.0] + [hsye 0.0] + [old-style old-style]) + (if (eq? snip last) + (values hilite-some? hsxs hsxe hsys hsye old-style) + (begin + (send (snip->style snip) switch-to dc old-style) + (let ([old-style (snip->style snip)]) + (let-boxes ([w 0.0] [h 0.0] [descent 0.0] [space 0.0]) + (send snip get-extent dc x ycounter w h descent space #f #f) + (let* ([align (send (snip->style snip) get-alignment)] + [down + (cond + [(eq? 'bottom align) + (+ (- bottombase h) descent)] + [(eq? 'top align) + (- topbase space)] + [else + (- (/ (+ topbase bottombase) 2) + (/ (- h descent space) 2) + space)])]) + + (when (and (x . <= . rightx) + ((+ x w) . >= . leftx)) + (send snip draw dc (+ x dx) (+ down dy) + tleftx tstarty trightx tendy + dx dy + (if (eq? snip s-caret-snip) + show-caret + 'no-caret))) + + ;; the rules for hiliting are surprisingly complicated: + (let ([hilite? + (and + hilite-on? + (or show-xsel? + (and (not s-caret-snip) + (or (eq? 'show-caret show-caret) + (and (show-caret . showcaret>= . s-inactive-caret-threshold) + (not (= -endpos -startpos)))))) + (if pos-at-eol? + (= -startpos (+ p (snip->count snip))) + (or (and (-startpos . < . (+ p (snip->count snip))) + (-endpos . >= . p) + (or (= -endpos -startpos) (-endpos . > . p))) + (and (= (+ p (snip->count snip)) len) + (= len -startpos)))) + (or (not (has-flag? (snip->flags snip) NEWLINE)) + ;; end of line: + (or (not (= -startpos (+ p (snip->count snip)))) + (and (= -endpos -startpos) pos-at-eol?) + (and (not (= -endpos -startpos)) + (-startpos . < . (+ p (snip->count snip)))))) + (or (not (eq? snip first)) + ;; beginning of line: + (or (not (= p -endpos)) + (and (= -endpos -startpos) (not pos-at-eol?)) + (and (not (= -endpos -startpos)) + (-endpos . > . p)))))]) + + (if hilite? + (let*-values ([(bottom) (+ down h)] + [(hxs) (if (-startpos . <= . p) + (if (-startpos . < . p) + 0 + x) + (+ x (send snip partial-offset dc x ycounter + (- -startpos p))))] + [(hxe bottom) (if (-endpos . >= . (+ p (snip->count snip))) + (if (has-flag? (snip->flags snip) NEWLINE) + (if (= -startpos -endpos) + (values hxs bottom) + (values rightx + (+ ycounter (mline-h line)))) + (values (+ x w) bottom)) + (values (+ x (send snip partial-offset dc x ycounter + (- -endpos p))) + bottom))]) + + (let-values ([(hsxs hsxe hsys hsye) + (if (not hilite-some?) + (values hxs hxe down bottom) + (values hsxs hxe (min down hsys) (max hsye bottom)))]) + (sloop (snip->next snip) + (+ p (snip->count snip)) + (+ x w) + #t hsxs hsxe hsys hsye + old-style))) + (sloop (snip->next snip) + (+ p (snip->count snip)) + (+ x w) + hilite-some? hsxs hsxe hsys hsye + old-style)))))))))]) + (when (and (positive? wrap-bitmap-width) + (not (has-flag? (snip->flags (mline-last-snip line)) HARD-NEWLINE)) + last + (rightx . >= . max-width) + (send auto-wrap-bitmap ok?)) + (let ([h (min (->long (send auto-wrap-bitmap get-height)) + (mline-bottombase line))] + [osfg (send old-style get-foreground)]) + (send dc draw-bitmap-section + auto-wrap-bitmap + (sub1 (+ max-width dx)) (+ (- bottombase h) dy) + 0 0 wrap-bitmap-width h + 'solid osfg))) + + (let ([prevwasfirst + (if hilite-some? + (if (not (= hsxs hsxe)) + (if (and (hsxs . <= . rightx) (hsxe . >= . leftx)) + (let ([save-pen (send dc get-pen)] + [hxsx (max hsxs leftx)] + [hsxe (min hsxe rightx)]) + (begin0 + (if (and (not show-xsel?) + (not (showcaret>= show-caret 'show-caret))) + (if show-outline-for-inactive? + (let ([first-hilite? (-startpos . >= . pcounter)] + [last-hilite? (-endpos . <= . (+ pcounter (mline-len line)))]) + (send dc set-pen outline-inactive-pen) + (let ([prevwasfirst + (cond + [first-hilite? + (send dc draw-line (+ hsxs dx) (+ hsys dy) (+ hsxe (sub1 dx)) (+ hsys dy)) + hsxs] + [(positive? prevwasfirst) + (send dc draw-line dx (+ hsys dy) (+ prevwasfirst dx) (+ hsys dy)) + 0.0] + [else 0.0])]) + (send dc draw-line (+ hsxs dx) (+ hsys dy) (+ hsxs dx) (+ hsye (sub1 dy))) + (send dc draw-line (+ hsxe (sub1 dx)) (+ hsys dy) + (+ hsxe (sub1 dx)) (+ hsye (sub1 dy))) + (when last-hilite? + (send dc draw-line (+ hsxs dx) (+ hsye dy) (+ hsxe (sub1 dx)) (+ hsye dy))) + (when (not first-hilite?) + (send dc draw-line (+ hsxe dx) (+ hsys dy) (+ rightx dx) (+ hsys dy))) + prevwasfirst)) + prevwasfirst) + (let ([save-brush (send dc get-brush)]) + (send dc set-pen outline-pen) + (send dc set-brush outline-brush) + + (send dc draw-rectangle (+ hsxs dx) (+ hsys dy) + (max 0.0 (- hsxe hsxs)) (max 0.0 (- hsye hsys))) + (when ALLOW-X-STYLE-SELECTION? + (when show-xsel? + (send dc set-brush outline-nonowner-brush) + (send dc draw-rectangle (+ hsxs dx) (+ hsys dy) + (max 0.0 (- hsxe hsxs)) (max 0.0 (- hsye hsys))))) + (send dc set-brush save-brush) + prevwasfirst)) + (send dc set-pen save-pen))) + prevwasfirst) + (begin + (when (eq? 'show-caret show-caret) + (when (and (hsxs . <= . rightx) (hsxs . >= . leftx)) + (let ([save-pen (send dc get-pen)]) + (send dc set-pen caret-pen) + (send dc draw-line (+ hsxs dx) (+ hsys dy) + (+ hsxs dx) + (+ hsye (sub1 dy))) + (send dc set-pen save-pen)))) + prevwasfirst)) + prevwasfirst)]) + (lloop (mline-next line) + old-style + (+ ycounter (mline-h line)) + (+ pcounter (mline-len line)) + prevwasfirst))))]))))))))) + + ;; ---------------------------------------- + + ;; used internally to delay refreshes: + (define/private (need-refresh start [end -1]) + (if refresh-unset? + (begin + (set! refresh-start start) + (set! refresh-end end) + (set! refresh-unset? #f)) + (begin + (set! refresh-start (min start refresh-start)) + (cond + [(= end -1) + (set! refresh-end -1)] + [(= refresh-end -1) + (void)] + [else (set! refresh-end (max end refresh-end))]))) + + (set! draw-cached-in-bitmap? #f) + + (continue-refresh)) + + (define/private (refresh-by-line-demand) + (set! graphic-maybe-invalid? #t) + (continue-refresh)) + + (define/private (continue-refresh) + (if (and (zero? delay-refresh) + (not (super is-printing?)) + (or (not s-admin) (not (send s-admin delay-refresh?)))) + (redraw) + (begin + (when (and (zero? delay-refresh) + (or (= delayedscroll -1) + delayedscrollbox?)) + (if (and (not (super is-printing?)) s-admin) + ;; although the administrator says to delay, + ;; we can't just drop scroll requests + (redraw) + (begin + (set! delayedscroll -1) + (set! delayedscrollbox? #f)))) + (when (and s-admin (zero? (send s-admin get-s-standard))) + (send s-admin resized #f))))) + + (define/private (need-caret-refresh) + (need-refresh startpos endpos)) + + ;; ---------------------------------------- + + (define/override (own-x-selection on? update? force?) + (and (do-own-x-selection on? force?) + (begin + (when update? + (need-caret-refresh)) + #t))) + + ;; ---------------------------------------- + + (def/public (set-paragraph-margins [exact-nonnegative-integer? i] + [nonnegative-real? first-left] + [nonnegative-real? left] + [nonnegative-real? right]) + (let ([l (mline-find-paragraph (unbox line-root-box) i)]) + (when l + (let ([p (mline-clone-paragraph (mline-paragraph l))]) + (set-mline-paragraph! l p) + + (set-paragraph-left-margin-first! p first-left) + (set-paragraph-left-margin! p left) + (set-paragraph-right-margin! p right) + + (if (max-width . > . 0) + (begin + (mline-mark-check-flow l) + (let loop ([l (mline-next l)]) + (when (and l + (zero? (mline-starts-paragraph l))) + (mline-mark-check-flow l) + (loop (mline-next l))))) + (need-refresh (paragraph-start-position i) (paragraph-end-position i))) + + (refresh-by-line-demand))))) + + (def/public (set-paragraph-alignment [exact-nonnegative-integer? i] [(symbol-in left center right) align]) + (let ([l (mline-find-paragraph (unbox line-root-box) i)]) + (when l + (let ([p (mline-clone-paragraph (mline-paragraph l))]) + (set-mline-paragraph! l p) + + (set-paragraph-alignment! p align) + + (need-refresh (paragraph-start-position i) (paragraph-end-position i)) + + (refresh-by-line-demand))))) + + ;; ---------------------------------------- + + (def/override (is-printing?) (super is-printing?)) + + (define/override (do-begin-print dc fit?) + (if flow-locked? + #f + (begin + (check-recalc) + (size-cache-invalid) + + (let ([save-info (if fit? + (cons (get-max-width) + (set-autowrap-bitmap #f)) + #f)]) + (when fit? + (let-values ([(w h) (send dc get-size)]) + (let-boxes ([hm 0] + [vm 0]) + (send (current-ps-setup) get-editor-margin hm vm) + (set-max-width (- w (* 2 hm)))))) + + (recalc-lines dc #t) + + (let ([wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + (on-change) + (set! write-locked? wl?) + (set! flow-locked? fl?)) + + save-info)))) + + (define/override (do-end-print dc data) + (unless flow-locked? + (size-cache-invalid) + + (when data + (set-max-width (car data)) + (set-autowrap-bitmap (cdr data))) + + (let ([wl? write-locked?] + [fl? flow-locked?]) + (set! write-locked? #t) + (set! flow-locked? #t) + (on-change) + (set! write-locked? wl?) + (set! flow-locked? fl?)))) + + (define/private (has/print-page dc page print?) + (if flow-locked? + #f + (begin + (recalc-lines dc #t) + (let-values ([(W H) (send dc get-size)]) + (let-boxes ([W W] + [H H] + [hm 0] + [vm 0]) + (begin + (when (or (zero? (unbox W)) (zero? (unbox H))) + (get-default-print-size W H)) + (send (current-ps-setup) get-editor-margin hm vm)) + (let ([H (- H (* 2 vm))] + [W (- W (* 2 hm))]) + + ;; H is the total page height; + ;; line is the line that we haven't finished printing; + ;; y is the starting location to print for this page; + ;; h is the height that we're hoping to fit into the page + ;; i is the line number + (let ploop ([this-page 1] + [line first-line] + [y 0.0] + [next-h 0.0] + [i 0]) + (and + line + (let ([h next-h] + [next-h 0.0]) + (let loop ([h h] + [i i] + [line line]) + (if (or (zero? h) + (and (i . < . num-valid-lines) + ((mline-h line) . < . (- H h)))) + (loop (+ h (mline-h line)) + (add1 i) + (mline-next line)) + (let-values ([(h i line) + (if (and (h . < . H) + (i . < . num-valid-lines) + ((mline-h line) . > . H)) + ;; we'll have to break it up anyway; start now? + (let* ([pos (find-scroll-line (+ y H))] + [py (scroll-line-location pos)]) + (if (py . > . (+ y h)) + ;; yes, at least one line will fit + (values (+ h (mline-h line)) + (add1 i) + (mline-next line)) + (values h i line))) + (values h i line))]) + (let-values ([(next-h h) + (if (h . > . H) + ;; only happens if we have something that's too big to fit on a page; + ;; look for internal scroll positions + (let* ([pos (find-scroll-line (+ y H))] + [py (scroll-line-location pos)]) + (if (py . > . y) + (let ([new-h (- py y)]) + (values (- h new-h) + new-h)) + (values next-h h))) + (values next-h h))]) + (or (if print? + (begin + (when (or (negative? page) (= this-page page)) + (begin + (when (negative? page) + (send dc start-page)) + (do-redraw dc + (+ y (if (zero? i) 0 1)) + (+ y (- h 1)) + 0 W (+ (- y) vm) hm + 'no-caret #f #f) + (when (negative? page) + (send dc end-page)))) + #f) + (= this-page page)) + (ploop (add1 this-page) + line + (+ y h) + next-h + i))))))))))))))) + + (define/override (do-has-print-page? dc page) + (has/print-page dc page #f)) + + (def/override (print-to-dc [dc<%> dc] [exact-integer? [page -1]]) + (has/print-page dc page #t) + (void))) + +(set-text%! text%) + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define/top (add-text-keymap-functions [keymap% tab]) + (let ([add (lambda (n f) + (send tab add-function n + (lambda (e evt) + (if (e . is-a? . text%) + (begin (f e evt) #t) + #f))))]) + (add "forward-character" (lambda (t evt) (send t move-position 'right))) + (add "backward-character" (lambda (t evt) (send t move-position 'left))) + (add "previous-line" (lambda (t evt) (send t move-position 'up))) + (add "next-line" (lambda (t evt) (send t move-position 'down))) + (add "previous-page" (lambda (t evt) (send t move-position 'up #f 'page))) + (add "next-page" (lambda (t evt) (send t move-position 'down #f 'page))) + (add "forward-word" (lambda (t evt) (send t move-position 'right #f 'word))) + (add "backward-word" (lambda (t evt) (send t move-position 'left #f 'word))) + + (add "forward-select" (lambda (t evt) (send t move-position 'right #t))) + (add "backward-select" (lambda (t evt) (send t move-position 'left #t))) + (add "select-down" (lambda (t evt) (send t move-position 'down #t))) + (add "select-up" (lambda (t evt) (send t move-position 'up #t))) + (add "select-page-up" (lambda (t evt) (send t move-position 'up #t 'page))) + (add "select-page-down" (lambda (t evt) (send t move-position 'down #t 'page))) + (add "forward-select-word" (lambda (t evt) (send t move-position 'right #t 'word))) + (add "backward-select-word" (lambda (t evt) (send t move-position 'left #t 'word))) + + (add "beginning-of-file" (lambda (t evt) (send t move-position 'home))) + (add "end-of-file" (lambda (t evt) (send t move-position 'end))) + (add "beginning-of-line" (lambda (t evt) (send t move-position 'left #f 'line))) + (add "end-of-line" (lambda (t evt) (send t move-position 'right #f 'line))) + + (add "select-to-beginning-of-file" (lambda (t evt) (send t move-position 'home #t))) + (add "select-to-end-of-file" (lambda (t evt) (send t move-position 'end #t))) + (add "select-to-beginning-of-line" (lambda (t evt) (send t move-position 'left #t 'line))) + (add "select-to-end-of-line" (lambda (t evt) (send t move-position 'right #t 'line))) + + (add "delete-previous-character" (lambda (t evt) (send t delete))) + (add "delete-next-character" (lambda (t evt) + (let-boxes ([s 0] + [e 0]) + (send t get-position s e) + (if (not (= s e)) + (send t delete) + (send t delete s (+ s 1)))))) + + (add "clear-buffer" (lambda (t evt) (send t erase))) + (add "delete-next-word" (lambda (t evt) + (send t begin-edit-sequence) + (send t move-position 'right #t 'word) + (send t delete) + (send t end-edit-sequence))) + (add "delete-previous-word" (lambda (t evt) + (send t begin-edit-sequence) + (send t move-position 'left #t 'word) + (send t delete) + (send t end-edit-sequence))) + (add "delete-line" (lambda (t evt) + (send t begin-edit-sequence) + (send t move-position 'left #f 'line) + (send t move-position 'right #t 'line) + (send t delete) + (send t end-edit-sequence))) + + (add "paste-next" (lambda (t evt) (send t paste-next))) + + (add-editor-keymap-functions tab))) diff --git a/collects/mred/private/wxme/undo.ss b/collects/mred/private/wxme/undo.ss new file mode 100644 index 0000000000..15f44fbdc3 --- /dev/null +++ b/collects/mred/private/wxme/undo.ss @@ -0,0 +1,307 @@ +#lang scheme/base +(require scheme/class + "private.ss" + "snip.ss" + "snip-flags.ss") + +(provide proc-record% + unmodify-record% + insert-record% + insert-snip-record% + delete-record% + delete-snip-record% + style-change-record% + style-change-snip-record% + move-snip-record% + resize-snip-record% + composite-record%) + +(define (disown snip) + (when (has-flag? (snip->flags snip) OWNED) + (send snip set-s-flags (remove-flag (snip->flags snip) OWNED)))) + +(define change-record% + (class object% + (super-new) + (define/public (cancel) (void)) + (define/public (undo editor) #f) + (define/public (drop-set-unmodified) (void)) + (define/public (is-composite?) #f) + (define/public (get-id) #f) + (define/public (get-parity) 0) + (define/public (inverse) #f))) + +(define proc-record% + (class change-record% + (init-field proc) + (super-new) + + (define/override (undo editor) + (proc)))) + +(define unmodify-record% + (class change-record% + (init-field cont?) + (define ok? #t) + (super-new) + + (define/override (undo editor) + (when ok? + (send editor set-modified #f)) + cont?) + + (define/override (drop-set-unmodified) + (set! ok? #f)))) + +(define insert-record% + (class change-record% + (init-field start) + (init length) + (init-field cont? + startsel + endsel) + (define end (+ start length)) + (super-new) + + (define/override (undo editor) + (send editor delete start end) + (send editor set-position startsel endsel) + cont?))) + +(define insert-snip-record% + (class change-record% + (init-field snip + cont?) + (super-new) + + (define/override (undo editor) + (send editor delete snip) + (unless cont? + (send editor set-selected snip)) + cont?))) + +(define-struct delete-snip-item (snip before x y)) + +(define delete-snip-record% + (class change-record% + (init-field cont?) + (define deletions null) + (define undid? #f) + (super-new) + + (define/public (insert-snip snip before x y) + (set! deletions (cons (make-delete-snip-item snip before x y) + deletions))) + + (define/override (cancel) + (unless undid? + (for-each (lambda (i) + (let ([snip (delete-snip-item-snip i)]) + (disown snip) + (send snip set-admin #f))) + deletions))) + + (define/override (undo editor) + (unless cont? + (send editor no-selected)) + + (for-each + (lambda (del) + (let ([snip (delete-snip-item-snip del)]) + ;; have to turn off the owned flag; we know that it's really ours + (disown snip) + + (send editor insert snip + (delete-snip-item-before del) + (delete-snip-item-x del) + (delete-snip-item-y del)) + + (unless cont? + (send editor add-selected snip)))) + deletions) + + (set! undid? #t) + + cont?))) + +(define delete-record% + (class change-record% + (init-field start + end + cont? + startsel + endsel) + (define deletions null) + (define clickbacks null) + (define undid? #f) + (super-new) + + (define/public (insert-snip snip) + (set! deletions (cons snip deletions))) + + (define/public (add-clickback click) + (set! clickbacks (cons click clickbacks))) + + (define/override (cancel) + (unless undid? + (for-each (lambda (snip) + (disown snip) + (send snip set-admin #f)) + deletions))) + + (define/override (undo editor) + ;; have to turn off the owned flag; we know that it's really ours + (for-each disown deletions) + (send editor do-insert-snips deletions start) + (for-each (lambda (cb) + (send editor set-clickback cb)) + clickbacks) + + (send editor set-position startsel endsel) + + (set! undid? #t) + + cont?))) + +(define style-change-record% + (class change-record% + (init-field start + end + cont? + startsel + endsel + restore-selection?) + (define changes null) + (super-new) + + (define/public (add-style-change start end style) + (set! changes (cons (vector start end style) + changes))) + + (define/override (undo editor) + (for-each (lambda (c) + (send editor change-style + (vector-ref c 2) + (vector-ref c 0) + (vector-ref c 1))) + (reverse changes)) + + (when restore-selection? + (send editor set-position startsel endsel)) + + cont?))) + +(define style-change-snip-record% + (class change-record% + (init-field cont?) + (define changes null) + (super-new) + + (define/public (add-style-change snip style) + (set! changes (cons (cons snip style) changes))) + + (define/override (undo editor) + (unless cont? + (send editor no-selected)) + + (for-each (lambda (s) + (send editor change-style (cdr s) (cdr s)) + (unless cont? + (send editor add-selected (car s)))) + (reverse changes)) + + cont?))) + +(define move-snip-record% + (class change-record% + (init-field snip + x + y + delta? + cont?) + (super-new) + + (define/override (undo editor) + (if delta? + (send editor move snip x y) + (send editor move-to snip x y)) + cont?))) + +(define resize-snip-record% + (class change-record% + (init-field snip + x + y + cont?) + (super-new) + + (define/override (undo editor) + (send editor resize snip x y) + cont?))) + +(define composite-record% + (class change-record% + (init count) + (init-field id + parity?) + (unless id + (set! id (if parity? + (cons this #f) + (cons #f this)))) + (define seq (make-vector count)) + (super-new) + + (define/override (cancel) + (for ([c (in-vector seq)]) + (send c cancel))) + + (define/override (undo editor) + (for ([c (in-vector seq)]) + (send c undo)) + #f) + + (define/override (drop-set-unmodified) + (for ([c (in-vector seq)]) + (send c drop-set-unmodified))) + + (define/public (add-undo pos c) + (vector-set! seq (- (vector-length seq) pos 1) c)) + + (define/override (is-composite?) #t) + + (define/override (get-id) id) + + (define/override (get-parity) parity?) + + (define/override (inverse) + (make-object inverse-record% id (not parity?))))) + + +(define inverse-record% + (class change-record% + (init-field id + parity?) + + (define/private (get) + (if parity? + (car id) + (cdr id))) + + (define/override (cancel) + ;; Avoid double-frees by not doing anything + (void)) + + (define/override (undo editor) + (send (get) undo editor)) + + (define/override (drop-set-unmodified) + (let ([c (get)]) + (when c + (send c drop-set-unmodified)))) + + (define/override (get-id) id) + + (define/override (get-parity) parity?) + + (define/override (inverse) + (send (get) inverse)))) diff --git a/collects/mred/private/wxme/wordbreak.ss b/collects/mred/private/wxme/wordbreak.ss new file mode 100644 index 0000000000..03b428c9d9 --- /dev/null +++ b/collects/mred/private/wxme/wordbreak.ss @@ -0,0 +1,151 @@ +#lang scheme/base +(require scheme/class + "../syntax.ss" + "cycle.ss") + +(provide editor-wordbreak-map% + the-editor-wordbreak-map + standard-wordbreak) + +(defclass editor-wordbreak-map% object% + (define char-map (make-hash)) + + (super-new) + + (hash-set! char-map #\- '(line)) + + (def/public (set-map [char? ch] [(make-list (symbol-in caret line selection user1 user2)) mask]) + (hash-set! char-map ch mask)) + + (def/public (get-map [char? ch]) + (or (hash-ref char-map ch #f) + (cond + [(or (char-alphabetic? ch) + (char-numeric? ch)) + '(caret line selection)] + [(not (char-whitespace? ch)) + '(line)] + [else null])))) + +(define the-editor-wordbreak-map (new editor-wordbreak-map%)) + +(define MAX-DIST-TRY 30) + +(define wb-get-map (generic editor-wordbreak-map% get-map)) + +(define (string-ref* str n) + (if (n . >= . (string-length str)) + #\nul + (string-ref str n))) + +(define/top (standard-wordbreak [text% win] + [(make-or-false (make-box exact-nonnegative-integer?)) startp] + [(make-or-false (make-box exact-nonnegative-integer?)) endp] + [(symbol-in caret line selection user1 user2)reason]) + (with-method ([get-map ((send win get-wordbreak-map) get-map)]) + (define (nonbreak? ch) (memq reason (get-map ch))) + + (when startp + (let* ([start (unbox startp)] + [pstart start] + [lstart (send win find-newline 'backward start 0)] + [lstart (if lstart + (if (eq? 'caret reason) + (or (and (positive? lstart) + (send win find-newline 'backward (sub1 lstart) 0)) + 0) + lstart) + 0)] + [lend (min (+ start 1) (send win last-position))] + [tstart (if ((- start lstart) . > . MAX-DIST-TRY) + (- start MAX-DIST-TRY) + lstart)] + [text (send win get-text tstart lend)] + [start (- start tstart)] + [pstart (- pstart tstart)]) + + (let ploop ([phase1-complete? #f] + [phase2-complete? #f] + [start start] + [pstart pstart] + [text text] + [tstart tstart]) + (let*-values ([(start phase1-complete?) + (if phase1-complete? + (values start #t) + (let ([start (if (and (positive? start) + (nonbreak? (string-ref* text start))) + (sub1 start) + start)]) + (values start + (not (nonbreak? (string-ref* text start))))))] + [(start phase2-complete?) + (if (not (eq? 'selection reason)) + (if (not phase2-complete?) + (let loop ([start start]) + (if (and (positive? start) + (not (nonbreak? (string-ref* text start)))) + (loop (sub1 start)) + (if (nonbreak? (string-ref* text start)) + (values start #t) + (values start #f)))) + (values start #t)) + (values start phase2-complete?))]) + (let loop ([start start]) + (if (and (positive? start) + (nonbreak? (string-ref* text start))) + (loop (sub1 start)) + (let ([start (if (and (start . < . pstart) + (not (nonbreak? (string-ref* text start)))) + (add1 start) + start)]) + (if (and (zero? start) + (not (= lstart tstart))) + (ploop phase1-complete? + phase2-complete? + (+ start (- tstart lstart)) + (+ pstart (- tstart lstart)) + (send win get-text lstart lend) + lstart) + (set-box! startp (+ start tstart)))))))))) + + (when endp + (let* ([end (unbox endp)] + [lstart end] + [lend (send win find-newline 'forward end)] + [lend (if lend + (if (eq? 'caret reason) + (or (send win find-newline 'forward (+ lend 1)) + (send win last-position)) + lend) + (send win last-position))] + [tend (if ((- lend end) . > . MAX-DIST-TRY) + (+ end MAX-DIST-TRY) + lend)] + [text (send win get-text lstart tend)] + [end (- end lstart)] + [lend (- lend lstart)] + [tend (- tend lstart)]) + + (let ploop ([phase1-complete? #f] + [text text] + [tend tend]) + (let-values ([(end phase1-complete?) + (if phase1-complete? + (values end #t) + (let loop ([end end]) + (if (and (end . < . tend) + (not (nonbreak? (string-ref* text end)))) + (loop (add1 end)) + (if (end . < . tend) + (values end #t) + (values end #f)))))]) + (let loop ([end end]) + (if (and (end . < . tend) + (nonbreak? (string-ref* text end))) + (loop (add1 end)) + (if (and (= tend end) (not (= lend tend))) + (ploop phase1-complete? + (send win get-text lstart (+ lstart lend)) + lend) + (set-box! endp (+ end lstart))))))))))) diff --git a/collects/mred/private/wxme/wx.ss b/collects/mred/private/wxme/wx.ss new file mode 100644 index 0000000000..a50d9a08e6 --- /dev/null +++ b/collects/mred/private/wxme/wx.ss @@ -0,0 +1,63 @@ +#lang scheme/base +(require "../kernel.ss") + +(define the-clipboard (get-the-clipboard)) +(define the-x-selection-clipboard (get-the-x-selection)) +(define the-brush-list (get-the-brush-list)) +(define the-pen-list (get-the-pen-list)) +(define the-font-list (get-the-font-list)) +(define the-color-database (get-the-color-database)) +(define the-font-name-directory (get-the-font-name-directory)) + +(define (family-symbol? s) + (memq s '(default decorative roman script + swiss modern symbol system))) +(define (style-symbol? s) + (memq s '(normal italic slant))) +(define (weight-symbol? s) + (memq s '(normal bold light))) +(define (smoothing-symbol? s) + (memq s '(default smoothed unsmoothed partly-smoothed))) +(define (size? v) (and (exact-positive-integer? v) + (byte? v))) + +(provide event% + mouse-event% + key-event% + timer% + canvas% + bitmap-dc% + color% + the-color-database + pen% + the-pen-list + brush% + the-brush-list + font% + the-font-list + the-font-name-directory + cursor% + bitmap% + dc<%> + post-script-dc% + printer-dc% + current-eventspace + clipboard-client% + clipboard<%> + the-clipboard + the-x-selection-clipboard + get-double-click-threshold + begin-refresh-sequence + end-refresh-sequence + begin-busy-cursor + end-busy-cursor + hide-cursor + run-printout + current-ps-setup + family-symbol? + style-symbol? + weight-symbol? + smoothing-symbol?) + +(define (get-double-click-threshold) + (get-double-click-time)) diff --git a/collects/mred/private/wxmenu.ss b/collects/mred/private/wxmenu.ss index 91c34e9a9f..d0a00ff588 100644 --- a/collects/mred/private/wxmenu.ss +++ b/collects/mred/private/wxmenu.ss @@ -3,6 +3,7 @@ mzlib/class100 mzlib/list (prefix wx: "kernel.ss") + (prefix wx: "wxme/keymap.ss") "lock.ss" "const.ss" "helper.ss" diff --git a/collects/mred/private/wxtextfield.ss b/collects/mred/private/wxtextfield.ss index 4ecd803007..f17688bb11 100644 --- a/collects/mred/private/wxtextfield.ss +++ b/collects/mred/private/wxtextfield.ss @@ -2,6 +2,8 @@ (require mzlib/class mzlib/class100 (prefix wx: "kernel.ss") + (prefix wx: "wxme/text.ss") + (prefix wx: "wxme/editor-canvas.ss") "lock.ss" "const.ss" "check.ss" diff --git a/collects/mred/private/wxtop.ss b/collects/mred/private/wxtop.ss index ada1f634e9..da720d36bc 100644 --- a/collects/mred/private/wxtop.ss +++ b/collects/mred/private/wxtop.ss @@ -4,6 +4,8 @@ mzlib/etc mzlib/list (prefix wx: "kernel.ss") + (prefix wx: "wxme/editor-canvas.ss") + (prefix wx: "wxme/editor-snip.ss") "lock.ss" "helper.ss" "const.ss" diff --git a/collects/scheme/private/for.ss b/collects/scheme/private/for.ss index f5e625a6da..b88259b4a9 100644 --- a/collects/scheme/private/for.ss +++ b/collects/scheme/private/for.ss @@ -637,7 +637,7 @@ (if (null? sequences) sequence (append-sequences all #f)))) (define (in-cycle sequence . sequences) (let ([all (cons sequence sequences)]) - (check-sequences 'in-cycle sequences) + (check-sequences 'in-cycle all) (append-sequences all #t))) (define (in-parallel . sequences) diff --git a/collects/scheme/private/kw.ss b/collects/scheme/private/kw.ss index dac1b7da94..3181f0a80b 100644 --- a/collects/scheme/private/kw.ss +++ b/collects/scheme/private/kw.ss @@ -386,7 +386,8 @@ #`[core #,(annotate-method (syntax-property - #`(lambda #,(syntax-property + (quasisyntax/loc stx + (lambda #,(syntax-property #`(given-kws given-args new-plain-id ... opt-arg ... @@ -402,7 +403,7 @@ (opt-arg ...) (opt-arg? ...) (new-plain-id ... . new-rest) ;; the original body, finally: - body1 body ...))) + body1 body ...)))) 'certify-mode 'transparent))] 'certify-mode diff --git a/collects/scribblings/gui/clipboard-intf.scrbl b/collects/scribblings/gui/clipboard-intf.scrbl index bb1807c654..230949287a 100644 --- a/collects/scribblings/gui/clipboard-intf.scrbl +++ b/collects/scribblings/gui/clipboard-intf.scrbl @@ -80,6 +80,14 @@ See @|timediscuss| for a discussion of the @scheme[time] argument. If } + +@defmethod[(same-clipboard-client? [owner (is-a?/c clipboard-client%)]) + boolean?]{ + +Returns @scheme[#t] if @scheme[owner] currently owns the clipboard, +@scheme[#f] otherwise.} + + @defmethod[(set-clipboard-bitmap [new-bitmap (is-a?/c bitmap%)] [time (and/c exact? integer?)]) void?]{ diff --git a/collects/scribblings/gui/dc-intf.scrbl b/collects/scribblings/gui/dc-intf.scrbl index 92ab853a46..b5b8e56663 100644 --- a/collects/scribblings/gui/dc-intf.scrbl +++ b/collects/scribblings/gui/dc-intf.scrbl @@ -13,6 +13,21 @@ when the drawing coordinates are in the range @scheme[-16383] to @scheme[16383]. This restriction applies to the coordinates both before and after offsets and scaling factors are applied. + +@defmethod[(cache-font-metrics-key) + exact-integer?]{ + +Returns an integer that, if not @scheme[0], corresponds to a +particular kind of device and scaling factor, such that text-extent +information (from @method[dc<%> get-text-extent], @method[dc<%> +get-char-height], etc.) is the same. The key is valid across all +@scheme[dc<%>] instances, even among different classes. + +A @scheme[0] result indicates that the current configuration of +@this-obj[] does not fit into a common category, and so no key is +available for caching text-extent information.} + + @defmethod[(clear) void?]{ diff --git a/collects/scribblings/gui/editor-intf.scrbl b/collects/scribblings/gui/editor-intf.scrbl index 1e9756751f..2184550f83 100644 --- a/collects/scribblings/gui/editor-intf.scrbl +++ b/collects/scribblings/gui/editor-intf.scrbl @@ -59,7 +59,7 @@ The system adds undoers to an editor (in response to other method } @defmethod[(adjust-cursor [event (is-a?/c mouse-event%)]) - (or/c (is-a?/c cursor%) false/c)]{ + (or/c (is-a?/c cursor%) #f)]{ @methspec{ @@ -332,9 +332,9 @@ Returns @scheme[#t]. }} -@defmethod*[([(change-style [delta (or/c (is-a?/c style-delta%) false/c)]) +@defmethod*[([(change-style [delta (or/c (is-a?/c style-delta%) #f)]) void?] - [(change-style [style (or/c (is-a?/c style<%>) false/c)]) + [(change-style [style (or/c (is-a?/c style<%>) #f)]) void?])]{ Changes the style for @techlink{items} in the editor, either by @@ -456,6 +456,12 @@ Returns the name of a style to be used for newly inserted text, } + +@defmethod[(do-copy) void?]{ + +See @xmethod[text% do-copy] or @xmethod[pasteboard% do-copy].} + + @defmethod[(do-edit-operation [op (one-of/c 'undo 'redo 'clear 'cut 'copy 'paste 'kill 'select-all 'insert-text-box 'insert-pasteboard-box 'insert-image)] @@ -492,6 +498,17 @@ See @|timediscuss| for a discussion of the @scheme[time] argument. If } + +@defmethod[(do-paste) void?]{ + +See @xmethod[text% do-paste] or @xmethod[pasteboard% do-paste].} + + +@defmethod[(do-paste-x-selection) void?]{ + +See @xmethod[text% do-paste-x-selection] or @xmethod[pasteboard% do-paste-x-selection].} + + @defmethod[(editor-location-to-dc-location [x real?] [y real?]) (values real? real?)]{ @@ -530,7 +547,7 @@ more information. @defmethod[(find-first-snip) - (or/c (is-a?/c snip%) false/c)]{ + (or/c (is-a?/c snip%) #f)]{ Returns the first snip in the editor, or @scheme[#f] if the editor is empty. To get all of the snips in the editor, use the @xmethod[snip% @@ -553,7 +570,7 @@ For @scheme[text%] objects: @|FCA| @|OVD| } @defmethod[(get-active-canvas) - (or/c (is-a?/c editor-canvas%) false/c)]{ + (or/c (is-a?/c editor-canvas%) #f)]{ If the editor is displayed in a canvas, this method returns the canvas that most recently had the keyboard focus (while the editor was @@ -562,7 +579,7 @@ If the editor is displayed in a canvas, this method returns the canvas } @defmethod[(get-admin) - (or/c (is-a?/c editor-admin%) false/c)]{ + (or/c (is-a?/c editor-admin%) #f)]{ Returns the @scheme[editor-admin%] object currently managing this editor or @scheme[#f] if the editor is not displayed. @@ -570,7 +587,7 @@ Returns the @scheme[editor-admin%] object currently managing this } @defmethod[(get-canvas) - (or/c (is-a?/c editor-canvas%) false/c)]{ + (or/c (is-a?/c editor-canvas%) #f)]{ If @method[editor<%> get-active-canvas] returns a canvas, that canvas is also returned by this method. Otherwise, if @method[editor<%> @@ -591,7 +608,7 @@ Returns a list of canvases displaying the editor. An editor may be } @defmethod[(get-dc) - (or/c (is-a?/c dc<%>) false/c)]{ + (or/c (is-a?/c dc<%>) #f)]{ Typically used (indirectly) by snip objects belonging to the editor. Returns a destination drawing context which is suitable for @@ -610,8 +627,8 @@ Returns the font descent for the editor. This method is primarily used } -@defmethod[(get-extent [w (or/c (box/c (and/c real? (not/c negative?))) false/c)] - [h (or/c (box/c (and/c real? (not/c negative?))) false/c)]) +@defmethod[(get-extent [w (or/c (box/c (and/c real? (not/c negative?))) #f)] + [h (or/c (box/c (and/c real? (not/c negative?))) #f)]) void?]{ Gets the current extent of the editor's graphical representation. @@ -622,8 +639,8 @@ Gets the current extent of the editor's graphical representation. } -@defmethod[(get-file [directory (or/c path? false/c)]) - (or/c path-string? false/c)]{ +@defmethod[(get-file [directory (or/c path? #f)]) + (or/c path-string? #f)]{ @methspec{ Called when the user must be queried for a filename to load an @@ -644,8 +661,8 @@ If the editor is displayed in a single canvas, then the canvas's }} -@defmethod[(get-filename [temp (box/c (or/c any/c false/c)) #f]) - (or/c path-string? false/c)]{ +@defmethod[(get-filename [temp (box/c (or/c any/c #f)) #f]) + (or/c path-string? #f)]{ Returns the path name of the last file saved from or loaded into this editor, @scheme[#f] if the editor has no filename. @@ -665,7 +682,7 @@ a discussion of flattened vs. non-flattened text. @defmethod[(get-focus-snip) - (or/c (is-a?/c snip%) false/c)]{ + (or/c (is-a?/c snip%) #f)]{ @index['("keyboard focus" "snips")]{Returns} the snip within the editor that gets the keyboard focus when the editor has the focus, or @@ -698,7 +715,7 @@ See also @method[editor<%> set-inactive-caret-threshold] and @defmethod[(get-keymap) - (or/c (is-a?/c keymap%) false/c)]{ + (or/c (is-a?/c keymap%) #f)]{ Returns the main keymap currently used by the editor. @@ -788,7 +805,7 @@ If the result is @scheme[#t], then the editor accepts only plain-text } @defmethod[(get-snip-data [thesnip (is-a?/c snip%)]) - (or/c (is-a?/c editor-data%) false/c)]{ + (or/c (is-a?/c editor-data%) #f)]{ @methspec{ @@ -805,8 +822,8 @@ Returns @scheme[#f]. @defmethod[(get-snip-location [thesnip (is-a?/c snip%)] - [x (or/c (box/c real?) false/c) #f] - [y (or/c (box/c real?) false/c) #f] + [x (or/c (box/c real?) #f) #f] + [y (or/c (box/c real?) #f) #f] [bottom-right? any/c #f]) boolean?]{ @@ -850,8 +867,8 @@ Returns the style list currently in use by the editor. } -@defmethod[(get-view-size [w (or/c (box/c (and/c real? (not/c negative?))) false/c)] - [h (or/c (box/c (and/c real? (not/c negative?))) false/c)]) +@defmethod[(get-view-size [w (or/c (box/c (and/c real? (not/c negative?))) #f)] + [h (or/c (box/c (and/c real? (not/c negative?))) #f)]) void?]{ Returns the visible area into which the editor is currently being @@ -868,8 +885,8 @@ If the @techlink{display} is an editor canvas, see also } -@defmethod[(global-to-local [x (or/c (box/c real?) false/c)] - [y (or/c (box/c real?) false/c)]) +@defmethod[(global-to-local [x (or/c (box/c real?) #f)] + [y (or/c (box/c real?) #f)]) void?]{ Converts the given coordinates from top-level @techlink{display} coordinates @@ -949,7 +966,7 @@ The @scheme[show-errors?] argument is no longer used. } -@defmethod[(insert-image [filename (or/c path-string? false/c) #f] +@defmethod[(insert-image [filename (or/c path-string? #f) #f] [type (one-of/c 'unknown 'gif 'jpeg 'xbm 'xpm 'bmp 'pict) 'unknown] [relative-path? any/c #f] [inline? any/c #t]) @@ -974,7 +991,7 @@ calling @defmethod[(insert-port [port input-port] [format (one-of/c 'guess 'same 'copy 'standard 'text 'text-force-cr) 'guess] - [show-errors? any/c #t]) + [replace-styles? any/c #t]) (one-of/c 'standard 'text 'text-force-cr)]{ Use @method[editor<%> insert-file], instead. @@ -991,8 +1008,8 @@ The @scheme[port] must support position setting with @scheme[file-position]. For information on @scheme[format], see @method[editor<%> load-file]. -The @scheme[show-errors?] argument is no longer used. - +if @scheme[replace-styles?] is true, then styles in the current style + list are replaced by style specifications in @scheme[port]'s stream. } @defmethod[(invalidate-bitmap-cache [x real? 0.0] @@ -1030,13 +1047,20 @@ Returns @scheme[#t] if the editor is currently locked, @scheme[#f] @defmethod[(is-modified?) boolean?]{ -Returns @scheme[#t] is the editor has been modified since the last +Returns @scheme[#t] if the editor has been modified since the last save or load (or the last call to @method[editor<%> set-modified] with @scheme[#f]), @scheme[#f] otherwise. } +@defmethod[(is-printing?) + boolean?]{ + +Returns @scheme[#t] if the editor is currently being printed through +the @method[editor<%> print] method, @scheme[#f] otherwise.} + + @defmethod[(kill [time (and/c exact? integer?) 0]) void?]{ @@ -1056,7 +1080,7 @@ See also @method[editor<%> cut]. } -@defmethod[(load-file [filename (or/c path-string? false/c) #f] +@defmethod[(load-file [filename (or/c path-string? #f) #f] [format (one-of/c 'guess 'same 'copy 'standard 'text 'text-force-cr) 'guess] [show-errors? any/c #t]) @@ -1117,8 +1141,8 @@ See also @method[editor<%> on-load-file], @method[editor<%> } -@defmethod[(local-to-global [x (box/c real?)] - [y (box/c real?)]) +@defmethod[(local-to-global [x (or/c (box/c real?) #f)] + [y (or/c (box/c real?) #f)]) void?]{ Converts the given coordinates from editor @techlink{location} @@ -1499,7 +1523,7 @@ Creates a @scheme[editor-snip%] with either a sub-editor from }} -@defmethod[(on-new-image-snip [filename (or/c path? false/c)] +@defmethod[(on-new-image-snip [filename (or/c path? #f)] [kind (one-of/c 'unknown 'gif 'jpeg 'xbm 'xpm 'bmp 'pict)] [relative-path? any/c] [inline? any/c]) @@ -1689,7 +1713,7 @@ To extend or re-implement copying, override the @xmethod[text% @defmethod[(print [interactive? any/c #t] [fit-on-page? any/c #t] [output-mode (one-of/c 'standard 'postscript) 'standard] - [parent (or/c (or/c @scheme[frame%] (is-a?/c dialog%)) false/c) #f] + [parent (or/c (or/c @scheme[frame%] (is-a?/c dialog%)) #f) #f] [force-ps-page-bbox? any/c #t] [as-eps? any/c #f]) void?]{ @@ -1750,18 +1774,26 @@ The printing margins are determined by @method[ps-setup% } -@defmethod[(print-to-dc [dc (is-a?/c dc<%>)]) +@defmethod[(print-to-dc [dc (is-a?/c dc<%>)] + [page-number exact-integer? -1]) void?]{ Prints the editor into the given drawing context. See also @method[editor<%> print]. +If @scheme[page-number] is a non-negative integer, then just the +indicated page is printed, where pages are numbered from +@scheme[1]. (So, supplying @scheme[0] as @scheme[page-number] produces +no output.) When @scheme[page-number] is negative, the +@method[dc<%> start-page] and @scheme[dc<%> end-page] methods of @scheme[dc] are +called for each page. + } -@defmethod[(put-file [directory (or/c path? false/c)] - [default-name (or/c path? false/c)]) - (or/c path-string? false/c)]{ +@defmethod[(put-file [directory (or/c path? #f)] + [default-name (or/c path? #f)]) + (or/c path-string? #f)]{ @methspec{ Called when the user must be queried for a filename to save an @@ -1860,7 +1892,7 @@ See also @method[editor<%> add-undo]. [width (and/c real? (not/c negative?))] [height (and/c real? (not/c negative?))] [draw-caret (one-of/c 'no-caret 'show-inactive-caret 'show-caret)] - [background (or/c (is-a?/c color%) false/c)]) + [background (or/c (is-a?/c color%) #f)]) void?]{ Repaints a region of the editor, generally called by an editor @@ -1940,7 +1972,7 @@ If @scheme[redraw-now?] is @scheme[#f], the editor will require } -@defmethod[(save-file [filename (or/c path-string? false/c) #f] +@defmethod[(save-file [filename (or/c path-string? #f) #f] [format (one-of/c 'guess 'same 'copy 'standard 'text 'text-force-cr) 'same] [show-errors? any/c #t]) @@ -2074,7 +2106,7 @@ Normally, this method is called only by @xmethod[editor-canvas% } -@defmethod[(set-admin [admin (or/c (is-a?/c editor-admin%) false/c)]) +@defmethod[(set-admin [admin (or/c (is-a?/c editor-admin%) #f)]) void?]{ Sets the editor's administrator. This method is only called by an @@ -2087,7 +2119,7 @@ get-admin]}] } -@defmethod[(set-caret-owner [snip (or/c (is-a?/c snip%) false/c)] +@defmethod[(set-caret-owner [snip (or/c (is-a?/c snip%) #f)] [domain (one-of/c 'immediate 'display 'global) 'immediate]) void?]{ @@ -2127,8 +2159,8 @@ See also @method[editor<%> get-focus-snip]. } -@defmethod[(set-cursor [cursor (or/c (is-a?/c cursor%) false/c)] - [override? any/c @scheme[#t]]) +@defmethod[(set-cursor [cursor (or/c (is-a?/c cursor%) #f)] + [override? any/c #t]) void?]{ Sets the custom cursor for the editor to @scheme[cursor]. If @@ -2148,7 +2180,7 @@ An embedding editor's custom cursor can override the cursor of an } -@defmethod[(set-filename [filename (or/c path-string? false/c)] +@defmethod[(set-filename [filename (or/c path-string? #f)] [temporary? any/c #f]) void?]{ @@ -2172,7 +2204,7 @@ Sets the threshold for painting an inactive selection. See } -@defmethod[(set-keymap [keymap (or/c (is-a?/c keymap%) false/c) #f]) +@defmethod[(set-keymap [keymap (or/c (is-a?/c keymap%) #f) #f]) void?]{ Sets the current keymap for the editor. A @scheme[#f] argument removes @@ -2336,7 +2368,7 @@ recalculated on demand. See also @method[editor<%> invalidate-bitmap-cache].} -@defmethod[(style-has-changed [style (or/c (is-a?/c style<%>) false/c)]) +@defmethod[(style-has-changed [style (or/c (is-a?/c style<%>) #f)]) void?]{ Notifies the editor that a style in its style list has changed. This diff --git a/collects/scribblings/gui/editor-stream-in-base-class.scrbl b/collects/scribblings/gui/editor-stream-in-base-class.scrbl index adc5952ef4..ce4cfc8952 100644 --- a/collects/scribblings/gui/editor-stream-in-base-class.scrbl +++ b/collects/scribblings/gui/editor-stream-in-base-class.scrbl @@ -24,14 +24,18 @@ Returns @scheme[#t] if there has been an error reading from the @defmethod[(read [data (and/c vector? (not immutable?))]) exact-nonnegative-integer?]{ -Reads Latin-1 characters to fill the supplied vector. The return value is the - number of characters read, which may be less than the number +Like @method[editor-stream-in-base% read-bytes], but fills a supplied +vector with Latin-1 characters instead of filling a byte string. This method +is implemented by default via @method[editor-stream-in-base% read-bytes].} + +@defmethod[(read-bytes [bstr (and/c bytes? (not immutable?))]) + exact-nonnegative-integer?]{ + +Reads bytes to fill the supplied byte string. The return value is the + number of bytes read, which may be less than the number requested if the stream is emptied. If the stream is emptied, the next call to @method[editor-stream-in-base% bad?] must return - @scheme[#t]. - -} - + @scheme[#t].} @defmethod[(seek [pos exact-nonnegative-integer?]) void?]{ diff --git a/collects/scribblings/gui/editor-stream-out-base-class.scrbl b/collects/scribblings/gui/editor-stream-out-base-class.scrbl index d45aabb57f..9b02aab20a 100644 --- a/collects/scribblings/gui/editor-stream-out-base-class.scrbl +++ b/collects/scribblings/gui/editor-stream-out-base-class.scrbl @@ -39,6 +39,12 @@ Returns the current stream position. @defmethod[(write [data (listof char?)]) void?]{ -Writes data (encoded as Latin-1 characters) to the stream. +Writes data (encoded as Latin-1 characters) to the stream. This method +is implemented by default via @method[editor-stream-out-base% +write-bytes].} + +@defmethod[(write-bytes [bstr bytes?]) void?]{ + +Writes data to the stream.}} + -}} diff --git a/collects/scribblings/gui/editor-stream-out-class.scrbl b/collects/scribblings/gui/editor-stream-out-class.scrbl index 2499f448a3..d869eaf23a 100644 --- a/collects/scribblings/gui/editor-stream-out-class.scrbl +++ b/collects/scribblings/gui/editor-stream-out-class.scrbl @@ -62,8 +62,9 @@ This method is called by @scheme[write-editor-global-header]. Writes @scheme[v], or @scheme[n] bytes of @scheme[v]. -When @scheme[n] is supplied, use @method[editor-stream-in% - get-unterminated-bytes] to read the bytes later. +When @scheme[n] is supplied with a byte-string @scheme[v], use + @method[editor-stream-in% get-unterminated-bytes] to read the bytes + later. If @scheme[n] is not supplied and @scheme[v] is a byte string, then for historical reasons, the actual number of bytes written includes a @@ -85,9 +86,14 @@ Puts a fixed-sized integer into the stream. This method is needed fixed-size number. Numbers written to a stream with @method[editor-stream-out% put-fixed] - must be read with @method[editor-stream-in% get-fixed]. + must be read with @method[editor-stream-in% get-fixed].} + + +@defmethod[(put-unterminated [v bytes?]) (is-a?/c editor-stream-out%)]{ + +The same as calling @method[editor-stream-out% put] with +@scheme[(bytes-length v)] and @scheme[v].} -} @defmethod[(tell) exact-nonnegative-integer?]{ diff --git a/collects/scribblings/gui/pasteboard-class.scrbl b/collects/scribblings/gui/pasteboard-class.scrbl index d4e58bc65a..5c109bb628 100644 --- a/collects/scribblings/gui/pasteboard-class.scrbl +++ b/collects/scribblings/gui/pasteboard-class.scrbl @@ -499,7 +499,8 @@ Deletes @scheme[snip] when provided, or deletes the currently selected } -@defmethod[(do-copy [time (and/c exact? integer?)] +@defmethod[#:mode override + (do-copy [time (and/c exact? integer?)] [extend? any/c]) void?]{ @@ -523,7 +524,8 @@ Copies the current selection, extending the current clipboard contexts }} -@defmethod[(do-paste [time (and/c exact? integer?)]) +@defmethod[#:mode override + (do-paste [time (and/c exact? integer?)]) void?]{ @methspec{ @@ -544,7 +546,8 @@ Pastes. }} -@defmethod[(do-paste-x-selection [time (and/c exact? integer?)]) +@defmethod[#:mode override + (do-paste-x-selection [time (and/c exact? integer?)]) void?]{ @methspec{ @@ -806,7 +809,7 @@ Deselects all selected snips in the editor. } -@defmethod[#:mode override +@defmethod[#:mode override (on-default-event [event (is-a?/c mouse-event%)]) void?]{ diff --git a/collects/scribblings/gui/text-class.scrbl b/collects/scribblings/gui/text-class.scrbl index 1b0f04dde4..3635683ed6 100644 --- a/collects/scribblings/gui/text-class.scrbl +++ b/collects/scribblings/gui/text-class.scrbl @@ -324,12 +324,12 @@ See also @method[text% hide-caret]. @defmethod*[#:mode extend - ([(change-style [delta (or/c (is-a?/c style-delta%) false/c)] + ([(change-style [delta (or/c (is-a?/c style-delta%) #f)] [start (or/c exact-nonnegative-integer? (one/of 'start)) 'start] [end (or/c exact-nonnegative-integer? (one/of 'end)) 'end] [counts-as-mod? any/c #t]) void?] - [(change-style [style (or/c (is-a?/c style<%>) false/c)] + [(change-style [style (or/c (is-a?/c style<%>) #f)] [start (or/c exact-nonnegative-integer? (one/of 'start)) 'start] [end (or/c exact-nonnegative-integer? (one/of 'end)) 'end] [counts-as-mod? any/c #t]) @@ -422,7 +422,8 @@ Deletes the specified range or the currently selected text (when no } -@defmethod[(do-copy [start exact-nonnegative-integer?] +@defmethod[#:mode override + (do-copy [start exact-nonnegative-integer?] [end exact-nonnegative-integer?] [time (and/c exact? integer?)] [extend? any/c]) @@ -446,7 +447,8 @@ Copy the data from @scheme[start] to @scheme[end], extending the current }} -@defmethod[(do-paste [start exact-nonnegative-integer?] +@defmethod[#:mode override + (do-paste [start exact-nonnegative-integer?] [time (and/c exact? integer?)]) void?]{ @methspec{ @@ -467,7 +469,8 @@ Pastes into the @techlink{position} @scheme[start]. }} -@defmethod[(do-paste-x-selection [start exact-nonnegative-integer?] +@defmethod[#:mode override + (do-paste-x-selection [start exact-nonnegative-integer?] [time (and/c exact? integer?)]) void?]{ @methspec{ @@ -500,7 +503,7 @@ See also @method[text% delete]. @defmethod[(find-line [y real?] - [on-it? (or/c (box/c any/c) false/c) #f]) + [on-it? (or/c (box/c any/c) #f) #f]) exact-nonnegative-integer?]{ Given a @techlink{location} in the editor, returns the line at the @@ -516,8 +519,17 @@ Given a @techlink{location} in the editor, returns the line at the } -@defmethod[(find-next-non-string-snip [after (or/c (is-a?/c snip%) false/c)]) - (or/c (is-a?/c snip%) false/c)]{ +@defmethod[(find-newline [direction (one-of/c 'forward 'backward) 'forward] + [start (or/c exact-nonnegative-integer? (one/of 'start)) 'start] + [end (or/c exact-nonnegative-integer? (one/of 'eof)) 'eof]) + (or/c exact-nonnegative-integer? #f)]{ + +Like @method[text% find-string], but specifically finds a paragraph +break (possibly more efficiently than searching text).} + + +@defmethod[(find-next-non-string-snip [after (or/c (is-a?/c snip%) #f)]) + (or/c (is-a?/c snip%) #f)]{ Given a snip, returns the next snip in the editor (after the given one) that is not an instance of @scheme[string-snip%]. If @@ -530,9 +542,9 @@ Given a snip, returns the next snip in the editor (after the given @defmethod[(find-position [x real?] [y real?] - [at-eol? (or/c (box/c any/c) false/c) #f] - [on-it? (or/c (box/c any/c) false/c) #f] - [edge-close? (or/c (box/c real?) false/c) #f]) + [at-eol? (or/c (box/c any/c) #f) #f] + [on-it? (or/c (box/c any/c) #f) #f] + [edge-close? (or/c (box/c real?) #f) #f]) exact-nonnegative-integer?]{ Given a @techlink{location} in the editor, returns the @techlink{position} at the @@ -557,9 +569,9 @@ See @|ateoldiscuss| for a discussion of the @scheme[at-eol?] argument. @defmethod[(find-position-in-line [line exact-nonnegative-integer?] [x real?] - [at-eol? (or/c (box/c any/c) false/c) #f] - [on-it? (or/c (box/c any/c) false/c) #f] - [edge-close? (or/c (box/c real?) false/c) #f]) + [at-eol? (or/c (box/c any/c) #f) #f] + [on-it? (or/c (box/c any/c) #f) #f] + [edge-close? (or/c (box/c real?) #f) #f]) exact-nonnegative-integer?]{ Given a @techlink{location} within a line of the editor, returns the @@ -579,8 +591,8 @@ See @method[text% find-position] for a discussion of @defmethod[(find-snip [pos exact-nonnegative-integer?] [direction (one-of/c 'before-or-none 'before 'after 'after-or-none)] - [s-pos (or/c (box/c exact-nonnegative-integer?) false/c) #f]) - (or/c (is-a?/c snip%) false/c)]{ + [s-pos (or/c (box/c exact-nonnegative-integer?) #f) #f]) + (or/c (is-a?/c snip%) #f)]{ Returns the snip at a given @techlink{position}, or @scheme[#f] if an appropriate snip cannot be found. @@ -615,7 +627,7 @@ can be any of the following: [end (or/c exact-nonnegative-integer? (one/of 'eof)) 'eof] [get-start? any/c #t] [case-sensitive? any/c #t]) - (or/c exact-nonnegative-integer? false/c)]{ + (or/c exact-nonnegative-integer? #f)]{ Finds an exact-match string in the editor and returns its @techlink{position}. If the string is not found, @scheme[#f] is returned. @@ -656,8 +668,8 @@ Finds all occurrences of a string using @method[text% find-string]. If } -@defmethod[(find-wordbreak [start (or/c (box/c exact-nonnegative-integer?) false/c)] - [end (or/c (box/c exact-nonnegative-integer?) false/c)] +@defmethod[(find-wordbreak [start (or/c (box/c exact-nonnegative-integer?) #f)] + [end (or/c (box/c exact-nonnegative-integer?) #f)] [reason (one-of/c 'caret 'line 'selection 'user1 'user2)]) void?]{ @@ -804,8 +816,8 @@ Returns @scheme[#t] if the editor is in overwrite mode, @scheme[#f] } -@defmethod[(get-position [start (or/c (box/c exact-nonnegative-integer?) false/c)] - [end (or/c (box/c exact-nonnegative-integer?) false/c) #f]) +@defmethod[(get-position [start (or/c (box/c exact-nonnegative-integer?) #f)] + [end (or/c (box/c exact-nonnegative-integer?) #f) #f]) void?]{ Returns the current selection range in @techlink{position}s. If @@ -823,7 +835,7 @@ and @method[text% get-end-position]. @defmethod[(get-region-data [start exact-nonnegative-integer?] [end exact-nonnegative-integer?]) - (or/c (is-a?/c editor-data%) false/c)]{ + (or/c (is-a?/c editor-data%) #f)]{ Gets extra data associated with a given region. See @|editordatadiscuss| for more information. @@ -854,7 +866,7 @@ Returns an inexact number that increments every time the editor is @defmethod[(get-snip-position [snip (is-a?/c snip%)]) - (or/c exact-nonnegative-integer? false/c)]{ + (or/c exact-nonnegative-integer? #f)]{ Returns the starting @techlink{position} of a given snip or @scheme[#f] if the snip is not in this editor. @@ -862,9 +874,9 @@ Returns the starting @techlink{position} of a given snip or } @defmethod[(get-snip-position-and-location [snip (is-a?/c snip%)] - [pos (or/c (box/c exact-nonnegative-integer?) false/c)] - [x (or/c (box/c real?) false/c) #f] - [y (or/c (box/c real?) false/c) #f]) + [pos (or/c (box/c exact-nonnegative-integer?) #f)] + [x (or/c (box/c real?) #f) #f] + [y (or/c (box/c real?) #f) #f]) boolean?]{ Gets a snip's @techlink{position} and top left @techlink{location} in editor @@ -911,9 +923,9 @@ See also @method[text% set-styles-sticky]. } -@defmethod[(get-tabs [length (or/c (box/c exact-nonnegative-integer?) false/c) #f] - [tab-width (or/c (box/c real?) false/c) #f] - [in-units (or/c (box/c any/c) false/c) #f]) +@defmethod[(get-tabs [length (or/c (box/c exact-nonnegative-integer?) #f) #f] + [tab-width (or/c (box/c real?) #f) #f] + [in-units (or/c (box/c any/c) #f) #f]) (listof real?)]{ Returns the current tab-position array as a list. @@ -964,8 +976,8 @@ Returns the distance from the top of the editor to the alignment } -@defmethod[(get-visible-line-range [start (or/c (box/c exact-nonnegative-integer?) false/c)] - [end (or/c (box/c exact-nonnegative-integer?) false/c)] +@defmethod[(get-visible-line-range [start (or/c (box/c exact-nonnegative-integer?) #f)] + [end (or/c (box/c exact-nonnegative-integer?) #f)] [all? any/c #t]) void?]{ @@ -985,8 +997,8 @@ If the editor is displayed by multiple canvases and @scheme[all?] is } -@defmethod[(get-visible-position-range [start (or/c (box/c exact-nonnegative-integer?) false/c)] - [end (or/c (box/c exact-nonnegative-integer?) false/c)] +@defmethod[(get-visible-position-range [start (or/c (box/c exact-nonnegative-integer?) #f)] + [end (or/c (box/c exact-nonnegative-integer?) #f)] [all? any/c #t]) void?]{ @@ -1523,7 +1535,9 @@ If the paragraph ends with invisible @techlink{item}s (such as a carriage @defmethod[(paragraph-start-line [paragraph exact-nonnegative-integer?]) exact-nonnegative-integer?]{ -Returns the starting line of a given paragraph. @|ParagraphNumbering| @|LineNumbering| +Returns the starting line of a given paragraph. If @scheme[paragraph] +is greater than the highest-numbered paragraph, then the editor's end +@tech{position} is returned. @|ParagraphNumbering| @|LineNumbering| @|FCAMW| @|EVD| @@ -1548,13 +1562,17 @@ If the paragraph starts with invisible @techlink{item}s and @scheme[visible?] is @defmethod[#:mode override (paste [time (and/c exact? integer?) 0] - [start (or/c exact-nonnegative-integer? (one/of 'end)) 'end] + [start (or/c exact-nonnegative-integer? (one/of 'start 'end)) 'start] [end (or/c exact-nonnegative-integer? (one/of 'same)) 'same]) void?]{ -Pastes into the specified range. If @scheme[start] is @scheme['end], then - the current selection end @techlink{position} is used. If @scheme[end] is - @scheme['same], then @scheme[start] is used for @scheme[end]. +Pastes into the specified range. If @scheme[start] is @scheme['start], + then the current selection start @techlink{position} is used. If + @scheme[start] is @scheme['end], then the current selection end + @techlink{position} is used. If @scheme[end] is @scheme['same], then + @scheme[start] is used for @scheme[end], unless @scheme[start] is + @scheme['start], in which case the current selection end + @techlink{position} is used. See @|timediscuss| for a discussion of the @scheme[time] argument. If @scheme[time] is outside the platform-specific range of times, @@ -1586,13 +1604,17 @@ If the previous operation on the editor was not a paste, calling @defmethod[#:mode override (paste-x-selection [time (and/c exact? integer?)] - [start (or/c exact-nonnegative-integer? (one/of 'end)) 'end] + [start (or/c exact-nonnegative-integer? (one/of 'start 'end)) 'start] [end (or/c exact-nonnegative-integer? (one/of 'same)) 'same]) void?]{ -Pastes into the specified range. If @scheme[start] is @scheme['end], then - the current selection end @techlink{position} is used. If @scheme[end] is - @scheme['same], then @scheme[start] is used for @scheme[end]. +Pastes into the specified range. If @scheme[start] is @scheme['start], + then the current selection start @techlink{position} is used. If + @scheme[start] is @scheme['end], then the current selection end + @techlink{position} is used. If @scheme[end] is @scheme['same], then + @scheme[start] is used for @scheme[end], unless @scheme[start] is + @scheme['start], in which case the current selection end + @techlink{position} is used. See @|timediscuss| for a discussion of the @scheme[time] argument. If @scheme[time] is outside the platform-specific range of times, @@ -1616,8 +1638,8 @@ See @|ateoldiscuss| for a discussion of @scheme[at-eol?]. @defmethod[(position-location [start exact-nonnegative-integer?] - [x (or/c (box/c real?) false/c) #f] - [y (or/c (box/c real?) false/c) #f] + [x (or/c (box/c real?) #f) #f] + [y (or/c (box/c real?) #f) #f] [top? any/c #t] [at-eol? any/c #f] [whole-line? any/c #f]) @@ -1647,10 +1669,10 @@ maximum bottom @techlink{location} for the whole line is returned in @scheme[y]. @defmethod[(position-locations [start exact-nonnegative-integer?] - [top-x (or/c (box/c real?) false/c) #f] - [top-y (or/c (box/c real?) false/c) #f] - [bottom-x (or/c (box/c real?) false/c) #f] - [bottom-y (or/c (box/c real?) false/c) #f] + [top-x (or/c (box/c real?) #f) #f] + [top-y (or/c (box/c real?) #f) #f] + [bottom-x (or/c (box/c real?) #f) #f] + [bottom-y (or/c (box/c real?) #f) #f] [at-eol? any/c #f] [whole-line? any/c #f]) void?]{ @@ -1750,8 +1772,8 @@ If @scheme[on?] is not @scheme[#f], then the selection will be } -@defmethod[(set-autowrap-bitmap [bitmap (or/c (is-a?/c bitmap%) false/c)]) - (or/c (is-a?/c bitmap%) false/c)]{ +@defmethod[(set-autowrap-bitmap [bitmap (or/c (is-a?/c bitmap%) #f)]) + (or/c (is-a?/c bitmap%) #f)]{ Sets the bitmap that is drawn at the end of a line when it is automatically line-wrapped. @@ -1790,7 +1812,7 @@ See also exact-nonnegative-integer? exact-nonnegative-integer?) . -> . any)] - [hilite-delta (or/c (is-a?/c style-delta%) false/c) #f] + [hilite-delta (or/c (is-a?/c style-delta%) #f) #f] [call-on-down? any/c #f]) void?]{ @@ -2010,8 +2032,8 @@ Setting tabs is disallowed when the editor is internally locked for } -@defmethod[(set-wordbreak-func [f ((is-a?/c text%) (or/c (box/c exact-nonnegative-integer?) false/c) - (or/c (box/c exact-nonnegative-integer?) false/c) +@defmethod[(set-wordbreak-func [f ((is-a?/c text%) (or/c (box/c exact-nonnegative-integer?) #f) + (or/c (box/c exact-nonnegative-integer?) #f) symbol? . -> . any)]) void?]{ @@ -2036,7 +2058,7 @@ Since the wordbreak function will be called when line breaks are being } -@defmethod[(set-wordbreak-map [map (or/c (is-a?/c editor-wordbreak-map%) false/c)]) +@defmethod[(set-wordbreak-map [map (or/c (is-a?/c editor-wordbreak-map%) #f)]) void?]{ Sets the wordbreaking map that is used by the standard wordbreaking diff --git a/collects/scribblings/guide/proc-macros.scrbl b/collects/scribblings/guide/proc-macros.scrbl index b76a5ec6d8..07461ab295 100644 --- a/collects/scribblings/guide/proc-macros.scrbl +++ b/collects/scribblings/guide/proc-macros.scrbl @@ -115,7 +115,7 @@ unwrapping a pair, in which case the @scheme[cdr] of the pair may be recursively unwrapped, depending on how the syntax object was constructed. -The oppose of @scheme[syntax->datum] is, of course, +The opposite of @scheme[syntax->datum] is, of course, @scheme[datum->syntax]. In addition to a datum like @scheme['(+ 1 2)], @scheme[datum->syntax] needs an existing syntax object to donate its lexical context, and optionally another syntax object to donate @@ -322,7 +322,7 @@ the source form are identifiers. We could use a ] The @scheme[check-ids] function can use the @scheme[syntax->list] -function to convert a synatx-object wrapping a list into a list +function to convert a syntax-object wrapping a list into a list of syntax objects: @schemeblock[ diff --git a/collects/scribblings/reference/eval-model.scrbl b/collects/scribblings/reference/eval-model.scrbl index 4e073ec0e3..eeba29eb61 100644 --- a/collects/scribblings/reference/eval-model.scrbl +++ b/collects/scribblings/reference/eval-model.scrbl @@ -563,18 +563,21 @@ If a module @tech{instantiate}d at @tech{phase} @math{n} first @tech{instantiate}d at phase @math{n}, and so on transitively. (Module @scheme[require]s cannot form cycles.) If a module @tech{instantiate}d at phase @math{n} @scheme[require]s -@scheme[for-syntax] another module, the other module is first -@tech{instantiate}d at @tech{phase} @math{n+1}, and so on. If a -module @tech{instantiate}d at phase @math{n} for non-zero @math{n} -@scheme[require]s @scheme[for-template] another module, the other -module is first @tech{instantiate}d at @tech{phase} @math{n-1}, and so -on. +@scheme[for-syntax] another module, the other module becomes +@deftech{available} at @tech{phase} @math{n+1}, and it may later be +@tech{instantiate}d at @tech{phase} @math{n+1}. If a module that is +@tech{available} at phase @math{n} for @math{n>0} @scheme[require]s +@scheme[for-template] another module, the other module becomes +@tech{available} at @tech{phase} @math{n-1}, and so +on. @tech{Instantiation}s of @tech{available} modules above +@tech{phase} 0 are triggered on demand as described in +@secref["mod-parse"]. A final distinction among module @tech{instantiations} is that -multiple @tech{instantiations} may exist at @tech{phase} 1 and higher. These -@tech{instantiations} are created by the parsing of module forms (see -@secref["mod-parse"]), and are, again, conceptually distinguished -by prefixes. +multiple @tech{instantiations} may exist at @tech{phase} 1 and +higher. These @tech{instantiations} are created by the parsing of +module forms (see @secref["mod-parse"]), and are, again, conceptually +distinguished by prefixes. Top-level variables can exist in multiple phases in the same way as within modules. For example, @scheme[define-for-syntax] creates a diff --git a/collects/scribblings/reference/hashes.scrbl b/collects/scribblings/reference/hashes.scrbl index 1a50e06a55..72d88b6df3 100644 --- a/collects/scribblings/reference/hashes.scrbl +++ b/collects/scribblings/reference/hashes.scrbl @@ -47,9 +47,10 @@ a table-specific semaphore as needed. Three caveats apply, however: @itemize[ @item{If a thread is terminated while applying @scheme[hash-ref], - @scheme[hash-set!], or @scheme[hash-remove!] to a hash table that + @scheme[hash-set!], @scheme[hash-remove!], @scheme[hash-ref!], + or @scheme[has-update!] to a hash table that uses @scheme[equal?] or @scheme[eqv?] key comparisons, all current - and future operations on the hash table block indefinitely.} + and future operations on the hash table may block indefinitely.} @item{The @scheme[hash-map] and @scheme[hash-for-each] procedures do not use the table's semaphore. Consequently, if a hash table is @@ -63,7 +64,8 @@ a table-specific semaphore as needed. Three caveats apply, however: otherwise the traversal skips a deleted key or uses the remapped key's new value).} - @item{The @scheme[hash-update!] function uses a table's semaphore + @item{The @scheme[hash-update!] and @scheme[hash-set!] functions + use a table's semaphore independently for the @scheme[hash-ref] and @scheme[hash-set!] parts of its functionality, which means that the update as a whole is not ``atomic.''} @@ -209,15 +211,17 @@ Returns the value for @scheme[key] in @scheme[hash]. If no value is found for @scheme[key], then @scheme[to-set] determines the result as in @scheme[hash-ref] (i.e., it is either a thunk that computes a value or a plain value), and this result is stored in @scheme[hash] for the -@scheme[key]. (Note that is @scheme[to-set] is a thunk, it is not -invoked in tail position.)} +@scheme[key]. (Note that if @scheme[to-set] is a thunk, it is not +invoked in tail position.) + +@see-also-caveats[]} @defproc[(hash-has-key? [hash hash?] [key any/c]) - any]{ + boolean?]{ -Returns a true value if @scheme[hash] contains the given -@scheme[key].} +Returns @scheme[#t] if @scheme[hash] contains a value for the given +@scheme[key], @scheme[#f] otherwise.} @defproc[(hash-update! [hash (and/c hash? (not/c immutable?))] diff --git a/collects/scribblings/reference/module-reflect.scrbl b/collects/scribblings/reference/module-reflect.scrbl index e01b6a0151..941f6fa03a 100644 --- a/collects/scribblings/reference/module-reflect.scrbl +++ b/collects/scribblings/reference/module-reflect.scrbl @@ -322,27 +322,29 @@ See also @scheme[module->language-info].} [fail-thunk (-> any) (lambda () ....)]) any]{ -Dynamically instantiates the module specified by @scheme[mod] for -@tech{phase} 0 in the current namespace's registry, if it is not yet -@tech{instantiate}d. The current @tech{module name resolver} may load -a module declaration to resolve @scheme[mod] (see -@scheme[current-module-name-resolver]); the path is resolved relative -to @scheme[current-load-relative-directory] and/or +Dynamically @tech{instantiates} the module specified by @scheme[mod] +in the current namespace's registry at the namespace's @tech{base +phase}, if it is not yet @tech{instantiate}d. The current @tech{module +name resolver} may load a module declaration to resolve @scheme[mod] +(see @scheme[current-module-name-resolver]); the path is resolved +relative to @scheme[current-load-relative-directory] and/or @scheme[current-directory]. If @scheme[provided] is @scheme[#f], then the result is @|void-const|, -and the module is not @tech{visit}ed (see @secref["mod-parse"]). +and the module is not @tech{visit}ed (see @secref["mod-parse"]) or +even made @tech{available} (for on-demand @tech{visits}) in phases +above the @tech{base phase}. When @scheme[provided] is a symbol, the value of the module's export with the given name is returned, and still the module is not @tech{visit}ed. If the module exports @scheme[provide] as syntax, then a use of the binding is expanded and evaluated in a fresh namespace to which the module is attached, which means that the module is -@tech{visit}ed. If the module has no such exported variable or syntax, -then @scheme[fail-thunk] is called; the default @scheme[fail-thunk] -raises @scheme[exn:fail:contract]. If the variable named by -@scheme[provided] is exported protected (see @secref["modprotect"]), -then the @exnraise[exn:fail:contract]. +@tech{visit}ed in the fresh namespace. If the module has no such +exported variable or syntax, then @scheme[fail-thunk] is called; the +default @scheme[fail-thunk] raises @scheme[exn:fail:contract]. If the +variable named by @scheme[provided] is exported protected (see +@secref["modprotect"]), then the @exnraise[exn:fail:contract]. If @scheme[provided] is @|void-const|, then the module is @tech{visit}ed but not @tech{instantiate}d (see @secref["mod-parse"]), @@ -354,7 +356,8 @@ and the result is @|void-const|.} [fail-thunk (-> any) (lambda () ....)]) any]{ -Like @scheme[dynamic-require], but in @tech{phase} 1.} +Like @scheme[dynamic-require], but in a @tech{phase} that is @math{1} +more than the namespace's @tech{base phase}.} @defproc[(module->language-info [mod module-path?]) diff --git a/collects/scribblings/reference/namespaces.scrbl b/collects/scribblings/reference/namespaces.scrbl index 30291a3a1a..27e2732f01 100644 --- a/collects/scribblings/reference/namespaces.scrbl +++ b/collects/scribblings/reference/namespaces.scrbl @@ -252,17 +252,17 @@ path, but no module is loaded; the resolved form of @scheme[modname] is used as the module name in @scheme[dest-namespace]. In addition to @scheme[modname], every module that it imports (directly or indirectly) is also recorded in the current namespace's @tech{module -registry}. The inspector of the module invocation in -@scheme[dest-namespace] is the same as inspector of the invocation in -@scheme[src-namespace]. +registry}, and instances at the same @tech{phase} or lower are also +attached to @scheme[dest-namespace] (while @tech{visits} at the +module's phase and instances at higher phases are not attached, nor +even made @tech{available} for on-demand @tech{visits}). The inspector +of the module invocation in @scheme[dest-namespace] is the same as +inspector of the invocation in @scheme[src-namespace]. If @scheme[modname] does not refer to an @tech{instantiate}d module in @scheme[src-namespace], or if the name of any module to be attached -already has a different declaration or instance in -@scheme[dest-namespace], then the @exnraise[exn:fail:contract]. If -the module to attach has not been @tech{visit}ed (see -@secref["mod-parse"]), then it is @tech{visit}ed in the original -namespace before being attached. +already has a different declaration or same-@tech{phase} instance in +@scheme[dest-namespace], then the @exnraise[exn:fail:contract]. If @scheme[src-namespace] and @scheme[dest-namespace] do not have the same @tech{base phase}, then the @exnraise[exn:fail:contract].} diff --git a/collects/scribblings/reference/syntax-model.scrbl b/collects/scribblings/reference/syntax-model.scrbl index e47a8cc5c2..594c3dec9a 100644 --- a/collects/scribblings/reference/syntax-model.scrbl +++ b/collects/scribblings/reference/syntax-model.scrbl @@ -647,29 +647,46 @@ or @scheme[define-syntaxes] form, expansion fails with a syntax error. A @scheme[require] form not only introduces @tech{bindings} at expansion time, but also @deftech{visits} the referenced module when it is encountered by the expander. That is, the expander -@tech{instantiate}s any @scheme[define-for-syntax]ed variables defined +instantiates any @scheme[define-for-syntax]ed variables defined in the module, and also evaluates all expressions for @scheme[define-syntaxes] @tech{transformer bindings}. Module @tech{visits} propagate through @scheme[require]s in the same way as module @tech{instantiation}. Moreover, when a module is -@tech{visit}ed, any module that it @scheme[require]s -@scheme[for-syntax] is @tech{instantiate}d at @tech{phase} 1, with the -adjustment that @scheme[require] @scheme[for-template]s leading back -to @tech{phase} 0 causes the required module to be merely visited at -@tech{phase} 0, not @tech{instantiate}d. +@tech{visit}ed at @tech{phase} 0, any module that it @scheme[require]s +@scheme[for-syntax] is @tech{instantiate}d at @tech{phase} 1, while +further @scheme[require]s @scheme[for-template] leading back +to @tech{phase} 0 causes the required module to be visited at +@tech{phase} 0 (i.e., not @tech{instantiate}d). -When the expander encounters @scheme[(require (for-syntax ....))], it -immediately instantiates the required module at @tech{phase} 1, in -addition to adding bindings scheme @tech{phase level} 1 (i.e., the -@tech{transformer environment}). +During compilation, the top-level of module context is itself +implicitly @tech{visit}ed. Thus, when the expander encounters +@scheme[(require (for-syntax ....))], it immediately +@tech{instantiate}s the required module at @tech{phase} 1, in addition +to adding bindings at @tech{phase level} 1 (i.e., the +@tech{transformer environment}). Similarly, the expander immediately +evaluates any @scheme[define-values-for-syntax] form that it +encounters. + +@tech{Phases} beyond 0 are @tech{visit}ed on demand. For example, +when the right-hand side of a @tech{phase}-0 @scheme[let-syntax] is to +be expanded, then modules that are @tech{available} at @tech{phase} 1 +are visited. More generally, initiating expansion at @tech{phase} +@math{n} @tech{visit}s modules at @tech{phase} @math{n}, which in turn +@tech{instantiates} modules at @tech{phase} @math{n+1}. These +@tech{visits} and @tech{instantiations} apply to @tech{available} +modules in the enclosing @tech{namespace}. When the expander encounters @scheme[require] and @scheme[(require (for-syntax ....))] within a @tech{module context}, the resulting @tech{visits} and @tech{instantiations} are specific to the expansion of the enclosing module, and are kept separate from @tech{visits} and @tech{instantiations} triggered from a @tech{top-level context} or -from the expansion of a different module. +from the expansion of a different module. Along the same lines, when a +module is attached to a namespace through +@scheme[namespace-attach-module], modules that it @scheme[require]s +are transitively attached, but instances are attached only at +phases at or below the namespace's @tech{base phase}. @;------------------------------------------------------------------------ @section[#:tag "compilation-model"]{Compilation} @@ -742,10 +759,11 @@ reflective operations such as @scheme[eval] and After a namespace is created, module instances from existing namespaces can be attached to the new namespace. In terms of the evaluation model, top-level variables from different namespaces -essentially correspond to definitions with different prefixes. -Furthermore, the first step in evaluating any compiled expression is -to link its top-level variable and module-level variable references to -specific variables in the namespace. +essentially correspond to definitions with different prefixes, but +attaching a module uses the same prefix for the module's definitions +in namespaces where it is attached. The first step in evaluating any +compiled expression is to link its top-level variable and module-level +variable references to specific variables in the namespace. At all times during evaluation, some namespace is designated as the @deftech{current namespace}. The current namespace has no particular diff --git a/collects/scribblings/reference/syntax.scrbl b/collects/scribblings/reference/syntax.scrbl index 9f106e198a..856d6714f8 100644 --- a/collects/scribblings/reference/syntax.scrbl +++ b/collects/scribblings/reference/syntax.scrbl @@ -272,12 +272,13 @@ Legal only in a @tech{module begin context}, and handled by the ((unsyntax (schemeidfont "+")) nat) ((unsyntax (schemeidfont "-")) nat)])]{ -In a @tech{top-level context}, @scheme[require] instantiates modules -(see @secref["module-eval-model"]). In a @tech{module context}, -@scheme[require] @tech{visits} modules (see @secref["mod-parse"]). In -both contexts, @scheme[require] introduces bindings into a -@tech{namespace} or a module (see @secref["intro-binding"]). -A @scheme[require] form in a @tech{expression context} or +In a @tech{top-level context}, @scheme[require] @tech{instantiates} +modules (see @secref["module-eval-model"]). In a @tech{top-level +context} or @tech{module context}, expansion of @scheme[require] +@tech{visits} modules (see @secref["mod-parse"]). In both contexts and +both evaluation and expansion, @scheme[require] introduces bindings +into a @tech{namespace} or a module (see @secref["intro-binding"]). A +@scheme[require] form in a @tech{expression context} or @tech{internal-definition context} is a syntax error. A @scheme[require-spec] designates a particular set of identifiers to diff --git a/collects/sirmail/readr.ss b/collects/sirmail/readr.ss index 23ab647ec6..b278fa47e6 100644 --- a/collects/sirmail/readr.ss +++ b/collects/sirmail/readr.ss @@ -2395,8 +2395,10 @@ (send header-list focus) - (for-each add-message mailbox) - + (send (send header-list get-editor) begin-edit-sequence) + (for-each add-message mailbox) + (send (send header-list get-editor) end-edit-sequence) + (send main-frame create-status-line) (send main-frame show #t) diff --git a/collects/tests/mred/media8.mre b/collects/tests/mred/media8.mre index 3b2f394b48..3f19360e0e 100644 --- a/collects/tests/mred/media8.mre +++ b/collects/tests/mred/media8.mre @@ -1,17 +1,20 @@ #reader(lib"read.ss""wxme")WXME0108 ## +#| + This file is in PLT Scheme editor format. Open this file in DrScheme version 370 or later to read it. - Open this file in DrScheme version 370 or later to read it. - Most likely, it was created by saving a program in DrScheme version - 370 or later, and it probably contains a program with non-text - elements (such as images or comment boxes). - www.plt-scheme.org + + Most likely, it was created by saving a program in DrScheme, + and it probably contains a program with non-text elements + (such as images or comment boxes). + + http://www.plt-scheme.org |# 4 7 #"wxtext\0" 3 1 6 #"wxtab\0" 1 1 8 #"wxmedia\0" -3 1 8 #"wximage\0" +4 1 8 #"wximage\0" 2 0 1 6 #"wxloc\0" -00000000000 1 26 0 9 #"Standard\0" +00000000000 1 19 0 9 #"Standard\0" 0 70 1 #"\0" 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 #"\0" 0 70 1 #"\0" @@ -50,25 +53,11 @@ 0 75 1 #"\0" 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 #"\0" 0 70 1 #"\0" -1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 2 1 1 1 #"\0" -0 71 1 #"\0" -1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 -1 1 1 #"\0" -0 70 1 #"\0" -1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 -1 1 1 #"\0" -0 72 1 #"\0" -1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 -1 1 1 #"\0" -0 73 1 #"\0" -1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 -1 1 1 #"\0" -0 74 1 #"\0" -1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 -1 1 1 #"\0" -0 75 1 #"\0" -1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 -1 1 1 #"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 -1 -00000000002 0 00000000000 2 00000000000 41 0 1 3 44 +1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 2 1 00000000002 +0 00000000000 2 00000000000 40 0 1 3 44 #"This is a line of plain text (default font)." 0 0 1 29 1 #"\n" -0 2 1 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 00000000000 2 3 0 9 +0 2 1 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 0 00000000000 2 3 0 9 #"Standard\0" 0 70 1 #"\0" 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 #"\0" @@ -76,13 +65,13 @@ 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 00000000000 1 0 1 3 38 #"This is a line of plain text in a box." 0 00000000000 0 0 1 29 1 #"\n" -0 2 1 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 00000000000 3 3 0 9 +0 2 1 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 0 00000000000 3 3 0 9 #"Standard\0" 0 70 1 #"\0" 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 #"\0" 0 70 1 #"\0" 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 00000000000 -1 2 1 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 00000000000 4 3 0 9 +1 2 1 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 0 00000000000 4 3 0 9 #"Standard\0" 0 70 1 #"\0" 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 #"\0" @@ -97,7 +86,7 @@ 0 0 5 3 29 #"This has a yellow background." 0 0 1 29 1 #"\n" 0 0 7 3 34 #"Top aligned (compared to the box)." -0 2 1 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 00000000000 5 5 0 9 +0 2 1 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 0 00000000000 5 5 0 9 #"Standard\0" 0 70 1 #"\0" 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 #"\0" @@ -112,7 +101,7 @@ 0 0 1 29 1 #"\n" 0 0 4 3 3 #"Red" 0 0 4 29 1 #"\n" -0 2 4 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 00000000000 6 4 0 9 +0 2 4 1 1 5 5 5 5 1 1 1 1 -1 -1 -1 -1 0 0 0 00000000000 6 4 0 9 #"Standard\0" 0 70 1 #"\0" 1 0 90 90 90 90 3 3 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 #"\0" @@ -138,15 +127,14 @@ 0 0 7 29 1 #"\n" 0 0 12 3 19 #"(2 points smaller.)" 0 0 7 29 1 #"\n" -0 0 19 3 11 #"Decorative." -0 0 20 3 1 #" " -0 0 21 3 6 #"Roman." -0 0 20 3 1 #" " -0 0 22 3 7 #"Script." -0 0 20 3 1 #" " -0 0 23 3 6 #"Swiss." -0 0 20 3 1 #" " -0 0 24 3 6 #"Fixed." -0 0 25 3 53 #" (Last line changed to bottom-aligned for version 8.)" -0 0 20 29 1 #"\n" +0 0 13 3 11 #"Decorative." +0 0 7 3 1 #" " +0 0 14 3 6 #"Roman." +0 0 7 3 1 #" " +0 0 15 3 7 #"Script." +0 0 7 3 1 #" " +0 0 16 3 6 #"Swiss." +0 0 7 3 1 #" " +0 0 17 3 6 #"Fixed." +0 0 7 29 1 #"\n" 0 00000000000 diff --git a/collects/tests/mred/test-editor-admin.ss b/collects/tests/mred/test-editor-admin.ss new file mode 100644 index 0000000000..d07323663c --- /dev/null +++ b/collects/tests/mred/test-editor-admin.ss @@ -0,0 +1,44 @@ +#lang scheme/base +(require scheme/class + scheme/gui/base) + +(provide test-editor-admin%) + +(define the-dc + (new (class* bitmap-dc% () + (super-new) + (define/override (get-text-extent s [font #f] [combine? #f] [offset 0]) + (values (* 10.0 (string-length s)) 10.0 1.0 1.0)) + (define/override (set-pen . p) (void)) + (define/override (get-pen . p) #f) + (define/override (set-brush . b) (void)) + (define/override (get-brush . b) #f) + (define/override (set-clipping-rect . b) (void)) + (define/override (get-clipping-region . b) #f) + (define/override (draw-text s x y combine? offset count) (void)) + (define/override (cache-font-metrics-key) 100)))) + + +(define test-editor-admin% + (class editor-admin% + (super-new) + + (define/override (get-dc [x #f] [y #f]) + (when x (set-box! x 1.0)) + (when y (set-box! y 1.0)) + the-dc) + + (define/private (do-get-view x y w h) + (when x (set-box! x 0.0)) + (when y (set-box! y 0.0)) + (when w (set-box! w 100.0)) + (when h (set-box! h 100.0))) + + (define/override (get-view x y w h [full? #f]) + (do-get-view x y w h)) + + (define/override (get-max-view x y w h [full? #f]) + (do-get-view x y w h)) + + (define/override (scroll-to x y w h refresh? bias) + (void)))) diff --git a/collects/tests/mred/wxme.ss b/collects/tests/mred/wxme.ss new file mode 100644 index 0000000000..695bce1791 --- /dev/null +++ b/collects/tests/mred/wxme.ss @@ -0,0 +1,1337 @@ +#lang scheme/base +(require scheme/class + (only-in scheme/gui/base + color% + font% + the-clipboard + clipboard-client% + key-event% + mouse-event%) + mred/private/wxme/snip + mred/private/wxme/mline + mred/private/wxme/style + mred/private/wxme/editor + mred/private/wxme/text + mred/private/wxme/pasteboard + "test-editor-admin.ss" + mred/private/wxme/stream + mred/private/wxme/keymap + mred/private/wxme/editor-snip) + +(define wrong-cnt 0) +(define test-cnt 0) + +(define (expect v v2) + (set! test-cnt (add1 test-cnt)) + (unless (equal? v v2) + (set! wrong-cnt (add1 wrong-cnt)) + (printf "EXPECTED ~s:\n" v2)) + v) + +(define (show v) + (print v) + (newline)) + +(define (expect* v v2) + (if (equal? v v2) + (set! test-cnt (add1 test-cnt)) + (show (expect v v2)))) + +(define (done) + (printf "\n~a tests\n" test-cnt) + (if (zero? wrong-cnt) + (printf "all passed\n") + (printf "~s FAILED\n" wrong-cnt))) + +;; ---------------------------------------- +;; String snips and lines + +(define s (make-object string-snip% "helko")) +(send s insert "cat " 4 2) +(send s get-text 0 (send s get-count)) +(send s set-flags (cons 'invisible (send s get-flags))) +(send s get-flags) +(send (send (get-the-snip-class-list) find "wxtext") get-classname) + +(define root-box (box mline-NIL)) +(define m20 (mline-insert #f root-box #t)) +(expect (mline-get-line m20) 0) +(define m00 (mline-insert m20 root-box #t)) +(expect (mline-get-line m00) 0) +(expect (mline-get-line m20) 1) +(expect (mline-get-position m00) 0) +(expect (mline-get-position m20) 0) +(mline-set-length m00 5) +(mline-set-length m20 20) +(expect (mline-get-position m00) 0) +(expect (mline-get-position m20) 5) + +(mline-check-consistent (unbox root-box)) + +;; ---------------------------------------- +;; Line inserts and deletes + +(define m5 (mline-insert m20 root-box #t)) +(mline-check-consistent (unbox root-box)) + +(mline-set-length m5 10) + +(expect (mline-get-position m00) 0) +(expect (mline-get-position m5) 5) +(expect (mline-get-position m20) 15) + +(mline-delete m5 root-box) +(expect (mline-get-position m20) 5) + +(set! m5 (mline-insert m20 root-box #t)) +(mline-set-length m5 8) + +(expect (mline-get-position m00) 0) +(expect (mline-get-position m5) 5) +(expect (mline-get-position m20) 13) + +(mline-delete m5 root-box) + +(mline-check-consistent (unbox root-box)) + +;; ---------------------------------------- +;; Line counts and positions + +(define m30 (mline-insert m20 root-box #f)) + +(expect (mline-get-line m00) 0) +(expect (mline-get-line m20) 1) +(expect (mline-get-line m30) 2) + +(expect (mline-get-position m00) 0) +(expect (mline-get-position m20) 5) +(expect (mline-get-position m30) 25) + +(mline-check-consistent (unbox root-box)) + +;; ---------------------------------------- +;; More line lines and positions + +(define m05 (mline-insert m00 root-box #f)) + +(mline-set-length m05 2) + +(expect (mline-get-line m00) 0) +(expect (mline-get-line m05) 1) +(expect (mline-get-line m20) 2) +(expect (mline-get-line m30) 3) + +(expect (mline-get-position m00) 0) +(expect (mline-get-position m05) 5) +(expect (mline-get-position m20) 7) +(expect (mline-get-position m30) 27) + +(mline-check-consistent (unbox root-box)) + +;; ---------------------------------------- +;; Line inserts and deletes, radomized + +(let ([added + (let loop ([l (list m00 m05 m20 m30)] + [n 100]) + (let ([m (mline-insert (list-ref l (random (length l))) + root-box + (zero? (random 2)))]) + (mline-check-consistent (unbox root-box)) + (if (zero? n) + (cons m l) + (loop (cons m l) (sub1 n)))))]) + (for-each (lambda (i) + (mline-delete i root-box) + (mline-check-consistent (unbox root-box))) + (cdr added)) + (show (expect (mline-next (car added)) #f)) + (show (expect (mline-prev (car added)) #f)) + (expect (unbox root-box) + (car added))) + +;; ---------------------------------------- +;; Styles, deltas, lists + +(define d1 (new style-delta%)) +(define d2 (new style-delta%)) +(expect (send d1 get-underlined-on) #f) +(expect (send d1 equal d2) #t) +(send d1 set-underlined-on #t) +(expect (send d1 equal d2) #f) +(send d2 collapse d1) +(expect (send d2 get-underlined-on) #t) +(send d2 set-underlined-on #f) +(send d1 copy d2) +(expect (send d1 get-underlined-on) #f) + +(define sl (new style-list%)) +(expect #t (eq? (send sl basic-style) (send sl basic-style))) +(define s-plain (send sl find-or-create-style (send sl basic-style) + (new style-delta%))) +(expect (send sl find-or-create-style (send sl basic-style) + (new style-delta%)) + s-plain) + +(send d1 set-underlined-on #t) +(define s-underlined (send sl find-or-create-style s-plain d1)) +(expect (send s-plain get-underlined) #f) +(expect (send s-underlined get-underlined) #t) + +(send d2 set-underlined-off #t) +(send d2 set-smoothing-on 'partly-smoothed) +(define s-nonunderlined1 (send sl find-or-create-style s-underlined d2)) +(expect (send s-nonunderlined1 get-underlined) #f) +(expect (send s-nonunderlined1 get-base-style) (send sl basic-style)) ; due to collpasing + +(define s-named-underlined (send sl new-named-style "underlined" s-underlined)) +(define s-nonunderlined (send sl find-or-create-style s-named-underlined d2)) +(expect (send s-nonunderlined get-underlined) #f) +(expect (send s-nonunderlined get-base-style) s-named-underlined) + +(send d1 set-family 'modern) +(define s-modern (send sl find-or-create-style s-plain d1)) +(expect (send s-modern get-underlined) #t) +(expect (send s-modern get-family) 'modern) +(expect (send s-plain get-family) 'default) + +(expect (send s-plain is-join?) #f) + +(define s-modern+nonunderlined (send sl find-or-create-join-style + s-modern + s-nonunderlined)) +(expect (send s-modern+nonunderlined get-underlined) #f) +(expect (send s-modern+nonunderlined get-smoothing) 'partly-smoothed) +(expect (send s-modern+nonunderlined get-family) 'modern) +(expect (send s-modern+nonunderlined is-join?) #t) + +(send d2 set-smoothing-on 'base) +(send s-nonunderlined set-delta d2) +(expect (send s-nonunderlined get-smoothing) 'default) +(expect (send s-modern+nonunderlined get-smoothing) 'default) + +(send d1 set-style-on 'italic) +(send s-modern set-delta d1) +(expect (send s-modern get-style) 'italic) +(expect (send s-modern+nonunderlined get-style) 'italic) + +(expect (send s-plain get-alignment) 'bottom) +(expect (send (send s-plain get-background) red) 255) +(expect (send s-plain get-base-style) (send sl basic-style)) +(expect (send s-modern+nonunderlined get-base-style) s-modern) +(expect (send s-plain get-face) #f) +(expect (send s-plain get-name) #f) +(expect (send s-plain get-shift-style) (send sl basic-style)) +(expect (send s-modern+nonunderlined get-shift-style) s-nonunderlined) +(expect (send s-plain get-size-in-pixels) #f) +(expect (send s-plain get-transparent-text-backing) #t) +(expect (send s-plain get-weight) 'normal) + +(expect (send s-nonunderlined get-base-style) s-named-underlined) +(send s-nonunderlined set-base-style s-modern+nonunderlined) ; would create cycle +(expect (send s-nonunderlined get-base-style) s-named-underlined) + +(send s-modern+nonunderlined set-base-style s-plain) +(expect (send s-modern+nonunderlined get-family) 'default) +(expect (send s-modern+nonunderlined get-style) 'normal) + +(send s-modern+nonunderlined set-shift-style s-modern+nonunderlined) ; would create cycle + +(define sl2 (new style-list%)) +(define s2-modern (send sl2 convert s-modern)) +(expect (send s2-modern get-family) 'modern) + +;; ---------------------------------------- +;; Lines, positions, paragraphs + +(define t (new text%)) +(expect (send t get-text) "") +(expect (send t last-position) 0) +(expect (send t get-start-position) 0) +(expect (send t get-end-position) 0) +(expect (send t position-line 0) 0) +(expect (send t position-paragraph 0) 0) + +(send t insert "hello") +(expect (send t get-text) "hello") +(expect (send t get-text 3) "lo") +(expect (send t get-text 2 4) "ll") +(expect (send t last-position) 5) +(expect (send t last-line) 0) +(expect (send t get-start-position) 5) +(expect (send t get-end-position) 5) +(expect (send t get-character 1) #\e) +(expect (send t position-line 1) 0) +(expect (send t position-paragraph 1) 0) + +(send t insert "!\nbye") +(expect (send t get-text) "hello!\nbye") +(expect (send t last-position) 10) +(expect (send t line-length 0) 7) +(expect (send t line-length 1) 3) +(expect (send t last-line) 1) +(expect (send t line-start-position 0) 0) +(expect (send t line-start-position 1) 7) +(expect (send t line-end-position 0) 6) +(expect (send t position-line 0) 0) +(expect (send t position-line 1) 0) +(expect (send t position-line 6) 0) +(expect (send t position-line 7 #t) 0) +(expect (send t position-line 7) 1) +(expect (send t position-line 10) 1) +(expect (send t position-paragraph 1) 0) +(expect (send t position-paragraph 6) 0) +(expect (send t position-paragraph 7 #t) 1) ; no eol ambiguity for paragraphs +(expect (send t position-paragraph 7) 1) +(expect (send t position-paragraph 8) 1) +(expect (send t get-start-position) 10) +(expect (send t get-end-position) 10) + +(send t set-position 7 8) +(expect (send t get-start-position) 7) +(expect (send t get-end-position) 8) +(expect + (let ([b (box 0)][e (box 0)]) + (list + (begin (send t get-position b) (unbox b)) + (begin (send t get-position #f e) (list (unbox b) (unbox e))))) + '(7 (7 8))) + +(send t insert ".\t," 2 4) +(expect (send t get-text) "he.\t,o!\nbye") +(expect (send t get-start-position) 8) +(expect (send t get-end-position) 9) + +(send t insert "\n3\n" 10) +(expect (send t get-text) "he.\t,o!\nby\n3\ne") +(expect (send t last-line) 3) +(expect (send t get-start-position) 8) +(expect (send t get-end-position) 9) +(send t set-position 100) +(expect (send t get-start-position) 14) +(expect (send t get-end-position) 14) +(send t set-position 14) +(expect (send t get-start-position) 14) +(expect (send t get-end-position) 14) + +(send t delete (send t last-position)) +(expect (send t get-text) "he.\t,o!\nby\n3\n") +(expect (send t last-line) 3) +(expect (send t get-start-position) 13) +(expect (send t get-end-position) 13) + +(send t insert "4" (send t last-position)) +(expect (send t get-text) "he.\t,o!\nby\n3\n4") +(expect (send t last-line) 3) +(send t delete 9 11) +(expect (send t last-line) 2) +(expect (send t get-text) "he.\t,o!\nb3\n4") + +(send t set-position 2 4) +(send t delete) +(expect (send t get-text) "he,o!\nb3\n4") +(expect (send t last-line) 2) +(expect (send t get-start-position) 2) +(expect (send t get-end-position) 2) +(expect (send t position-line 6) 1) +(expect (send t position-line 7) 1) +(expect (send t position-line 12) 2) + +(send t insert (make-object string-snip% "?") 2) +(expect (send t get-text) "he?,o!\nb3\n4") + +(expect (send t find-string "o") 4) +(expect (send t find-string "q") #f) +(expect (send t find-string "\n") 6) +(expect (send t find-string "\n" 'forward) 6) +(expect (send t find-string "\n" 'forward 7) 9) +(expect (send t find-string "\n" 'backward 7) 7) +(expect (send t find-string "\n" 'backward 9) 7) +(expect (send t find-string-all "\n") '(6 9)) +(expect (send t find-string-all "\n" 'forward 3 7) '(6)) +(expect (send t find-string-all "\n" 'backward 8 4) '(7)) +(expect (send t find-string-all "\n" 'backward 8 4 #f) '(6)) +(expect (send t find-string "\n4") 9) +(expect (send t find-string "O") #f) +(expect (send t find-string "O" 'forward 0 20 #t #f) 4) + +(expect (send t find-next-non-string-snip #f) #f) + +;; ---------------------------------------- + +;; Insert very long strings to test max-string-length handling +(send t delete 0 (send t last-position)) +(send t insert (make-string 256 #\a)) +(send t insert (make-string 256 #\a)) +(send t insert (make-string 256 #\a)) +(send t insert (make-string 256 #\a)) +(send t insert (make-string 1024 #\a)) +(expect (send t last-position) 2048) + +;; ---------------------------------------- +;; Moving and word boundaries + +(send t delete 0 (send t last-position)) +(send t insert "do you like\ngreen eggs and ham?") +(expect (send t position-paragraph 0) 0) +(expect (send t position-paragraph 12) 1) +(expect (send t paragraph-start-position 1) 12) +(expect (send t paragraph-start-position 2) 31) +(expect (send t find-newline 'forward 0) 12) +(expect (send t find-newline 'forward 12) 31) +(expect (send t get-text) "do you like\ngreen eggs and ham?") +(send t set-position 0) +(send t move-position 'right #f 'word) +(expect (send t get-start-position) 2) +(send t move-position 'right #f 'word) +(expect (send t get-start-position) 6) +(send t move-position 'left #f 'word) +(expect (send t get-start-position) 3) +(send t move-position 'right #f 'word) +(expect (send t get-start-position) 6) +(send t move-position 'right #f 'word) +(expect (send t get-start-position) 11) +(send t move-position 'right #f 'simple) +(send t move-position 'right #f 'word) +(expect (send t get-start-position) 17) +(send t set-position 11) +(send t move-position 'right #f 'word) +(expect (send t get-start-position) 17) + +(define (check-positions graphics?) + (define snips+counts + (let loop ([snip (send t find-first-snip)]) + (if snip + (cons (cons snip (send snip get-count)) + (loop (send snip next))) + null))) + + (let ([x (box 0.0)] + [y (box 0.0)]) + (let loop ([s+c snips+counts] + [pos 0]) + (unless (null? s+c) + (let ([p (send t get-snip-position (caar s+c))]) + (expect* p pos) + (let ([p2 (box 0)]) + (when graphics? + (if (send t get-snip-position-and-location (caar s+c) p2 x y) + (expect* (unbox p2) pos) + (show (expect #f #t)))) + (loop (cdr s+c) (+ pos (cdar s+c)))))))) + + (for-each + (lambda (before) + (let loop ([pos 0][s+c snips+counts][snip-pos 0]) + (if (null? s+c) + (show (expect pos (add1 (send t last-position)))) + (let* ([s-pos (box 0)] + [s (send t find-snip pos before s-pos)]) + (let ([es (if (and (= pos 0) (eq? before 'before-or-none)) + #f + (caar s+c))]) + (expect* s es) + (expect* (unbox s-pos) snip-pos) + (let ([next? (= pos (+ snip-pos (cdar s+c)))]) + (loop (add1 pos) + (if next? + (cdr s+c) + s+c) + (if next? + (+ snip-pos (cdar s+c)) + snip-pos)))))))) + '(before before-or-none)) + + (for-each + (lambda (after) + (let loop ([pos 0][s+c snips+counts][snip-pos 0][prev #f][prev-snip-pos 0]) + (let* ([s-pos (box 0)] + [s (send t find-snip pos after s-pos)] + [end? (null? s+c)] + [es (if end? + (if (eq? after 'after-or-none) + #f + (car prev)) + (caar s+c))] + [ep (if end? (if es prev-snip-pos 0) snip-pos)]) + (expect* s es) + (expect* (unbox s-pos) ep) + (if end? + (show (expect pos (send t last-position))) + (let ([next? (= (add1 pos) (+ snip-pos (cdar s+c)))]) + (loop (add1 pos) + (if next? + (cdr s+c) + s+c) + (if next? + (+ snip-pos (cdar s+c)) + snip-pos) + (car s+c) + snip-pos)))))) + '(after after-or-none))) + +(check-positions #f) + +;; ---------------------------------------- +;; Line flow + +;; Every character is 10.0 high, 10.0 wide, 1.0 descent, 1.0 top space +(send t set-admin (new test-editor-admin%)) + +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (list (begin + (send t position-location 1 x y) + (list (unbox x) (unbox y))) + (begin + (send t position-location 1 x y #f) + (list (unbox x) (unbox y))))) + '((10.0 0.0) (10.0 10.0))) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (list (begin + (send t position-location 14 x y) + (list (unbox x) (unbox y))) + (begin + (send t position-location 14 x y #f) + (list (unbox x) (unbox y))))) + '((20.0 11.0) (20.0 21.0))) +(expect (let ([w (box 0.0)] [h (box 0.0)]) + (send t get-extent w h) + (list (unbox w) (unbox h))) + '(192.0 22.0)) + +(expect (send t find-position 0.0 0.0) 0) +(expect (send t find-position 0.0 3.0) 0) +(expect (send t find-position 10.0 0.0) 1) +(expect (send t find-position 13.0 0.0) 1) +(expect (send t find-position 0.0 12.0) 12) +(expect (send t find-position 13.0 12.0) 13) +(expect (send t find-position 13.0 23.0) 31) +(expect (send t find-position 0.0 230.0) 31) +(expect (send t find-position 300.0 2.0) 11) +(expect (send t find-position -1.0 12.0) 12) +(expect (send t find-position 109.0 2.0) 10) +(expect (send t find-position 110.0 2.0) 11) +(expect (let ([b (box #f)]) + (send t find-position 1.0 12.0 #f b) + (unbox b)) + #t) +(expect (let ([b (box #f)] + [e (box 0.0)]) + (send t find-position -1.0 12.0 #f b e) + (list (unbox b) (unbox e))) + '(#f 100.0)) +(expect (let ([b (box #f)] + [e (box 0.0)]) + (list (send t find-position 109.0 2.0 #f b e) + (unbox b) + (unbox e))) + '(10 #t 1.0)) +(expect (let ([b (box #f)] + [e (box 0.0)]) + (list (send t find-position 102.0 2.0 #f b e) + (unbox b) + (unbox e))) + '(10 #t -2.0)) +(expect (let ([b (box #f)] + [e (box 0.0)]) + (list (send t find-position 110.0 2.0 #f b e) + (unbox b) + (unbox e))) + '(11 #f 100.0)) +(expect (send t find-position-in-line 0 14.0) 1) +(expect (send t find-position-in-line 1 14.0) 13) + +(send t set-position 1 1) +(send t move-position 'down #f 'line) +(expect (send t get-start-position) 13) +(send t move-position 'right #f 'simple) +(send t move-position 'up #f 'line) +(expect (send t get-start-position) 2) + +(check-positions #t) + +(send t set-max-width 71.0) + +(define (check-ge&h-flow) + (expect* (send t last-line) 6) + (expect* (send t line-start-position 0) 0) + (expect* (send t line-start-position 1) 3) + (expect* (send t line-start-position 2) 7) + (expect* (send t line-start-position 3) 12) + (expect* (send t line-start-position 4) 18) + (expect* (send t line-start-position 5) 23) + (expect* (send t line-start-position 6) 27) + (expect* (send t last-paragraph) 1) + (expect* (send t paragraph-start-position 0) 0) + (expect* (send t paragraph-end-position 0) 11) + (expect* (send t paragraph-start-position 1) 12) + (expect* (send t paragraph-end-position 1) 31) + (expect* (send t paragraph-start-position 2) 31) + (void)) +(check-ge&h-flow) + +(check-positions #t) + +(send t set-max-width 200.0) +(expect (send t last-line) 1) + +(send t set-max-width 71.0) +(check-ge&h-flow) + +(send t insert "Sir: " 0) +(expect (send t last-line) 7) +(expect (send t line-start-position 7) 32) +(send t delete 0 5) +(check-ge&h-flow) + +(define (check-line-starts) + (let ([lens (let loop ([snip (send t find-first-snip)][len 0]) + (if snip + (let ([len (+ len (send snip get-count))]) + (let ([s (send snip get-text 0 (send snip get-count))]) + (when (regexp-match? #rx"\n" s) + (unless (and (memq 'hard-newline (send snip get-flags)) + (string=? s "\n")) + (error "embedded newline!"))) + (if (or (memq 'newline (send snip get-flags)) + (memq 'hard-newline (send snip get-flags))) + (cons len (loop (send snip next) 0)) + (loop (send snip next) len)))) + (list len)))]) + (for/fold ([pos 0]) ([i (in-range (add1 (send t last-line)))] + [len (in-list lens)]) + (expect* (send t line-start-position i #f) pos) + (expect* (send t line-end-position i #f) (+ pos len)) + (+ pos len)))) + +(for-each + (lambda (str) + ;; (printf ">> ~a <<\n" str) + (for ([i (in-range (add1 (send t last-position)))]) + ;; (printf "~a\n" i) + (check-line-starts) + (send t insert str i) + (check-line-starts) + (send t last-line) + (send t delete i (+ i (string-length str))) + (check-line-starts) + (check-ge&h-flow))) + '(" a" "a " "qvzxw " " qvxzw" "qqq qqqq" "a\nb")) + +;; ---------------------------------------- +;; Undo + +(send t set-modified #f) +(send t set-max-undo-history 100) +(send t delete 0 3) +(expect (send t get-text) "you like\ngreen eggs and ham?") +(expect (send t modified?) #t) +(send t undo) +(expect (send t get-text) "do you like\ngreen eggs and ham?") +(expect (send t modified?) #f) +(send t redo) +(expect (send t modified?) #t) +(expect (send t get-text) "you like\ngreen eggs and ham?") +(send t set-position 0) +(send t insert #\d) +(send t insert #\o) +(send t insert #\space) +(expect (send t get-text) "do you like\ngreen eggs and ham?") +(send t undo) +(expect (send t get-text) "you like\ngreen eggs and ham?") +(send t redo) +(expect (send t get-text) "do you like\ngreen eggs and ham?") + +(send t begin-edit-sequence) +(send t delete 0 3) +(send t delete (- (send t last-position) 4) (send t last-position)) +(send t end-edit-sequence) +(expect (send t get-text) "you like\ngreen eggs and ") +(send t delete 0 4) +(expect (send t get-text) "like\ngreen eggs and ") +(send t undo) +(send t undo) +(expect (send t get-text) "do you like\ngreen eggs and ham?") + +;; ---------------------------------------- +;; Stream out base + +(define fbo (make-object editor-stream-out-bytes-base%)) +(expect (send fbo tell) 0) +(send fbo write-bytes #"abc") +(expect (send fbo tell) 3) +(expect (send fbo get-bytes) #"abc") +(send fbo seek 2) +(send fbo write-bytes #"012345" 1 4) +(expect (send fbo tell) 5) +(expect (send fbo get-bytes) #"ab123") +(expect (send fbo bad?) #f) +(send fbo write '(#\o #\l #\d)) +(expect (send fbo get-bytes) #"ab123old") + +;; ---------------------------------------- +;; Stream in base + +(define fbi (make-object editor-stream-in-bytes-base% #"ab123old")) +(define ibuf (make-bytes 3)) +(expect (send fbi tell) 0) +(send fbi read-bytes ibuf) +(expect ibuf #"ab1") +(expect (send fbi tell) 3) +(send fbi seek 2) +(send fbi read-bytes ibuf 1 2) +(expect ibuf #"a11") +(send fbi skip 2) +(send fbi read-bytes ibuf 0 2) +(expect ibuf #"ol1") +(expect (send fbi bad?) #f) + +;; ---------------------------------------- +;; Stream writing + +(define fbo2 (make-object editor-stream-out-bytes-base%)) +(define fo (make-object editor-stream-out% fbo2)) + +(expect (send fo tell) 0) +(void (send fo put 2)) +(expect (send fbo2 get-bytes) #"\n2") +(void (send fo put 2.0)) +(expect (send fbo2 get-bytes) #"\n2 2.0") +(expect (send fo tell) 2) +(send fo jump-to 0) +(send fo put 3) +(send fo jump-to 2) +(expect (send fbo2 get-bytes) #"\n3 2.0") +(void (send fo put #"hi")) +(expect (send fbo2 get-bytes) #"\n3 2.0 3 #\"hi\\0\"") +(void (send fo put 3 #"bye?")) +(expect (send fbo2 get-bytes) #"\n3 2.0 3 #\"hi\\0\"\n3 #\"bye\"") +(void (send fo put 80 #"0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abcdefghij0123456\"89ABCDEFGHIJ")) +(expect (send fbo2 get-bytes) + (bytes-append + #"\n3 2.0 3 #\"hi\\0\"\n3 #\"bye\"\n80\n" + #"(\n" + #" #\"0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abcdefghij0123456\"\n" + #" #\"\\\"89ABCDEFGHIJ\"\n" + #")")) + +(define fbo3 (make-object editor-stream-out-bytes-base%)) +(define fo3 (make-object editor-stream-out% fbo3)) +(void (send fo3 put 2)) +(expect (send fo3 tell) 1) +(void (send fo3 put-fixed 5)) +(expect (send fo3 tell) 2) +(void (send fo3 put-fixed -8)) +(void (send fo3 put 2 #"hi")) +(expect (send fbo3 get-bytes) #"\n2 5 -8 2 #\"hi\"") +(send fo3 jump-to 1) +(void (send fo3 put-fixed -4)) +(send fo3 jump-to 2) +(void (send fo3 put-fixed 7)) +(expect (send fbo3 get-bytes) #"\n2 -4 7 2 #\"hi\"") + +;; ---------------------------------------- +;; Stream reading + +(define fbi2 (make-object editor-stream-in-bytes-base% (bytes-append #"1 ; comment \n 2 " + #"#| | x # #| |# q |# 4.0" + #" 2 #\"hi\"" + #" 3 #\"hi\\\"\"" + #" 23 ( #\"0123456789ABCDEFappl\" #\"e!\\0\" ) 88"))) +(define fi2 (make-object editor-stream-in% fbi2)) + +(expect (send fi2 ok?) #t) +(expect (send fi2 tell) 0) +(expect (let ([b (box 0)]) (send fi2 get b) (unbox b)) 1) +(expect (send fi2 ok?) #t) +(expect (send fi2 tell) 1) +(expect (let ([b (box 0)]) (send fi2 get b) (unbox b)) 2) +(expect (send fi2 ok?) #t) +(expect (let ([b (box 0.0)]) (send fi2 get b) (unbox b)) 4.0) +(expect (send fi2 ok?) #t) +(expect (send fi2 tell) 3) +(expect (send fi2 get-unterminated-bytes) #"hi") +(expect (send fi2 ok?) #t) +(expect (send fi2 tell) 5) +(expect (send fi2 get-unterminated-bytes) #"hi\"") +(expect (send fi2 ok?) #t) +(expect (send fi2 get-bytes) #"0123456789ABCDEFapple!") +(expect (send fi2 ok?) #t) +(expect (send fi2 tell) 9) + +(send fi2 jump-to 3) +(expect (send fi2 tell) 3) +(expect (send fi2 get-unterminated-bytes) #"hi") +(send fi2 skip 4) +(expect (let ([b (box 0)]) (send fi2 get b) (unbox b)) 88) +(expect (send fi2 ok?) #t) +(expect (send fi2 tell) 10) + +(send fi2 jump-to 3) +(send fi2 set-boundary 5) +(expect (send fi2 get-unterminated-bytes) #"hi") +(send fi2 jump-to 3) +(expect (send fi2 ok?) #t) +(send fi2 set-boundary 4) +(expect (send fi2 get-unterminated-bytes) #"") +(expect (send fi2 ok?) #f) + +;; ---------------------------------------- +;; Save & load + +(send t delete 0 (send t last-position)) +(send t clear-undos) +(send t insert "one\ntwo\n") +(send t set-position 0 3) +(send t copy #f 0) +(send t set-position 8) +(send t paste 0) ;; probably uses the snip% `copy' method +(expect (send t get-text) "one\ntwo\none") +(define (move-to-serialized-clipboard) + (let ([data (send the-clipboard get-clipboard-data "WXME" 0)]) + (send the-clipboard set-clipboard-client + (new (class clipboard-client% + (inherit add-type) + (super-new) + (add-type "WXME") + (define/override (get-data format) data))) + 0))) +(move-to-serialized-clipboard) +(send t paste 0) ;; uses above clipboard +(expect (send t get-text) "one\ntwo\noneone") +(send the-clipboard set-clipboard-string "\u3BB" 0) +(send t paste 0) +(expect (send t get-text) "one\ntwo\noneone\u3BB") + +(send t set-position 3 4) +(send t copy #f 0) +(send t set-position 4 7) +(send t copy #t 0) +(send t set-position (send t last-position)) +(send t paste 0) +(expect (send t get-text) "one\ntwo\noneone\u3BB\ntwo") +(send t paste-next) +(expect (send t get-text) "one\ntwo\noneone\u3BBone") + +(send t cut #f 0 0 4) +(expect (send t get-text) "two\noneone\u3BBone") + +(define-values (in7 out7) (make-pipe)) +(expect (send t save-port out7 'text) #t) +(close-output-port out7) +(expect (read-string 100 in7) "two\noneone\u3BBone") + +(define out8 (open-output-bytes)) +(expect (send t save-port out8 'standard) #t) +(define in8 (open-input-bytes (get-output-bytes out8))) +(expect (peek-bytes 31 0 in8) #"#reader(lib\"read.ss\"\"wxme\")WXME") +(send t erase) +(expect (send t get-text) "") +(expect (send t insert-port in8) 'standard) +(expect (send t get-text) "two\noneone\u3BBone") + +;; ---------------------------------------- +;; Styles on text + +(define (check-color pos r g b w) + (let* ([s (send (send t find-snip pos 'after) get-style)] + [c (send s get-foreground)] + [f (send s get-font)]) + (expect* (send c red) r) + (expect* (send c green) g) + (expect* (send c blue) b) + (expect* (send f get-weight) w))) + +(send t erase) +(send t insert "red\nblue") +(check-color 0 0 0 0 'normal) +(let ([d (send (new style-delta%) set-delta-foreground (make-object color% 255 0 0))]) + (send d set-weight-on 'bold) + (send t change-style d 0 3)) +(send t change-style + (send (new style-delta%) set-delta-foreground (make-object color% 0 0 255)) + 4 8) +(check-color 0 255 0 0 'bold) +(check-color 4 0 0 255 'normal) + +(define out9 (open-output-bytes)) +(expect (send t save-port out9 'standard) #t) +(define in9 (open-input-bytes (get-output-bytes out9))) +(send t erase) +(expect (send t insert-port in9) 'standard) +(expect (send t get-text) "red\nblue") +(check-color 0 255 0 0 'bold) +(check-color 4 0 0 255 'normal) + +(define (check-random-delta d) + (expect* (send d get-alignment-on) 'top) + (expect* (send d get-alignment-off) 'base) + (expect* (send (send d get-background-add) get-r) 25) + (expect* (send (send d get-background-add) get-g) 25) + (expect* (send (send d get-background-add) get-b) 25) + (expect* (send (send d get-background-mult) get-r) 0.5) + (expect* (send (send d get-background-mult) get-g) 0.5) + (expect* (send (send d get-background-mult) get-b) 0.5) + (expect* (send (send d get-foreground-add) get-r) 50) + (expect* (send (send d get-foreground-add) get-g) 50) + (expect* (send (send d get-foreground-add) get-b) 50) + (expect* (send (send d get-foreground-mult) get-r) 0.6) + (expect* (send (send d get-foreground-mult) get-g) 0.6) + (expect* (send (send d get-foreground-mult) get-b) 0.6) + (expect* (send d get-face) "Purty") + (expect* (send d get-family) 'decorative) + (expect* (send d get-size-in-pixels-on) #t) + (expect* (send d get-size-in-pixels-off) #f) + (expect* (send d get-smoothing-off) 'smoothed) + (expect* (send d get-smoothing-on) 'base) + (expect* (send d get-style-on) 'italic) + (expect* (send d get-style-off) 'base) + (expect* (send d get-transparent-text-backing-on) #t) + (expect* (send d get-transparent-text-backing-off) #f) + (expect* (send d get-underlined-off) #t) + (expect* (send d get-underlined-on) #f) + (expect* (send d get-weight-on) 'light) + (expect* (send d get-weight-off) 'base)) + +(let ([d (new style-delta%)]) + (send d set-alignment-on 'top) + (send (send d get-background-add) set 25 25 25) + (send (send d get-background-mult) set 0.5 0.5 0.5) + (send (send d get-foreground-add) set 50 50 50) + (send (send d get-foreground-mult) set 0.6 0.6 0.6) + (send d set-delta-face "Purty" 'decorative) + (send d set-size-in-pixels-on #t) + (send d set-smoothing-off 'smoothed) + (send d set-style-on 'italic) + (send d set-transparent-text-backing-on #t) + (send d set-underlined-off #t) + (send d set-weight-on 'light) + + (check-random-delta d) + + (let* ([sl (send t get-style-list)] + [s (send sl find-or-create-style (send sl basic-style) d)]) + (send t change-style s 0 1))) + +(define out10 (open-output-bytes)) +(expect (send t save-port out10 'standard) #t) +(define in10 (open-input-bytes (get-output-bytes out10))) +(send t erase) +(expect (send t insert-port in10 'guess #t) 'standard) +(expect (send t get-text) "red\nblue") +(check-color 0 50 50 50 'light) +(check-color 1 255 0 0 'bold) +(check-color 4 0 0 255 'normal) + +(let ([d (new style-delta%)]) + (send (send (send t find-first-snip) get-style) get-delta d) + (check-random-delta d)) + +;; ---------------------------------------- +;; Keymaps + +(define km (new keymap%)) +(define hit #f) +(define kevt (new key-event%)) + +(send km add-function "letter-a" (lambda (obj evt) (set! hit #\a))) +(send km add-function "letter-m" (lambda (obj evt) (set! hit #\m))) +(send km add-function "letter-n" (lambda (obj evt) (set! hit #\n))) +(send km add-function "letter-up" (lambda (obj evt) (set! hit 'up))) +(send km add-function "letter-UP" (lambda (obj evt) (set! hit 'UP))) +(send km add-function "letter-down" (lambda (obj evt) (set! hit 'down))) +(send km add-function "letter-DOWN" (lambda (obj evt) (set! hit 'DOWN))) + +(send km map-function "a" "letter-a") +(send kevt set-key-code #\x) +(expect (send km handle-key-event 'obj kevt) #f) +(send kevt set-key-code #\a) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #\a) + +(send km map-function "up" "letter-up") +(send kevt set-key-code 'up) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit 'up) +(set! hit #f) +(send kevt set-shift-down #t) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit 'up) + +(send km map-function "s:up" "letter-UP") +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit 'UP) + +(send km map-function ":down" "letter-down") +(send kevt set-key-code 'down) +(send kevt set-shift-down #f) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit 'down) +(set! hit #f) +(send kevt set-shift-down #t) +(expect (send km handle-key-event 'obj kevt) #f) + +(send km map-function "s:down" "letter-DOWN") +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit 'DOWN) + +(expect (with-handlers ([values + (lambda (exn) + (and (regexp-match? #rx"mapped as a non-prefix key" (exn-message exn)) + 'bad-remap))]) + (send km map-function "s:down;z" "oops")) + 'bad-remap) + +;; Check sequence +(set! hit #f) +(send km map-function "d;O" "letter-down") +(send kevt set-shift-down #f) +(send kevt set-key-code #\d) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #f) +(send kevt set-key-code #\o) +(expect (send km handle-key-event 'obj kevt) #f) +(send kevt set-shift-down #f) +(send kevt set-key-code #\d) +(expect (send km handle-key-event 'obj kevt) #t) +(send kevt set-key-code #\O) +(send kevt set-shift-down #t) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit 'down) + +;; Interrupt sequence +(set! hit #f) +(send kevt set-shift-down #f) +(send kevt set-key-code #\d) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #f) +(send km break-sequence) +(send kevt set-key-code #\O) +(send kevt set-shift-down #t) +(expect (send km handle-key-event 'obj kevt) #f) +(expect hit #f) + +;; Check success with alternate, then override with more specific non-alternate +(send kevt set-key-code #\m) +(send kevt set-other-shift-key-code #\n) +(send kevt set-shift-down #f) +(send km map-function "?:n" "letter-n") +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #\n) +(send km map-function "?:m" "letter-m") +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #\m) + +(define km2 (new keymap%)) +(send km chain-to-keymap km2 #t) + +;; Chained keymap more specific overrides less specific +(send km2 add-function "letter-n2" (lambda (obj evt) (set! hit 'n2))) +(send km2 map-function "n" "letter-n2") +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #\m) +(send kevt set-key-code #\n) +(send kevt set-other-shift-key-code #\p) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit 'n2) + +;; Check sequence in chained keymap +(send km2 add-function "letter-t" (lambda (obj evt) (set! hit #\t))) +(send km2 map-function "c:x;t" "letter-t") +(send kevt set-key-code #\x) +(send kevt set-control-down #t) +(send kevt set-other-shift-key-code #f) +(set! hit #f) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #f) +(send kevt set-control-down #f) +(send kevt set-key-code #\t) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #\t) + +;; Chained keymap non-prefixed overrides prefixed +(send km2 add-function "letter-d" (lambda (obj evt) (set! hit #\d))) +(send km2 map-function "d" "letter-d") +(send kevt set-key-code #\d) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #\d) +(send kevt set-key-code #\O) +(send kevt set-shift-down #t) +(expect (send km handle-key-event 'obj kevt) #f) +(expect hit #\d) + +;; Remove chained keymap +(send km remove-chained-keymap km2) +(send kevt set-key-code #\d) +(send kevt set-shift-down #f) +(set! hit #f) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit #f) +(send kevt set-key-code #\O) +(send kevt set-shift-down #t) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit 'down) + +;; Key grab +(send kevt set-key-code #\m) +(send kevt set-shift-down #f) +(send km set-grab-key-function (lambda (str km-in ed evt) + (expect* km-in km) + (expect* evt kevt) + (set! hit (list str ed)) + #t)) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit '("letter-m" obj)) +(send kevt set-key-code #\p) +(expect (send km handle-key-event 'obj kevt) #t) +(expect hit '(#f obj)) +(send km set-grab-key-function (lambda (str km-in ed evt) + (expect* str "letter-m") + (expect* ed 'obj2) + (set! hit 'nope) + #f)) +(send kevt set-key-code #\m) +(expect (send km handle-key-event 'obj2 kevt) #t) +(expect hit #\m) +(send km set-grab-key-function (lambda (str km-in ed evt) + (expect* str #f) + (expect* ed 'obj3) + (set! hit 'nope) + #f)) +(send kevt set-key-code #\p) +(expect (send km handle-key-event 'obj3 kevt) #f) +(expect hit 'nope) + +;; Mouse events +(define mevt/l (new mouse-event% [event-type 'left-down])) +(send mevt/l set-left-down #t) +(send km add-function "mouse-right" (lambda (obj evt) (set! hit 'right))) +(send km add-function "mouse-left" (lambda (obj evt) (set! hit 'left))) +(send km add-function "mouse-left2" (lambda (obj evt) (set! hit 'left2))) + +(expect (send km handle-mouse-event 'obj mevt/l) #f) +(send mevt/l set-time-stamp 501) ;; FIXME: depends on double-click time +(send km map-function "leftbutton" "mouse-left") +(send km map-function "leftbuttondouble" "mouse-left2") +(expect (send km handle-mouse-event 'obj mevt/l) #t) +(expect hit 'left) +(expect (send km handle-mouse-event 'obj mevt/l) #t) +(expect hit 'left2) +(expect (send km handle-mouse-event 'obj mevt/l) #t) +(expect hit 'left) +(send mevt/l set-time-stamp 10100) +(expect (send km handle-mouse-event 'obj mevt/l) #t) +(expect hit 'left) + +(set! hit #f) +(send km map-function "rightbuttonseq" "mouse-right") +(define mevt/r (new mouse-event% [event-type 'right-down])) +(send mevt/r set-right-down #t) +(define mevt/r/up (new mouse-event% [event-type 'right-up])) +(expect (send km handle-mouse-event 'obj mevt/r) #t) +(expect hit 'right) +(set! hit #f) +(expect (send km handle-mouse-event 'obj mevt/r/up) #t) +(expect hit 'right) + +(send km set-grab-mouse-function (lambda (str km-in ed evt) + (set! hit 'm) + #t)) +(define mevt/m (new mouse-event% [event-type 'middle-down])) +(send mevt/m set-middle-down #t) +(expect (send km handle-mouse-event 'obj mevt/m) #t) +(expect hit 'm) +(send km remove-grab-mouse-function) +(expect (send km handle-mouse-event 'obj mevt/m) #f) + +;; ---------------------------------------- +;; editor snips, content + +(define oe (new text%)) +(define ie (new text%)) +(define es (new editor-snip% [editor ie])) +(send ie insert "Hello") +(send oe insert es) + +(expect (send oe get-text 0 'eof #f) ".") +(expect (send oe get-flattened-text) "Hello") + +(send es show-border #t) +(expect (send es border-visible?) #t) +(send es set-margin 1 2 3 4) +(define (check-border es) + (let ([l (box 0)][t (box 0)][r (box 0)][b (box 0)]) + (send es get-margin l t r b) + (expect (list (unbox l) (unbox t) (unbox r) (unbox b)) + (list 1 2 3 4)))) +(check-border es) + +(send oe set-position 0 1) +(send oe copy #f 0) +(send oe set-position 1) +(send oe paste 0) ;; probably uses the snip% `copy' method +(expect (send oe last-position) 2) +(define es2 (send oe find-snip 1 'after-or-none)) +(check-border es2) +(move-to-serialized-clipboard) +(send oe paste 0) ;; uses above clipboard +(define es3 (send oe find-snip 2 'after-or-none)) +(check-border es3) +(expect (send es3 border-visible?) #t) +(expect (send es3 get-align-top-line) #f) + +(send (send es2 get-editor) insert "zzz" 2 2) +(expect (send oe get-text 0 'eof #f) "...") +(expect (send oe get-flattened-text) "HelloHezzzlloHello") + +(send oe insert "a\n" 0) +(send oe insert "\nb" (send oe last-position)) +(expect (send oe get-flattened-text) "a\nHelloHezzzlloHello\nb") + +;; ---------------------------------------- +;; editor snips, locations + +(send oe set-admin (new test-editor-admin%)) +(expect (let ([w (box 0.0)] [h (box 0.0)]) + (send oe get-extent w h) + (list (unbox w) (unbox h))) + '(197.0 40.0)) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (list (begin + (send oe position-location 0 x y) + (list (unbox x) (unbox y))) + (begin + (send oe position-location 1 x y #f) + (list (unbox x) (unbox y))))) + '((0.0 0.0) (10.0 10.0))) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (list (begin + (send oe position-location 2 x y) + (list (unbox x) (unbox y))) + (begin + (send oe position-location 3 x y #f) + (list (unbox x) (unbox y))))) + '((0.0 11.0) (55.0 28.0))) + +(send (send es2 get-editor) insert "\nmore" 100) +(expect (let ([w (box 0.0)] [h (box 0.0)]) + (send oe get-extent w h) + (list (unbox w) (unbox h))) + '(197.0 51.0)) + +;; ---------------------------------------- +;; Pasteboard + +(define pb (new pasteboard%)) +(expect (send pb find-first-snip) #f) +(expect (send pb find-snip 10.0 10.0) #f) +(expect (let ([w (box 0.0)] [h (box 0.0)]) + (send pb get-extent w h) + (list (unbox w) (unbox h))) + '(0.0 0.0)) + +(define ss1 (new string-snip%)) +(send ss1 insert "one" 3) +(send pb insert ss1 12.0 17.5) +(expect (send pb find-first-snip) ss1) +(expect (send pb get-flattened-text) "one") + +(define ss2 (new string-snip%)) +(send ss2 insert "two!" 4) +(send pb insert ss2 ss1 32.0 7.5) +(expect (send pb find-first-snip) ss2) +(expect (send pb get-flattened-text) "two!one") +(send pb lower ss2) +(expect (send pb get-flattened-text) "onetwo!") +(send pb raise ss2) +(expect (send pb get-flattened-text) "two!one") + +(send pb set-admin (new test-editor-admin%)) +(expect (let ([w (box 0.0)] [h (box 0.0)]) + (send pb get-extent w h) + (list (unbox w) (unbox h))) + '(74.0 29.5)) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (send pb get-snip-location ss2 x y #t) + (list (unbox x) (unbox y))) + '(72.0 17.5)) +(send ss2 insert "more" 4 3) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (send pb get-snip-location ss2 x y #t) + (list (unbox x) (unbox y))) + '(112.0 17.5)) +(expect (send pb get-flattened-text) "twomore!one") + +(send pb no-selected) +(expect (send pb find-next-selected-snip #f) #f) +(send pb add-selected ss1) +(expect (send pb find-next-selected-snip #f) ss1) +(expect (send pb find-next-selected-snip ss1) #f) +(send pb no-selected) +(send pb add-selected 0.0 0.0 10.0 10.0) +(expect (send pb find-next-selected-snip #f) #f) +(send pb add-selected 10.0 10.0 20.0 20.0) +(expect (send pb find-next-selected-snip #f) ss1) +(expect (send pb find-next-selected-snip ss1) #f) +(send pb add-selected 10.0 10.0 40.0 40.0) +(expect (send pb find-next-selected-snip #f) ss2) +(expect (send pb find-next-selected-snip ss2) ss1) + +(send pb set-max-undo-history 10) + +(send pb move 3 4) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (send pb get-snip-location ss1 x y #f) + (list (unbox x) (unbox y))) + '(15.0 21.5)) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (send pb get-snip-location ss2 x y #f) + (list (unbox x) (unbox y))) + '(35.0 11.5)) +(send pb undo) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (send pb get-snip-location ss1 x y #f) + (list (unbox x) (unbox y))) + '(12.0 17.5)) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (send pb get-snip-location ss2 x y #f) + (list (unbox x) (unbox y))) + '(32.0 7.5)) + +(send pb remove-selected ss1) +(expect (send pb find-snip 15.0 20.0) ss1) +(expect (send pb find-snip 35.0 10.0) ss2) +(expect (send pb find-first-snip) ss2) +(send pb delete) "delete" +(expect (send pb find-first-snip) ss1) +(expect (send pb find-snip 15.0 20.0) ss1) +(expect (send pb find-snip 35.0 10.0) #f) +(send pb undo) "undo" +(expect (send pb find-first-snip) ss2) +(expect (send pb find-snip 35.0 10.0) ss2) +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (send pb get-snip-location ss2 x y #f) + (list (unbox x) (unbox y))) + '(32.0 7.5)) + +(define out20 (open-output-bytes)) +(expect (send pb save-port out20 'standard) #t) +(define in20 (open-input-bytes (get-output-bytes out20))) +(expect (peek-bytes 31 0 in20) #"#reader(lib\"read.ss\"\"wxme\")WXME") + +(define t10 (make-object text%)) +(expect (send t10 insert-port in20) 'standard) +(expect (send t10 get-flattened-text) "twomore!one") + +(define in21 (open-input-bytes (get-output-bytes out20))) +(define pb2 (make-object pasteboard%)) +(expect (send pb2 insert-port in21) 'standard) +(expect (send pb2 get-flattened-text) "twomore!one") +(expect (let ([x (box 0.0)] [y (box 0.0)]) + (send pb2 get-snip-location (send pb2 find-first-snip) x y #f) + (list (unbox x) (unbox y))) + '(32.0 7.5)) + +;; ---------------------------------------- + +(done) diff --git a/collects/tests/mzscheme/module.ss b/collects/tests/mzscheme/module.ss index 24eba26299..fb30aa57be 100644 --- a/collects/tests/mzscheme/module.ss +++ b/collects/tests/mzscheme/module.ss @@ -176,13 +176,13 @@ (define e 1) (,here 'e) (provide e))) - (test '(d c b c) values l) + (test '(d b c) values l) (eval `(module f mzscheme (,here 'f) (require 'b 'e))) - (test '(d c b d c b c) values l) + (test '(d b d b c) values l) (eval `(require 'f)) - (let ([finished '(f b e a d c b d c b d c b c)]) + (let ([finished '(f b e a d b d b d b c)]) (test finished values l) (namespace-attach-module n ''f) (test finished values l) @@ -192,7 +192,7 @@ (namespace-require 'scheme/base) (eval `(require 'a)) (eval `(require 'f)) - (test finished values l))))) + (test (list* 'd 'b finished) values l))))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Check redundant import and re-provide diff --git a/doc/release-notes/mzscheme/HISTORY.txt b/doc/release-notes/mzscheme/HISTORY.txt index 6713c0f407..29c5680471 100644 --- a/doc/release-notes/mzscheme/HISTORY.txt +++ b/doc/release-notes/mzscheme/HISTORY.txt @@ -1,12 +1,14 @@ Version 4.1.5.3 -Change provide to convert an exported rename transformer to its +Changed provide to convert an exported rename transformer to its free-identifier=? target -Add 'not-free-identifier=? syntax property to disable free-identifier=? +Added 'not-free-identifier=? syntax property to disable free-identifier=? propagation through a rename transformer -Add prop:rename-transformer and prop:set!-transformer -Fix scheme/local so that local syntax bindings are visible to later +Added prop:rename-transformer and prop:set!-transformer +Fixed scheme/local so that local syntax bindings are visible to later local definitions Changed current-process-milliseconds to accept a thread argument +Added hash-hash-key?, hash-ref! +Added in-sequences, in-cycle Version 4.1.5.2 Changed expander to detect a reaname transformer and install a diff --git a/src/configure b/src/configure index ae2482e643..295e7b9819 100755 --- a/src/configure +++ b/src/configure @@ -12013,7 +12013,7 @@ if test "${enable_mred}" = "yes" ; then makefiles="$makefiles mred/Makefile - mred/wxs/Makefile mred/wxme/Makefile + mred/wxs/Makefile mred/gc2/Makefile" if test "${enable_libpng}" != "yes" ; then diff --git a/src/mred/Makefile.in b/src/mred/Makefile.in index a99175ebf0..cd56ba0b72 100644 --- a/src/mred/Makefile.in +++ b/src/mred/Makefile.in @@ -44,7 +44,7 @@ WXINC_wx_xt = -I$(PLTSRCDIR)/wxxt/src/AIAI-include -I$(PLTSRCDIR)/wxxt/src WXINC_wx_mac = -I$(PLTSRCDIR)/wxmac/include/base -I$(PLTSRCDIR)/wxmac/include/mac -I$(PLTSRCDIR)/wxcommon -I$(PLTSRCDIR)/a-list/c-headers/ WXINC = $(WXINC_@WXVARIANT@) -NOGCINC = $(WXINC) -I$(PLTSRCDIR)/mred/wxme/ -I$(PLTBUILDDIR)/mzscheme/ -I$(PLTSRCDIR)/mzscheme/include/ +NOGCINC = $(WXINC) -I$(PLTBUILDDIR)/mzscheme/ -I$(PLTSRCDIR)/mzscheme/include/ INC = -I$(PLTSRCDIR)/mzscheme/$(GCDIRECTORY) $(NOGCINC) CXXFLAGS = $(INC) $(XINCLUDE) $(OPTIONS) -D$(WXVARIANT) @COMPFLAGS@ @PROFFLAGS@ @CXXFLAGS@ @PREFLAGS@ CFLAGS = $(INC) $(XINCLUDE) $(OPTIONS) -D$(WXVARIANT) @COMPFLAGS@ @PROFFLAGS@ @CFLAGS@ @PREFLAGS@ @@ -67,7 +67,7 @@ WXLIBS_wx_xt = ../wxxt/src/libwx_xt.@LIBSFX@ ../wxxt/contrib/xpm/lib/libXpm.@LIB MREDX_wx_xt = mredx.@LTO@ WXLIBS_wx_mac = ../wxmac/src/libwxmac.@LIBSFX@ MREDX_wx_mac = mredmac.@LTO@ simpledrop.@LTO@ -WXLIBSNORM = mred.@LTO@ $(MREDX_@WXVARIANT@) wxGC.@LTO@ wxJPEG.@LTO@ wxs/libwxscheme.@LIBSFX@ wxme/libwxme.@LIBSFX@ $(WXLIBS_@WXVARIANT@) @JPEG_A@ @PNG_A@ @ZLIB_A@ +WXLIBSNORM = mred.@LTO@ $(MREDX_@WXVARIANT@) wxGC.@LTO@ wxJPEG.@LTO@ wxs/libwxscheme.@LIBSFX@ $(WXLIBS_@WXVARIANT@) @JPEG_A@ @PNG_A@ @ZLIB_A@ WXLIBSDYN = libmred.@LIBSFX@ GUILIBS_wx_xt = $(LDLIBS) GUILIBS_wx_mac = @LIBS@ @@ -81,7 +81,6 @@ MREDOBJECTS = mrmain.@LTO@ MZSCHEMEDEPS = ../mzscheme/libmzscheme.@LIBSFX@ ../mzscheme/libmzgc.@LIBSFX@ WXSCHEME = wxs/libwxscheme.@LIBSFX@ -WXME = wxme/libwxme.@LIBSFX@ INSTALLDEST=/home/scheme/plt @@ -113,7 +112,6 @@ cgc: $(MAKE) ext-libs $(MAKE) @WXVARIANT@ cd wxs; $(MAKE) - cd wxme; $(MAKE) $(MAKE) $(LINKRESULT) both: @@ -171,7 +169,7 @@ wx_mac: wx_mac-min: cd ../wxmac/src; $(MAKE) min -mred.@LTO@ : $(srcdir)/mred.cxx $(srcdir)/wxme/wx_media.h $(srcdir)/wxme/wx_medad.h \ +mred.@LTO@ : $(srcdir)/mred.cxx \ $(srcdir)/wxs/wxscheme.h $(srcdir)/mred.h \ $(srcdir)/../mzscheme/include/scheme.h \ $(srcdir)/wxs/wxsmred.h $(WXINCDEP) $(srcdir)/../wxcommon/wxGC.h \ @@ -238,7 +236,6 @@ clean: rm -f *.@LTO@ *.d core mred mred3m rm -f gc2/*.@LTO@ gc2/xsrc/* gc2/macxsrc/* gc2/*.d gc2/*.dd rm -rf gc2/xform-collects - cd wxme; $(MAKE) clean cd wxs; $(MAKE) clean if [ -f ../wxcommon/jpeg/Makefile ] ; then cd ../wxcommon/jpeg; $(MAKE) clean ; fi if [ -f ../wxcommon/libpng/Makefile ] ; then cd ../wxcommon/libpng; $(MAKE) clean ; fi diff --git a/src/mred/gc2/Makefile.in b/src/mred/gc2/Makefile.in index c2cde1e10f..271d352a1b 100644 --- a/src/mred/gc2/Makefile.in +++ b/src/mred/gc2/Makefile.in @@ -40,7 +40,7 @@ WXINC_wx_xt = -I$(PLTSRCDIR)/wxxt/src/AIAI-include -I$(PLTSRCDIR)/wxxt/src WXINC_wx_mac = -I$(PLTSRCDIR)/wxmac/include/base -I$(PLTSRCDIR)/wxmac/include/mac -I$(PLTSRCDIR)/wxcommon -I$(PLTSRCDIR)/a-list/c-headers/ WXINC = $(WXINC_@WXVARIANT@) -NOGCINC = $(WXINC) -I$(PLTSRCDIR)/mred/wxme/ -I$(PLTBUILDDIR)/mzscheme/ -I$(PLTSRCDIR)/mzscheme/include/ +NOGCINC = $(WXINC) -I$(PLTBUILDDIR)/mzscheme/ -I$(PLTSRCDIR)/mzscheme/include/ INC = -I$(PLTSRCDIR)/mzscheme/$(GCDIRECTORY) $(NOGCINC) CXXFLAGS = $(INC) $(XINCLUDE) $(OPTIONS) -D$(WXVARIANT) @COMPFLAGS@ @PROFFLAGS@ @CXXFLAGS@ @PREFLAGS@ CFLAGS = $(INC) $(XINCLUDE) $(OPTIONS) -D$(WXVARIANT) @COMPFLAGS@ @PROFFLAGS@ @CFLAGS@ @PREFLAGS@ @@ -74,7 +74,7 @@ XFORMDEP = $(srcdir)/../../mzscheme/gc2/xform.ss $(srcdir)/../../mzscheme/gc2/xf WXBDIR=../../wxxt WXMACBDIR=../../wxmac/src -MREDLDFLAGS = -L$(WXBDIR)/utils/image/src -L$(WXBDIR)/contrib/xpm/lib $(LDFLAGS) -L../../mzscheme -L../wxs -L../wxme -L$(WXBDIR)/src +MREDLDFLAGS = -L$(WXBDIR)/utils/image/src -L$(WXBDIR)/contrib/xpm/lib $(LDFLAGS) -L../../mzscheme -L../wxs -L$(WXBDIR)/src DEF_COLLECTS_DIR = +D INITIAL_COLLECTS_DIRECTORY='"'"`cd $(srcdir)/../../../collects; pwd`"'"' @@ -367,43 +367,6 @@ wx_mac_XFORMPRECOMP = $(MACXPRECOMPDEP) XFORMPRECOMP = $(@WXVARIANT@_XFORMPRECOMP) XFORMPRECOMPDEP = -xsrc/wx_media.cc: $(srcdir)/../wxme/wx_media.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_media.cc $(srcdir)/../wxme/wx_media.cxx - -xsrc/wx_mpriv.cc: $(srcdir)/../wxme/wx_mpriv.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_mpriv.cc $(srcdir)/../wxme/wx_mpriv.cxx - -xsrc/wx_snip.cc: $(srcdir)/../wxme/wx_snip.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_snip.cc $(srcdir)/../wxme/wx_snip.cxx - -xsrc/wx_msnip.cc: $(srcdir)/../wxme/wx_msnip.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_msnip.cc $(srcdir)/../wxme/wx_msnip.cxx - -xsrc/wx_mbuf.cc: $(srcdir)/../wxme/wx_mbuf.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_mbuf.cc $(srcdir)/../wxme/wx_mbuf.cxx - -xsrc/wx_mpbrd.cc: $(srcdir)/../wxme/wx_mpbrd.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_mpbrd.cc $(srcdir)/../wxme/wx_mpbrd.cxx - -xsrc/wx_keym.cc: $(srcdir)/../wxme/wx_keym.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_keym.cc $(srcdir)/../wxme/wx_keym.cxx - -xsrc/wx_medio.cc: $(srcdir)/../wxme/wx_medio.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_medio.cc $(srcdir)/../wxme/wx_medio.cxx - -xsrc/wx_medad.cc: $(srcdir)/../wxme/wx_medad.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_medad.cc $(srcdir)/../wxme/wx_medad.cxx - -xsrc/wx_style.cc: $(srcdir)/../wxme/wx_style.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_style.cc $(srcdir)/../wxme/wx_style.cxx - -xsrc/wx_mline.cc: $(srcdir)/../wxme/wx_mline.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_mline.cc $(srcdir)/../wxme/wx_mline.cxx - -xsrc/wx_cgrec.cc: $(srcdir)/../wxme/wx_cgrec.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wx_cgrec.cc $(srcdir)/../wxme/wx_cgrec.cxx - - xsrc/wxscheme.cc: $(srcdir)/../wxs/wxscheme.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxscheme.cc $(srcdir)/../wxs/wxscheme.cxx @@ -448,20 +411,10 @@ xsrc/wxs_item.cc: $(srcdir)/../wxs/wxs_item.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxs_item.cc $(srcdir)/../wxs/wxs_item.cxx xsrc/wxs_lbox.cc: $(srcdir)/../wxs/wxs_lbox.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxs_lbox.cc $(srcdir)/../wxs/wxs_lbox.cxx -xsrc/wxs_madm.cc: $(srcdir)/../wxs/wxs_madm.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wxs_madm.cc $(srcdir)/../wxs/wxs_madm.cxx -xsrc/wxs_mede.cc: $(srcdir)/../wxs/wxs_mede.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wxs_mede.cc $(srcdir)/../wxs/wxs_mede.cxx -xsrc/wxs_medi.cc: $(srcdir)/../wxs/wxs_medi.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wxs_medi.cc $(srcdir)/../wxs/wxs_medi.cxx xsrc/wxs_menu.cc: $(srcdir)/../wxs/wxs_menu.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxs_menu.cc $(srcdir)/../wxs/wxs_menu.cxx -xsrc/wxs_mio.cc: $(srcdir)/../wxs/wxs_mio.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wxs_mio.cc $(srcdir)/../wxs/wxs_mio.cxx xsrc/wxs_misc.cc: $(srcdir)/../wxs/wxs_misc.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxs_misc.cc $(srcdir)/../wxs/wxs_misc.cxx -xsrc/wxs_mpb.cc: $(srcdir)/../wxs/wxs_mpb.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wxs_mpb.cc $(srcdir)/../wxs/wxs_mpb.cxx xsrc/wxs_obj.cc: $(srcdir)/../wxs/wxs_obj.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxs_obj.cc $(srcdir)/../wxs/wxs_obj.cxx xsrc/wxs_panl.cc: $(srcdir)/../wxs/wxs_panl.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) @@ -470,10 +423,6 @@ xsrc/wxs_rado.cc: $(srcdir)/../wxs/wxs_rado.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxs_rado.cc $(srcdir)/../wxs/wxs_rado.cxx xsrc/wxs_slid.cc: $(srcdir)/../wxs/wxs_slid.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxs_slid.cc $(srcdir)/../wxs/wxs_slid.cxx -xsrc/wxs_snip.cc: $(srcdir)/../wxs/wxs_snip.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wxs_snip.cc $(srcdir)/../wxs/wxs_snip.cxx -xsrc/wxs_styl.cc: $(srcdir)/../wxs/wxs_styl.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) - $(XFORMWP) xsrc/wxs_styl.cc $(srcdir)/../wxs/wxs_styl.cxx xsrc/wxs_tabc.cc: $(srcdir)/../wxs/wxs_tabc.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) $(XFORMWP) xsrc/wxs_tabc.cc $(srcdir)/../wxs/wxs_tabc.cxx xsrc/wxs_win.cc: $(srcdir)/../wxs/wxs_win.cxx $(XFORMDEP) $(XFORMPRECOMPDEP) @@ -769,31 +718,6 @@ wx_xt_EXTRAFLAGS = wx_mac_EXTRAFLAGS = $(MACUSEPRECOMP) -Imacxsrc EXTRAFLAGS = $(@WXVARIANT@_EXTRAFLAGS) -wx_media.@LTO@: xsrc/wx_media.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_media.@LTO@ xsrc/wx_media.cc -wx_mpriv.@LTO@: xsrc/wx_mpriv.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_mpriv.@LTO@ xsrc/wx_mpriv.cc -wx_snip.@LTO@: xsrc/wx_snip.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_snip.@LTO@ xsrc/wx_snip.cc -wx_msnip.@LTO@: xsrc/wx_msnip.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_msnip.@LTO@ xsrc/wx_msnip.cc -wx_mbuf.@LTO@: xsrc/wx_mbuf.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_mbuf.@LTO@ xsrc/wx_mbuf.cc -wx_mpbrd.@LTO@: xsrc/wx_mpbrd.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_mpbrd.@LTO@ xsrc/wx_mpbrd.cc -wx_keym.@LTO@: xsrc/wx_keym.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_keym.@LTO@ xsrc/wx_keym.cc -wx_medio.@LTO@: xsrc/wx_medio.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_medio.@LTO@ xsrc/wx_medio.cc -wx_medad.@LTO@: xsrc/wx_medad.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_medad.@LTO@ xsrc/wx_medad.cc -wx_style.@LTO@: xsrc/wx_style.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_style.@LTO@ xsrc/wx_style.cc -wx_mline.@LTO@: xsrc/wx_mline.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_mline.@LTO@ xsrc/wx_mline.cc -wx_cgrec.@LTO@: xsrc/wx_cgrec.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wx_cgrec.@LTO@ xsrc/wx_cgrec.cc - wxscheme.@LTO@: xsrc/wxscheme.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxscheme.@LTO@ xsrc/wxscheme.cc wxs_bmap.@LTO@: xsrc/wxs_bmap.cc $(PRECOMPDEP) @@ -822,20 +746,10 @@ wxs_item.@LTO@: xsrc/wxs_item.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_item.@LTO@ xsrc/wxs_item.cc wxs_lbox.@LTO@: xsrc/wxs_lbox.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_lbox.@LTO@ xsrc/wxs_lbox.cc -wxs_madm.@LTO@: xsrc/wxs_madm.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_madm.@LTO@ xsrc/wxs_madm.cc -wxs_mede.@LTO@: xsrc/wxs_mede.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_mede.@LTO@ xsrc/wxs_mede.cc -wxs_medi.@LTO@: xsrc/wxs_medi.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_medi.@LTO@ xsrc/wxs_medi.cc wxs_menu.@LTO@: xsrc/wxs_menu.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_menu.@LTO@ xsrc/wxs_menu.cc -wxs_mio.@LTO@: xsrc/wxs_mio.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_mio.@LTO@ xsrc/wxs_mio.cc wxs_misc.@LTO@: xsrc/wxs_misc.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_misc.@LTO@ xsrc/wxs_misc.cc -wxs_mpb.@LTO@: xsrc/wxs_mpb.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_mpb.@LTO@ xsrc/wxs_mpb.cc wxs_obj.@LTO@: xsrc/wxs_obj.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_obj.@LTO@ xsrc/wxs_obj.cc wxs_panl.@LTO@: xsrc/wxs_panl.cc $(PRECOMPDEP) @@ -844,10 +758,6 @@ wxs_rado.@LTO@: xsrc/wxs_rado.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_rado.@LTO@ xsrc/wxs_rado.cc wxs_slid.@LTO@: xsrc/wxs_slid.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_slid.@LTO@ xsrc/wxs_slid.cc -wxs_snip.@LTO@: xsrc/wxs_snip.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_snip.@LTO@ xsrc/wxs_snip.cc -wxs_styl.@LTO@: xsrc/wxs_styl.cc $(PRECOMPDEP) - $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_styl.@LTO@ xsrc/wxs_styl.cc wxs_tabc.@LTO@: xsrc/wxs_tabc.cc $(PRECOMPDEP) $(CXX) $(EXTRAFLAGS) -DGC2_JUST_MACROS $(GCPREINC) -c $(XXPOSTFLAGS) -o wxs_tabc.@LTO@ xsrc/wxs_tabc.cc wxs_win.@LTO@: xsrc/wxs_win.cc $(PRECOMPDEP) @@ -1033,36 +943,16 @@ MRED_XSRCS = \ xsrc/wxs_glob.cc \ xsrc/wxs_item.cc \ xsrc/wxs_lbox.cc \ - xsrc/wxs_madm.cc \ - xsrc/wxs_mede.cc \ - xsrc/wxs_medi.cc \ xsrc/wxs_menu.cc \ - xsrc/wxs_mio.cc \ xsrc/wxs_misc.cc \ - xsrc/wxs_mpb.cc \ xsrc/wxs_obj.cc \ xsrc/wxs_panl.cc \ xsrc/wxs_rado.cc \ xsrc/wxs_slid.cc \ - xsrc/wxs_snip.cc \ - xsrc/wxs_styl.cc \ xsrc/wxs_tabc.cc \ xsrc/wxs_win.cc \ \ xsrc/wxscheme.cc \ -\ - xsrc/wx_media.cc \ - xsrc/wx_mpriv.cc \ - xsrc/wx_snip.cc \ - xsrc/wx_msnip.cc \ - xsrc/wx_mbuf.cc \ - xsrc/wx_mpbrd.cc \ - xsrc/wx_keym.cc \ - xsrc/wx_medio.cc \ - xsrc/wx_medad.cc \ - xsrc/wx_style.cc \ - xsrc/wx_mline.cc \ - xsrc/wx_cgrec.cc \ \ xsrc/wxJPEG.cc \ \ @@ -1230,36 +1120,16 @@ MRED_XOBJS = \ wxs_glob.@LTO@ \ wxs_item.@LTO@ \ wxs_lbox.@LTO@ \ - wxs_madm.@LTO@ \ - wxs_mede.@LTO@ \ - wxs_medi.@LTO@ \ wxs_menu.@LTO@ \ - wxs_mio.@LTO@ \ wxs_misc.@LTO@ \ - wxs_mpb.@LTO@ \ wxs_obj.@LTO@ \ wxs_panl.@LTO@ \ wxs_rado.@LTO@ \ wxs_slid.@LTO@ \ - wxs_snip.@LTO@ \ - wxs_styl.@LTO@ \ wxs_tabc.@LTO@ \ wxs_win.@LTO@ \ \ wxscheme.@LTO@ \ -\ - wx_media.@LTO@ \ - wx_mpriv.@LTO@ \ - wx_snip.@LTO@ \ - wx_msnip.@LTO@ \ - wx_mbuf.@LTO@ \ - wx_mpbrd.@LTO@ \ - wx_keym.@LTO@ \ - wx_medio.@LTO@ \ - wx_medad.@LTO@ \ - wx_style.@LTO@ \ - wx_mline.@LTO@ \ - wx_cgrec.@LTO@ \ \ wxJPEG.@LTO@ \ \ @@ -1540,15 +1410,6 @@ gen-deps: @INCLUDEDEP@ wx_style.dd @INCLUDEDEP@ wx_keym.dd @INCLUDEDEP@ wx_mbuf.dd -@INCLUDEDEP@ wx_media.dd -@INCLUDEDEP@ wx_mpriv.dd -@INCLUDEDEP@ wx_msnip.dd -@INCLUDEDEP@ wx_mline.dd -@INCLUDEDEP@ wx_mpbrd.dd -@INCLUDEDEP@ wx_medad.dd -@INCLUDEDEP@ wx_snip.dd -@INCLUDEDEP@ wx_cgrec.dd -@INCLUDEDEP@ wx_medio.dd @INCLUDEDEP@ xcglue.dd @INCLUDEDEP@ wxs_bmap.dd @INCLUDEDEP@ wxs_butn.dd @@ -1563,19 +1424,12 @@ gen-deps: @INCLUDEDEP@ wxs_glob.dd @INCLUDEDEP@ wxs_item.dd @INCLUDEDEP@ wxs_lbox.dd -@INCLUDEDEP@ wxs_madm.dd -@INCLUDEDEP@ wxs_mede.dd -@INCLUDEDEP@ wxs_medi.dd @INCLUDEDEP@ wxs_menu.dd -@INCLUDEDEP@ wxs_mio.dd @INCLUDEDEP@ wxs_misc.dd -@INCLUDEDEP@ wxs_mpb.dd @INCLUDEDEP@ wxs_obj.dd @INCLUDEDEP@ wxs_panl.dd @INCLUDEDEP@ wxs_rado.dd @INCLUDEDEP@ wxs_slid.dd -@INCLUDEDEP@ wxs_snip.dd -@INCLUDEDEP@ wxs_styl.dd @INCLUDEDEP@ wxs_tabc.dd @INCLUDEDEP@ wxs_win.dd @INCLUDEDEP@ wxscheme.dd diff --git a/src/mred/mred.cxx b/src/mred/mred.cxx index 1809a13fe6..cc6d86f247 100644 --- a/src/mred/mred.cxx +++ b/src/mred/mred.cxx @@ -29,7 +29,6 @@ #include "wx_buttn.h" #include "wx_messg.h" #include "wx_timer.h" -#include "wx_media.h" #include "wx_dialg.h" #include "wx_cmdlg.h" #include "wx_menu.h" @@ -116,7 +115,6 @@ wxFrame *mred_real_main_frame; static Scheme_Thread *user_main_thread; -extern void wxMediaIOCheckLSB(void); extern void wxMouseEventHandled(void); #ifdef wx_xt extern int wx_single_instance; @@ -296,8 +294,6 @@ static int mark_eventspace_val(void *p) gcMARK_TYPED(MrEdFinalizedContext *, c->finalized); gcMARK_TYPED(wxChildList *, c->topLevelWindowList); - gcMARK_TYPED(wxStandardSnipClassList *, c->snipClassList); - gcMARK_TYPED(wxBufferDataClassList *, c->bufferDataClassList); gcMARK_TYPED(wxWindow *, c->modal_window); gcMARK_TYPED(MrEd_Saved_Modal *, c->modal_stack); @@ -330,8 +326,6 @@ static int fixup_eventspace_val(void *p) gcFIXUP_TYPED(MrEdFinalizedContext *, c->finalized); gcFIXUP_TYPED(wxChildList *, c->topLevelWindowList); - gcFIXUP_TYPED(wxStandardSnipClassList *, c->snipClassList); - gcFIXUP_TYPED(wxBufferDataClassList *, c->bufferDataClassList); gcFIXUP_TYPED(wxWindow *, c->modal_window); gcFIXUP_TYPED(MrEd_Saved_Modal *, c->modal_stack); @@ -523,22 +517,6 @@ void wxPopModalWindow(wxObject *w, wxWindow *win) } } -wxStandardSnipClassList *wxGetTheSnipClassList() -{ - MrEdContext *c; - c = MrEdGetContext(); - - return c->snipClassList; -} - -wxBufferDataClassList *wxGetTheBufferDataClassList() -{ - MrEdContext *c; - c = MrEdGetContext(); - - return c->bufferDataClassList; -} - int wxGetBusyState(void) { MrEdContext *c; @@ -739,8 +717,6 @@ static MrEdContext *MakeContext(MrEdContext *c) if (!c) { wxChildList *tlwl; - wxStandardSnipClassList *scl; - wxBufferDataClassList *bdcl; MrEdFinalizedContext *fc; c = (MrEdContext *)scheme_malloc_tagged(sizeof(MrEdContext)); @@ -748,10 +724,6 @@ static MrEdContext *MakeContext(MrEdContext *c) tlwl = new WXGC_PTRS wxChildList(); c->topLevelWindowList = tlwl; - scl = wxMakeTheSnipClassList(); - c->snipClassList = scl; - bdcl = wxMakeTheBufferDataClassList(); - c->bufferDataClassList = bdcl; fc = new WXGC_PTRS MrEdFinalizedContext; c->finalized = fc; } @@ -1638,27 +1610,11 @@ static int check_initialized(Scheme_Object *) # define KEEP_GOING wxTheApp->keep_going -#if WINDOW_STDIO -static Scheme_Custodian *main_custodian; -#endif - void wxDoEvents() { /* When we get here, we are in the main dispatcher thread */ if (!TheMrEdApp->initialized) { MrEdContext *c; -#if WINDOW_STDIO - Scheme_Custodian *m, *oldm = NULL; - Scheme_Config *config = NULL; - if (!wx_in_terminal) { - config = scheme_current_config(); - oldm = (Scheme_Custodian *)scheme_get_param(config, MZCONFIG_CUSTODIAN); - m = scheme_make_custodian(oldm); - scheme_set_param(config, MZCONFIG_CUSTODIAN, (Scheme_Object *)m); - wxREGGLOB(main_custodian); - main_custodian = m; - } -#endif /* Create the user's main thread: */ @@ -1681,11 +1637,6 @@ void wxDoEvents() user_main_thread->name = cp; } -#if WINDOW_STDIO - if (!wx_in_terminal) - scheme_set_param(config, MZCONFIG_CUSTODIAN, (Scheme_Object *)oldm); -#endif - /* Block until the user's main thread is initialized: */ scheme_block_until(CAST_BLKCHK check_initialized, NULL, NULL, 0.0); } @@ -2255,235 +2206,11 @@ void MrEdQueueInEventspace(void *context, Scheme_Object *thunk) /* Redirected Standard I/O */ /****************************************************************************/ -#if REDIRECT_STDIO || WINDOW_STDIO || WCONSOLE_STDIO +#if REDIRECT_STDIO || WCONSOLE_STDIO static void MrEdSchemeMessages(char *, ...); static Scheme_Object *stdin_pipe; #endif -#if WINDOW_STDIO - -static int have_stdio = 0; -static int stdio_kills_prog = 0; -static Bool RecordInput(void *media, wxEvent *event, void *data); -static Bool SendBreak(void *media, wxEvent *event, void *data); -static void break_console_reading_threads(); -static char utf8_leftover[8]; -static int utf8_leftover_count; - -class IOMediaEdit : public wxMediaEdit -{ -public: - Bool CanInsert(long start, long); - Bool CanDelete(long start, long); -}; - -class IOFrame : public wxFrame -{ -public: - wxMediaCanvas *display; - wxMediaEdit *media; - wxMenu *fileMenu; - Bool hidden, beginEditSeq; - int endpos; - - IOFrame(); - void OnSize(int x, int y); - Bool OnClose(void); - void OnMenuCommand(long id); - Bool PreOnChar(wxWindow *, wxKeyEvent *e); - Bool PreOnEvent(wxWindow *, wxMouseEvent *e); - void CloseIsQuit(void); -}; - -IOFrame::IOFrame() - : wxFrame(NULL, "Standard Output", -1, -1, 600, 400, 0, "stdout") -{ - wxKeymap *km; - wxStyle *style; - wxStyleList *sl; - wxStyleDelta *sd; - wxMenuBar *mb; - wxMenu *m; - - display = new WXGC_PTRS wxMediaCanvas(this); - - media = new WXGC_PTRS IOMediaEdit(); - display->SetMedia(media); - endpos = 0; - hidden = FALSE; - - /* Map copy keys: */ - km = media->GetKeymap(); - media->AddBufferFunctions(km); - media->AddEditorFunctions(km); - km->AddFunction("send-break", SendBreak, NULL); -# ifdef wx_msw - km->MapFunction("c:c", "copy-clipboard"); - km->MapFunction("c:x", "copy-clipboard"); - km->MapFunction("c:v", "paste-clipboard"); -# else - km->MapFunction("d:c", "copy-clipboard"); - km->MapFunction("d:x", "copy-clipboard"); - km->MapFunction("d:v", "paste-clipboard"); - km->MapFunction("d:.", "send-break"); -# endif - km->MapFunction("return", "record-input"); - km->AddFunction("record-input", RecordInput, NULL); - - /* Fixed-width font: */ - sl = media->GetStyleList(); - style = sl->FindNamedStyle("Standard"); - sd = new WXGC_PTRS wxStyleDelta(wxCHANGE_FAMILY, wxMODERN); - style->SetDelta(sd); - -#ifdef wx_mac - OnSize(600, 400); -#endif - -#ifdef wx_mac -# define CLOSE_MENU_ITEM "Close\tCmd+W" -#else -# define CLOSE_MENU_ITEM "Close" -#endif - - mb = new WXGC_PTRS wxMenuBar(); - SetMenuBar(mb); - fileMenu = new WXGC_PTRS wxMenu(); - fileMenu->Append(77, CLOSE_MENU_ITEM); - m = new WXGC_PTRS wxMenu(); - m->Append(79, "&Copy\tCmd+C"); - m->Append(81, "&Paste\tCmd+V"); - m->AppendSeparator(); - m->Append(83, "&Break\tCmd+."); - mb->Append(fileMenu, "File"); - mb->Append(m, "Edit"); - - have_stdio = 1; - Show(TRUE); - - beginEditSeq = 0; -} - -void IOFrame::OnSize(int x, int y) -{ - GetClientSize(&x, &y); - if (display) - display->SetSize(0, 0, x, y); - if (media && (x > 30)) - media->SetMaxWidth((float)(x - 30)); -} - -Bool IOFrame::OnClose(void) -{ - hidden = TRUE; - if (stdio_kills_prog) { - if (scheme_exit) - scheme_exit(exit_val); -#ifdef wx_msw - mred_clean_up_gdi_objects(); -#endif - scheme_immediate_exit(exit_val); - } else { - break_console_reading_threads(); - have_stdio = 0; - } - return TRUE; -} - -void IOFrame::OnMenuCommand(long id) -{ - if (id == 79) - media->Copy(); - else if (id == 81) - media->Paste(); - else if (id == 83) - scheme_break_main_thread(); - else if (id == 77) - if (OnClose()) - Show(FALSE); -} - -Bool IOFrame::PreOnChar(wxWindow *, wxKeyEvent *e) -{ - PreOnEvent(NULL, NULL); - -#if defined(wx_mac) && WINDOW_STDIO - if (e->metaDown && e->KeyCode() == (stdio_kills_prog ? 'q' : 'w')) { - OnMenuCommand(77); - return TRUE; - } -#endif - - return FALSE; -} - -Bool IOFrame::PreOnEvent(wxWindow *, wxMouseEvent *e) -{ - if (beginEditSeq) { - beginEditSeq = 0; - media->EndEditSequence(); - } - - return FALSE; -} - -void IOFrame::CloseIsQuit(void) -{ -#ifdef wx_mac -# define QUIT_MENU_ITEM "Quit\tCmd+Q" -#else -# define QUIT_MENU_ITEM "E&xit" -#endif - fileMenu->Delete(77); - fileMenu->Append(77, QUIT_MENU_ITEM); - - media->Insert("\n[Exited]", media->LastPosition()); - if (beginEditSeq) { - beginEditSeq = 0; - media->EndEditSequence(); - } - media->Lock(1); -} - -static IOFrame *ioFrame = NULL; - -Bool IOMediaEdit::CanInsert(long start, long) -{ - return (start >= ioFrame->endpos); -} - -Bool IOMediaEdit::CanDelete(long start, long) -{ - return (start >= ioFrame->endpos); -} - -static Bool RecordInput(void *m, wxEvent *event, void *data) -{ - char *s; - long len, start; - wxMediaEdit *media = ioFrame->media; - - media->Insert("\n"); - start = media->GetStartPosition(); - len = start - ioFrame->endpos; - if (len > 0) { - s = media->GetTextUTF8(ioFrame->endpos, start); - ioFrame->endpos = start; - - scheme_write_byte_string(s, len, stdin_pipe); - } - - return TRUE; -} - -static Bool SendBreak(void *m, wxEvent *event, void *data) -{ - scheme_break_main_thread(); - return TRUE; -} - -#else /* !WINDOW_STDIO */ - #if WCONSOLE_STDIO static HANDLE console_out; @@ -2498,66 +2225,15 @@ static FILE *mrerr = NULL; #endif /* WCONSOLE_STDIO */ -#endif /* WINDOW_STDIO */ - -#if REDIRECT_STDIO || WINDOW_STDIO || WCONSOLE_STDIO +#if REDIRECT_STDIO || WCONSOLE_STDIO static void MrEdSchemeMessages(char *msg, ...) { GC_CAN_IGNORE va_list args; -#if WINDOW_STDIO - char *arg_s = NULL; - long arg_d = 0, arg_l = 0; -# define VSP_BUFFER_SIZE 4096 - char arg_buffer[VSP_BUFFER_SIZE]; -#endif scheme_start_atomic(); HIDE_FROM_XFORM(va_start(args, msg)); -#if WINDOW_STDIO - if (!wx_in_terminal) { - static int opening = 0; - - if (opening) { - HIDE_FROM_XFORM(va_end(args)); - return; - } - - /* Need to extract arguments before a potential GC */ - if (!msg) { - arg_s = HIDE_FROM_XFORM(va_arg(args, char*)); - arg_d = HIDE_FROM_XFORM(va_arg(args, long)); - arg_l = HIDE_FROM_XFORM(va_arg(args, long)); - } else { -# ifdef MPW_CPLUS - /* FIXME: No vsnprintf in MPW. */ -# define vsnprintf(x, y, z, w) vsprintf(x, z, w) -# endif - MSC_IZE(vsnprintf)(arg_buffer, VSP_BUFFER_SIZE, msg, args); - } - - opening = 1; - if (!ioFrame) { - wxREGGLOB(ioFrame); - if (mred_only_context) - ioFrame = new WXGC_PTRS IOFrame; - else { - /* Set eventspace ... */ - mred_only_context = mred_main_context; - only_context_just_once = 1; - ioFrame = new WXGC_PTRS IOFrame; - mred_only_context = NULL; - } - } - opening = 0; - if (ioFrame->hidden) { - ioFrame->hidden = FALSE; - have_stdio = 1; - ioFrame->Show(TRUE); - } - } -#endif #if WCONSOLE_STDIO if (!console_out) { AllocConsole(); @@ -2574,60 +2250,6 @@ static void MrEdSchemeMessages(char *msg, ...) } #endif -#if WINDOW_STDIO - if (wx_in_terminal) { - vfprintf(stderr, msg, args); - fflush(stderr); - } else if (!msg) { - char *s; - wxchar *us; - long d, l, ulen, ipos; - - s = arg_s; - d = arg_d; - l = arg_l; - - if (!ioFrame->beginEditSeq) { - ioFrame->media->BeginEditSequence(); - ioFrame->beginEditSeq = 1; - } - - if (utf8_leftover_count) { - char *naya; - naya = new WXGC_ATOMIC char[l + utf8_leftover_count]; - memcpy(naya, utf8_leftover, utf8_leftover_count); - memcpy(naya + utf8_leftover_count, s + d, l); - s = naya; - d = 0; - l += utf8_leftover_count; - } - - ulen = scheme_utf8_decode_as_prefix((unsigned char *)s, d, l, - NULL, 0, -1, - &ipos, 0, '?'); - utf8_leftover_count = (l - (ipos - d)); - memcpy(utf8_leftover, s + ipos, utf8_leftover_count); - - us = (wxchar *)scheme_malloc_atomic(sizeof(wxchar) * ulen); - scheme_utf8_decode_as_prefix((unsigned char *)s, d, l, - us, 0, -1, - &ipos, 0, '?'); - ioFrame->media->Insert(ulen, us, ioFrame->endpos); - ioFrame->endpos += ulen; - - if (ulen != 1 || s[0] == '\n') { - ioFrame->media->EndEditSequence(); - ioFrame->beginEditSeq = 0; - } - } else { - ioFrame->media->Insert((char *)arg_buffer, ioFrame->endpos); - ioFrame->endpos += strlen(arg_buffer); - if (ioFrame->beginEditSeq) { - ioFrame->media->EndEditSequence(); - ioFrame->beginEditSeq = 0; - } - } -#endif #if WCONSOLE_STDIO if (!msg) { char *s; @@ -2645,7 +2267,7 @@ static void MrEdSchemeMessages(char *msg, ...) WriteConsole(console_out, buffer, strlen(buffer), &wrote, NULL); } #endif -#if !WINDOW_STDIO && !WCONSOLE_STDIO +#if !WCONSOLE_STDIO vfprintf(mrerr, msg, args); fflush(mrerr); #endif @@ -2662,7 +2284,7 @@ static void MrEdSchemeMessagesOutput(char *s, long l) } #endif -#if REDIRECT_STDIO || WINDOW_STDIO || WCONSOLE_STDIO +#if REDIRECT_STDIO || WCONSOLE_STDIO static Scheme_Object *console_reading; @@ -2769,7 +2391,7 @@ static Scheme_Object *MrEdMakeStdIn(void) static long stdout_write(Scheme_Output_Port*, const char *s, long d, long l, int rarely_block, int enable_break) { -#if WINDOW_STDIO || WCONSOLE_STDIO +#if WCONSOLE_STDIO if (l) MrEdSchemeMessages(NULL, s, d, l); #else @@ -2800,7 +2422,7 @@ static Scheme_Object *MrEdMakeStdOut(void) static long stderr_write(Scheme_Output_Port*, const char *s, long d, long l, int rarely_block, int enable_break) { -#if WINDOW_STDIO || WCONSOLE_STDIO +#if WCONSOLE_STDIO if (l) MrEdSchemeMessages(NULL, s, d, l); #else @@ -2849,7 +2471,7 @@ extern "C" GC_word GC_fo_entries; Scheme_Object *OBJDump(int, Scheme_Object *[]) { -# if REDIRECT_STDIO || WINDOW_STDIO || WCONSOLE +# if REDIRECT_STDIO || WCONSOLE_STDIO # define PRINT_IT MrEdSchemeMessages # else # define PRINT_IT scheme_console_printf @@ -3202,19 +2824,6 @@ void *wxMallocAtomicIfPossible(size_t s) return v; } -static const char *CallSchemeExpand(const char *filename, const char *who, int to_write) -{ - char *s; - - s = scheme_expand_filename((char *)filename, strlen(filename), - who, 0, - (to_write - ? SCHEME_GUARD_FILE_WRITE - : SCHEME_GUARD_FILE_READ)); - - return s ? s : filename; -} - #if !defined(USE_SENORA_GC) && !defined(MZ_PRECISE_GC) static void MrEdIgnoreWarnings(char *, GC_word) { @@ -3233,8 +2842,6 @@ static Scheme_Env *setup_basic_env() scheme_set_banner(BANNER); - wxmeExpandFilename = CallSchemeExpand; - #ifdef DANGER_ALARM { DangerThreadTimer *t = new WXGC_PTRS DangerThreadTimer(); @@ -3316,7 +2923,7 @@ wxFrame *MrEdApp::OnInit(void) new WXGC_PTRS Regex("a", 0); #endif -#if REDIRECT_STDIO || WINDOW_STDIO || WCONSOLE_STDIO +#if REDIRECT_STDIO || WCONSOLE_STDIO if (!wx_in_terminal) { scheme_make_stdin = CAST_MK MrEdMakeStdIn; scheme_make_stdout = CAST_MK MrEdMakeStdOut; @@ -3337,7 +2944,7 @@ wxFrame *MrEdApp::OnInit(void) # endif #endif -#if REDIRECT_STDIO || WINDOW_STDIO || WCONSOLE_STDIO +#if REDIRECT_STDIO || WCONSOLE_STDIO scheme_console_printf = CAST_PRINTF MrEdSchemeMessages; if (!wx_in_terminal) { scheme_console_output = CAST_OUTPUT MrEdSchemeMessagesOutput; @@ -3348,8 +2955,6 @@ wxFrame *MrEdApp::OnInit(void) mred_event_dispatch_param = scheme_new_param(); mred_ps_setup_param = scheme_new_param(); - wxInitSnips(); /* and snip classes */ - mred_eventspace_type = scheme_make_type(""); mred_nested_wait_type = scheme_make_type(""); mred_eventspace_hop_type = scheme_make_type(""); @@ -3389,16 +2994,6 @@ wxFrame *MrEdApp::OnInit(void) cl = new WXGC_PTRS wxChildList(); mmc->topLevelWindowList = cl; } - { - wxStandardSnipClassList *scl; - scl = wxMakeTheSnipClassList(); - mmc->snipClassList = scl; - } - { - wxBufferDataClassList *dcl; - dcl = wxMakeTheBufferDataClassList(); - mmc->bufferDataClassList = dcl; - } { MrEdFinalizedContext *fc; fc = new WXGC_PTRS MrEdFinalizedContext; @@ -3418,7 +3013,7 @@ wxFrame *MrEdApp::OnInit(void) TheMrEdApp->wx_frame = mred_real_main_frame; #endif - wxInitMedia(); + wxInitClipboard(); wxscheme_early_gl_init(); @@ -3432,41 +3027,9 @@ wxFrame *MrEdApp::OnInit(void) mred_run_from_cmd_line(argc, argv, setup_basic_env); -#if WINDOW_STDIO - if (!wx_in_terminal) { - /* The only reason we get here is that a command-line error or - -h occured. In either case, stick around for the sake of the - console. */ - setup_basic_env(); - TheMrEdApp->initialized = 1; - stdio_kills_prog = 1; - if (ioFrame) - ioFrame->CloseIsQuit(); - wxTheApp->MainLoop(); - } -#endif - return NULL; } -#if WINDOW_STDIO -static void MrEdExit(int v) -{ - if (have_stdio) { - stdio_kills_prog = 1; - if (ioFrame) - ioFrame->CloseIsQuit(); - scheme_close_managed(main_custodian); - return; - } - -#ifdef wx_msw - mred_clean_up_gdi_objects(); -#endif - scheme_immediate_exit(v); -} -#endif - static void on_main_killed(Scheme_Thread *p) { on_handler_killed(p); @@ -3488,13 +3051,7 @@ void MrEdApp::RealInit(void) initialized = 1; - wxMediaIOCheckLSB(/* scheme_console_printf */); - thread->on_kill = CAST_TOK on_main_killed; -#if WINDOW_STDIO - if (!wx_in_terminal) - scheme_exit = CAST_EXIT MrEdExit; -#endif #ifdef wx_xt if (wx_single_instance) { @@ -3968,13 +3525,6 @@ void wxDrop_Runtime(char **argv, int argc) #if defined(wx_mac) || defined(wx_msw) void wxDrop_Quit() { -#if WINDOW_STDIO - if (ioFrame) { - if (ioFrame->OnClose()) - ioFrame->Show(FALSE); - } -#endif - wxDo(wxs_app_quit_proc, 0, NULL); } #endif diff --git a/src/mred/mred.h b/src/mred/mred.h index 0b3c686ece..cbd35c0aea 100644 --- a/src/mred/mred.h +++ b/src/mred/mred.h @@ -52,8 +52,6 @@ typedef struct MrEdContext { MrEdFinalizedContext *finalized; wxChildList *topLevelWindowList; - wxStandardSnipClassList *snipClassList; - wxBufferDataClassList *bufferDataClassList; wxWindow *modal_window; MrEd_Saved_Modal *modal_stack; @@ -191,19 +189,8 @@ MRED_EXTERN void mred_set_run_from_cmd_line(MrEd_Run_From_Cmd_Line_Proc); #endif #define BANNER "MrEd v" MZSCHEME_VERSION mrVERSION_SUFFIX ", Copyright (c) 2004-2009 PLT Scheme Inc.\n" -#ifndef WINDOW_STDIO -/* Removing "|| defined(wx_msw)" below uses the Windows console. - The danger is that closing that console kills MrEd without - any chance of cancelling the kill. */ -# if defined(wx_mac) || defined(wx_msw) -# define WINDOW_STDIO 1 -# else -# define WINDOW_STDIO 0 -# endif -#endif - #ifndef WCONSOLE_STDIO -# if defined(wx_msw) && !WINDOW_STDIO +# if defined(wx_msw) # define WCONSOLE_STDIO 1 # else # define WCONSOLE_STDIO 0 @@ -211,7 +198,7 @@ MRED_EXTERN void mred_set_run_from_cmd_line(MrEd_Run_From_Cmd_Line_Proc); #endif #ifndef REDIRECT_STDIO -# if (defined(wx_msw) || defined(wx_mac)) && !WINDOW_STDIO && !WCONSOLE_STDIO +# if (defined(wx_msw) || defined(wx_mac)) && !WCONSOLE_STDIO # define REDIRECT_STDIO 1 # else # define REDIRECT_STDIO 0 diff --git a/src/mred/mredmac.cxx b/src/mred/mredmac.cxx index 547e65acc4..e46e694435 100644 --- a/src/mred/mredmac.cxx +++ b/src/mred/mredmac.cxx @@ -10,7 +10,10 @@ #include "common.h" #include "wx_main.h" -#include "wx_media.h" +#include "wx_win.h" +#include "wx_frame.h" +#include "wx_canvs.h" +#include "wx_utils.h" #include "scheme.h" #include "wx_macevents.h" #include "wx_het.h" diff --git a/src/mred/mredmsw.cxx b/src/mred/mredmsw.cxx index 90b2c213c0..35b76b7c7c 100644 --- a/src/mred/mredmsw.cxx +++ b/src/mred/mredmsw.cxx @@ -12,7 +12,7 @@ # include "wx.h" #endif #include "wx_main.h" -#include "wx_media.h" +#include "wx_utils.h" #include "scheme.h" #include "wx_dialg.h" diff --git a/src/mred/mredx.cxx b/src/mred/mredx.cxx index 3ec0638008..7a2a61ecd1 100644 --- a/src/mred/mredx.cxx +++ b/src/mred/mredx.cxx @@ -12,7 +12,7 @@ #define Uses_XLib #include "wx_main.h" -#include "wx_media.h" +#include "wx_win.h" #include "wx_clipb.h" #include "scheme.h" diff --git a/src/mred/wxme/Makefile.in b/src/mred/wxme/Makefile.in deleted file mode 100644 index 4c2a33e70a..0000000000 --- a/src/mred/wxme/Makefile.in +++ /dev/null @@ -1,136 +0,0 @@ - -srcdir = @srcdir@ -builddir = @builddir@ - -PLTSRCDIR = $(srcdir)/../.. -PLTBUILDDIR = $(builddir)/../.. - -########################### -# Common Macros # -########################### -CC = @CC@ -CXX = @CXX@ -LINKER = $(CXX) -PERL = @PERL@ -RANLIB = @RANLIB@ -AR = @STATIC_AR@ -ARFLAGS = @ARFLAGS@ -OPTIONS = @OPTIONS@ @MROPTIONS@ -COMPFLAGS = @CFLAGS@ @PROFFLAGS@ -XINCLUDE = @X_CFLAGS@ -XLIB = @X_LIBS@ -LDLIBS = @X_PRE_LIBS@ -lXaw -lXmu -lXt -lX11 -lXext @X_EXTRA_LIBS@ @LIBS@ -GCDIRECTORY = @GCDIR@ -WBUILD = @WBUILD@ -WXVARIANT = @WXVARIANT@ - -WXINC_wx_xt = -I$(PLTSRCDIR)/wxxt/src/AIAI-include -I$(PLTSRCDIR)/wxxt/src -WXINC_wx_mac = -I$(PLTSRCDIR)/wxmac/include/base -I$(PLTSRCDIR)/wxmac/include/mac -I$(PLTSRCDIR)/wxcommon -I$(PLTSRCDIR)/a-list/c-headers/ - -WXINC = $(WXINC_@WXVARIANT@) -NOGCINC = $(WXINC) -I$(PLTSRCDIR)/mred/wxme/ -I$(PLTBUILDDIR)/mzscheme/ -I$(PLTSRCDIR)/mzscheme/include/ -INC = -I$(PLTSRCDIR)/mzscheme/$(GCDIRECTORY) $(NOGCINC) -CXXFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) -D$(WXVARIANT) @COMPFLAGS@ @PROFFLAGS@ @CXXFLAGS@ @PREFLAGS@ -CFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) -D$(WXVARIANT) @COMPFLAGS@ @PROFFLAGS@ @CFLAGS@ @PREFLAGS@ -LDFLAGS = $(XLIB) -########################### - -OBJECTS = wx_style.@LTO@ wx_keym.@LTO@ wx_mbuf.@LTO@ \ - wx_media.@LTO@ wx_mpriv.@LTO@ wx_msnip.@LTO@ \ - wx_mline.@LTO@ wx_mpbrd.@LTO@ \ - wx_medad.@LTO@ wx_snip.@LTO@ wx_cgrec.@LTO@ \ - wx_medio.@LTO@ - -OBJECTHEADER_wx_xt = $(srcdir)/../../wxxt/src/DataStructures/Object.h -PENBRUSHHEADER_wx_xt = $(srcdir)/../../wxxt/src/GDI-Classes/Pen+Brush.h -DCHEADER_wx_xt = $(srcdir)/../../wxxt/src/DeviceContexts/DC.h -STDEVHEADER_wx_xt = $(srcdir)/../../wxxt/src/EventHandling/wx_stdev.h -WINDOWHEADER_wx_xt = $(srcdir)/../../wxxt/src/Windows/Window.h - -OBJECTHEADER_wx_mac = $(srcdir)/../../wxmac/include/base/wx_obj.h -PENBRUSHHEADER_wx_mac = -DCHEADER_wx_mac = -STDEVHEADER_wx_mac = -WINDOWHEADER_wx_mac = - -PENBRUSHHEADER = $(PENBRUSHHEADER_@WXVARIANT@) -DCHEADER = $(DCHEADER_@WXVARIANT@) -STDEVHEADER = $(STDEVHEADER_@WXVARIANT@) -WINDOWHEADER = $(WINDOWHEADER_@WXVARIANT@) - -WXPRECOMPDIR = ../../wxmac/src - -ALLHEADERS = $(srcdir)/wx_ptreq.h $(srcdir)/wx_mtype.h \ - $(OBJECTHEADER_@WXVARIANT@) @WXPRECOMP@ \ - $(srcdir)/../../wxcommon/wxGC.h $(srcdir)/../../wxcommon/wx_list.h -HEADERS = $(srcdir)/wx_media.h $(srcdir)/wx_medad.h $(srcdir)/wx_cgrec.h \ - $(srcdir)/wx_medio.h $(srcdir)/wx_style.h \ - $(ALLHEADERS) $(WINDOWHEADER) $(DCHEADER) $(STDEVHEADER) - -libwxme.@LIBSFX@: $(OBJECTS) - $(AR) $(ARFLAGS) libwxme.@LIBSFX@ $(OBJECTS) - $(RANLIB) libwxme.@LIBSFX@ - -LOCALFLAGS_wx_xt = @WX_MMD_FLAG@ -LOCALFLAGS_wx_mac = -MMD -DWX_CARBON -LOCALFLAGS = $(LOCALFLAGS_@WXVARIANT@) - -MCC = $(CXX) @USE_WXPRECOMP@ $(CXXFLAGS) $(LOCALFLAGS) -c - -wx_media.@LTO@ : $(srcdir)/wx_media.cxx $(HEADERS) $(srcdir)/wx_keym.h $(srcdir)/wx_snip.h \ - $(srcdir)/wx_mpriv.h $(srcdir)/wx_mline.h - $(MCC) $(srcdir)/wx_media.cxx -o wx_media.@LTO@ - -wx_mpriv.@LTO@ : $(srcdir)/wx_mpriv.cxx $(HEADERS) $(srcdir)/wx_keym.h $(srcdir)/wx_snip.h $(srcdir)/wx_mpriv.h \ - $(srcdir)/wx_mline.h $(srcdir)/wx_gcrct.h $(PENBRUSHHEADER) - $(MCC) $(srcdir)/wx_mpriv.cxx -o wx_mpriv.@LTO@ - -wx_msnip.@LTO@ : $(srcdir)/wx_msnip.cxx $(HEADERS) $(srcdir)/wx_keym.h $(srcdir)/wx_snip.h $(srcdir)/wx_madm.h \ - $(srcdir)/wx_mpriv.h $(srcdir)/wx_gcrct.h - $(MCC) $(srcdir)/wx_msnip.cxx -o wx_msnip.@LTO@ - -wx_mline.@LTO@ : $(srcdir)/wx_mline.cxx $(srcdir)/wx_mline.h $(srcdir)/wx_snip.h $(HEADERS) - $(MCC) $(srcdir)/wx_mline.cxx -o wx_mline.@LTO@ - -wx_mpbrd.@LTO@ : $(srcdir)/wx_mpbrd.cxx $(HEADERS) $(srcdir)/wx_keym.h $(srcdir)/wx_snip.h $(srcdir)/wx_medpb.h \ - $(PENBRUSHHEADER) - $(MCC) $(srcdir)/wx_mpbrd.cxx -o wx_mpbrd.@LTO@ - -wx_medad.@LTO@ : $(srcdir)/wx_medad.cxx $(HEADERS) $(srcdir)/wx_snip.h $(srcdir)/wx_madm.h - $(MCC) $(srcdir)/wx_medad.cxx -o wx_medad.@LTO@ - -wx_mbuf.@LTO@ : $(srcdir)/wx_mbuf.cxx $(HEADERS) $(srcdir)/wx_keym.h $(srcdir)/wx_snip.h $(srcdir)/../../wxcommon/PSDC.h - $(MCC) $(srcdir)/wx_mbuf.cxx -o wx_mbuf.@LTO@ - -wx_snip.@LTO@ : $(srcdir)/wx_snip.cxx $(HEADERS) $(srcdir)/wx_gcrct.h - $(MCC) $(srcdir)/wx_snip.cxx -o wx_snip.@LTO@ - -wx_cgrec.@LTO@ : $(srcdir)/wx_cgrec.cxx $(HEADERS) $(srcdir)/wx_snip.h - $(MCC) $(srcdir)/wx_cgrec.cxx -o wx_cgrec.@LTO@ - -wx_keym.@LTO@ : $(srcdir)/wx_keym.cxx $(srcdir)/wx_keym.h $(ALLHEADERS) - $(MCC) $(srcdir)/wx_keym.cxx -o wx_keym.@LTO@ - -wx_medio.@LTO@ : $(srcdir)/wx_medio.cxx $(srcdir)/wx_medio.h $(ALLHEADERS) - $(MCC) $(srcdir)/wx_medio.cxx -o wx_medio.@LTO@ - -wx_style.@LTO@ : $(srcdir)/wx_style.cxx $(srcdir)/wx_style.h $(srcdir)/wx_medio.h $(ALLHEADERS) \ - $(DCHEADER) $(PENBRUSHHEADER) - $(MCC) $(srcdir)/wx_style.cxx -o wx_style.@LTO@ - -clean: - rm -f *.@LTO@ *.@LIBSFX@ *.d *~ core - - -@INCLUDEDEP@ wx_style.d -@INCLUDEDEP@ wx_keym.d -@INCLUDEDEP@ wx_mbuf.d -@INCLUDEDEP@ wx_media.d -@INCLUDEDEP@ wx_mpriv.d -@INCLUDEDEP@ wx_msnip.d -@INCLUDEDEP@ wx_mline.d -@INCLUDEDEP@ wx_mpbrd.d -@INCLUDEDEP@ wx_medad.d -@INCLUDEDEP@ wx_snip.d -@INCLUDEDEP@ wx_cgrec.d -@INCLUDEDEP@ wx_medio.d diff --git a/src/mred/wxme/wx_cgrec.cxx b/src/mred/wxme/wx_cgrec.cxx deleted file mode 100644 index 48d660d3cc..0000000000 --- a/src/mred/wxme/wx_cgrec.cxx +++ /dev/null @@ -1,753 +0,0 @@ -/* - * File: wx_cgrec.cc - * Purpose: wxChangeRecord implementations - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" -#include -#include -#include "wx_media.h" -#include "wx_ptreq.h" - -class wxcgList -#ifndef MZ_PRECISE_GC -: public gc -#endif -{ -public: - long count, size; - wxObject **array; - - wxcgList(void) { count = size = 0; } - - int Count() { return count; } - wxObject *Get(int i) { return array[i]; } - - void Append(wxObject *o); - void DeleteAll(void); -}; - -void wxcgList::Append(wxObject *o) -{ - if (count >= size) { - wxObject **naya; - if (size) - size *= 2; - else - size = 2; - naya = new WXGC_PTRS wxObject*[size]; - memcpy(naya, array, count * sizeof(wxObject*)); - array = naya; - } - array[count++] = o; -} - -void wxcgList::DeleteAll(void) -{ - wxObject *o; - while (count--) { - o = array[count]; - DELETE_OBJ o; - } -} - -wxChangeRecord::wxChangeRecord(void) -{ -} - -wxChangeRecord::~wxChangeRecord(void) -{ -} - -Bool wxChangeRecord::Undo(wxMediaBuffer *) -{ - return FALSE; -} - -void wxChangeRecord::DropSetUnmodified(void) -{ -} - -Bool wxChangeRecord::IsComposite() -{ - return FALSE; -} - -wxChangeRecordId *wxChangeRecord::GetId() -{ - return NULL; -} - -int wxChangeRecord::GetParity() -{ - return 0; -} - -wxChangeRecord *wxChangeRecord::Inverse() -{ - return NULL; -} - -#if CGREC_DEBUG -char *wxChangeRecord::GetName() -{ - return "???"; -} -#endif - - -wxSchemeModifyRecord::wxSchemeModifyRecord(void *proc) -{ - p = proc; -} - -extern int wxsSchemeUndo(void *); - -Bool wxSchemeModifyRecord::Undo(wxMediaBuffer *) -{ - return wxsSchemeUndo(p); -} - -#if CGREC_DEBUG -char *wxSchemeModifyRecord::GetName() -{ - return "scheme-modify"; -} -#endif - - -wxUnmodifyRecord::wxUnmodifyRecord(Bool _cont) -{ - ok = 1; - cont = _cont; -} - -Bool wxUnmodifyRecord::Undo(wxMediaBuffer *media) -{ - if (ok) - media->SetModified(FALSE); - return cont; -} - -void wxUnmodifyRecord::DropSetUnmodified(void) -{ - ok = 0; -} - -#if CGREC_DEBUG -char *wxUnmodifyRecord::GetName() -{ - return "unmodify"; -} -#endif - - -wxInsertRecord::wxInsertRecord(long position, long length, Bool cont, long ss, long es) -{ - start = position; - end = position + length; - continued = cont; - startsel = ss; - endsel = es; -} - -Bool wxInsertRecord::Undo(wxMediaBuffer *buffer) -{ - wxMediaEdit *media; - media = (wxMediaEdit *)buffer; - - media->Delete(start, end); - - media->SetPosition(startsel, endsel); - - return continued; -} - -#if CGREC_DEBUG -char *wxInsertRecord::GetName() -{ - return "insert"; -} -#endif - -wxInsertSnipRecord::wxInsertSnipRecord(wxSnip *thesnip, Bool cont) -{ - snip = thesnip; - continued = cont; -} - -Bool wxInsertSnipRecord::Undo(wxMediaBuffer *buffer) -{ - wxMediaPasteboard *media; - media = (wxMediaPasteboard *)buffer; - - media->Delete(snip); - if (!continued) - media->SetSelected(snip); - - return continued; -} - -#if CGREC_DEBUG -char *wxInsertSnipRecord::GetName() -{ - return "insert-snip"; -} -#endif - -class DeleteSnipItem /* : public wxObject --- uncomment to GC */ -{ - public: - ~DeleteSnipItem(); - - wxDeleteSnipRecord *parent; - wxSnip *snip, *before; - double x, y; -}; - -DeleteSnipItem::~DeleteSnipItem() -{ - if (!parent->undid) { - if (snip->flags & wxSNIP_OWNED) - snip->flags -= wxSNIP_OWNED; - snip->SetAdmin(NULL); - } -} - -wxDeleteSnipRecord::wxDeleteSnipRecord(Bool cont) -{ - continued = cont; - deletions = new WXGC_PTRS wxcgList(); -} - -wxDeleteSnipRecord::~wxDeleteSnipRecord() -{ - int i; - - for (i = deletions->Count(); i--; ) { - DeleteSnipItem *ds; - ds = (DeleteSnipItem *)deletions->Get(i); - } - - DELETE_OBJ deletions; -} - -void wxDeleteSnipRecord::InsertSnip(wxSnip *snip, wxSnip *before, - double x, double y) -{ - DeleteSnipItem *item; - - item = new WXGC_PTRS DeleteSnipItem(); - item->parent = this; - item->snip = snip; - item->before = before; - item->x = x; - item->y = y; - - deletions->Append((wxObject *)item); -} - -Bool wxDeleteSnipRecord::Undo(wxMediaBuffer *buffer) -{ - DeleteSnipItem *item; - wxMediaPasteboard *media; - int i, count; - - media = (wxMediaPasteboard *)buffer; - - if (!continued) - media->NoSelected(); - - count = deletions->Count(); - for (i = 0; i < count; i++) { - item = (DeleteSnipItem *)deletions->Get(i); - - /* Have to turn off the owned flag; we know that it's really ours */ - if (item->snip->flags & wxSNIP_OWNED) - item->snip->flags -= wxSNIP_OWNED; - - media->Insert(item->snip, item->before, item->x, item->y); - if (!continued) - media->AddSelected(item->snip); - } - - undid = TRUE; - - return continued; -} - -#if CGREC_DEBUG -char *wxDeleteSnipRecord::GetName() -{ - return "delete-snip"; -} -#endif - -wxDeleteRecord::wxDeleteRecord(long startpos, long endpos, Bool cont, long ss, long es) -{ - continued = cont; - start = startpos; - end = endpos; - startsel = ss; - endsel = es; - undid = FALSE; - deletions = new WXGC_PTRS wxcgList(); - clickbacks = NULL; -} - -wxDeleteRecord::~wxDeleteRecord() -{ - if (!undid) { - wxSnip *snip; - int i; - for (i = deletions->Count(); i--; ) { - snip = (wxSnip *)deletions->Get(i); - if (snip->flags & wxSNIP_OWNED) - snip->flags -= wxSNIP_OWNED; - snip->SetAdmin(NULL); - } - if (clickbacks) - clickbacks->DeleteAll(); - } - - DELETE_OBJ deletions; - if (clickbacks) - DELETE_OBJ clickbacks; -} - -void wxDeleteRecord::InsertSnip(wxSnip *snip) -{ - deletions->Append(snip); -} - -void wxDeleteRecord::AddClickback(wxClickback *click) -{ - if (!clickbacks) { - clickbacks = new WXGC_PTRS wxcgList(); - } - clickbacks->Append((wxObject *)click); -} - -Bool wxDeleteRecord::Undo(wxMediaBuffer *buffer) -{ - wxSnip *snip; - wxMediaEdit *media; - int i, count; - wxList *toAdd; - - media = (wxMediaEdit *)buffer; - - toAdd = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - - count = deletions->Count(); - for (i = count; i--; ) { - snip = (wxSnip *)deletions->Get(i); - - /* Have to turn off the owned flag, though we know that it's really ours */ - if (snip->flags & wxSNIP_OWNED) - snip->flags -= wxSNIP_OWNED; - - toAdd->Append(snip); - } - media->Insert(toAdd, start); - DELETE_OBJ toAdd; - - if (clickbacks) { - count = clickbacks->Count(); - for (i = 0; i < count; i++) { - wxClickback *cb; - cb = (wxClickback *)clickbacks->Get(i); - media->SetClickback(cb); - } - } - - media->SetPosition(startsel, endsel); - - undid = TRUE; - - return continued; -} - -#if CGREC_DEBUG -char *wxDeleteRecord::GetName() -{ - return "delete"; -} -#endif - -class StyleChange /* : public wxObject */ -{ - public: - long start, end; - wxStyle *style; -}; - -wxStyleChangeRecord::wxStyleChangeRecord(long startpos, long endpos, Bool cont, long ss, long es, Bool restoreSel) -{ - continued = cont; - start = startpos; - end = endpos; - startsel = ss; - endsel = es; - restoreSelection = restoreSel; - - changes = new WXGC_PTRS wxcgList(); -} - -wxStyleChangeRecord::~wxStyleChangeRecord() -{ - int i; - - for (i = changes->Count(); i--; ) { - StyleChange *sc; - sc = (StyleChange *)changes->Get(i); - } -} - -void wxStyleChangeRecord::AddStyleChange(long start, long end, wxStyle *style) -{ - StyleChange *change; - - change = new WXGC_PTRS StyleChange; - - change->start = start; - change->end = end; - change->style = style; - - changes->Append((wxObject *)change); -} - -Bool wxStyleChangeRecord::Undo(wxMediaBuffer *buffer) -{ - StyleChange *change; - long p; - wxMediaEdit *media; - int i, count; - - media = (wxMediaEdit *)buffer; - - p = start; - - count = changes->Count(); - for (i = 0; i < count; i++) { - change = (StyleChange *)changes->Get(i); - media->ChangeStyle(change->style, change->start, change->end); - } - - if (restoreSelection) - media->SetPosition(startsel, endsel); - - return continued; -} - -#if CGREC_DEBUG -char *wxStyleChangeRecord::GetName() -{ - return "style-change"; -} -#endif - -class StyleChangeSnip /* : public wxObject */ -{ - public: - wxSnip *snip; - wxStyle *style; -}; - -wxStyleChangeSnipRecord::wxStyleChangeSnipRecord(Bool cont) -{ - continued = cont; - - changes = new WXGC_PTRS wxcgList(); -} - -wxStyleChangeSnipRecord::~wxStyleChangeSnipRecord() -{ - int i; - - for (i = changes->Count(); i--; ) { - StyleChange *sc; - sc = (StyleChange *)changes->Get(i); - } - - DELETE_OBJ changes; -} - -void wxStyleChangeSnipRecord::AddStyleChange(wxSnip *snip, wxStyle *style) -{ - StyleChangeSnip *change; - - change = new WXGC_PTRS StyleChangeSnip; - - change->snip = snip; - change->style = style; - - changes->Append((wxObject *)change); -} - -Bool wxStyleChangeSnipRecord::Undo(wxMediaBuffer *buffer) -{ - StyleChangeSnip *change; - wxMediaPasteboard *media; - int i, count; - - media = (wxMediaPasteboard *)buffer; - - if (!continued) - media->NoSelected(); - - count = changes->Count(); - for (i = 0; i < count; i++) { - change = (StyleChangeSnip *)changes->Get(i); - media->ChangeStyle(change->style, change->snip); - if (!continued) - media->AddSelected(change->snip); - } - - return continued; -} - -#if CGREC_DEBUG -char *wxStyleChangeSnipRecord::GetName() -{ - return "style-change-snip"; -} -#endif - -wxMoveSnipRecord::wxMoveSnipRecord(wxSnip *s, double fx, double fy, - Bool d, Bool cont) -{ - snip = s; - continued = cont; - x = fx; - y = fy; - delta = d; -} - -Bool wxMoveSnipRecord::Undo(wxMediaBuffer *buffer) -{ - wxMediaPasteboard *media; - - media = (wxMediaPasteboard *)buffer; - - if (delta) - media->Move(snip, x, y); - else - media->MoveTo(snip, x, y); - - return continued; -} - -#if CGREC_DEBUG -char *wxMoveSnipRecord::GetName() -{ - return "move-snip"; -} -#endif - -wxResizeSnipRecord::wxResizeSnipRecord(wxSnip *s, double fx, double fy, - Bool cont) -{ - snip = s; - continued = cont; - x = fx; - y = fy; -} - -Bool wxResizeSnipRecord::Undo(wxMediaBuffer *buffer) -{ - wxMediaPasteboard *media; - - media = (wxMediaPasteboard *)buffer; - - media->Resize(snip, x, y); - - return continued; -} - -#if CGREC_DEBUG -char *wxResizeSnipRecord::GetName() -{ - return "resize-snip"; -} -#endif - - -wxCompositeRecord::wxCompositeRecord(int _cnt, wxChangeRecordId *_id, int _parity) -{ - cnt = _cnt; - seq = new WXGC_PTRS wxChangeRecord*[cnt]; - id = _id; - parity = _parity; - if (!id) { - id = new WXGC_PTRS wxChangeRecordId; - } - if (parity) - id->positive = this; - else - id->negative = this; -} - -wxCompositeRecord::~wxCompositeRecord() -{ - int i = cnt; - wxChangeRecord *cr; - while (i--) { - cr = seq[i]; - DELETE_OBJ cr; - } - cnt = 0; - seq = NULL; - if (id) { - if (parity) - id->positive = NULL; - else - id->negative = NULL; - id = NULL; - } -} - -Bool wxCompositeRecord::Undo(wxMediaBuffer *media) -{ - int i = cnt; - wxChangeRecord *cr; - while (i--) { - cr = seq[i]; - cr->Undo(media); - } - return FALSE; -} - -void wxCompositeRecord::DropSetUnmodified() -{ - int i = cnt; - wxChangeRecord *cr; - while (i--) { - cr = seq[i]; - cr->DropSetUnmodified(); - } -} - -void wxCompositeRecord::AddUndo(int pos, wxChangeRecord *c) -{ - seq[pos] = c; -} - -Bool wxCompositeRecord::IsComposite() -{ - return TRUE; -} - -wxChangeRecordId *wxCompositeRecord::GetId() -{ - return id; -} - -int wxCompositeRecord::GetParity() -{ - return parity; -} - -wxChangeRecord *wxCompositeRecord::Inverse() -{ - return new WXGC_PTRS wxInverseRecord(id, !parity); -} - -#if CGREC_DEBUG -char *wxCompositeRecord::GetName() -{ - if (cnt == 1) { - wxChangeRecord *cr; - cr = seq[0]; - return cr->GetName(); - } else - return "composite"; -} -#endif - -wxInverseRecord::wxInverseRecord(wxChangeRecordId *_id, int _parity) -{ - id = _id; - parity = _parity; -} - -wxInverseRecord::~wxInverseRecord() -{ - /* Avoid double-frees by not doing anything */ -} - -wxChangeRecord *wxInverseRecord::Get() -{ - if (parity) - return id->positive; - else - return id->negative; -} - -Bool wxInverseRecord::Undo(wxMediaBuffer *media) -{ - wxChangeRecord *c; - c = Get(); - return c->Undo(media); -} - -void wxInverseRecord::DropSetUnmodified() -{ - wxChangeRecord *c; - c = Get(); - if (c) - c->DropSetUnmodified(); -} - -wxChangeRecordId *wxInverseRecord::GetId() -{ - return id; -} - -int wxInverseRecord::GetParity() -{ - return parity; -} - -wxChangeRecord *wxInverseRecord::Inverse() -{ - wxChangeRecord *c; - c = Get(); - return c->Inverse(); -} - -#if CGREC_DEBUG -char *wxInverseRecord::GetName() -{ - wxChangeRecord *c; - c = Get(); - if (c) - return c->GetName(); - else - return "inverse"; -} -#endif - diff --git a/src/mred/wxme/wx_cgrec.h b/src/mred/wxme/wx_cgrec.h deleted file mode 100644 index dd2483aafc..0000000000 --- a/src/mred/wxme/wx_cgrec.h +++ /dev/null @@ -1,231 +0,0 @@ - -class wxcgList; - -#define CGREC_DEBUG 0 - -class wxChangeRecordId; - -class wxChangeRecord -#ifndef MZ_PRECISE_GC -: public gc -#endif -{ - public: - wxChangeRecord(void); - virtual ~wxChangeRecord(); - virtual Bool Undo(wxMediaBuffer *media); - virtual void DropSetUnmodified(void); - virtual Bool IsComposite(); - virtual wxChangeRecordId *GetId(); - virtual int GetParity(); - virtual wxChangeRecord *Inverse(); -#if CGREC_DEBUG - virtual char *GetName(); -#endif -}; - -class wxSchemeModifyRecord : public wxChangeRecord -{ - void *p; - public: - wxSchemeModifyRecord(void *p); - Bool Undo(wxMediaBuffer *media); -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxUnmodifyRecord : public wxChangeRecord -{ - Bool ok, cont; - public: - wxUnmodifyRecord(Bool cont); - Bool Undo(wxMediaBuffer *media); - void DropSetUnmodified(void); -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxInsertRecord : public wxChangeRecord -{ - private: - long start, end; - long startsel, endsel; - Bool continued; - public: - wxInsertRecord(long position, long length, Bool cont, long startsel, long endsel); - Bool Undo(wxMediaBuffer *media); -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxInsertSnipRecord : public wxChangeRecord -{ - private: - wxSnip *snip; - Bool continued; - public: - wxInsertSnipRecord(wxSnip *s, Bool cont); - Bool Undo(wxMediaBuffer *media); -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxDeleteRecord : public wxChangeRecord -{ - private: - Bool continued; - long start, end; - long startsel, endsel; - wxcgList *deletions; - wxcgList *clickbacks; - Bool undid; - - public: - wxDeleteRecord(long start, long end, Bool cont, long startsel, long endsel); - ~wxDeleteRecord(); - - void InsertSnip(wxSnip *); - void AddClickback(wxClickback *); - - Bool Undo(wxMediaBuffer *media); - -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxDeleteSnipRecord : public wxChangeRecord -{ - private: - Bool continued; - wxcgList *deletions; - - public: - Bool undid; - - wxDeleteSnipRecord(Bool cont); - ~wxDeleteSnipRecord(); - - void InsertSnip(wxSnip *, wxSnip *, double, double); - - Bool Undo(wxMediaBuffer *media); - -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxStyleChangeRecord : public wxChangeRecord -{ - private: - Bool continued, restoreSelection; - long start, end; - long startsel, endsel; - wxcgList *changes; - - public: - wxStyleChangeRecord(long start, long end, Bool cont, long startsel, long endsel, Bool restoreSel = 1); - ~wxStyleChangeRecord(); - - void AddStyleChange(long start, long end, wxStyle *style); - Bool Undo(wxMediaBuffer *media); - -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxStyleChangeSnipRecord : public wxChangeRecord -{ - private: - Bool continued; - wxcgList *changes; - - public: - wxStyleChangeSnipRecord(Bool cont); - ~wxStyleChangeSnipRecord(); - - void AddStyleChange(wxSnip *, wxStyle *style); - Bool Undo(wxMediaBuffer *media); - -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxMoveSnipRecord : public wxChangeRecord -{ - private: - Bool continued; - wxSnip *snip; - double x, y; - Bool delta; - public: - wxMoveSnipRecord(wxSnip *snip, double x, double y, Bool delta, Bool cont); - Bool Undo(wxMediaBuffer *media); -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxResizeSnipRecord : public wxChangeRecord -{ - private: - Bool continued; - wxSnip *snip; - double x, y; - public: - wxResizeSnipRecord(wxSnip *snip, double x, double y, Bool cont); - Bool Undo(wxMediaBuffer *media); -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxChangeRecordId { - public: - wxChangeRecord *positive, *negative; -}; - -class wxCompositeRecord : public wxChangeRecord -{ - int cnt; - int parity; - wxChangeRecordId *id; - wxChangeRecord **seq; - public: - wxCompositeRecord(int cnt, wxChangeRecordId *, int parity); - ~wxCompositeRecord(); - Bool Undo(wxMediaBuffer *media); - void DropSetUnmodified(void); - void AddUndo(int pos, wxChangeRecord *c); - Bool IsComposite(); - wxChangeRecordId *GetId(); - int GetParity(); - wxChangeRecord *Inverse(); -#if CGREC_DEBUG - char *GetName(); -#endif -}; - -class wxInverseRecord : public wxChangeRecord -{ - int parity; - wxChangeRecordId *id; - wxChangeRecord *Get(); - public: - wxInverseRecord(wxChangeRecordId *, int parity); - ~wxInverseRecord(); - Bool Undo(wxMediaBuffer *media); - void DropSetUnmodified(void); - wxChangeRecordId *GetId(); - int GetParity(); - wxChangeRecord *Inverse(); -#if CGREC_DEBUG - char *GetName(); -#endif -}; diff --git a/src/mred/wxme/wx_gcrct.h b/src/mred/wxme/wx_gcrct.h deleted file mode 100644 index 6be9b30cea..0000000000 --- a/src/mred/wxme/wx_gcrct.h +++ /dev/null @@ -1,4 +0,0 @@ - -#define GC_LINE_EXTEND 0 -#define GC_RECT_BRUSH_EXTEND 0 -#define GC_RECT_FRAME_EXTEND 0 diff --git a/src/mred/wxme/wx_keym.cxx b/src/mred/wxme/wx_keym.cxx deleted file mode 100644 index 57ff84a8bc..0000000000 --- a/src/mred/wxme/wx_keym.cxx +++ /dev/null @@ -1,1211 +0,0 @@ -/* - * File: wx_keym.cc - * Purpose: wxKeymap implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" -#include "wx_main.h" -#include "wx_keym.h" -#include "wx_mtype.h" -#include "wx_utils.h" -#include -#include -#include "wx_ptreq.h" - -extern void wxsKeymapError(char *s); - -#ifdef wx_mac -int wxMapCommandAsMeta; -# define AS_META_KEY(k) (wxMapCommandAsMeta ? (k) : 0) -# define AS_CMD_KEY(k) (k) -#else -# define AS_META_KEY(k) (k) -# define AS_CMD_KEY(k) 0 -#endif - -class wxKMFunc -{ - public: - char *name; - wxKMFunction f; - void *data; - - wxKMFunc(char *name, wxKMFunction f, void *data); - Bool Call(UNKNOWN_OBJ , wxEvent *); -}; - -class wxKeycode -{ - public: - long code; - int score; - -#define TF_Flag(var) unsigned var : 1 - TF_Flag( shiftOn ); - TF_Flag( shiftOff ); - TF_Flag( ctrlOn ); - TF_Flag( ctrlOff ); - TF_Flag( altOn ); - TF_Flag( altOff ); - TF_Flag( metaOn ); - TF_Flag( metaOff ); - TF_Flag( cmdOn ); - TF_Flag( cmdOff ); - TF_Flag( capsOn ); - TF_Flag( capsOff ); - - TF_Flag( checkOther ); - - TF_Flag( fullset ); -#undef TF_Flag - - char *fname; - - Bool isprefix; - wxKeycode *seqprefix; - - wxKeycode *next; -}; - -/***************************************************************/ - -extern int wxMrEdGetDoubleTime(void); - -int wxmeGetDoubleClickThreshold() -{ - return wxMrEdGetDoubleTime(); -} - -wxKeymap::wxKeymap() - : wxObject(WXGC_NO_CLEANUP) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_KEYMAP; -#endif - - functions = NULL; - keys = NULL; - - prefix = NULL; - - active_mouse_function = NULL; - - grabKeyFunction = NULL; - grabMouseFunction = NULL; - onBreak = NULL; - - chainCount = 0; - chainTo = NULL; - - lastButton = 0; - - doubleInterval = wxmeGetDoubleClickThreshold(); -} - -wxKeymap::~wxKeymap() -{ -} - -void wxKeymap::Reset(void) -{ - int i; - - prefix = NULL; - prefixed = 0; - - for (i = 0; i < chainCount; i++) { - chainTo[i]->Reset(); - } -} - -void wxKeymap::BreakSequence(void) -{ - int i; - - prefix = NULL; - - if (onBreak) { - wxBreakSequenceFunction f; - void *data; - - f = onBreak; - data = onBreakData; - - onBreak = NULL; - onBreakData = NULL; - - f(data); - } - - for (i = 0; i < chainCount; i++) { - chainTo[i]->BreakSequence(); - } -} - -void wxKeymap::SetBreakSequenceCallback(wxBreakSequenceFunction f, - void *data) -{ - wxBreakSequenceFunction fold; - void *dataold; - - fold = onBreak; - dataold = onBreakData; - - onBreak = f; - onBreakData = data; - - if (fold) - fold(dataold); -} - -wxKeycode *wxKeymap::FindKey(long code, long other_code, long alt_code, long other_alt_code, long caps_code, - Bool shift, Bool ctrl, - Bool alt, Bool meta, Bool cmd, Bool caps, - wxKeycode *prefix, int *_score) -{ - wxKeycode *key; - wxKeycode *bestKey = NULL; - int bestScore = -1; - int iter; - long findk; - - if (!keys) - return NULL; - - for (iter = 0; iter < 5; iter++) { - switch (iter) { - case 0: - findk = code; - break; - case 1: - findk = other_code; - break; - case 2: - findk = alt_code; - break; - case 3: - findk = other_alt_code; - break; - case 4: - default: - findk = caps_code; - break; - } - key = (wxKeycode *)keys->Get(findk); - while (key) { - if (((key->code == code) - || (key->checkOther - && ((key->code == other_code) - || (key->code == alt_code) - || (key->code == other_alt_code) - || (key->code == caps_code)))) - && ((key->shiftOn && shift) - || (key->shiftOff && !shift) - || (!key->shiftOn && !key->shiftOff)) - && ((key->ctrlOn && ctrl) - || (key->ctrlOff && !ctrl) - || (!key->ctrlOn && !key->ctrlOff)) - && ((key->altOn && alt) - || (key->altOff && !alt) - || (!key->altOn && !key->altOff)) - && ((key->metaOn && meta) - || (key->metaOff && !meta) - || (!key->metaOn && !key->metaOff)) - && ((key->cmdOn && cmd) - || (key->cmdOff && !cmd) - || (!key->cmdOn && !key->cmdOff)) - && ((key->capsOn && caps) - || (key->capsOff && !caps) - || (!key->capsOn && !key->capsOff)) - && key->seqprefix == prefix) { - int score = key->score; - if (key->code != code) { - if (key->code == other_alt_code) - score -= 4; - else - score -= 2; - } - if (score > bestScore) { - bestKey = key; - bestScore = score; - } - } - key = key->next; - } - } - - if (_score) - *_score = bestScore; - - return bestKey; -} - - -typedef struct { - char *str; - long code; -} Keybind; - -static Keybind keylist[] - = { { "leftbutton" , WXK_MOUSE_LEFT }, - { "rightbutton" , WXK_MOUSE_RIGHT }, - { "middlebutton" , WXK_MOUSE_MIDDLE }, - { "leftbuttondouble" , WXK_MOUSE_LEFT_DOUBLE }, - { "rightbuttondouble" , WXK_MOUSE_RIGHT_DOUBLE }, - { "middlebuttondouble" , WXK_MOUSE_MIDDLE_DOUBLE }, - { "leftbuttontriple" , WXK_MOUSE_LEFT_TRIPLE }, - { "rightbuttontriple" , WXK_MOUSE_RIGHT_TRIPLE }, - { "middlebuttontriple" , WXK_MOUSE_MIDDLE_TRIPLE }, - { "leftbuttonseq" , WXK_MOUSE_LEFT }, - { "rightbuttonseq" , WXK_MOUSE_RIGHT }, - { "middlebuttonseq" , WXK_MOUSE_MIDDLE }, - { "wheelup" , WXK_WHEEL_UP }, - { "wheeldown" , WXK_WHEEL_DOWN }, - { "esc", WXK_ESCAPE }, - { "delete", WXK_DELETE }, - { "del", WXK_DELETE }, - { "insert", WXK_INSERT }, - { "ins", WXK_INSERT }, - { "add", WXK_ADD }, - { "subtract", WXK_SUBTRACT }, - { "multiply", WXK_MULTIPLY }, - { "divide", WXK_DIVIDE }, - { "backspace", WXK_BACK }, - { "back", WXK_BACK }, - { "return", WXK_RETURN }, - { "enter", WXK_RETURN }, - { "tab", WXK_TAB }, - { "space", WXK_SPACE }, - { "right", WXK_RIGHT }, - { "left", WXK_LEFT }, - { "up", WXK_UP }, - { "down", WXK_DOWN }, - { "home", WXK_HOME }, - { "end", WXK_END }, - { "pageup", WXK_PRIOR }, - { "pagedown", WXK_NEXT }, - { "semicolon", ';' }, - { "colon", ':' }, - { "numpad0", WXK_NUMPAD0 }, - { "numpad1", WXK_NUMPAD1 }, - { "numpad2", WXK_NUMPAD2 }, - { "numpad3", WXK_NUMPAD3 }, - { "numpad4", WXK_NUMPAD4 }, - { "numpad5", WXK_NUMPAD5 }, - { "numpad6", WXK_NUMPAD6 }, - { "numpad7", WXK_NUMPAD7 }, - { "numpad8", WXK_NUMPAD8 }, - { "numpad9", WXK_NUMPAD9 }, - { "numpadenter", 3 }, - { "f1", WXK_F1 }, - { "f2", WXK_F2 }, - { "f3", WXK_F3 }, - { "f4", WXK_F4 }, - { "f5", WXK_F5 }, - { "f6", WXK_F6 }, - { "f7", WXK_F7 }, - { "f8", WXK_F8 }, - { "f9", WXK_F9 }, - { "f10", WXK_F10 }, - { "f11", WXK_F11 }, - { "f12", WXK_F12 }, - { "f13", WXK_F13 }, - { "f14", WXK_F14 }, - { "f15", WXK_F15 }, - { "f16", WXK_F16 }, - { "f17", WXK_F17 }, - { "f18", WXK_F18 }, - { "f19", WXK_F19 }, - { "f20", WXK_F20 }, - { "f21", WXK_F21 }, - { "f22", WXK_F22 }, - { "f23", WXK_F23 }, - { "f24", WXK_F24 }, - { NULL, 0 }}; - -wxKeycode *wxKeymap::MapFunction(long code, int shift, int ctrl, - int alt, int meta, int cmd, int caps, int checkOther, - char *fname, wxKeycode *prev, int type) -{ - wxKeycode *key, *newkey; - - /* Look for exact key: */ - key = keys ? ((wxKeycode *)keys->Get(code)) : (wxKeycode *)NULL; - while (key) { - if (key->code == code - && (key->shiftOn == (shift > 0)) - && (key->shiftOff == (shift < 0)) - && (key->ctrlOn == (ctrl > 0)) - && (key->ctrlOff == (ctrl < 0)) - && (key->altOn == (alt > 0)) - && (key->altOff == (alt < 0)) - && (key->metaOn == (meta > 0)) - && (key->metaOff == (meta < 0)) - && (key->cmdOn == (cmd > 0)) - && (key->cmdOff == (cmd < 0)) - && (key->capsOn == (caps > 0)) - && (key->capsOff == (caps < 0)) - && (key->checkOther == (checkOther ? 1 : 0)) - && key->seqprefix == prev) - break; - key = key->next; - } - - if (key) { - if ((type == wxKEY_PREFIX) != key->isprefix) { - char buffer[256], modbuf[256], *keystr = NULL; - int i; - - modbuf[0] = 0; - if (meta > 0) - strcat(modbuf, "m:"); - if (meta < 0) - strcat(modbuf, "~m:"); - - if (cmd > 0) - strcat(modbuf, "d:"); - if (cmd < 0) - strcat(modbuf, "~d:"); - - if (alt > 0) - strcat(modbuf, "a:"); - if (alt < 0) - strcat(modbuf, "~a:"); - - if (ctrl > 0) - strcat(modbuf, "c:"); - if (ctrl < 0) - strcat(modbuf, "~c:"); - - if (shift > 0) - strcat(modbuf, "s:"); - if (shift < 0) - strcat(modbuf, "~s:"); - - for (i = 0; keylist[i].str; i++) { - if (keylist[i].code == code) - keystr = keylist[i].str; - } - - if (keystr) - sprintf(buffer, "keymap: \"%s%s%s\" ", modbuf, checkOther ? "?" : "", keystr); - else - sprintf(buffer, "keymap: \"%s%s%c\" ", modbuf, checkOther ? "?" : "", (char)code); - - strcat(buffer, "is already mapped as a "); - if (!key->isprefix) - strcat(buffer, "non-"); - strcat(buffer, "prefix key"); - - wxsKeymapError(buffer); - - return NULL; - } else { - if (strcmp(key->fname, fname)) { - key->fname = copystring(fname); - } - return key; - } - } - - newkey = new WXGC_PTRS wxKeycode; - - newkey->code = code; - newkey->shiftOn = (shift > 0); - newkey->shiftOff = (shift < 0); - newkey->ctrlOn = (ctrl > 0); - newkey->ctrlOff = (ctrl < 0); - newkey->altOn = (alt > 0); - newkey->altOff = (alt < 0); - newkey->metaOn = (meta > 0); - newkey->metaOff = (meta < 0); - newkey->cmdOn = (cmd > 0); - newkey->cmdOff = (cmd < 0); - newkey->capsOn = (caps > 0); - newkey->capsOff = (caps < 0); - newkey->checkOther = (checkOther ? 1 : 0); - newkey->score = ((newkey->shiftOn ? 1 : 0) - + (newkey->shiftOff ? 5 : 0) - + (newkey->ctrlOn ? 1 : 0) - + (newkey->ctrlOff ? 5 : 0) - + (newkey->altOn ? 1 : 0) - + (newkey->altOff ? 5 : 0) - + (newkey->metaOn ? 1 : 0) - + (newkey->metaOff ? 5 : 0) - + (newkey->cmdOn ? 1 : 0) - + (newkey->cmdOff ? 5 : 0) - + (newkey->capsOn ? 1 : 0) - + (newkey->capsOff ? 5 : 0) - + (newkey->checkOther ? 6 : 30)); - newkey->fullset = 0; - newkey->fname = copystring(fname); - newkey->next = NULL; - - newkey->seqprefix = prev; - - newkey->isprefix = (type == wxKEY_PREFIX); - - if (!keys) { - wxHashTable *ht; - ht = new WXGC_PTRS wxHashTable(wxKEY_INTEGER, 25); - keys = ht; - } - - key = (wxKeycode *)keys->Get(code); - if (!key) - keys->Put(code, (wxObject *)newkey); - else { - while (key->next) { - key = key->next; - } - key->next = newkey; - } - - return newkey; -} - -static int wx_c_strcmp(wxchar *keyseq, char *s) -{ - int i = 0; - - while (keyseq[i] && s[i]) { - if ((int)keyseq[i] != (int)s[i]) - return 1; - i++; - } - return keyseq[i] || s[i]; -} - -static long GetCode(wxchar *keyseq, int *_kp, int *fullset) -{ - long i, code, kp; -#define MAX_BUF 256 - wxchar buffer[MAX_BUF], first; - - kp = *_kp; - - first = buffer[0] = keyseq[kp++]; - for (i = 1; keyseq[kp] && (keyseq[kp] != ';'); i++, kp++) { - if (i >= MAX_BUF - 1) - return 0; - buffer[i] = keyseq[kp]; - if (buffer[i] < 128) { - wxchar t; - t = tolower(buffer[i]); - buffer[i] = t; - } - } - buffer[i] = 0; - code = 0; - if (buffer[1]) { - if (buffer[0] < 128) { - wxchar t; - t = tolower(buffer[0]); - buffer[0] = t; - } - for (i = 0; keylist[i].str; i++) { - if (!wx_c_strcmp(buffer, keylist[i].str)) { - code = keylist[i].code; - if (!wx_c_strcmp(buffer, "leftbuttonseq") - || !wx_c_strcmp(buffer, "middlebuttonseq") - || !wx_c_strcmp(buffer, "rightbuttonseq")) - *fullset = 1; - break; - } - } - } else - code = first; - - *_kp = kp; - - return code; -} - -void wxKeymap::MapFunction(wxchar *keys, char *fname) -{ - wxchar *keyseq = keys; - int num_keys, num_new_keys, kp, start_keys; - wxKeycode **key, **new_key; - int shift, ctrl, alt, meta, cmd, caps, mod, checkOther; - int part = 1, i, j; - long code; - int fullset; - char *errstr; - char buffer[256]; - - num_keys = 1; - key = new WXGC_PTRS wxKeycode*[1]; - key[0] = NULL; - - start_keys = kp = 0; - - while (keyseq[kp]) { - shift = ctrl = alt = meta = cmd = caps = 0; - code = 0; - fullset = 0; - checkOther = 0; - - while (keyseq[kp] && (keyseq[kp] != ';')) { - mod = 1; - if ((kp == start_keys) && (keyseq[kp] == ':') && keyseq[kp + 1]) { - shift = ctrl = alt = cmd = meta = -1; - caps = 0; - kp++; - } else if (keyseq[kp] == '~') { - if (!keyseq[kp + 1] || (keyseq[kp + 2] != ':')) { - goto do_char; - } else { - mod = -1; - kp++; - goto do_mod; - } - } else if (keyseq[kp] < 128 && isspace(keyseq[kp])) { - kp++; - } else if (keyseq[kp + 1] == ':') { - do_mod: - wxchar mch; - mch = keyseq[kp]; - if (mch < 128) - mch = tolower(mch); - switch (mch) { - case 's': - shift = mod; - break; - case 'c': - ctrl = mod; - break; - case 'l': - caps = mod; - break; - case 'm': - meta = mod; - break; - case 'd': - cmd = mod; - break; - case 'a': - alt = mod; - break; - case '?': - if (mod == 1) { - checkOther = 1; - } else { - errstr = "cannot negate ? modifier"; - goto key_error; - } - break; - default: - errstr = "bad modifier"; - goto key_error; - } - mod = 1; - kp += 2; - } else { - do_char: - code = GetCode(keyseq, &kp, &fullset); - if (!code) { - errstr = "bad keyname"; - goto key_error; - } - } - } - - if (code) { - if ((code > 0) && (code < 127) && isalpha(code)) { - if (shift > 0) { -#ifdef wx_mac - if ((meta < 1) && (cmd < 1)) -#endif -#if defined(wx_msw) - if ((ctrl < 1) || (meta > 0)) -#endif - code = toupper(code); - } else if (isupper(code)) - shift = 1; - } - - num_new_keys = num_keys; - new_key = new WXGC_PTRS wxKeycode*[num_new_keys]; - - for (i = 0, j = 0; i < num_keys; i++) { - wxKeycode *mf; - mf = MapFunction(code, shift, ctrl, alt, meta, cmd, caps, checkOther, fname, key[i], - keyseq[kp] ? wxKEY_PREFIX : wxKEY_FINAL); - mf->fullset = fullset; - new_key[j++] = mf; - } - - - num_keys = num_new_keys; - key = new_key; - - part++; - if (keyseq[kp]) - kp++; - start_keys = kp; - } else { - errstr = "no non-modifier key"; - goto key_error; - } - - if (!key) - return; - } - - return; - - key_error: - { - long l; - char *r = NULL; - - wxme_utf8_encode(keys, wxstrlen(keys), &r, &l); - sprintf(buffer, "keymap: %s in keystring: \"%.100s\", part %d", - errstr, r, part); - wxsKeymapError(buffer); - } -} - -void wxKeymap::MapFunction(char *keys, char *fname) -{ - wxchar *us; - long ulen; - - wxme_utf8_decode(keys, strlen(keys), &us, &ulen); - MapFunction(us, fname); -} - -int wxKeymap::HandleEvent(long code, long other_code, long alt_code, long other_alt_code, long caps_code, - Bool shift, Bool ctrl, - Bool alt, Bool meta, Bool cmd, Bool caps, int score, - char **fname, int *fullset) -{ - wxKeycode *key; - int found_score; - - key = FindKey(code, other_code, alt_code, other_alt_code, caps_code, - shift, ctrl, alt, meta, cmd, caps, prefix, &found_score); - - prefix = NULL; - - if (key && (found_score >= score)) { - if (key->isprefix) { - prefix = key; - *fname = NULL; - return 1; - } - *fname = key->fname; - if (fullset) - *fullset = key->fullset; - return 1; - } - - return 0; -} - -int wxKeymap::GetBestScore(long code, long other_code, long alt_code, long other_alt_code, long caps_code, - Bool shift, Bool ctrl, - Bool alt, Bool meta, Bool cmd, Bool caps) -{ - wxKeycode *key; - int s, i; - int score; - - key = FindKey(code, other_code, alt_code, other_alt_code, caps_code, - shift, ctrl, alt, meta, cmd, caps, prefix, &score); - - if (key) - s = score; - else - s = -1; - - for (i = 0; i < chainCount; i++) { - int r; - r = chainTo[i]->GetBestScore(code, other_code, alt_code, other_alt_code, caps_code, - shift, ctrl, alt, meta, cmd, caps); - if (r > s) - s = r; - } - - return s; -} - -void wxKeymap::SetGrabKeyFunction(wxGrabKeyFunction grab, void *grabData) -{ - grabKeyFunction = grab; - grabKeyData = grabData; -} - -void wxKeymap::RemoveGrabKeyFunction(void) -{ - grabKeyFunction = NULL; - grabKeyData = NULL; -} - -Bool wxKeymap::HandleKeyEvent(UNKNOWN_OBJ media, wxKeyEvent *event) -{ - int score, result, was_prefixed; - - if (event->keyCode == WXK_SHIFT - || event->keyCode == WXK_CONTROL - || event->keyCode == WXK_RELEASE - || !event->keyCode) - return TRUE; - - score = GetBestScore(event); - - was_prefixed = prefixed; - - result = ChainHandleKeyEvent(media, event, NULL, NULL, prefixed, score); - - if (!result && was_prefixed) { - Reset(); - /* Try again without prefix: */ - result = ChainHandleKeyEvent(media, event, NULL, NULL, 0, score); - } - - if (result >= 0) - Reset(); - - return result ? TRUE : FALSE; -} - -int wxKeymap::GetBestScore(wxKeyEvent *event) -{ - return GetBestScore(event->keyCode, - event->otherKeyCode, - event->altKeyCode, - event->otherAltKeyCode, - event->capsKeyCode, - event->shiftDown, - event->controlDown, - event->altDown, - AS_META_KEY(event->metaDown), - AS_CMD_KEY(event->metaDown), - event->capsDown); -} - -int wxKeymap::OtherHandleKeyEvent(UNKNOWN_OBJ media, wxKeyEvent *event, - wxGrabKeyFunction grab, void *grabData, - int try_state, int score) -{ - int i, result = 0; - - for (i = 0; i < chainCount; i++) { - int r; - r = chainTo[i]->ChainHandleKeyEvent(media, event, grab, grabData, try_state, score); - if (r > 0) { - Reset(); - return r; - } else if (r) - result = r; - } - - return result; -} - -int wxKeymap::ChainHandleKeyEvent(UNKNOWN_OBJ media, wxKeyEvent *event, - wxGrabKeyFunction grab, void *grabData, - int only_prefixed, int score) -/* Results: 0 = no match, 1 = match, -1 = matched prefix */ -{ - char *fname; - int result, sub_result; - - lastTime = event->timeStamp; - lastButton = 0; - - if (grabKeyFunction) { - grab = grabKeyFunction; - grabData = grabKeyData; - } - - if (only_prefixed && !prefixed) - return 0; - - sub_result = OtherHandleKeyEvent(media, event, grab, grabData, only_prefixed, score); - - if (sub_result > 0) - return sub_result; - - if (HandleEvent(event->keyCode, - event->otherKeyCode, - event->altKeyCode, - event->otherAltKeyCode, - event->capsKeyCode, - event->shiftDown, - event->controlDown, - event->altDown, - AS_META_KEY(event->metaDown), - AS_CMD_KEY(event->metaDown), - event->capsDown, - score, - &fname, - NULL)) { - if (fname) { - Reset(); - if (grab && grab(fname, this, media, event, grabData)) - return 1; - return CallFunction(fname, media, event) ? 1 : 0; - } else { - if (prefix) { - prefixed = 1; - return -1; - } - /* Huh? */ - result = 0; - } - } else - result = 0; - - if (sub_result < 0) { - prefixed = 1; - result = -1; - } - - if (!result && grabKeyFunction) - if (grabKeyFunction(NULL, this, media, event, grabKeyData)) - return 1; - - return result; -} - -static inline long Abs(long x) -{ - if (x < 0) - return -x; - else - return x; -} - -void wxKeymap::SetGrabMouseFunction(wxGrabMouseFunction grab, void *grabData) -{ - grabMouseFunction = grab; - grabMouseData = grabData; -} - -void wxKeymap::RemoveGrabMouseFunction(void) -{ - grabMouseFunction = NULL; - grabMouseData = NULL; -} - -Bool wxKeymap::HandleMouseEvent(UNKNOWN_OBJ media, wxMouseEvent *event) -{ - int score; - score = GetBestScore(event); - - return ChainHandleMouseEvent(media, event, NULL, NULL, 0, score) ? TRUE : FALSE; -} - -int wxKeymap::GetBestScore(wxMouseEvent *event) -{ - long code; - - if (!event->ButtonDown()) { - int i; - if (active_mouse_function) - return 100; - for (i = 0; i < chainCount; i++) { - if (chainTo[i]->GetBestScore(event)) - return 100; - } - return -1; - } else { - if (event->RightDown()) - code = WXK_MOUSE_RIGHT; - else if (event->LeftDown()) - code = WXK_MOUSE_LEFT; - else if (event->MiddleDown()) - code = WXK_MOUSE_MIDDLE; - else - return -1; - - if (code == lastButton && event->x == lastX && event->y == lastY) { - if (Abs(event->timeStamp - lastTime) < doubleInterval) { - code += WXK_CLICK_ADDER * clickCount; - } - } - } - - return GetBestScore(code, - -1, -1, -1, -1, - event->shiftDown, - event->controlDown, - event->altDown, - AS_META_KEY(event->metaDown), - AS_CMD_KEY(event->metaDown), - event->capsDown); -} - -int wxKeymap::OtherHandleMouseEvent(UNKNOWN_OBJ media, wxMouseEvent *event, - wxGrabMouseFunction grab, void *grabData, - int try_state, int score) -{ - int i, result = 0; - - for (i = 0; i < chainCount; i++) { - int r; - r = chainTo[i]->ChainHandleMouseEvent(media, event, grab, grabData, try_state, score); - if (r > 0) { - Reset(); - return r; - } else if (r) - result = r; - } - - return result; -} - -int wxKeymap::ChainHandleMouseEvent(UNKNOWN_OBJ media, wxMouseEvent *event, - wxGrabMouseFunction grab, void *grabData, - int try_state, int score) -{ - long code, origCode, lastCode; - char *fname; - int result, fullset; - - if (grabMouseFunction) { - grab = grabMouseFunction; - grabData = grabMouseData; - } - - if (!prefix && (try_state >= 0)) { - int r; - r = OtherHandleMouseEvent(media, event, grab, grabData, 1, score); - - if (r > 0) - return r; - - if (try_state > 0) - return r; - else - try_state = -1; - } else if (prefix && (try_state < 0)) - return OtherHandleMouseEvent(media, event, grab, grabData, -1, score); - - if (!event->ButtonDown()) { - Bool v; - - if (!event->Dragging() && !event->ButtonUp()) { - /* We must have missed the button-up */ - active_mouse_function = NULL; - } - - if (!active_mouse_function) { - return OtherHandleMouseEvent(media, event, grab, grabData, -1, score); - } - - if (grab && grab(active_mouse_function, this, media, event, grabData)) - v = 1; - else - v = CallFunction(active_mouse_function, media, event); - if (event->ButtonUp()) - active_mouse_function = NULL; - return v; - } - - if (event->RightDown()) - code = WXK_MOUSE_RIGHT; - else if (event->LeftDown()) - code = WXK_MOUSE_LEFT; - else if (event->MiddleDown()) - code = WXK_MOUSE_MIDDLE; - else - return 0; - - origCode = code; - - if (code == lastButton && event->x == lastX && event->y == lastY) { - if (Abs(event->timeStamp - lastTime) < doubleInterval) { - code += WXK_CLICK_ADDER * clickCount; - clickCount++; - } else - clickCount = 1; - } else { - lastButton = code; - clickCount = 1; - } - lastTime = event->timeStamp; - lastX = event->x; - lastY = event->y; - - do { - if (HandleEvent(code, - -1, -1, -1, -1, - event->shiftDown, - event->controlDown, - event->altDown, - AS_META_KEY(event->metaDown), - AS_CMD_KEY(event->metaDown), - event->capsDown, - score, - &fname, - &fullset)) { - if (fname) { - Reset(); - if (fullset) - active_mouse_function = fname; - if (grab && grab(fname, this, media, event, grabData)) - return 1; - return CallFunction(fname, media, event) - ? 1 : 0; - } else { - int r; - r = OtherHandleMouseEvent(media, event, grab, grabData, try_state, score); - - if (r > 0) - return r; - return -1; - } - } - lastCode = code; - code = origCode; - } while (lastCode != origCode); - - result = OtherHandleMouseEvent(media, event, grab, grabData, try_state, score); - - if (!result && grabMouseFunction) - if (grabMouseFunction(NULL, this, media, event, grabMouseData)) - return 1; - - return result; -} - -void wxKeymap::AddFunction(char *name, wxKMFunction func, void *data) -{ - wxKMFunc *f; - - if (!functions) { - wxHashTable *ht; - ht = new WXGC_PTRS wxHashTable(wxKEY_STRING, 50); - functions = ht; - } - - f = new WXGC_PTRS wxKMFunc(name, func, data); - if (functions->Get(f->name)) - functions->Delete(f->name); - functions->Put(f->name, (wxObject *)f); -} - -Bool wxKeymap::CallFunction(char *name, UNKNOWN_OBJ media, wxEvent *event, - Bool try_chained) -{ - wxKMFunc *f; - - if (functions) { - f = (wxKMFunc *)functions->Get(name); - if (f) { - f->Call(media, event); - return TRUE; - } - } - - if (try_chained) { - int i; - - for (i = 0; i < chainCount; i++) { - if (chainTo[i]->CallFunction(name, media, event, TRUE)) - return TRUE; - } - } else { - char buffer[256]; - sprintf(buffer, "keymap: no function \"%.150s\"", name); - wxsKeymapError(buffer); - } - - return 0; -} - -long wxKeymap::GetDoubleClickInterval() -{ - return doubleInterval; -} - -void wxKeymap::SetDoubleClickInterval(long d) -{ - doubleInterval = d; -} - -Bool wxKeymap::CycleCheck(wxKeymap *km) -{ - int i; - - for (i = 0; i < chainCount; i++) { - if (PTREQ(km, chainTo[i]) || chainTo[i]->CycleCheck(km)) - return TRUE; - } - - return FALSE; -} - -void wxKeymap::ChainToKeymap(wxKeymap *km, Bool prefix) -{ - wxKeymap **old; - - if ((km == this) || CycleCheck(km) || km->CycleCheck(this)) - return; - - old = chainTo; - chainTo = new WXGC_PTRS wxKeymap*[chainCount + 1]; - - memcpy(chainTo + (prefix ? 1 : 0), old, chainCount * sizeof(wxKeymap *)); - chainTo[prefix ? 0 : chainCount] = km; - - chainCount++; -} - -void wxKeymap::RemoveChainedKeymap(wxKeymap *km) -{ - int i; - - for (i = 0; i < chainCount; i++) { - if (PTREQ(km, chainTo[i])) - break; - } - - if (i >= chainCount) - return; - - memcpy(chainTo + i, chainTo + i + 1, - sizeof(wxKeymap *) * (chainCount - i - 1)); - - chainCount--; -} - -/***************************************************************/ - -wxKMFunc::wxKMFunc(char *fname, wxKMFunction func, void *d) -{ - name = copystring(fname); - f = func; - data = d; -} - -Bool wxKMFunc::Call(UNKNOWN_OBJ media, wxEvent *event) -{ - return f(media, event, data); -} diff --git a/src/mred/wxme/wx_keym.h b/src/mred/wxme/wx_keym.h deleted file mode 100644 index 8ebbc25c3b..0000000000 --- a/src/mred/wxme/wx_keym.h +++ /dev/null @@ -1,131 +0,0 @@ - -#ifndef wx_keym -#define wx_keym - -#include "wx_stdev.h" -#include "wx_hash.h" - -typedef unsigned int wxchar; -extern int wxstrlen(wxchar *s); -void wxme_utf8_decode(char *str, long len, wxchar **us, long *ulen); -void wxme_utf8_encode(wxchar *us, long ulen, char **s, long *len); - -#define UNKNOWN_OBJ void* - -typedef Bool (*wxKMFunction)(UNKNOWN_OBJ media, wxEvent *event, void *data); - -typedef Bool (*wxGrabKeyFunction)(char *str, class wxKeymap *km, - UNKNOWN_OBJ media, wxKeyEvent *event, - void *data); -typedef Bool (*wxGrabMouseFunction)(char *str, class wxKeymap *km, - UNKNOWN_OBJ media, wxMouseEvent *event, - void *data); - -typedef void (*wxBreakSequenceFunction)(void *data); - -enum { - wxKEY_FINAL = 0, - wxKEY_PREFIX -}; - -#define WXK_MOUSE_RIGHT (-1) -#define WXK_MOUSE_LEFT (-2) -#define WXK_MOUSE_MIDDLE (-3) -#define WXK_MOUSE_RIGHT_DOUBLE (-4) -#define WXK_MOUSE_LEFT_DOUBLE (-5) -#define WXK_MOUSE_MIDDLE_DOUBLE (-6) -#define WXK_MOUSE_RIGHT_TRIPLE (-7) -#define WXK_MOUSE_LEFT_TRIPLE (-8) -#define WXK_MOUSE_MIDDLE_TRIPLE (-9) - -#define WXK_CLICK_ADDER (-3) - -class wxKeymap : public wxObject -{ - wxHashTable *functions; - wxHashTable *keys; - - int chainCount; - wxKeymap **chainTo; - - long doubleInterval; - - int lastButton; - int clickCount; - long lastTime; - double lastX, lastY; - - class wxKeycode *prefix; - int prefixed; - - char *active_mouse_function; - - wxGrabKeyFunction grabKeyFunction; - void *grabKeyData; - wxGrabMouseFunction grabMouseFunction; - void *grabMouseData; - - wxBreakSequenceFunction onBreak; - void *onBreakData; - - class wxKeycode *FindKey(long, long, long, long, long, Bool, Bool, Bool, Bool, Bool, Bool, class wxKeycode *, int *_score); - int HandleEvent(long code, long, long, long, long, - Bool shift, Bool ctrl, Bool alt, Bool meta, Bool cmd, Bool caps, - int score, char **fname, int *fullset); - int GetBestScore(long code, long, long, long, long, Bool shift, Bool ctrl, Bool alt, Bool meta, Bool cmd, Bool caps); - - Bool CycleCheck(wxKeymap *km); - - int ChainHandleKeyEvent(UNKNOWN_OBJ media, wxKeyEvent *event, - wxGrabKeyFunction grab, void *grabData, - int try_state, int score); - int ChainHandleMouseEvent(UNKNOWN_OBJ media, wxMouseEvent *event, - wxGrabMouseFunction grab, void *grabData, - int try_state, int score); - - int OtherHandleKeyEvent(UNKNOWN_OBJ media, wxKeyEvent *event, - wxGrabKeyFunction grab, void *grabData, - int try_state, int score); - int OtherHandleMouseEvent(UNKNOWN_OBJ media, wxMouseEvent *event, - wxGrabMouseFunction grab, void *grabData, - int try_state, int score); - - int GetBestScore(wxKeyEvent *event); - int GetBestScore(wxMouseEvent *event); - - void Reset(void); - - public: - wxKeymap(); - ~wxKeymap(); - - virtual Bool HandleKeyEvent(UNKNOWN_OBJ media, wxKeyEvent *event); - virtual Bool HandleMouseEvent(UNKNOWN_OBJ media, wxMouseEvent *event); - - void SetGrabKeyFunction(wxGrabKeyFunction grab, void *grabData); - void RemoveGrabKeyFunction(void); - void SetGrabMouseFunction(wxGrabMouseFunction grab, void *grabData); - void RemoveGrabMouseFunction(void); - - void BreakSequence(void); - void SetBreakSequenceCallback(wxBreakSequenceFunction f, void *data); - - class wxKeycode *MapFunction(long code, int shift, int ctrl, - int alt, int meta, int cmd, int caps, int check_alt, - char *fname, class wxKeycode *prevkey=NULL, - int keytype = wxKEY_FINAL); - void MapFunction(wxchar *keyname, char *fname); - void MapFunction(char *keyname, char *fname); - - void AddFunction(char *name, wxKMFunction func, void *data); - Bool CallFunction(char *name, UNKNOWN_OBJ media, wxEvent *event, - Bool try_chained = FALSE); - - void ChainToKeymap(wxKeymap *, Bool prefix); - void RemoveChainedKeymap(wxKeymap *); - - long GetDoubleClickInterval(); - void SetDoubleClickInterval(long); -}; - -#endif diff --git a/src/mred/wxme/wx_madm.h b/src/mred/wxme/wx_madm.h deleted file mode 100644 index 03a3a728c2..0000000000 --- a/src/mred/wxme/wx_madm.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * File: wx_madm.cc - * Purpose: wxMediaAdmins - * Author: Matthew Flatt - * Created: 1997 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1997, Matthew Flatt - */ - - -#ifndef __WX_MEDIA_ADMIN__ -#define __WX_MEDIA_ADMIN__ - -class wxMediaAdmin : public wxObject -{ - private: - friend class wxMediaCanvas; - friend class wxMediaEdit; - friend class wxMediaBuffer; - friend class wxCanvasMediaAdmin; - int standard; /* Used to recognize standard display. Hack. */ - - public: - inline wxMediaAdmin(); - - /* Usually called by wxMediaBuffer objects: */ - virtual wxDC *GetDC(double *x = NULL, double *y = NULL) = 0; - virtual void GetView(double *x, double *y, double *w, double *h, - Bool full = FALSE) = 0; - virtual Bool ScrollTo(double localx, double localy, double w, double h, - Bool refresh = TRUE, int bias = 0) = 0; - virtual void GrabCaret(int = wxFOCUS_GLOBAL) = 0; - - virtual void Resized(Bool redraw_now) = 0; - virtual void NeedsUpdate(double localx, double localy, double w, double h) = 0; - - virtual void UpdateCursor() = 0; - - virtual void GetMaxView(double *x, double *y, double *w, double *h, - Bool full = FALSE); - virtual Bool DelayRefresh(); - - virtual Bool PopupMenu(void *m, double x, double y) = 0; - - virtual void Modified(Bool) = 0; -}; - -inline wxMediaAdmin::wxMediaAdmin() - : wxObject(WXGC_NO_CLEANUP) -{ - standard = 0; -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_MEDIA_ADMIN; -#endif -}; - -class wxUpdateCursorTimer; - -class wxCanvasMediaAdmin : public wxMediaAdmin -{ - private: - friend class wxMediaCanvas; - friend class os_wxCanvasMediaAdmin; - friend class wxUpdateCursorTimer; - - wxMediaCanvas *canvas; - wxCanvasMediaAdmin *nextadmin, *prevadmin; - Bool resetFlag; - Bool updateBlock, resizedBlock; - wxUpdateCursorTimer *updateCursorTimer; - - inline void AdjustStdFlag(void); - - wxCanvasMediaAdmin(wxMediaCanvas *c); - - public: - ~wxCanvasMediaAdmin(); - - /* Usually called by wxMediaBuffer objects: */ - wxDC *GetDC(double *x = NULL, double *y = NULL); - void GetView(double *x, double *y, double *h, double *w, Bool full = FALSE); - Bool ScrollTo(double localx, double localy, double, double, - Bool refresh = TRUE, int bias = 0); - - void GrabCaret(int = wxFOCUS_GLOBAL); - - void Resized(Bool update); - void NeedsUpdate(double localx, double localy, double w, double h); - - void UpdateCursor(); - void GetMaxView(double *x, double *y, double *h, double *w, Bool full = FALSE); - - Bool PopupMenu(void *m, double x, double y); - - inline wxMediaCanvas *GetCanvas() { return canvas; } - - void Modified(Bool); -}; - -/* Used by wxMediaSnipMediaAdmin: */ -class wxMSMA_SnipDrawState { - public: - Bool drawing; - double x, y; - wxDC *dc; -}; - -class wxMediaSnipMediaAdmin : public wxMediaAdmin -{ - friend class wxMediaSnip; - friend class os_wxMediaSnipMediaAdmin; - - wxMSMA_SnipDrawState *state; - - wxMediaSnip *snip; - - void RestoreState(wxMSMA_SnipDrawState *saved); - void SaveState(wxMSMA_SnipDrawState *save, wxDC *dc, double x, double y); - - wxMediaSnipMediaAdmin(wxMediaSnip *s); - - public: - - /* Only to make wxs_madm.xc happy */ - inline wxMediaSnipMediaAdmin(); - ~wxMediaSnipMediaAdmin(); - - wxDC *GetDC(double *x = NULL, double *y = NULL); - void GetView(double *x, double *y, double *h, double *w, Bool full = FALSE); - Bool ScrollTo(double localx, double localy, double w, double h, - Bool refresh = TRUE, int bias = 0); - void GrabCaret(int = wxFOCUS_GLOBAL); - - void Resized(Bool redraw_now); - void NeedsUpdate(double localx, double localy, double w, double h); - - void UpdateCursor(); - - virtual Bool DelayRefresh(); - - Bool PopupMenu(void *m, double x, double y); - - inline wxMediaSnip* GetSnip() { return snip; } - - void Modified(Bool); -}; - -/* Only to make wxs_madm.xc happy */ -inline wxMediaSnipMediaAdmin::wxMediaSnipMediaAdmin() -{ - snip = NULL; -} - -#endif /* __WX_MEDIA_ADMIN__ */ diff --git a/src/mred/wxme/wx_mbuf.cxx b/src/mred/wxme/wx_mbuf.cxx deleted file mode 100644 index 2f53ed96fe..0000000000 --- a/src/mred/wxme/wx_mbuf.cxx +++ /dev/null @@ -1,2955 +0,0 @@ -/* - * File: wx_mbuf.cc - * Purpose: wxMediaBuffer implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995-98, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#define Uses_wxPrintSetup /* for wx_xt */ -#include "common.h" -#include "wx_utils.h" -#include "wx_win.h" -#include "wx_dcps.h" -#ifndef OLD_WXWINDOWS -# include "wx_cmdlg.h" -#endif -#include "wx_print.h" -#ifdef wx_xt -# include "wx_types.h" -#endif - -#include "wx_media.h" -#ifndef OLD_WXWINDOWS -# include "wx_clipb.h" -#else -# include "wx_gclip.h" -#endif -#include "wx_ptreq.h" -#include -#include -#include "scheme.h" - -#define DELETE_CLIP_LIST_CONTENT 0 - -#if ALLOW_X_STYLE_SELECTION -Bool wxMediaXSelectionMode = TRUE; -wxMediaBuffer *wxMediaXSelectionOwner = NULL; -wxMediaBuffer *wxMediaXSelectionAllowed = NULL; -static Bool xSelectionCopied = FALSE; -static Bool xClipboardHack = FALSE; -#endif - -static void InitCutNPaste(void); - -static void MediaStyleNotify(wxStyle *which, wxMediaBuffer *media); - -class wxMediaClipboardClient : public wxClipboardClient -{ - public: - wxMediaClipboardClient(); - char *GetData(char *format, long *size); - void BeingReplaced(void); -}; -static wxMediaClipboardClient *TheMediaClipboardClient; - -#if ALLOW_X_STYLE_SELECTION -class wxMediaXClipboardClient : public wxClipboardClient -{ - public: - wxMediaXClipboardClient(); - char *GetData(char *format, long *size); - void BeingReplaced(void); -}; -static wxMediaXClipboardClient *TheMediaXClipboardClient; -#endif - -# define MALLOC_CRP(n) new WXGC_PTRS wxChangeRecord*[n] - -// xformer doesn't handle static member variable declarations -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - -wxBitmap *wxMediaBuffer::bitmap; -wxMemoryDC *wxMediaBuffer::offscreen = NULL; -long wxMediaBuffer::bmHeight, wxMediaBuffer::bmWidth; -Bool wxMediaBuffer::offscreenInUse = FALSE; -wxMediaBuffer *wxMediaBuffer::lastUsedOffscreen = NULL; - -#ifdef MZ_PRECISE_GC -END_XFORM_SKIP; -#endif - -extern wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char*, int); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(wxMediaBuffer*); - -/******************************************************************/ - -static int emacs_style_undo = -1; -extern int wxGetBoolPreference(const char *name, int *res); - -#ifndef EACH_BUFFER_OWN_OFFSCREEN -static int bcounter = 0; -#endif - -wxMediaBuffer::wxMediaBuffer() - : wxObject(WXGC_NO_CLEANUP) -{ - map = new WXGC_PTRS wxKeymap(); - // AddBufferFunctions(map); - - styleList = new WXGC_PTRS wxStyleList; - styleList->NewNamedStyle(STD_STYLE, NULL); - notifyId = styleList->NotifyOnChange((wxStyleNotifyFunc)MediaStyleNotify, - this, 1); - - filename = NULL; - - undomode = redomode = interceptmode = FALSE; - maxUndos = 0; - - if (emacs_style_undo == -1) { - if (!wxGetBoolPreference("emacsUndo", &emacs_style_undo)) { - emacs_style_undo = 0; - } - } - - customCursor = NULL; - - loadoverwritesstyles = 1; - - noundomode = 0; - - ownCaret = FALSE; - caretSnip = NULL; - - pasteTextOnly = 0; - - InitCutNPaste(); - - admin = NULL; - -#ifdef EACH_BUFFER_OWN_OFFSCREEN - offscreen = NULL; -#endif - - if (!offscreen) { - wxREGGLOB(offscreen); - wxREGGLOB(bitmap); - wxREGGLOB(lastUsedOffscreen); - bitmap = NULL; - offscreen = new WXGC_PTRS wxMemoryDC(); - bmHeight = bmWidth = 0; -#ifndef wx_mac - offscreen->SetOptimization(TRUE); -#endif - } - - inactiveCaretThreshold = wxSNIP_DRAW_SHOW_INACTIVE_CARET; - -#ifndef EACH_BUFFER_OWN_OFFSCREEN - bcounter++; -#endif -} - -wxMediaBuffer::~wxMediaBuffer() -{ -#if ALLOW_X_STYLE_SELECTION - if (wxMediaXSelectionOwner == this) - wxMediaXSelectionOwner = NULL; -#endif - - if (map) - SetKeymap(NULL); - - styleList->ForgetNotification(notifyId); - -#ifndef EACH_BUFFER_OWN_OFFSCREEN - --bcounter; - if (!bcounter) { -#endif - offscreen->SelectObject(NULL); - DELETE_OBJ offscreen; - offscreen = NULL; - if (bitmap) - DELETE_OBJ bitmap; -#ifndef EACH_BUFFER_OWN_OFFSCREEN - } -#endif - - ClearUndos(); -} - -/******************************************************************/ - -extern "C" int objscheme_something_prepared; - -void wxMediaBuffer::OnLocalEvent(wxMouseEvent *event) -{ - if (map) { - Scheme_Object *edit; - if (objscheme_something_prepared) - edit = objscheme_bundle_wxMediaBuffer(this); - else - edit = NULL; /* could happen in Mac or Windows with -Z */ - if (map->HandleMouseEvent(edit, event)) { - return; - } else if (!event->Moving()) - map->BreakSequence(); - } - - OnDefaultEvent(event); -} - -void wxMediaBuffer::OnLocalChar(wxKeyEvent *event) -{ - if (map) { - Scheme_Object *edit; - if (objscheme_something_prepared) - edit = objscheme_bundle_wxMediaBuffer(this); - else - edit = NULL; /* could happen in Mac or Windows with -Z */ - if (map->HandleKeyEvent(edit, event)) { - return; - } else - map->BreakSequence(); - } - - OnDefaultChar(event); -} - -void wxMediaBuffer::OnFocus(Bool WXUNUSED(on)) -{ -} - -/******************************************************************/ - -void wxMediaBuffer::SetAdmin(wxMediaAdmin *administrator) -{ - SettingAdmin(administrator); - - admin = administrator; - if (!admin) - ownCaret = FALSE; - - if (admin) - InitNewAdmin(); -} - -void wxMediaBuffer::SettingAdmin(wxMediaAdmin *) -{ -} - -void wxMediaBuffer::InitNewAdmin() -{ -} - -wxMediaAdmin *wxMediaBuffer::GetAdmin(void) -{ - return admin; -} - -/******************************************************************/ - -#define ShowsGhostCaret() 1 - -Bool wxMediaBuffer::DoOwnCaret(Bool ownit) -{ - Bool refresh; - - refresh = (!caretSnip && (((Bool)ownCaret != ownit) || ShowsGhostCaret())); - - ownCaret = ownit; - if (caretSnip) - caretSnip->OwnCaret(ownit); - if (map && !ownit && refresh) - map->BreakSequence(); - -#if ALLOW_X_STYLE_SELECTION - if (ownit && !caretSnip) - wxMediaXSelectionAllowed = this; - else if (wxMediaXSelectionAllowed == this) - wxMediaXSelectionAllowed = NULL; -#endif - - if (admin) - admin->UpdateCursor(); - - return refresh; -} - -wxDC *wxMediaBuffer::GetDC() -{ - /* This can be called by snips to get a DC appropriate for - sizing text, etc., outside of draws. It isn't the destination - for draws, though. */ - if (admin) - return admin->GetDC(NULL, NULL); - else - return NULL; -} - -void wxMediaBuffer::GetViewSize(double *w, double *h) -{ - if (admin) - admin->GetView(NULL, NULL, w, h); - else { - if (w) - *w = 0; - if (h) - *h = 0; - } -} - -Bool wxMediaBuffer::DoSetCaretOwner(wxSnip *snip, int dist) -{ - Bool hadCaret, visCaret; - wxSnip *oldCaret; - Bool refresh; - - if (PTREQ(snip, caretSnip)) { - if (!admin || (dist == wxFOCUS_IMMEDIATE)) - return FALSE; - admin->GrabCaret(dist); - } - - refresh = FALSE; - - visCaret = ownCaret || ShowsGhostCaret(); - - if (!snip || !(snip->flags & wxSNIP_HANDLES_EVENTS)) { - wxSnip *_oldCaret = caretSnip; - caretSnip = NULL; - if (_oldCaret) { - _oldCaret->OwnCaret(FALSE); - if (visCaret) - refresh = TRUE; - } -#if ALLOW_X_STYLE_SELECTION - wxMediaXSelectionAllowed = this; -#endif - if (admin) - admin->UpdateCursor(); - return refresh; - } - - if (!GetSnipLocation(snip, NULL, NULL)) - return refresh; - - if (!ownCaret) - hadCaret = FALSE; - else - hadCaret = !caretSnip; - - oldCaret = caretSnip; - caretSnip = snip; - - BeginEditSequence(); - if (oldCaret) - oldCaret->OwnCaret(FALSE); - else if (visCaret) - refresh = TRUE; - snip->OwnCaret(ownCaret); - EndEditSequence(); - - if (admin && (dist != wxFOCUS_IMMEDIATE)) - admin->GrabCaret(dist); - - if (admin) - admin->UpdateCursor(); - - return refresh; -} - -static void ConvertCoords(wxMediaAdmin *admin, double *x, double *y, int toLocal) -{ - double lx = 0, ly = 0; - - if (admin) { - if (admin->__type == wxTYPE_MEDIA_SNIP_MEDIA_ADMIN) { - wxMediaSnip *snip; - wxSnipAdmin *sa; - - snip = ((wxMediaSnipMediaAdmin *)admin)->GetSnip(); - sa = snip->GetAdmin(); - - if (sa) { - wxMediaBuffer *mbuf; - mbuf = sa->GetMedia(); - if (mbuf) { - double bx = 0, by = 0; - int l, t, r, b; - - mbuf->LocalToGlobal(&bx, &by); - mbuf->GetSnipLocation(snip, &lx, &ly, 0); - lx += bx; - ly += by; - - snip->GetMargin(&l, &t, &r, &b); - lx += l; - ly += t; - } - } - } else { - admin->GetDC(&lx, &ly); - lx = -lx; - ly = -ly; - } - } - - if (toLocal) { - if (x) - *x -= lx; - if (y) - *y -= ly; - } else { - if (x) - *x += lx; - if (y) - *y += ly; - } -} - -void wxMediaBuffer::GlobalToLocal(double *x, double *y) -{ - ConvertCoords(admin, x, y, 1); -} - -void wxMediaBuffer::LocalToGlobal(double *x, double *y) -{ - ConvertCoords(admin, x, y, 0); -} - -void wxMediaBuffer::SetCursor(wxCursor *c, Bool override) -{ - customCursor = c; - customCursorOverrides = override; - - if (admin) - admin->UpdateCursor(); -} - -/******************************************************************/ - -#ifndef ROUND -#include -#define ROUND(x) (int)floor(x) -#endif - -#define REDICULOUS_SIZE 2000 - -Bool wxMediaBuffer::ReadyOffscreen(double width, double height) -{ - if ((width > REDICULOUS_SIZE) - || (height > REDICULOUS_SIZE)) - return FALSE; - -#ifdef wx_mac - return FALSE; -#endif - - if (!offscreenInUse && (height > bmHeight || width > bmWidth)) { - wxBitmap *oldbm = bitmap; - - if (height > bmHeight) - bmHeight = ROUND(height) + 1; - if (width > bmWidth) - bmWidth = ROUND(width) + 1; - - bitmap = new WXGC_PTRS wxBitmap(bmWidth, bmHeight); - - offscreen->SelectObject(NULL); - if (oldbm) - DELETE_OBJ oldbm; - - if (bitmap->Ok()) - offscreen->SelectObject(bitmap); - - return TRUE; - } - - return FALSE; -} - -/******************************************************************/ - -void wxMediaBuffer::SetKeymap(wxKeymap *keymap) -{ - map = keymap; -} - -wxKeymap *wxMediaBuffer::GetKeymap(void) -{ - return map; -} - -wxStyleList *wxMediaBuffer::GetStyleList(void) -{ - return styleList; -} - -void wxMediaBuffer::SetStyleList(wxStyleList *newList) -{ - styleList->ForgetNotification(notifyId); - notifyId = newList->NotifyOnChange((wxStyleNotifyFunc)MediaStyleNotify, - this, 1); - styleList = newList; - - /* Create STD_STYLE if it's not there: */ - styleList->NewNamedStyle(STD_STYLE, NULL); -} - -static void MediaStyleNotify(wxStyle *which, wxMediaBuffer *media) -{ - if (media) - media->StyleHasChanged(which); -} - -char *wxMediaBuffer::GetDefaultStyleName() -{ - return STD_STYLE; -} - -wxStyle *wxMediaBuffer::GetDefaultStyle() -{ - return styleList->FindNamedStyle(GetDefaultStyleName()); -} - -/******************************************************************/ - -int wxMediaBuffer::AppendEditItems(wxMenu *, int) -{ - return 0; -} - -void wxMediaBuffer::DoEdit(int op, Bool recursive, long time) -{ - if (recursive && caretSnip) { - caretSnip->DoEdit(op, TRUE, time); - return; - } - - switch(op) { - case wxEDIT_UNDO: - Undo(); - break; - case wxEDIT_REDO: - Redo(); - break; - case wxEDIT_CLEAR: - Clear(); - break; - case wxEDIT_CUT: - Cut(FALSE, time); - break; - case wxEDIT_COPY: - Copy(FALSE, time); - break; - case wxEDIT_PASTE: - Paste(time); - break; - case wxEDIT_KILL: - Kill(time); - break; - case wxEDIT_INSERT_TEXT_BOX: - InsertBox(wxEDIT_BUFFER); - break; - case wxEDIT_INSERT_GRAPHIC_BOX: - InsertBox(wxPASTEBOARD_BUFFER); - break; - case wxEDIT_INSERT_IMAGE: - InsertImage(); - break; - case wxEDIT_SELECT_ALL: - SelectAll(); - break; - } -} - - -Bool wxMediaBuffer::CanEdit(int op, Bool recursive) -{ - if (recursive && caretSnip) { - return caretSnip->CanEdit(op, TRUE); - } - - if (IsLocked()) { - if ((op != wxEDIT_COPY) && (op != wxEDIT_SELECT_ALL)) - return FALSE; - } - - switch(op) { - case wxEDIT_UNDO: - if (changes_start == changes_end) - return FALSE; - break; - case wxEDIT_REDO: - if (redochanges_start == redochanges_end) - return FALSE; - break; - } - - return ReallyCanEdit(op); -} - -int wxMediaBuffer::AppendFontItems(wxMenu *, int) -{ - return 0; -} - -void wxMediaBuffer::DoFont(int, Bool) -{ - return; -} - -void wxMediaBuffer::InsertBox(int type) -{ - wxSnip *snip; - char *sname; - - snip = OnNewBox(type); - if (!snip) - return; - - sname = GetDefaultStyleName(); - - BeginEditSequence(); - snip->style = styleList->FindNamedStyle(sname); - if (!snip->style) { - wxStyle *bs; - bs = styleList->BasicStyle(); - snip->style = bs; - } - Insert(snip); - SetCaretOwner(snip); - EndEditSequence(); -} - -wxSnip *wxMediaBuffer::OnNewBox(int type) -{ - wxMediaSnip *snip; - wxMediaBuffer *media; - - if (type == wxEDIT_BUFFER) - media = new WXGC_PTRS wxMediaEdit(); - else - media = new WXGC_PTRS wxMediaPasteboard(); - snip = new WXGC_PTRS wxMediaSnip(media); - - media->SetKeymap(map); - media->SetStyleList(styleList); - - return snip; -} - -void wxMediaBuffer::InsertImage(char *filename, long type, Bool relative, Bool inlineImg) -{ - wxImageSnip *snip; - - if (!filename) { - filename = GetFile(NULL); - } - - if (!filename) - return; - - snip = OnNewImageSnip(filename, type, relative, inlineImg); - Insert(snip); -} - -wxImageSnip *wxMediaBuffer::OnNewImageSnip(char *filename, long type, - Bool relative, Bool inlineImg) -{ - return new WXGC_PTRS wxImageSnip(filename, type, relative, inlineImg); -} - -/**********************************************************************/ - -wxBufferData *wxMediaBuffer::GetSnipData(wxSnip *) -{ - return NULL; -} - -void wxMediaBuffer::SetSnipData(wxSnip *, wxBufferData *) -{ -} - -/**********************************************************************/ - -Bool wxWriteMediaVersion(wxMediaStreamOut *f, wxMediaStreamOutBase *b) -{ - b->Write(MRED_READER_STR, MRED_READER_STR_LEN); - b->Write(MRED_START_STR, MRED_START_STR_LEN); - b->Write(MRED_FORMAT_STR, MRED_FORMAT_STR_LEN); - b->Write(MRED_VERSION_STR, MRED_VERSION_STR_LEN); - b->Write(" ## ", 4); - - return !b->Bad(); -} - -Bool wxDetectWXMEFile(const char *who, Scheme_Object *f, int peek) -{ - char sbuffer[MRED_START_STR_LEN+MRED_READER_STR_LEN+1]; - int n; - - n = scheme_get_byte_string(who, f, sbuffer, 0, MRED_START_STR_LEN, 0, peek, NULL); - sbuffer[MRED_START_STR_LEN] = 0; - if ((n != MRED_START_STR_LEN) || strcmp(sbuffer, MRED_START_STR)) { - if (!strncmp(sbuffer, MRED_READER_STR, MRED_START_STR_LEN)) { - /* So far, it looks like the #reader prefix... */ - if (peek) - n = scheme_get_byte_string(who, f, sbuffer, 0, MRED_READER_STR_LEN + MRED_START_STR_LEN, 0, 1, NULL); - else - n += scheme_get_byte_string(who, f, sbuffer XFORM_OK_PLUS MRED_START_STR_LEN, 0, MRED_READER_STR_LEN, 0, 0, NULL); - sbuffer[MRED_READER_STR_LEN + MRED_START_STR_LEN] = 0; - if ((n != (MRED_READER_STR_LEN + MRED_START_STR_LEN)) || strcmp(sbuffer, MRED_READER_STR MRED_START_STR)) - return 0; - } else - return 0; - } - - return 1; -} - -Bool wxReadMediaVersion(wxMediaStreamIn *mf, wxMediaStreamInBase *b, Bool parseFormat, Bool showErrors) -{ - char vbuf[MRED_READER_STR_LEN + MRED_FORMAT_STR_LEN + MRED_VERSION_STR_LEN + MRED_START_STR_LEN + 1]; - - if (parseFormat) { - memset(vbuf, 0, MRED_START_STR_LEN + 1); - b->Read(vbuf, MRED_START_STR_LEN); - if (strcmp(vbuf, MRED_START_STR)) { - /* Maybe we have a #reader... prefix? */ - memset(vbuf XFORM_OK_PLUS MRED_START_STR_LEN, 0, MRED_READER_STR_LEN - MRED_START_STR_LEN + 1); - b->Read(vbuf XFORM_OK_PLUS MRED_START_STR_LEN, MRED_READER_STR_LEN - MRED_START_STR_LEN); - if (!strcmp(vbuf, MRED_READER_STR)) { - /* Yes, so try reading start again. */ - memset(vbuf, 0, MRED_START_STR_LEN + 1); - b->Read(vbuf, MRED_START_STR_LEN); - } - - if (strcmp(vbuf, MRED_START_STR)) { - if (showErrors) - wxmeError("insert-file in pasteboard%: not a MrEd editor<%> file"); - return FALSE; - } - } - } - - b->Read(vbuf, MRED_FORMAT_STR_LEN); - memcpy((char *)mf->read_format, vbuf, MRED_FORMAT_STR_LEN); - b->Read(vbuf, MRED_VERSION_STR_LEN); - memcpy((char *)mf->read_version, vbuf, MRED_VERSION_STR_LEN); - - return wxmeCheckFormatAndVersion(mf, b, showErrors); -} - -Bool wxReadMediaGlobalHeader(wxMediaStreamIn *f) -{ - f->scl->ResetHeaderFlags(f); - if (!f->scl->Read(f)) - return FALSE; - - wxmbSetupStyleReadsWrites(f); - - return f->bdl->Read(f); -} - -Bool wxReadMediaGlobalFooter(wxMediaStreamIn *f) -{ - wxmbDoneStyleReadsWrites(f); - f->scl->ResetHeaderFlags(f); - - return TRUE; -} - -Bool wxWriteMediaGlobalHeader(wxMediaStreamOut *f) -{ - f->PrettyStart(); - - f->scl->ResetHeaderFlags(f); - if (!f->scl->Write(f)) - return FALSE; - - wxmbSetupStyleReadsWrites(f); - - return f->bdl->Write(f); -} - -Bool wxWriteMediaGlobalFooter(wxMediaStreamOut *f) -{ - wxmbDoneStyleReadsWrites(f); - f->scl->ResetHeaderFlags(f); - - f->PrettyFinish(); - - return TRUE; -} - -/**********************************************************************/ - -int wxmeCheckFormatAndVersion(wxMediaStreamIn *s, wxMediaStreamInBase *b, Bool showErrors) -{ - if (strcmp(s->read_format, MRED_FORMAT_STR)) { - if (showErrors) - wxmeError("load-file: unknown format number in editor<%> file format"); - return 0; - } - if (strcmp(s->read_version, MRED_VERSION_STR) - && strcmp(s->read_version, "01") - && strcmp(s->read_version, "02") - && strcmp(s->read_version, "03") - && strcmp(s->read_version, "04") - && strcmp(s->read_version, "05") - && strcmp(s->read_version, "06") - && strcmp(s->read_version, "07")) { - if (showErrors) - wxmeError("load-file: unknown version number in editor<%> file format"); - return 0; - } - - if (!WXME_VERSION_ONE(s) - && !WXME_VERSION_TWO(s) - && !WXME_VERSION_THREE(s)) { - /* Need to skip " ## " */ - char buf[4]; - b->Read((char *)buf, 4); - if ((buf[0] != ' ') - || (buf[1] != '#') - || (buf[2] != '#') - || ((buf[3] != ' ') - && (buf[3] != '\r') - && (buf[3] != '\n'))) { - if (showErrors) - wxmeError("load-file: editor<%> file missing ' ## ' mark"); - return 0; - } - } - - return 1; -} - -Bool wxMediaBuffer::ReadHeaderFromFile(wxMediaStreamIn *, char *headerName) -{ - char buffer[256]; - - sprintf(buffer, "read-header-from-file: unknown header data: \"%.100s\"", headerName); - - wxmeError(buffer); - - return TRUE; -} - -Bool wxMediaBuffer::ReadFooterFromFile(wxMediaStreamIn *, char *headerName) -{ - char buffer[256]; - - sprintf(buffer, "read-footer-from-file: unknown header data: \"%.100s\"", headerName); - - wxmeError(buffer); - - return TRUE; -} - -Bool wxMediaBuffer::WriteHeadersToFile(wxMediaStreamOut *WXUNUSED(f)) -{ - return TRUE; -} - -Bool wxMediaBuffer::WriteFootersToFile(wxMediaStreamOut *WXUNUSED(f)) -{ - return TRUE; -} - -Bool wxMediaBuffer::BeginWriteHeaderFooterToFile(wxMediaStreamOut *f, - char *headerName, - long *dataBuffer) -{ - long db; - db = f->Tell(); - *dataBuffer = db; - f->PutFixed(0); - f->Put(headerName); - - return TRUE; -} - -Bool wxMediaBuffer::EndWriteHeaderFooterToFile(wxMediaStreamOut *f, - long dataBuffer) -{ - long end, pos; - - end = f->Tell(); - - f->JumpTo(dataBuffer); - f->PutFixed(0); - pos = f->Tell(); - - f->JumpTo(dataBuffer); - f->PutFixed(end - pos); - - f->JumpTo(end); - - numExtraHeaders++; - - return TRUE; -} - -Bool wxMediaBuffer::ReadHeadersFooters(wxMediaStreamIn *f, Bool headers) -{ - char headerName[256]; - long len, hlen, i, pos, numHeaders; - - f->GetFixed(&numHeaders); -#if 0 - if (numHeaders > 1000) { - if (wxMessageBox("File contains suspiciously large value for special" - " headers/footers. Give up?", "Warning", - wxYES_NO | wxCENTRE) == wxYES) - return FALSE; - } -#endif - - for (i = 0; i < numHeaders; i++) { - f->GetFixed(&len); - if (!f->Ok()) - return FALSE; - if (len) { - pos = f->Tell(); - f->SetBoundary(len); - hlen = 256; - f->Get((long *)&hlen, (char *)headerName); - if (headers) { - if (!ReadHeaderFromFile(f, headerName)) - return FALSE; - } else { - if (!ReadFooterFromFile(f, headerName)) - return FALSE; - } - if (!f->Ok()) - return FALSE; - f->RemoveBoundary(); - if (len -= (f->Tell() - pos)) - f->Skip(len); - if (!f->Ok()) - return FALSE; - } - } - - return TRUE; -} - -Bool wxMediaBuffer::DoWriteHeadersFooters(wxMediaStreamOut *f, Bool headers) -{ - long allStart, allEnd; - - allStart = f->Tell(); - f->PutFixed(0); - numExtraHeaders = 0; - - if (headers) { - if (!WriteHeadersToFile(f)) - return FALSE; - } else { - if (!WriteFootersToFile(f)) - return FALSE; - } - - if (numExtraHeaders) { - allEnd = f->Tell(); - f->JumpTo(allStart); - f->PutFixed(numExtraHeaders); - f->JumpTo(allEnd); - } - - return TRUE; -} - -/**********************************************************************/ - -static wxBufferData *ReadBufferData(wxMediaStreamIn *f) -{ - wxBufferData *data, *newdata; - wxBufferDataClass *dclass; - int extraDataIndex; - long datalen; - - data = NULL; - do { - f->Get(&extraDataIndex); - if (extraDataIndex) { - dclass = f->bdl->FindByMapPosition(f, extraDataIndex); - - if (!dclass || !dclass->required) - f->Get(&datalen); - else - datalen = -1; - - if (dclass) { - long start; - start = f->Tell(); - if (datalen >= 0) - f->SetBoundary(datalen); - if (!(newdata = dclass->Read(f))) - return FALSE; - newdata->next = data; - data = newdata; - if (datalen >= 0) { - long rcount; - rcount = f->Tell() - start; - if (rcount < datalen) { - wxmeError("read-buffer-data: underread (caused by file corruption?)"); - f->Skip(datalen - rcount); - } - f->RemoveBoundary(); - } - } else { - /* Unknown extra data */ - f->Skip(datalen); - } - if (!f->Ok()) - return FALSE; - } - } while (extraDataIndex); - - return data; -} - -Bool wxMediaBuffer::ReadSnipsFromFile(wxMediaStreamIn *f, Bool overwritestylename) -{ - long len, numHeaders, numSnips, i, listId; - int styleIndex; - short n; - wxStyleList *newList; - wxSnipClass *sclass; - wxBufferData *data; - wxSnip *snip; - wxList *snipsToInsert, *dataToInsert; - - if (!ReadHeadersFooters(f, TRUE)) - return FALSE; - - if (!(newList = wxmbReadStylesFromFile(styleList, f, overwritestylename, &listId))) - return FALSE; - - if (PTRNE(newList, styleList)) - SetStyleList(newList); - - f->GetFixed(&numHeaders); - -#if 0 - if (numHeaders > 100) { - if (wxMessageBox("File contains suspiciously large value for class" - " headers. Give up?", "Warning", - wxYES_NO | wxCENTRE) == wxYES) - return FALSE; - } -#endif - - for (i = 0; i < numHeaders; i++) { - f->Get(&n); - f->GetFixed(&len); - if (!f->Ok()) - return FALSE; - if (len) { - sclass = f->scl->FindByMapPosition(f, n); - if (sclass) { - long start, rcount; - start = f->Tell(); - - f->SetBoundary(len); - if (!sclass->ReadHeader(f)) - return FALSE; - if (!f->Ok()) - return FALSE; - f->SetHeaderFlag(sclass); - - rcount = f->Tell() - start; - if (rcount < len) { - wxmeError("read-snips-from-file: underread (caused by file corruption?)"); - f->Skip(len - rcount); - } - - f->RemoveBoundary(); - } else { - f->Skip(len); - } - if (!f->Ok()) - return FALSE; - } - } - - f->Get(&numSnips); - - if (bufferType == wxEDIT_BUFFER) { - snipsToInsert = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - dataToInsert = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - } else { - snipsToInsert = NULL; - dataToInsert = NULL; - } - - for (i = 0; i < numSnips; i++) { - f->Get(&n); - if (n >= 0) { - sclass = f->scl->FindByMapPosition(f, n); - } else - sclass = NULL; /* -1 => unknown */ - if (!sclass || !sclass->required) - f->GetFixed(&len); - else - len = -1; - if (!f->Ok()) - return FALSE; - if (len) { - if (sclass) { - long start; - start = f->Tell(); - - if (len >= 0) - f->SetBoundary(len); - f->Get(&styleIndex); - if ((snip = sclass->Read(f))) { - if (snip->flags & wxSNIP_OWNED) - snip->flags -= wxSNIP_OWNED; - snip->style = styleList->MapIndexToStyle(f, styleIndex, listId); - if (!snip->style) { - wxStyle *bs; - bs = styleList->BasicStyle(); - snip->style = bs; - } - if (snipsToInsert) - snipsToInsert->Append(snip); - else { - if (!ReadInsert(snip)) - return FALSE; - } - } else - return FALSE; - - data = ReadBufferData(f); - if (!f->Ok()) - return FALSE; - - if (dataToInsert) - dataToInsert->Append(data); - else if (data) - SetSnipData(snip, data); - - if (len >= 0) { - long rcount; - rcount = f->Tell() - start; - if (rcount < len) { - wxmeError("read-snips-from-file: underread (caused by file corruption?)"); - f->Skip(len - rcount); - } - f->RemoveBoundary(); - } - } else { - f->Skip(len); - } - if (!f->Ok()) - return FALSE; - } - } - - if (snipsToInsert) { - wxNode *sn, *dn; - ((wxMediaEdit *)this)->ReadInsert(snipsToInsert); - sn = snipsToInsert->First(); - dn = dataToInsert->First(); - for (; sn; sn = sn->Next(), dn = dn->Next()) { - data = (wxBufferData *)dn->Data(); - if (data) { - snip = (wxSnip *)sn->Data(); - SetSnipData(snip, data); - } - } - - DELETE_OBJ snipsToInsert; - DELETE_OBJ dataToInsert; - } - - if (!ReadHeadersFooters(f, FALSE)) - return FALSE; - - return TRUE; -} - -Bool wxmbWriteBufferData(wxMediaStreamOut *f, wxBufferData *data) -{ - long dataPos = 0, dataStart = 0, dataEnd; - - while (data) { - short mp; - mp = (short)f->MapPosition(data->dataclass); - f->Put(mp); - - if (!data->dataclass->required) { - dataStart = f->Tell(); - f->PutFixed(0); - dataPos = f->Tell(); - } - - if (!data->Write(f)) - return FALSE; - - if (!data->dataclass->required) { - dataEnd = f->Tell(); - f->JumpTo(dataStart); - f->PutFixed(dataEnd - dataPos); - f->JumpTo(dataEnd); - } - data = data->next; - } - - f->Put(0); - - return TRUE; -} - -Bool wxmbWriteSnipsToFile(wxMediaStreamOut *f, - wxStyleList *styleList, - wxList *snipList, - wxSnip *startSnip, wxSnip *endSnip, - wxList *extraData, - wxMediaBuffer *buffer) -{ - long allStart, allEnd, headerPos, headerStart, headerEnd; - long snipCount, snipPos = 0, snipStart = 0, snipEnd; - long numHeaders; - int styleIndex; - wxNode *node = NULL, *node2; - wxSnip *snip; - wxSnipClass *sclass; - wxBufferData *data; - - if (!wxmbWriteStylesToFile(styleList, f)) - return FALSE; - - allStart = f->Tell(); - f->PutFixed(0); - - if (snipList) { - node = snipList->First(); - if (!node) - return FALSE; - startSnip = (wxSnip *)node->Data(); - endSnip = NULL; - } else - node = NULL; - - numHeaders = 0; - snipCount = 0; - for (snip = startSnip; PTRNE(snip, endSnip); snipCount++) { - sclass = snip->snipclass; - if (!sclass) { - wxmeError("write-snips-to-file: snip has no snipclass"); - } else if (!f->GetHeaderFlag(sclass)) { - short mp; - mp = (short)f->MapPosition(sclass); - f->Put(mp); - headerStart = f->Tell(); - f->PutFixed(0); - headerPos = f->Tell(); - if (!sclass->WriteHeader(f)) - return FALSE; - f->SetHeaderFlag(sclass); - headerEnd = f->Tell(); - f->JumpTo(headerStart); - f->PutFixed(headerEnd - headerPos); - f->JumpTo(headerEnd); - numHeaders++; - if (!f->Ok()) - return FALSE; - } - - if (snipList) { - node = node->Next(); - if (node) - snip = (wxSnip *)node->Data(); - else - snip = NULL; - } else - snip = snip->next; - } - - allEnd = f->Tell(); - f->JumpTo(allStart); - f->PutFixed(numHeaders); - f->JumpTo(allEnd); - - f->Put(snipCount); - - if (snipList) - node = snipList->First(); - else - node = NULL; - if (extraData) - node2 = extraData->First(); - else - node2 = NULL; - - for (snip = startSnip; PTRNE(snip, endSnip); ) { - sclass = snip->snipclass; - - if (sclass) { - short mp; - mp = (short)f->MapPosition(sclass); - f->Put(mp); - } else - f->Put((short)(-1)); - - if (!snip->snipclass || !snip->snipclass->required) { - snipStart = f->Tell(); - f->PutFixed(0); - snipPos = f->Tell(); - } - - styleIndex = styleList->StyleToIndex(snip->style); - if (styleIndex < 0) { - wxmeError("write-snips-to-file: bad style discovered"); - styleIndex = 0; - } - f->Put(styleIndex); - - snip->Write(f); - if (node2) - data = (wxBufferData *)node2->Data(); - else - data = buffer->GetSnipData(snip); - - if (!wxmbWriteBufferData(f, data)) - return FALSE; - - if (!snip->snipclass || !snip->snipclass->required) { - snipEnd = f->Tell(); - f->JumpTo(snipStart); - f->PutFixed(snipEnd - snipPos); - f->JumpTo(snipEnd); - } - - if (!f->Ok()) - return FALSE; - - if (snipList) { - node = node->Next(); - if (node) - snip = (wxSnip *)node->Data(); - else - snip = NULL; - } else - snip = snip->next; - if (extraData) - node2 = node2->Next(); - } - - return TRUE; -} - -char *wxMediaBuffer::GetFilename(Bool *temp) -{ - if (temp) - *temp = tempFilename; - return filename; -} - -wxWindow *wxMediaBuffer::ExtractParent(void) -{ - if (admin && (admin->standard > 0)) { - wxWindow *w; - - w = ((wxCanvasMediaAdmin *)admin)->GetCanvas(); - - while (w && !wxSubType(w->__type, wxTYPE_FRAME) - && !wxSubType(w->__type, wxTYPE_DIALOG_BOX)) { - w = w->GetParent(); - } - - return w; - } else - return NULL; -} - -#ifndef wx_xt -class wxMediaPrintout : public wxPrintout -{ -private: - wxMediaBuffer *b; - void *data; - - Bool fitToPage; - -public: - wxMediaPrintout(wxMediaBuffer *buffer, Bool fit); - - Bool HasPage(int page); - Bool OnPrintPage(int page); - Bool OnBeginDocument(int startPage, int endPage); - void OnEndDocument(); -}; - -wxMediaPrintout::wxMediaPrintout(wxMediaBuffer *buffer, Bool fit) -: wxPrintout() -{ - b = buffer; - fitToPage = fit; -} - -Bool wxMediaPrintout::HasPage(int page) -{ - return b->HasPrintPage(GetDC(), page); -} - -Bool wxMediaPrintout::OnPrintPage(int page) -{ - b->PrintToDC(GetDC(), page); - - return TRUE; -} - -Bool wxMediaPrintout::OnBeginDocument(int startPage, int endPage) -{ - if (wxPrintout::OnBeginDocument(startPage, endPage)) { - b->printing = GetDC(); - data = b->BeginPrint(b->printing, fitToPage); - return TRUE; - } else - return FALSE; -} - -void wxMediaPrintout::OnEndDocument() -{ - wxDC *pr = b->printing; - b->printing = NULL; - b->EndPrint(pr, data); - wxPrintout::OnEndDocument(); - b->InvalidateBitmapCache(0, 0, -1, -1); -} -#endif - -#ifdef wx_x -# define WXUNUSED_X(x) /* empty */ -#else -# define WXUNUSED_X(x) x -#endif - -void wxMediaBuffer::Print(Bool interactive, Bool fitToPage, int WXUNUSED_X(output_mode), wxWindow *parent, - Bool forcePageBBox, Bool asEPS) -{ - int ps; - -#ifndef wx_x - ps = (output_mode == 1); -#else - ps = 1; -#endif - - if (!parent) { - parent = ExtractParent(); - } - - if (ps) { - wxDC *dc; - void *data; - - dc = new WXGC_PTRS wxPostScriptDC(interactive, parent, forcePageBBox, asEPS); - - if (dc->Ok()) { - dc->StartDoc("Printing buffer"); - - printing = dc; - data = BeginPrint(dc, fitToPage); - - PrintToDC(dc); - - printing = NULL; - EndPrint(dc, data); - - dc->EndDoc(); - - InvalidateBitmapCache(0, 0, -1, -1); - } - - DELETE_OBJ dc; - - return; - } - -#ifndef wx_x - { - wxPrinter *p; - wxPrintout *o; - - p = new WXGC_PTRS wxPrinter(); - o = new WXGC_PTRS wxMediaPrintout(this, fitToPage); - - p->Print(parent, o, interactive); - - DELETE_OBJ o; - DELETE_OBJ p; - } -#endif -} - -/****************************************************************/ - -void wxMediaBuffer::Undo(void) -{ - if (!undomode && !redomode) { - undomode = TRUE; - - PerformUndos(FALSE); - - undomode = FALSE; - } -} - -void wxMediaBuffer::Redo(void) -{ - if (!undomode && !redomode) { - redomode = TRUE; - - PerformUndos(TRUE); - - redomode = FALSE; - } -} - -#define delete_cgrec(x) DELETE_OBJ (x) - -static void wxmeClearUndos(wxChangeRecord **changes, int start, int end, int size) -{ - int i; - - for (i = start; i != end; i = (i + 1) % size) { - delete_cgrec(changes[i]); - changes[i] = NULL; - } -} - -void wxMediaBuffer::AddUndo(wxChangeRecord *rec) -{ - if (interceptmode) - intercepted->Append((wxObject *)rec); - else if (undomode) - AppendUndo(rec, TRUE); - else if (!noundomode) { - if (!redomode) { - if (emacs_style_undo) { - if (redochanges_start != redochanges_end) { - int e = redochanges_end; - wxChangeRecord *cr; - while (redochanges_start != e) { - e = (e - 1 + redochanges_size) % redochanges_size; - cr = redochanges[e]; - AppendUndo(cr->Inverse(), FALSE); - } - while (redochanges_start != redochanges_end) { - AppendUndo(redochanges[redochanges_start], FALSE); - redochanges[redochanges_start] = NULL; - redochanges_start = (redochanges_start + 1) % redochanges_size; - } - redochanges_start = 0; - redochanges_end = 0; - } - } else { - wxmeClearUndos(redochanges, redochanges_start, redochanges_end, redochanges_size); - redochanges_start = redochanges_end = 0; - } - } - AppendUndo(rec, FALSE); - } else - delete_cgrec(rec); -} - -void wxMediaBuffer::AddSchemeUndo(void *proc) -{ - wxSchemeModifyRecord *modrec; - modrec = new WXGC_PTRS wxSchemeModifyRecord(proc); - AddUndo(modrec); -} - -void wxMediaBuffer::AppendUndo(wxChangeRecord *rec, Bool redos) -{ - if (maxUndos) { - wxChangeRecord **c; - int start, end, size; - - if (redos) { - start = redochanges_start; - end = redochanges_end; - size = redochanges_size; - c = redochanges; - } else { - start = changes_start; - end = changes_end; - size = changes_size; - c = changes; - } - - if (!size) { - size = 128; /* Initial undo size */ - if (size > maxUndos) - size = maxUndos; - c = MALLOC_CRP(size); - } - - c[end] = rec; - end = (end + 1) % size; - if (end == start) { - if ((size < maxUndos) || emacs_style_undo) { - /* Make more room */ - int s, i, j; - wxChangeRecord **naya; - s = (size * 2); - if (s > maxUndos) - s = maxUndos; - - naya = MALLOC_CRP(s); - for (j = 0, i = start; - (j < size); - j++, i = (i + 1) % size) { - naya[j] = c[i]; - } - size = s; - c = naya; - start = 0; - end = j; - } else { - /* No room to grow, so drop an undo record */ - delete_cgrec(c[start]); - c[start] = NULL; - start = (start + 1) % size; - } - } - - if (redos) { - redochanges_start = start; - redochanges_end = end; - redochanges_size = size; - redochanges = c; - } else { - changes_start = start; - changes_end = end; - changes_size = size; - changes = c; - } - } else - delete_cgrec(rec); -} - -void wxMediaBuffer::PerformUndos(Bool redos) -{ - wxChangeRecord **c; - wxChangeRecord *rec; - wxChangeRecordId *id = NULL; - int parity = 0; - Bool cont; - int start, end, size; - - BeginEditSequence(); - - if (redos) { - start = redochanges_start; - end = redochanges_end; - size = redochanges_size; - c = redochanges; - } else { - start = changes_start; - end = changes_end; - size = changes_size; - c = changes; - } - - while (start != end) { - end = (end - 1 + size) % size; - rec = c[end]; - c[end] = NULL; - - if (redos) { - redochanges_start = start; - redochanges_end = end; - } else { - changes_start = start; - changes_end = end; - } - - if (emacs_style_undo) { - id = rec->GetId(); - parity = rec->GetParity(); - } - - cont = rec->Undo(this); - - if (!cont) - break; - } - - EndEditSequence(); - - if (emacs_style_undo && !redos) { - /* Combine all new steps into one undo record, and - set/generate id */ - start = redochanges_start; - end = redochanges_end; - size = redochanges_size; - c = redochanges; - - if (start != end) { - wxChangeRecord *cr; - int e, cnt = 0; - for (e = end; start != e; ) { - e = (e - 1 + size) % size; - cr = c[e]; - if (cr->IsComposite()) - break; - else - cnt++; - } - - if (cnt > 0) { - wxCompositeRecord *cu; - int i; - cu = new WXGC_PTRS wxCompositeRecord(cnt, id, !parity); - for (i = 0; i < cnt; i++) { - e = (end - cnt + i + size) % size; - cu->AddUndo(i, c[e]); - c[e] = NULL; - } - e = (end - cnt + size) % size; - c[e] = cu; - end = (e + 1) % size; - redochanges_end = end; - } - } - } -} - -void wxMediaBuffer::PerformUndoList(wxList *changes) -{ - wxNode *node; - wxChangeRecord *rec; - Bool cont = FALSE; - - BeginEditSequence(); - do { - node = changes->Last(); - if (node) { - rec = (wxChangeRecord *)node->Data(); - cont = rec->Undo(this); - delete_cgrec(rec); - changes->DeleteNode(node); - } - } while (node && cont); - EndEditSequence(); -} - -void wxMediaBuffer::ClearUndos() -{ - wxmeClearUndos(changes, changes_start, changes_end, changes_size); - changes_start = changes_end = 0; - wxmeClearUndos(redochanges, redochanges_start, redochanges_end, redochanges_size); - redochanges_start = redochanges_end = 0; -} - -void wxMediaBuffer::SetMaxUndoHistory(int v) -{ - if (v < 0) - v = 0xfffFFFF; - - if (undomode || redomode || (v == maxUndos)) - return; - - if (!v) { - ClearUndos(); - changes = NULL; - redochanges = NULL; - changes_size = 0; - redochanges_size = 0; - } - - /* Should we bother downsizing if maxUndos gets smaller but stays - non-0? */ - - maxUndos = v; -} - -int wxMediaBuffer::GetMaxUndoHistory() -{ - return maxUndos; -} - -/****************************************************************/ - -/* Copy and the copy ring: the current clipboard content is stored in - wxmb_commonCopyBuffer, etc. To implement the copy ring, then when a - copy is started, we moved the wxmb_commonCopyBuffer, etc. values - into a copy ring. Yanking from the ring swaps the values in - wxmb_commonCopyBuffer, etc. and the ring values and adjust the - pointer into the ring. */ - -static int copyDepth = 0; - -static int copyRingSize = 30; -static int copyRingPos = 0, copyRingMax = 0, copyRingDest = 0; - -static wxList **copyRingBuffer1, **copyRingBuffer2; -static wxStyleList **copyRingStyle; -static wxBufferData **copyRingData; - -wxList *wxmb_commonCopyBuffer = NULL; -wxList *wxmb_commonCopyBuffer2 = NULL; -wxStyleList *wxmb_copyStyleList = NULL; -wxBufferData *wxmb_commonCopyRegionData = NULL; - -wxList *wxmb_selectionCopyBuffer = NULL; -wxList *wxmb_selectionCopyBuffer2 = NULL; -wxStyleList *wxmb_selectionCopyStyleList = NULL; -wxBufferData *wxmb_selectionCopyRegionData = NULL; - -static int copyingSelf; - -static void InitCutNPaste() -{ - if (!copyRingBuffer1) { - wxREGGLOB(copyRingBuffer1); - wxREGGLOB(copyRingBuffer2); - wxREGGLOB(copyRingStyle); - wxREGGLOB(copyRingData); - - copyRingBuffer1 = new WXGC_PTRS wxList*[copyRingSize]; - copyRingBuffer2 = new WXGC_PTRS wxList*[copyRingSize]; - copyRingStyle = new WXGC_PTRS wxStyleList*[copyRingSize]; - copyRingData = new WXGC_PTRS wxBufferData*[copyRingSize]; - - copyRingMax = 1; - copyRingDest = 1; - - wxREGGLOB(wxmb_commonCopyBuffer); - wxREGGLOB(wxmb_commonCopyBuffer2); - wxmb_commonCopyBuffer = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - wxmb_commonCopyBuffer2 = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - - wxREGGLOB(wxmb_copyStyleList); - wxREGGLOB(wxmb_commonCopyRegionData); - - wxREGGLOB(wxmb_selectionCopyBuffer); - wxREGGLOB(wxmb_selectionCopyBuffer2); - wxREGGLOB(wxmb_selectionCopyStyleList); - wxREGGLOB(wxmb_selectionCopyRegionData); - } - - if (!TheMediaClipboardClient) { - wxREGGLOB(TheMediaClipboardClient); - TheMediaClipboardClient = new WXGC_PTRS wxMediaClipboardClient; -#if ALLOW_X_STYLE_SELECTION - wxREGGLOB(TheMediaXClipboardClient); - wxREGGLOB(wxMediaXSelectionOwner); - wxREGGLOB(wxMediaXSelectionAllowed); - TheMediaXClipboardClient = new WXGC_PTRS wxMediaXClipboardClient; -#endif - } -} - -void wxMediaBuffer::CopyRingNext(void) -{ - copyRingBuffer1[copyRingPos] = wxmb_commonCopyBuffer; - copyRingBuffer2[copyRingPos] = wxmb_commonCopyBuffer2; - copyRingData[copyRingPos] = wxmb_commonCopyRegionData; - copyRingStyle[copyRingPos] = wxmb_copyStyleList; - - copyRingPos = copyRingPos - 1; - if (copyRingPos < 0) - copyRingPos = copyRingMax - 1; - - wxmb_commonCopyBuffer = copyRingBuffer1[copyRingPos]; - wxmb_commonCopyBuffer2 = copyRingBuffer2[copyRingPos]; - wxmb_commonCopyRegionData = copyRingData[copyRingPos]; - wxmb_copyStyleList = copyRingStyle[copyRingPos]; -} - -void wxMediaBuffer::BeginCopyBuffer(void) -{ - copyDepth++; -} - -void wxMediaBuffer::EndCopyBuffer(void) -{ - --copyDepth; -} - -void wxMediaBuffer::FreeOldCopies(void) -{ - if (!wxmb_copyStyleList) - return; - - if (copyDepth > 1) { - /* Delete current "ring" occupant: */ - wxmb_commonCopyBuffer->DeleteContents(DELETE_CLIP_LIST_CONTENT); - DELETE_OBJ wxmb_commonCopyBuffer; - wxmb_commonCopyBuffer2->DeleteContents(DELETE_CLIP_LIST_CONTENT); - DELETE_OBJ wxmb_commonCopyBuffer2; - -#if DELETE_CLIP_LIST_CONTENT - if (wxmb_commonCopyRegionData) - DELETE_OBJ wxmb_commonCopyRegionData; -#endif - - wxmb_commonCopyBuffer = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - wxmb_commonCopyBuffer2 = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - - wxmb_commonCopyRegionData = NULL; - - wxmb_copyStyleList = NULL; - - return; - } - - copyRingBuffer1[copyRingPos] = wxmb_commonCopyBuffer; - copyRingBuffer2[copyRingPos] = wxmb_commonCopyBuffer2; - copyRingData[copyRingPos] = wxmb_commonCopyRegionData; - copyRingStyle[copyRingPos] = wxmb_copyStyleList; - - if (copyRingMax > copyRingDest) { - /* No more space: delete current ring occupant: */ - wxList *dl; - dl = copyRingBuffer1[copyRingDest]; - dl->DeleteContents(DELETE_CLIP_LIST_CONTENT); - DELETE_OBJ dl; - dl = copyRingBuffer2[copyRingDest]; - dl->DeleteContents(DELETE_CLIP_LIST_CONTENT); - DELETE_OBJ dl; - - if (copyRingData[copyRingDest]) { - wxBufferData *data; - data = copyRingData[copyRingDest]; -#if DELETE_CLIP_LIST_CONTENT - DELETE_OBJ data; -#endif - } - - copyRingPos = copyRingDest; - } - - wxmb_commonCopyBuffer = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - wxmb_commonCopyBuffer2 = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - wxmb_commonCopyRegionData = NULL; - wxmb_copyStyleList = NULL; - - copyRingPos = copyRingDest; - - copyRingDest++; - if (copyRingMax < copyRingDest) - copyRingMax = copyRingDest; - if (copyRingDest >= copyRingSize) - copyRingDest = 0; -} - -void wxMediaBuffer::InstallCopyBuffer(long time, wxStyleList *sl) -{ - wxmb_copyStyleList = sl; - - if (copyingSelf != copyDepth) { -#if ALLOW_X_STYLE_SELECTION - if (!xClipboardHack) -#endif - wxTheClipboard->SetClipboardClient(TheMediaClipboardClient, time); - } -} - -void wxMediaBuffer::DoBufferPaste(wxClipboard *cb, long time, Bool local) -{ - wxClipboardClient *owner; - wxNode *node, *node2; - wxSnip *snip; - wxBufferData *bd; - - /* Cut and paste to ourself? (Same eventspace?) */ - owner = cb->GetClipboardClient(); - if (local || (!pasteTextOnly && PTREQ(owner, TheMediaClipboardClient) - && PTREQ(wxGetContextForFrame(), owner->context))) { - copyDepth++; - for ((node = wxmb_commonCopyBuffer->First(), - node2 = wxmb_commonCopyBuffer2->First()); - node; - (node = node->Next(), - node2 = node2->Next())) { - snip = (wxSnip *)node->Data(); - bd = (wxBufferData *)node2->Data(); - snip = snip->Copy(); - InsertPasteSnip(snip, bd); - } - --copyDepth; - if (wxmb_commonCopyRegionData && bufferType == wxEDIT_BUFFER) - ((wxMediaEdit *)this)->PasteRegionData(wxmb_commonCopyRegionData); - } else { - char *str; - long len; - int got_wxme; - - if (!pasteTextOnly && (str = cb->GetClipboardData("WXME", &len, time))) { - wxMediaStreamInStringBase *b; - wxMediaStreamIn *mf; - - b = new WXGC_PTRS wxMediaStreamInStringBase(str, len); - mf = new WXGC_PTRS wxMediaStreamIn(b); - - if (wxReadMediaVersion(mf, b, TRUE, FALSE)) { - if (wxReadMediaGlobalHeader(mf)) { - if (mf->Ok()) - if (ReadFromFile(mf)) { - wxBufferData *data; - data = ReadBufferData(mf); - if (data && bufferType == wxEDIT_BUFFER) - ((wxMediaEdit *)this)->PasteRegionData(data); - } - } - wxReadMediaGlobalFooter(mf); - got_wxme = 1; - } else - got_wxme = 0; - } else - got_wxme = 0; - - if (!got_wxme) { - wxBitmap *bm = NULL; - - if (!pasteTextOnly) - bm = cb->GetClipboardBitmap(time); - if (bm) { - snip = new WXGC_PTRS wxImageSnip(bm); - InsertPasteSnip(snip, NULL); - } else { - str = cb->GetClipboardString(time); - /* no data => empty string */ - { - wxchar *us; - long ulen; - wxme_utf8_decode(str, strlen(str), &us, &ulen); - InsertPasteString(us); - } - } - } - } -} - -wxMediaClipboardClient::wxMediaClipboardClient() -{ - formats->Add("TEXT"); - formats->Add("WXME"); -} - -void wxMediaBuffer::CopySelfTo(wxMediaBuffer *m) -{ - /* Copy all the snips: */ - wxList *saveBuffer, *copySnips; - wxList *saveBuffer2, *copySnips2; - wxStyleList *saveStyles; - wxBufferData *saveData; - int save_cs; - Bool t; - char *f; - wxNode *node, *node2; - - /* Copy style list */ - m->styleList->Copy(styleList); - - /* Copy all the snips: */ - saveBuffer = wxmb_commonCopyBuffer; - saveBuffer2 = wxmb_commonCopyBuffer2; - saveStyles = wxmb_copyStyleList; - saveData = wxmb_commonCopyRegionData; - save_cs = copyingSelf; - - m->BeginEditSequence(); - - copySnips = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - wxmb_commonCopyBuffer = copySnips; - copySnips2 = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - wxmb_commonCopyBuffer2 = copySnips2; - wxmb_copyStyleList = NULL; - wxmb_commonCopyRegionData = NULL; - copyingSelf = copyDepth + 1; - if (bufferType == wxEDIT_BUFFER) { - wxMediaEdit *e = (wxMediaEdit *)this; - int pos; - pos = e->LastPosition(); - e->Copy(TRUE, 0, 0, pos); - } else { - wxMediaPasteboard *pb = (wxMediaPasteboard *)this; - wxSnip *s; - wxNode *n; - wxList *unselect; - unselect = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - - BeginEditSequence(); - for (s = pb->FindFirstSnip(); s; s = s->Next()) { - if (!pb->IsSelected(s)) { - pb->AddSelected(s); - unselect->Append(s); - } - } - pb->Copy(TRUE, 0); - for (n = unselect->First(); n; n = n->Next()) { - wxSnip *snp; - snp = (wxSnip *)n->Data(); - pb->RemoveSelected(snp); - } - EndEditSequence(); - } - wxmb_commonCopyBuffer = saveBuffer; - wxmb_commonCopyBuffer2 = saveBuffer2; - wxmb_copyStyleList = saveStyles; - wxmb_commonCopyRegionData = saveData; - copyingSelf = save_cs; - - if (m->bufferType == wxEDIT_BUFFER) - ((wxMediaEdit *)m)->Insert(copySnips); - - node = copySnips->First(); - node2 = copySnips2->First(); - for (; node; node = node->Next(), node2 = node2->Next()) { - wxSnip *s; - wxBufferData *bfd; - s = (wxSnip *)node->Data(); - if (m->bufferType == wxEDIT_BUFFER) { - /* Done all at once above: */ - /* m->Insert(s); */ - } else { - wxMediaPasteboard *pb = (wxMediaPasteboard *)m; - pb->Insert(s, s); /* before itself -> at end */ - } - bfd = (wxBufferData *)node2->Data(); - m->SetSnipData(s, bfd); - } - - /* Don't delete the snips themselves, though */ - DELETE_OBJ copySnips; - DELETE_OBJ copySnips2; - - m->SizeCacheInvalid(); - - { - double mw, mh; - mw = GetMinWidth(); - m->SetMinWidth(mw); - mw = GetMaxWidth(); - m->SetMaxWidth(mw); - mh = GetMinHeight(); - m->SetMinHeight(mh); - mh = GetMaxHeight(); - m->SetMaxHeight(mh); - } - - f = GetFilename(&t); - m->SetFilename(f, t); - - m->SetMaxUndoHistory(GetMaxUndoHistory()); - - m->SetKeymap(GetKeymap()); - - m->SetInactiveCaretThreshold(GetInactiveCaretThreshold()); - m->SetLoadOverwritesStyles(GetLoadOverwritesStyles()); - - m->EndEditSequence(); -} - -char *wxMediaBuffer::GetFlattenedTextUTF8(long *_got) -{ - wxchar *s; - char *r = NULL; - long got, len; - - s = GetFlattenedText(&got); - wxme_utf8_encode(s, got, &r, &len); - - if (_got) - *_got = len; - - return r; -} - -static char *GenericGetData(char *format, long *size, - wxList *copyBuffer, - wxList *copyBuffer2, - wxStyleList *copyStyles, - wxBufferData *copyRegionData) -{ - wxNode *node; - wxSnip *snip; - long l, length = 0, sz = 0; - wxchar *wxstr; - char *total = NULL, *old, *str; - - if (!strcmp(format, "TEXT")) { - for (node = copyBuffer->First(); node; node = node->Next()) { - snip = (wxSnip *)node->Data(); - - wxstr = snip->GetText(0, snip->count, TRUE); - wxme_utf8_encode(wxstr, wxstrlen(wxstr), &str, &l); - - if (total) { - if (length + l + 1 >= sz) { - sz = (2 * sz) + length + l + 1; - old = total; - total = new WXGC_ATOMIC char[sz]; - memcpy(total, old, length); - } - memcpy(total + length, str, l); - } else - total = str; - length += l; - } - - if (!total) - total = new WXGC_ATOMIC char[1]; - - total[length] = 0; - -#ifdef wx_mac - /* Change newline to return: */ - { - int i; - - for (i = 0; i < length; i++) { - if (total[i] == '\n') - total[i] = '\r'; - } - } -#endif -#ifdef wx_msw - /* Change newline to return-newline: */ - { - int i, extra = 0; - - for (i = 0; i < length; i++) { - if (total[i] == '\n') - extra++; - } - - if (extra) { - str = new WXGC_ATOMIC char[length + extra + 1]; - extra = 0; - for (i = 0; i < length; i++) { - if (total[i] == '\n') { - str[i + extra] = '\r'; - extra++; - str[i + extra] = '\n'; - } else - str[i + extra] = total[i]; - } - length += extra; - str[length] = 0; - total = str; - } - } -#endif - - *size = length; - - return total; - } else if (!strcmp(format, "WXME")) { - wxMediaStreamOutStringBase *b; - wxMediaStreamOut *mf; - char *result; - - b = new WXGC_PTRS wxMediaStreamOutStringBase(); - mf = new WXGC_PTRS wxMediaStreamOut(b); - - wxWriteMediaVersion(mf, b); - - wxWriteMediaGlobalHeader(mf); - if (mf->Ok()) { - mf->PutFixed(0); - if (!wxmbWriteSnipsToFile(mf, copyStyles, copyBuffer, - NULL, NULL, copyBuffer2, NULL)) - return FALSE; - mf->PutFixed(0); - wxmbWriteBufferData(mf, copyRegionData); - } - wxWriteMediaGlobalFooter(mf); - - result = b->GetString(size); - return result; - } else { - *size = 0; - return ""; - } -} - -char *wxMediaClipboardClient::GetData(char *format, long *size) -{ - return GenericGetData(format, size, - wxmb_commonCopyBuffer, - wxmb_commonCopyBuffer2, - wxmb_copyStyleList, - wxmb_commonCopyRegionData); -} - -void wxMediaClipboardClient::BeingReplaced(void) -{ -} - -#if ALLOW_X_STYLE_SELECTION - -wxMediaXClipboardClient::wxMediaXClipboardClient() -{ - formats->Add("TEXT"); - formats->Add("WXME"); -} - -static void CopyIntoSelection() -{ - /* Copy all the snips: */ - wxList *saveBuffer, *copySnips; - wxList *saveBuffer2, *copySnips2; - wxStyleList *saveStyles; - wxBufferData *saveData; - - xClipboardHack = TRUE; - - /* Save normal buffers: */ - saveBuffer = wxmb_commonCopyBuffer; - saveBuffer2 = wxmb_commonCopyBuffer2; - saveStyles = wxmb_copyStyleList; - saveData = wxmb_commonCopyRegionData; - - /* Set up new selection buffers, and redirect: */ - copySnips = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - wxmb_commonCopyBuffer = copySnips; - copySnips2 = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - wxmb_commonCopyBuffer2 = copySnips2; - wxmb_copyStyleList = NULL; - wxmb_commonCopyRegionData = NULL; - - wxMediaXSelectionOwner->Copy(FALSE, 0L); - - if (wxmb_selectionCopyBuffer) { - /* Free old selection buffers: */ - wxmb_selectionCopyBuffer->DeleteContents(DELETE_CLIP_LIST_CONTENT); - DELETE_OBJ wxmb_selectionCopyBuffer; - wxmb_selectionCopyBuffer2->DeleteContents(DELETE_CLIP_LIST_CONTENT); - DELETE_OBJ wxmb_selectionCopyBuffer2; -#if DELETE_CLIP_LIST_CONTENT - if (wxmb_selectionCopyRegionData) - DELETE_OBJ wxmb_selectionCopyRegionData; -#endif - } - - /* Move "normal" buffers to selection: */ - wxmb_selectionCopyBuffer = wxmb_commonCopyBuffer; - wxmb_selectionCopyBuffer2 = wxmb_commonCopyBuffer2; - wxmb_selectionCopyStyleList = wxmb_copyStyleList; - wxmb_selectionCopyRegionData = wxmb_commonCopyRegionData; - - /* Restore normal buffers: */ - wxmb_commonCopyBuffer = saveBuffer; - wxmb_commonCopyBuffer2 = saveBuffer2; - wxmb_copyStyleList = saveStyles; - wxmb_commonCopyRegionData = saveData; - - xClipboardHack = FALSE; -} - - -char *wxMediaXClipboardClient::GetData(char *format, long *size) -{ - if (!xSelectionCopied && !wxMediaXSelectionOwner) { - *size = 0; - return ""; - } - - if (!xSelectionCopied || wxMediaXSelectionOwner) { - CopyIntoSelection(); - } - - /* If nothing is copied (e.g., DoCopy is overriden to not copy anything - or copies directly to clipboard): */ - if (!wxmb_selectionCopyStyleList) { - if (wxTheSelection->GetClipboardClient() == this) - return NULL; - else - return wxTheSelection->GetClipboardData(format, size, 0); - } - - return GenericGetData(format, size, - wxmb_selectionCopyBuffer, - wxmb_selectionCopyBuffer2, - wxmb_selectionCopyStyleList, - wxmb_selectionCopyRegionData); -} - -void wxMediaXClipboardClient::BeingReplaced(void) -{ - if (wxMediaXSelectionOwner) { - /* In case this client replaced itself somewhere along the way: */ - if (this != wxTheSelection->GetClipboardClient()) { - wxMediaBuffer *b = wxMediaXSelectionOwner; - wxMediaXSelectionOwner= NULL; - xSelectionCopied = FALSE; - b->OwnXSelection(FALSE, TRUE, FALSE); - } - } else - xSelectionCopied = FALSE; -} - -#endif - -/****************************************************************/ - -#if ALLOW_X_STYLE_SELECTION - -Bool wxMediaBuffer::DoOwnXSelection(Bool on, Bool force) -{ - if (on) { - if (!force && wxMediaXSelectionAllowed != this) - return FALSE; - if (wxMediaXSelectionOwner) { - wxMediaXSelectionOwner->OwnXSelection(FALSE, TRUE, FALSE); - wxMediaXSelectionOwner = NULL; // should be redundant - } - xSelectionCopied = FALSE; - wxTheSelection->SetClipboardClient(TheMediaXClipboardClient, 0L); - wxMediaXSelectionOwner = this; - } else if (this == wxMediaXSelectionOwner) { - wxMediaXSelectionOwner = NULL; - if (!xSelectionCopied - && PTREQ(wxTheSelection->GetClipboardClient(), - TheMediaXClipboardClient)) { - wxTheSelection->SetClipboardString("", 0L); - } - } - - return TRUE; -} - -void wxMediaBuffer::CopyOutXSelection(void) -{ - if (this == wxMediaXSelectionOwner) { - CopyIntoSelection(); - xSelectionCopied = TRUE; - } -} - -#endif - -void wxMediaSetXSelectionMode(Bool on) -{ -#if ALLOW_X_STYLE_SELECTION - wxMediaXSelectionMode = on; - if (!on && PTREQ(wxTheSelection->GetClipboardClient(), - TheMediaXClipboardClient)) - wxTheSelection->SetClipboardString("", 0L); -#endif -} - -Bool wxMediaBuffer::GetPasteTextOnly(void) -{ - return pasteTextOnly; -} - -void wxMediaBuffer::SetPasteTextOnly(Bool pto) -{ - pasteTextOnly = pto; -} - - -/****************************************************************/ - -void wxMediaBuffer::Lock(Bool lock) -{ - userLocked = lock; -} - -Bool wxMediaBuffer::IsLocked() -{ - return userLocked; -} - -Bool wxMediaBuffer::Modified(void) -{ - return modified; -} - -void wxMediaBuffer::SetModified(Bool mod) -{ - if (!!mod == !!modified) - return; - - modified = mod; - - if (mod) - num_parts_modified = 1; - - if (!mod && !undomode) { - /* Get rid of undos that reset the modification state. */ - int i; - num_parts_modified = 0; - for (i = changes_end; i != changes_start; ) { - wxChangeRecord *cr; - i = (i - 1 + changes_size) % changes_size; - cr = changes[i]; - cr->DropSetUnmodified(); - } - for (i = redochanges_end; i != redochanges_start; ) { - wxChangeRecord *cr; - i = (i - 1 + redochanges_size) % redochanges_size; - cr = redochanges[i]; - cr->DropSetUnmodified(); - } - } - - if (admin) - admin->Modified(modified); - - if (!mod && !undomode) { - /* Tell all snips that they should now consider themselves unmodified: */ - wxSnip *snip; - for (snip = FindFirstSnip(); snip; snip = snip->next) { - snip->SetUnmodified(); - } - } -} - -void wxMediaBuffer::OnSnipModified(wxSnip *s, Bool mod) -{ - if (!mod) { - if (num_parts_modified == 1) { - num_parts_modified = 0; - if (modified) - SetModified(FALSE); - } - } else { - if (!modified) - SetModified(TRUE); - else - num_parts_modified++; - } -} - -int wxMediaBuffer::GetInactiveCaretThreshold(void) -{ - return inactiveCaretThreshold; -} - -void wxMediaBuffer::SetInactiveCaretThreshold(int v) -{ - inactiveCaretThreshold = v; -} - -Bool wxMediaBuffer::AdminScrollTo(double localx, double localy, double w, double h, - Bool refresh, int bias) -{ - if (admin) - return admin->ScrollTo(localx, localy, w, h, refresh, bias); - else - return FALSE; -} - -void wxMediaBuffer::OnPaint(Bool WXUNUSED(pre), - wxDC *WXUNUSED(dc), - double WXUNUSED(l), double WXUNUSED(t), - double WXUNUSED(r), double WXUNUSED(b), - double WXUNUSED(dx), double WXUNUSED(dy), - int WXUNUSED(show_caret)) -{ - /* Do nothing */ -} - -Bool wxMediaBuffer::CanSaveFile(char *WXUNUSED(filename), int WXUNUSED(format)) -{ - return TRUE; -} - -void wxMediaBuffer::OnSaveFile(char *WXUNUSED(filename), int WXUNUSED(format)) -{ - /* do nothing */ -} - -void wxMediaBuffer::AfterSaveFile(Bool WXUNUSED(success)) -{ - /* do nothing */ -} - -Bool wxMediaBuffer::CanLoadFile(char *WXUNUSED(filename), int WXUNUSED(format)) -{ - return TRUE; -} - -void wxMediaBuffer::OnLoadFile(char *WXUNUSED(filename), int WXUNUSED(format)) -{ - /* do nothing */ -} - -void wxMediaBuffer::AfterLoadFile(Bool WXUNUSED(success)) -{ - /* do nothing */ -} - -void wxMediaBuffer::OnEditSequence(void) -{ - /* Do nothing */ -} - -void wxMediaBuffer::AfterEditSequence(void) -{ - /* Do nothing */ -} - -void wxMediaBuffer::OnDisplaySize(void) -{ - /* Do nothing */ -} - -void wxMediaBuffer::OnDisplaySizeWhenReady(void) -{ - if (InEditSequence()) - needOnDisplaySize = 1; - else { - if (!seq_lock || scheme_wait_sema((Scheme_Object *)seq_lock, 1)) { - if (seq_lock) - scheme_post_sema((Scheme_Object *)seq_lock); - OnDisplaySize(); - } else - needOnDisplaySize = 1; - } -} - -void wxMediaBuffer::BeginSequenceLock() -{ - Scheme_Object *sema; - - if (!seq_lock) { - sema = scheme_make_sema(1); - seq_lock = sema; - } else - sema = (Scheme_Object *)seq_lock; - - /* "Try" really should succeed, because multiple refreshes are - prevent through other flags. Still, we don't want to block if - someone previously escaped from a repaint. */ - scheme_wait_sema(sema, 1); -} - -void wxMediaBuffer::EndSequenceLock() -{ - scheme_post_sema((Scheme_Object *)seq_lock); -} - -void wxMediaBuffer::WaitSequenceLock() -{ - if (seq_lock) { - Scheme_Object *sema; - sema = (Scheme_Object *)seq_lock; - scheme_wait_sema(sema, 0); - scheme_post_sema(sema); - } -} - -#ifdef wx_msw -#define WILDCARD "*.*" -#else -#define WILDCARD "*" -#endif - -char *wxMediaBuffer::GetFile(char *path) -{ - return wxFileSelector("Choose a file", path, NULL, - NULL, WILDCARD, wxOPEN, - ExtractParent(), 0, 0); -} - -char *wxMediaBuffer::PutFile(char *path, char *suggested_name) -{ - return wxFileSelector("Save file as", path, - suggested_name, NULL, WILDCARD, wxSAVE, - ExtractParent(), 0, 0); -} - -void wxMediaBuffer::SetLoadOverwritesStyles(Bool b) -{ - loadoverwritesstyles = b; -} - -Bool wxMediaBuffer::GetLoadOverwritesStyles() -{ - return loadoverwritesstyles; -} - -/****************************************************************/ - -#define edf(name, action, kname) \ - static Bool ed_##name(void *vb, wxEvent *kname, void *) \ - { wxMediaBuffer *b = NULL; \ - if (vb) b = objscheme_unbundle_wxMediaBuffer((Scheme_Object *)vb, NULL, 0); \ - if (!b) \ - return FALSE; \ - b->action; \ - return TRUE; } \ - -edf(copy, Copy(FALSE, event->timeStamp), event) -edf(copyappend, Copy(TRUE, event->timeStamp), event) -edf(paste, Paste(event->timeStamp), event) -edf(paste_x_sel, PasteSelection(event->timeStamp), event) -edf(cut, Cut(FALSE, event->timeStamp), event) -edf(kill, Kill(event->timeStamp), event) -edf(cutappend, Cut(TRUE, event->timeStamp), event) -edf(undo, Undo(), WXUNUSED(event)) -edf(redo, Redo(), WXUNUSED(event)) -edf(delete, Clear(), WXUNUSED(event)) -edf(select_all, SelectAll(), WXUNUSED(event)) - -void wxMediaBuffer::AddBufferFunctions(wxKeymap *tab) -{ - wxAddMediaBufferFunctions(tab); -} - -void wxAddMediaBufferFunctions(wxKeymap *tab) -{ -#define setf(name, func) tab->AddFunction(name, ed_##func, NULL) - - setf("copy-clipboard", copy); - setf("copy-append-clipboard", copyappend); - setf("cut-clipboard", cut); - setf("cut-append-clipboard", cutappend); - setf("paste-clipboard", paste); - setf("paste-x-selection", paste_x_sel); - setf("delete-selection", delete); - setf("clear-selection", delete); - setf("delete-to-end-of-line", kill); - - setf("undo", undo); - setf("redo", redo); - - setf("select-all", select_all); -} - -/****************************************************************/ - -#ifdef MEMORY_USE_METHOD -long wxMediaBuffer::MemoryUse(void) -{ - return ((filename ? strlen(filename) + 1 : 0) - + (maxUndos * 2 * sizeof(wxChangeRecord*)) - + wxObject::MemoryUse()); -} -#endif - -/****************************************************************/ - -wxStandardSnipAdmin::wxStandardSnipAdmin(wxMediaBuffer *m) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_MEDIA_SNIP_ADMIN; -#endif - - media = m; -} - -wxMediaBuffer *wxStandardSnipAdmin::GetMedia(void) -{ - return media; -} - -wxDC *wxStandardSnipAdmin::GetDC() -{ - return media->GetDC(); -} - -void wxStandardSnipAdmin::GetViewSize(double *w, double *h) -{ - GetView(NULL, NULL, w, h, NULL); -} - -void wxStandardSnipAdmin::GetView(double *x, double *y, double *w, double *h, wxSnip *snip) -{ - wxMediaAdmin *admin; - admin = media->GetAdmin(); - - if (snip) { - if (admin) { - double mx, my, mh, mw, mr, mb, sl, st, sr, sb; - - admin->GetView(&mx, &my, &mw, &mh, FALSE); - - mb = my + mh; - mr = mx + mw; - if (media->GetSnipLocation(snip, &sl, &st, FALSE)) { - double l, t, r, b; - - media->GetSnipLocation(snip, &sr, &sb, TRUE); - - l = (mx > sl ? mx : sl); - t = (my > st ? my : st); - r = (mr > sr ? sr : mr); - b = (mb > sb ? sb : mb); - - if (x) - *x = l - sl; - if (y) - *y = t - st; - if (w) { - if (r < l) - *w = 0; - else - *w = (r - l); - } - if (h) { - if (b < t) - *h = 0; - else - *h = (b - t); - } - - return; - } - } - } else { - if (admin) { - admin->GetView(x, y, w, h, TRUE); - return; - } - } - - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; -} - -Bool wxStandardSnipAdmin::ScrollTo(wxSnip *s, double localx, double localy, - double w, double h, Bool refresh, int bias) -{ - if (s->GetAdmin() == this) - return media->ScrollTo(s, localx, localy, w, h, refresh, bias); - else - return FALSE; -} - -void wxStandardSnipAdmin::SetCaretOwner(wxSnip *s, int dist) -{ - if (s->GetAdmin() == this) - media->SetCaretOwner(s, dist); -} - -void wxStandardSnipAdmin::Resized(wxSnip *s, Bool redraw_now) -{ - if (s->GetAdmin() == this) - media->Resized(s, redraw_now); -} - -Bool wxStandardSnipAdmin::Recounted(wxSnip *s, Bool redraw_now) -{ - if (s->GetAdmin() == this) - return media->Recounted(s, redraw_now); - else - return FALSE; -} - -void wxStandardSnipAdmin::NeedsUpdate(wxSnip *s, double localx, double localy, - double w, double h) -{ - if (s->GetAdmin() == this) - media->NeedsUpdate(s, localx, localy, w, h); -} - -Bool wxStandardSnipAdmin::ReleaseSnip(wxSnip *snip) -{ - if (snip->GetAdmin() == this) - return media->ReleaseSnip(snip); - else - return FALSE; -} - -void wxStandardSnipAdmin::UpdateCursor() -{ - if (media->admin) - media->admin->UpdateCursor(); -} - -Bool wxStandardSnipAdmin::PopupMenu(void *m, wxSnip *snip, double x, double y) -{ - if (media->admin) { - double sl, st; - if (media->GetSnipLocation(snip, &sl, &st, FALSE)) { - media->admin->PopupMenu(m, x + sl, y + st); - } - } - - return FALSE; -} - -void wxStandardSnipAdmin::Modified(wxSnip *snip, Bool modified) -{ - media->OnSnipModified(snip, modified); -} - -#ifdef wx_mac - -#ifndef WX_CARBON -# include -#endif - -#ifndef OS_X -long wxMediaCreatorId = 'WXME'; -#endif - -void wxMediaSetFileCreatorType(char *file, Bool is_binary) -{ - FSSpec spec; - FInfo info; - int spec_ok; - -#ifndef OS_X - spec_ok = scheme_mac_path_to_spec(file, &spec); -# else - { - FSRef ref; - Boolean isd = 0; - OSErr err; - - err = FSPathMakeRef((UInt8*)file, &ref, &isd); - if (!err && isd) - spec_ok = 0; - else if (!err) { - err = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, &spec, NULL); - spec_ok = !err; - } else - spec_ok = 0; - } -# endif - - if (spec_ok) { - if (FSpGetFInfo(&spec, &info) == noErr) { -# ifndef OS_X - info.fdCreator = wxMediaCreatorId; -# endif - info.fdType = is_binary ? 'WXME' : 'TEXT'; - FSpSetFInfo(&spec, &info); - } - } -} - -#endif diff --git a/src/mred/wxme/wx_medad.cxx b/src/mred/wxme/wx_medad.cxx deleted file mode 100644 index 44f61f60f4..0000000000 --- a/src/mred/wxme/wx_medad.cxx +++ /dev/null @@ -1,1696 +0,0 @@ -/* - * File: wx_medad.cc - * Purpose: wxMediaCanvas & wxDrawableMediaAdmin implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" - -#include -#include -#include - -#include "wx_canvs.h" -#include "wx_dcmem.h" -#include "wx_media.h" -#include "wx_types.h" -#include "wx_gcrct.h" -#include "wx_ptreq.h" -#include "wx_timer.h" -#include "wx_main.h" - -static wxMemoryDC *wx_canvasless_offscreen; - -#ifdef wx_mac -extern void wxStartRefreshSequence(void); -extern void wxEndRefreshSequence(void); -#else -# define wxStartRefreshSequence() /* empty */ -# define wxEndRefreshSequence() /* empty */ -#endif - -extern void *MrEdGetWindowContext(wxWindow *w); - -class SimpleScroll -{ - Bool horizontal; - - int count, pageStep, value; - - public: - SimpleScroll(wxMediaCanvas *, long style = 0, - int length = 0, int stepsPerPage = 4, - int position = 0); - ~SimpleScroll(); - - void SetValue(int); - int GetValue(void); - void SetScroll(int len = -1, int page = -1, int position = -1); -}; - -class wxUpdateCursorTimer : public wxTimer -{ - wxCanvasMediaAdmin *admin; - public: - wxUpdateCursorTimer(wxCanvasMediaAdmin *a); - void Notify(void); - void Cancel(); -}; - -wxUpdateCursorTimer::wxUpdateCursorTimer(wxCanvasMediaAdmin *a) - : wxTimer(MrEdGetWindowContext(a->canvas)) -{ - admin = a; - Start(0, TRUE); -} - -void wxUpdateCursorTimer::Notify(void) { - Stop(); - if (admin) { - admin->updateCursorTimer = NULL; - admin->canvas->UpdateCursorNow(); - } -} - -void wxUpdateCursorTimer::Cancel() { - admin = NULL; -} - -#define BLINK_DELAY 500 - -class wxBlinkTimer : public wxTimer -{ - wxMediaCanvas *canvas; - public: - wxBlinkTimer(wxMediaCanvas *c); - void Notify(void); - void Kill(); -}; - -wxBlinkTimer::wxBlinkTimer(wxMediaCanvas *c) { - canvas = c; - SetContext(MrEdGetWindowContext(c)); -} - -void wxBlinkTimer::Notify(void) { - /* Used to try to avoid starving other events, but yielding - has its own problems. In particular, it messes up dialogs - that expect show #f to immediately lead to a return from - show #t. */ - // wxYield(); - - if (canvas) - canvas->BlinkCaret(); -} - -void wxBlinkTimer::Kill() { - canvas = NULL; - Stop(); -} - -#define AUTO_DRAG_DELAY 100 - -class wxAutoDragTimer : public wxTimer -{ - wxMediaCanvas *canvas; - wxMouseEvent *event; - public: - wxAutoDragTimer(wxMediaCanvas *c, wxMouseEvent *e); - void Notify(void); - void Kill(void); -}; - -wxAutoDragTimer::wxAutoDragTimer(wxMediaCanvas *c, wxMouseEvent *e) { - canvas = c; - SetContext(MrEdGetWindowContext(c)); - event = new WXGC_PTRS wxMouseEvent(0); - memcpy(event, e, sizeof(wxMouseEvent)); - Start(AUTO_DRAG_DELAY, TRUE); -} - -void wxAutoDragTimer::Notify(void) { - /* See note above about wxYield */ - // wxYield(); /* In case we get too much time */ - - if (canvas) { - event->timeStamp += AUTO_DRAG_DELAY; - canvas->OnEvent(event); - } -} - -void wxAutoDragTimer::Kill(void) { - canvas = NULL; - Stop(); -} - -/************************************************************************/ - -static int default_wheel_amt; - -#ifndef wxOVERRIDE_KEY_TRANSLATIONS -#define wxOVERRIDE_KEY_TRANSLATIONS 0 -#endif - -#define INIT_SB ((style & (wxMCANVAS_NO_H_SCROLL | wxMCANVAS_HIDE_H_SCROLL)) ? 0 : wxHSCROLL) \ - + ((style & (wxMCANVAS_NO_V_SCROLL | wxMCANVAS_HIDE_V_SCROLL)) ? 0 : wxVSCROLL) - -#ifdef wx_x -# define wxmeBORDER wxBORDER -# define wxCONTROL_BORDER 0 -#else -# define wxmeBORDER wxBORDER -#endif -#ifndef wx_mac -# define wxRESIZE_CORNER 0 -#endif - -wxMediaCanvas::wxMediaCanvas(wxWindow *parent, - int x, int y, - int width, int height, - char *name, - long style, - int scrollsPP, - wxMediaBuffer *m, - wxGLConfig *gl_cfg) -: wxCanvas(parent, x, y, width, height, - (((style & wxBORDER) ? wxmeBORDER : 0) - + wxOVERRIDE_KEY_TRANSLATIONS - + INIT_SB - + (style & wxINVISIBLE ? wxINVISIBLE : 0) - + (style & wxTRANSPARENT_WIN ? wxTRANSPARENT_WIN : wxNO_AUTOCLEAR) - + (style & wxCONTROL_BORDER ? wxCONTROL_BORDER : 0) - + (style & wxCOMBO_SIDE ? wxCOMBO_SIDE : 0) - + (style & wxRESIZE_CORNER ? wxRESIZE_CORNER : 0)), - name, gl_cfg) -{ - static int type_added = FALSE; - -#if USE_OLD_TYPE_SYSTEM - if (!type_added) { - wxAllTypes->AddType(wxTYPE_MEDIA_CANVAS, wxTYPE_CANVAS, "media-canvas"); - type_added = TRUE; - } - - __type = wxTYPE_MEDIA_CANVAS; -#endif - - givenHScrollsPerPage = scrollsPP; - - xmargin = 5; - ymargin = 5; - - allowXScroll = !(style & wxMCANVAS_NO_H_SCROLL); - allowYScroll = !(style & wxMCANVAS_NO_V_SCROLL); - fakeXScroll = !allowXScroll || (style & wxMCANVAS_HIDE_H_SCROLL); - fakeYScroll = !allowYScroll || (style & wxMCANVAS_HIDE_V_SCROLL); - - auto_x = (!fakeXScroll && ((style & wxMCANVAS_AUTO_H_SCROLL) ? 1 : 0)); - auto_y = (!fakeYScroll && ((style & wxMCANVAS_AUTO_V_SCROLL) ? 1 : 0)); - xscroll_on = (!fakeXScroll && !auto_x); - yscroll_on = (!fakeYScroll && !auto_y); - EnableScrolling(xscroll_on, yscroll_on); - noloop = TRUE; - wxCanvas::SetScrollbars(fakeXScroll ? -1 : 1, fakeYScroll ? -1 : 1, -#ifdef wx_msw - fakeXScroll ? -1 : 1, fakeYScroll ? -1 : 1, -#else - 1, 1, -#endif - 1, 1, 0, 0, FALSE); - -#ifdef wx_mac - /* Fixes update, somehow. There's a similar call in - the constructor for wxCanvas, but somehow we need - another one after SetScrollbars: */ - OnClientAreaDSize(1, 1, 1, 1); -#endif - - if (fakeXScroll) { - SimpleScroll *ss; - ss = new WXGC_PTRS SimpleScroll(this, wxHORIZONTAL, 0, 1, 0) ; - hscroll = ss; - } else - hscroll = (SimpleScroll *)NULL; - if (fakeYScroll) { - SimpleScroll *ss; - ss = new WXGC_PTRS SimpleScroll(this, wxVERTICAL, 0, 1, 0); - vscroll = ss; - } else - vscroll = (SimpleScroll *)NULL; - scrollWidth = fakeXScroll ? 0 : 1; - scrollHeight = fakeYScroll ? 0 : 1; - - vscrollsPerPage = hscrollsPerPage = 1; - hpixelsPerScroll = 0; - - noloop = FALSE; - - { - wxCanvasMediaAdmin *cma; - cma = new WXGC_PTRS wxCanvasMediaAdmin(this); - admin = cma; - } - admin->standard = 1; - - customCursor = NULL; - customCursorOn = FALSE; - - focuson = FALSE; - focusforcedon = FALSE; - - scrollToLast = FALSE; - scrollBottomBased = FALSE; - scrollOffset = 0; - - lastwidth = lastheight = -1; - - lazy_refresh = need_refresh = FALSE; - - autoDragger = NULL; - - if (!default_wheel_amt) { - wxGetPreference("wheelStep", &default_wheel_amt); - if (!default_wheel_amt) - default_wheel_amt = 3; - if (default_wheel_amt > 1000) - default_wheel_amt = 1000; - } - wheel_amt = default_wheel_amt; - - if (m) - SetMedia(m); - -#ifndef wx_mac - { - wxDC *adc; - adc = GetDC(); - adc->SetOptimization(TRUE); - } -#endif -} - -wxMediaCanvas::~wxMediaCanvas() -{ - if (autoDragger) { - autoDragger->Kill(); - autoDragger = NULL; - } - - if (blinkTimer) { - ((wxBlinkTimer *)blinkTimer)->Kill(); - blinkTimer = NULL; - } - - /* If we're managing an editor, we would like to disconnect from the - editor --- but we don't want to execute any Scheme code to - perform disconnection notices. (After all, this destruction could - be a finalization callback.) So we don't disconnect, and - fortunately, we have a layer oif indirection through the - administrator -- we set the "dead" flag. Later actions directly - on the canvas (possible because the Scheme code keeps a list of - canvas) will trigger "invalidated object" errors. */ -#if 0 - if (media) { - if (admin->nextadmin || admin->prevadmin) - SetMedia(NULL); - else - DELETE_OBJ media; - } - DELETE_OBJ admin; -#else - admin->canvas = NULL; -#endif -} - -void wxMediaCanvas::OnSize(int w, int h) -{ -#ifndef wx_msw - wxCanvas::OnSize(w, h); -#endif - - if (noloop) - return; - - if (w == lastwidth - && h == lastheight) - return; - - if (media && media->printing) - return; - - ResetSize(); -} - -void wxMediaCanvas::ResetSize() -{ - ResetVisual(FALSE); - -#if defined(wx_mac) - if (0) { - wxDC *adc; - wxColor *bg; - bg = GetCanvasBackground(); - if (bg) { - adc = GetDC(); - adc->SetBackground(bg); - adc->Clear(); - } - } -#endif - - Refresh(); -} - -void wxMediaCanvas::SetXMargin(int x) -{ - if (x != xmargin) { - xmargin = x; - ResetSize(); - } -} - -void wxMediaCanvas::SetYMargin(int y) -{ - if (y != ymargin) { - ymargin = y; - ResetSize(); - } -} - -int wxMediaCanvas::GetXMargin() -{ - return xmargin; -} - -int wxMediaCanvas::GetYMargin() -{ - return ymargin; -} - -void wxMediaCanvas::SetCanvasBackground(wxColour *c) -{ - wxCanvas::SetCanvasBackground(c); - - Refresh(); -} - -void wxMediaCanvas::OnFocus(Bool focus) -{ - if (focuson == focus) - return; - - focuson = focus; - if (media && !media->printing) { - wxCanvasMediaAdmin *oldadmin; - - if (PTRNE((oldadmin = (wxCanvasMediaAdmin *)media->GetAdmin()), admin)) { - media->SetAdmin(admin); - } - - if (media) - media->OwnCaret(focus); - - if (PTRNE(oldadmin, admin)) { - if (media) - media->SetAdmin(oldadmin); - } - } - - if (focuson) { - if (!blinkTimer) { - wxBlinkTimer *bt; - bt = new WXGC_PTRS wxBlinkTimer(this); - blinkTimer = bt; - } - blinkTimer->Start(BLINK_DELAY, 1); - } -} - -void wxMediaCanvas::BlinkCaret() -{ - if (focuson) { - if (media) { - wxCanvasMediaAdmin *oldadmin; - - if (PTRNE((oldadmin = (wxCanvasMediaAdmin *)media->GetAdmin()), admin)) { - media->SetAdmin(admin); - } - - if (media) - media->BlinkCaret(); - - if (PTRNE(oldadmin, admin)) { - if (media) - media->SetAdmin(oldadmin); - } - } - - blinkTimer->Start(BLINK_DELAY, 1); - } -} - -void *wxMediaCanvas::CallAsPrimaryOwner(void *(*f)(void *), void *data) -{ - void *r; - - if (media) { - wxCanvasMediaAdmin *oldadmin; - - if (PTRNE((oldadmin = (wxCanvasMediaAdmin *)media->GetAdmin()), admin)) { - media->SetAdmin(admin); - } - - r = f(data); - - if (PTRNE(oldadmin, admin)) { - if (media) - media->SetAdmin(oldadmin); - } - } else - r = f(data); - - return r; -} - -#if defined(wx_msw) || defined(wx_mac) -extern struct MrEdContext *MrEdGetContext(wxObject *w); -extern void MrEdQueueInEventspace(void *context, Scheme_Object *thunk); -#endif - -#ifdef wx_msw - -static Scheme_Object *on_set_focus_cb(Scheme_Object *b_cnvs, int, Scheme_Object **) -{ - wxMediaCanvas *c; - int on; - on = SCHEME_TRUEP(SCHEME_CAR(b_cnvs)); - c = (wxMediaCanvas *)SCHEME_CDR(b_cnvs); - c->OnFocus(on); - return scheme_void; -} - -static void QueueOnFocusCallback(wxMediaCanvas *canvas, int on) -{ - Scheme_Object *thunk, *b_cnvs; - wxWindow *tl; - void *context; - - b_cnvs = scheme_make_pair((on ? scheme_true : scheme_false), - (Scheme_Object *)canvas); - - thunk = scheme_make_closed_prim((Scheme_Closed_Prim *)on_set_focus_cb, b_cnvs); - - tl = canvas->GetTopLevel(); - context = MrEdGetContext(tl); - - MrEdQueueInEventspace(context, thunk); -} -#endif - -void wxMediaCanvas::OnSetFocus() -{ -#ifdef wx_msw - // Need trampoline - QueueOnFocusCallback(this, TRUE); -#else - wxCanvas::OnSetFocus(); - OnFocus(TRUE); -#endif -} - -void wxMediaCanvas::OnKillFocus() -{ -#ifdef wx_msw - // Need trampoline - QueueOnFocusCallback(this, FALSE); -#else - wxCanvas::OnKillFocus(); - OnFocus(FALSE); -#endif -} - -Bool wxMediaCanvas::IsFocusOn() -{ - return focuson; -} - -void wxMediaCanvas::ForceDisplayFocus(Bool on) -{ - int old = focusforcedon; - - focusforcedon = on; - - admin->AdjustStdFlag(); - - if ((focuson || focusforcedon) != ((focuson || old))) - Repaint(); -} - -void wxMediaCanvas::OnEvent(wxMouseEvent *event) -{ - /* Turn of auto-dragger if there is one. */ - if (autoDragger) { - autoDragger->Kill(); - autoDragger = NULL; - } - - last_x = event->x; - last_y = event->y; - -#ifdef wx_msw - if (!focuson && event->ButtonDown()) { - SetFocus(); - OnFocus(TRUE); - } -#endif - - if (media && !media->printing) { - wxCanvasMediaAdmin *oldadmin; - - if (PTRNE((oldadmin = (wxCanvasMediaAdmin *)media->GetAdmin()), admin)) { - media->SetAdmin(admin); - } - - if (media) { - wxCursor *c; - c = media->AdjustCursor(event); - SetCustomCursor(c); - } - if (media) - media->OnEvent(event); - - if (PTRNE(oldadmin, admin)) { - if (media) - media->SetAdmin(oldadmin); - } - - if (event->Dragging()) { - int ch, cw; - GetClientSize(&cw, &ch); - if (event->x < 0 || event->y < 0 || event->x > cw || event->y > ch) { - /* Dragging outside the canvas: auto-generate more events because the buffer - is probably scrolling. But make sure we're shown. */ - wxWindow *w = this; - while (w && w->IsShown()) { - if (wxSubType(w->__type, wxTYPE_FRAME) - || wxSubType(w->__type, wxTYPE_DIALOG_BOX)) - w = NULL; - else - w = w->GetParent(); - } - if (!w) { - autoDragger = new WXGC_PTRS wxAutoDragTimer(this, event); - } - } - } - } -} - -void wxMediaCanvas::UpdateCursorNow(void) -{ - wxMouseEvent *event; - wxCanvasMediaAdmin *oldadmin; - - if (!media) - return; - - event = new WXGC_PTRS wxMouseEvent(wxEVENT_TYPE_MOTION); - - event->x = last_x; - event->y = last_y; - event->timeStamp = 0L; - - if (PTRNE((oldadmin = (wxCanvasMediaAdmin *)media->GetAdmin()), admin)) - media->SetAdmin(admin); - - if (media) { - wxCursor *c; - c = media->AdjustCursor(event); - SetCustomCursor(c); - } - - if (PTRNE(oldadmin, admin)) { - if (media) - media->SetAdmin(oldadmin); - } -} - -wxMenu *wxMediaCanvas::PopupForMedia(wxMediaBuffer *WXUNUSED(b), void *WXUNUSED(m)) -{ - return NULL; -} - -void wxMediaCanvas::OnChar(wxKeyEvent *event) -{ - if (wheel_amt > 0) { - /* Handle wheel here */ - switch (event->KeyCode()) { - case WXK_WHEEL_UP: - case WXK_WHEEL_DOWN: - if (allowYScroll && !fakeYScroll) { - int x, y; - - GetScroll(&x, &y); - y += (wheel_amt * ((event->KeyCode() == WXK_WHEEL_UP) ? -1 : 1)); - if (y < 0) y = 0; - Scroll(x, y, 1); - } - return; - } - } - - if (media && !media->printing) { - wxCanvasMediaAdmin *oldadmin; - - if (PTRNE((oldadmin = (wxCanvasMediaAdmin *)media->GetAdmin()), admin)) { - media->SetAdmin(admin); - } - - if (media) - media->OnChar(event); - - if (PTRNE(oldadmin, admin)) { - if (media) - media->SetAdmin(oldadmin); - } - } -} - -void wxMediaCanvas::ClearMargins(void) -{ - /* This method is called by `on-paint' in `wx:canvas%' - before it calls the `on-paint' in `canvas%'. It's - essentially a compromise between autoclear mode and - no-autoclear mode. */ - - if (xmargin || ymargin) { - wxDC *adc; - wxColor *bg; - bg = GetCanvasBackground(); - if (bg) { - wxBrush *b, *ob; - wxPen *p, *op; - int cw, ch; - - GetClientSize(&cw, &ch); - - b = wxTheBrushList->FindOrCreateBrush(bg, wxSOLID); - p = wxThePenList->FindOrCreatePen("BLACK", 0, wxTRANSPARENT); - adc = GetDC(); - - ob = adc->GetBrush(); - op = adc->GetPen(); - adc->SetBrush(b); - adc->SetPen(p); - - adc->DrawRectangle(0, 0, xmargin, ch); - adc->DrawRectangle(cw-xmargin, 0, cw, ch); - adc->DrawRectangle(0, 0, cw, ymargin); - adc->DrawRectangle(0, ch-ymargin, cw, ch); - - adc->SetBrush(ob); - adc->SetPen(op); - } - } -} - -void wxMediaCanvas::OnPaint(void) -{ - need_refresh = FALSE; - - if (media) { - if (!media->printing) { - double w, h, x, y; - GetView(&x, &y, &w, &h); - Redraw(x, y, w, h); - } - } else { - wxDC *adc; - wxColor *bg; - bg = GetCanvasBackground(); - if (bg) { - adc = GetDC(); - adc->SetBackground(bg); - adc->Clear(); - } - } - - wxCanvas::OnPaint(); -} - -void wxMediaCanvas::Repaint(void) -{ - if (need_refresh) - return; - - if (lazy_refresh || !GetCanvasBackground()) { - need_refresh = TRUE; - Refresh(); - } else - OnPaint(); -} - -void wxMediaCanvas::PaintScrolls(void) -{ -} - -void wxMediaCanvas::SetLazyRefresh(Bool on) -{ - lazy_refresh = on; - if (!on && need_refresh) - OnPaint(); -} - -Bool wxMediaCanvas::GetLazyRefresh(void) -{ - return lazy_refresh; -} - -void wxMediaCanvas::SetCustomCursor(wxCursor *cursor) -{ - if (!cursor) { - NoCustomCursor(); - } else { - customCursorOn = TRUE; - customCursor = cursor; - SetCursor(customCursor); - } -} - -void wxMediaCanvas::NoCustomCursor(void) -{ - static wxCursor *arrow = NULL; - - if (!arrow) { - wxREGGLOB(arrow); - arrow = new WXGC_PTRS wxCursor(wxCURSOR_ARROW); - } - - if (customCursorOn) { - customCursorOn = FALSE; - SetCursor(arrow); - } -} - -wxDC *wxMediaCanvas::GetDCAndOffset(double *fx, double *fy) -{ - int x, y; - - if (fx || fy) { - GetScroll(&x, &y); - if (fx) - *fx = x * hpixelsPerScroll - xmargin; - if (fy) { - if (media && (y || scrollBottomBased)) { - int h, w; - GetClientSize(&w, &h); - h -= 2 * ymargin; - if (h < 0) - h = 0; - { - double v; - v = media->ScrollLineLocation(y + scrollOffset) - ymargin; - *fy = v; - } - if (scrollBottomBased && (scrollHeight || scrollToLast)) - (*fy) -= h; - } else - *fy = -ymargin; - } - } - - return GetDC(); -} - -void wxMediaCanvas::GetView(double *fx, double *fy, double *fw, double *fh, - Bool WXUNUSED(full)) -{ - int h, w; - - GetClientSize(&w, &h); - GetDCAndOffset(fx, fy); - if (1 /* !full */) { - if (fx) - *fx += xmargin; - if (fy) - *fy += ymargin; - } - if (0 /* full */) { - if (fh) - *fh = h; - if (fw) - *fw = w; - } else { - if (fh) { - if (h > 2 * ymargin) - *fh = h - 2 * ymargin; - else - *fh = 0; - } - if (fw) { - if (w > 2 * xmargin) - *fw = w - 2 * xmargin; - else - *fw = 0; - } - } -} - -void wxMediaCanvas::Redraw(double localx, double localy, double fw, double fh) -{ - double x, y, w, h, right, bottom; - - if (!media || media->printing) - return; - - wxStartRefreshSequence(); - - GetView(&x, &y, &w, &h); - - right = x + w; - bottom = y + h; - - if (localx > x) - x = localx; - if (localy > y) - y = localy; - - if (right > localx + fw) - right = localx + fw; - if (bottom > localy + fh) - bottom = localy + fh; - w = right - x; - h = bottom - y; - - if (w < 0) - w = 0; - if (h < 0) - h = 0; - - if (w && h) { - wxCanvasMediaAdmin *oldadmin; - - if (PTRNE((oldadmin = (wxCanvasMediaAdmin *)media->GetAdmin()), admin)) { - media->SetAdmin(admin); - } - - if (media) - media->Refresh(x, y, w, h, - (focuson || focusforcedon) - ? wxSNIP_DRAW_SHOW_CARET - : wxSNIP_DRAW_SHOW_INACTIVE_CARET, - GetCanvasBackground()); - - if (PTRNE(oldadmin, admin)) { - if (media) - media->SetAdmin(oldadmin); - } - } - - wxEndRefreshSequence(); -} - -Bool wxMediaCanvas::ScrollTo(double localx, double localy, double fw, double fh, - Bool refresh, int bias) -{ - int cy, cx, sy, sx; - double iw, ih; - double x, y; - double find_dy; - wxMediaBuffer *med = media; - - if (!med || med->printing || (!allowXScroll && !allowYScroll)) - return FALSE; - - GetView(&x, &y, &iw, &ih); - - if (!iw || !ih) - return FALSE; - - if (scrollBottomBased) - find_dy = ih; - else - find_dy = 0; - - GetScroll(&cx, &cy); - - if (allowYScroll) { - if (// doesn't fit and bias is set: - (bias == -1 && fh > ih) - // fits, need to shift down into view: - || (fh <= ih && localy < y) - // doesn't fit, no conflicting bias, can shift up to see more: - || (fh > ih && bias != 1 && localy < y)) - sy = med->FindScrollLine(find_dy + localy) - scrollOffset; - else if (// doesn't fit, bias is set: - (bias == 1 && fh > ih) - // fits, need to shift up into view: - || (fh <= ih && y + ih < localy + fh)) { - double l = find_dy + localy + fh - ih; - // Find scroll pos for top of region to show: - sy = med->FindScrollLine(l); - // Unless l is exactly the top of a line, move down to the next whole line: - if (med->ScrollLineLocation(sy) != l) - sy++; - sy -= scrollOffset; - } else if (// doesn't fit, no conflicting bias, maybe shift down to see more: - (fh > ih && bias != -1 && localy + fh > y + ih)) { - // Shift to one more than the first scroll position that shows last line - long my; - my = med->FindScrollLine(find_dy + localy + fh - ih) + 1 - scrollOffset; - // But only shift down the extra line if doing so doesn't skip the whole area - if (med->ScrollLineLocation(my) < find_dy + localy + fh) - sy = my; - else if (my > 0) - sy = my - 1; - else - sy = 0; - } else - sy = cy; - } else - sy = cy; - - if (allowXScroll) { - if (hpixelsPerScroll) { - if ((bias == -1 && fw > iw) - || (fw < iw && localx < x) - || (fw > iw && bias != 1 && localx < x)) - sx = (int)(localx / hpixelsPerScroll); - else if ((bias == 1 && fw > iw) - || (fw < iw && x + iw < localx + fw) - || (fw > iw && bias != -1 && localx + fw > x + iw)) - sx = (int)((localx + fw - iw) / hpixelsPerScroll) + 1; - else - sx = cx; - } else - sx = 0; - } else - sx = cx; - - if (sy != cy || sx != cx) { - if (hscroll) - hscroll->SetValue(sx); - if (vscroll) - vscroll->SetValue(sy); - Scroll(sx, sy, refresh); - return TRUE; - } else - return FALSE; -} - -Bool wxMediaCanvas::ResetVisual(Bool reset_scroll) -{ - int x, y, sx, sy, lw, lh; - double w, h; - int hnumScrolls, vnumScrolls, hspp, vspp; - long tw; - double totalHeight, totalWidth; - Bool retval = FALSE; - - if (givenHScrollsPerPage < 0) { - givenHScrollsPerPage = -2; - return FALSE; - } - - while (1) { - GetScroll(&sx, &sy); - - GetSize(&lw, &lh); - lastwidth = lw; - lastheight = lh; - - if (media && (allowXScroll || allowYScroll)) { - wxMediaBuffer *med = media; - - if (reset_scroll) - x = y = 0; - else { - x = sx; - y = sy; - } - - w = h = 0.0; - GetView(NULL, NULL, &w, &h); - totalWidth = totalHeight = 0.0; - med->GetExtent(&totalWidth, &totalHeight); - - if (!h || (!scrollToLast && (h >= totalHeight))) { - vnumScrolls = 0; - scrollOffset = 0; - } else { - if (scrollBottomBased) { - vnumScrolls = med->NumScrollLines() - 1; - scrollOffset = 1; - if (!scrollToLast) { - long start; - start = med->FindScrollLine(h + 1) - 1; - scrollOffset += start; - vnumScrolls -= start; - } - } else { - long top = (long)(totalHeight - (scrollToLast ? 0 : h)); - if (top) - --top; - vnumScrolls = med->FindScrollLine(top) + 1; - if (vnumScrolls >= med->NumScrollLines()) - vnumScrolls = med->NumScrollLines() - 1; - scrollOffset = 0; - } - } - - if (vnumScrolls > 0) { - int numLines; - numLines = med->NumScrollLines() - 1; - vspp = (long)(((double)h * numLines) / totalHeight) - 1; - if (vspp < 1) - vspp = 1; - } else { - vnumScrolls = 0; - vspp = 1; - } - - if (totalWidth >= w) { - tw = (long)(totalWidth - w); - - hpixelsPerScroll = (long)(w / givenHScrollsPerPage); - if (!hpixelsPerScroll) - hpixelsPerScroll = 2; - - if (tw % hpixelsPerScroll) - tw += (hpixelsPerScroll - (tw % hpixelsPerScroll)); - - hnumScrolls = tw / hpixelsPerScroll; - hspp = givenHScrollsPerPage; - } else { - hnumScrolls = 0; - hspp = 1; - } - } else { - x = y = 0; - hnumScrolls = vnumScrolls = 0; - vspp = hspp = 1; - if (!media) { - wxDC *adc; - wxColor *bg; - bg = GetCanvasBackground(); - if (bg) { - adc = GetDC(); - adc->SetBackground(bg); - adc->Clear(); - } - } - } - - if (scrollWidth != hnumScrolls || scrollHeight != vnumScrolls - || vspp != vscrollsPerPage - || hspp != hscrollsPerPage - || x != sx || y != sy) { - Bool goAgain = FALSE; - int savenoloop; - int saveHSPP; - int xon, yon; - - if (hscroll) - hscroll->SetScroll(hnumScrolls, hspp, x); - if (vscroll) - vscroll->SetScroll(vnumScrolls, vspp, y); - - savenoloop = noloop; - saveHSPP = givenHScrollsPerPage; - - noloop = TRUE; - givenHScrollsPerPage = -1; - - xon = !fakeXScroll && hnumScrolls; - yon = !fakeYScroll && vnumScrolls; - if ((auto_x && (xon != xscroll_on)) || (auto_y && (yon != yscroll_on))) { - if (auto_x) - xscroll_on = xon; - if (auto_y) - yscroll_on = yon; - EnableScrolling(xscroll_on, yscroll_on); - OnScrollOnChange(); - goAgain = TRUE; - } - - if (!fakeXScroll) { - if (x > hnumScrolls) - x = hnumScrolls; - if (hspp < hscrollsPerPage) - SetScrollPage(wxHORIZONTAL, hspp); - if (x < sx) - SetScrollPos(wxHORIZONTAL, x); - if (scrollWidth != hnumScrolls) - SetScrollRange(wxHORIZONTAL, hnumScrolls); - if (x > sx) - SetScrollPos(wxHORIZONTAL, x); - if (hspp > hscrollsPerPage) - SetScrollPage(wxHORIZONTAL, hspp); - } - - if (!fakeYScroll) { - if (y > vnumScrolls) - y = vnumScrolls; - if (vspp < vscrollsPerPage) - SetScrollPage(wxVERTICAL, vspp); - if (y < sy) - SetScrollPos(wxVERTICAL, y); - if (scrollHeight != vnumScrolls) - SetScrollRange(wxVERTICAL, vnumScrolls); - if (y > sy) - SetScrollPos(wxVERTICAL, y); - if (vspp > vscrollsPerPage) - SetScrollPage(wxVERTICAL, vspp); - } - - if (givenHScrollsPerPage < -1) - goAgain = TRUE; - givenHScrollsPerPage = saveHSPP; - - noloop = savenoloop; - hscrollsPerPage = hspp; - vscrollsPerPage = vspp; - scrollWidth = hnumScrolls; - scrollHeight = vnumScrolls; - - if (!goAgain) - return TRUE; - else - retval = TRUE; - } else - return retval; - } -} - -void wxMediaCanvas::Scroll(int x, int y, Bool refresh) -{ - int savenoloop = noloop; - noloop = TRUE; - - if (x > -1 && !fakeXScroll) { - if (scrollWidth) { - if (x > scrollWidth) - x = scrollWidth; - SetScrollPos(wxHORIZONTAL, x); - } - } - - if (y > -1 && !fakeYScroll) { - if (scrollHeight) { - if (y > scrollHeight) - y = scrollHeight; - SetScrollPos(wxVERTICAL, y); - } - } - - noloop = savenoloop; - - if (refresh) - Repaint(); -} - -void wxMediaCanvas::Scroll(int, int) -{ - /* Nothing */ -} - -void wxMediaCanvas::SetScrollbars(int, int, int, int, - int, int, int, int, - Bool) -{ - /* Nothing */ -} - -void wxMediaCanvas::GetScroll(int *x, int *y) -{ - int v; - - /* Get fake scroll values if available */ - if (hscroll) { - v = hscroll->GetValue(); - *x = v; - } - if (vscroll) { - v = vscroll->GetValue(); - *y = v; - } - - if (!hscroll) { - int v; - v = GetScrollPos(wxHORIZONTAL); - *x = v; - } - if (!vscroll) { - int v; - v = GetScrollPos(wxVERTICAL); - *y = v; - } -} - -#if defined(wx_msw) || defined(wx_mac) -static Scheme_Object *repaint_cb(Scheme_Object *_cnvs, int, Scheme_Object **) -{ - wxMediaCanvas *c; - c = (wxMediaCanvas *)_cnvs; - c->Repaint(); - return scheme_void; -} -#endif - -void wxMediaCanvas::OnScroll(wxScrollEvent *) -{ - if (noloop) - return; - -#if defined(wx_msw) || defined(wx_mac) - // Need trampoline - { - Scheme_Object *thunk; - wxWindow *tl; - void *context; - - thunk = scheme_make_closed_prim((Scheme_Closed_Prim *)repaint_cb, (Scheme_Object *)this); - -# ifdef wx_msw - tl = GetTopLevel(); -# else - tl = GetRootFrame(); -# endif - context = MrEdGetContext(tl); - - MrEdQueueInEventspace(context, thunk); - } -#else - Repaint(); -#endif -} - -void wxMediaCanvas::OnScrollOnChange() -{ -} - -wxMediaBuffer *wxMediaCanvas::GetMedia(void) -{ - return media; -} - -void wxMediaCanvas::SetMedia(wxMediaBuffer *m, Bool update) -{ - if (media == m) - return; - - if (media) { - if (PTREQ((wxCanvasMediaAdmin *)media->GetAdmin(), admin)) { - if (admin->nextadmin) - media->SetAdmin(admin->nextadmin); - else if (admin->prevadmin) - media->SetAdmin(admin->prevadmin); - else - media->SetAdmin(NULL); - } - - if (admin->nextadmin) { - admin->nextadmin->prevadmin = admin->prevadmin; - admin->nextadmin->AdjustStdFlag(); - admin->nextadmin = NULL; - } - if (admin->prevadmin) { - admin->prevadmin->nextadmin = admin->nextadmin; - admin->prevadmin->AdjustStdFlag(); - admin->prevadmin = NULL; - } - if (customCursor) { - NoCustomCursor(); - customCursor = NULL; - } - } - media = m; - if (media) { - wxMediaAdmin *oldadmin; - if ((oldadmin = media->GetAdmin())) { - if (!oldadmin->standard) { - media = NULL; - return; - } - admin->nextadmin = (wxCanvasMediaAdmin *)oldadmin; - admin->prevadmin = admin->nextadmin->prevadmin; - admin->nextadmin->prevadmin = admin; - admin->nextadmin->AdjustStdFlag(); - if (admin->prevadmin) { - admin->prevadmin->nextadmin = admin; - admin->prevadmin->AdjustStdFlag(); - } - /* Get the right cursor: */ - admin->UpdateCursor(); - } else { - admin->nextadmin = admin->prevadmin = NULL; - media->SetAdmin(admin); - media->OwnCaret(focuson); - } - } - - admin->AdjustStdFlag(); - - ResetVisual(TRUE); - if (update) - Repaint(); -} - -void wxMediaCanvas::AllowScrollToLast(Bool toLast) -{ - scrollToLast = toLast; - ResetVisual(FALSE); - Repaint(); -} - -void wxMediaCanvas::ScrollWithBottomBase(Bool bottom) -{ - scrollBottomBased = bottom; - ResetVisual(FALSE); - Repaint(); -} - -/************************************************************************/ - -wxCanvasMediaAdmin::wxCanvasMediaAdmin(wxMediaCanvas *c) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_CANVAS_MEDIA_ADMIN; -#endif - - canvas = c; - resetFlag = FALSE; - nextadmin = prevadmin = NULL; - WXGC_IGNORE(this, canvas); - - updateCursorTimer = NULL; - - updateBlock = resizedBlock = FALSE; -} - -wxCanvasMediaAdmin::~wxCanvasMediaAdmin() -{ - if (updateCursorTimer) - updateCursorTimer->Cancel(); - canvas = NULL; -} - -wxDC *wxCanvasMediaAdmin::GetDC(double *fx, double *fy) -{ - if (!canvas) { - if (!wx_canvasless_offscreen) { - wxREGGLOB(wx_canvasless_offscreen); - wx_canvasless_offscreen = new WXGC_PTRS wxMemoryDC(); - } - if (fx) - *fx = 0; - if (fy) - *fy = 0; - return wx_canvasless_offscreen; - } else if (canvas->media && canvas->media->printing) { - if (fx) - *fx = 0; - if (fy) - *fy = 0; - return canvas->media->printing; - } else - return canvas->GetDCAndOffset(fx, fy); -} - -void wxCanvasMediaAdmin::GetView(double *fx, double *fy, double *fh, double *fw, - Bool full) -{ - if (!canvas) { - if (fx) - *fx = 0; - if (fy) - *fy = 0; - if (fh) - *fh = 1; - if (fw) - *fw = 1; - } else if (canvas->media && canvas->media->printing) { - if (fx) - *fx = 0; - if (fy) - *fy = 0; - if (fh) - *fh = 10000; - if (fw) - *fw = 10000; - } else - canvas->GetView(fx, fy, fh, fw, full); -} - -void wxCanvasMediaAdmin::GetMaxView(double *fx, double *fy, double *fw, double *fh, - Bool full) -{ - if ((!nextadmin && !prevadmin) || !canvas || (canvas->media && canvas->media->printing)) { - GetView(fx, fy, fw, fh, full); - } else { - wxCanvasMediaAdmin *a; - double cx, x, cy, y, cw, w, ch, h, cr, r, cb, b; - - a = this; - while (a->prevadmin) { - a = a->prevadmin; - } - a->GetView(&cx, &cy, &cw, &ch); - cr = cx + cw; - cb = cy + ch; - for (a = a->nextadmin; a; a = a->nextadmin) { - a->GetView(&x, &y, &w, &h); - r = x + w; - b = y + h; - - if (x < cx) - cx = x; - if (y < cy) - cy = y; - if (r > cr) - cr = r; - if (b > cb) - cb = b; - } - - cw = cr - cx; - ch = cb - cy; - - if (fx) - *fx = cx; - if (fy) - *fy = cy; - if (fw) - *fw = cw; - if (fh) - *fh = ch; - } -} - -Bool wxCanvasMediaAdmin::ScrollTo(double localx, double localy, - double w, double h, Bool refresh, int bias) -{ - if (!canvas) - return FALSE; - - if (!canvas->IsFocusOn()) { - wxCanvasMediaAdmin *a; - - for (a = nextadmin; a; a = a->nextadmin) { - if (a->canvas->IsFocusOn()) - return a->ScrollTo(localx, localy, w, h, refresh, bias); - } - for (a = prevadmin; a; a = a->prevadmin) { - if (a->canvas->IsFocusOn()) - return a->ScrollTo(localx, localy, w, h, refresh, bias); - } - } - - return canvas->ScrollTo(localx, localy, w, h, refresh, bias); -} - -void wxCanvasMediaAdmin::GrabCaret(int dist) -{ - if (canvas) { - if (dist == wxFOCUS_GLOBAL) - canvas->SetFocus(); - } -} - -void wxCanvasMediaAdmin::NeedsUpdate(double localx, double localy, - double w, double h) -{ - int is_shown; - wxWindow *win; - - if (updateBlock || !canvas) - return; - - updateBlock = TRUE; - - is_shown = 1; - win = canvas; - while (win) { - if (!win->IsShown()) { - is_shown = 0; - win = NULL; - } else if (wxSubType(win->__type, wxTYPE_FRAME) - || wxSubType(win->__type, wxTYPE_DIALOG_BOX)) - win = NULL; - else - win = win->GetParent(); - } - - if (resetFlag) { - if (is_shown) - canvas->Repaint(); - resetFlag = FALSE; - } else if (is_shown) { - if (!canvas->GetCanvasBackground()) - canvas->Repaint(); - else - canvas->Redraw(localx, localy, w, h); - } - - if (nextadmin) - nextadmin->NeedsUpdate(localx, localy, w, h); - if (prevadmin) - prevadmin->NeedsUpdate(localx, localy, w, h); - - updateBlock = FALSE; -} - -void wxCanvasMediaAdmin::Resized(Bool update) -{ - if (resizedBlock || !canvas) - return; - - resizedBlock = TRUE; - - if (canvas->ResetVisual(FALSE)) - resetFlag = TRUE; - - if (update) { - canvas->Repaint(); - resetFlag = FALSE; - } - if (nextadmin) - nextadmin->Resized(update); - if (prevadmin) - prevadmin->Resized(update); - - resizedBlock = FALSE; -} - -void wxCanvasMediaAdmin::UpdateCursor() -{ - if (!updateCursorTimer && canvas) { - updateCursorTimer = new WXGC_PTRS wxUpdateCursorTimer(this); - - if (nextadmin) - nextadmin->UpdateCursor(); - if (prevadmin) - prevadmin->UpdateCursor(); - } -} - -Bool wxCanvasMediaAdmin::PopupMenu(void *m, double x, double y) -{ - double dx, dy; - wxMenu *menu; - - if (canvas && canvas->media) { - menu = canvas->PopupForMedia(canvas->media, m); - if (menu) { - (void)canvas->GetDCAndOffset(&dx, &dy); - return canvas->PopupMenu(menu, x - dx, y - dy); - } - } - - return FALSE; -} - -void wxCanvasMediaAdmin::AdjustStdFlag(void) -{ - /* 1 indicates that this is the sole, main admin. - This info is used for quick (Xor) caret refreshing - by an editor buffer. */ - - standard = (nextadmin - || prevadmin - || (canvas && canvas->focusforcedon)) - ? -1 : 1; -} - -void wxCanvasMediaAdmin::Modified(Bool modified) -{ - /* nothing to do */ -} - -void wxMediaAdmin::GetMaxView(double *fx, double *fy, double *fh, double *fw, - Bool full) -{ - GetView(fx, fy, fh, fw, full); -} - -Bool wxMediaAdmin::DelayRefresh() -{ - return FALSE; -} - -/*************************************************************/ - -#define MIN_THUMB_WIDTH 8 - -SimpleScroll::SimpleScroll(wxMediaCanvas *, - long style, - int length, int stepsPerPage, - int position) -{ - count = length; - pageStep = stepsPerPage; - value = position; - - horizontal = !!(style & wxHORIZONTAL); - SetScroll(length, stepsPerPage, position); -} - -SimpleScroll::~SimpleScroll() -{ -} - -void SimpleScroll::SetValue(int position) -{ - if (position < 0) - position = 0; - if (position >= count) - position = count; - - value = position; -} - -void SimpleScroll::SetScroll(int length, int stepsPerPage, int position) -{ - if (length > -1) - count = length; - if (stepsPerPage > 0) - pageStep = stepsPerPage; - if (position > -1) - value = position; - - if (value < 0) - value = 0; - if (value > count) - value = count; -} - -int SimpleScroll::GetValue(void) -{ - return value; -} diff --git a/src/mred/wxme/wx_medad.h b/src/mred/wxme/wx_medad.h deleted file mode 100644 index 6b3aba9263..0000000000 --- a/src/mred/wxme/wx_medad.h +++ /dev/null @@ -1,546 +0,0 @@ - -#ifndef __WX_MEDIA_BUFFER__ -#define __WX_MEDIA_BUFFER__ - -class wxStyleCanvas; -class wxStyleScrollbar; - -const long -wxMCANVAS_NO_H_SCROLL = 0x10, -wxMCANVAS_NO_V_SCROLL = 0x2, -wxMCANVAS_HIDE_H_SCROLL = 0x4, -wxMCANVAS_HIDE_V_SCROLL = 0x8, -wxMCANVAS_AUTO_H_SCROLL = 0x01000000, -wxMCANVAS_AUTO_V_SCROLL = 0x02000000; - -enum { - wxEDIT_BUFFER =1, - wxPASTEBOARD_BUFFER -}; - -#define STD_STYLE "Standard" - -extern int wxmeCheckFormatAndVersion(wxMediaStreamIn *s, wxMediaStreamInBase *b, Bool showErrors); -extern Bool wxDetectWXMEFile(const char *who, Scheme_Object *f, int peek); - -class wxMediaAdmin; -class wxKeymap; -class wxImageSnip; - -#ifdef OLD_WXWINDOWS -#ifndef EACH_BUFFER_OWN_OFFSCREEN -#define EACH_BUFFER_OWN_OFFSCREEN -#endif -#endif - -#ifndef ALLOW_X_STYLE_SELECTION -#ifdef wx_x -#define ALLOW_X_STYLE_SELECTION 1 -#else -#define ALLOW_X_STYLE_SELECTION 0 -#endif -#endif - -class wxMediaBuffer : public wxObject -{ - protected: -#ifdef EACH_BUFFER_OWN_OFFSCREEN - wxBitmap *bitmap; - wxMemoryDC *offscreen; - long bmHeight, bmWidth; - const Bool offscreenInUse = FALSE; -#else - static wxBitmap *bitmap; - static wxMemoryDC *offscreen; - static long bmHeight, bmWidth; - static Bool offscreenInUse; - static wxMediaBuffer *lastUsedOffscreen; -#endif - -#if ALLOW_X_STYLE_SELECTION - virtual Bool OwnXSelection(Bool on, Bool update, Bool force) = 0; - Bool DoOwnXSelection(Bool on, Bool force); - void CopyOutXSelection(void); - - friend class wxMediaXClipboardClient; -#endif - friend class wxStandardSnipAdmin; - - wxMediaAdmin *admin; - - wxKeymap *map; - -#define TF_Flag(var) unsigned var : 1 - - TF_Flag( ownCaret ); - TF_Flag( tempFilename ); /* TRUE if filename is just a temporary name */ - TF_Flag( userLocked ); - TF_Flag( modified ); - TF_Flag( undomode ); - TF_Flag( redomode ); - TF_Flag( interceptmode ); - TF_Flag( loadoverwritesstyles ); - TF_Flag( customCursorOverrides ); - TF_Flag( pasteTextOnly ); - TF_Flag( needOnDisplaySize ); - - int num_parts_modified; - - int noundomode; - - wxSnip *caretSnip; - - wxStyleList *styleList; - void *notifyId; - - char *filename; /* last loaded file, or NULL */ - - int maxUndos; - - wxChangeRecord **changes; - int changes_start, changes_end, changes_size; - wxChangeRecord **redochanges; - int redochanges_start, redochanges_end, redochanges_size; - wxChangeRecord **savedchanges; /* for Emacs-style undo */ - wxList *intercepted; - - wxCursor *customCursor; - - int inactiveCaretThreshold; - - Bool DoWriteHeadersFooters(wxMediaStreamOut *f, Bool headers); - Bool ReadHeadersFooters(wxMediaStreamIn *f, Bool headers); - - Bool ReadSnipsFromFile(wxMediaStreamIn *f, int overstyle); - - virtual Bool ReadInsert(wxSnip *snip) = 0; - - void AddUndo(wxChangeRecord *); - - void CopyRingNext(void); - void BeginCopyBuffer(void); - void EndCopyBuffer(void); - void FreeOldCopies(void); - void InstallCopyBuffer(long time, wxStyleList *sl); - void DoBufferPaste(wxClipboard *cb, long time, Bool local = FALSE); - virtual void InsertPasteSnip(wxSnip *snip, wxBufferData *) = 0; - virtual void InsertPasteString(wxchar *str) = 0; - - void PerformUndos(Bool redos); - void PerformUndoList(wxList *); - void AppendUndo(wxChangeRecord *, Bool redo); - - Bool DoOwnCaret(Bool ownit); - Bool DoSetCaretOwner(wxSnip *, int); - - Bool ReadyOffscreen(double w, double h); - - virtual void SettingAdmin(wxMediaAdmin *); - virtual void InitNewAdmin(void); - - wxStyle *GetDefaultStyle(); - - public: - wxMediaBuffer(); - ~wxMediaBuffer(); - - int bufferType; - wxDC *printing; - - void SetAdmin(wxMediaAdmin *admin); - wxMediaAdmin *GetAdmin(void); - - virtual void OnEvent(wxMouseEvent *event) = 0; - virtual void OnChar(wxKeyEvent *event) = 0; - virtual wxCursor *AdjustCursor(wxMouseEvent *event) = 0; - virtual void Refresh(double localx, double localy, double w, double h, - Bool show_caret, wxColour *bgColor) = 0; - virtual void OwnCaret(Bool ownit) = 0; - virtual void BlinkCaret() = 0; - virtual void SizeCacheInvalid(void) = 0; - virtual void GetExtent(double *w, double *h) = 0; - - virtual void OnDefaultEvent(wxMouseEvent *event) = 0; - virtual void OnLocalEvent(wxMouseEvent *event); - - virtual void OnDefaultChar(wxKeyEvent *event) = 0; - virtual void OnLocalChar(wxKeyEvent *event); - - /* Callbacks for the wxSnipAdmin: */ - virtual wxDC *GetDC(); - virtual void GetViewSize(double *h, double *w); - virtual Bool ScrollTo(wxSnip *, double localx, double localy, - double w, double h, Bool refresh, int bias = 0) = 0; - virtual void SetCaretOwner(wxSnip *, int = wxFOCUS_IMMEDIATE) = 0; - virtual void Resized(wxSnip *, Bool redraw_now) = 0; - virtual Bool Recounted(wxSnip *, Bool redraw_now) = 0; - virtual void NeedsUpdate(wxSnip *, double localx, double localy, - double w, double h) = 0; - virtual Bool ReleaseSnip(wxSnip *) = 0; - - virtual double ScrollLineLocation(long line) = 0; - virtual long NumScrollLines() = 0; - virtual long FindScrollLine(double y) = 0; - - virtual Bool AdminScrollTo(double localx, double localy, double w, double h, - Bool refresh = TRUE, int bias = 0); - - virtual wxMediaBuffer *CopySelf(void) = 0; - virtual void CopySelfTo(wxMediaBuffer *b); - virtual double GetDescent(void) = 0; - virtual double GetSpace(void) = 0; - virtual wxchar *GetFlattenedText(long *got = NULL) = 0; - virtual char *GetFlattenedTextUTF8(long *got = NULL); - - void GlobalToLocal(double *x, double *y); - void LocalToGlobal(double *x, double *y); - - /* Edit & Font menus: */ - void DoEdit(int op, Bool recursive = TRUE, long time = 0); - Bool CanEdit(int op, Bool recursive = TRUE); - void DoFont(int op, Bool recursive = TRUE); - virtual void ChangeStyle(wxStyleDelta *) = 0; - - virtual Bool ReallyCanEdit(int op) = 0; - - virtual void Clear() = 0; - virtual void Cut(Bool extend, long time) = 0; - virtual void Copy(Bool extend, long time) = 0; - virtual void Paste(long time) = 0; - virtual void PasteSelection(long time) = 0; - virtual void Kill(long time) = 0; - virtual void SelectAll(void) = 0; - - virtual void Insert(wxSnip *) = 0; - - inline wxSnip *GetFocusSnip(void) { return caretSnip; } - - void InsertBox(int type = wxEDIT_BUFFER); - void InsertImage(char *filename = NULL, long type = 0, - Bool relative = FALSE, Bool inlineImg = TRUE); - - virtual wxSnip *OnNewBox(int type); - - void Undo(void); - void Redo(void); - void ClearUndos(void); - void AddSchemeUndo(void *proc); - - void SetMaxUndoHistory(int); - int GetMaxUndoHistory(); - - int AppendEditItems(wxMenu *edit, int idOffset = 0); - int AppendFontItems(wxMenu *font, int idOffset = 0); - - virtual Bool GetSnipLocation(wxSnip *thesnip, - double *x = NULL, double *y = NULL, - Bool bottomRight=FALSE) = 0; - - virtual Bool WriteToFile(wxMediaStreamOut *) = 0; - virtual Bool ReadFromFile(wxMediaStreamIn *, Bool owrs = FALSE) = 0; - - /* Override this to put more information in the file. Make - sure that you follow the rules for extra header data. */ - virtual Bool ReadHeaderFromFile(wxMediaStreamIn *, char *headerName); - virtual Bool ReadFooterFromFile(wxMediaStreamIn *, char *headerName); - virtual Bool WriteHeadersToFile(wxMediaStreamOut *); - virtual Bool WriteFootersToFile(wxMediaStreamOut *); - /* Use these functions for adding custom header data: */ - Bool BeginWriteHeaderFooterToFile(wxMediaStreamOut *, char *headerName, - long *dataBuffer); - Bool EndWriteHeaderFooterToFile(wxMediaStreamOut *, long dataBuffer); - - void SetKeymap(wxKeymap *keymap = NULL); - wxKeymap *GetKeymap(void); - wxStyleList *GetStyleList(void); - virtual void SetStyleList(wxStyleList *styles); - virtual void StyleHasChanged(wxStyle *style) = 0; - - /* For making a lot of changes to be displayed at once: */ - virtual void BeginEditSequence(Bool undoable = TRUE, Bool interruptSeqs = TRUE) = 0; - virtual void EndEditSequence(void) = 0; - virtual Bool RefreshDelayed(void) = 0; - virtual Bool InEditSequence(void) = 0; - virtual Bool LocationsUpToDate(void) = 0; - - virtual wxSnip *FindFirstSnip(void) = 0; - - virtual void SetMaxWidth(double w) = 0; - virtual void SetMinWidth(double w) = 0; - virtual double GetMaxWidth() = 0; - virtual double GetMinWidth() = 0; - virtual void SetMinHeight(double w) = 0; - virtual void SetMaxHeight(double w) = 0; - virtual double GetMinHeight() = 0; - virtual double GetMaxHeight() = 0; - - virtual void OnPaint(Bool pre, wxDC *dc, - double, double, double, double, - double dx, double dy, - int show_caret); - virtual void InvalidateBitmapCache(double x=0.0, double y=0.0, - double w=-1.0, double h=-1.0) = 0; - - void Print(Bool interactive=TRUE, Bool fit=FALSE, int output_mode = 0, wxWindow *parent = NULL, - Bool forcePageBBox = TRUE, Bool asEPS = FALSE); - virtual void *BeginPrint(wxDC *dc, Bool fit) = 0; - virtual void EndPrint(wxDC*, void*) = 0; - virtual void PrintToDC(wxDC *dc, int page = -1) = 0; - virtual Bool HasPrintPage(wxDC *dc, int page) = 0; - - virtual Bool SavePort(Scheme_Object *port, int format = wxMEDIA_FF_SAME, Bool showErrors = TRUE) = 0; - virtual int InsertPort(Scheme_Object *port, int format = wxMEDIA_FF_GUESS, Bool replaceStyles = TRUE) = 0; - - char *GetFilename(Bool *temp = NULL); - virtual void SetFilename(char *, Bool temp = FALSE) = 0; - - virtual wxBufferData *GetSnipData(wxSnip *); - virtual void SetSnipData(wxSnip *, wxBufferData *); - - virtual void OnChange(void) = 0; - - virtual void OnFocus(Bool on); - - virtual Bool CanSaveFile(char *filename, int format); - virtual void OnSaveFile(char *filename, int format); - virtual void AfterSaveFile(Bool success); - virtual Bool CanLoadFile(char *filename, int format); - virtual void OnLoadFile(char *filename, int format); - virtual void AfterLoadFile(Bool success); - - virtual void OnEditSequence(void); - virtual void AfterEditSequence(void); - - virtual void OnDisplaySize(void); - virtual void OnDisplaySizeWhenReady(void); - - virtual wxImageSnip *OnNewImageSnip(char *filename, long type, - Bool relative, Bool inlineImg); - - virtual char *GetFile(char *path); - virtual char *PutFile(char *path, char *suggested_name); - - wxWindow *ExtractParent(void); - - int GetInactiveCaretThreshold(void); - void SetInactiveCaretThreshold(int); - - void SetCursor(wxCursor *cursor, Bool override = TRUE); - - Bool GetPasteTextOnly(void); - void SetPasteTextOnly(Bool pto); - - /* State */ - void Lock(Bool); - Bool IsLocked(); - Bool Modified(void); - virtual void SetModified(Bool); - virtual void OnSnipModified(wxSnip *, Bool); - - void SetLoadOverwritesStyles(Bool); - Bool GetLoadOverwritesStyles(); - - virtual char *GetDefaultStyleName(); - - void AddBufferFunctions(wxKeymap *tab); - - virtual Bool IsLockedForRead() { return 0; } - virtual Bool IsLockedForFlow() { return 0; } - virtual Bool IsLockedForWrite() { return 0; } - - void BeginSequenceLock(); - void EndSequenceLock(); - void WaitSequenceLock(); - -#ifdef MEMORY_USE_METHOD - virtual long MemoryUse(void); -#endif - - private: - int numExtraHeaders; - void *seq_lock; -}; - -Bool wxWriteMediaVersion(wxMediaStreamOut *mf, wxMediaStreamOutBase *f); -Bool wxReadMediaVersion(wxMediaStreamIn *f, wxMediaStreamInBase *b, Bool parseFormat, Bool showErrors = TRUE); - -Bool wxReadMediaGlobalHeader(wxMediaStreamIn *f); -Bool wxReadMediaGlobalFooter(wxMediaStreamIn *f); -Bool wxWriteMediaGlobalHeader(wxMediaStreamOut *f); -Bool wxWriteMediaGlobalFooter(wxMediaStreamOut *f); -wxStyle *wxmbStyleByIndex(int index); - -Bool wxmbWriteSnipsToFile(wxMediaStreamOut *, wxStyleList *, - wxList *, wxSnip *, wxSnip *, wxList *, - wxMediaBuffer *); - -class wxCanvasMediaAdmin; -class SimpleScroll; -class wxTimer; -class wxAutoDragTimer; -class wxGLConfig; - -class wxMediaCanvas : public wxCanvas -{ - friend class wxCanvasMediaAdmin; - friend class wxUpdateCursorTimer; - - wxCanvasMediaAdmin *admin; - wxMediaBuffer *media; - wxTimer *blinkTimer; - Bool noloop; - long hpixelsPerScroll; - int givenHScrollsPerPage; - int hscrollsPerPage, vscrollsPerPage; - int scrollHeight, scrollWidth; - char xscroll_on, yscroll_on, auto_x, auto_y; - Bool focuson, focusforcedon; - Bool lazy_refresh, need_refresh; - - wxAutoDragTimer *autoDragger; - - wxCursor *customCursor; - Bool customCursorOn; - - Bool scrollToLast, scrollBottomBased; - int scrollOffset; - - int lastwidth, lastheight; - - int last_x, last_y; - - wxColour *bgColor; - - Bool allowXScroll, allowYScroll; - Bool fakeXScroll, fakeYScroll; - SimpleScroll *hscroll, *vscroll; - void PaintScrolls(void); - - void GetScroll(int *x, int *y); - Bool ResetVisual(Bool reset_scroll = FALSE); - - void GetView(double *fx, double *fy, double *fh, double *fw, Bool full = FALSE); - wxDC *GetDCAndOffset(double *fx, double *fy); - void Redraw(double, double, double, double); - - void NoCustomCursor(void); - - void UpdateCursorNow(void); - - public: - int wheel_amt; - int xmargin, ymargin; - - wxMediaCanvas(wxWindow *parent, int x = -1, int y = -1, - int width = -1, int height = -1, char *name = "", - long scrollStyle = 0, - int scrollsPerPage = 100, wxMediaBuffer *m = NULL, - wxGLConfig *gl_cfg = NULL); - ~wxMediaCanvas(); - - Bool IsFocusOn(); - - Bool ScrollTo(double, double, double, double, Bool refresh = TRUE, int bias = 0); - - /* Override some wxCanvas methods: */ - virtual void OnSize(int, int); - virtual void OnEvent(wxMouseEvent *event); - virtual void OnChar(wxKeyEvent *event); - virtual void OnPaint(void); - virtual void OnScroll(wxScrollEvent *event); - virtual void OnSetFocus(); - virtual void OnKillFocus(); - virtual void OnFocus(Bool focus); - virtual void OnScrollOnChange(); - - virtual void Scroll(int x, int y, Bool refresh); - - void ClearMargins(); - - /* To block bad uses: */ - virtual void Scroll(int x, int y); - virtual void SetScrollbars(int h_pixels, int v_pixels, int x_len, int y_len, - int x_page, int y_page, int x_pos=0, int y_pos=0, - Bool setVirtualSize = TRUE); - - void BlinkCaret(); - - void ForceDisplayFocus(Bool on); - - void SetLazyRefresh(Bool on); - Bool GetLazyRefresh(void); - void Repaint(); - - wxMediaBuffer *GetMedia(void); - void SetMedia(wxMediaBuffer *, Bool redisplay = TRUE); - - void SetCustomCursor(wxCursor *cursor); - - void AllowScrollToLast(Bool toLast); - void ScrollWithBottomBase(Bool bottom); - - void *CallAsPrimaryOwner(void *(*f)(void *), void *); - - virtual wxMenu *PopupForMedia(wxMediaBuffer *b, void *m); - - void ResetSize(void); - void SetXMargin(int); - void SetYMargin(int); - int GetXMargin(void); - int GetYMargin(void); - - virtual void SetCanvasBackground(wxColour *); -}; - -class wxCursor; - -#include "wx_madm.h" - -class wxStandardSnipAdmin : public wxSnipAdmin -{ - wxMediaBuffer *media; - public: - wxStandardSnipAdmin(wxMediaBuffer *m); - - wxMediaBuffer *GetMedia(void); - - wxDC *GetDC(); - void GetViewSize(double *h, double *w); - void GetView(double *x, double *y, double *h, double *w, wxSnip *snip = NULL); - Bool ScrollTo(wxSnip *, double localx, double localy, - double w, double h, Bool refresh, int bias = 0); - void SetCaretOwner(wxSnip *, int = wxFOCUS_IMMEDIATE); - void Resized(wxSnip *, Bool redraw_now); - Bool Recounted(wxSnip *, Bool redraw_now); - void NeedsUpdate(wxSnip *, double localx, double localy, - double w, double h); - Bool ReleaseSnip(wxSnip *); - - void UpdateCursor(); - Bool PopupMenu(void *m, wxSnip *s, double x, double y); - - void Modified(wxSnip *, Bool); -}; - -class wxBufferData; -class wxStyleList; - -extern wxList *wxmb_commonCopyBuffer; -extern wxList *wxmb_commonCopyBuffer2; -extern wxBufferData *wxmb_commonCopyRegionData; -extern wxStyleList *wxmb_copyStyleList; - -void wxGetMediaPrintMargin(long *hm=NULL, long *vm=NULL); -void wxSetMediaPrintMargin(long hm=-1, long vm=-1); - -void wxAddMediaBufferFunctions(wxKeymap *tab); - -#if ALLOW_X_STYLE_SELECTION -extern Bool wxMediaXSelectionMode; -extern wxMediaBuffer *wxMediaXSelectionOwner; -extern wxMediaBuffer *wxMediaXSelectionAllowed; -#endif - -void wxMediaSetXSelectionMode(Bool on); - -#endif /* __WX_MEDIA_BUFFER__ */ diff --git a/src/mred/wxme/wx_media.cxx b/src/mred/wxme/wx_media.cxx deleted file mode 100644 index 254ce37ab6..0000000000 --- a/src/mred/wxme/wx_media.cxx +++ /dev/null @@ -1,4570 +0,0 @@ -/* - * File: wx_media.cc - * Purpose: wxMediaEdit implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" -#include "wx_dialg.h" -#include "wx_cmdlg.h" -#include "wx_utils.h" -#include "wx_media.h" -#include "wx_types.h" - -#include -#include -#include - -#include "wx_mpriv.h" - -static void StandardWordbreak(wxMediaEdit *win, long *start, long *end, int, void*); - -wxMediaWordbreakMap *wxTheMediaWordbreakMap; - -#ifdef wx_mac -extern void wxMediaSetFileCreatorType(char *file, Bool is_binary); -#endif - -static wxCursor *iBeam = NULL, *arrow = NULL; - -/************************************************************************/ - -void wxme_utf8_decode(char *str, long len, wxchar **_us, long *_ulen) -{ - long ulen; - wxchar *us; - - ulen = scheme_utf8_decode_all((unsigned char *)str, len, NULL, '?'); - us = new WXGC_ATOMIC wxchar[ulen+1]; - ulen = scheme_utf8_decode_all((unsigned char *)str, len, us, '?'); - us[ulen] = 0; - *_us = us; - *_ulen = ulen; -} - -void wxme_utf8_encode(wxchar *us, long ulen, char **_s, long *_len) -{ - char *s; - long len; - len = scheme_utf8_encode_all(us, ulen, NULL); - s = new WXGC_ATOMIC char[len + 1]; - len = scheme_utf8_encode_all(us, ulen, (unsigned char *)s); - s[len] = 0; - *_s = s; - *_len = len; -} - -int wxstrlen(wxchar *s) -{ - int i; - for (i = 0; s[i]; i++) { - } - return i; -} - -/************************************************************************/ - -extern void wxMediaIOCheckLSB(void); - -const char *(*wxmeExpandFilename)(const char *, const char *, int) = NULL; - -static const char *wxCallExpandPath(const char *f, const char *who, int to_write) -{ - return f; // wxExpandPath(NULL, f); -} - -void wxInitMedia(void) -{ - wxREGGLOB(iBeam); - wxREGGLOB(arrow); - - /* Creates NIL: */ - (void)(new WXGC_PTRS wxMediaLine); - - wxInitClipboard(); - wxInitStyles(); - - wxREGGLOB(wxTheMediaWordbreakMap); - wxTheMediaWordbreakMap = new WXGC_PTRS wxMediaWordbreakMap; - -#if USE_OLD_TYPE_SYSTEM - wxAllTypes->AddType(wxTYPE_MEDIA_CANVAS, wxTYPE_CANVAS, "media-canvas"); - - wxAllTypes->AddType(wxTYPE_MEDIA_BUFFER, wxTYPE_OBJECT, "media-buffer"); - wxAllTypes->AddType(wxTYPE_MEDIA_EDIT, wxTYPE_MEDIA_BUFFER, "media-edit"); - wxAllTypes->AddType(wxTYPE_MEDIA_PASTEBOARD, wxTYPE_MEDIA_BUFFER, "media-pasteboard"); - - wxAllTypes->AddType(wxTYPE_SNIP, wxTYPE_OBJECT, "snip"); - wxAllTypes->AddType(wxTYPE_TEXT_SNIP, wxTYPE_SNIP, "text-snip"); - wxAllTypes->AddType(wxTYPE_TAB_SNIP, wxTYPE_SNIP, "tab-snip"); - wxAllTypes->AddType(wxTYPE_IMAGE_SNIP, wxTYPE_SNIP, "image-snip"); - wxAllTypes->AddType(wxTYPE_MEDIA_SNIP, wxTYPE_SNIP, "media-snip"); - - wxAllTypes->AddType(wxTYPE_MEDIA_ADMIN, wxTYPE_OBJECT, "media-admin"); - wxAllTypes->AddType(wxTYPE_CANVAS_MEDIA_ADMIN, wxTYPE_MEDIA_ADMIN, "canvas-media-admin"); - wxAllTypes->AddType(wxTYPE_MEDIA_SNIP_MEDIA_ADMIN, wxTYPE_MEDIA_ADMIN, "media-snip-media-admin"); - - wxAllTypes->AddType(wxTYPE_MEDIA_SNIP_ADMIN, wxTYPE_OBJECT, "media-snip-admin"); - - wxAllTypes->AddType(wxTYPE_SNIP_CLASS, wxTYPE_OBJECT, "snip-class"); - wxAllTypes->AddType(wxTYPE_BUFFER_DATA, wxTYPE_OBJECT, "buffer-data"); - wxAllTypes->AddType(wxTYPE_BUFFER_DATA_CLASS, wxTYPE_OBJECT, "buffer-data-class"); - - wxAllTypes->AddType(wxTYPE_KEYMAP, wxTYPE_OBJECT, "keymap"); - - wxAllTypes->AddType(wxTYPE_STYLE, wxTYPE_OBJECT, "style"); - wxAllTypes->AddType(wxTYPE_STYLE_DELTA, wxTYPE_OBJECT, "style-delta"); - wxAllTypes->AddType(wxTYPE_STYLE_LIST, wxTYPE_OBJECT, "style-list"); - - wxAllTypes->AddType(wxTYPE_WORDBREAK_MAP, wxTYPE_OBJECT, "wordbreak-map"); - - wxAllTypes->AddType(wxTYPE_SNIP_CLASS_LIST, wxTYPE_LIST, "snip-class-list"); - wxAllTypes->AddType(wxTYPE_BUFFER_DATA_CLASS_LIST, wxTYPE_LIST, "buffer-data-class-list"); -#endif - - wxMediaIOCheckLSB(); - - if (!wxmeExpandFilename) - wxmeExpandFilename = wxCallExpandPath; -} - -wxMediaEdit::wxMediaEdit(double spacing, double *tabstops, int numtabs) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_MEDIA_EDIT; -#endif - bufferType = wxEDIT_BUFFER; - - readLocked = FALSE; - flowLocked = FALSE; - writeLocked = FALSE; - userLocked = modified = FALSE; - - lineSpacing = spacing; - maxWidth = minWidth = minHeight = maxHeight = -1; - - hiliteOn = TRUE; - - len = 0; - - // AddEditorFunctions(map); - - startpos = endpos = 0; - posateol = FALSE; - - flash = FALSE; - flashTimer = NULL; - - delayRefresh = 0; - - refreshUnset = refreshBoxUnset = TRUE; - refreshAll = FALSE; - delayedscroll = -1; - delayedscrollbox = FALSE; - - { - wxStandardSnipAdmin *ssa; - ssa = new WXGC_PTRS wxStandardSnipAdmin(this); - snipAdmin = ssa; - } - - caretStyle = NULL; - - MakeOnlySnip(); - - snipCacheInvalid = FALSE; - - graphicsInvalid = flowInvalid = FALSE; - graphicMaybeInvalid = TRUE; - graphicMaybeInvalidForce = FALSE; - - totalHeight = totalWidth = finalDescent = initialSpace = 0; - - drawCachedInBitmap = FALSE; - - overwriteMode = FALSE; - - clickbacks = NULL; - - typingStreak = FALSE; - deletionStreak = FALSE; - delayedStreak = FALSE; - anchorStreak = FALSE; - vcursorStreak = FALSE; - killStreak = FALSE; - insertForceStreak = FALSE; - deleteForceStreak = FALSE; - - keepAnchorStreak = FALSE; - - caretBlinked = FALSE; - - changed = FALSE; - -#if ALLOW_X_STYLE_SELECTION - needXCopy = FALSE; -#endif - - tracking = dragging = FALSE; - - fileFormat = wxMEDIA_FF_STD; - - prevPasteStart = -1; - - stickyStyles = 1; - initialStyleNeeded = 1; - - tabcount = numtabs; - tabs = tabstops; - tabSpace = wxTAB_WIDTH; - tabSpaceInUnits = TRUE; - - wordBreak = StandardWordbreak; - wordBreakData = NULL; - wordBreakMap = wxTheMediaWordbreakMap; - - autoWrapBitmap = NULL; - wrapBitmapWidth = 0; - - betweenThreshold = 2.0; -} - -wxMediaEdit::~wxMediaEdit() -{ - wxSnip *snip, *next; - - SetWordbreakMap(NULL); - - for (snip = snips; snip; snip = next) { - next = snip->next; - DELETE_OBJ snip; - } - - if (clickbacks) - clickbacks->DeleteContents(TRUE); -} - -wxMediaBuffer *wxMediaEdit::CopySelf(void) -{ - wxMediaEdit *m; - - m = new WXGC_PTRS wxMediaEdit(lineSpacing); - - CopySelfTo(m); - - /* All done! */ - return m; -} - -void wxMediaEdit::CopySelfTo(wxMediaBuffer *b) -{ - wxMediaEdit *m; - - if (b->bufferType != wxEDIT_BUFFER) - return; - m = (wxMediaEdit *)b; - - /* Copy parameters, such as tab settings: */ - if (tabs) { - double *t; - - t = new WXGC_ATOMIC double[tabcount]; - memcpy(t, tabs, sizeof(double) * tabcount); - m->SetTabs(t, tabcount, tabSpace, tabSpaceInUnits); - } - - wxMediaBuffer::CopySelfTo(m); - - if (!m->LastPosition()) { - wxStyle *bs; - char *sname; - /* Make sure only snip in m has a good style (since we called - m->styleList->Copy() in wxMediaBuffer::CopySelfTo). */ - sname = GetDefaultStyleName(); - bs = m->styleList->FindNamedStyle(sname); - m->snips->style = bs; - if (!m->snips->style) { - bs = m->styleList->BasicStyle(); - m->snips->style = bs; - } - } - - m->SetFileFormat(GetFileFormat()); - - m->SetWordbreakFunc(wordBreak, wordBreakData); - m->SetWordbreakMap(GetWordbreakMap()); - m->SetBetweenThreshold(GetBetweenThreshold()); - m->HideCaret(CaretHidden()); - m->SetOverwriteMode(GetOverwriteMode()); - - m->SetAutowrapBitmap(autoWrapBitmap); - - m->SetStickyStyles(stickyStyles); -} - -/******************************************************************/ - -wxCursor *wxMediaEdit::AdjustCursor(wxMouseEvent *event) -{ - double scrollx, scrolly; - double x, y; - wxSnip *snip; - wxDC *dc; - Bool onit; - long pos; - wxCursor *c; - double how_close; - - if (!iBeam) { - arrow = new WXGC_PTRS wxCursor(wxCURSOR_ARROW); - iBeam = new WXGC_PTRS wxCursor(wxCURSOR_IBEAM); - } - - if (!admin) - return NULL; - - dc = admin->GetDC(&scrollx, &scrolly); - if (!dc) - return NULL; - - x = event->x + scrollx; - y = event->y + scrolly; - - if (tracking) - return customCursor ? customCursor : arrow; - - /* This test needs to be the same as in Refresh(): */ - if (graphicMaybeInvalid || flowLocked || delayRefresh) { - /* We're too busy. Ask again later. */ - if (customCursorOverrides &&customCursor) - return customCursor; - return iBeam; - } - - BeginSequenceLock(); - - if (!customCursorOverrides) { - if (caretSnip && event->Dragging()) { - double x, y; - GetSnipPositionAndLocation(caretSnip, NULL, &x, &y); - c = caretSnip->AdjustCursor(dc, x - scrollx, y - scrolly, x, y, event); - if (c) { - EndSequenceLock(); - return c; - } - } - - /* Find snip: */ - - pos = FindPosition(x, y, NULL, &onit, &how_close); - if ((how_close > 0 && how_close <= betweenThreshold) - || (how_close < 0 && -how_close <= betweenThreshold)) - onit = FALSE; - - if (onit) - snip = FindSnip(pos, +1); - else - snip = NULL; - - if (snip) { - double x, y; - GetSnipPositionAndLocation(snip, NULL, &x, &y); - c = snip->AdjustCursor(dc, x - scrollx, y - scrolly, x, y, event); - if (c) { - EndSequenceLock(); - return c; - } - } - } - - if (customCursor) { - EndSequenceLock(); - return customCursor; - } - - if (x >= 0) { - int cb; - pos = FindPosition(x, y, NULL); - cb = !!FindClickback(pos, y); - EndSequenceLock(); - return cb ? arrow : iBeam; - } else { - EndSequenceLock(); - return iBeam; - } -} - -void wxMediaEdit::OnEvent(wxMouseEvent *event) -{ - double scrollx, scrolly; - double x, y; - wxSnip *snip; - wxDC *dc; - Bool onit; - Bool sequenced = FALSE; - long now; - - if (!admin) - return; - - if (!event->Moving() - && !event->Entering() - && !event->Leaving()) - EndStreaks(wxSTREAK_EXCEPT_KEY_SEQUENCE | wxSTREAK_EXCEPT_CURSOR | wxSTREAK_EXCEPT_DELAYED); - - if (event->ButtonDown() || caretSnip) { - /* First, find clicked-on snip: */ - x = event->x; - y = event->y; - - dc = admin->GetDC(&scrollx, &scrolly); - y += scrolly; - x += scrollx; - - if (!dc) - return; - } else - dc = NULL; - - if (event->ButtonDown()) { - double how_close; - - now = FindPosition(x, y, NULL, &onit, &how_close); - if ((how_close > 0 && how_close <= betweenThreshold) - || (how_close < 0 && -how_close <= betweenThreshold)) - onit = FALSE; - - if (onit) { - /* We're in the snip's horizontal region... */ - double top, bottom, dummy; - - snip = FindSnip(now, +1); - - /* ... but maybe the mouse is above or below it. */ - GetSnipLocation(snip, &dummy, &top, FALSE); - GetSnipLocation(snip, &dummy, &bottom, TRUE); - if ((top > y) || (y > bottom)) - snip = NULL; - } else - snip = NULL; - sequenced = 0 && (PTRNE(snip, caretSnip)); - if (sequenced) - BeginEditSequence(); - SetCaretOwner(snip); - } - - if (caretSnip && (caretSnip->flags & wxSNIP_HANDLES_EVENTS)) { - GetSnipPositionAndLocation(caretSnip, NULL, &x, &y); - caretSnip->OnEvent(dc, x - scrollx, y - scrolly, x, y, event); - if (sequenced) - EndEditSequence(); - return; - } - - OnLocalEvent(event); - - if (sequenced) - EndEditSequence(); -} - -void wxMediaEdit::OnDefaultEvent(wxMouseEvent *event) -{ - long now; - double scrollx, scrolly; - double x, y; - Bool ateol; - wxClickback *click; - wxDC *dc; - double how_close; - - if (!admin) - return; - - x = event->x; - y = event->y; - dc = admin->GetDC(&scrollx, &scrolly); - y += scrolly; - x += scrollx; - - if (!dc) - return; - - now = FindPosition(x, y, &ateol, NULL, &how_close); - if (how_close > 0 && how_close <= betweenThreshold) - now++; - - if (event->ButtonDown()) { - tracking = FALSE; - if ((x >= 0) && (click = FindClickback(now, y))) { - if (click->callOnDown) { - click->f(this, click->start, click->end, click->data); - } else { - tracking = TRUE; - trackClickback = click; - if (admin) - admin->UpdateCursor(); - SetClickbackHilited(trackClickback, TRUE); - } - } else { - dragstart = now; - dragging = TRUE; - if (event->ShiftDown()) { - if (dragstart > startpos) - dragstart = startpos; - else - dragstart = endpos; - } - if (now < dragstart) - SetPositionBiasScroll(-2, now, dragstart, ateol); - else - SetPositionBiasScroll(2, dragstart, now, ateol); - } - } else if (event->Dragging()) { - now = FindPosition(x, y, &ateol); - if (dragging) { - if (now < dragstart) { - if (now != startpos || dragstart != endpos) - SetPositionBiasScroll(-2, now, dragstart, ateol); - } else { - if (now != endpos || dragstart != startpos) - SetPositionBiasScroll(2, dragstart, now, ateol); - } - } else if (tracking) { - wxClickback *cb; - if (x >= 0) - cb = FindClickback(now, y); - else - cb = NULL; - SetClickbackHilited(trackClickback, cb == trackClickback); - } - } else if (event->ButtonUp()) { - if (dragging) - dragging = FALSE; - else if (tracking) { - tracking = FALSE; - if (trackClickback->hilited) { - SetClickbackHilited(trackClickback, FALSE); - trackClickback->f(this, trackClickback->start, - trackClickback->end, trackClickback->data); - } - if (admin) - admin->UpdateCursor(); - } - } else if (event->Moving()) { - dragging = FALSE; - if (tracking) { - tracking = FALSE; - if (trackClickback->hilited) { - SetClickbackHilited(trackClickback, FALSE); - trackClickback->f(this, trackClickback->start, - trackClickback->end, trackClickback->data); - } - if (admin) - admin->UpdateCursor(); - } - } -} - -void wxMediaEdit::OnChar(wxKeyEvent *event) -{ - if (!admin) - return; - - if (caretSnip && (caretSnip->flags & wxSNIP_HANDLES_EVENTS)) { - wxDC *dc; - double scrollx, scrolly, x, y; - - dc = admin->GetDC(&scrollx, &scrolly); - GetSnipPositionAndLocation(caretSnip, NULL, &x, &y); - - caretSnip->OnChar(dc, x - scrollx, y - scrolly, x, y, event); - return; - } - - { - int code; - code = event->keyCode; - if ((code != WXK_RELEASE) - && (code != WXK_SHIFT) - && (code != WXK_CONTROL) - && (code != WXK_MENU) - && (code != 0)) - wxHideCursor(); - } - - OnLocalChar(event); -} - -void wxMediaEdit::OnDefaultChar(wxKeyEvent *event) -{ - long code, ins = -1; - int ok = 0; - - if (!admin) - return; - - code = event->KeyCode(); - - switch(code) { - case WXK_BACK: - Delete(); - return; - case WXK_DELETE: - if (startpos == endpos) { - if (endpos < len) { - Delete(endpos, endpos + 1); - } - } else - Delete(); - return; - case WXK_RIGHT: - case WXK_LEFT: - case WXK_UP: - case WXK_DOWN: - case WXK_HOME: - case WXK_END: - case WXK_PRIOR: - case WXK_NEXT: - { - int isshift; - isshift = event->ShiftDown(); - MovePosition(code, isshift); - } - return; - case WXK_NUMPAD0: - ins = '0'; - break; - case WXK_NUMPAD1: - ins = '1'; - break; - case WXK_NUMPAD2: - ins = '2'; - break; - case WXK_NUMPAD3: - ins = '3'; - break; - case WXK_NUMPAD4: - ins = '4'; - break; - case WXK_NUMPAD5: - ins = '5'; - break; - case WXK_NUMPAD6: - ins = '6'; - break; - case WXK_NUMPAD7: - ins = '7'; - break; - case WXK_NUMPAD8: - ins = '8'; - break; - case WXK_NUMPAD9: - ins = '9'; - break; - case WXK_MULTIPLY: - ins = '*'; - break; - case WXK_DIVIDE: - ins = '/'; - break; - case WXK_ADD: - ins = '+'; - break; - case WXK_SUBTRACT: - ins = '-'; - break; - case WXK_DECIMAL: - ins = '.'; - break; - case 3: /* NUMPAD_ENTER */ - ins = '\r'; - break; - case WXK_RETURN: - case WXK_TAB: - ok = 1; - default: /* ^^^ fallthrough ^^^ */ - if (ok || ((code >= 32) - && ((code <= 0xD800) - || (code > 0xDF00)))) { - ins = code; - } - } - - if (ins > -1) { - if (overwriteMode && (startpos == endpos)) - Insert(ins, startpos, startpos + 1); - else - Insert(ins); - } -} - -void wxMediaEdit::OwnCaret(Bool ownit) -{ - if (DoOwnCaret(ownit)) { - NeedCaretRefresh(); - OnFocus(ownit); - } -} - -void wxMediaEdit::BlinkCaret() -{ - if (caretSnip) { - wxDC *dc; - double dx, dy; - if ((dc = admin->GetDC(&dx, &dy))) { - double x, y; - if (GetSnipLocation(caretSnip, &x, &y)) - caretSnip->BlinkCaret(dc, x - dx, y - dy); - } - } else { - /* This test needs to be the same as in Refresh(): */ - if (graphicMaybeInvalid || flowLocked || delayRefresh) { - /* We're busy. Go away. */ - return; - } - - if ((startpos == endpos) - && !flash - && hiliteOn) { - caretBlinked = !caretBlinked; - NeedCaretRefresh(); - } - } -} - -void wxMediaEdit::SizeCacheInvalid(void) -{ - if (!graphicMaybeInvalid) - graphicMaybeInvalid = TRUE; - graphicsInvalid = TRUE; - if (maxWidth > 0) - flowInvalid = TRUE; - snipCacheInvalid = TRUE; -} - -Bool wxMediaEdit::IsLockedForRead() { - return readLocked; -} - -Bool wxMediaEdit::IsLockedForFlow() { - return flowLocked; -} - -Bool wxMediaEdit::IsLockedForWrite() { - return writeLocked; -} - -/****************************************************************/ - -void wxMediaEdit::OnChange(void) -{ - /* Do nothing */ -} - -Bool wxMediaEdit::CanInsert(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ - return TRUE; -} - -void wxMediaEdit::OnInsert(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ -} - -void wxMediaEdit::AfterInsert(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ -} - -Bool wxMediaEdit::CanDelete(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ - return TRUE; -} - -void wxMediaEdit::OnDelete(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ -} - -void wxMediaEdit::AfterDelete(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ -} - -Bool wxMediaEdit::CanChangeStyle(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ - return TRUE; -} - -void wxMediaEdit::OnChangeStyle(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ -} - -void wxMediaEdit::AfterChangeStyle(long WXUNUSED(start), long WXUNUSED(len)) -{ - /* Do nothing */ -} - - -void wxMediaEdit::AfterSetPosition(void) -{ - /* Do nothing */ -} - -Bool wxMediaEdit::CanSetSizeConstraint(void) -{ - return TRUE; -} - -void wxMediaEdit::OnSetSizeConstraint(void) -{ - /* Do nothing */ -} - -void wxMediaEdit::AfterSetSizeConstraint(void) -{ - /* Do nothing */ -} - -void wxMediaEdit::OnSplitSnip(long pos) -{ - /* Do nothing */ -} - -void wxMediaEdit::OnMergeSnips(long pos) -{ - /* Do nothing */ -} - -/****************************************************************/ - -void wxMediaEdit::BeginEditSequence(Bool undoable, Bool interruptSeqs) -{ - WaitSequenceLock(); - - if (!delayRefresh && !interruptSeqs) - PushStreaks(); - - EndStreaks(wxSTREAK_EXCEPT_DELAYED); - - if (noundomode || !undoable) - noundomode++; - - if (!delayRefresh) { -#if ALLOW_X_STYLE_SELECTION - needXCopy = TRUE; -#endif - delayRefresh++; - OnEditSequence(); - } else - delayRefresh++; -} - -void wxMediaEdit::EndEditSequence(void) -{ - if (!delayRefresh) { -#ifdef wx_x - fprintf(stderr, "EndEditSequence without BeginEditSequence\n"); - return; -#endif - } - - if (!(--delayRefresh)) { - EndStreaks(); - PopStreaks(); - Redraw(); -#if ALLOW_X_STYLE_SELECTION - needXCopy = FALSE; -#endif - AfterEditSequence(); - } else if (delayRefresh < 0) - delayRefresh = 0; - - if (noundomode) - --noundomode; - - if (!delayRefresh && needOnDisplaySize) { - needOnDisplaySize = 0; - OnDisplaySize(); - } -} - -Bool wxMediaEdit::RefreshDelayed(void) -{ - if (delayRefresh > 0) - return 1; - - if (!admin) - return 1; - else - return admin->DelayRefresh(); -} - -Bool wxMediaEdit::InEditSequence(void) -{ - return (delayRefresh > 0); -} - -Bool wxMediaEdit::LocationsUpToDate(void) -{ - return !graphicMaybeInvalid; -} - -void wxMediaEdit::Recalculate(void) -{ -} - -void wxMediaEdit::GetPosition(long *start, long *end) -{ - if (start) - *start = startpos; - if (end) - *end = endpos; -} - -long wxMediaEdit::GetStartPosition(void) -{ - return startpos; -} - -long wxMediaEdit::GetEndPosition(void) -{ - return endpos; -} - -void wxMediaEdit::SetPosition(long start, long end, Bool ateol, Bool scroll, - int seltype) -{ - _SetPosition(FALSE, 0, start, end, ateol, scroll, seltype); -} - -void wxMediaEdit::SetPositionBiasScroll(int bias, long start, long end, - Bool ateol, Bool scroll, int seltype) -{ - _SetPosition(FALSE, bias, start, end, ateol, scroll, seltype); -} - -Bool wxMediaEdit::ScrollToPosition(long start, Bool ateol, Bool refresh, - long end, int bias) -{ - double topx, botx, topy, boty, w, h; - - if (flowLocked) - return FALSE; - - if (end < start) - end = start; - - if (delayRefresh) { - if (admin) { - delayedscrollbox = FALSE; - delayedscroll = start; - delayedscrollend = end; - delayedscrollateol = ateol; - delayedscrollbias = bias; - } - return FALSE; - } - - if (!CheckRecalc(TRUE, FALSE)) - return FALSE; - - delayedscroll = -1; - - PositionLocation(start, &topx, &topy, TRUE, ateol, TRUE); - PositionLocation(end, &botx, &boty, FALSE, ateol, TRUE); - - if (botx < topx) { - /* when the end position is to the left of the start position */ - topx = 0; - botx = totalWidth; - } - - w = botx - topx; - h = boty - topy; - - return AdminScrollTo(topx, topy, w, h, refresh, bias); -} - -Bool wxMediaEdit::ScrollToPosition(long start, Bool ateol, long end, int bias) -{ - return ScrollToPosition(start, ateol, TRUE, end, bias); -} - -void wxMediaEdit::GetVisiblePositionRange(long *start, long *end, Bool all) -{ - double x, y, h, w; - - if (!CheckRecalc(TRUE, FALSE)) - return; - - if (all) - admin->GetMaxView(&x, &y, &w, &h); - else - admin->GetView(&x, &y, &w, &h); - if (start) { - long s; - s = FindPosition(x, y); - *start = s; - } - if (end) { - long e; - e = FindPosition(x + w, y + h); - *end = e; - } -} - -void wxMediaEdit::GetVisibleLineRange(long *start, long *end, Bool all) -{ - double x, y, h, w; - - if (!CheckRecalc(TRUE, FALSE)) - return; - - if (all) - admin->GetMaxView(&x, &y, &w, &h); - else - admin->GetView(&x, &y, &w, &h); - if (start) { - long s; - s = FindLine(y); - *start = s; - } - if (end) { - long e; - e = FindLine(y + h); - *end = e; - } -} - -void wxMediaEdit::MovePosition(long code, Bool extendSelection, - int kind) -{ - long i, start, end, extendstart, extendend; - Bool ateol, vcursor, anchor, extend, kas; - double y; - int leftshrink, rightshrink; - - if (flowLocked) - return; - - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return; - - anchor = anchorStreak; - vcursor = vcursorStreak; - - if (extendStreak || anchorStreak) { - extendend = extendendpos; - extendstart = extendstartpos; - } else { - extendend = endpos; - extendstart = startpos; - } - - kas = keepAnchorStreak; - keepAnchorStreak = anchorStreak; - - EndStreaks(wxSTREAK_EXCEPT_DELAYED); - - extend = anchor || extendSelection; - - /* rightshrink: motion to right shrinks the selected region */ - rightshrink = (extend && (startpos < extendstart)); - leftshrink = (extend && (endpos > extendend)); - - if (code == WXK_PRIOR) { - code = WXK_UP; - kind = wxMOVE_PAGE; - } else if (code == WXK_NEXT) { - code = WXK_DOWN; - kind = wxMOVE_PAGE; - } - - if (code == WXK_HOME) { - if (leftshrink) - SetPositionBiasScroll(-2, extendstart, extendend); - else - SetPositionBiasScroll(-2, 0, extend ? extendend : 0); - } else if (code == WXK_END) { - if (rightshrink) - SetPositionBiasScroll(2, extendstart, extendend); - else - SetPositionBiasScroll(2, extend ? extendstart : len, len); - } else if (code == WXK_LEFT) { - if ((kind != wxMOVE_LINE) - && (kind != wxMOVE_WORD) - && !extend - && (startpos != endpos)) { - SetPosition(startpos); - } else { - /* Pick a starting place */ - if (leftshrink) - start = endpos; - else - start = startpos; - - if (kind == wxMOVE_WORD) - FindWordbreak(&start, NULL, wxBREAK_FOR_CARET); - else if (kind == wxMOVE_LINE) - start = LineStartPosition(PositionLine(start, posateol)); - else - --start; - - if (extend) { - if (leftshrink) { - if (start < extendend) - start = extendend; /* collapse to original */ - end = start; - start = startpos; - } else { - end = endpos; - } - } else - end = start; - - SetPositionBiasScroll(-2, start, end); - } - } else if (code == WXK_RIGHT) { - if ((kind != wxMOVE_LINE) - && (kind != wxMOVE_WORD) - && !extend - && (startpos != endpos)) { - SetPosition(endpos, endpos, TRUE); - } else { - /* Pick a starting place */ - if (rightshrink) - end = startpos; - else - end = endpos; - - if (kind == wxMOVE_WORD) - FindWordbreak(NULL, &end, wxBREAK_FOR_CARET); - else if (kind == wxMOVE_LINE) - end = LineEndPosition(PositionLine(end, posateol)); - else - end++; - - if (extend) { - if (rightshrink) { - if (end > extendstart) - end = extendstart; /* collapse to original */ - start = end; - end = endpos; - } else { - start = startpos; - } - } else - start = end; - - SetPositionBiasScroll(2, start, end, TRUE); - } - } else if ((code == WXK_UP) || (code == WXK_DOWN)) { - int cline, bias; - /* Used when paging: */ - Bool specialScroll = (kind == wxMOVE_PAGE); - double scrollLeft = 0.0, scrollWidth = 0.0; - double scrollTop = 0.0, scrollHeight = 0.0; - - if (code == WXK_UP) { - if (leftshrink) - start = endpos; - else - start = startpos; - - if (!vcursor) - PositionLocation(start, &vcursorloc, NULL, TRUE, posateol, TRUE); - - cline = PositionLine(start, posateol); - if (kind == wxMOVE_PAGE) { - /* The current top line should become the next-to bottom line. - The caret should go to line above current top line, but - watch out for: - - especially tall lines - - already at top */ - double vy, ty; - long newtop, top; - - admin->GetView(&scrollLeft, &vy, &scrollWidth, &scrollHeight); - - /* Top line should be completely visible as bottom line after - scrolling. */ - top = FindScrollLine(vy); - ty = ScrollLineLocation(top + 1); - newtop = FindScrollLine(ty - scrollHeight); - y = ScrollLineLocation(newtop); - if (y < ty - scrollHeight) { - newtop++; - } - y = ScrollLineLocation(newtop); - /* y is the new top location */ - - if (y >= vy) { - /* No or backward progess. */ - y = ScrollLineLocation(top - 1); - } - - if (y == vy) { - /* Must be at the top: */ - i = FindLine(y); - } else { - i = FindLine(y + scrollHeight); - if (LineLocation(i - 1) > y) - i--; - } - scrollTop = y; - } else - i = cline - 1; - if (i >= 0) - start = FindPositionInLine(i, vcursorloc, &ateol); - else { - start = 0; - ateol = FALSE; - } - - if (extend) { - if (leftshrink) { - if (start < extendend) { - if ((kind != wxMOVE_PAGE) && (start < extendstart)) { - /* Inversion! */ - end = extendend; - } else { - /* collapse to original */ - end = extendend; - start = startpos; - specialScroll = 0; - } - } else { - end = start; - start = startpos; - } - } else { - end = endpos; - } - } else - end = start; - - bias = leftshrink ? 2 : -2; - } else { - if (rightshrink) - end = startpos; - else - end = endpos; - - if (!vcursor) - PositionLocation(end, &vcursorloc, NULL, TRUE, posateol, TRUE); - - cline = PositionLine(end, posateol); - if (kind == wxMOVE_PAGE) { - double vy; - long newtop; - - admin->GetView(&scrollLeft, &vy, &scrollWidth, &scrollHeight); - - /* Last fully-visible line is the new top line */ - newtop = FindScrollLine(vy + scrollHeight); - y = ScrollLineLocation(newtop + 1); - if (y > vy + scrollHeight) { - newtop--; - } - y = ScrollLineLocation(newtop); - /* y is the new top location */ - - if (y <= vy) { - /* No or backwards movement. Scroll back one. */ - newtop = FindScrollLine(vy) + 1; - y = ScrollLineLocation(newtop); - } - - /* Compute top line, for caret */ - i = FindLine(y); - if (LineLocation(i, TRUE) < y) - i++; - - /* Now, suppose we're scrolling down while extending the - selection. We want to be able to see that we're - selecting. So try moving the line `i' down one more, if - there's room: */ - if (LineLocation(i + 1, FALSE) < y + scrollHeight) - i++; - - scrollTop = y - 1; - } else - i = cline + 1; - if (i <= numValidLines - 1) - end = FindPositionInLine(i, vcursorloc, &ateol); - else - end = len; - - if (extend) { - if (rightshrink) { - if (end > extendstart) { - if ((kind != wxMOVE_PAGE) && (end > extendend)) { - /* Inversion! */ - start = extendstart; - } else { - /* collapse to original */ - start = extendstart; - end = endpos; - specialScroll = 0; - } - } else { - start = end; - end = endpos; - } - } else { - start = startpos; - } - } else - start = end; - - bias = rightshrink ? -2 : 2; - } - - if (specialScroll) - BeginEditSequence(); - - /* Scroll only if !specialScroll */ - SetPositionBiasScroll(bias, start, end, ateol, - !specialScroll); - if (specialScroll) - /* Special scrolling intructions: */ - ScrollTo(NULL, scrollLeft, scrollTop, - scrollWidth, scrollHeight, - FALSE, 0); - - if (specialScroll) - EndEditSequence(); - - vcursorStreak = TRUE; - } - - keepAnchorStreak = kas; - if (extend) - extendStreak = TRUE; - - if (extendStreak || anchorStreak) { - extendendpos = extendend; - extendstartpos = extendstart; - } -} - -void wxMediaEdit::SetAnchor(Bool on) -{ - int wason = anchorStreak; - - anchorStreak = on; - - if (on && !wason) { - extendendpos = endpos; - extendstartpos = startpos; - } -} - -Bool wxMediaEdit::GetAnchor(void) -{ - return anchorStreak; -} - -void wxMediaEdit::_Insert(wxSnip *isnip, long strlen, wxchar *str, wxList *snipsl, - long start, long end, Bool scrollOk) -{ - long addlen, i, sPos, s, snipStartPos; - wxSnip *gsnip, *cSnip, *beforeSnip; - wxTextSnip *snip; - wxTabSnip *tabsnip; - Bool deleted = FALSE, insertedLine = FALSE, scroll; - wxNode *node; - - if (writeLocked || userLocked) - return; - - if (start < 0) - return; - if (start > len) - start = len; - - if (caretStyle) - if (start != end || start != startpos) - caretStyle = NULL; - - if (end > -1) - if (start < end) { -#if ALLOW_X_STYLE_SELECTION - if (!delayRefresh) - needXCopy = TRUE; -#endif - if (isnip || strlen || snipsl) - BeginEditSequence(); - Delete(start, end, scrollOk); - deleted = TRUE; -#if ALLOW_X_STYLE_SELECTION - if (!delayRefresh) - needXCopy = FALSE; -#endif - } - - if (!isnip && !strlen && !snipsl) - return; - - /* If deleted, must end edit sequence after this point... */ - - writeLocked = TRUE; - - if (isnip || snipsl) { - int did_one; - - addlen = 0; - - if (snipsl) { - for (node = snipsl->First(); node; node = node->Next()) { - isnip = (wxSnip *)node->Data(); - if (!isnip->count) - goto give_up; - addlen += isnip->count; - if (isnip->IsOwned()) - goto give_up; - } - } else { - if (!isnip->count) - goto give_up; - - addlen = isnip->count; - - if (isnip->IsOwned()) - goto give_up; - } - - if (!CanInsert(start, addlen)) - goto give_up; - OnInsert(start, addlen); - - flowLocked = TRUE; - - /* Make sure OnInsert didn't do something bad to the snip(s): */ - if (snipsl) { - for (node = snipsl->First(); node; node = node->Next()) { - isnip = (wxSnip *)node->Data(); - if (!isnip->count) - goto give_up; - if (isnip->IsOwned()) - goto give_up; - } - } else { - if (!isnip->count) - goto give_up; - if (isnip->IsOwned()) - goto give_up; - } - - did_one = 0; - beforeSnip = NULL; - - for (node = snipsl ? snipsl->First() : NULL; - !snipsl || node; - node = node ? node->Next() : node) { - - if (node) - isnip = (wxSnip *)node->Data(); - - if ((isnip->flags & wxSNIP_NEWLINE)&&!(isnip->flags & wxSNIP_HARD_NEWLINE)) - isnip->flags -= wxSNIP_NEWLINE; - - if (!len && !did_one) { - /* Special case: ignore the empty snip */ - snips = lastSnip = isnip; - lineRoot = new WXGC_PTRS wxMediaLine; - isnip->line = lineRoot; - lineRoot->snip = lineRoot->lastSnip = isnip; - if (maxWidth > 0) - lineRoot->MarkCheckFlow(); - } else { - if (!did_one) { - MakeSnipset(start, start); - gsnip = FindSnip(start, +2); - beforeSnip = gsnip; - } else - gsnip = beforeSnip; - - if (!gsnip) { - AppendSnip(isnip); - gsnip = lastLine->lastSnip; - if (gsnip && (gsnip->flags & wxSNIP_HARD_NEWLINE)) { - wxMediaLine *lr; - lr = lineRoot; - isnip->line = lastLine->Insert(&lr, FALSE); - lineRoot = lr; - isnip->line->snip = isnip->line->lastSnip = isnip; - numValidLines++; - insertedLine = TRUE; - } else { - isnip->line = lastLine; - if (!lastLine->snip) - lastLine->snip = isnip; - lastLine->lastSnip = isnip; - if (isnip->flags & wxSNIP_HARD_NEWLINE) - insertedLine = TRUE; /* b/c added extra ghost line */ - } - } else { - InsertSnip(gsnip, isnip); - if (isnip->flags & wxSNIP_HARD_NEWLINE) { - wxMediaLine *lr; - lr = lineRoot; - isnip->line = gsnip->line->Insert(&lr, TRUE); - lineRoot = lr; - insertedLine = TRUE; - numValidLines++; - if (PTREQ(gsnip->line->snip, gsnip)) - isnip->line->snip = isnip; - else - isnip->line->snip = gsnip->line->snip; - isnip->line->lastSnip = isnip; - gsnip->line->snip = gsnip; - - for (cSnip = isnip->line->snip; - PTRNE(cSnip, isnip); - cSnip = cSnip->next) { - cSnip->line = isnip->line; - } - - gsnip->line->CalcLineLength(); - gsnip->line->MarkRecalculate(); - } else { - isnip->line = gsnip->line; - if (PTREQ(isnip->line->snip, gsnip)) - isnip->line->snip = isnip; - } - } - - if (maxWidth > 0) { - isnip->line->MarkCheckFlow(); - if (isnip->line->prev - && !(isnip->line->prev->lastSnip->flags & wxSNIP_HARD_NEWLINE)) - isnip->line->prev->MarkCheckFlow(); - if ((isnip->flags & wxSNIP_HARD_NEWLINE) && isnip->line->next) - isnip->line->next->MarkCheckFlow(); - } - } - - - isnip->style = styleList->Convert(isnip->style); - isnip->SizeCacheInvalid(); - - isnip->line->CalcLineLength(); - isnip->line->MarkRecalculate(); - - len += isnip->count; - did_one = 1; - - SnipSetAdmin(isnip, snipAdmin); - - firstLine = lineRoot->First(); - lastLine = lineRoot->Last(); - - if (!snipsl) - break; - } - } else { - int sp, cnt; - - addlen = strlen; - - if (!CanInsert(start, addlen)) - goto give_up; - OnInsert(start, addlen); - - flowLocked = TRUE; - - if (!len) { - wxStyle *style; - style = ((stickyStyles & !initialStyleNeeded) - ? snips->style - : GetDefaultStyle()); - snip = InsertTextSnip(start, style); - sPos = 0; - caretStyle = NULL; - lineRoot->snip = lineRoot->lastSnip = snip; - } else { - wxStyle *style; - - if (start) - gsnip = FindSnip(start, -1, &sPos); - else - gsnip = NULL; - - if (!gsnip || (caretStyle && (gsnip->style != caretStyle)) - || !(gsnip->flags & wxSNIP_IS_TEXT) - || (gsnip->count + addlen > MAX_COUNT_FOR_SNIP) - || (!stickyStyles - && (gsnip->style != GetDefaultStyle()))) { - style = (caretStyle - ? caretStyle - : (stickyStyles - ? (gsnip - ? gsnip->style - : snips->style) // No style: use forward - : GetDefaultStyle())); - snip = InsertTextSnip(start, style); - caretStyle = NULL; - sPos = start; - } else { - snip = (wxTextSnip *)gsnip; - if (!(snip->flags & wxSNIP_CAN_APPEND)) { - style = (stickyStyles - ? snip->style - : GetDefaultStyle()); - snip = InsertTextSnip(start, style); - sPos = start; - } - } - - if (gsnip && (gsnip->flags & wxSNIP_HARD_NEWLINE) && (gsnip->next == snip)) { - /* Preceeding snip was a newline, so the new slip belongs on the next line: */ - wxMediaLine *oldline = gsnip->line, *newline; - - if (!oldline->next) { - wxMediaLine *lr; - lr = lineRoot; - oldline->Insert(&lr, FALSE); - lineRoot = lr; - insertedLine = TRUE; - numValidLines++; - - oldline->next->lastSnip = snip; - } - - newline = oldline->next; - - snip->line = newline; - - oldline->lastSnip = gsnip; - newline->snip = snip; - - oldline->CalcLineLength(); - oldline->MarkRecalculate(); - } - } - - s = start - sPos; - - snip->flags |= wxSNIP_CAN_SPLIT; - snip->Insert(str, addlen, s); - if (snip->flags & wxSNIP_CAN_SPLIT) - snip->flags -= wxSNIP_CAN_SPLIT; - - snip->line->CalcLineLength(); - snip->line->MarkRecalculate(); - - if (maxWidth > 0) { - snip->line->MarkCheckFlow(); - if (snip->line->prev - && !(snip->line->prev->lastSnip->flags & wxSNIP_HARD_NEWLINE)) - snip->line->prev->MarkCheckFlow(); - } - - snipStartPos = start; - str = snip->buffer; - sp = s + snip->dtext; - cnt = 0; - for (i = 0; i < addlen; i++) { - if (str[sp] == '\r') - str[sp] = '\n'; - if (str[sp] == '\n' || str[sp] == '\t') { - Bool newline = (str[sp] == '\n'); - - MakeSnipset(i + start, i + start + 1); - snip = (wxTextSnip *)FindSnip(i + start, +1); - - if (newline) { - /* Forced return - split the snip */ - wxMediaLine *oldLine; - - snip->flags |= wxSNIP_NEWLINE | wxSNIP_HARD_NEWLINE - | wxSNIP_INVISIBLE; - snip->flags -= (snip->flags & wxSNIP_CAN_APPEND); - - insertedLine = TRUE; - - if (PTRNE(snip, snip->line->lastSnip)) { - wxMediaLine *lr; - oldLine = snip->line; - lr = lineRoot; - snip->line = oldLine->Insert(&lr, TRUE); - lineRoot = lr; - numValidLines++; - snip->line->lastSnip = snip; - snip->line->snip = oldLine->snip; - - /* Retarget snips moved to new line: */ - for (cSnip = snip->line->snip; - PTRNE(cSnip, snip); - cSnip = cSnip->next) { - cSnip->line = snip->line; - } - - oldLine->snip = snip->next; - - oldLine->CalcLineLength(); - oldLine->MarkRecalculate(); - if (maxWidth > 0) - oldLine->MarkCheckFlow(); - - snip->line->CalcLineLength(); - snip->line->MarkRecalculate(); - if (maxWidth > 0) - snip->line->MarkCheckFlow(); - } else { - /* Carriage-return inserted at the end of a auto-wrapped line. - Line lengths stay the same, but next line now starts - a paragraph. */ - if (snip->line->next) - if (!snip->line->next->StartsParagraph()) - snip->line->next->SetStartsParagraph(TRUE); - } - } else { - wxSnip *rsnip; - tabsnip = OnNewTabSnip(); - if (tabsnip->IsOwned() || tabsnip->count) { - /* Uh-oh. */ - tabsnip = new WXGC_PTRS wxTabSnip(); - } - tabsnip->style = snip->style; - rsnip = SnipSetAdmin(tabsnip, snipAdmin); - if (rsnip!= tabsnip) { - /* Uh-oh. */ - tabsnip = new WXGC_PTRS wxTabSnip(); - tabsnip->style = snip->style; - tabsnip->SetAdmin(snipAdmin); - } - - tabsnip->flags |= wxSNIP_CAN_SPLIT; - tabsnip->InsertUTF8("\t", 1, 0); - if (tabsnip->flags & wxSNIP_CAN_SPLIT) - tabsnip->flags -= wxSNIP_CAN_SPLIT; - - SpliceSnip(tabsnip, snip->prev, snip->next); - tabsnip->line = snip->line; - if (PTREQ(snip->line->snip, snip)) - tabsnip->line->snip = tabsnip; - if (PTREQ(snip->line->lastSnip, snip)) - tabsnip->line->lastSnip = tabsnip; - DELETE_OBJ snip; - } - - snip = (wxTextSnip *)FindSnip(i + start + 1, +1); - snipStartPos = i + start + 1; - str = snip->buffer; - sp = snip->dtext; - cnt = 0; - } else if (cnt > MAX_COUNT_FOR_SNIP) { - /* Divide up snip because it's too large: */ - MakeSnipset(i + start, i + start); - snip = (wxTextSnip *)FindSnip(i + start, +1); - snipStartPos = i + start; - str = snip->buffer; - sp = snip->dtext + 1; - cnt = 1; - } else { - sp++; - cnt++; - } - } - - firstLine = lineRoot->First(); - lastLine = lineRoot->Last(); - - len += addlen; - } - - initialStyleNeeded = 0; - - revision_count++; - - AdjustClickbacks(start, start, addlen, NULL); - - if (!modified) { - wxUnmodifyRecord *ur; - ur = new WXGC_PTRS wxUnmodifyRecord(delayedStreak); - AddUndo(ur); - } - if (!noundomode) { - wxInsertRecord *ir; - ir = new WXGC_PTRS wxInsertRecord(start, addlen, - deleted || typingStreak || delayedStreak - || insertForceStreak - || !modified, - startpos, endpos); - AddUndo(ir); - } - - if (delayRefresh) - delayedStreak = TRUE; - - scroll = (startpos == start); - - if (startpos >= start) - startpos += addlen; - if (endpos >= start) - endpos += addlen; - - if (!refreshUnset) { - if (refreshStart >= start) - refreshStart += addlen; - if (refreshEnd >= start) - refreshEnd += addlen; - } - - extraLine = !!(lastSnip->flags & wxSNIP_NEWLINE); - - writeLocked = FALSE; - flowLocked = FALSE; - - if (scroll) - caretBlinked = FALSE; - - if (scroll && scrollOk) { - delayRefresh++; - ScrollToPosition(startpos); - --delayRefresh; - } - - changed = TRUE; - - caretStyle = NULL; - - if (insertedLine) { - if (!graphicMaybeInvalid) - graphicMaybeInvalid = TRUE; - NeedRefresh(start); - } else - RefreshByLineDemand(); - - if (deleted) - EndEditSequence(); - - if (!modified) - SetModified(TRUE); - - AfterInsert(start, addlen); - - return; - - give_up: - writeLocked = FALSE; - flowLocked = FALSE; - if (deleted) - EndEditSequence(); - - return; -} - -void wxMediaEdit::Insert(wxchar *str, long start, long end, Bool scrollOk) -{ - _Insert(NULL, wxstrlen(str), str, NULL, start, end, scrollOk); -} - -void wxMediaEdit::Insert(wxchar *str) -{ - Insert(str, startpos, endpos); -} - -void wxMediaEdit::Insert(char *str, long start, long end, Bool scrollOk) -{ - int l; - l = strlen(str); - Insert(l, str, start, end, scrollOk); -} - -void wxMediaEdit::Insert(char *str) -{ - Insert(str, startpos, endpos); -} - -void wxMediaEdit::Insert(long len, wxchar *str, long start, long end, Bool scrollOk) -{ - _Insert(NULL, len, str, NULL, start, end, scrollOk); -} - -void wxMediaEdit::Insert(long len, wxchar *str) -{ - _Insert(NULL, len, str, NULL, startpos, endpos); -} - -void wxMediaEdit::Insert(long len, char *str, long start, long end, Bool scrollOk) -{ - long ulen; - wxchar *us = NULL; - wxme_utf8_decode(str, len, &us, &ulen); - _Insert(NULL, ulen, us, NULL, start, end, scrollOk); -} - -void wxMediaEdit::Insert(long len, char *str) -{ - Insert(len, str, startpos, endpos); -} - -void wxMediaEdit::Insert(wxchar a_char, long start, long end) -{ - Bool streak, ifs; - wxchar buffer[2]; - - buffer[0] = a_char; - buffer[1] = 0; - - streak = typingStreak; - ifs = insertForceStreak; - - EndStreaks(wxSTREAK_EXCEPT_DELAYED); - - insertForceStreak = streak; - Insert(buffer, start, end); - - insertForceStreak = ifs; - typingStreak = TRUE; -} - -void wxMediaEdit::Insert(wxchar a_char) -{ - Insert(a_char, startpos, endpos); -} - -void wxMediaEdit::Insert(wxSnip *snip, long start, long end, Bool scrollOk) -{ - _Insert(snip, 0, NULL, NULL, start, end, scrollOk); -} - -void wxMediaEdit::Insert(wxSnip *snip) -{ - Insert(snip, startpos, endpos); -} - -void wxMediaEdit::Insert(wxList *snipsl) -{ - _Insert(NULL, 0, NULL, snipsl, startpos); -} - -void wxMediaEdit::Insert(wxList *snipsl, long start, long end) -{ - _Insert(NULL, 0, NULL, snipsl, start, end); -} - -void wxMediaEdit::_Delete(long start, long end, Bool withUndo, Bool scrollOk) -{ - wxSnip *prev, *next, *startSnip, *endSnip; - long dellen; - wxSnip *snip; - wxDeleteRecord *rec; - wxMediaLine *line; - Bool deletedLine = FALSE, setCaretStyle = FALSE; - Bool updateCursor = FALSE, movedToNext; - - if (writeLocked || userLocked) - return; - - if (end <= -1) { - if (!start) - return; - end = start; - --start; - setCaretStyle = TRUE; - } else if (start == startpos && end == endpos) - setCaretStyle = TRUE; - - if (start >= end) - return; - if ((start < 0) || (start >= len)) - return; - - if (end > len) - end = len; - -#if ALLOW_X_STYLE_SELECTION - if (start <= startpos && end >= endpos) - if (!delayRefresh || needXCopy) { - needXCopy = FALSE; - CopyOutXSelection(); - } -#endif - - writeLocked = TRUE; - - if (!CanDelete(start, end - start)) - goto give_up; - OnDelete(start, end - start); - - flowLocked = TRUE; - - MakeSnipset(start, end); - revision_count++; - - startSnip = FindSnip(start, -2); - endSnip = FindSnip(end, -1); - - if (noundomode) - withUndo = FALSE; - - if (withUndo) { - if (!modified) { - wxUnmodifyRecord *ur; - ur = new WXGC_PTRS wxUnmodifyRecord(delayedStreak); - AddUndo(ur); - } - rec = new WXGC_PTRS wxDeleteRecord(start, end, deletionStreak || delayedStreak - || deleteForceStreak || !modified, - startpos, endpos); - } else - rec = NULL; - - if (setCaretStyle && stickyStyles) - caretStyle = startSnip ? startSnip->next->style : snips->style; - - for (snip = endSnip; PTRNE(snip, startSnip); snip = prev) { - if (PTREQ(snip, caretSnip)) { - caretSnip->OwnCaret(FALSE); - caretSnip = NULL; - updateCursor = TRUE; - } - - if (withUndo) - rec->InsertSnip(snip); - - prev = snip->prev; - - if (PTREQ(snip->line->snip, snip)) { - if (PTREQ(snip->line->lastSnip, snip)) { - snip->line->Delete(&lineRoot); - deletedLine = TRUE; - numValidLines--; - } else - snip->line->snip = snip->next; - } else if (PTREQ(snip->line->lastSnip, snip)) { - if (snip->line->next) { - snip->line->lastSnip = snip->line->next->lastSnip; - snip->line->next->Delete(&lineRoot); - deletedLine = TRUE; - numValidLines--; - } else { - snip->line->lastSnip = prev; - if (!snip->line->next && extraLine) - deletedLine = TRUE; /* b/c maybe deleted extra ghost line */ - } - } - - DeleteSnip(snip); - } - - if (!snipCount) { - MakeOnlySnip(); - if (caretStyle) { - snips->style = caretStyle; - caretStyle = NULL; - } - } - - firstLine = lineRoot->First(); - lastLine = lineRoot->Last(); - - movedToNext = FALSE; - - if (startSnip) { - if (startSnip->flags & wxSNIP_NEWLINE) { - if (startSnip->line->next) { - line = startSnip->line->next; - movedToNext = TRUE; - } else { - startSnip->line->MarkCheckFlow(); - line = NULL; - } - } else - line = startSnip->line; - } else - line = firstLine; - - if (line) { - /* Fix line references from possibly moved snips: */ - next = line->lastSnip->next; - for (snip = line->snip; PTRNE(snip, next); snip = snip->next) { - snip->line = line; - } - - line->CalcLineLength(); - line->MarkRecalculate(); - - if (maxWidth >= 0) { - line->MarkCheckFlow(); - if (line->prev && !(line->prev->lastSnip->flags & wxSNIP_HARD_NEWLINE)) { - line->prev->MarkCheckFlow(); - if (movedToNext && deletedLine && line->prev->prev - && !(line->prev->prev->lastSnip->flags & wxSNIP_HARD_NEWLINE)) { - /* Maybe the deleted object was in the middle of a long word, - and maybe now the long word can be folded into the previous - line */ - line->prev->prev->MarkCheckFlow(); - } - } - } - } - - AdjustClickbacks(start, end, start - end, rec); - - if (withUndo) { - AddUndo(rec); - if (delayRefresh) - delayedStreak = TRUE; - } - - dellen = end - start; - - len -= dellen; - - CheckMergeSnips(start); - - flowLocked = FALSE; - writeLocked = FALSE; - - if ((startpos >= start) && (startpos <= end)) { - caretBlinked = FALSE; - startpos = start; - } else if (startpos > end) { - caretBlinked = FALSE; - startpos -= dellen; - } - - if ((endpos >= start) && (endpos <= end)) - endpos = start; - else if (endpos > end) - endpos -= dellen; - - if (!refreshUnset) { - if ((refreshStart >= start) && (refreshStart <= end)) - refreshStart = start; - else if (refreshStart >= end) - refreshStart -= dellen; - if ((refreshEnd >= start) && (refreshEnd <= end)) - refreshEnd = start; - else if (refreshEnd >= end) - refreshEnd -= dellen; - } - - extraLine = !!(lastSnip->flags & wxSNIP_NEWLINE); - - if (scrollOk && startpos == start) { - delayRefresh++; - ScrollToPosition(startpos); - --delayRefresh; - } - - changed = TRUE; - - if (!setCaretStyle) - caretStyle = NULL; - - if (start == len) { - /* force recheck extra line state: */ - graphicMaybeInvalid = TRUE; - graphicMaybeInvalidForce = TRUE; - } - - if (deletedLine) { - if (!graphicMaybeInvalid) - graphicMaybeInvalid = TRUE; - NeedRefresh(start); - } else - RefreshByLineDemand(); - - if (!modified) - SetModified(TRUE); - - AfterDelete(start, dellen); - - if (updateCursor) - if (admin) - admin->UpdateCursor(); - - return; - - give_up: - writeLocked = FALSE; - flowLocked = FALSE; - - return; -} - -void wxMediaEdit::Delete(long start, long end, Bool scrollOk) -{ - _Delete(start, end, TRUE, scrollOk); -} - -void wxMediaEdit::Delete() -{ - Bool dstreak, streak = (startpos == endpos), dfs; - - dstreak = deletionStreak; - dfs = deleteForceStreak; - - EndStreaks(wxSTREAK_EXCEPT_DELAYED); - deleteForceStreak = dstreak; - Delete(startpos, (endpos == startpos) ? -1 : endpos); - - deleteForceStreak = dfs; - deletionStreak = streak; -} - -void wxMediaEdit::Erase(void) -{ - Delete(0, len); -} - -void wxMediaEdit::Clear() -{ - Delete(startpos, endpos); -} - -void wxMediaEdit::Cut(Bool extend, long time, long start, long end) -{ - if (start < 0) - start = startpos; - if (end < 0) - end = endpos; - if (end > len) - end = len; - if (start >= end) - return; - Copy(extend, time, start, end); - Delete(start, end); -} - -void wxMediaEdit::Cut(Bool extend, long time) -{ - Cut(extend, time, -1); -} - -void wxMediaEdit::DoCopy(long startp, long endp, long time, Bool extend) -{ - wxSnip *start, *end; - wxSnip *asnip, *snip; - wxStyleList *sl; - Bool wl, fl; - - if (startp < 0) - startp = 0; - if (endp > len) - endp = len; - if (endp <= startp) - return; - - MakeSnipset(startp, endp); - - sl = (extend && wxmb_copyStyleList) ? wxmb_copyStyleList : styleList; - - wxmb_commonCopyRegionData = GetRegionData(startp, endp); - - start = FindSnip(startp, +1); - end = FindSnip(endp, +2); - - wl = writeLocked; - fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - for (snip = start; PTRNE(snip, end); snip = snip->next) { - asnip = snip->Copy(); - SnipSetAdmin(asnip, NULL); - asnip->style = sl->Convert(asnip->style); - wxmb_commonCopyBuffer->Append(asnip); - wxmb_commonCopyBuffer2->Append(GetSnipData(snip)); - } - - writeLocked = wl; - flowLocked = fl; - - InstallCopyBuffer(time, sl); -} - -void wxMediaEdit::Copy(Bool extend, long time, long startp, long endp) -{ - if (startp < 0) - startp = startpos; - if (endp < 0) - endp = endpos; - if (endp > len) - endp = len; - if (startp >= endp) - return; - - BeginCopyBuffer(); - - if (!extend) - FreeOldCopies(); - - DoCopy(startp, endp, time, extend); - - EndCopyBuffer(); -} - -void wxMediaEdit::Copy(Bool extend, long time) -{ - Copy(extend, time, -1); -} - -void wxMediaEdit::DoGenericPaste(wxClipboard *cb, long start, long time) -{ - long delta; - - readInsert = readInsertStart = start; - - delta = len; - - DoBufferPaste(cb, time, FALSE); - - delta = len - delta; - - prevPasteStart = start; - prevPasteEnd = start + delta; -} - -void wxMediaEdit::DoPaste(long start, long time) -{ - DoGenericPaste(wxTheClipboard, start, time); -} - -void wxMediaEdit::DoPasteSelection(long start, long time) -{ -#ifdef wx_xt - DoGenericPaste(wxTheSelection, start, time); -#else - DoGenericPaste(wxTheClipboard, start, time); -#endif -} - -void wxMediaEdit::GenericPaste(Bool x_sel, long time, long start, long end) -{ - int savePrevPaste; - - if (end < 0) - end = (start < 0) ? endpos : start; - if (start < 0) - start = endpos; - if (end > len) - end = len; - if (start > end) - return; - - BeginEditSequence(); - - if (start < end) - Delete(start, end); - - if (x_sel) - DoPasteSelection(start, time); - else - DoPaste(start, time); - - savePrevPaste = prevPasteStart; - - EndEditSequence(); - - prevPasteStart = savePrevPaste; -} - -void wxMediaEdit::Paste(long time, long start, long end) -{ - GenericPaste(0, time, start, end); -} - -void wxMediaEdit::PasteSelection(long time, long start, long end) -{ - GenericPaste(1, time, start, end); -} - -void wxMediaEdit::InsertPasteSnip(wxSnip *snip, wxBufferData *data) -{ - int addpos = snip->count; - - Insert(snip, readInsert); - if (data) { - wxSnip *fsnip; - fsnip = FindSnip(readInsert, +1); - SetSnipData(fsnip, data); - } - readInsert += addpos; -} - -void wxMediaEdit::PasteRegionData(wxBufferData *data) -{ - SetRegionData(readInsertStart, readInsert, data); -} - -void wxMediaEdit::InsertPasteString(wxchar *str) -{ -#ifdef wx_msw - /* Change cr/lf to just lf: */ - int i, offset = 0; - for (i = 0; str[i]; i++) { - if (str[i] == '\r' && str[i + 1] == '\n') { - str[i + offset] = '\n'; - i++; - --offset; - } else if (offset) - str[i + offset] = str[i]; - } - str[i + offset] = 0; -#endif - - /* Change non-breaking space to space: */ - { - int i; - for (i = 0; str[i]; i++) { - if (str[i] == 160) - str[i] = 32; - } - } - - Insert(str, readInsert); - readInsert += wxstrlen(str); -} - -void wxMediaEdit::Paste(long time) -{ - Paste(time, startpos, endpos); -} - -void wxMediaEdit::PasteSelection(long time) -{ - PasteSelection(time, startpos, endpos); -} - -void wxMediaEdit::PasteNext(void) -{ - long start, end, delta; - - if (prevPasteStart < 0) - return; - - start = prevPasteStart; - end = prevPasteEnd; - - CopyRingNext(); - - BeginEditSequence(); - - Delete(start, end); - - readInsert = readInsertStart = start; - - delta = len; - - DoBufferPaste(wxTheClipboard, 0, TRUE); - - EndEditSequence(); - - delta = len - delta; - - prevPasteStart = start; - prevPasteEnd = start + delta; -} - -void wxMediaEdit::Kill(long time, long start, long end) -{ - int streak; - wxchar *text; - - if ((start < 0) != (end < 0)) - return; - - streak = killStreak; - - BeginEditSequence(); - if (start < 0) { - int newend; - newend = ParagraphEndPosition(PositionParagraph(endpos, posateol)); - - if (startpos == newend) - SetPosition(startpos, startpos + 1, FALSE, TRUE, wxLOCAL_SELECT); - else { - long i; - - SetPosition(startpos, newend, FALSE, TRUE, wxLOCAL_SELECT); - text = GetText(startpos, endpos); - for (i = endpos - startpos; i--; ) { - if (!isspace(text[i])) - break; - } - - if (i < 0) { - /* Line has all spaces: move one more */ - SetPosition(startpos, endpos + 1, FALSE, TRUE, wxLOCAL_SELECT); - } - } - start = startpos; - end = endpos; - } - Cut(streak, time, start, end); - EndEditSequence(); - - killStreak = TRUE; -} - -void wxMediaEdit::Kill(long time) -{ - Kill(time, -1, -1); -} - -void wxMediaEdit::SelectAll(void) -{ - SetPosition(0, len); -} - - -void wxMediaEdit::SplitSnip(long pos) -{ - Bool wl; - - if (flowLocked) - return; - - if (pos <= 0) - return; - if (pos >= len) - return; - - wl = writeLocked; - - writeLocked = TRUE; - flowLocked = TRUE; - MakeSnipset(pos, pos); - writeLocked = wl; - flowLocked = FALSE; -} - -Bool wxMediaEdit::ReallyCanEdit(int op) -{ - if (readLocked) - return FALSE; - - if (op != wxEDIT_COPY) { - if (flowLocked || writeLocked) - return FALSE; - } - - switch(op) { - case wxEDIT_CLEAR: - case wxEDIT_CUT: - case wxEDIT_COPY: - if (startpos == endpos) - return FALSE; - break; - case wxEDIT_PASTE: - break; - case wxEDIT_KILL: - if (endpos == len) - return FALSE; - break; - case wxEDIT_SELECT_ALL: - if (!len) - return 0; - } - - return TRUE; -} - -double wxMediaEdit::GetRevisionNumber() -{ - return revision_count; -} - -/****************************************************************/ - -wxchar *wxMediaEdit::GetFlattenedText(long *got) -{ - return GetText(-1, -1, TRUE, FALSE, got); -} - -wxchar *wxMediaEdit::GetText(long start, long end, Bool flatt, Bool forceCR, long *got) -{ - wxSnip *snip; - long count, sPos, p, num, offset, total; - long alloc; - wxchar *s, *t, *old; - Bool wl, fl; - - if (readLocked) { - if (got) - *got = 0; - return wx_empty_wxstr; - } - - if (start < 0) - start = 0; - if (end < 0) - end = len; - - if (start > len) - start = len; - if (end < start) - end = start; - - if (end > len) - end = len; - - count = end - start; - - if (!flatt) { - s = new WXGC_ATOMIC wxchar[count + 1]; - s[count] = 0; - alloc = count + 1; - } else { - alloc = 2 * count; - if (!alloc) - alloc = 2; - s = new WXGC_ATOMIC wxchar[alloc]; - s[0] = 0; - } - - if (!count) { - if (got) - *got = 0; - return s; - } - - wl = writeLocked; - fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - snip = FindSnip(start, +1, &sPos); - offset = start - sPos; - num = ((snip->count - offset <= count) ? snip->count - offset : count); - if (!flatt) { - snip->GetTextBang(s, offset, num, 0); - p = num; - } else { - int add_newline; - - t = snip->GetText(offset, num, TRUE); - p = wxstrlen(t); - if (forceCR && (snip->flags & wxSNIP_NEWLINE) - && !(snip->flags & wxSNIP_HARD_NEWLINE)) { - p++; - add_newline = 1; - } else - add_newline = 0; - if (p >= alloc) { - alloc = 2 * p; - s = new WXGC_ATOMIC wxchar[alloc]; - } - memcpy(s, t, (p - add_newline) * sizeof(wxchar)); - if (add_newline) - s[p - 1] = '\n'; - } - total = num; - snip = snip->next; - while (snip && (count > total)) { - num = ((total + snip->count <= count) ? snip->count : count - total); - if (!flatt) { - /* Precise GC: can't write directly to s + p. (And we don't - want to chage the interface to take a string offset.) */ - if (num < 256) { - wxchar buffer[256]; - snip->GetTextBang(buffer, 0, num, 0); - memcpy(s + p, buffer, num * sizeof(wxchar)); - } else { - wxchar *ss; - ss = new WXGC_ATOMIC wxchar[num]; - snip->GetTextBang(ss, 0, num, 0); - memcpy(s + p, ss, num * sizeof(wxchar)); - } - p += num; - } else { - int add_newline; - - t = snip->GetText(0, num, TRUE); - offset = wxstrlen(t); - - if (forceCR && (snip->flags & wxSNIP_NEWLINE) - && !(snip->flags & wxSNIP_HARD_NEWLINE)) { - offset++; - add_newline = 1; - } else - add_newline = 0; - - if (p + offset >= alloc) { - alloc = 2 * (p + offset); - old = s; - s = new WXGC_ATOMIC wxchar[alloc]; - memcpy(s, old, p * sizeof(wxchar)); - } - - memcpy(s + p, t, offset * sizeof(wxchar)); - if (add_newline) - s[p + offset - 1] = '\n'; - p += offset; - } - total += num; - snip = snip->next; - } - - writeLocked = wl; - flowLocked = fl; - - if (flatt) - s[p] = 0; - - if (got) - *got = p; - - return s; -} - -char *wxMediaEdit::GetTextUTF8(long start, long end, Bool flatt, Bool forceCR, long *_got) -{ - wxchar *s; - long got, l; - char *r = NULL; - - s = GetText(start, end, flatt, forceCR, &got); - wxme_utf8_encode(s, got, &r, &l); - - if (_got) - *_got = l; - - return r; -} - -wxchar wxMediaEdit::GetCharacter(long start) -{ - wxSnip *snip; - long sPos; - wxchar buffer[2]; - - if (readLocked) - return 0; - - if (start < 0) - start = 0; - else if (start >= len) - return 0; - - snip = FindSnip(start, +1, &sPos); - snip->GetTextBang(buffer, start - sPos, 1, 0); - - return buffer[0]; -} - -char wxMediaEdit::GetTruncatedCharacter(long start) -{ - wxchar c; - c = GetCharacter(start); - if (c < 256) - return c; - else - return 255; -} - -/****************************************************************/ - -wxClickback::wxClickback() : wxObject(WXGC_NO_CLEANUP) -{ -} - -void wxMediaEdit::SetClickback(long start, long end, - wxClickbackFunc f, void *d, - wxStyleDelta *delta, - Bool callOnDown) -{ - wxClickback *click; - - click = new WXGC_PTRS wxClickback; - click->start = start; - click->end = end; - click->f = f; - click->data = d; - click->callOnDown = callOnDown; - - click->delta = new WXGC_PTRS wxStyleDelta; - if (delta) - click->delta->Copy(delta); - - SetClickback(click); -} - -void wxMediaEdit::SetClickback(wxClickback *click) -{ - if (!clickbacks) { - clickbacks = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - } - - clickbacks->Append(click); -} - -void wxMediaEdit::RemoveClickback(long start, long end) -{ - wxNode *node, *next; - wxClickback *click; - - if (!clickbacks) return; - - for (node = clickbacks->First(); node; node = next) { - next = node->Next(); - click = (wxClickback *)node->Data(); - if (click->start == start && click->end == end) { - DELETE_OBJ click; - clickbacks->DeleteNode(node); - } - } -} - -void wxMediaEdit::CallClickback(long start, long end) -{ - wxNode *node; - wxClickback *click; - - if ((start > end) || !clickbacks) - return; - - for (node = clickbacks->First(); node; node = node->Next()) { - click = (wxClickback *)node->Data(); - if (click->start <= start && click->end >= end) { - click->f(this, click->start, click->end, click->data); - return; - } - } -} - -/****************************************************************/ - -void wxMediaEdit::FlashOn(long start, long end, Bool ateol, Bool scroll, - long timeout) -{ - _SetPosition(TRUE, 0, start, end, ateol, scroll, wxDEFAULT_SELECT); - if (timeout > 0) { - flashautoreset = TRUE; - if (flashTimer) { - flashTimer->Stop(); - DELETE_OBJ flashTimer; - } - flashTimer = new WXGC_PTRS wxMediaFlashTimer(); - flashTimer->media = this; - flashTimer->Start(timeout); - } - flashscroll = scroll; -} - -void wxMediaEdit::FlashOff(void) -{ - if (!flash) - return; - flashautoreset = TRUE; - flashdirectoff = TRUE; - _SetPosition(FALSE, 0, startpos, endpos, posateol, flashscroll, wxDEFAULT_SELECT); -} - -/****************************************************************/ - -void StandardWordbreak(wxMediaEdit *win, long *startp, long *endp, - int reason, void *) -{ - long pstart, start, lstart, tstart, end, lend, tend; - wxchar *text; - wxMediaWordbreakMap *wordBreakMap; - - wordBreakMap = win->GetWordbreakMap(); - -#define nonbreak(x) (((x > 255) ? 1 : (wordBreakMap ? wordBreakMap->map : wxTheMediaWordbreakMap->map)[x] & reason)) - /* Try looking at only MAX_DIST_TRY chars. If that fails, then - look until a newline. */ -#define MAX_DIST_TRY 30 - - if (startp) { - int phase1_complete = 0, phase2_complete = 0; - - pstart = start = *startp; - - lstart = win->FindNewline(-1, start); - if (lstart < 0) - lstart = 0; - else if (reason == wxBREAK_FOR_CARET) { - lstart = win->FindNewline(-1, lstart - 1); - if (lstart < 0) - lstart = 0; - } - lend = win->LastPosition(); - if (start + 1 < lend) - lend = start + 1; - - if (start - lstart > MAX_DIST_TRY) - tstart = start - MAX_DIST_TRY; - else - tstart = lstart; - - text = win->GetText(tstart, lend); - - start -= tstart; - pstart -= tstart; - - try_start_again: - - if (!phase1_complete) { - if (start && nonbreak(text[start])) - --start; - if (!nonbreak(text[start])) - phase1_complete = 1; - } - if (reason != wxBREAK_FOR_SELECTION) { - if (!phase2_complete) { - while (start && !nonbreak(text[start])) { - --start; - } - if (nonbreak(text[start])) - phase2_complete = 1; - } - } - while (start && nonbreak(text[start])) { - --start; - } - if ((start < pstart) && !nonbreak(text[start])) - start++; - - if (!start && (tstart != lstart)) { - start += (tstart - lstart); - pstart += (tstart - lstart); - text = win->GetText(lstart, lend); - tstart = lstart; - goto try_start_again; - } - - *startp = start + tstart; - } - - if (endp) { - int phase1_complete = 0; - - end = *endp; - - lstart = end; - lend = win->FindNewline(1, end); - if (lend < 0) - lend = win->LastPosition(); - else if (reason == wxBREAK_FOR_CARET) { - lend = win->FindNewline(1, lend + 1); - if (lend < 0) - lend = win->LastPosition(); - } - - if (lend - end > MAX_DIST_TRY) - tend = end + MAX_DIST_TRY; - else - tend = lend; - - text = win->GetText(lstart, tend); - - end -= lstart; - lend -= lstart; - tend -= lstart; - - try_end_again: - - if (!phase1_complete) { - while ((end < tend) && !nonbreak(text[end])) { - end++; - } - if (end < tend) - phase1_complete = 1; - } - while ((end < tend) && nonbreak(text[end])) { - end++; - } - - if ((end == tend) && (tend != lend)) { - text = win->GetText(lstart, lstart + lend); - tend = lend; - goto try_end_again; - } - - *endp = end + lstart; - } -} - -/****************************************************************/ - -void wxMediaEdit::SetWordbreakFunc(wxWordbreakFunc f, void *data) -{ - wordBreak = f; - wordBreakData = data; -} - -void wxMediaEdit::FindWordbreak(long *start, long *end, int reason) -{ - long oldstart, oldend; - - if (readLocked) - return; - - oldstart = start ? *start : 0; - oldend = end ? *end : 0; - - wordBreak(this, start, end, reason, wordBreakData); - - if (start && *start > oldstart) - *start = oldstart; - if (end && *end < oldend) - *end = oldend; -} - -wxMediaWordbreakMap *wxMediaEdit::GetWordbreakMap(void) -{ - return wordBreakMap; -} - -void wxMediaEdit::SetWordbreakMap(wxMediaWordbreakMap *map) -{ - wordBreakMap = map; - - if (!map) - return; -} - -/****************************************************************/ - -void wxMediaEdit::SetLineSpacing(double s) -{ - if (flowLocked) - return; - - if (s != lineSpacing) { - lineSpacing = s; - SizeCacheInvalid(); - changed = TRUE; - NeedRefresh(-1, -1); - } -} - -double wxMediaEdit::GetMaxWidth() -{ - if (maxWidth <= 0) - return 0.0; - else - return maxWidth + wrapBitmapWidth; -} - -double wxMediaEdit::GetMinWidth() -{ - return minWidth; -} - -void wxMediaEdit::SetMaxWidth(double w) -{ - if (flowLocked) - return; - - if (wrapBitmapWidth && (w > 0)) { - w -= wrapBitmapWidth; - if (w <= 0.0) - w = CURSOR_WIDTH + 1; - } - - if ((w == maxWidth) || ((w <= 0) && (maxWidth <= 0))) - return; - - if (!CanSetSizeConstraint()) - return; - OnSetSizeConstraint(); - - if (w > 0 && w < (CURSOR_WIDTH + 1)) - w = CURSOR_WIDTH + 1; - maxWidth = w; - flowInvalid = TRUE; - if (!graphicMaybeInvalid) - graphicMaybeInvalid = TRUE; - changed = TRUE; - NeedRefresh(-1, -1); - - AfterSetSizeConstraint(); -} - -void wxMediaEdit::SetMinWidth(double w) -{ - if (flowLocked) - return; - - if (w == minWidth || ((w <= 0) && (minWidth <= 0))) - return; - - if (!CanSetSizeConstraint()) - return; - OnSetSizeConstraint(); - - graphicMaybeInvalid = TRUE; - graphicMaybeInvalidForce = TRUE; - minWidth = w; - changed = TRUE; - NeedRefresh(-1,-1); - - AfterSetSizeConstraint(); -} - -void wxMediaEdit::SetMinHeight(double h) -{ - if (flowLocked) - return; - - if (h == minHeight || ((h <= 0) && (minHeight <= 0))) - return; - - if (!CanSetSizeConstraint()) - return; - OnSetSizeConstraint(); - - graphicMaybeInvalid = TRUE; - graphicMaybeInvalidForce = TRUE; - minHeight = h; - changed = TRUE; - NeedRefresh(-1,-1); - - AfterSetSizeConstraint(); -} - -void wxMediaEdit::SetMaxHeight(double h) -{ - if (flowLocked) - return; - - if (h == maxHeight || ((h <= 0) && (maxHeight <= 0))) - return; - - if (!CanSetSizeConstraint()) - return; - OnSetSizeConstraint(); - - graphicMaybeInvalid = TRUE; - graphicMaybeInvalidForce = TRUE; - maxHeight = h; - changed = TRUE; - NeedRefresh(-1,-1); - - AfterSetSizeConstraint(); -} - -double wxMediaEdit::GetMinHeight() -{ - return minHeight; -} - -double wxMediaEdit::GetMaxHeight() -{ - return maxHeight; -} - -/****************************************************************/ - -int wxMediaEdit::InsertPort(Scheme_Object *f, int format, Bool replaceStyles) -{ - if (writeLocked || userLocked) - return FALSE; - - InsertFile("insert-file in text%", f, NULL, &format, replaceStyles, TRUE); - - return format; -} - -Bool wxMediaEdit::InsertFile(const char *who, Scheme_Object *f, char *WXUNUSED(file), - int *format, Bool clearStyles, Bool showErrors) -{ - long n; - const int BUF_SIZE = 1000; - wxchar buffer[BUF_SIZE]; - Bool fileerr; - - if (*format == wxMEDIA_FF_GUESS) { - if (!wxDetectWXMEFile(who, f, 1)) { - *format = wxMEDIA_FF_TEXT; - } else { - *format = wxMEDIA_FF_STD; - } - } - - fileerr = FALSE; - - showErrors = TRUE; - - if (*format == wxMEDIA_FF_STD) { - if (!wxDetectWXMEFile(who, f, 1)) { - if (showErrors) { - char ebuf[256]; - sprintf(ebuf, "%s: not a MrEd editor<%%> file", who); - wxmeError(ebuf); - } - *format = wxMEDIA_FF_TEXT; - } else { - wxMediaStreamInFileBase *b; - wxMediaStreamIn *mf; - - wxDetectWXMEFile(who, f, 0); - - b = new WXGC_PTRS wxMediaStreamInFileBase(f); - mf = new WXGC_PTRS wxMediaStreamIn(b); - - if (wxReadMediaVersion(mf, b, FALSE, showErrors)) { - if (wxReadMediaGlobalHeader(mf)) { - if (mf->Ok()) - fileerr = !ReadFromFile(mf, clearStyles); - else - fileerr = TRUE; - } else - fileerr = TRUE; - fileerr = !wxReadMediaGlobalFooter(mf) || fileerr; - - /* If STD_STYLE wasn't loaded, re-create it: */ - styleList->NewNamedStyle(STD_STYLE, NULL); - - fileerr = fileerr || !mf->Ok(); - } else - fileerr = TRUE; - } - } - - if (*format == wxMEDIA_FF_TEXT || *format == wxMEDIA_FF_TEXT_FORCE_CR) { - int savecr = 0; - while (1) { - buffer[0] = '\r'; - - n = scheme_get_char_string(who, f, buffer+ savecr, 0, BUF_SIZE - savecr, 0, NULL); - - if ((n == EOF) || !n) - break; - else { - n += savecr; - if ((n > 1) && (buffer[n - 1] == '\r')) { - savecr = 1; - --n; - } else - savecr = 0; - - { - int i; - for (i = 0; i < n - 1; i++) { - if ((buffer[i] == '\r') && (buffer[i + 1] == '\n')) { - memmove(buffer + i + 1, buffer + i + 2, (n - i - 2) * sizeof(wxchar)); - --n; - } - } - } - Insert(n, buffer); - } - } - if (savecr) - Insert(1, "\r"); - } - - if (fileerr && showErrors) { - char ebuf[256]; - sprintf(ebuf, "%s: error loading the file", who); - wxmeError(ebuf); - } - - return !fileerr; -} - -Bool wxMediaEdit::SavePort(Scheme_Object *f, int format, Bool showErrors) -{ - Bool fileerr; - - showErrors = TRUE; - - if (readLocked) { - if (showErrors) - wxmeError("save-file in text%: editor locked for reading"); - return FALSE; - } - - if ((format == wxMEDIA_FF_SAME) || (format == wxMEDIA_FF_GUESS) - || (format == wxMEDIA_FF_COPY)) - format = fileFormat; - - fileerr = FALSE; - - if (format == wxMEDIA_FF_TEXT || format == wxMEDIA_FF_TEXT_FORCE_CR) { - wxchar *us; - us = GetText(-1, -1, TRUE, format == wxMEDIA_FF_TEXT_FORCE_CR); - scheme_put_char_string("save-file", f, us, 0, wxstrlen(us)); - } else { - wxMediaStreamOutFileBase *b; - wxMediaStreamOut *mf; - - b = new WXGC_PTRS wxMediaStreamOutFileBase(f); - mf = new WXGC_PTRS wxMediaStreamOut(b); - - wxWriteMediaVersion(mf, b); - - wxWriteMediaGlobalHeader(mf); - if (mf->Ok()) - fileerr = !WriteToFile(mf); - wxWriteMediaGlobalFooter(mf); - - fileerr = fileerr || !mf->Ok(); - } - - if (fileerr && showErrors) - wxmeError("save-file in text%: error writing the file"); - - return !fileerr; -} - -Bool wxMediaEdit::ReadFromFile(wxMediaStreamIn *f, long start, Bool overwritestyle) -{ - Bool result; - - if (writeLocked) - return FALSE; - - if (start < 0) - start = startpos; - - readInsert = start; - - result = ReadSnipsFromFile(f, overwritestyle); - - if (!LastPosition()) { - /* We probably destructively changed the style list. Reset the dummy snip. */ - snips->style = GetDefaultStyle(); - if (!snips->style) { - snips->style = styleList->BasicStyle(); - } - } - - return result; -} - -Bool wxMediaEdit::ReadFromFile(wxMediaStreamIn *f, Bool owrs) -{ - return ReadFromFile(f, -1, owrs); -} - - -Bool wxMediaEdit::ReadInsert(wxSnip *snip) -{ - int addpos = snip->count; - - Insert(snip, readInsert); - readInsert += addpos; - - return TRUE; -} - -Bool wxMediaEdit::ReadInsert(wxList *snipsl) -{ - int oldlen = len; - - Insert(snipsl, readInsert); - readInsert += (len - oldlen); - - return TRUE; -} - -Bool wxMediaEdit::WriteToFile(wxMediaStreamOut *f, long start, long end) -{ - wxSnip *startSnip, *endSnip; - - if (readLocked) - return FALSE; - - if (start < 0) - start = 0; - if (end < 0) - end = len; - if (end < start) - end = start; - - startSnip = FindSnip(start, +1); - endSnip = FindSnip(end, +2); - if (!snips->count) - startSnip = endSnip = NULL; - - if (!DoWriteHeadersFooters(f, TRUE)) - return FALSE; - - wxmbWriteSnipsToFile(f, styleList, NULL, startSnip, endSnip, NULL, this); - - if (!DoWriteHeadersFooters(f, FALSE)) - return FALSE; - - return TRUE; -} - -Bool wxMediaEdit::WriteToFile(wxMediaStreamOut *f) -{ - return WriteToFile(f, -1); -} - -int wxMediaEdit::GetFileFormat(void) -{ - return fileFormat; -} - -void wxMediaEdit::SetFileFormat(int format) -{ - if (format == wxMEDIA_FF_STD - || format == wxMEDIA_FF_TEXT - || format == wxMEDIA_FF_TEXT_FORCE_CR) - fileFormat = format; -} - -void wxMediaEdit::SetFilename(char *name, Bool temp) -{ - wxSnip *snip; - Bool wl, fl; - char *fn; - - fn = (name ? copystring(name) : (char *)NULL); - filename = fn; - tempFilename = temp; - - wl = writeLocked; - fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - for (snip = snips; snip; snip = snip->next) { - if (snip->flags & wxSNIP_USES_BUFFER_PATH) - snip->SetAdmin(snipAdmin); - } - - writeLocked = wl; - flowLocked = fl; -} - -wxBufferData *wxMediaEdit::GetRegionData(long WXUNUSED(start), long WXUNUSED(end)) -{ - return NULL; -} - -void wxMediaEdit::SetRegionData(long WXUNUSED(start), long WXUNUSED(end), - wxBufferData *) -{ -} - -/****************************************************************/ - -double *wxMediaEdit::GetTabs(int *count, double *space, Bool *inUnits) -{ - if (count) - *count = tabcount; - - if (space) - *space = tabSpace; - - if (inUnits) - *inUnits = tabSpaceInUnits; - - return tabs; -} - -void wxMediaEdit::SetTabs(double *newtabs, int count, - double tabWidth, Bool inUnits) -{ - if (flowLocked) - return; - - tabs = newtabs; - tabcount = count; - - if (tabWidth >= 1) - tabSpace = tabWidth; - else - tabSpace = wxTAB_WIDTH; - - tabSpaceInUnits = inUnits; - - SizeCacheInvalid(); - changed = TRUE; - NeedRefresh(-1, -1); -} - -/****************************************************************/ - -long wxMediaEdit::FindPositionInLine(long i, double x, Bool *ateol, Bool *onit, - double *how_close) -{ - return _FindPositionInLine(FALSE, i, x, ateol, onit, how_close); -} - -long wxMediaEdit::_FindPositionInSnip(wxDC *dc, double X, double Y, - wxSnip *snip, double x, - double *how_close) -{ - long offset, range, i; - Bool wl, fl; - - if (readLocked) - return 0; - - if (x < 0) { - if (how_close) - *how_close = -100; - return 0; - } - - wl = writeLocked; - fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - if (snip->PartialOffset(dc, X, Y, snip->count) <= x) { - if (how_close) - *how_close = 100; - writeLocked = wl; - flowLocked = fl; - return snip->count; - } - - /* Binary search for position within snip: */ - range = snip->count; - i = range / 2; - offset = 0; - - while (1) { - double dl, dr; - - dl = snip->PartialOffset(dc, X, Y, offset + i); - if (dl > x) - range = i; - else { - dr = snip->PartialOffset(dc, X, Y, offset + i + 1); - if (dr <= x) { - offset += i; - range -= i; - } else { - if (how_close) { - if (dr - x < x - dl) - *how_close = dr - x; - else - *how_close = dl - x; - } - break; - } - } - - i = range / 2; - } - - writeLocked = wl; - flowLocked = fl; - - return i + offset; -} - -long wxMediaEdit::FindLine(double y, Bool *onit) -{ - if (onit) - *onit = FALSE; - - if (!CheckRecalc(TRUE, FALSE)) - return 0; - - if (y <= 0) - return 0; - if ((y >= totalHeight) || (extraLine && y >= totalHeight - extraLineH)) - return numValidLines - (extraLine ? 0 : 1); - - if (onit) - *onit = TRUE; - - { - wxMediaLine *line; - line = lineRoot->FindLocation(y); - return line->GetLine(); - } -} - -long wxMediaEdit::FindPosition(double x, double y, Bool *ateol, Bool *onit, - double *how_close) -{ - long i, p; - Bool online; - - if (readLocked) - return 0; - - if (ateol) - *ateol = FALSE; - - i = FindLine(y, &online); - if ((i >= numValidLines - 1) && !online && (y > 0)) { - if (onit) - *onit = FALSE; - if (how_close) - *how_close = 100; - return len; - } - - p = FindPositionInLine(i, x, ateol, onit, how_close); - if (onit) - *onit = online && *onit; - - return p; -} - -long wxMediaEdit::PositionLine(long start, Bool eol) -{ - wxMediaLine *line; - - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - if (start <= 0) - return 0; - if (start >= len) { - if (extraLine && !eol) - return numValidLines; - else - return numValidLines - 1; - } - - line = lineRoot->FindPosition(start); - if (eol && (line->GetPosition() == start)) - line = line->prev; - - return line->GetLine(); -} - -void wxMediaEdit::PositionLocations(long start, - double *tx, double *ty, - double *bx, double *by, - Bool eol, Bool wholeLine) -{ - double horiz, h, descent, space, topy; - int align; - wxMediaLine *line; - wxSnip *snip; - wxDC *dc; - Bool wl, fl; - - if (!CheckRecalc(TRUE, FALSE)) - return; - - /* Handle boundary cases first: */ - - if (start <= 0) { - if (wholeLine) { - if (tx || bx) { - double xl; - xl = firstLine->GetLeftLocation(maxWidth); - if (tx) *tx = xl; - if (bx) *bx = xl; - } - if (ty || by) { - double yl; - yl = firstLine->GetLocation(); - if (ty) *ty = yl; - if (by) *by = yl + firstLine->h; - } - return; - } - line = firstLine; - } else if (start >= len) { - if (extraLine && !eol) { - if (ty) *ty = totalHeight - extraLineH; - if (by) *by = totalHeight; - if (tx) *tx = 0; - if (bx) *bx = 0; - return; - } - - line = lastLine; - - if (wholeLine || !len) { - if (tx || bx) { - double xl; - xl = line->GetRightLocation(maxWidth); - if (tx) *tx = xl; - if (bx) *bx = xl; - } - if (ty || by) { - double yl; - yl = lastLine->GetLocation(); - if (ty) *ty = yl; - if (by) *by = yl + lastLine->h; - } - return; - } - } else { - line = lineRoot->FindLine(PositionLine(start, eol)); - - if (wholeLine) { - if (by || ty) { - double yl; - yl = line->GetLocation(); - if (ty) *ty = yl; - if (by) *by = yl + line->h; - } - if (!tx && !bx) - return; - } - } - - dc = NULL; - - wl = writeLocked; - fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - horiz = line->GetLeftLocation(maxWidth); - topy = line->GetLocation(); - - start -= line->GetPosition(); - if (!start) { - snip = line->snip; - } else if (start >= line->len) { - horiz += (line->w - line->lastW); - snip = line->lastSnip; - } else { - /* linear seach for snip */ - snip = NULL; - - while(1) { - snip = snip ? snip->next : line->snip; - - if ((start > snip->count) - || ((wholeLine || start) && start == snip->count)) { - double v; - - start -= snip->count; - if (!dc) { - dc = admin->GetDC(); - if (!dc) { - writeLocked = wl; - flowLocked = fl; - return; - } - } - - v = 0.0; - snip->GetExtent(dc, horiz, topy, &v); - horiz += v; - } else - break; - } - } - - - if (tx || bx) { - double xv; - - if (start && !dc) { - dc = admin->GetDC(); - if (!dc) { - writeLocked = wl; - flowLocked = fl; - return; - } - } - - xv = horiz + (start ? snip->PartialOffset(dc, horiz, topy, start) : 0); - if (tx) *tx = xv; - if (bx) *bx = xv; - } - - if (!wholeLine && (ty || by)) { - if (!dc) { - dc = admin->GetDC(); - if (!dc) { - writeLocked = wl; - flowLocked = fl; - return; - } - } - h = descent = space = 0.0; - snip->GetExtent(dc, horiz, topy, NULL, &h, &descent, &space); - align = snip->style->GetAlignment(); - if (align == wxALIGN_BOTTOM) { - double yl; - yl = topy + line->bottombase + descent; - if (ty) *ty = yl - h; - if (by) *by = yl; - } else if (align == wxALIGN_TOP) { - double yl; - yl = topy + line->topbase - space; - if (ty) *ty = yl; - if (by) *by = yl + h; - } else { - double yl; - h = (h - descent - space) / 2; - yl = topy + ((line->topbase + line->bottombase) / 2); - if (ty) *ty = yl - h - space; - if (by) *by = yl + h + descent; - } - } - - writeLocked = wl; - flowLocked = fl; -} - -void wxMediaEdit::PositionLocation(long start, double *x, double *y, - Bool top, Bool eol, Bool wholeLine) -{ - PositionLocations(start, - top ? x : NULL, top ? y : NULL, - top ? NULL : x, top ? NULL : y, - eol, wholeLine); -} - -double wxMediaEdit::LineLocation(long i, Bool top) -{ - wxMediaLine *line; - double y; - - if (!CheckRecalc(TRUE, FALSE)) - return 0.0; - - if (i < 0) - return 0; - else if (i > numValidLines) - return totalHeight; - else if (i == numValidLines) { - if (extraLine) - return totalHeight - extraLineH; - return totalHeight; - } - - line = lineRoot->FindLine(i); - y = line->GetLocation(); - - if (top) - return y; - else - return y + line->h; -} - -long wxMediaEdit::LineStartPosition(long i, Bool visibleOnly) -{ - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - if (i < 0) - i = 0; - else if (i >= numValidLines) { - if (extraLine) - return len; - i = numValidLines - 1; - } - - if (visibleOnly) { - wxMediaLine *line; - line = lineRoot->FindLine(i); - return FindFirstVisiblePosition(line); - } else { - wxMediaLine *line; - line = lineRoot->FindLine(i); - return line->GetPosition(); - } -} - -long wxMediaEdit::LineEndPosition(long i, Bool visibleOnly) -{ - wxMediaLine *line; - long p; - - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - if (i < 0) - i = 0; - else if (i >= numValidLines) { - if (extraLine) - return len; - i = numValidLines - 1; - } - - line = lineRoot->FindLine(i); - - p = line->GetPosition() + line->len; - if (visibleOnly) - FindLastVisiblePosition(line, &p); - - return p; -} - -long wxMediaEdit::LineLength(long i) -{ - wxMediaLine *line; - - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - if (i < 0) - return 0; - else if (i >= numValidLines) - return 0; - - line = lineRoot->FindLine(i); - return line->len; -} - -long wxMediaEdit::PositionParagraph(long i, Bool WXUNUSED(eol)) -{ - wxMediaLine *l; - int delta = 0; - - if (!CheckRecalc(FALSE, FALSE, TRUE)) - return 0; - - if (i < 0) - i = 0; - else if (i >= len) { - i = len; - if (extraLine) - delta = 1; - } - - l = lineRoot->FindPosition(i); - - return l->GetParagraph() + delta; -} - -long wxMediaEdit::ParagraphStartPosition(long i, Bool visibleOnly) -{ - wxMediaLine *l; - - if (!CheckRecalc(FALSE, FALSE, TRUE)) - return 0; - - if (i < 0) - i = 0; - - l = lineRoot->FindParagraph(i); - if (!l) { - if (extraLine) - return len; - else { - l = lastLine; - while (l->prev && !l->StartsParagraph()) { - l = l->prev; - } - } - } - - if (visibleOnly) - return FindFirstVisiblePosition(l); - else - return l->GetPosition(); -} - -long wxMediaEdit::ParagraphEndPosition(long i, Bool visibleOnly) -{ - wxMediaLine *l; - long p; - - if (!CheckRecalc(FALSE, FALSE, TRUE)) - return 0; - - if (i < 0) - i = 0; - - l = lineRoot->FindParagraph(i); - if (l) { - while (l->next && !l->next->StartsParagraph()) { - l = l->next; - } - } else { - if (extraLine) - return len; - else - l = lastLine; - } - - p = l->GetPosition() + l->len; - if (visibleOnly) - FindLastVisiblePosition(l, &p); - - return p; -} - -long wxMediaEdit::LineParagraph(long i) -{ - wxMediaLine *l; - - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - if (i < 0) - return 0; - else if (i >= numValidLines) - return lastLine->GetParagraph() + (extraLine ? 1 : 0); - - l = lineRoot->FindLine(i); - - return l->GetParagraph(); -} - -long wxMediaEdit::ParagraphStartLine(long i) -{ - wxMediaLine *l; - - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - if (i < 0) - i = 0; - - l = lineRoot->FindParagraph(i); - if (!l) - return LastLine(); - - return l->GetLine(); -} - -long wxMediaEdit::ParagraphEndLine(long i) -{ - wxMediaLine *l; - - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - if (i < 0) - i = 0; - - l = lineRoot->FindParagraph(i); - if (l) { - while (l->next && !l->next->StartsParagraph()) { - l = l->next; - } - } else - return LastLine(); - - return l->GetLine(); -} - -long wxMediaEdit::LastPosition(void) -{ - return len; -} - -long wxMediaEdit::LastLine(void) -{ - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - return numValidLines - (extraLine ? 0 : 1); -} - -long wxMediaEdit::LastParagraph(void) -{ - if (!CheckRecalc(maxWidth > 0, FALSE, TRUE)) - return 0; - - return lastLine->GetParagraph() + (extraLine ? 1 : 0); -} - -void wxMediaEdit::GetExtent(double *w, double *h) -{ - CheckRecalc(TRUE, FALSE); - - if (w) - *w = totalWidth; - if (h) - *h = totalHeight; -} - -double wxMediaEdit::GetDescent(void) -{ - CheckRecalc(TRUE, FALSE); - - return finalDescent; -} - -double wxMediaEdit::GetSpace(void) -{ - CheckRecalc(TRUE, FALSE); - - return initialSpace; -} - -double wxMediaEdit::GetTopLineBase(void) -{ - CheckRecalc(TRUE, FALSE); - - return initialLineBase; -} - -double wxMediaEdit::ScrollLineLocation(long scroll) -{ - wxMediaLine *line; - long p; - double y; - long total; - - if (readLocked) - return 0; - - CheckRecalc(TRUE, FALSE); - - total = lastLine->GetScroll() + lastLine->numscrolls; - - if (scroll == total) { - if (extraLine) - return totalHeight - extraLineH; - else - return totalHeight; - } else if (scroll > total) - return totalHeight; - - line = lineRoot->FindScroll(scroll); - p = line->GetScroll(); - y = line->GetLocation(); - - if (p < scroll) - y += line->ScrollOffset(scroll - p); - - return y; -} - -long wxMediaEdit::NumScrollLines() -{ - if (readLocked) - return 0; - - CheckRecalc(maxWidth > 0, FALSE, TRUE); - - return lastLine->GetScroll() + lastLine->numscrolls + (extraLine ? 1 : 0); -} - -long wxMediaEdit::FindScrollLine(double p) -{ - wxMediaLine *line; - double y; - long s; - - if (readLocked) - return 0; - - CheckRecalc(TRUE, FALSE); - - if (extraLine && (p >= totalHeight - extraLineH)) - return NumScrollLines() - 1; - - line = lineRoot->FindLocation(p); - s = line->GetScroll(); - - if (line->numscrolls > 1) { - y = line->GetLocation(); - s += line->FindExtraScroll(p - y); - } - - return s; -} - -/****************************************************************/ - -long wxMediaEdit::FindString(wxchar *str, int direction, long start, long end, - Bool bos, Bool caseSens) -{ - if (!CheckRecalc(FALSE, FALSE)) - return -1; - - return _FindStringAll(str, direction, start, end, NULL, TRUE, bos, caseSens); -} - -long wxMediaEdit::FindStringUTF8(char *str, int direction, long start, long end, - Bool bos, Bool caseSens) -{ - long ulen; - wxchar *us = NULL; - wxme_utf8_decode(str, strlen(str), &us, &ulen); - - return FindString(us, direction, start, end, bos, caseSens); -} - -long *wxMediaEdit::FindStringAll(wxchar *str, long *cnt, int direction, - long start, long end, Bool bos, Bool caseSens) -{ - long *positions, cntv; - - if (!CheckRecalc(FALSE, FALSE)) { - *cnt = 0; - return NULL; - } - - cntv = _FindStringAll(str, direction, start, end, &positions, FALSE, - bos, caseSens); - *cnt = cntv; - - if (*cnt < 0) { - *cnt = 0; - positions = NULL; - } - return positions; -} - -long *wxMediaEdit::FindStringAllUTF8(char *str, long *cnt, int direction, - long start, long end, Bool bos, Bool caseSens) -{ - long ulen; - wxchar *us = NULL; - wxme_utf8_decode(str, strlen(str), &us, &ulen); - - return FindStringAll(us, cnt, direction, start, end, bos, caseSens); -} - -long wxMediaEdit::FindNewline(int direction, long start, long end) -{ - long para, pos; - - para = PositionParagraph(start, direction < 0 ? TRUE : FALSE); - - if (direction > 0) - para++; - - pos = ParagraphStartPosition(para); - - if (direction > 0) { - if (pos > end) - return -1; - } else { - if (pos < end) - return -1; - } - - return pos; -} - -/****************************************************************/ - -void wxMediaEdit::ChangeStyle(wxStyleDelta *delta) -{ - ChangeStyle(delta, -1); -} - -void wxMediaEdit::ChangeStyle(wxStyleDelta *delta, long start, long end, Bool counts_as_mod) -{ - _ChangeStyle(start > -1 ? start : startpos, - end > -1 ? end : (start > -1 ? len : endpos), - NULL, delta, 1, counts_as_mod); -} - -void wxMediaEdit::ChangeStyle(wxStyle *style, long start, long end, Bool counts_as_mod) -{ - _ChangeStyle(start > -1 ? start : startpos, - end > -1 ? end : (start > -1 ? len : endpos), - style, NULL, 1, counts_as_mod); -} - -void wxMediaEdit::SetStyleList(wxStyleList *newList) -{ - wxSnip *snip; - wxStyle *style, *baseStyle, *newStyle = NULL; - int count, index, baseIndex; - wxStyle **smap; - wxStyleDelta *delta; - char *name; - - if (writeLocked) - return; - - delta = new WXGC_PTRS wxStyleDelta; - - count = styleList->Number(); - if (count) { - wxStyle *i2s; - smap = new WXGC_PTRS wxStyle*[count]; - i2s = newList->IndexToStyle(0); /* base style maps to base style */ - smap[0] = i2s; - for (index = 1; index < count; index++) { - style = styleList->IndexToStyle(index); - name = style->GetName(); - - if (!name || !(newStyle = newList->FindNamedStyle(name))) { - baseStyle = style->GetBaseStyle(); - baseIndex = styleList->StyleToIndex(baseStyle); - - if (style->IsJoin()) { - int shiftIndex; - wxStyle *ss; - ss = style->GetShiftStyle(); - shiftIndex = styleList->StyleToIndex(ss); - - newStyle = newList->FindOrCreateJoinStyle(smap[baseIndex], smap[shiftIndex]); - } else { - style->GetDelta(delta); - - newStyle = newList->FindOrCreateStyle(smap[baseIndex], delta); - } - if (name) - newStyle = newList->NewNamedStyle(name, newStyle); - } - - smap[index] = newStyle; - } - - for (snip = snips; snip; snip = snip->next) { - style = snip->style; - index = styleList->StyleToIndex(style); - if (index < 0) { - /* Bad! Snip had style not from this buffer's style list */ - snip->style = smap[0]; - } else - snip->style = smap[index]; - } - } - - wxMediaBuffer::SetStyleList(newList); - - SizeCacheInvalid(); - changed = TRUE; - NeedRefresh(-1, -1); -} - -void wxMediaEdit::StyleHasChanged(wxStyle *style) -{ - wxSnip *snip; - Bool wl, fl; - - if (readLocked) - return; - - if (!style) { - /* Our queue to repaint */ - changed = TRUE; - NeedRefresh(-1, -1); - return; - } - - wl = writeLocked; - fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - for (snip = snips; snip; snip = snip->next) { - if (PTREQ(snip->style, style)) { - snip->style = style; - snip->SizeCacheInvalid(); - snip->line->MarkRecalculate(); - if (maxWidth >= 0) { - snip->line->MarkCheckFlow(); - if (snip->line->prev - && !(snip->line->prev->lastSnip->flags & wxSNIP_HARD_NEWLINE)) - snip->line->prev->MarkCheckFlow(); - } - } - } - - writeLocked = wl; - flowLocked = fl; -} - -/****************************************************************/ - -Bool wxMediaEdit::ScrollTo(wxSnip *snip, double localx, double localy, - double w, double h, Bool refresh, int bias) -{ - double x, y; - - if (flowLocked) - return FALSE; - - if (delayRefresh) { - if (admin) { - delayedscroll = -1; - delayedscrollbox = TRUE; - delayedscrollsnip = snip; - delayedscrollX = localx; - delayedscrollY = localy; - delayedscrollW = w; - delayedscrollH = h; - delayedscrollbias = bias; - } - return FALSE; - } else { - if (snip) { - if (!GetSnipPositionAndLocation(snip, NULL, &x, &y)) - return FALSE; - } else - x = y = 0; - if (AdminScrollTo(x + localx, y + localy, w, h, refresh, bias)) { - if (!refresh) - refreshAll = TRUE; - return TRUE; - } else - return FALSE; - } -} - -void wxMediaEdit::Resized(wxSnip *snip, Bool redraw_now) -{ - if (!GetSnipPositionAndLocation(snip, NULL, NULL, NULL)) - return; - - snip->line->MarkRecalculate(); - if (maxWidth >= 0) { - snip->line->MarkCheckFlow(); - /* Maybe something can now move to the previous line. */ - if (snip->line->prev - && !(snip->line->prev->lastSnip->flags & wxSNIP_HARD_NEWLINE)) - snip->line->prev->MarkCheckFlow(); - } - if (!graphicMaybeInvalid) - graphicMaybeInvalid = TRUE; - - if (flowLocked) - redraw_now = FALSE; - - changed = TRUE; - - if (!redraw_now) - delayRefresh++; - RefreshByLineDemand(); - if (!redraw_now) - --delayRefresh; -} - -Bool wxMediaEdit::Recounted(wxSnip *snip, Bool redraw_now) -{ - if (writeLocked) - return FALSE; - - revision_count++; - - Resized(snip, redraw_now); - - return TRUE; -} - -void wxMediaEdit::SetCaretOwner(wxSnip *snip, int dist) -{ - if (DoSetCaretOwner(snip, dist)) { - NeedRefresh(startpos, endpos); /* NeedCaretRefresh(); <- doesn't work; local caret ownership weirdness*/ - OnFocus(!snip); - } -} - -Bool wxMediaEdit::ReleaseSnip(wxSnip *snip) -{ - long pos; - - if ((pos = GetSnipPosition(snip)) < 0) - return FALSE; - - _Delete(pos, pos + snip->count, FALSE, FALSE); - - if (!(snip->admin) && (snip->flags & wxSNIP_OWNED)) - snip->flags -= wxSNIP_OWNED; - - return TRUE; -} - -void wxMediaEdit::RefreshBox(double L, double T, double w, double h) -{ - double B, R; - - B = T + h; - R = L + w; - - if (refreshBoxUnset) { - refreshL = L; - refreshR = R; - refreshT = T; - refreshB = B; - refreshBoxUnset = FALSE; - } else { - if (L < refreshL) - refreshL = L; - if (R > refreshR) - refreshR = R; - if (T < refreshT) - refreshT = T; - if (B > refreshB) - refreshB = B; - } - - drawCachedInBitmap = FALSE; -} - -void wxMediaEdit::NeedsUpdate(wxSnip *snip, double localx, double localy, - double w, double h) -{ - double x, y; - - if (!GetSnipLocation(snip, &x, &y)) - return; - - RefreshBox(x + localx, y + localy, w, h); - - if (!delayRefresh) - Redraw(); -} - -void wxMediaEdit::InvalidateBitmapCache(double x, double y, double w, double h) -{ - if (w < 0) - w = totalWidth - x; - if (h < 0) - h = totalHeight - y; - - RefreshBox(x, y, w, h); - if (!delayRefresh) - Redraw(); -} - -void wxMediaEdit::HideCaret(Bool hide) -{ - if (!!hiliteOn == !!hide) { - hiliteOn = !hide; - if (ownCaret || (startpos != endpos)) - NeedCaretRefresh(); - } -} - -Bool wxMediaEdit::CaretHidden(void) -{ - return !hiliteOn; -} - -double wxMediaEdit::GetBetweenThreshold() -{ - return betweenThreshold; -} - -void wxMediaEdit::SetBetweenThreshold(double t) -{ - if (t > 99.0) - t = 99.0; - betweenThreshold = t; -} - -/****************************************************************/ - -#ifdef MEMORY_USE_METHOD -long wxMediaEdit::MemoryUse(void) -{ - return ((numValidLines * sizeof(wxMediaLine)) - + (tabcount * sizeof(double)) - + wxMediaBuffer::MemoryUse()); -} -#endif - diff --git a/src/mred/wxme/wx_media.h b/src/mred/wxme/wx_media.h deleted file mode 100644 index b4b93f2eca..0000000000 --- a/src/mred/wxme/wx_media.h +++ /dev/null @@ -1,687 +0,0 @@ -/* Main header file for wxMedia */ -/* Include this file for anything using wxMedia */ - -#ifndef __WX_MEDIA__ -#define __WX_MEDIA__ - -#include "scheme.h" - -#include "wx_panel.h" -#include "wx_canvs.h" -#include "wx_dcmem.h" -#include "wx_keym.h" -#include "wx_medio.h" -#include "wx_style.h" -#include "wx_mtype.h" - -class wxMediaEdit; -class wxClickback; -class wxClipboard; - -extern wxchar wx_empty_wxstr[1]; - -#define wxFOCUS_IMMEDIATE 0 -#define wxFOCUS_DISPLAY 1 -#define wxFOCUS_GLOBAL 2 - -/* File formats */ -enum { - wxMEDIA_FF_GUESS, - wxMEDIA_FF_STD, - wxMEDIA_FF_TEXT, - wxMEDIA_FF_TEXT_FORCE_CR, - wxMEDIA_FF_SAME, - wxMEDIA_FF_COPY -}; - -#include "wx_snip.h" -#include "wx_cgrec.h" -#include "wx_medad.h" - -class wxSnipLocation; -class wxMediaFlashTimer; - -class wxBitmap; - -/* Edit commands */ -enum { - wxEDIT_UNDO = 1, - wxEDIT_REDO, - wxEDIT_CLEAR, - wxEDIT_CUT, - wxEDIT_COPY, - wxEDIT_PASTE, - wxEDIT_KILL, - wxEDIT_INSERT_TEXT_BOX, - wxEDIT_INSERT_GRAPHIC_BOX, - wxEDIT_INSERT_IMAGE, - wxEDIT_SELECT_ALL, - _wx_EDIT_counter -}; - -/* Movement kinds */ -enum { - wxMOVE_SIMPLE = 1, - wxMOVE_LINE, - wxMOVE_PAGE, - wxMOVE_WORD -}; - -/* For Finding Wordbreaks: */ -enum { - wxBREAK_FOR_CARET = 1, - wxBREAK_FOR_LINE = 2, - wxBREAK_FOR_SELECTION = 4, - wxBREAK_FOR_USER_1 = 32, - wxBREAK_FOR_USER_2 = 64 -}; - -/* Selection: */ -enum { - wxDEFAULT_SELECT = 0, - wxX_SELECT = 1, - wxLOCAL_SELECT = 2 -}; - -/* Drawing: */ -enum { - wxSNIP_DRAW_NO_CARET = 0, - wxSNIP_DRAW_SHOW_INACTIVE_CARET, - wxSNIP_DRAW_SHOW_CARET -}; - - -/* For FindSnip: */ -#define wxSNIP_BEFORE_OR_NULL (-2) -#define wxSNIP_BEFORE (-1) -#define wxSNIP_AFTER 1 -#define wxSNIP_AFTER_OR_NULL 2 - -#define wxTAB_WIDTH 20 - -typedef void (*wxClickbackFunc)(wxMediaEdit *, long start, long end, void *); -typedef void (*wxWordbreakFunc)(wxMediaEdit *, long *start, long *end, int reason, void *); - -class wxMediaAdmin; - - -class wxMediaWordbreakMap : public wxObject -{ - int usage; - public: - char map[256]; - - wxMediaWordbreakMap(); - - void SetMap(int ch, int mask); - int GetMap(int ch); -}; - -extern wxMediaWordbreakMap *wxTheMediaWordbreakMap; - -class wxMediaLine; - -class wxMediaEdit : public wxMediaBuffer -{ - friend class wxMediaLine; - friend class wxMediaSnipMediaAdmin; - public: - wxMediaEdit(double lineSpacing = 1.0, - double *tabstops = NULL, int numtabs = 0); - ~wxMediaEdit(); - - wxMediaBuffer *CopySelf(void); - void CopySelfTo(wxMediaBuffer *b); - - /* Usually called by wxMediaAdmin */ - virtual void OnEvent(wxMouseEvent *event); - virtual void OnChar(wxKeyEvent *event); - virtual wxCursor *AdjustCursor(wxMouseEvent *event); - virtual void Refresh(double localx, double localy, double w, double h, - int show_caret, wxColor *bgColor); - virtual void OwnCaret(Bool ownit); - virtual void BlinkCaret(); - virtual void SizeCacheInvalid(void); - - virtual void OnDefaultEvent(wxMouseEvent *event); - virtual void OnDefaultChar(wxKeyEvent *event); - - /* Callbacks for the wxSnipAdmin: */ - virtual Bool ScrollTo(wxSnip *, double localx, double localy, - double w, double h, Bool refresh, int bias = 0); - virtual void Resized(wxSnip *, Bool redraw_now); - virtual Bool Recounted(wxSnip *, Bool redraw_now); - virtual void NeedsUpdate(wxSnip *, double localx, double localy, - double w, double h); - virtual void SetCaretOwner(wxSnip *, int = wxFOCUS_IMMEDIATE); - virtual Bool ReleaseSnip(wxSnip *); - - /* Methods for you to override: */ - virtual void OnChange(void); - virtual Bool CanInsert(long start, long len); - virtual void OnInsert(long start, long len); - virtual void AfterInsert(long start, long len); - virtual Bool CanDelete(long start, long len); - virtual void OnDelete(long start, long len); - virtual void AfterDelete(long start, long len); - virtual Bool CanChangeStyle(long start, long len); - virtual void OnChangeStyle(long start, long len); - virtual void AfterChangeStyle(long start, long len); - virtual void AfterSetPosition(void); - virtual Bool CanSetSizeConstraint(void); - virtual void OnSetSizeConstraint(void); - virtual void AfterSetSizeConstraint(void); - virtual void OnSplitSnip(long pos); - virtual void OnMergeSnips(long pos); - - /* Set the caret position: */ - void GetPosition(long *start, long *end = NULL); - long GetStartPosition(void); - long GetEndPosition(void); - void SetPosition(long start, long end = -1, - Bool eol = FALSE, Bool scroll = TRUE, - int seltype = wxDEFAULT_SELECT); - void MovePosition(long code, Bool extend = FALSE, - int kind = wxMOVE_SIMPLE); - void SetPositionBiasScroll(int bias, long start, long end = -1, - Bool eol = FALSE, Bool scroll = TRUE, - int seltype = wxDEFAULT_SELECT); - - virtual void SetAnchor(Bool); - Bool GetAnchor(void); - - Bool ScrollToPosition(long start, Bool ateol = FALSE, - long end = -1, int bias = 0); - void GetVisiblePositionRange(long *start, long *end, Bool all = TRUE); - void GetVisibleLineRange(long *start, long *end, Bool all = TRUE); - - /* Hilite a region without changing the selection position: */ - void FlashOn(long start, long end, Bool ateol = FALSE, - Bool scroll = TRUE, long timeout = 500); - void FlashOff(); - - /* Change the text */ - void Insert(char *str, long start, long end = -1, Bool scrollOk = TRUE); - void Insert(char *str); - void Insert(long len, char *str, long start, long end = -1, Bool scrollOk=TRUE); - void Insert(long len, char *str); - void Insert(wxchar *str, long start, long end = -1, Bool scrollOk = TRUE); - void Insert(wxchar *str); - void Insert(long len, wxchar *str, long start, long end = -1, Bool scrollOk=TRUE); - void Insert(long len, wxchar *str); - void Insert(wxSnip *snip, long start, long end = -1, Bool scrollOk=TRUE); - void Insert(wxSnip *snip); - void Insert(wxList *snips); - void Insert(wxList *snips, long start, long end = -1); - void Insert(wxchar code_point); - void Insert(wxchar code_point, long start, long end = -1); - void Delete(long start, long end = -1, Bool scrollOk = TRUE); - void Delete(); - void Erase(); - - void Cut(Bool extend, long time, long start, long end = -1); - void Cut(Bool extend = FALSE, long time = 0); - void Copy(Bool extend, long time, long start, long end = -1); - void Copy(Bool extend = FALSE, long time = 0); - void Paste(long time, long start, long end = -1); - void Paste(long time = 0); - void PasteSelection(long time, long start, long end = -1); - void PasteSelection(long time = 0); - void PasteNext(void); - void Kill(long time = 0); - void Kill(long time, long start, long end); - void Clear(void); - void SelectAll(void); - - virtual void DoCopy(long start, long end, long time, Bool extend); - virtual void DoPaste(long start, long time); - virtual void DoPasteSelection(long start, long time); - void DoGenericPaste(wxClipboard *cb, long start, long time); - - void GenericPaste(Bool x_sel, long time, long start, long end); - - /* For making a lot of changes to be displayed at once: */ - void BeginEditSequence(Bool undoable = TRUE, Bool interruptSeqs = TRUE); - void EndEditSequence(void); - Bool RefreshDelayed(void); - Bool InEditSequence(void); - Bool LocationsUpToDate(void); - - void ChangeStyle(wxStyleDelta *); - void ChangeStyle(wxStyle *, long start = -1, long end = -1, Bool counts_as_mod = TRUE); - void ChangeStyle(wxStyleDelta *, long start, long end = -1, Bool counts_as_mod = TRUE); - /* Called automatically when a style is changed; no need to call this */ - void StyleHasChanged(wxStyle *style); - - void SetStyleList(wxStyleList *styles); - - Bool ReallyCanEdit(int op); - - /* Convert canvas co-ordinates to caret position */ - long FindPosition(double x, double y, Bool - *ateol = NULL, Bool *onit = NULL, - double *how_close = NULL); - long FindLine(double y, Bool *onit = NULL); - long FindPositionInLine(long i, double x, - Bool *ateol = NULL, Bool *onit =NULL, - double *how_close = NULL); - - /* Find the line or canvas co-ordinates for a caret position */ - long PositionLine(long start, Bool eol=FALSE); - void PositionLocation(long start, - double *x = NULL, double *y = NULL, - Bool front = TRUE, Bool eol = FALSE, - Bool wholeLine = FALSE); - void PositionLocations(long start, - double *tx, double *ty, - double *bx, double *by, - Bool eol = FALSE, Bool wholeLine = FALSE); - double LineLocation(long line, Bool top = TRUE); - - /* Get first/last caret position in a line: */ - long LineStartPosition(long i, Bool visibleOnly = TRUE); - long LineEndPosition(long i, Bool visibleOnly = TRUE); - long LineLength(long i); - - /* Paragraphs */ - long PositionParagraph(long start, Bool eol=FALSE); - long ParagraphStartPosition(long i, Bool visibleOnly = TRUE); - long ParagraphEndPosition(long i, Bool visibleOnly = TRUE); - long LineParagraph(long line); - long ParagraphStartLine(long i); - long ParagraphEndLine(long i); - - long LastPosition(void); - long LastLine(void); - long LastParagraph(void); - - void SetParagraghMargins(long i, double firstLeft, double left, double right); - void SetParagraghAlignment(long i, int align); - - void GetExtent(double *w, double *h); - double GetDescent(void); - double GetSpace(void); - double GetTopLineBase(void); - - double ScrollLineLocation(long line); - long NumScrollLines(); - long FindScrollLine(double y); - - /* Searching */ - long FindString(wxchar *str, int direction = 1, long start =-1, long end =-1, - Bool bos = TRUE, Bool caseSens = TRUE); - long *FindStringAll(wxchar *str, long *cnt, int direction = 1, - long start =-1, long end =-1, Bool bos = TRUE, - Bool caseSens = TRUE); - long FindStringUTF8(char *str, int direction = 1, long start =-1, long end =-1, - Bool bos = TRUE, Bool caseSens = TRUE); - long *FindStringAllUTF8(char *str, long *cnt, int direction = 1, - long start =-1, long end =-1, Bool bos = TRUE, - Bool caseSens = TRUE); - long FindNewline(int direction = 1, long start =-1, long end =-1); - - /* Create clickable ranges: */ - void SetClickback(long start, long end, wxClickbackFunc, void *, - wxStyleDelta *hiliteDelta = NULL, Bool callOnDown = FALSE); - void RemoveClickback(long start, long end); - void CallClickback(long start, long end); - - void SetClickback(wxClickback *); /* Used by undo record only */ - - wxSnip *FindFirstSnip(void); - wxSnip *FindNextNonTextSnip(wxSnip *snip); - wxSnip *FindSnip(long p, int direction, long *sPos = NULL); - Bool GetSnipPositionAndLocation(wxSnip *thesnip, long *pos, - double *x = NULL, double *y = NULL); - Bool GetSnipLocation(wxSnip *thesnip, double *x = NULL, double *y = NULL, - Bool bottomRight=FALSE); - long GetSnipPosition(wxSnip *thesnip); - - wxchar *GetFlattenedText(long *len = NULL); - wxchar *GetText(long start = -1, long end = -1, - Bool flattened = FALSE, Bool forceCR = FALSE, - long *got = NULL); - char *GetTextUTF8(long start = -1, long end = -1, - Bool flattened = FALSE, Bool forceCR = FALSE, - long *got = NULL); - wxchar GetCharacter(long start); - char GetTruncatedCharacter(long start); - - Bool SavePort(Scheme_Object *port, int format = wxMEDIA_FF_SAME, Bool showErrors = TRUE); - int InsertPort(Scheme_Object *port, int format = wxMEDIA_FF_GUESS, Bool replaceStyles = TRUE); - - Bool ReadFromFile(wxMediaStreamIn *, long start, Bool overwritestyle = FALSE); - Bool ReadFromFile(wxMediaStreamIn *, Bool overwritestyle = FALSE); - Bool WriteToFile(wxMediaStreamOut *, long start, long end = -1); - Bool WriteToFile(wxMediaStreamOut *); - - void SetFilename(char *, Bool temp = FALSE); - int GetFileFormat(void); - void SetFileFormat(int); - - void SplitSnip(long pos); - - double *GetTabs(int *length = NULL, - double *tabInc = NULL, Bool *inUnits = NULL); - void SetTabs(double *tabs, int count, - double tabIncrement = wxTAB_WIDTH, Bool inUnits = TRUE); - - void AddEditorFunctions(wxKeymap *keymap); - - void SetWordbreakFunc(wxWordbreakFunc f, void *data); - void FindWordbreak(long *start, long *end, int reason); - - wxMediaWordbreakMap *GetWordbreakMap(void); - void SetWordbreakMap(wxMediaWordbreakMap *map); - - virtual void PrintToDC(wxDC *dc, int page = -1); - virtual void *BeginPrint(wxDC *, Bool); - virtual void EndPrint(wxDC *, void *); - virtual Bool HasPrintPage(wxDC *dc, int page); - - void SetMaxWidth(double w); - void SetMinWidth(double w); - double GetMaxWidth(); - double GetMinWidth(); - void SetMinHeight(double h); - void SetMaxHeight(double w); - double GetMinHeight(); - double GetMaxHeight(); - - virtual void InvalidateBitmapCache(double x=0.0, double y=0.0, - double w=-1.0, double h=-1.0); - - /* You might need to call this if you're doing text changes within - BeginEditSequence() and EndEditSequence(). Hopefully, it will - get called automatically. */ - void Recalculate(void); - - void SettingAdmin(wxMediaAdmin *); - void InitNewAdmin(void); - - virtual wxBufferData *GetRegionData(long start, long end); - virtual void SetRegionData(long start, long end, wxBufferData *); - - void PasteRegionData(wxBufferData *); - - virtual wxTextSnip *OnNewTextSnip(); - virtual wxTabSnip *OnNewTabSnip(); - - wxBitmap *SetAutowrapBitmap(wxBitmap *bm); - virtual void OnReflow(void); - - void HideCaret(Bool hide); - Bool CaretHidden(void); - - double GetBetweenThreshold(); - void SetBetweenThreshold(double thresh); - - inline Bool GetOverwriteMode(void) { return overwriteMode; } - inline void SetOverwriteMode(Bool m) { overwriteMode = !!m; } - - inline double GetLineSpacing() { return lineSpacing; } - void SetLineSpacing(double); - - inline Bool GetStickyStyles() { return stickyStyles; } - inline void SetStickyStyles(Bool s) { stickyStyles = s; if (s) caretStyle = NULL; } - -#if ALLOW_X_STYLE_SELECTION - virtual Bool OwnXSelection(Bool on, Bool update, Bool force); -#endif - -#ifdef MEMORY_USE_METHOD - virtual long MemoryUse(void); -#endif - - Bool IsLockedForRead(); - Bool IsLockedForFlow(); - Bool IsLockedForWrite(); - - double GetRevisionNumber(); - - private: -#define TF_Flag(var) unsigned var : 1 - - TF_Flag( readLocked ); - TF_Flag( flowLocked ); - TF_Flag( writeLocked ); - - TF_Flag( hiliteOn ); - - TF_Flag( changed ); /* Set if OnChange() needs to be called */ - - TF_Flag( flash ); - TF_Flag( flashautoreset ); - TF_Flag( flashdirectoff ); - - TF_Flag( posateol ); /* display the caret at the end of a line? */ - TF_Flag( flashposateol ); - TF_Flag( flashscroll ); /* Scroll back after unflashing? */ - - TF_Flag( graphicsInvalid ); - TF_Flag( flowInvalid ); - TF_Flag( snipCacheInvalid ); - TF_Flag( graphicMaybeInvalid ); - TF_Flag( graphicMaybeInvalidForce ); - - TF_Flag( typingStreak ); - TF_Flag( deletionStreak ); - TF_Flag( delayedStreak ); - TF_Flag( vcursorStreak ); - TF_Flag( killStreak ); - TF_Flag( anchorStreak ); - TF_Flag( extendStreak ); - TF_Flag( insertForceStreak ); - TF_Flag( deleteForceStreak ); - - TF_Flag( keepAnchorStreak ); - - TF_Flag( streaksPushed ); - TF_Flag( saveTypingStreak ); - TF_Flag( saveDeletionStreak ); - TF_Flag( saveDelayedStreak ); - TF_Flag( saveVcursorStreak ); - TF_Flag( saveKillStreak ); - TF_Flag( saveAnchorStreak ); - TF_Flag( saveExtendStreak ); - - TF_Flag( dragging ); - TF_Flag( tracking ); - TF_Flag( extraLine ); /* Empty line at end of file with no representative */ - - TF_Flag( delayedscrollateol ); - TF_Flag( delayedscrollbox ); - TF_Flag( drawCachedInBitmap ); - TF_Flag( refreshUnset ); - TF_Flag( refreshBoxUnset ); - TF_Flag( refreshAll ); - - TF_Flag( tabSpaceInUnits ); - TF_Flag( overwriteMode ); - TF_Flag( stickyStyles ); - -#if ALLOW_X_STYLE_SELECTION - TF_Flag( needXCopy ); -#endif - - TF_Flag( caretBlinked ); /* Whether we want to hide an active caret or not */ - - TF_Flag( initialStyleNeeded ); - -#undef TF_Flag - - int lastDrawCaret; - int lastDrawXSel; - - double lineSpacing; - double maxWidth, minWidth, minHeight, maxHeight; - double wrapBitmapWidth; - - wxBitmap *autoWrapBitmap; - - int delayRefresh; - - long len; /* Total length in "characters" == number of positions - 1 */ - - long startpos, endpos; - long extendstartpos, extendendpos; /* for extendstreak */ - double vcursorloc; /* for vcursorStreak */ - - wxMediaFlashTimer *flashTimer; - long flashstartpos, flashendpos; - - wxSnip *snips, *lastSnip; /* The contents of this edit session */ - long snipCount; - - wxStandardSnipAdmin *snipAdmin; - - wxMediaLine *lineRoot, *firstLine, *lastLine; /* Line information */ - long numValidLines; - - double extraLineH; - - double totalHeight, totalWidth; /* Total height/width in canvas units */ - double finalDescent; /* Descent of last line */ - double initialSpace; /* Space from first line */ - double initialLineBase; /* Inverse descent from first line */ - - wxStyle *caretStyle; - - long dragstart; - - wxClickback *trackClickback; - - long refreshStart, refreshEnd; - double refreshL, refreshT, refreshR, refreshB; - - double lastDrawL, lastDrawT, lastDrawR, lastDrawB; - unsigned char lastDrawRed, lastDrawGreen, lastDrawBlue; - - long delayedscroll, delayedscrollend; - int delayedscrollbias; - wxSnip *delayedscrollsnip; - double delayedscrollX, delayedscrollY, delayedscrollW, delayedscrollH; - - wxList *clickbacks; - - int fileFormat; - - double betweenThreshold; - - double *tabs; - int tabcount; - double tabSpace; - - long readInsert, readInsertStart; - - long prevPasteStart, prevPasteEnd; - long savePrevPasteStart, savePrevPasteEnd; - - double revision_count; - - wxWordbreakFunc wordBreak; - void *wordBreakData; - - wxMediaWordbreakMap *wordBreakMap; - - void _Insert(wxSnip *snip, long len, wxchar *str, wxList *snips, - long start, long end = -1, - Bool scrollOk = TRUE); - void _Delete(long start, long end, Bool undo, Bool scrollOk); - - void _SetPosition(Bool setflash, int bias, long start, long end, - Bool ateol, Bool scroll, int seltype); - - void _ChangeStyle(long start, long end, wxStyle *, wxStyleDelta *, Bool restoreSel = 1, Bool counts_as_mod = TRUE); - - void MakeOnlySnip(void); - void SpliceSnip(wxSnip *snip, wxSnip *prev, wxSnip *next); - void InsertSnip(wxSnip *before, wxSnip *snip); - void AppendSnip(wxSnip *snip); - void DeleteSnip(wxSnip *snip); - wxSnip *SnipSetAdmin(wxSnip *snip, wxSnipAdmin *a); - void SnipSplit(wxSnip *snip, long pos, wxSnip **a, wxSnip **b); - - void MakeSnipset(long start, long end); - wxTextSnip *InsertTextSnip(long start, wxStyle *style = NULL); - void CheckMergeSnips(long start); - - void AdjustClickbacks(long start, long end, long d, wxDeleteRecord *rec); - wxClickback *FindClickback(long start, double y); - void SetClickbackHilited(wxClickback *, Bool); - - Bool ScrollToPosition(long start, Bool ateol, Bool refresh, long end, - int bias); - - long FindFirstVisiblePosition(wxMediaLine *line, wxSnip *snip = NULL); - void FindLastVisiblePosition(wxMediaLine *line, long *p, - wxSnip **snipP = NULL); - - long _FindPositionLine(long pos); - void _CalcValidPositionLine(void); - - long _FindPositionInLine(Bool internal, long i, double x, - Bool *ateol = NULL, Bool *onit =NULL, - double *how_close = NULL); - long _FindPositionInSnip(wxDC *dc, double X, double Y, - wxSnip *snip, double x, double *how_close = NULL); - - void LinesInvalidAfter(long); - void OneLineInvalid(long); - void SnipChangedAt(long); - - long _FindStringAll(wxchar *str, int direction, - long start, long end, long **positions, - Bool, Bool, Bool); - - Bool InsertFile(const char *who, Scheme_Object *f, char *filename, int *format, Bool clearStyles, Bool showErrors); - - void RecalcLines(wxDC *dc, Bool calcGraphic = TRUE); - Bool CheckFlow(double maxw, wxDC *dc, double Y, long startp, wxSnip *start); - Bool CheckRecalc(Bool need_graphic = TRUE, Bool need_write = TRUE, Bool no_display_ok = FALSE); - void Redraw(wxDC *, double, double, double, double, double, double, int, int, wxColour*); - void Redraw(); - - void NeedRefresh(long start, long end = -1); - void NeedRefresh(double, double, double, double); - void RefreshByLineDemand(void); - void ContinueRefresh(void); - void RefreshBox(double x, double y, double w, double h); - - void NeedCaretRefresh(void); - - void EndStreaks(int exception = 0); - - void PushStreaks(void); - void PopStreaks(void); - - public: - Bool ReadInsert(wxList *snipl); - protected: - Bool ReadInsert(wxSnip *snip); - void InsertPasteSnip(wxSnip *snip, wxBufferData *); - void InsertPasteString(wxchar *str); -}; - -#include "wx_medpb.h" - -void wxInitMedia(void); -void wxAddMediaEditorFunctions(wxKeymap *tab); -void wxAddMediaPasteboardFunctions(wxKeymap *tab); - -extern const char *(*wxmeExpandFilename)(const char *, const char *, int); - -extern void wxmeError(const char *e); - -extern wxMediaSnip *wxsMakeMediaSnip(wxMediaBuffer *useme, - Bool border, - int lm, int tm, int rm, int bm, - int li, int ti, int ri, int bi, - double w, double W, double h, double H); -extern wxMediaEdit *wxsMakeMediaEdit(); -extern wxMediaPasteboard *wxsMakeMediaPasteboard(); - -extern int wxGetPreference(const char *name, int *res); -extern int wxGetBoolPreference(const char *name, int *res); - -#endif /* __WX_MEDIA__ */ diff --git a/src/mred/wxme/wx_medio.cxx b/src/mred/wxme/wx_medio.cxx deleted file mode 100644 index 766e2e85e0..0000000000 --- a/src/mred/wxme/wx_medio.cxx +++ /dev/null @@ -1,1532 +0,0 @@ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" - -#include - -#include "wx_dialg.h" -#ifndef OLD_WXWINDOWS -// wxWindows 1.62(f): new include for common dialogs -#include "wx_cmdlg.h" -#endif - -#include "wx_media.h" -#include - -static int lsb_first; - -/* For testing and debugging: */ -#define TYPESAFE 0 - -extern void wxmeError(const char *e); - -extern "C" Scheme_Object *scheme_read_byte_string(Scheme_Object *port); - -enum { - st_STRING, - st_NUMBER, - st_FLOAT, - st_FIXED -}; - -/* - Integer format specified by first byte: - bit 8: 0 - read 7-bit (positive) number - bit 8: 1 - ... - bit 7: 0 - read abother byte for 15-bit (positive) number - bit 7: 1 - negative and long numbers... - bit 1: 1 - read another 8-bit (signed) number - bit 1: 0 - ... - bit 2: 1 - read another 16-bit (signed) number - bit 2: 0 - read another 32-bit (signed) number -*/ - -void wxMediaIOCheckLSB(void) -{ - long v = 1; - - lsb_first = *(char *)&v; -} - -/****************************************************************/ - -wxMediaStream::wxMediaStream() -{ - wxStandardSnipClassList *_scl; - wxBufferDataClassList *_bdl; - - _scl = &wxTheSnipClassList; - scl = _scl; - _bdl = &wxTheBufferDataClassList; - bdl = _bdl; -} - -wxMediaStream::~wxMediaStream() -{ -} - -int wxMediaStream::ReadingVersion(wxSnipClass *sclass) -{ - wxSnipClassLink *asl; - - for (asl = sl; asl; asl = asl->next) { - if (asl->c == sclass) - return asl->readingVersion; - } - - /* Class didn't show up in the header? - Assume we're reading the current version. */ - return sclass->version; -} - -int wxMediaStream::MapPosition(wxSnipClass *c) -{ - wxSnipClassLink *asl; - - for (asl = sl; asl; asl = asl->next) { - if (asl->c == c) - return asl->mapPosition; - } - - return -1; -} - -int wxMediaStream::MapPosition(wxBufferDataClass *d) -{ - wxDataClassLink *adl; - - for (adl = dl; adl; adl = adl->next) { - if (adl->d == d) - return adl->mapPosition; - } - - return -1; -} - -int wxMediaStream::GetHeaderFlag(wxSnipClass *c) -{ - wxSnipClassLink *asl; - - for (asl = sl; asl; asl = asl->next) { - if (asl->c == c) - return asl->headerFlag; - } - - return 0; -} - -void wxMediaStream::SetHeaderFlag(wxSnipClass *c) -{ - wxSnipClassLink *asl; - - for (asl = sl; asl; asl = asl->next) { - if (asl->c == c) { - asl->headerFlag = 1; - return; - } - } -} - - -/****************************************************************/ - -wxMediaStreamInFileBase::wxMediaStreamInFileBase(Scheme_Object *s) -{ - f = s; -} - -wxMediaStreamInFileBase::~wxMediaStreamInFileBase() -{ -} - -long wxMediaStreamInFileBase::Tell(void) -{ - return scheme_set_file_position(f, -1); -} - -void wxMediaStreamInFileBase::Seek(long p) -{ - scheme_set_file_position(f, p); -} - -void wxMediaStreamInFileBase::Skip(long n) -{ - scheme_set_file_position(f, n + scheme_set_file_position(f, -1)); -} - -Bool wxMediaStreamInFileBase::Bad(void) -{ - return FALSE; -} - -long wxMediaStreamInFileBase::Read(char *data, long len, long delta) -{ - if (len <= 0) - return 0; - - return scheme_get_byte_string("read in editor-stream-in%", f, data, delta, len, 0, 0, NULL); -} - -/****************************************************************/ - -void wxMediaStreamOutBase::Write(char *data, long len, int delta) -{ -#ifdef MZ_PRECISE_GC - if (delta) { - char *d; - d = new WXGC_ATOMIC char[len]; - memcpy(d, data + delta, len); - delta = 0; - data = d; - } -#endif - Write(data + delta, len); -} - -/****************************************************************/ - -wxMediaStreamOutFileBase::wxMediaStreamOutFileBase(Scheme_Object *s) -{ - f = s; -} - -wxMediaStreamOutFileBase::~wxMediaStreamOutFileBase() -{ -} - -long wxMediaStreamOutFileBase::Tell(void) -{ - return scheme_set_file_position(f, -1); -} - -void wxMediaStreamOutFileBase::Seek(long p) -{ - scheme_set_file_position(f, p); -} - -Bool wxMediaStreamOutFileBase::Bad(void) -{ - return FALSE; -} - -void wxMediaStreamOutFileBase::Write(char *data, long len) -{ - Write(data, len, 0); -} - -void wxMediaStreamOutFileBase::Write(char *data, long len, int delta) -{ - if (len <= 0) - return; - - scheme_put_byte_string("write in editor-stream-out%", f, data, delta, len, 0); -} - -/****************************************************************/ - -wxMediaStreamInStringBase::wxMediaStreamInStringBase(char *s, long l) -{ - a_string = s; - len = l; - pos = 0; - bad = FALSE; -} - -wxMediaStreamInStringBase::~wxMediaStreamInStringBase() -{ -} - -long wxMediaStreamInStringBase::Tell(void) -{ - return pos; -} - -void wxMediaStreamInStringBase::Seek(long p) -{ - if (p < 0) - p = 0; - else if (p < len) - pos = p; - else - pos = len; -} - -void wxMediaStreamInStringBase::Skip(long n) -{ - pos += n; - if (pos > len) - pos = len; - else if (pos < 0) - pos = 0; -} - -Bool wxMediaStreamInStringBase::Bad(void) -{ - return bad; -} - -long wxMediaStreamInStringBase::Read(char *data, long l, long delta) -{ - if (l + pos > len) { - bad = TRUE; - l = len - pos; - } - - memcpy(data + delta, a_string + pos, l); - pos += l; - - return l; -} - -/****************************************************************/ - -wxMediaStreamOutStringBase::wxMediaStreamOutStringBase() -{ - alloc = 50; - len = pos = 0; - a_string = new WXGC_ATOMIC char[alloc]; - bad = FALSE; -} - -wxMediaStreamOutStringBase::~wxMediaStreamOutStringBase() -{ -} - -char *wxMediaStreamOutStringBase::GetString(long *l) -{ - *l = len; - return a_string; -} - -long wxMediaStreamOutStringBase::Tell(void) -{ - return pos; -} - -void wxMediaStreamOutStringBase::Seek(long p) -{ - if (p < 0) - pos = 0; - else if (p > len) - pos = len; - else - pos = p; -} - -Bool wxMediaStreamOutStringBase::Bad(void) -{ - return bad; -} - -void wxMediaStreamOutStringBase::Write(char *data, long l, int delta) -{ - if (l + pos > alloc) { - char *old = a_string; - - alloc = (alloc * 2) + l; - a_string = new WXGC_ATOMIC char[alloc]; - memcpy(a_string, old, len); - } - - memcpy(a_string + pos, data + delta, l); - pos += l; - if (len < pos) - len = pos; -} - -void wxMediaStreamOutStringBase::Write(char *data, long l) -{ - Write(data, l, 0); -} - -/****************************************************************/ - -wxMediaStreamIn::wxMediaStreamIn(wxMediaStreamInBase *s) -{ - f = s; - boundalloc = 10; - boundcount = 0; - boundaries = new WXGC_ATOMIC long[boundalloc]; - bad = FALSE; -} - -wxMediaStreamIn::~wxMediaStreamIn() -{ -} - -#ifdef TYPESAFE -# define WX_TYPESAFE_USED(x) x -#else -# define WX_TYPESAFE_USED(x) WXUNUSED(x) -#endif - -void wxMediaStreamIn::Typecheck(char WX_TYPESAFE_USED(v)) -{ - if (bad) - return; - - if (boundcount && (Tell() >= boundaries[boundcount - 1])) { - bad = TRUE; - wxmeError("editor-stream-in%: overread (caused by file corruption?)"); - return; - } - - bad = f->Bad(); - - if (bad) { - wxmeError("editor-stream-in%: stream error"); - return; - } - -#if TYPESAFE - char t; - - f->Read(&t, 1); - - if (bad = f->Bad()) { - wxmeError("editor-stream-in%: stream error"); - return; - } - - bad = (t != v); - - if (bad) - wxmeError("editor-stream-in%: type safety error"); -#endif -} - -#if 0 -# define BAD_PRINTF(x) printf x -#else -# define BAD_PRINTF(x) /* disabled */ -#endif - -char wxMediaStreamIn::SkipWhitespace(char *_buf) -{ - char buf[1]; - - if (bad) - return 0; - - do { - if (f->Read(buf, 1) != 1) { - BAD_PRINTF(("bad 1\n")); - bad = 1; - break; - } - if (buf[0] == '#') { - int pos; - pos = f->Tell(); - if ((f->Read(buf, 1) == 1) && (buf[0] == '|')) { - /* Skip to end of comment */ - int saw_bar = 0, saw_hash = 0, nesting = 0; - while (1) { - if (f->Read(buf, 1) != 1) { - BAD_PRINTF(("bad 1.1\n")); - bad = 1; - break; - } - if (saw_bar && (buf[0] == '#')) { - buf[0] = ' '; - if (nesting) { - --nesting; - } else - break; - } else if (saw_hash && (buf[0] == '|')) { - nesting++; - buf[0] = 0; /* So the bar doesn't count for closing */ - } - saw_bar = (buf[0] == '|'); - saw_hash = (buf[0] == '#'); - } - if (bad) - break; - } else { - f->Seek(pos); - buf[0] = '#'; - } - } else if (buf[0] == ';') { - /* Skip to end of comment */ - while (1) { - if (f->Read(buf, 1) != 1) { - BAD_PRINTF(("bad 1.1\n")); - bad = 1; - break; - } - if ((buf[0] == '\n') || (buf[0] == '\r')) - break; - } - buf[0] = ' '; - } - } while (scheme_isspace(((unsigned char *)buf)[0])); - - if (_buf) - _buf[0] = buf[0]; - - return buf[0]; -} - -int wxMediaStreamIn::IsDelim(char c) -{ - if (scheme_isspace((unsigned char)c)) - return 1; - else if (c == '#') { - long pos; - char next[1]; - pos = f->Tell(); - f->Read(next, 1); - if (next[0] == '|') { - f->Seek(pos - 1); - return 1; - } else { - f->Seek(pos); - return 0; - } - } else if (c == ';') { - long pos; - pos = f->Tell(); - f->Seek(pos - 1); - return 1; - } else - return 0; -} - -void wxMediaStreamIn::GetNumber(long *_v, double *_fv) -{ - char buf[50]; - int cnt = 1; - - SkipWhitespace(buf); - if (bad) - cnt = 50; - - while (cnt < 50) { - if (f->Read(buf, 1, cnt) != 1) { - /* Assuming EOF */ - break; - } - if (IsDelim(buf[cnt])) - break; - cnt++; - } - - if (cnt == 50) { - BAD_PRINTF(("bad 3\n")); - bad = 1; - if (_v) - *_v = 0; - if (_fv) - *_fv = 0.0; - } else { - buf[cnt] = 0; - if (_fv) { - double fv; - GC_CAN_IGNORE char *p; - fv = strtod(buf, &p); - *_fv = fv; - } else { - long v = 0; - int i = 0, negate; - - if (buf[i] == '-') { - negate = 1; - i = 1; - } else { - negate = 0; - } - if (cnt > 11) { - BAD_PRINTF(("bad 4 %d %s\n", cnt, buf)); - bad = 1; - } - - for (; buf[i]; i++) { - if ((buf[i] >= '0' && (buf[i] <= '9'))) { - v = (v * 10) + (buf[i] - '0'); - } else { - bad = 1; - BAD_PRINTF(("bad 6 %c\n", buf[i])); - } - } - if (negate) - v = -v; - - *_v = v; - } - } - - IncItemCount(); -} - -char *wxMediaStreamIn::GetAString(long *n, long limit, char *target, int extra, int recur) -{ - char *s, buf[32]; - int alloc = 32, size = 0; - Scheme_Object *port, *str; - long len, orig_len, get_amt, got_amt; - - if (recur) { - if (limit < 16) - orig_len = limit; - else - orig_len = 16; - } else { - Get(&orig_len); - } - get_amt = orig_len + 1; - - if (recur) { - buf[0] = '#'; - } else { - SkipWhitespace(buf); - if (bad) - buf[0] = 0; - } - - if (buf[0] == '#') { - if (f->Read(buf, 1, 1) == 1) { - if (buf[1] == '"') { - size = 0; - s = buf; - while (1) { - if ((size + get_amt + 1) >= alloc) { - char *naya; - do { - alloc *= 2; - } while (alloc <= (size + get_amt + 1)); - naya = new WXGC_ATOMIC char[alloc]; - memcpy(naya, s, size); - s = naya; - } - got_amt = f->Read(s, get_amt, size); - if (got_amt == get_amt) { - int i, eos = 0, orig_size = size; - for (i = 0; i < get_amt; ) { - if (s[orig_size + i] == '"') { - size++; - i++; - eos = 1; - break; - } else if (s[orig_size + i] == '\\') { - if (i + 1 >= get_amt) { - if (f->Read(s, 1, orig_size + i + 1) != 1) { - bad = 1; - BAD_PRINTF(("bad 8\n")); - break; - } - i++; - } else - i += 2; - size += 2; - } else { - size++; - i++; - } - } - if (i < get_amt) { - bad = 1; - BAD_PRINTF(("bad 8.5 %d %ld %ld %s\n", i, get_amt, limit, s)); - } - get_amt = 1; - if (eos || bad) - break; - } else { - bad = 1; - BAD_PRINTF(("bad 9 %ld %ld\n", get_amt, got_amt)); - break; - } - } - - if (!bad) { - if (!recur) - IncItemCount(); - - port = scheme_make_sized_byte_string_input_port(s, size); - str = scheme_read_byte_string(port); - - if (str) { - if (recur) { - return (char *)str; - } else { - len = SCHEME_BYTE_STRLEN_VAL(str); - - if (len == orig_len) { - if (target) { - long amt; - amt = ((len > limit) ? limit : len); - memcpy(target, SCHEME_BYTE_STR_VAL(str), amt); - *n = amt; - return target; - } else { - /* extra is either 1 or 0 */ - if (n) - *n = len + extra; - return SCHEME_BYTE_STR_VAL(str); - } - } else { - BAD_PRINTF(("bad 9.9 %ld %ld %s\n", orig_len, len, SCHEME_BYTE_STR_VAL(str))); - } - } - } - BAD_PRINTF(("bad 10--1\n")); - } - BAD_PRINTF(("bad 10-0\n")); - } - BAD_PRINTF(("bad 10-1\n")); - } - BAD_PRINTF(("bad 10-2\n")); - } else if (!recur && (buf[0] == '(')) { - /* Read a sequence of strings */ - Scheme_Object *accum = scheme_null; - long left_to_get = orig_len; - while (1) { - SkipWhitespace(buf); - - if (bad) - break; - - if (buf[0] == ')') { - /* Got all byte strings */ - break; - } else if (buf[0] == '#') { - str = (Scheme_Object *)GetAString(NULL, left_to_get, NULL, 0, 1); - if (bad) - break; - accum = scheme_make_pair(str, accum); - left_to_get -= SCHEME_BYTE_STRLEN_VAL(str); - - if (left_to_get < 0) { - BAD_PRINTF(("bad 10.2\n")); - bad = 1; - break; - } - } else { - BAD_PRINTF(("bad 10.7\n")); - bad = 1; - break; - } - } - - if (left_to_get) { - BAD_PRINTF(("bad 10.3\n")); - bad = 1; - } - - if (!bad) { - long amt, i; - - /* Reverse list */ - str = scheme_null; - while (SCHEME_PAIRP(accum)) { - str = scheme_make_pair(SCHEME_CAR(accum), str); - accum = SCHEME_CDR(accum); - } - - /* Prepare target: */ - if (target) { - amt = ((orig_len > limit) ? limit : orig_len); - *n = amt; - } else { - /* extra is either 1 or 0 */ - amt = orig_len; - if (n) - *n = orig_len + extra; - target = new WXGC_ATOMIC char[orig_len + extra]; - if (extra) - target[orig_len] = 0; - } - - /* Copy strings to target: */ - i = 0; - accum = str; - while (amt) { - str = SCHEME_CAR(accum); - accum = SCHEME_CDR(accum); - get_amt = SCHEME_BYTE_STRLEN_VAL(str); - if (get_amt > amt) - get_amt = amt; - memcpy(target + i, SCHEME_BYTE_STR_VAL(str), get_amt); - i += get_amt; - amt -= get_amt; - } - - IncItemCount(); - - return target; - } - BAD_PRINTF(("bad 10-3\n")); - } else { - BAD_PRINTF(("bad 10-4 %d\n", buf[0])); - } - - bad = 1; - BAD_PRINTF(("bad 10\n")); - if (n) - *n = 0; - return ""; -} - -void wxMediaStreamIn::IncItemCount() -{ - items++; - Tell(); /* Adds mapping for items */ -} - -void wxMediaStreamIn::SkipOne(int recur) -{ - char buf[1]; - - if (recur) { - buf[0] = '#'; - } else { - SkipWhitespace(buf); - } - - if (!bad) { - if (buf[0] == '#') { - /* Byte string */ - if (f->Read(buf, 1) == 1) { - if (buf[0] != '"') { - bad = 1; - BAD_PRINTF(("bad 12\n")); - } else { - while (1) { - if (f->Read(buf, 1) != 1) { - bad = 1; - BAD_PRINTF(("bad 13\n")); - break; - } - if (buf[0] == '"') { - break; - } else if (buf[0] == '\\') { - if (f->Read(buf, 1) != 1) { - bad = 1; - BAD_PRINTF(("bad 14\n")); - break; - } - } - } - } - } else { - bad = 1; - BAD_PRINTF(("bad 15\n")); - } - } else if (buf[0] == '(') { - /* List of byte strings */ - while (!bad) { - do { - if (f->Read(buf, 1) != 1) { - bad = 1; - BAD_PRINTF(("bad 16\n")); - break; - } - } while (!IsDelim(buf[0])); - if (buf[0] == ')') - break; - else if (buf[0] == '#') { - SkipOne(TRUE); - } else { - bad = 1; - break; - } - } - } else { - /* Number */ - do { - if (f->Read(buf, 1) != 1) { - bad = 1; - BAD_PRINTF(("bad 16\n")); - break; - } - } while (!IsDelim(buf[0])); - } - - if (!bad && !recur) - IncItemCount(); - } -} - -wxMediaStreamIn *wxMediaStreamIn::GetFixed(long *v) -{ - Typecheck(st_FIXED); - - if (bad) { - *v = 0; - return this; - } - - if (WXME_VERSION_BEFORE_EIGHT(this)) { - if (!lsb_first) { - if (f->Read((char *)v, sizeof(long)) != sizeof(long)) { - *v = 0; - bad = 1; - BAD_PRINTF(("bad 17\n")); - } - } else { - if (WXME_VERSION_ONE(this)) { - if (f->Read((char *)v, sizeof(long)) != sizeof(long)) { - bad = 1; - BAD_PRINTF(("bad 18\n")); - *v = 0; - } - } else { - unsigned char bl[4]; - - if (f->Read((char *)bl, 4) != 4) { - bad = 1; - BAD_PRINTF(("bad 19\n")); - *v = 0; - } else { - *v = ((((long)bl[0]) << 24) + (((long)bl[1]) << 16) - + (((long)bl[2]) << 8) + bl[3]); - } - } - } - } else { - GetNumber(v, NULL); - } - - return this; -} - -extern void *wxMallocAtomicIfPossible(size_t s); - -char *wxMediaStreamIn::GetString(long *n, int extra) -{ - long m; - char *r; - - if (bad) { - if (n) - *n = 0; - return NULL; - } - - if (WXME_VERSION_BEFORE_EIGHT(this)) { - Get(&m); - - Typecheck(st_STRING); - - r = (char *)wxMallocAtomicIfPossible(m + extra); - if (!r) { - wxmeError("editor-stream-in%: string too large (out of memory) while reading stream"); - bad = 1; - BAD_PRINTF(("bad 20\n")); - if (n) - *n = 0; - return NULL; - } - if (extra) - r[m] = 0; - - if (f->Read(r, m) != m) { - bad = 1; - BAD_PRINTF(("bad 21\n")); - m = 0; - } - if (n) - *n = m; - } else { - r = GetAString(n, -1, NULL, extra, 0); - } - - return r; -} - -char *wxMediaStreamIn::GetStringPlusOne(long *n) -{ - char *s; - s = GetString(n, 1); - if (n && *n) - *n = (*n - 1); - return s; -} - -wxMediaStreamIn *wxMediaStreamIn::Get(long *n, char *str) -{ - long m; - - if (bad) { - *n = 0; - return this; - } - - if (WXME_VERSION_BEFORE_EIGHT(this)) { - Get(&m); - - Typecheck(st_STRING); - - if (m <= *n) { - if (f->Read(str, m) != m) { - bad = 1; - BAD_PRINTF(("bad 22\n")); - m = 0; - } - } else { - int d; - d = f->Read(str, *n); - if (d != *n) { - bad = 1; - BAD_PRINTF(("bad 23\n")); - m = 0; - } else { - f->Skip(m - *n); - } - } - *n = m; - } else { - GetAString(n, *n, str, 0, 0); - } - - return this; -} - -wxMediaStreamIn* wxMediaStreamIn::Get(long *v) -{ - char b; - - Typecheck(st_NUMBER); - - if (bad) { - *v = 0; - return this; - } - - if (WXME_VERSION_BEFORE_EIGHT(this)) { - if (f->Read((char *)&b, sizeof(char)) != sizeof(char)) { - bad = 1; - BAD_PRINTF(("bad 24\n")); - b = 0; - } - - if (b & 0x80) { - if (b & 0x40) { - if (b & 0x1) { - signed char bv; - if (f->Read((char *)&bv, 1) != 1) { - bad = 1; - BAD_PRINTF(("25\n")); - *v = 0; - } else - *v = bv; - } else if (b & 0x2) { - unsigned char bl[2]; - if (f->Read((char *)bl, 2) != 2) { - bad = 1; - BAD_PRINTF(("bad 26\n")); - *v = 0; - } else - *v = (((int)((signed char *)bl)[0]) << 8) + bl[1]; - } else { - unsigned char bl[4]; - if (f->Read((char *)bl, 4) != 4) { - bad = 1; - BAD_PRINTF(("27\n")); - *v = 0; - } else - *v = (((long)((signed char *)bl)[0]) << 24) - + (((long)bl[1]) << 16) - + (((long)bl[2]) << 8) + bl[3]; - } - } else { - unsigned char b2; - if (f->Read((char *)&b2, sizeof(char)) != sizeof(char)) { - bad = 1; - BAD_PRINTF(("28\n")); - *v = 0; - } else - *v = (((int)(b & 0x3F)) << 8) | b2; - } - } else - *v = b; - } else { - GetNumber(v, NULL); - } - - return this; -} - -wxMediaStreamIn* wxMediaStreamIn::Get(short *v) -{ - long lv; - - Get(&lv); - *v = lv; - - return this; -} - -wxMediaStreamIn* wxMediaStreamIn::Get(int *v) -{ - long lv; - - Get(&lv); - *v = lv; - - return this; -} - -wxMediaStreamIn* wxMediaStreamIn::Get(char *v) -{ - long lv; - - Get(&lv); - *v = lv; - - return this; -} - -wxMediaStreamIn *wxMediaStreamIn::Get(double *v) -{ - Typecheck(st_FLOAT); - - if (bad) { - *v = 0.0; - return this; - } - - if (WXME_VERSION_BEFORE_EIGHT(this)) { - if (!lsb_first) { - if (f->Read((char *)v, sizeof(double)) != sizeof(double)) { - bad = 1; - BAD_PRINTF(("bad 29\n")); - *v = 0.0; - } - } else { - if (WXME_VERSION_ONE(this)) { - if (f->Read((char *)v, sizeof(double)) != sizeof(double)) { - bad = 1; - BAD_PRINTF(("bad 30\n")); - *v = 0.0; - } - } else { - char num[sizeof(double)], num2[sizeof(double)]; - int i, j; - - if (f->Read((char *)num, sizeof(double)) != sizeof(double)) { - bad = 1; - BAD_PRINTF(("bad 31\n")); - *v = 0.0; - } else { - for (i = 0, j = sizeof(double); i < (int)sizeof(double); ) { - num2[i++] = num[--j]; - } - - memcpy((char *)v, num2, sizeof(double)); - } - } - } - } else { - GetNumber(NULL, v); - } - - return this; -} - -wxMediaStreamIn* wxMediaStreamIn::Get(float *v) -{ - double lv; - - Get(&lv); - *v = lv; - - return this; -} - -void wxMediaStreamIn::SetBoundary(long n) -{ - if (boundcount == boundalloc) { - long *old = boundaries; - boundalloc *= 2; - boundaries = new WXGC_ATOMIC long[boundalloc]; - memcpy(boundaries, old, boundcount * sizeof(long)); - } - - { - long m; - m = Tell() + n; - boundaries[boundcount++] = m; - } -} - -void wxMediaStreamIn::RemoveBoundary() -{ - --boundcount; -} - -void wxMediaStreamIn::Skip(long n) -{ - if (WXME_VERSION_BEFORE_EIGHT(this)) { - f->Skip(n); - } else { - JumpTo(n + items); - } -} - -long wxMediaStreamIn::Tell(void) -{ - if (WXME_VERSION_BEFORE_EIGHT(this)) { - return f->Tell(); - } else { - long pos; - Scheme_Hash_Table *ht; - - pos = f->Tell(); - - ht = (Scheme_Hash_Table *)pos_map; - if (!ht) { - ht = scheme_make_hash_table(SCHEME_hash_ptr); - pos_map = (void *)ht; - } - - scheme_hash_set(ht, scheme_make_integer(items), - scheme_make_integer_value(pos)); - - - return items; - } -} - -void wxMediaStreamIn::JumpTo(long pos) -{ - if (WXME_VERSION_BEFORE_EIGHT(this)) { - f->Seek(pos); - } else { - Scheme_Hash_Table *ht; - Scheme_Object *p; - - ht = (Scheme_Hash_Table *)pos_map; - if (ht) { - p = scheme_hash_get(ht, scheme_make_integer(pos)); - } else - p = NULL; - - if (!p) { - while ((items < pos) && !bad) { - SkipOne(FALSE); - } - if (items != pos) { - bad = 1; - BAD_PRINTF(("bad 32\n")); - } - return; - } else { - items = (int)pos; - } - - scheme_get_int_val(p, &pos); - f->Seek(pos); - } -} - -Bool wxMediaStreamIn::Ok(void) -{ - return !bad; -} - -/*********************************************************************/ - -wxMediaStreamOut::wxMediaStreamOut(wxMediaStreamOutBase *s) -{ - f = s; - bad = FALSE; - col = 72; -} - -void wxMediaStreamOut::Typeset(char WX_TYPESAFE_USED(v)) -{ - if (bad) - return; - - bad = f->Bad(); - - if (bad) { - wxmeError("editor-stream-out%: stream error"); - return; - } - -#if TYPESAFE - f->Write(&v, 1); -#endif -} - -wxMediaStreamOut *wxMediaStreamOut::PutFixed(long v) -{ - char buf[13]; - int spc; - - Typeset(st_FIXED); - - if (col + 12 > 72) { - col = 11; - spc = '\n'; - } else { - spc = ' '; - col += 12; - } - - if (v < 0) - sprintf(buf, " %10.10ld", v); - else - sprintf(buf, " %11.11ld", v); - buf[0] = spc; - f->Write(buf, 12); - - items++; - - return this; -} - -static int estimate_size(char *s, int ds, int n) -{ - int i, c, len = 3; - - for (i = 0; i < n; i++) { - c = ((unsigned char *)s)[i + ds]; - if (!c) - len += 2; - else if (((c >= '_') && (c <= '~')) - || ((c >= '#') && (c <= 'Z')) - || (c == ' ')) - len++; - else - len += 4; /* worst case */ - } - - return len; -} - -wxMediaStreamOut* wxMediaStreamOut::Put(long n, char *str, int ds) -{ - long len; - char *s; - - Put(n); - - Typeset(st_STRING); - - len = estimate_size(str, ds, n); - - if (len > 72) { - /* Single byte string doesn't fit on a line */ - int amt; - f->Write("\n(", 2); - while (n) { - if (n > 32) - amt = 32; - else - amt = n; - len = estimate_size(str, ds, amt); - if (len < 71) { - while (amt < n) { - if (estimate_size(str, ds, amt + 1) < 71) - amt++; - else - break; - } - } else { - while (1) { - if (estimate_size(str, ds, amt) < 71) - break; - --amt; - } - } - - s = scheme_write_to_string(scheme_make_sized_offset_byte_string(str, ds, amt, 0), &len); - f->Write("\n ", 2); - f->Write(s, len); - ds += amt; - n -= amt; - } - f->Write("\n)", 2); - col = 1; - } else { - s = scheme_write_to_string(scheme_make_sized_offset_byte_string(str, ds, n, 0), &len); - if (col + len + 1 > 72) { - f->Write("\n", 1); - col = 0; - } else { - f->Write(" ", 1); - col++; - } - f->Write(s, len); - // col += len; - col = 72; /* forcing a newline after every string makes the file more readable */ - } - - items++; - - return this; -} - -wxMediaStreamOut *wxMediaStreamOut::Put(char *v) -{ - return Put(strlen(v) + 1, v); -} - -wxMediaStreamOut *wxMediaStreamOut::Put(long v) -{ - char buf[13]; - int len; - - Typeset(st_NUMBER); - - sprintf(buf, " %ld", v); - - len = strlen(buf); - - if (col + len > 72) { - col = len - 1; - buf[0] = '\n'; - } else { - col += len; - } - - f->Write(buf, len); - - items++; - - return this; -} - -wxMediaStreamOut* wxMediaStreamOut::Put(short v) -{ - return Put((long)v); -} - -wxMediaStreamOut* wxMediaStreamOut::Put(int v) -{ - return Put((long)v); -} - -wxMediaStreamOut* wxMediaStreamOut::Put(char v) -{ - return Put((long)v); -} - -wxMediaStreamOut* wxMediaStreamOut::Put(double v) -{ - int digits, len; - char buffer[50]; - - Typeset(st_FLOAT); - - digits = 14; - while (digits < 30) { - double check; - GC_CAN_IGNORE char *ptr; - - sprintf(buffer, "%.*g", digits, v); - - /* Did we get read-write invariance, yet? */ - check = strtod(buffer, &ptr); - if (check == v) - break; - - digits++; - } - - len = strlen(buffer); - - if (col + len + 1 > 72) { - col = len; - f->Write("\n", 1); - } else { - f->Write(" ", 1); - col += len + 1; - } - - f->Write(buffer, len); - - items++; - - return this; -} - -wxMediaStreamOut* wxMediaStreamOut::Put(float v) -{ - return Put((double)v); -} - -long wxMediaStreamOut::Tell(void) -{ - long pos; - Scheme_Hash_Table *ht; - - pos = f->Tell(); - - ht = (Scheme_Hash_Table *)pos_map; - if (!ht) { - ht = scheme_make_hash_table(SCHEME_hash_ptr); - pos_map = (void *)ht; - } - - scheme_hash_set(ht, scheme_make_integer(items), - scheme_make_pair(scheme_make_integer_value(pos), - scheme_make_integer(col))); - - return items; -} - -void wxMediaStreamOut::JumpTo(long icount) -{ - long pos; - Scheme_Hash_Table *ht; - Scheme_Object *p; - - if (pos_map && !bad) { - ht = (Scheme_Hash_Table *)pos_map; - p = scheme_hash_get(ht, scheme_make_integer(icount)); - - if (p) { - scheme_get_int_val(SCHEME_CAR(p), &pos); - f->Seek(pos); - - p = SCHEME_CDR(p); - col = SCHEME_INT_VAL(p); - - items = icount; - } - } -} - -Bool wxMediaStreamOut::Ok(void) -{ - return !bad; -} - -void wxMediaStreamOut::PrettyFinish() -{ - if (!bad && col) { - f->Write("\n", 1); - col = 0; - } -} - -void wxMediaStreamOut::PrettyStart() -{ - if (!bad) { - char *s; - if (col) { - f->Write("\n", 1); - } - s = "#|\n This file is in PLT Scheme editor format.\n"; - f->Write(s, strlen(s)); - s = " Open this file in DrScheme version " MZSCHEME_WRITER_VERSION " or later to read it.\n"; - f->Write(s, strlen(s)); - s = "\n"; - f->Write(s, strlen(s)); - s = " Most likely, it was created by saving a program in DrScheme,\n"; - f->Write(s, strlen(s)); - s = " and it probably contains a program with non-text elements\n"; - f->Write(s, strlen(s)); - s = " (such as images or comment boxes).\n"; - f->Write(s, strlen(s)); - s = "\n"; - f->Write(s, strlen(s)); - s = " http://www.plt-scheme.org\n|#\n"; - f->Write(s, strlen(s)); - col = 0; - } -} diff --git a/src/mred/wxme/wx_medio.h b/src/mred/wxme/wx_medio.h deleted file mode 100644 index 053e670a2a..0000000000 --- a/src/mred/wxme/wx_medio.h +++ /dev/null @@ -1,262 +0,0 @@ -/* Header file for wxMediaStream */ - -#ifndef wx_medio -#define wx_medio - -#include "scheme.h" - -class wxMediaStreamInBase : public wxObject -{ - public: - virtual long Tell(void) = 0; - virtual void Seek(long) = 0; - virtual void Skip(long) = 0; - virtual Bool Bad(void) = 0; - virtual long Read(char *data, long len, long delta = 0) = 0; -}; - -class wxMediaStreamOutBase : public wxObject -{ - public: - virtual long Tell(void) = 0; - virtual void Seek(long) = 0; - virtual Bool Bad(void) = 0; - virtual void Write(char *data, long len) = 0; - void Write(char *data, long len, int delta); -}; - -/*******************************************************************/ - -class wxMediaStreamInFileBase : public wxMediaStreamInBase -{ - Scheme_Object *f; - public: - wxMediaStreamInFileBase(Scheme_Object *s); - ~wxMediaStreamInFileBase(); - - long Tell(void); - void Seek(long); - void Skip(long); - Bool Bad(void); - long Read(char *data, long len, long delta = 0); -}; - -class wxMediaStreamOutFileBase : public wxMediaStreamOutBase -{ - Scheme_Object *f; - public: - wxMediaStreamOutFileBase(Scheme_Object *s); - ~wxMediaStreamOutFileBase(); - - long Tell(void); - void Seek(long); - Bool Bad(void); - void Write(char *data, long len); - void Write(char *data, long len, int delta); -}; - -/*******************************************************************/ - -class wxMediaStreamInStringBase : public wxMediaStreamInBase -{ - char *a_string; - long len; - long pos; - Bool bad; - public: - wxMediaStreamInStringBase(char *s, long len); - ~wxMediaStreamInStringBase(); - - long Tell(void); - void Seek(long); - void Skip(long); - Bool Bad(void); - long Read(char *data, long len, long delta = 0); -}; - -class wxMediaStreamOutStringBase : public wxMediaStreamOutBase -{ - char *a_string; - long len, alloc; - long pos; - Bool bad; - public: - wxMediaStreamOutStringBase(); - ~wxMediaStreamOutStringBase(); - - char *GetString(long *len); - - long Tell(void); - void Seek(long); - Bool Bad(void); - void Write(char *data, long len); - void Write(char *data, long len, int delta); -}; - -/*******************************************************************/ - -#define MRED_READER_STR "#reader(lib\"read.ss\"\"wxme\")" -#define MRED_READER_STR_LEN 27 -#define MRED_START_STR_LEN 4 -#define MRED_START_STR "WXME" -#define MRED_START_STR_LEN 4 -#define MRED_FORMAT_STR "01" -#define MRED_FORMAT_STR_LEN 2 -#define MRED_VERSION_STR "08" -#define MRED_VERSION_STR_LEN 2 -#define MZSCHEME_WRITER_VERSION "370" - -#define WXME_VERSION_ONE(f) (f->read_version[1] == '1') -#define WXME_VERSION_TWO(f) (f->read_version[1] == '2') -#define WXME_VERSION_THREE(f) (f->read_version[1] == '3') -#define WXME_VERSION_FOUR(f) (f->read_version[1] == '4') -#define WXME_VERSION_FIVE(f) (f->read_version[1] == '5') -#define WXME_VERSION_SIX(f) (f->read_version[1] == '6') -#define WXME_VERSION_SEVEN(f) (f->read_version[1] == '7') -#define WXME_VERSION_BEFORE_EIGHT(f) ((f->read_version[1] >= '1') && (f->read_version[1] <= '7')) - -class wxStandardSnipClassList; -class wxBufferDataClassList; -class wxSnipClass; -class wxBufferDataClass; -class wxStyleList; -class wxStyle; - -class wxSnipClassLink -{ - public: - wxSnipClass *c; - char *name; - Bool headerFlag; - short mapPosition; - int readingVersion; - wxSnipClassLink *next; -}; - -class wxDataClassLink -{ - public: - wxBufferDataClass *d; - char *name; - int mapPosition; - wxDataClassLink *next; -}; - -class wxStyleListLink -{ - public: - wxStyleList *styleList; - int listId; - wxStyle **styleMap; - int numMappedStyles; - wxStyle *basic; /* used to detect clearing */ - - wxStyleListLink *next; -}; - -class wxMediaStream : public wxObject -{ - public: - wxStandardSnipClassList *scl; - wxBufferDataClassList *bdl; - char read_format[MRED_FORMAT_STR_LEN + 1]; - char read_version[MRED_VERSION_STR_LEN + 1]; - wxSnipClassLink *sl; - wxDataClassLink *dl; - - wxStyleListLink *ssl; - int styleCount; - - wxMediaStream(); - ~wxMediaStream(); - - int MapPosition(wxSnipClass *c); - int MapPosition(wxBufferDataClass *d); - - int GetHeaderFlag(wxSnipClass *c); - void SetHeaderFlag(wxSnipClass *c); - - int ReadingVersion(wxSnipClass *c); -}; - -/*******************************************************************/ - -class wxMediaStreamIn : public wxMediaStream -{ - wxMediaStreamInBase *f; - long *boundaries; - int boundalloc, boundcount; - int bad; - int items; - void *pos_map; - - void Typecheck(char); - - void GetNumber(long*, double*); - char *GetAString(long *n, long limit, char *target, int extra, int recur); - void IncItemCount(); - void SkipOne(int recur); - char SkipWhitespace(char *buf = NULL); - int IsDelim(char c); - - public: - wxMediaStreamIn(wxMediaStreamInBase *base); - ~wxMediaStreamIn(); - - wxMediaStreamIn* Get(long *n, char *str); - wxMediaStreamIn* Get(long*); - wxMediaStreamIn* Get(short*); - wxMediaStreamIn* Get(int*); - wxMediaStreamIn* Get(char*); - wxMediaStreamIn* Get(float*); - wxMediaStreamIn* Get(double*); - - wxMediaStreamIn* GetFixed(long*); - - char *GetString(long *len, int extra = 0); - char *GetStringPlusOne(long *len); - - void SetBoundary(long n); - void RemoveBoundary(); - - void Skip(long n); - long Tell(void); - void JumpTo(long pos); - - Bool Ok(void); -}; - -class wxMediaStreamOut : public wxMediaStream -{ - wxMediaStreamOutBase *f; - int bad, col; - int items; /* position count in items */ - void *pos_map; /* map from position count to stream location */ - - void Typeset(char); - - public: - wxMediaStreamOut(wxMediaStreamOutBase *s); - - wxMediaStreamOut* Put(long n, char *str, int ds = 0); - wxMediaStreamOut* Put(char *); - wxMediaStreamOut* Put(long); - wxMediaStreamOut* Put(short); - wxMediaStreamOut* Put(int); - wxMediaStreamOut* Put(char); - wxMediaStreamOut* Put(float); - wxMediaStreamOut* Put(double); - - wxMediaStreamOut* PutFixed(long); - - long Tell(void); - void JumpTo(long pos); - - Bool Ok(void); - - void PrettyStart(); - void PrettyFinish(); -}; - -#endif /* wx_medio */ - diff --git a/src/mred/wxme/wx_medpb.h b/src/mred/wxme/wx_medpb.h deleted file mode 100644 index e3c02eef71..0000000000 --- a/src/mred/wxme/wx_medpb.h +++ /dev/null @@ -1,271 +0,0 @@ - -/* Included by wx_media.h */ - -class wxMediaPasteboard : public wxMediaBuffer -{ - protected: - Bool ReadInsert(wxSnip *snip); - void InsertPasteSnip(wxSnip *snip, wxBufferData *); - void InsertPasteString(wxchar *str); - public: - wxMediaPasteboard(); - ~wxMediaPasteboard(); - - virtual void OnEvent(wxMouseEvent *event); - virtual void OnChar(wxKeyEvent *event); - virtual wxCursor *AdjustCursor(wxMouseEvent *event); - virtual void Refresh(double localx, double localy, double w, double h, - int show_caret, wxColour *c); - virtual void OwnCaret(Bool ownit); - virtual void BlinkCaret(); - virtual void SizeCacheInvalid(void); - void GetExtent(double *w, double *h); - - virtual void OnDefaultEvent(wxMouseEvent *event); - virtual void OnDefaultChar(wxKeyEvent *event); - - virtual void OnDoubleClick(wxSnip *, wxMouseEvent *event); - - /* Callbacks for the wxSnipAdmin: */ - virtual Bool ScrollTo(wxSnip *, double localx, double localy, - double w, double h, Bool refresh, int bias = 0); - virtual void SetCaretOwner(wxSnip *, int = wxFOCUS_IMMEDIATE); - virtual void Resized(wxSnip *, Bool redraw_now); - virtual Bool Recounted(wxSnip *, Bool redraw_now); - virtual void NeedsUpdate(wxSnip *, double localx, double localy, - double w, double h); - virtual Bool ReleaseSnip(wxSnip *); - - double ScrollLineLocation(long line); - long NumScrollLines(); - long FindScrollLine(double y); - - wxMediaBuffer *CopySelf(void); - void CopySelfTo(wxMediaBuffer *b); - double GetDescent(void); - double GetSpace(void); - wxchar *GetFlattenedText(long *got=NULL); - void GetCenter(double *x, double *y); - - void Clear(); - void Cut(Bool extend=FALSE, long time=0); - void Copy(Bool extend=FALSE, long time=0); - void Paste(long time=0); - void PasteSelection(long time=0); - void Kill(long time=0); - void SelectAll(void); - - virtual void DoCopy(long time, Bool extend); - virtual void DoPaste(long time); - virtual void DoPasteSelection(long time); - - void DoGenericPaste(wxClipboard *cb, long time); - void GenericPaste(Bool x_sel, long time); - - void SetSelected(wxSnip *); - void AddSelected(wxSnip *); - void RemoveSelected(wxSnip *); - void NoSelected(); - void AddSelected(double x, double y, double w, double h); - - void Insert(wxSnip *snip, wxSnip *before, double x, double y); - void Insert(wxSnip *snip, double x, double y); - void Insert(wxSnip *snip); - void Insert(wxSnip *snip, wxSnip *before); - - void Delete(); - void Delete(wxSnip *snip); - void Remove(wxSnip *snip); - - void Erase(void); - - void ChangeStyle(wxStyleDelta *delta); - void ChangeStyle(wxStyle *style, wxSnip *snip = NULL); - void ChangeStyle(wxStyleDelta *delta, wxSnip *snip); - - Bool ReallyCanEdit(int op); - - Bool GetSnipLocation(wxSnip *thesnip, double *x = NULL, double *y = NULL, Bool bottomRight=FALSE); - - void SetFilename(char *, Bool temp = FALSE); - - Bool WriteToFile(wxMediaStreamOut *); - Bool ReadFromFile(wxMediaStreamIn *, Bool overwritestyle = FALSE); - Bool SavePort(Scheme_Object *port, int format = wxMEDIA_FF_SAME, Bool showErrors = TRUE); - int InsertPort(Scheme_Object *port, int format = wxMEDIA_FF_GUESS, Bool replaceStyles = TRUE); - - void StyleHasChanged(wxStyle *style); - - /* For making a lot of changes to be displayed at once: */ - void BeginEditSequence(Bool undoable = TRUE, Bool interruptSeqs = TRUE); - void EndEditSequence(void); - Bool RefreshDelayed(void); - Bool InEditSequence(void); - Bool LocationsUpToDate(void); - - void SetMaxWidth(double w); - void SetMinWidth(double w); - double GetMaxWidth(); - double GetMinWidth(); - void SetMinHeight(double h); - void SetMaxHeight(double w); - double GetMinHeight(); - double GetMaxHeight(); - - virtual void PrintToDC(wxDC *print, int page = -1); - virtual void *BeginPrint(wxDC *, Bool); - virtual void EndPrint(wxDC *, void *); - virtual Bool HasPrintPage(wxDC *dc, int page); - - void AddPasteboardFunctions(wxKeymap *tab); - - wxSnip *FindSnip(double x, double y, wxSnip *after=NULL); - wxSnip *FindFirstSnip(void); - - Bool IsSelected(wxSnip *asnip); - wxSnip *FindNextSelectedSnip(wxSnip *start); - - void MoveTo(wxSnip *, double x, double y); - void Move(wxSnip *, double x, double y); - void Move(double x, double y); - - Bool Resize(wxSnip *, double w, double h); - - void Raise(wxSnip *snip); - void Lower(wxSnip *snip); - void SetBefore(wxSnip *snip, wxSnip *before); - void SetAfter(wxSnip *snip, wxSnip *after); - - Bool GetDragable(); - void SetDragable(Bool); - - Bool GetSelectionVisible(); - void SetSelectionVisible(Bool); - - virtual void SetSnipData(wxSnip *, wxBufferData *); - virtual wxBufferData *GetSnipData(wxSnip *snip); - - virtual void InvalidateBitmapCache(double x=0.0, double y=0.0, - double w=-1.0, double h=-1.0); - -#if ALLOW_X_STYLE_SELECTION - virtual Bool OwnXSelection(Bool on, Bool update, Bool force); -#endif - - /* Override these for your own use: */ - virtual void OnChange(void); - virtual Bool CanInsert(wxSnip *, wxSnip *, double x, double y); - virtual void OnInsert(wxSnip *, wxSnip *, double x, double y); - virtual void AfterInsert(wxSnip *, wxSnip *, double x, double y); - virtual Bool CanDelete(wxSnip *); - virtual void OnDelete(wxSnip *); - virtual void AfterDelete(wxSnip *); - virtual Bool CanMoveTo(wxSnip *, double x, double y, Bool dragging); - virtual void OnMoveTo(wxSnip *, double x, double y, Bool dragging); - virtual void AfterMoveTo(wxSnip *, double x, double y, Bool dragging); - virtual Bool CanResize(wxSnip *, double w, double h); - virtual void OnResize(wxSnip *, double w, double h); - virtual void AfterResize(wxSnip *, double w, double h, Bool did); - virtual Bool CanReorder(wxSnip *, wxSnip *, Bool); - virtual void OnReorder(wxSnip *, wxSnip *, Bool); - virtual void AfterReorder(wxSnip *, wxSnip *, Bool); - - virtual Bool CanSelect(wxSnip *, Bool on); - virtual void OnSelect(wxSnip *, Bool on); - virtual void AfterSelect(wxSnip *, Bool on); - - virtual Bool CanInteractiveMove(wxMouseEvent *); - virtual void OnInteractiveMove(wxMouseEvent *); - virtual void AfterInteractiveMove(wxMouseEvent *); - virtual Bool CanInteractiveResize(wxSnip *snip); - virtual void OnInteractiveResize(wxSnip *snip); - virtual void AfterInteractiveResize(wxSnip *snip); - - virtual void InteractiveAdjustMouse(double *x, double *y); - virtual void InteractiveAdjustResize(wxSnip *s, double *x, double *y); - virtual void InteractiveAdjustMove(wxSnip *s, double *x, double *y); - - void SetScrollStep(double s); - double GetScrollStep(void); - - Bool IsLockedForWrite() { return writeLocked; } - Bool IsLockedForFlow() { return flowLocked; } - - private: - Bool dragable, selectionVisible; - - wxSnip *snips, *lastSnip; - Scheme_Hash_Table *snipLocationList; - - wxStandardSnipAdmin *snipAdmin; - - long lastTime; - double startX, startY; - double lastX, lastY; - - double origX, origY, origW, origH; - - double maxWidth, minWidth, minHeight, maxHeight; - - Bool keepSize, dragging, rubberband; - - int needResize; - - wxSnip *resizing; - double sizedxm, sizedym; - - double scrollStep; - - double totalWidth, totalHeight, realWidth, realHeight; - - double updateLeft, updateRight, updateTop, updateBottom; - Bool updateNonempty, noImplicitUpdate; - - Bool sizeCacheInvalid; - int writeLocked; - Bool flowLocked; - - int sequence; - - int delayedscrollbias; - wxSnip *delayedscrollsnip; - double delayedscrollX, delayedscrollY, delayedscrollW, delayedscrollH; - - Bool sequenceStreak; - - Bool changed; - - void InitDragging(wxMouseEvent *); - void FinishDragging(wxMouseEvent *); - - void DoSelect(wxSnip *, Bool on); - - void DoEventResize(double eventX, double eventY); - void DoEventMove(double eventX, double eventY); - - Bool _Delete(wxSnip *, wxDeleteSnipRecord *del); - - Bool InsertFile(const char *who, Scheme_Object *f, const char *filename, Bool clearStyles, Bool showErrors); - - void Draw(wxDC *dc, double dx, double dy, - double cx, double cy, double cw, double ch, - int show_caret, wxColour *bg); - - Bool FindDot(wxSnipLocation *loc, double x, double y, - double *dxm, double *dym); - - void Update(double x, double y, double w, double h); - void UpdateSnip(wxSnip *); - void UpdateLocation(wxSnipLocation *); - void UpdateSelected(); - void UpdateAll(); - void UpdateNeeded(); - - void CheckRecalc(); - - void RubberBand(double x, double y, double w, double h); - - void _ChangeStyle(wxStyle *style, wxStyleDelta *delta, wxSnip *snip); - - wxSnip *SnipSetAdmin(wxSnip *snip, wxSnipAdmin *a); -}; diff --git a/src/mred/wxme/wx_mline.cxx b/src/mred/wxme/wx_mline.cxx deleted file mode 100644 index 60b7ac05cf..0000000000 --- a/src/mred/wxme/wx_mline.cxx +++ /dev/null @@ -1,1306 +0,0 @@ -/* - * File: wx_mline.cc - * Purpose: wxMediaLine (internal class for wxMediaEdit) implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" -#include "wx_media.h" -#include "wx_mline.h" -#include "wx_ptreq.h" - -#define MAX_W_MASK (WXLINE_MAX_W_HERE | WXLINE_MAX_W_LEFT | WXLINE_MAX_W_RIGHT) -#define COLOR_MASK (WXLINE_RED | WXLINE_BLACK) -#define CALC_MASK (WXLINE_CALC_HERE | WXLINE_CALC_LEFT | WXLINE_CALC_RIGHT) -#define FLOW_MASK (WXLINE_FLOW_HERE | WXLINE_FLOW_LEFT | WXLINE_FLOW_RIGHT) - -#define SET_RED(n) n->flags = ((n->flags & ~COLOR_MASK) | WXLINE_RED) -#define SET_BLACK(n) n->flags = ((n->flags & ~COLOR_MASK) | WXLINE_BLACK) - -#define REDP(node) (node->flags & WXLINE_RED) -#define BLACKP(node) (node->flags & WXLINE_BLACK) - -wxMediaLine *NIL; - -static wxMediaParagraph *plain_paragraph = NULL; - -/*****************************************************************/ - -wxMediaLine::wxMediaLine() -{ - if (!NIL) { - wxREGGLOB(NIL); - NIL = this; - } - - pos = line = scroll = 0; - y = 0; - - prev = next = NULL; - left = right = parent = NIL; - - flags = WXLINE_BLACK | WXLINE_MAX_W_HERE | WXLINE_CALC_HERE; - w = maxWidth = 0; - - snip = lastSnip = scrollSnip = NULL; - - numscrolls = 1; - len = 0; - h = w = 0; - lastH = lastW = 0; - bottombase = topbase = 0; - parno = 0; -} - -wxMediaLine::~wxMediaLine() -{ - if (PTRNE(left, NIL)) - DELETE_OBJ left; - if (PTRNE(right, NIL)) - DELETE_OBJ right; -} - -/*****************************************************************/ - -void wxMediaLine::AdjustOffsets(wxMediaLine *newchild) -{ - if (PTREQ(newchild, NIL)) - return; - - newchild->line -= line + 1; - newchild->pos -= pos + len; - newchild->scroll -= scroll + numscrolls; - newchild->y -= y + h; - newchild->parno -= parno + StartsParagraph(); -} - -void wxMediaLine::DeadjustOffsets(wxMediaLine *oldchild) -{ - if (PTREQ(oldchild, NIL)) - return; - - oldchild->line += line + 1; - oldchild->pos += pos + len; - oldchild->scroll += scroll + numscrolls; - oldchild->y += y + h; - oldchild->parno += parno + StartsParagraph(); -} - -void wxMediaLine::RotateLeft(wxMediaLine **root) -{ - wxMediaLine *oldright; - - oldright = right; - - DeadjustOffsets(oldright); - - right = oldright->left; - if (PTRNE(right, NIL)) - right->parent = this; - - oldright->parent = parent; - if (PTREQ(parent, NIL)) - *root = oldright; - else if (PTREQ(this, parent->left)) - parent->left = oldright; - else - parent->right = oldright; - - oldright->left = this; - parent = oldright; - - AdjustMaxWidth(); - AdjustNeedCalc(); - AdjustNeedFlow(); - oldright->AdjustMaxWidth(); - oldright->AdjustNeedCalc(); - oldright->AdjustNeedFlow(); -} - -void wxMediaLine::RotateRight(wxMediaLine **root) -{ - wxMediaLine *oldleft; - - oldleft = left; - - oldleft->AdjustOffsets(this); - - left = oldleft->right; - if (PTRNE(left, NIL)) - left->parent = this; - - oldleft->parent = parent; - if (PTREQ(parent, NIL)) - *root = oldleft; - else if (PTREQ(this, parent->left)) - parent->left = oldleft; - else - parent->right = oldleft; - - oldleft->right = this; - parent = oldleft; - - AdjustMaxWidth(); - AdjustNeedCalc(); - AdjustNeedFlow(); - oldleft->AdjustMaxWidth(); - oldleft->AdjustNeedCalc(); - oldleft->AdjustNeedFlow(); -} - -wxMediaLine *wxMediaLine::Insert(wxMediaLine **root, Bool before) -{ - wxMediaLine *newline, *node; - - newline = new WXGC_PTRS wxMediaLine; - - if (PTREQ(*root, NIL)) { - *root = newline; - return newline; - } - - SET_RED(newline); - - if (before) { - newline->prev = prev; - if (prev) - prev->next = newline; - newline->next = this; - prev = newline; - } else { - newline->prev = this; - newline->next = next; - if (next) - next->prev = newline; - next = newline; - } - - if (before) { - if (PTREQ(left, NIL)) { - left = newline; - node = this; - } else { - node = left; - while (PTRNE(node->right, NIL)) { - node = node->right; - } - node->right = newline; - } - } else { - if (PTREQ(right, NIL)) { - right = newline; - node = this; - } else { - node = right; - while (PTRNE(node->left, NIL)) { - node = node->left; - } - node->left = newline; - } - } - - newline->parent = node; - node->AdjustNeedCalc(TRUE); - - node = newline; - while (PTRNE(node->parent, NIL)) { - if (PTREQ(node, node->parent->left)) { - node = node->parent; - newline->DeadjustOffsets(node); - } else - node = node->parent; - } - - node = newline; - while (PTRNE(node, *root) && REDP(node->parent)) { - if (PTREQ(node->parent, node->parent->parent->left)) { - wxMediaLine *v = node->parent->parent->right; - if (REDP(v)) { - SET_BLACK(node->parent); - SET_BLACK(v); - node = node->parent->parent; - SET_RED(node); - } else { - if (PTREQ(node, node->parent->right)) { - node = node->parent; - node->RotateLeft(root); - } - SET_BLACK(node->parent); - node = node->parent->parent; - SET_RED(node); - node->RotateRight(root); - } - } else { - wxMediaLine *v = node->parent->parent->left; - if (REDP(v)) { - SET_BLACK(node->parent); - SET_BLACK(v); - node = node->parent->parent; - SET_RED(node); - } else { - if (PTREQ(node, node->parent->left)) { - node = node->parent; - node->RotateRight(root); - } - SET_BLACK(node->parent); - node = node->parent->parent; - SET_RED(node); - node->RotateLeft(root); - } - } - } - - SET_BLACK((*root)); - - return newline; -} - -void wxMediaLine::Delete(wxMediaLine **root) -{ - wxMediaLine *v, *x; - Bool wasBlack; - - /* Adjust ancestor offsets */ - v = this; - while (PTRNE(v->parent, NIL)) { - if (PTREQ(v->parent->right, v)) - v = v->parent; - else { - v = v->parent; - v->line -= 1; - v->pos -= len; - v->scroll -= numscrolls; - v->y -= h; - v->parno -= StartsParagraph(); - } - } - - if (PTREQ(left, NIL) || PTREQ(right, NIL)) { - v = this; - } else { - v = this->next; - x = v; - while (PTRNE(x->parent, this)) { - if (PTREQ(x->parent->right, x)) - x = x->parent; - else { - x = x->parent; - x->line -= 1; - x->pos -= v->len; - x->scroll -= v->numscrolls; - x->y -= v->h; - x->parno -= v->StartsParagraph(); - } - } - } - - if (PTRNE(v->left, NIL)) - x = v->left; - else - x = v->right; - - x->parent = v->parent; /* x could be NIL; fixup at end */ - - if (PTREQ(v->parent, NIL)) - *root = x; - else if (PTREQ(v, v->parent->left)) - v->parent->left = x; - else - v->parent->right = x; - - wasBlack = BLACKP(v); - - if (PTRNE(v, this)) { - wxMediaLine *oldparent; - - oldparent = v->parent; - - if (BLACKP(this)) - SET_BLACK(v); - else - SET_RED(v); - - v->left = left; - if (PTRNE(left, NIL)) - left->parent = v; - v->right = right; - if (PTRNE(right, NIL)) - right->parent = v; - v->parent = parent; - if (PTREQ(*root, this)) - *root = v; - else if (PTREQ(parent->right, this)) - parent->right = v; - else - parent->left = v; - - v->prev = prev; - if (v->prev) - v->prev->next = v; - - v->line = line; - v->pos = pos; - v->scroll = scroll; - v->y = this->y; - v->parno = parno; - - oldparent->AdjustMaxWidth(TRUE); - oldparent->AdjustNeedCalc(TRUE); - oldparent->AdjustNeedFlow(TRUE); - - v->AdjustMaxWidth(TRUE); - v->AdjustNeedCalc(TRUE); - v->AdjustNeedFlow(TRUE); - - if (PTREQ(x->parent, this)) - x->parent = v; - } else { - if (prev) - prev->next = next; - if (next) - next->prev = prev; - } - - if (wasBlack) { - /* Fixup */ - wxMediaLine *z; - - while (PTRNE(x, *root) && BLACKP(x)) { - if (PTREQ(x, x->parent->left)) { - z = x->parent->right; - if (REDP(z)) { - SET_BLACK(z); - SET_RED(x->parent); - x->parent->RotateLeft(root); - z = x->parent->right; - } - if (BLACKP(z->left) && BLACKP(z->right)) { - SET_RED(z); - x = x->parent; - } else { - if (BLACKP(z->right)) { - SET_BLACK(z->left); - SET_RED(z); - z->RotateRight(root); - z = x->parent->right; - } - if (REDP(x->parent)) - SET_RED(z); - else - SET_BLACK(z); - SET_BLACK(x->parent); - SET_BLACK(z->right); - x->parent->RotateLeft(root); - x = *root; - } - } else { - z = x->parent->left; - if (REDP(z)) { - SET_BLACK(z); - SET_RED(x->parent); - x->parent->RotateRight(root); - z = x->parent->left; - } - if (BLACKP(z->right) && BLACKP(z->left)) { - SET_RED(z); - x = x->parent; - } else { - if (BLACKP(z->left)) { - SET_BLACK(z->right); - SET_RED(z); - z->RotateLeft(root); - z = x->parent->left; - } - if (REDP(x->parent)) - SET_RED(z); - else - SET_BLACK(z); - SET_BLACK(x->parent); - SET_BLACK(z->left); - x->parent->RotateRight(root); - x = *root; - } - } - } - - SET_BLACK(x); - } - - if (PTRNE(NIL->parent, NIL)) { - /* fixup: we set NIL's parent above */ - NIL->parent = NIL; - } - - right = left = NIL; - DELETE_OBJ this; -} - -/***************************************************************/ - -#define SEARCH(what, size) \ - wxMediaLine *node, *_prev; \ - \ - node = this; \ - \ - do { \ - _prev = node; \ - if (what < node->what) \ - node = node->left; \ - else if (what >= node->what + size) { \ - what -= node->what + size; \ - node = node->right; \ - } else \ - return node; \ - } while (PTRNE(node, NIL)); \ - \ - return _prev; \ - -wxMediaLine *wxMediaLine::FindLine(long line) -{ - SEARCH(line, 1); -} - -wxMediaLine *wxMediaLine::FindPosition(long pos) -{ - SEARCH(pos, node->len); -} - -wxMediaLine *wxMediaLine::FindScroll(long scroll) -{ - SEARCH(scroll, node->numscrolls); -} - -wxMediaLine *wxMediaLine::FindLocation(double y) -{ - SEARCH(y, node->h); -} - -wxMediaLine *wxMediaLine::FindParagraph(long parno) -{ - wxMediaLine *node; - - node = this; - - do { - if (parno < node->parno) - node = node->left; - else if (parno > node->parno - || (parno == node->parno - && !node->StartsParagraph())) { - parno -= node->parno + node->StartsParagraph(); - node = node->right; - } else - return node; - } while (PTRNE(node, NIL)); - - return NULL; -} - -/***************************************************************/ - -#define SUM(what, lwhat, size, adjust) \ - wxMediaLine *node; \ - \ - node = this; \ - \ - lwhat = node->what; \ - while (PTRNE(node->parent, NIL)) { \ - if (PTREQ(node, node->parent->left)) \ - node = node->parent; \ - else { \ - node = node->parent; \ - lwhat += node->what + size; \ - } \ - } \ - \ - return lwhat + adjust; \ - -long wxMediaLine::GetLine() -{ - long _line; - SUM(line, _line, 1, 0); -} - -long wxMediaLine::GetPosition() -{ - long _pos; - SUM(pos, _pos, node->len, 0); -} - -long wxMediaLine::GetScroll() -{ - long _scroll; - SUM(scroll, _scroll, node->numscrolls, 0); -} - -double wxMediaLine::GetLocation() -{ - double _y; - SUM(y, _y, node->h, 0); -} - -long wxMediaLine::GetParagraph() -{ - long _parno; - SUM(parno, _parno, node->StartsParagraph(), (StartsParagraph() ? 0 : -1)); -} - -wxMediaParagraph *wxMediaLine::GetParagraphStyle(Bool *first) -{ - if (flags & WXLINE_STARTS_PARA) { - if (first) *first = 1; - return paragraph; - } else { - wxMediaLine *root, *pstart; - int p; - if (first) *first = 0; - root = GetRoot(); - p = GetParagraph(); - pstart = root->FindParagraph(p); - return pstart->paragraph; - } -} - -/***************************************************************/ - -#define ADJUST(what, adj) \ - wxMediaLine *node; \ - \ - node = this; \ - \ - delta = what - node->what; \ - node->what = what; \ - while (PTRNE(node->parent, NIL)) { \ - if (PTREQ(node, node->parent->left)) { \ - node = node->parent; \ - node->adj += delta; \ - } else { \ - node = node->parent; \ - } \ - } - - -void wxMediaLine::SetLength(long len) -{ - long delta; - ADJUST(len, pos); -} - -void wxMediaLine::CalcLineLength() -{ - wxSnip *asnip, *nexts; - long l = 0; - - nexts = lastSnip->next; - for(asnip = snip; PTRNE(asnip, nexts); asnip = asnip->next) { - l += asnip->count; - if (asnip->flags & wxSNIP_WIDTH_DEPENDS_ON_X) - asnip->SizeCacheInvalid(); - } - - if (l != len) - SetLength(l); - - if (next && (lastSnip->flags & wxSNIP_HARD_NEWLINE)) { - if (!next->StartsParagraph()) - next->SetStartsParagraph(TRUE); - } else if (next) - if (next->StartsParagraph()) - next->SetStartsParagraph(FALSE); - - if (!prev || (prev->lastSnip->flags & wxSNIP_HARD_NEWLINE)) { - if (!StartsParagraph()) - SetStartsParagraph(TRUE); - } else - if (StartsParagraph()) - SetStartsParagraph(FALSE); -} - -void wxMediaLine::SetScrollLength(long numscrolls) -{ - long delta; - ADJUST(numscrolls, scroll); -} - -void wxMediaLine::SetHeight(double h) -{ - double delta; - ADJUST(h, y); -} - -void wxMediaLine::SetStartsParagraph(Bool starts) -{ - wxMediaLine *node; - - if ((starts ? 1 : 0) == StartsParagraph()) - return; - - if (starts) { - flags |= WXLINE_STARTS_PARA; - if (!paragraph) { - if (!plain_paragraph) { - wxREGGLOB(plain_paragraph); - paragraph = new WXGC_PTRS wxMediaParagraph(); - paragraph->leftMarginFirst = 0; - paragraph->leftMargin = 0; - paragraph->rightMargin = 0; - paragraph->alignment = WXPARA_LEFT; - plain_paragraph = paragraph; - } else - paragraph = plain_paragraph; - } - } else { - flags -= WXLINE_STARTS_PARA; - paragraph = NULL; - } - - node = this; - - while (PTRNE(node->parent, NIL)) { - if (PTREQ(node, node->parent->left)) { - node = node->parent; - if (starts) - node->parno += 1; - else - node->parno -= 1; - } else { - node = node->parent; - } - } -} - -/***************************************************************/ - -void wxMediaLine::AdjustMaxWidth(Bool recur) -{ - wxMediaLine *node = this; - long which, old; - - if (PTREQ(this, NIL)) - return; - - while (1) { - old = node->flags & MAX_W_MASK; - - if (PTRNE(node->right, NIL) - && node->right->maxWidth > node->w - && (PTREQ(node->left, NIL) - || node->right->maxWidth > node->left->maxWidth)) { - node->maxWidth = node->right->maxWidth; - which = WXLINE_MAX_W_RIGHT; - } else if (PTRNE(node->left, NIL) - && node->left->maxWidth > node->w) { - node->maxWidth = node->left->maxWidth; - which = WXLINE_MAX_W_LEFT; - } else { - node->maxWidth = node->w; - which = WXLINE_MAX_W_HERE; - } - - if (old != which) { - node->flags &= ~MAX_W_MASK; - node->flags |= which; - } - - node = node->parent; - if (!recur || PTREQ(node, NIL)) - return; - } -} - -void wxMediaLine::SetWidth(double w) -{ - this->w = w; - AdjustMaxWidth(TRUE); -} - -/***************************************************************/ - -double wxMediaLine::ScrollOffset(long p) -{ - if (!scrollSnip) - return 0; - - if (p >= numscrolls) - return h; - - return scrollSnip->GetScrollStepOffset(p); -} - -long wxMediaLine::FindExtraScroll(double y) -{ - if (y >= h) - return numscrolls; - if (y <= 0) - return 0; - - if (!scrollSnip) - return 0; - - return scrollSnip->FindScrollStep(y); -} - -/***************************************************************/ - -void wxMediaLine::MarkRecalculate() -{ - if (!(flags & WXLINE_CALC_HERE)) { - flags |= WXLINE_CALC_HERE; - if (PTRNE(parent, NIL)) - parent->AdjustNeedCalc(TRUE); - } -} - -void wxMediaLine::AdjustNeedCalc(Bool recur) -{ - wxMediaLine *node = this; - long which, old; - - while (1) { - old = node->flags & CALC_MASK; - - which = old & WXLINE_CALC_HERE; - - if (PTRNE(node->right, NIL) && node->right->flags & CALC_MASK) - which |= WXLINE_CALC_RIGHT; - if (PTRNE(node->left, NIL) && node->left->flags & CALC_MASK) - which |= WXLINE_CALC_LEFT; - - if (old != which) { - node->flags &= ~CALC_MASK; - node->flags |= which; - if (!recur || PTREQ(node->parent, NIL)) - return; - node = node->parent; - } else - return; - } -} - -/***************************************************************/ - -void wxMediaLine::MarkCheckFlow() -{ - if (!(flags & WXLINE_FLOW_HERE)) { - flags |= WXLINE_FLOW_HERE; - if (PTRNE(parent, NIL)) - parent->AdjustNeedFlow(TRUE); - } -} - -void wxMediaLine::AdjustNeedFlow(Bool recur) -{ - wxMediaLine *node = this; - long which, old; - - while (1) { - old = node->flags & FLOW_MASK; - - which = old & WXLINE_FLOW_HERE; - - if (PTRNE(node->right, NIL) && node->right->flags & FLOW_MASK) - which |= WXLINE_FLOW_RIGHT; - if (PTRNE(node->left, NIL) && node->left->flags & FLOW_MASK) - which |= WXLINE_FLOW_LEFT; - - if (old != which) { - node->flags &= ~FLOW_MASK; - node->flags |= which; - if (!recur || PTREQ(node->parent, NIL)) - return; - node = node->parent; - } else - return; - } -} - -/***************************************************************/ - -wxMediaLine *wxMediaLine::GetRoot() -{ - wxMediaLine *node; - - node = this; - while (PTRNE(node->parent, NIL)) { - node = node->parent; - } - - return node; -} - -/***************************************************************/ - -Bool wxMediaLine::UpdateFlow(wxMediaLine **root, - wxMediaEdit *media, double maxWidth, wxDC *dc) -{ - if (flags & WXLINE_FLOW_LEFT) { - if (PTRNE(left, NIL) && left->UpdateFlow(root, media, maxWidth, dc)) - return TRUE; - flags -= WXLINE_FLOW_LEFT; - } - - if (flags & WXLINE_FLOW_HERE) { - Bool firstLine; - wxMediaParagraph *para; - double lineMaxWidth; - - flags -= WXLINE_FLOW_HERE; - - para = GetParagraphStyle(&firstLine); - lineMaxWidth = para->GetLineMaxWidth(maxWidth, firstLine); - - if (media->CheckFlow(lineMaxWidth, dc, GetLocation(), GetPosition(), snip)) { - wxSnip *asnip; - - for (asnip = snip; PTRNE(asnip, lastSnip); asnip = asnip->next) { - if (asnip->flags & wxSNIP_NEWLINE) { - /* Items pushed to next line or new line was inserted */ - wxSnip *nextsnip = NULL; - - if (next) { - nextsnip = asnip->next; - while (nextsnip && PTRNE(nextsnip, next->lastSnip) - && !(nextsnip->flags & wxSNIP_NEWLINE)) { - nextsnip = nextsnip->next; - } - } - - if (!next || PTRNE(nextsnip, next->lastSnip)) { - /* It was a new line */ - - wxMediaLine *newline; - - newline = Insert(root, FALSE); - newline->snip = asnip->next; - newline->lastSnip = lastSnip; - lastSnip = asnip; - - nextsnip = newline->lastSnip->next; - - for (asnip = newline->snip; PTRNE(asnip, nextsnip); - asnip = asnip->next) { - asnip->line = newline; - } - - newline->MarkCheckFlow(); - newline->MarkRecalculate(); - newline->CalcLineLength(); - } else { - /* Just pushed to next line */ - lastSnip = asnip; - asnip->line = this; - - next->snip = asnip->next; - - nextsnip = next->lastSnip->next; - for (asnip = next->snip; PTRNE(asnip, nextsnip); - asnip = asnip->next) { - asnip->line = next; - } - - next->MarkCheckFlow(); - next->MarkRecalculate(); - next->CalcLineLength(); - } - - CalcLineLength(); - MarkRecalculate(); - - return TRUE; - } - asnip->line = this; - } - /* This line was extended */ - - if (asnip) { - while (asnip->next && !(asnip->flags & wxSNIP_NEWLINE)) { - asnip->line = this; - if (next && PTREQ(asnip, next->lastSnip)) { - /* a line was deleted */ - next->Delete(root); - } - asnip = asnip->next; - } - - if (next && PTREQ(asnip, next->lastSnip)) { - /* a line was deleted */ - next->Delete(root); - } - - lastSnip = asnip; - } else { - lastSnip = media->lastSnip; - while (next) { - next->Delete(root); - } - } - - lastSnip->line = this; - - if (next) { - asnip = asnip->next; - if (PTRNE(next->snip, asnip) || !(next->lastSnip->flags & wxSNIP_NEWLINE)) { - /* Effect can propogate to more lines, merging the - next several. (Handle prefixing the remains of the source of - the extension to this line onto the next line. Implemented - as the next line eating the next->next line.) */ - next->snip = asnip; - while (asnip->next && !(asnip->flags & wxSNIP_NEWLINE)) { - if (next->next && PTREQ(asnip, next->next->lastSnip)) { - /* a line was deleted */ - next->next->Delete(root); - } - asnip->line = next; - asnip = asnip->next; - } - asnip->line = next; - next->lastSnip = asnip; - if (next->next) { - if (PTREQ(asnip, next->next->lastSnip)) { - /* a line was deleted */ - next->next->Delete(root); - } else - next->next->snip = asnip->next; - } - - next->CalcLineLength(); - next->MarkRecalculate(); - next->MarkCheckFlow(); - } - } - - CalcLineLength(); - MarkRecalculate(); - - return TRUE; - } - } - - if (flags & WXLINE_FLOW_RIGHT) { - if (PTRNE(right, NIL) && right->UpdateFlow(root, media, maxWidth, dc)) - return TRUE; - flags -= WXLINE_FLOW_RIGHT; - } - - return FALSE; -} - -Bool wxMediaLine::UpdateGraphics(wxMediaEdit *media, wxDC *dc) -{ - Bool changed = FALSE; - Bool isfirst; - wxMediaParagraph *para; - - if (flags & WXLINE_CALC_LEFT) - if (PTRNE(left, NIL) && left->UpdateGraphics(media, dc)) - changed = TRUE; - - if (flags & WXLINE_CALC_HERE) { - wxSnip *asnip, *_next; - long maxscroll, _scroll; - double _y, bigwidth; - double _h, _w, descent, space, totalwidth; - double maxh, maxbase, maxdescent, maxspace, maxantidescent, maxantispace; - int align; - - _y = GetLocation(); - - maxbase = maxdescent = maxspace = maxantidescent = maxantispace = 0; - totalwidth = 0; - - maxscroll = 1; - scrollSnip = NULL; - - _next = lastSnip->next; - for (asnip = snip; PTRNE(asnip, _next); asnip = asnip->next) { - _w = _h = descent = space = 0.0; - asnip->GetExtent(dc, totalwidth, _y, &_w, &_h, &descent, &space); - - align = asnip->style->GetAlignment(); - - _scroll = asnip->GetNumScrollSteps(); - - if (_h - descent - space > maxbase) - maxbase = _h - descent - space; - - if (align == wxALIGN_BOTTOM) { - if (descent > maxdescent) - maxdescent = descent; - } else { - if (_h - space > maxantispace) - maxantispace = _h - space; - } - - if (align == wxALIGN_TOP) { - if (space > maxspace) - maxspace = space; - } else { - if (_h - descent > maxantidescent) - maxantidescent = _h - descent; - } - - if (_scroll > maxscroll) { - scrollSnip = asnip; - maxscroll = _scroll; - } - - totalwidth += _w; - } - - if (maxantidescent - maxbase > maxspace) - maxspace = maxantidescent - maxbase; - - if (maxantispace - maxbase > maxdescent) - maxdescent = maxantispace - maxbase; - - lastH = _h; - lastW = _w; - topbase = maxspace; - bottombase = maxspace + maxbase; - - maxh = maxbase + maxdescent + maxspace; - - maxh += media->lineSpacing; - - if (this->w > totalwidth) - bigwidth = this->w; - else - bigwidth = totalwidth; - bigwidth += CURSOR_WIDTH; - - para = GetParagraphStyle(&isfirst); - if (isfirst) - bigwidth += para->leftMarginFirst; - else - bigwidth += para->leftMargin; - - SetWidth(totalwidth); - - if (maxscroll != this->numscrolls) - SetScrollLength(maxscroll); - - if (maxh == this->h) - media->RefreshBox(0, _y, bigwidth, maxh); - else { - double bigheight; - - SetHeight(maxh); - - bigwidth = 1e5; /* Really want viewable width, but > ok */ - if (bigwidth < media->totalWidth) - bigwidth = media->totalWidth; - - bigheight = maxh + media->totalHeight; - - media->RefreshBox(0, _y, bigwidth, bigheight); - } - - changed = TRUE; - } - - if (flags & WXLINE_CALC_RIGHT) - if (PTRNE(right, NIL) && right->UpdateGraphics(media, dc)) - changed = TRUE; - - flags &= ~CALC_MASK; - - return changed; -} - -/***************************************************************/ - -long wxMediaLine::Number() -{ - wxMediaLine *last; - last = Last(); - return last->GetLine() + 1; -} - -wxMediaLine *wxMediaLine::First() -{ - wxMediaLine *node; - - node = this; - while (PTRNE(node->left, NIL)) { - node = node->left; - } - - return node; -} - -wxMediaLine *wxMediaLine::Last() -{ - wxMediaLine *node; - - node = this; - while (PTRNE(node->right, NIL)) { - node = node->right; - } - - return node; -} - -/***************************************************************/ - -double wxMediaLine::GetLeftLocation(double maxWidth) -{ - double _left; - wxMediaParagraph *para; - - if (flags & WXLINE_STARTS_PARA) { - para = paragraph; - _left = para->leftMarginFirst; - } else { - para = GetParagraphStyle(); - _left = para->leftMargin; - } - - if (para->alignment != (unsigned)WXPARA_LEFT) { - if (maxWidth > 0) { - double delta = maxWidth - w; - if (delta < 0) - delta = 0; - if (para->alignment == (unsigned)WXPARA_RIGHT) - _left += delta; - else - _left += (delta / 2); - } - } - - return _left; -} - -double wxMediaLine::GetRightLocation(double maxWidth) -{ - return GetLeftLocation(maxWidth) + w; -} - -/***************************************************************/ - -wxMediaParagraph *wxMediaParagraph::Clone() -{ - wxMediaParagraph *paragraph; - paragraph = new WXGC_PTRS wxMediaParagraph(); - - paragraph->leftMarginFirst = leftMarginFirst; - paragraph->leftMargin = leftMargin; - paragraph->rightMargin = rightMargin; - paragraph->alignment = alignment; - - return paragraph; -} - -double wxMediaParagraph::GetLineMaxWidth(double maxWidth, Bool first) -{ - if (maxWidth <= 0) - return maxWidth; - - if (first) - maxWidth -= leftMarginFirst; - else - maxWidth -= leftMargin; - maxWidth -= rightMargin; - - if (maxWidth <= 0) - maxWidth = 1; - - return maxWidth; -} - -/***************************************************************/ - -#ifdef TEST - -#include - -wxMgediaLine *root = NIL; -int numLines = 0; - -main() -{ - long i; - wxMediaLine *line; - char command[256]; - - line->Insert(&root); - numLines++; - - while (1) { - cout << "Lines:\n"; - for (i = 0; i < numLines; i++) { - line = root->FindLine(i); - cout << " " << i - << " (" << line->GetLine() << ")" - << ": [" << ((void *)line->prev) << "," - << ((void *)line) << "," - << ((void *)line->next) << "]" - << " pos=" << line->GetPosition() - << " len=" << line->len - << " scr=" << line->GetScroll() - << " slen=" << line->numscrolls - << " loc=" << line->GetLocation() - << " ht=" << line->h - << "\n"; - } - - cout << "Line? "; - cin >> i; - if (i >= numLines) - return 0; - - line = root->FindLine(i); - cout << "[" << ((void *)line) << "]\n"; - - cout << "Command? [i,d,l,h,s,q] "; - cin >> command; - if (command[0] == 'i') { - line->Insert(&root); - numLines++; - } else if (command[0] == 'd') { - line->Delete(&root); - --numLines; - } else if (command[0] == 'l') { - cout << "How many? "; - cin >> i; - if (i >= 0) - line->SetLength(i); - } else if (command[0] == 's') { - cout << "How many? "; - cin >> i; - if (i >= 0) - line->SetScrollLength(i); - } else if (command[0] == 'h') { - double h; - cout << "How tall? "; - cin >> h; - if (h >= 0.0) - line->SetHeight(h); - } else if (command[0] == 'q') { - return 0; - } - } -} - -#endif diff --git a/src/mred/wxme/wx_mline.h b/src/mred/wxme/wx_mline.h deleted file mode 100644 index 56772390b4..0000000000 --- a/src/mred/wxme/wx_mline.h +++ /dev/null @@ -1,124 +0,0 @@ - -#define CURSOR_WIDTH 2 - -class wxMediaParagraph; - -const unsigned long - WXLINE_RED = 0x1, - WXLINE_BLACK = 0x2, - WXLINE_MAX_W_HERE = 0x4, - WXLINE_MAX_W_LEFT = 0x8, - WXLINE_MAX_W_RIGHT = 0x10, - WXLINE_CALC_HERE = 0x20, - WXLINE_CALC_LEFT = 0x40, - WXLINE_CALC_RIGHT = 0x80, - WXLINE_FLOW_HERE = 0x100, - WXLINE_FLOW_LEFT = 0x200, - WXLINE_FLOW_RIGHT = 0x400, - WXLINE_STARTS_PARA = 0x800; - -class wxMediaLine -#ifndef MZ_PRECISE_GC -: public gc -#endif -{ - public: - wxMediaLine *next, *prev, *parent, *left, *right; - long flags; - wxMediaParagraph *paragraph; - - /* relative values: */ - long line; // line number - long pos; // starting item position - long scroll; // starting scroll step - long parno; // paragraph number - double y; // starting y location - - double maxWidth; - - wxSnip *snip, *lastSnip, *scrollSnip; - - long len, numscrolls; - double lastH, lastW; /* height/width of last snip in line */ - double h, w; /* height/width of line */ - double bottombase, topbase; /* bottom baseline, top baseline (relative) */ - - wxMediaLine(); - ~wxMediaLine(); - - wxMediaLine *Insert(wxMediaLine **root, Bool before = TRUE); - void Delete(wxMediaLine **root); - - wxMediaLine *FindLine(long line); - wxMediaLine *FindPosition(long pos); - wxMediaLine *FindScroll(long scroll); - wxMediaLine *FindLocation(double y); - wxMediaLine *FindParagraph(long parnp); - - long GetLine(); - long GetPosition(); - long GetScroll(); - double GetLocation(); - long GetParagraph(); - - wxMediaParagraph *GetParagraphStyle(Bool *first = NULL); - - double ScrollOffset(long p); - long FindExtraScroll(double y); - - void SetLength(long len); - void CalcLineLength(); - void SetScrollLength(long numScrolls); - void SetHeight(double h); - - void SetWidth(double w); - void MarkRecalculate(); - void MarkCheckFlow(); - - void SetStartsParagraph(Bool starts); - inline int StartsParagraph(void) - { return (flags & WXLINE_STARTS_PARA) ? 1 : 0; }; - - wxMediaLine *GetRoot(); - - Bool UpdateFlow(wxMediaLine **root, wxMediaEdit *, double maxw, wxDC *dc); - Bool UpdateGraphics(wxMediaEdit *media, wxDC *dc); - - long Number(); - wxMediaLine *First(); - wxMediaLine *Last(); - - double GetLeftLocation(double maxWidth); - double GetRightLocation(double maxWidth); - - private: - void AdjustOffsets(wxMediaLine *newchild); - void DeadjustOffsets(wxMediaLine *oldchild); - - void RotateLeft(wxMediaLine **root); - void RotateRight(wxMediaLine **root); - void AdjustNeedCalc(Bool recur = FALSE); - void AdjustNeedFlow(Bool recur = FALSE); - void AdjustMaxWidth(Bool recur = FALSE); -}; - -extern wxMediaLine *NIL; - -const unsigned long - WXPARA_LEFT = 0x0, - WXPARA_CENTER = 0x1, - WXPARA_RIGHT = 0x2; - -class wxMediaParagraph -#ifndef MZ_PRECISE_GC -: public gc -#endif -{ - public: - double leftMarginFirst, leftMargin; - double rightMargin; - int alignment; - - wxMediaParagraph *Clone(); - double GetLineMaxWidth(double maxWidth, Bool first); -}; diff --git a/src/mred/wxme/wx_mpbrd.cxx b/src/mred/wxme/wx_mpbrd.cxx deleted file mode 100644 index 98658ad4af..0000000000 --- a/src/mred/wxme/wx_mpbrd.cxx +++ /dev/null @@ -1,3025 +0,0 @@ -/* - * File: wx_mpbd.cc - * Purpose: wxMediaPasteboard implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" -#include "wx_dialg.h" -#ifndef OLD_WXWINDOWS -# include "wx_cmdlg.h" -#endif -#include "wx_clipb.h" -#include "wx_utils.h" -#include "wx_media.h" -#include "wx_gcrct.h" -#include "wx_ptreq.h" - -#include -#include - -#define LINE_HEIGHT 16 - -#define DOT_WIDTH 5 -#define HALF_DOT_WIDTH 2 - -static wxCursor *arrow = NULL; - -int wxmeGetDoubleClickThreshold(); - -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); - -static wxSnipLocation *DoXSnipLoc(Scheme_Hash_Table *snipLocationList, wxSnip *s) -{ - Scheme_Object *key, *v; - - key = objscheme_bundle_wxSnip(s); - v = scheme_hash_get(snipLocationList, key); - return (wxSnipLocation *)v; -} - -static void SetSnipLoc(Scheme_Hash_Table *snipLocationList, wxSnip *s, wxSnipLocation *loc) -{ - Scheme_Object *key; - - key = objscheme_bundle_wxSnip(s); - scheme_hash_set(snipLocationList, key, (Scheme_Object *)loc); -} - -#define XSnipLoc(snip) DoXSnipLoc(snipLocationList, snip) -#define SnipLoc(snip) XSnipLoc(snip) - -inline Bool Inbox(double lx, double x) -{ - return ((lx - HALF_DOT_WIDTH <= x) - && (lx - HALF_DOT_WIDTH + DOT_WIDTH >= x)); -} - -class wxSnipLocation : public wxObject -{ - public: - double x, y, w, h, r, b, hm, vm; - double startx, starty; - Bool selected, needResize; - wxSnip *snip; - - wxSnipLocation(); - void Resize(wxDC *dc); -}; - -static wxBrush *blackBrush = NULL, *whiteBrush = NULL, *rbBrush = NULL; -static wxPen *invisiPen = NULL, *rbPen = NULL; - -#ifdef wx_mac -extern void wxMediaSetFileCreatorType(char *file, Bool is_binary); -#endif - -/**********************************************************************/ - -wxMediaPasteboard::wxMediaPasteboard() -{ - Scheme_Hash_Table *sll; - - sizeCacheInvalid = TRUE; - updateNonempty = FALSE; - noImplicitUpdate = FALSE; - writeLocked = 0; - - snips = lastSnip = NULL; - sll = scheme_make_hash_table(SCHEME_hash_ptr); - snipLocationList = sll; - - sequence = 0; - -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_MEDIA_PASTEBOARD; -#endif - bufferType = wxPASTEBOARD_BUFFER; - - totalWidth = totalHeight = realWidth = realHeight = 0; - - dragable = TRUE; - selectionVisible = TRUE; - - sequenceStreak = FALSE; - - dragging = rubberband = FALSE; - - if (!blackBrush) { - wxREGGLOB(blackBrush); - wxREGGLOB(whiteBrush); - wxREGGLOB(invisiPen); - wxREGGLOB(rbBrush); - wxREGGLOB(rbPen); - blackBrush = wxTheBrushList->FindOrCreateBrush("BLACK", wxXOR); - whiteBrush = wxTheBrushList->FindOrCreateBrush("WHITE", wxSOLID); - invisiPen = wxThePenList->FindOrCreatePen("BLACK", 1, wxTRANSPARENT); - rbBrush = wxTheBrushList->FindOrCreateBrush("BLACK", wxTRANSPARENT); - rbPen = wxThePenList->FindOrCreatePen("BLACK", 1, wxXOR_DOT); - } - - { - wxStandardSnipAdmin *ssa; - ssa = new WXGC_PTRS wxStandardSnipAdmin(this); - snipAdmin = ssa; - } - - needResize = FALSE; - - keepSize = FALSE; - - scrollStep = LINE_HEIGHT; - - maxWidth = minWidth = minHeight = maxHeight = 0.0; -} - -wxMediaPasteboard::~wxMediaPasteboard() -{ - wxSnip *snip, *next; - for (snip = snips; snip; snip = next) { - next = snip->next; - DELETE_OBJ snip; - } - - DELETE_OBJ snipAdmin; -} - -void wxMediaPasteboard::RubberBand(double x, double y, double w, double h) -{ - wxPen *oldPen; - wxBrush *oldBrush; - wxDC *dc; - double vx, vy, vw, vh, b, r, dx, dy; - - if (!admin) - return; - - if (!w & !h) - return; - - if (w < 0) { - x += w; - w = -w; - } - r = x + w; - if (h < 0) { - y += h; - h = -h; - } - b = y + h; - - admin->GetView(&vx, &vy, &vw, &vh); - - if (x < vx) - x = vx; - if (y < vy) - y = vy; - if (r > vx + vw) - r = vx + vw; - if (b > vy + vh) - b = vy + vh; - - if (x >= r || y >= b) - return; - - dc = admin->GetDC(&dx, &dy); - - oldPen = dc->GetPen(); - oldBrush = dc->GetBrush(); - dc->SetPen(rbPen); - dc->SetBrush(rbBrush); - - dc->DrawRectangle(x - dx, y - dy, - r - x + GC_RECT_BRUSH_EXTEND, - b - y + GC_RECT_BRUSH_EXTEND); - - dc->SetPen(oldPen); - dc->SetBrush(oldBrush);; -} - -wxCursor *wxMediaPasteboard::AdjustCursor(wxMouseEvent *event) -{ - double scrollx, scrolly; - double x, y; - wxSnip *snip; - wxDC *dc; - wxCursor *c; - - if (!admin) - return NULL; - - dc = admin->GetDC(&scrollx, &scrolly); - if (!dc) - return NULL; - - x = event->x + scrollx; - y = event->y + scrolly; - - if (!customCursorOverrides) { - - if (caretSnip && event->Dragging()) { - double x, y; - GetSnipLocation(caretSnip, &x, &y); - c = caretSnip->AdjustCursor(dc, x - scrollx, y - scrolly, x, y, event); - if (c) - return c; - } - - snip = FindSnip(x, y); - - if (snip && (snip == caretSnip)) { - double x, y; - GetSnipLocation(caretSnip, &x, &y); - c = snip->AdjustCursor(dc, x - scrollx, y - scrolly, x, y, event); - if (c) - return c; - } - } - - if (customCursor) - return customCursor; - - if (!arrow) { - wxREGGLOB(arrow); - arrow = new WXGC_PTRS wxCursor(wxCURSOR_ARROW); - } - - return arrow; -} - -void wxMediaPasteboard::OnEvent(wxMouseEvent *event) -{ - double x, y, scrollx, scrolly; - wxSnip *snip; - wxSnipLocation *loc; - wxDC *dc; - - if (!admin) - return; - - if (event->ButtonDown() || caretSnip) { - /* First, find clicked-on snip: */ - x = event->x; - y = event->y; - - dc = admin->GetDC(&scrollx, &scrolly); - y += scrolly; - x += scrollx; - } else { - x = y = 0; - dc = NULL; - } - - if (event->ButtonDown()) - snip = FindSnip(x, y); - else - snip = caretSnip; - - if (caretSnip && PTREQ(snip, caretSnip)) { - loc = SnipLoc(caretSnip); - caretSnip->OnEvent(dc, loc->x - scrollx, loc->y - scrolly, loc->x, loc->y, event); - return; - } - - OnLocalEvent(event); -} - -void wxMediaPasteboard::OnDefaultEvent(wxMouseEvent *event) -{ - double x, y, scrollx, scrolly; - wxSnip *snip; - wxSnipLocation *loc; - wxDC *dc; - Bool click; - - if (!admin) - return; - - x = event->x; - y = event->y; - - dc = admin->GetDC(&scrollx, &scrolly); - y += scrolly; - x += scrollx; - - InteractiveAdjustMouse(&x, &y); - - if (event->ButtonDown() - || (event->Moving() && !event->Dragging()) - || event->ButtonUp()) { - Bool update = FALSE; - - keepSize = FALSE; - if (dragging) { - if (resizing) { - BeginEditSequence(); - /* Move & resize back without Undo */ - if (sizedxm < 0 || sizedym < 0) - MoveTo(resizing, origX, origY); - Resize(resizing, origW, origH); - dragging = FALSE; - /* Re-move and re-size with undo: */ - DoEventResize(lastX, lastY); - AfterInteractiveResize(resizing); - EndEditSequence(); - resizing = NULL; - } else { - FinishDragging(event); - } - } - if (rubberband) { - rubberband = FALSE; - RubberBand(startX, startY, lastX - startX, lastY - startY); - AddSelected(startX, startY, lastX - startX, lastY - startY); - update = TRUE; - } - - if (update) { - UpdateAll(); - } - } - - click = FALSE; - if (event->ButtonDown()) - click = TRUE; - if (event->Dragging() && !dragging && !rubberband) - click = TRUE; - - if (click) { - snip = FindSnip(x, y); - - if (dragable) { - if (snip) { - loc = SnipLoc(snip); - origX = loc->x; - origY = loc->y; - origW = loc->w; - origH = loc->h; - if (!loc->selected) { - if (!event->shiftDown) - NoSelected(); - SetCaretOwner(NULL); - AddSelected(snip); - InitDragging(event); - } else { - long interval; - - interval = event->timeStamp - lastTime; - if (interval < 0) - interval = -interval; - if (event->ButtonDown() && (interval < (map ? map->GetDoubleClickInterval() : wxmeGetDoubleClickThreshold()))) - OnDoubleClick(snip, event); - else { - if (FindDot(loc, x, y, &sizedxm, &sizedym)) - resizing = snip; - InitDragging(event); - } - } - if (event->ButtonDown()) - lastTime = event->timeStamp; - } else { - if (!event->shiftDown) - NoSelected(); - SetCaretOwner(NULL); - rubberband = TRUE; - } - startX = lastX = x; - startY = lastY = y; - } else - SetCaretOwner(snip); - - return; - } - - if (dragable) { - if (event->Dragging()) { - if (rubberband) { - /* Erase old */ - RubberBand(startX, startY, lastX - startX, lastY - startY); - /* Draw new: */ - RubberBand(startX, startY, x - startX, y - startY); - } else { - if (resizing) - DoEventResize(x, y); - else { - DoEventMove(x, y); - } - } - lastX = x; - lastY = y; - } - } -} - -void wxMediaPasteboard::OnDoubleClick(wxSnip *snip, wxMouseEvent *) -{ - if (snip->flags & wxSNIP_HANDLES_EVENTS) { - NoSelected(); - SetCaretOwner(snip); - } -} - -void wxMediaPasteboard::OnChar(wxKeyEvent *event) -{ - double x, y, scrollx, scrolly; - wxSnipLocation *loc; - wxDC *dc; - - if (!admin) - return; - - x = event->x; - y = event->y; - - dc = admin->GetDC(&scrollx, &scrolly); - y += scrolly; - x += scrollx; - - if (caretSnip) { - loc = SnipLoc(caretSnip); - caretSnip->OnChar(dc, loc->x, loc->y, x - scrollx, y - scrolly, event); - return; - } - - OnLocalChar(event); -} - -void wxMediaPasteboard::OnDefaultChar(wxKeyEvent *event) -{ - long code; - - if (!admin) - return; - - code = event->KeyCode(); - - switch(code) { - case WXK_BACK: - case WXK_DELETE: - Delete(); - break; - case WXK_RIGHT: - Move(1, 0); - break; - case WXK_LEFT: - Move(-1, 0); - break; - case WXK_UP: - Move(0, -1); - break; - case WXK_DOWN: - Move(0, 1); - break; - } -} - -void wxMediaPasteboard::InitDragging(wxMouseEvent *e) -{ - wxSnip *s = NULL; - - if (resizing) { - if (!CanInteractiveResize(resizing)) { - resizing = NULL; - return; - } - OnInteractiveResize(resizing); - } else { - if (!CanInteractiveMove(e)) - return; - OnInteractiveMove(e); - } - - dragging = TRUE; - keepSize = TRUE; - - while ((s = FindNextSelectedSnip(s))) { - wxSnipLocation *loc; - loc = SnipLoc(s); - loc->startx = loc->x; - loc->starty = loc->y; - } -} - -void wxMediaPasteboard::FinishDragging(wxMouseEvent *e) -{ - wxSnip *s = NULL; - - BeginEditSequence(); - /* Move back without Undo and remember final */ - while ((s = FindNextSelectedSnip(s))) { - double x, y; - wxSnipLocation *loc; - loc = SnipLoc(s); - x = loc->startx; - y = loc->starty; - loc->startx = loc->x; - loc->starty = loc->y; - MoveTo(s, x, y); - } - dragging = FALSE; - /* Move to final position with undo: */ - s = NULL; - while ((s = FindNextSelectedSnip(s))) { - wxSnipLocation *loc; - loc = SnipLoc(s); - MoveTo(s, loc->startx, loc->starty); - } - - AfterInteractiveMove(e); - - EndEditSequence(); -} - -void wxMediaPasteboard::DoEventMove(double eventX, double eventY) -{ - wxSnip *s = NULL; - double dx, dy; - - dx = eventX - startX; - dy = eventY - startY; - - BeginEditSequence(); - - while ((s = FindNextSelectedSnip(s))) { - wxSnipLocation *loc; - double x, y; - - loc = SnipLoc(s); - x = loc->startx + dx; - y = loc->starty + dy; - InteractiveAdjustMove(s, &x, &y); - MoveTo(s, x, y); - } - - EndEditSequence(); -} - -void wxMediaPasteboard::DoEventResize(double eventX, double eventY) -{ - double Dx, Dy, w, h, x, y; - - Dx = eventX - startX; - Dy = eventY - startY; - - w = origW + Dx * sizedxm; - h = origH + Dy * sizedym; - - if (w < 0) - w = 0; - if (h < 0) - h = 0; - - InteractiveAdjustResize(resizing, &w, &h); - - if (w < 0) - w = 0; - if (h < 0) - h = 0; - - x = origX; - if (sizedxm < 0) { - x += (origW - w); - } - y = origY; - if (sizedym < 0) { - y += (origH - h); - } - - BeginEditSequence(); - - if (Resize(resizing, w, h)) { - if ((sizedxm < 0 || sizedym < 0)) - MoveTo(resizing, x, y); - } - - EndEditSequence(); -} - -void wxMediaPasteboard::InteractiveAdjustMouse(double *x, double *y) -{ - if (*x < 0) - *x = 0; - if (*y < 0) - *y = 0; -} - -void wxMediaPasteboard::InteractiveAdjustResize(wxSnip *, double *, double *) -{ - /* Do nothing */ -} - -void wxMediaPasteboard::InteractiveAdjustMove(wxSnip *, double *x, double *y) -{ - if (*x < 0) - *x = 0; - if (*y < 0) - *y = 0; -} - - -/***************************************************************************/ - -void wxMediaPasteboard::SetSelected(wxSnip *snip) -{ - BeginEditSequence(); - NoSelected(); - AddSelected(snip); - EndEditSequence(); -} - -void wxMediaPasteboard::DoSelect(wxSnip *snip, Bool on) -{ - wxSnipLocation *loc; - - if ((loc = XSnipLoc(snip))) { - if (loc->selected != on) { - writeLocked++; - if (CanSelect(snip, on)) { - OnSelect(snip, on); - --writeLocked; - loc->selected = on; - AfterSelect(snip, on); - UpdateLocation(loc); - } else - --writeLocked; - } - } -} - -void wxMediaPasteboard::AddSelected(wxSnip *snip) -{ - DoSelect(snip, TRUE); -} - -void wxMediaPasteboard::RemoveSelected(wxSnip *snip) -{ - DoSelect(snip, FALSE); -} - -void wxMediaPasteboard::AddSelected(double x, double y, double w, double h) -{ - wxSnip *s; - double r, b; - - if (w < 0) { - x += w; - w = -w; - } - if (h < 0) { - y += h; - h = -h; - } - - r = x + w; - b = y + h; - - BeginEditSequence(); - - for (s = snips; s; s = s->next) { - wxSnipLocation *loc; - loc = SnipLoc(s); - if (loc - && !loc->selected - && (loc->x <= r) - && (loc->y <= b) - && (loc->r >= x) - && (loc->b >= y)) { - AddSelected(s); - } - } - - EndEditSequence(); -} - -void wxMediaPasteboard::SelectAll(void) -{ - wxSnip *s; - - BeginEditSequence(); - - for (s = snips; s; s = s->next) { - AddSelected(s); - } - - EndEditSequence(); -} - -void wxMediaPasteboard::NoSelected() -{ - wxSnip *s; - - BeginEditSequence(); - - for (s = snips; s; s = s->next) { - RemoveSelected(s); - } - - EndEditSequence(); -} - -void wxMediaPasteboard::Insert(wxSnip *snip, wxSnip *before, double x, double y) -{ - wxSnipLocation *loc; - wxSnip *search; - - if (userLocked || writeLocked) - return; - - if (snip->IsOwned()) - return; - - if (!snip->snipclass) - wxmeError("insert in pasteboard%: cannot insert a snip without a snipclass"); - - writeLocked++; - BeginEditSequence(); - if (!CanInsert(snip, before, x, y)) { - EndEditSequence(); - --writeLocked; - return; - } - OnInsert(snip, before, x, y); - --writeLocked; - - if (snip->IsOwned()) { - /* Disaster: Can/OnInsert made the snip owned. */ - snip = new WXGC_PTRS wxImageSnip(); - } - - for (search = snips; search && (search != before); search = search->next) { - } - - snip->next = search; - if (snip->next) { - snip->prev = search->prev; - snip->next->prev = snip; - } else { - snip->prev = lastSnip; - lastSnip = snip; - } - if (snip->prev) - snip->prev->next = snip; - else - snips = snip; - - loc = new WXGC_PTRS wxSnipLocation; - loc->x = x; - loc->y = y; - loc->snip = snip; - loc->needResize = TRUE; - loc->selected = FALSE; - SetSnipLoc(snipLocationList, snip, loc); - - snip->style = styleList->Convert(snip->style); - if (PTREQ(snip->style, styleList->BasicStyle())) { - wxStyle *s; - s = GetDefaultStyle(); - if (s) - snip->style = s; - } - - snip->SizeCacheInvalid(); - - SnipSetAdmin(snip, snipAdmin); - - if (!noundomode) { - wxInsertSnipRecord *is; - is = new WXGC_PTRS wxInsertSnipRecord(snip, sequenceStreak); - AddUndo(is); - } - if (sequence) - sequenceStreak = TRUE; - - changed = TRUE; - - if (!modified) - SetModified(TRUE); - - needResize = TRUE; - UpdateLocation(loc); - - writeLocked++; - EndEditSequence(); - --writeLocked; - - if (!sequence) - UpdateNeeded(); - - AfterInsert(snip, before, x, y); -} - -void wxMediaPasteboard::Insert(wxSnip *snip, double x, double y) -{ - Insert(snip, snips, x, y); -} - -void wxMediaPasteboard::Insert(wxSnip *snip) -{ - double x, y; - - GetCenter(&x, &y); - Insert(snip, x, y); -} - -void wxMediaPasteboard::Insert(wxSnip *snip, wxSnip *before) -{ - double x, y; - - GetCenter(&x, &y); - Insert(snip, before, x, y); -} - -void wxMediaPasteboard::Delete() -{ - int i; - wxSnipLocation *loc; - wxDeleteSnipRecord *del; - - if (userLocked || writeLocked) - return; - - del = new WXGC_PTRS wxDeleteSnipRecord(sequenceStreak); - if (sequence) - sequenceStreak = TRUE; - - BeginEditSequence(); - - for (i = 0; i < snipLocationList->size; i++) { - loc = (wxSnipLocation *)snipLocationList->vals[i]; - if (loc) { - if (loc->selected) - _Delete(loc->snip, del); - } - } - - if (!noundomode) - AddUndo(del); - - EndEditSequence(); -} - -void wxMediaPasteboard::Erase() -{ - wxSnip *snip, *next; - wxDeleteSnipRecord *del; - - if (userLocked || writeLocked) - return; - - del = new WXGC_PTRS wxDeleteSnipRecord(sequenceStreak); - if (sequence) - sequenceStreak = TRUE; - - BeginEditSequence(); - for (snip = snips; snip; snip = next) { - next = snip->next; - _Delete(snip, del); - } - - if (!noundomode) - AddUndo(del); - - EndEditSequence(); -} - -Bool wxMediaPasteboard::_Delete(wxSnip *del_snip, - wxDeleteSnipRecord *del) -{ - wxSnip *snip; - wxSnipLocation *loc; - Bool updateCursor = FALSE; - Bool result = FALSE; - - for (snip = snips; snip; snip = snip->next) { - if (PTREQ(snip, del_snip)) { - writeLocked++; - BeginEditSequence(); - if (!CanDelete(del_snip)) { - EndEditSequence(); - --writeLocked; - return FALSE; - } - OnDelete(del_snip); - --writeLocked; - - if (del_snip == caretSnip) { - caretSnip->OwnCaret(FALSE); - caretSnip = NULL; - updateCursor = TRUE; - } - - UpdateSnip(del_snip); - - if (!snip->prev) - snips = snip->next; - else - snip->prev->next = snip->next; - if (!snip->next) - lastSnip = snip->prev; - else - snip->next->prev = snip->prev; - - loc = DoXSnipLoc(snipLocationList, snip); - SetSnipLoc(snipLocationList, snip, NULL); - if (del) - del->InsertSnip(snip, snip->next, loc->x, loc->y); - snip->next = snip->prev = NULL; - - snip->flags += wxSNIP_CAN_DISOWN; - SnipSetAdmin(snip, NULL); - snip->flags -= wxSNIP_CAN_DISOWN; - if (!del) - if (!snip->GetAdmin()) - snip->flags -= wxSNIP_OWNED; - - if (!modified) - SetModified(TRUE); - - AfterDelete(del_snip); - changed = TRUE; - - needResize = TRUE; - - writeLocked++; - EndEditSequence(); - --writeLocked; - - if (!sequence) - UpdateNeeded(); - - result = TRUE; - } - } - - if (updateCursor) - if (admin) - admin->UpdateCursor(); - - return result; -} - -void wxMediaPasteboard::Delete(wxSnip *del_snip) -{ - wxDeleteSnipRecord *del; - - if (userLocked || writeLocked) - return; - - del = new WXGC_PTRS wxDeleteSnipRecord(sequenceStreak); - if (sequence) - sequenceStreak = TRUE; - - _Delete(del_snip, del); - - if (!noundomode) - AddUndo(del); -} - -void wxMediaPasteboard::Remove(wxSnip *del_snip) -{ - if (userLocked || writeLocked) - return; - - _Delete(del_snip, NULL); -} - -void wxMediaPasteboard::MoveTo(wxSnip *snip, double x, double y) -{ - wxSnipLocation *loc; - wxMoveSnipRecord *rec; - - if (userLocked || writeLocked) - return; - - loc = DoXSnipLoc(snipLocationList, snip); - - if (loc) { - if ((loc->x == x) && (loc->y == y)) - return; - - writeLocked++; - BeginEditSequence(); - if (!CanMoveTo(snip, x, y, dragging)) { - EndEditSequence(); - --writeLocked; - return; - } - OnMoveTo(snip, x, y, dragging); - --writeLocked; - - UpdateLocation(loc); - - if (!dragging) { - rec = new WXGC_PTRS wxMoveSnipRecord(loc->snip, loc->x, loc->y, - FALSE, sequenceStreak); - if (sequence) - sequenceStreak = TRUE; - if (!noundomode) - AddUndo(rec); - } - - loc->x = x; - loc->y = y; - loc->r = x + loc->w; - loc->b = y + loc->h; - loc->hm = x + loc->w/2; - loc->vm = y + loc->h/2; - UpdateLocation(loc); - - if (!dragging && !modified) - SetModified(TRUE); - - AfterMoveTo(snip, x, y, dragging); - - needResize = TRUE; - - writeLocked++; - EndEditSequence(); - --writeLocked; - - changed = TRUE; - - if (!sequence) - UpdateNeeded(); - } -} - -void wxMediaPasteboard::Move(wxSnip *snip, double dx, double dy) -{ - wxSnipLocation *loc; - - if (userLocked || writeLocked) - return; - - loc = DoXSnipLoc(snipLocationList, snip); - if (loc) { - MoveTo(snip, loc->x + dx, loc->y + dy); - } -} - -void wxMediaPasteboard::Move(double dx, double dy) -{ - int i; - wxSnipLocation *loc; - - if (userLocked || writeLocked) - return; - - BeginEditSequence(); - - for (i = 0; i < snipLocationList->size; i++) { - loc = (wxSnipLocation *)snipLocationList->vals[i]; - if (loc) { - if (loc->selected) - Move(loc->snip, dx, dy); - } - } - - EndEditSequence(); -} - -Bool wxMediaPasteboard::Resize(wxSnip *snip, double w, double h) -{ - wxSnipLocation *loc; - double oldw, oldh; - Bool rv; - - if (!admin) - return FALSE; - - loc = DoXSnipLoc(snipLocationList, snip); - if (!loc) - return FALSE; - - oldw = loc->w; - oldh = loc->h; - - writeLocked++; - BeginEditSequence(); - if (!CanResize(snip, w, h)) { - EndEditSequence(); - --writeLocked; - return FALSE; - } - OnResize(snip, w, h); - --writeLocked; - - if (!snip->Resize(w, h)) - rv = FALSE; - else { - if (!dragging) { - if (!noundomode) { - wxResizeSnipRecord *rs; - rs = new WXGC_PTRS wxResizeSnipRecord(snip, oldw, oldh, sequenceStreak); - AddUndo(rs); - } - if (sequence) - sequenceStreak = TRUE; - } - rv = TRUE; - } - - if (rv && !dragging && !modified) - SetModified(TRUE); - - AfterResize(snip, w, h, rv); - - writeLocked++; - EndEditSequence(); - --writeLocked; - - changed = TRUE; - - if (!sequence) - UpdateNeeded(); - - return rv; -} - -void wxMediaPasteboard::ChangeStyle(wxStyleDelta *delta) -{ - ChangeStyle(delta, NULL); -} - -void wxMediaPasteboard::ChangeStyle(wxStyle *style, wxSnip *snip) -{ - _ChangeStyle(style, NULL, snip); -} - -void wxMediaPasteboard::ChangeStyle(wxStyleDelta *delta, wxSnip *snip) -{ - _ChangeStyle(NULL, delta, snip); -} - -void wxMediaPasteboard::_ChangeStyle(wxStyle *style, wxStyleDelta *delta, - wxSnip *snip) -{ - wxSnipLocation *loc; - wxStyleChangeSnipRecord *rec; - Bool didit = FALSE; - - if (userLocked || writeLocked) - return; - - rec = new WXGC_PTRS wxStyleChangeSnipRecord(sequenceStreak); - if (sequence) - sequenceStreak = TRUE; - - if (!style && !delta) { - style = GetDefaultStyle(); - if (!style) - style = styleList->BasicStyle(); - } - - BeginEditSequence(); - - if (snip) { - rec->AddStyleChange(snip, snip->style); - if (style) - snip->style = style; - else { - snip->style = styleList->FindOrCreateStyle(snip->style, delta); - } - snip->SizeCacheInvalid(); - UpdateSnip(snip); - didit = TRUE; - } else { - int i; - for (i = 0; i < snipLocationList->size; i++) { - loc = (wxSnipLocation *)snipLocationList->vals[i]; - if (loc) { - if (loc->selected) { - rec->AddStyleChange(loc->snip, loc->snip->style); - if (style) - loc->snip->style = style; - else { - loc->snip->style = styleList->FindOrCreateStyle(loc->snip->style, - delta); - } - loc->snip->SizeCacheInvalid(); - loc->needResize = TRUE; - needResize = TRUE; - UpdateLocation(loc); - didit = TRUE; - } - } - } - } - - if (didit) { - if (!noundomode) - AddUndo(rec); - - changed = TRUE; - if (!modified) - SetModified(TRUE); - } - - EndEditSequence(); -} - -void wxMediaPasteboard::Raise(wxSnip *snip) -{ - SetBefore(snip, snip->prev); -} - -void wxMediaPasteboard::Lower(wxSnip *snip) -{ - SetAfter(snip, snip->next); -} - -void wxMediaPasteboard::SetBefore(wxSnip *snip, wxSnip *before) -{ - if (userLocked || writeLocked) - return; - - if (!before) - before = snips; - - if (!DoXSnipLoc(snipLocationList, snip) - || !DoXSnipLoc(snipLocationList, before)) - return; - - if (snip == before) - return; - - writeLocked++; - if (!CanReorder(snip, before, TRUE)) { - --writeLocked; - return; - } - OnReorder(snip, before, TRUE); - --writeLocked; - - /* Remove snip from current pos: */ - if (snip->prev) - snip->prev->next = snip->next; - else - snips = snip->next; - if (snip->next) - snip->next->prev = snip->prev; - else - lastSnip = snip->prev; - - /* Insert before `before': */ - snip->prev = before->prev; - snip->next = before; - before->prev = snip; - if (snip->prev) - snip->prev->next = snip; - else - snips = snip; - - changed = TRUE; - if (!modified) - SetModified(TRUE); - - UpdateSnip(snip); - - AfterReorder(snip, before, TRUE); -} - -void wxMediaPasteboard::SetAfter(wxSnip *snip, wxSnip *after) -{ - if (userLocked || writeLocked) - return; - - if (!after) - after = lastSnip; - - if (!DoXSnipLoc(snipLocationList, snip) - || !DoXSnipLoc(snipLocationList, after)) - return; - - if (snip == after) - return; - - writeLocked++; - if (!CanReorder(snip, after, FALSE)) { - --writeLocked; - return; - } - OnReorder(snip, after, FALSE); - --writeLocked; - - /* Remove snip from current pos: */ - if (snip->prev) - snip->prev->next = snip->next; - else - snips = snip->next; - if (snip->next) - snip->next->prev = snip->prev; - else - lastSnip = snip->prev; - - /* Insert after `after': */ - snip->next = after->next; - snip->prev = after; - after->next = snip; - if (snip->next) - snip->next->prev = snip; - else - lastSnip = snip; - - changed = TRUE; - if (!modified) - SetModified(TRUE); - - UpdateSnip(snip); - - AfterReorder(snip, after, FALSE); -} - -wxSnip *wxMediaPasteboard::SnipSetAdmin(wxSnip *snip, wxSnipAdmin *a) -{ - wxSnipAdmin *orig_admin; - orig_admin = snip->GetAdmin(); - - /* Lock during SetAdmin! */ - snip->SetAdmin(a); - - if (snip->GetAdmin() != a) { - /* Something went wrong. */ - if (!a && (snip->GetAdmin() == orig_admin)) { - /* Force admin to NULL. */ - snip->wxSnip::SetAdmin(NULL); - } else if (a) { - /* Snip didn't accept membership into this buffer. Give up on it. */ - wxSnip *naya; - naya = new WXGC_PTRS wxSnip(); - naya->prev = snip->prev; - naya->next = snip->next; - if (naya->prev) - naya->prev->next = naya; - else - snips = naya; - if (naya->next) - naya->next->prev = naya; - else - lastSnip = naya; - - snip->wxSnip::SetAdmin(NULL); - - naya->SetAdmin(a); - snip = naya; - } - } - - return snip; -} - -Bool wxMediaPasteboard::ReallyCanEdit(int op) -{ - if (op != wxEDIT_COPY) { - if (writeLocked) - return FALSE; - } - - switch(op) { - case wxEDIT_CLEAR: - case wxEDIT_CUT: - case wxEDIT_COPY: - case wxEDIT_KILL: - if (!FindNextSelectedSnip(NULL)) - return FALSE; - break; - case wxEDIT_SELECT_ALL: - if (!snips) - return FALSE; - } - - return TRUE; -} - -/***************************************************************************/ - -Bool wxMediaPasteboard::FindDot(wxSnipLocation *loc, double x, double y, - double *dxm, double *dym) -{ - if (Inbox(loc->x, x)) { - *dxm = -1; - if (Inbox(loc->y, y)) - *dym = -1; - else if (Inbox(loc->vm, y)) - *dym = 0; - else if (Inbox(loc->b, y)) - *dym = 1; - else - return FALSE; - } else if (Inbox(loc->hm, x)) { - *dxm = 0; - if (Inbox(loc->y, y)) - *dym = -1; - else if (Inbox(loc->b, y)) - *dym = 1; - else - return FALSE; - } else if (Inbox(loc->r, x)) { - *dxm = 1; - if (Inbox(loc->y, y)) - *dym = -1; - else if (Inbox(loc->vm, y)) - *dym = 0; - else if (Inbox(loc->b, y)) - *dym = 1; - else - return FALSE; - } else - return FALSE; - - return TRUE; -} - -wxSnip *wxMediaPasteboard::FindSnip(double x, double y, wxSnip *after) -{ - wxSnip *snip; - wxSnipLocation *loc; - double dym, dxm; - - for (snip = snips; snip; snip = snip->next) { - if (after) { - if (after == snip) - after = NULL; - } else { - loc = SnipLoc(snip); - if (loc->x <= x && loc->y <= y - && loc->r >= x && loc->b >= y) - return snip; - else if (loc->selected && FindDot(loc, x, y, &dxm, &dym)) - return snip; - } - } - - return NULL; -} - -wxSnip *wxMediaPasteboard::FindFirstSnip(void) -{ - return snips; -} - -Bool wxMediaPasteboard::IsSelected(wxSnip *asnip) -{ - wxSnip *snip; - wxSnipLocation *loc; - - for (snip = snips; snip; snip = snip->next) { - if (PTREQ(asnip, snip)) { - loc = SnipLoc(snip); - return loc->selected; - } - } - - return FALSE; -} - -wxSnip *wxMediaPasteboard::FindNextSelectedSnip(wxSnip *start) -{ - wxSnip *snip; - wxSnipLocation *loc; - - if (!start) - snip = snips; - else { - loc = XSnipLoc(start); - if (!loc) return NULL; /* Not in this pasteboard */ - snip = start->next; - } - - for (; snip; snip = snip->next) { - loc = SnipLoc(snip); - if (loc->selected) - return snip; - } - - return NULL; -} - -/***************************************************************************/ - -void wxMediaPasteboard::Draw(wxDC *dc, double dx, double dy, - double cx, double cy, double cw, double ch, - int show_caret, wxColour *bgColor) -{ - wxSnip *snip; - wxStyle *oldstyle = NULL; - wxSnipLocation *loc; - double cr, cb, x, y, r, b, hm, vm, dcx, dcy, dcr, dcb; - - if (!admin) - return; - - writeLocked++; - flowLocked = TRUE; - - dcx = cx + dx; - dcy = cy + dy; - - cr = cx + cw; - cb = cy + ch; - - dcr = dcx + cw; - dcb = dcy + ch; - - if (bgColor) { - wxPen *savePen; - wxBrush *saveBrush, *wb; - - savePen = dc->GetPen(); - saveBrush = dc->GetBrush(); - - if (bgColor == wxWHITE) - wb = whiteBrush; - else - wb = wxTheBrushList->FindOrCreateBrush(bgColor, wxSOLID); - dc->SetBrush(wb); - dc->SetPen(invisiPen); - dc->DrawRectangle(dcx, dcy, - cw + GC_RECT_BRUSH_EXTEND, - ch + GC_RECT_BRUSH_EXTEND); - - dc->SetBrush(saveBrush); - dc->SetPen(savePen); - } - - OnPaint(TRUE, dc, cx, cy, cr, cb, dx, dy, - (show_caret && !caretSnip) - ? show_caret - : (int)wxSNIP_DRAW_NO_CARET); - - for (snip = lastSnip; snip; snip = snip->prev) { - loc = SnipLoc(snip); - - if ((loc->x <= cr) - && (loc->y <= cb) - && (loc->r >= cx) - && (loc->b >= cy)) { - snip->style->SwitchTo(dc, oldstyle); - oldstyle = snip->style; - - x = loc->x + dx; - y = loc->y + dy; - - snip->Draw(dc, x, y, dcx, dcy, dcr, dcb, dx, dy, - PTREQ(snip, caretSnip) - ? (show_caret ? show_caret : (int)wxSNIP_DRAW_NO_CARET) - : (int)wxSNIP_DRAW_NO_CARET); - - if ((show_caret == wxSNIP_DRAW_SHOW_CARET) - && ownCaret - && selectionVisible - && loc->selected) { - wxBrush *oldbrush; - wxPen *oldpen; - - oldbrush = dc->GetBrush(); - oldpen = dc->GetPen(); - dc->SetBrush(blackBrush); - dc->SetPen(invisiPen); - - r = loc->r + dx; - b = loc->b + dy; - hm = loc->hm + dx; - vm = loc->vm + dy; - - dc->DrawRectangle(x - HALF_DOT_WIDTH, - y - HALF_DOT_WIDTH, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND); - dc->DrawRectangle(hm - HALF_DOT_WIDTH, - y - HALF_DOT_WIDTH, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND); - dc->DrawRectangle(r - HALF_DOT_WIDTH, - y - HALF_DOT_WIDTH, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND); - dc->DrawRectangle(r - HALF_DOT_WIDTH, - vm - HALF_DOT_WIDTH, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND); - dc->DrawRectangle(r - HALF_DOT_WIDTH, - b - HALF_DOT_WIDTH, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND); - dc->DrawRectangle(hm - HALF_DOT_WIDTH, - b - HALF_DOT_WIDTH, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND); - dc->DrawRectangle(x - HALF_DOT_WIDTH, - b - HALF_DOT_WIDTH, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND); - dc->DrawRectangle(x - HALF_DOT_WIDTH, - vm - HALF_DOT_WIDTH, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND, - DOT_WIDTH + GC_RECT_BRUSH_EXTEND); - - dc->SetPen(oldpen); - dc->SetBrush(oldbrush); - } - } - } - - { - wxStyle *bs; - bs = styleList->BasicStyle(); - bs->SwitchTo(dc, oldstyle); - } - - OnPaint(FALSE, dc, cx, cy, cr, cb, dx, dy, - (show_caret && !caretSnip) - ? show_caret - : (int)wxSNIP_DRAW_NO_CARET); - - flowLocked = FALSE; - --writeLocked; -} - -void wxMediaPasteboard::Refresh(double localx, double localy, double w, double h, - int show_caret, wxColour *bgColor) -{ - double dx, dy, right, bottom; - wxDC *dc; - - if (!admin) - return; - - if ((h <= 0) || (w <= 0)) - return; - - if (flowLocked || sequence) { - /* We're busy. Invalidate so that everything is refreshed later. */ - Update(localx, localy, w, h); - return; - } - - BeginSequenceLock(); - - ReadyOffscreen(w, h); - - dc = admin->GetDC(&dx, &dy); - - /* Make sure all location information is integral, - so we can shift the coordinate system and generally - update on pixel boundaries. */ - dx = floor(dx); - dy = floor(dy); - bottom = ceil(localy + h); - right = ceil(localx + w); - localy = floor(localy); - localx = floor(localx); - w = right - localx; - h = bottom - localy; - - if (!offscreenInUse && bitmap && bitmap->Ok() && offscreen->Ok() - && bgColor) { -#ifndef EACH_BUFFER_OWN_OFFSCREEN - offscreenInUse = TRUE; -#endif - - Draw(offscreen, -localx, -localy, localx, localy, w, h, show_caret, bgColor); - { - wxBitmap *bm; - bm = offscreen->GetObject(); - dc->Blit(localx - dx, localy - dy, w, h, bm, 0, 0, wxCOPY); - } - -#ifndef EACH_BUFFER_OWN_OFFSCREEN - offscreenInUse = FALSE; - lastUsedOffscreen = this; -#endif - } else { - wxPen *pen; - wxBrush *brush; - wxFont *font; - wxColour *fg, *bg; - int bgmode; - wxRegion *rgn; - - pen = dc->GetPen(); - brush = dc->GetBrush(); - font = dc->GetFont(); - { - wxColour *clr; - clr = dc->GetTextForeground(); - fg = new WXGC_PTRS wxColour(clr); - clr = dc->GetTextBackground(); - bg = new WXGC_PTRS wxColour(clr); - } - bgmode = dc->GetBackgroundMode(); - - rgn = dc->GetClippingRegion(); - dc->SetClippingRect(localx - dx, localy - dy, w, h); - - Draw(dc, -dx, -dy, localx, localy, w, h, show_caret, bgColor); - - dc->SetClippingRegion(rgn); - - dc->SetBrush(brush); - dc->SetPen(pen); - dc->SetFont(font); - dc->SetTextForeground(fg); - dc->SetTextBackground(bg); - dc->SetBackgroundMode(bgmode); - } - - EndSequenceLock(); -} - -void wxMediaPasteboard::CheckRecalc() -{ - double r, b; - wxDC *dc; - wxSnipLocation *loc; - - if (!admin) - return; - - dc = admin->GetDC(); - - if (!dc) - return; - - if (needResize) { - /* Find right & bottom */ - int i; - r = b = 0; - for (i = 0; i < snipLocationList->size; i++) { - loc = (wxSnipLocation *)snipLocationList->vals[i]; - if (loc) { - if (sizeCacheInvalid) { - loc->snip->SizeCacheInvalid(); - loc->needResize = TRUE; - } - if (loc->needResize) - loc->Resize(dc); - if (loc->r + HALF_DOT_WIDTH > r) - r = loc->r + HALF_DOT_WIDTH; - if (loc->b + HALF_DOT_WIDTH > b) - b = loc->b + HALF_DOT_WIDTH; - } - } - - realWidth = r; - realHeight = b; - - if (minWidth && (realWidth < minWidth)) - realWidth = minWidth; - if (maxWidth && (realWidth > maxWidth)) - realWidth = maxWidth; - - if (minHeight && (realHeight < minHeight)) - realHeight = minHeight; - if (maxHeight && (realHeight > maxHeight)) - realHeight = maxHeight; - - needResize = FALSE; - } - - sizeCacheInvalid = FALSE; - - if (!keepSize) { - if (realWidth != totalWidth || realHeight != totalHeight) { - totalWidth = realWidth; - totalHeight = realHeight; - admin->Resized(FALSE); - } - } -} - -void wxMediaPasteboard::Update(double x, double y, double w, double h) -{ - double r, b; - - if (delayedscrollsnip && !sequence && !flowLocked) { - wxSnip *s = delayedscrollsnip; - delayedscrollsnip = NULL; - if (ScrollTo(s, - delayedscrollX, delayedscrollY, - delayedscrollW, delayedscrollH, - TRUE, delayedscrollbias)) - return; - } - - r = x + w; - b = y + h; - - if (x < 0) - x = 0; - if (y < 0) - y = 0; - if (r < 0) - r = 0; - if (b < 0) - b = 0; - - noImplicitUpdate = FALSE; - - if (!updateNonempty) { - updateTop = y; - updateLeft = x; - if (h < 0) - updateBottom = h; - else - updateBottom = b; - if (w < 0) - updateRight = w; - else - updateRight = r; - updateNonempty = TRUE; - } else { - if (y < updateTop) - updateTop = y; - - if (x < updateLeft) - updateLeft = x; - - if ((h < 0) && (updateBottom > 0)) - updateBottom = -updateBottom; - if (updateBottom < 0) { - if (h < 0 && h < updateBottom) - updateBottom = h; - else if (h > 0 && (-b) < updateBottom) - updateBottom = -b; - } else if (b > updateBottom) - updateBottom = b; - - if ((w < 0) && (updateRight > 0)) - updateRight = -updateRight; - if (updateRight < 0) { - if (w < 0 && w < updateRight) - updateRight = w; - else if (h > 0 && (-r) < updateRight) - updateRight = -r; - } else if (r > updateRight) - updateRight = r; - } - - if (sequence || !admin || flowLocked) - return; - - CheckRecalc(); - - if (updateBottom < 0) { - updateBottom = -updateBottom; - if (updateBottom < realHeight) - updateBottom = realHeight; - } - if (updateRight < 0) { - updateRight = -updateRight; - if (updateRight < realWidth) - updateRight = realWidth; - } - - updateNonempty = FALSE; - - if (changed) { - changed = FALSE; - writeLocked++; - OnChange(); - --writeLocked; - } - - if (updateTop != updateBottom || updateLeft != updateRight) { - /* Bizarre MSVC bug: if we inline w & h and skip the > 0 test, - h is wrong */ - double w = updateRight - updateLeft + 1; - double h = updateBottom - updateTop + 1; - - if ((w > 0) && (h > 0)) - admin->NeedsUpdate(updateLeft, updateTop, w, h); - } -} - -void wxMediaPasteboard::UpdateLocation(wxSnipLocation *loc) -{ - if (admin) { - if (loc->needResize) { - wxDC *dc; - dc = admin->GetDC(); - if (dc) - loc->Resize(dc); - /* otherwise, still need resize... */ - } - Update(loc->x - HALF_DOT_WIDTH, loc->y - HALF_DOT_WIDTH, - loc->w + DOT_WIDTH, loc->h + DOT_WIDTH); - } -} - -void wxMediaPasteboard::UpdateSnip(wxSnip *snip) -{ - wxSnipLocation *loc; - - loc = DoXSnipLoc(snipLocationList, snip); - if (loc) - UpdateLocation(loc); -} - -void wxMediaPasteboard::UpdateSelected() -{ - int i; - wxSnipLocation *loc; - - BeginEditSequence(); - - for (i = 0; i < snipLocationList->size; i++) { - loc = (wxSnipLocation *)snipLocationList->vals[i]; - if (loc && loc->selected) - UpdateLocation(loc); - } - - EndEditSequence(); -} - -void wxMediaPasteboard::UpdateAll() -{ - Update(0, 0, -1, -1); -} - -void wxMediaPasteboard::UpdateNeeded() -{ - if ((updateNonempty && !noImplicitUpdate) || delayedscrollsnip) - Update(updateLeft, updateTop, 0, 0); -} - -void wxMediaPasteboard::InvalidateBitmapCache(double x, double y, double w, double h) -{ - Update(x, y, w, h); -} - -/***************************************************************************/ - -void wxMediaPasteboard::OwnCaret(Bool ownit) -{ - if (DoOwnCaret(ownit)) { - UpdateSelected(); - OnFocus(ownit); - } -} - -void wxMediaPasteboard::BlinkCaret() -{ - if (caretSnip) { - wxDC *dc; - double dx, dy; - if ((dc = admin->GetDC(&dx, &dy))) { - double x, y; - if (GetSnipLocation(caretSnip, &x, &y)) - caretSnip->BlinkCaret(dc, x - dx, y - dy); - } - } -} - -void wxMediaPasteboard::SizeCacheInvalid(void) -{ - sizeCacheInvalid = TRUE; - needResize = TRUE; -} - - -void wxMediaPasteboard::GetExtent(double *w, double *h) -{ - CheckRecalc(); - - if (w) - *w = totalWidth; - if (h) - *h = totalHeight; -} - -Bool wxMediaPasteboard::ScrollTo(wxSnip *snip, - double localx, double localy, - double w, double h, - Bool refresh, int bias) -{ - if (sequence) { - delayedscrollsnip = snip; - delayedscrollX = localx; - delayedscrollY = localy; - delayedscrollW = w; - delayedscrollH = h; - return FALSE; - } else if (admin) { - double x, y; - - GetSnipLocation(snip, &x, &y); - - if (AdminScrollTo(x + localx, y + localy, w, h, refresh, bias)) { - if (!refresh) { - updateTop = 0; - updateLeft = 0; - updateBottom = -1; - updateRight = -1; - updateNonempty = TRUE; - } - return TRUE; - } else - return FALSE; - } else - return FALSE; -} - -void wxMediaPasteboard::SetCaretOwner(wxSnip *snip, int dist) -{ - if (DoSetCaretOwner(snip, dist)) { - UpdateAll(); - OnFocus(!snip); - } -} - - -void wxMediaPasteboard::Resized(wxSnip *snip, Bool redraw_now) -{ - wxSnipLocation *loc; - Bool no_implicit_update; - - loc = DoXSnipLoc(snipLocationList, snip); - - if (!loc) - return; - - if (loc->needResize) - return; - - changed = TRUE; - - no_implicit_update = (!updateNonempty || noImplicitUpdate); - - if (!redraw_now) - sequence++; - BeginEditSequence(); - - UpdateLocation(loc); - - loc->needResize = TRUE; - needResize = TRUE; - - UpdateLocation(loc); - - EndEditSequence(); - if (!redraw_now) { - --sequence; - if (no_implicit_update) - noImplicitUpdate = TRUE; - } -} - -Bool wxMediaPasteboard::Recounted(wxSnip *snip, Bool redraw_now) -{ - Resized(snip, redraw_now); - return TRUE; -} - -void wxMediaPasteboard::NeedsUpdate(wxSnip *snip, double localx, double localy, - double w, double h) -{ - double x, y; - - GetSnipLocation(snip, &x, &y); - Update(x + localx, y + localy, w, h); -} - -Bool wxMediaPasteboard::ReleaseSnip(wxSnip *snip) -{ - if (_Delete(snip, NULL)) { - if (!(snip->admin) && (snip->flags & wxSNIP_OWNED)) - snip->flags -= wxSNIP_OWNED; - - return TRUE; - } - - return FALSE; -} - -/************************************************************************/ - -double wxMediaPasteboard::ScrollLineLocation(long line) -{ - return line * scrollStep; -} - - -long wxMediaPasteboard::NumScrollLines() -{ - return (long)((totalHeight + scrollStep - 1) / scrollStep); -} - -long wxMediaPasteboard::FindScrollLine(double y) -{ - return (long)(y / scrollStep); -} - -void wxMediaPasteboard::SetScrollStep(double s) -{ - if (scrollStep != s) { - scrollStep = s; - if (admin) - admin->Resized(TRUE); - } -} - -double wxMediaPasteboard::GetScrollStep(void) -{ - return scrollStep; -} - -/************************************************************************/ - -void wxMediaPasteboard::SetMinWidth(double w) -{ - if (w <= 0) - minWidth = 0.0; - else - minWidth = w; - - needResize = TRUE; - UpdateAll(); -} - -void wxMediaPasteboard::SetMaxWidth(double w) -{ - if (w <= 0) - maxWidth = 0.0; - else - maxWidth = w; - - needResize = TRUE; - UpdateAll(); -} - -double wxMediaPasteboard::GetMinWidth() -{ - return minWidth; -} - -double wxMediaPasteboard::GetMaxWidth() -{ - return maxWidth; -} - -void wxMediaPasteboard::SetMinHeight(double h) -{ - if (h <= 0) - minHeight = 0.0; - else - minHeight = h; - - needResize = TRUE; - UpdateAll(); -} - -void wxMediaPasteboard::SetMaxHeight(double h) -{ - if (h <= 0) - maxHeight = 0.0; - else - maxHeight = h; - - needResize = TRUE; - UpdateAll(); -} - -double wxMediaPasteboard::GetMinHeight() -{ - return minHeight; -} - -double wxMediaPasteboard::GetMaxHeight() -{ - return maxHeight; -} - -/************************************************************************/ - - -wxMediaBuffer *wxMediaPasteboard::CopySelf(void) -{ - wxMediaPasteboard *pb; - - pb = new WXGC_PTRS wxMediaPasteboard(); - - CopySelfTo(pb); - - return pb; -} - -void wxMediaPasteboard::CopySelfTo(wxMediaBuffer *b) -{ - wxMediaPasteboard *pb; - - if (b->bufferType != wxPASTEBOARD_BUFFER) - return; - pb = (wxMediaPasteboard *)b; - - wxMediaBuffer::CopySelfTo(pb); - - pb->SetDragable(GetDragable()); - pb->SetSelectionVisible(GetSelectionVisible()); - pb->SetScrollStep(GetScrollStep()); -} - -double wxMediaPasteboard::GetDescent(void) -{ - return 0; -} - - -double wxMediaPasteboard::GetSpace(void) -{ - return 0; -} - -void wxMediaPasteboard::GetCenter(double *fx, double *fy) -{ - double x, y, w, h; - - if (!admin) { - w = totalWidth; - h = totalHeight; - x = y = 0; - } else - admin->GetView(&x, &y, &w, &h, TRUE); - - if (w > 1000) - // Don't belive it - w = 500; - if (h > 1000) - // Don't belive it - h = 500; - - if (fx) - *fx = w / 2; - if (fy) - *fy = h / 2; - -} - -wxchar *wxMediaPasteboard::GetFlattenedText(long *got) -{ - wxSnip *snip; - wxchar *t, *s, *old; - long p, alloc, offset; - - alloc = 100; - s = new WXGC_ATOMIC wxchar[alloc]; - - snip = snips; - - p = 0; - - while (snip) { - t = snip->GetText(0, snip->count, TRUE); - - offset = wxstrlen(t); - if (p + offset >= alloc) { - alloc = 2 * (p + offset); - old = s; - s = new WXGC_ATOMIC wxchar[alloc]; - memcpy(s, old, p * sizeof(wxchar)); - } - memcpy(s + p, t, offset * sizeof(wxchar)); - p += offset; - - snip = snip->next; - } - - s[p] = 0; - if (got) - *got = p; - - return s; -} - -/************************************************************************/ - -void wxMediaPasteboard::Clear() -{ - Delete(); -} - -void wxMediaPasteboard::Cut(Bool extend, long time) -{ - Copy(extend, time); - Clear(); -} - -void wxMediaPasteboard::DoCopy(long time, Bool extend) -{ - wxSnip *snip, *asnip; - wxSnipLocation *loc; - wxStyleList *sl; - - wxmb_commonCopyRegionData = NULL; - - sl = (extend && wxmb_copyStyleList) ? wxmb_copyStyleList : styleList; - - for (snip = snips; snip; snip = snip->Next()) { - loc = SnipLoc(snip); - if (loc->selected) { - asnip = snip->Copy(); - asnip->SetAdmin(NULL); - asnip->style = sl->Convert(asnip->style); - wxmb_commonCopyBuffer->Append(asnip); - wxmb_commonCopyBuffer2->Append(GetSnipData(loc->snip)); - } - } - - InstallCopyBuffer(time, sl); -} - -void wxMediaPasteboard::Copy(Bool extend, long time) -{ - BeginCopyBuffer(); - - if (!extend) - FreeOldCopies(); - - DoCopy(time, extend); - - EndCopyBuffer(); -} - -void wxMediaPasteboard::DoGenericPaste(wxClipboard *cb, long time) -{ - wxSnip *start, *snip; - double cx, cy, left, right, top, bottom, dx, dy; - wxSnipLocation *loc; - wxDC *dc; - - if (userLocked || writeLocked) - return; - - start = snips; - GetCenter(&cx, &cy); - - DoBufferPaste(cb, time); - - // Quiet the compiler: - left = right = top = bottom = 0; - - if (admin && PTRNE(snips, start)) { - dc = GetDC(); - - if (dc) { - /* Get top/left/bottom/right of pasted group: */ - for (snip = snips; PTRNE(snip, start); snip = snip->next) { - loc = SnipLoc(snip); - if (loc->needResize) - loc->Resize(dc); - if (PTREQ(snip, snips)) { - left = loc->x; - top = loc->y; - right = loc->r; - bottom = loc->b; - } else { - if (loc->x < left) - left = loc->x; - if (loc->y < top) - top = loc->y; - if (loc->r > right) - right = loc->r; - if (loc->b > bottom) - bottom = loc->b; - } - AddSelected(snip); - } - - dx = cx - (left + right) / 2; - dy = cy - (top + bottom) / 2; - - /* Shift the pasted group to center: */ - Move(dx, dy); - } - } else { - /* Just select them: */ - for (snip = snips; PTRNE(snip, start); snip = snip->next) { - AddSelected(snip); - } - } -} - -void wxMediaPasteboard::DoPaste(long time) -{ - DoGenericPaste(wxTheClipboard, time); -} - -void wxMediaPasteboard::DoPasteSelection(long time) -{ -#ifdef wx_xt - DoGenericPaste(wxTheSelection, time); -#else - DoGenericPaste(wxTheClipboard, time); -#endif -} - -void wxMediaPasteboard::GenericPaste(Bool x_sel, long time) -{ - if (userLocked || writeLocked) - return; - - BeginEditSequence(); - - NoSelected(); - - if (x_sel) - DoPasteSelection(time); - else - DoPaste(time); - - EndEditSequence(); -} - -void wxMediaPasteboard::Paste(long time) -{ - GenericPaste(0, time); -} - -void wxMediaPasteboard::PasteSelection(long time) -{ -#ifdef wx_xt - GenericPaste(1, time); -#endif -} - -void wxMediaPasteboard::InsertPasteSnip(wxSnip *snip, wxBufferData *data) -{ - Insert(snip, snip); - SetSnipData(snip, data); -} - -void wxMediaPasteboard::InsertPasteString(wxchar *str) -{ - wxTextSnip *snip; - - snip = new WXGC_PTRS wxTextSnip(); - snip->style = GetDefaultStyle(); - if (!snip->style) { - snip->style = styleList->BasicStyle(); - } - snip->Insert(str, wxstrlen(str)); - - InsertPasteSnip(snip, NULL); -} - -void wxMediaPasteboard::Kill(long time) -{ - Cut(time); -} - -/************************************************************************/ - -Bool wxMediaPasteboard::GetSnipLocation(wxSnip *thesnip, double *x, double *y, - Bool bottomRight) -{ - wxSnipLocation *loc; - - if (bottomRight) { - if (!admin) - return FALSE; - CheckRecalc(); - } - - loc = DoXSnipLoc(snipLocationList, thesnip); - if (!loc) - return FALSE; - - if (x) - *x = loc->x; - if (y) - *y = loc->y; - if (bottomRight) { - if (x) - *x += loc->w; - if (y) - *y += loc->h; - } - - return TRUE; -} - -/************************************************************************/ - -wxBufferData *wxMediaPasteboard::GetSnipData(wxSnip *snip) -{ - wxSnipLocation *loc; - wxLocationBufferData *data; - - loc = DoXSnipLoc(snipLocationList, snip); - - if (!loc) - return wxMediaBuffer::GetSnipData(snip); - - data = new WXGC_PTRS wxLocationBufferData; - data->x = loc->x; - data->y = loc->y; - - data->next = wxMediaBuffer::GetSnipData(snip); - - return data; -} - -void wxMediaPasteboard::SetSnipData(wxSnip *snip, wxBufferData *data) -{ - while (data) { - if (data->dataclass && !strcmp(data->dataclass->classname, "wxloc")) { - wxLocationBufferData *ldata; - ldata = (wxLocationBufferData *)data; - MoveTo(snip, ldata->x, ldata->y); - } - data = data->next; - } -} - -int wxMediaPasteboard::InsertPort(Scheme_Object *f, int WXUNUSED(format), Bool replaceStyles) -{ - if (userLocked || writeLocked) - return FALSE; - - InsertFile("insert-file in pasteboard%", f, NULL, replaceStyles, TRUE); - - return wxMEDIA_FF_STD; -} - -Bool wxMediaPasteboard::InsertFile(const char *who, Scheme_Object *f, const char *filename, - Bool clearStyles, Bool showErrors) -{ - Bool fileerr; - - if (userLocked || writeLocked) - return FALSE; - - showErrors = TRUE; - - if (!wxDetectWXMEFile(who, f, 0)) { - if (showErrors) - wxmeError("insert-file in pasteboard%: not a MrEd editor<%> file"); - fileerr = TRUE; - } else { - wxMediaStreamInFileBase *b; - wxMediaStreamIn *mf; - - b = new WXGC_PTRS wxMediaStreamInFileBase(f); - mf = new WXGC_PTRS wxMediaStreamIn(b); - - if (wxReadMediaVersion(mf, b, FALSE, showErrors)) { - if (wxReadMediaGlobalHeader(mf)) { - if (mf->Ok()) - fileerr = !ReadFromFile(mf, clearStyles); - else - fileerr = TRUE; - } else - fileerr = TRUE; - fileerr = !wxReadMediaGlobalFooter(mf) || fileerr; - - styleList->NewNamedStyle(STD_STYLE, NULL); - - fileerr = fileerr || !mf->Ok(); - } else - fileerr = TRUE; - } - - if (fileerr && showErrors) - wxmeError("insert-file in pasteboard%: error loading the file"); - - return !fileerr; -} - -Bool wxMediaPasteboard::SavePort(Scheme_Object *f, int format, Bool showErrors) -{ - Bool fileerr; - wxMediaStreamOutFileBase *b; - wxMediaStreamOut *mf; - - showErrors = TRUE; - - b = new WXGC_PTRS wxMediaStreamOutFileBase(f); - mf = new WXGC_PTRS wxMediaStreamOut(b); - - wxWriteMediaVersion(mf, b); - - wxWriteMediaGlobalHeader(mf); - if (mf->Ok()) - fileerr = !WriteToFile(mf); - else - fileerr = TRUE; - wxWriteMediaGlobalFooter(mf); - - fileerr = fileerr || !mf->Ok(); - - if (fileerr && showErrors) - wxmeError("save-file in pasteboard%: error writing the file"); - - return !fileerr; -} - -Bool wxMediaPasteboard::WriteToFile(wxMediaStreamOut *f) -{ - if (!DoWriteHeadersFooters(f, TRUE)) - return FALSE; - - wxmbWriteSnipsToFile(f, styleList, NULL, snips, NULL, NULL, this); - - if (!DoWriteHeadersFooters(f, FALSE)) - return FALSE; - - return TRUE; -} - - -Bool wxMediaPasteboard::ReadFromFile(wxMediaStreamIn *f, Bool overwritestyle) -{ - if (userLocked || writeLocked) - return FALSE; - - return ReadSnipsFromFile(f, overwritestyle); -} - - -Bool wxMediaPasteboard::ReadInsert(wxSnip *snip) -{ - Insert(snip, (wxSnip *)NULL); - return TRUE; -} - -void wxMediaPasteboard::SetFilename(char *name, Bool temp) -{ - wxSnip *snip; - - filename = copystring(name); - tempFilename = temp; - - for (snip = snips; snip; snip = snip->next) { - if (snip->flags & wxSNIP_USES_BUFFER_PATH) - /* Just a notification */ - snip->SetAdmin(snipAdmin); - } -} - -/************************************************************************/ - -void wxMediaPasteboard::StyleHasChanged(wxStyle *style) -{ - if (!style) { - changed = TRUE; - UpdateAll(); - return; - } -} - -/************************************************************************/ - -void wxMediaPasteboard::BeginEditSequence(Bool undoable, Bool interruptSeqs) -{ - WaitSequenceLock(); - - if (noundomode || !undoable) - noundomode++; - - if (!sequence && !writeLocked) - OnEditSequence(); - - sequence++; -} - - -void wxMediaPasteboard::EndEditSequence(void) -{ - if (!(--sequence) && !writeLocked) { - sequenceStreak = FALSE; - UpdateNeeded(); - AfterEditSequence(); - } - - if (noundomode) - --noundomode; - - if (!sequence && needOnDisplaySize) { - needOnDisplaySize = 0; - OnDisplaySize(); - } -} - -Bool wxMediaPasteboard::RefreshDelayed(void) -{ - if (sequence) - return 1; - - if (!admin) - return 1; - else - return admin->DelayRefresh(); -} - -Bool wxMediaPasteboard::InEditSequence(void) -{ - return !!sequence; -} - -Bool wxMediaPasteboard::LocationsUpToDate(void) -{ - return !needResize; -} - -/************************************************************************/ - -void wxMediaPasteboard::AddPasteboardFunctions(wxKeymap *tab) -{ - wxAddMediaPasteboardFunctions(tab); -} - -void wxAddMediaPasteboardFunctions(wxKeymap *) -{ -} - -Bool wxMediaPasteboard::GetDragable() -{ - return dragable; -} - -void wxMediaPasteboard::SetDragable(Bool d) -{ - dragable = d; -} - -Bool wxMediaPasteboard::GetSelectionVisible() -{ - return selectionVisible; -} - -void wxMediaPasteboard::SetSelectionVisible(Bool v) -{ - selectionVisible = v; -} - - -/************************************************************************/ - -void wxMediaPasteboard::OnChange(void) -{ -} - -Bool wxMediaPasteboard::CanInsert(wxSnip *, wxSnip *, double, double) -{ - return TRUE; -} - -void wxMediaPasteboard::OnInsert(wxSnip *, wxSnip *, double, double) -{ -} - -void wxMediaPasteboard::AfterInsert(wxSnip *, wxSnip *, double, double) -{ -} - -Bool wxMediaPasteboard::CanDelete(wxSnip *) -{ - return TRUE; -} - -void wxMediaPasteboard::OnDelete(wxSnip *) -{ -} - -void wxMediaPasteboard::AfterDelete(wxSnip *) -{ -} - -Bool wxMediaPasteboard::CanMoveTo(wxSnip *, double, double, Bool WXUNUSED(dragging)) -{ - return TRUE; -} - -void wxMediaPasteboard::OnMoveTo(wxSnip *, double, double, Bool WXUNUSED(dragging)) -{ -} - -void wxMediaPasteboard::AfterMoveTo(wxSnip *, double, double, Bool WXUNUSED(dragging)) -{ -} - -Bool wxMediaPasteboard::CanResize(wxSnip *, double, double) -{ - return TRUE; -} - -void wxMediaPasteboard::OnResize(wxSnip *, double, double) -{ -} - -void wxMediaPasteboard::AfterResize(wxSnip *, double, double, Bool WXUNUSED(did)) -{ -} - -Bool wxMediaPasteboard::CanSelect(wxSnip *, Bool) -{ - return TRUE; -} - -void wxMediaPasteboard::OnSelect(wxSnip *, Bool) -{ -} - -void wxMediaPasteboard::AfterSelect(wxSnip *, Bool) -{ -} - -Bool wxMediaPasteboard::CanReorder(wxSnip *, wxSnip *, Bool) -{ - return TRUE; -} - -void wxMediaPasteboard::OnReorder(wxSnip *, wxSnip *, Bool) -{ -} - -void wxMediaPasteboard::AfterReorder(wxSnip *, wxSnip *, Bool) -{ - -} - -#if ALLOW_X_STYLE_SELECTION -Bool wxMediaPasteboard::OwnXSelection(Bool on, Bool WXUNUSED(update), Bool force) -{ - return DoOwnXSelection(on, force); -} -#endif - -Bool wxMediaPasteboard::CanInteractiveMove(wxMouseEvent *) -{ - return TRUE; -} - -void wxMediaPasteboard::OnInteractiveMove(wxMouseEvent *) -{ -} - -void wxMediaPasteboard::AfterInteractiveMove(wxMouseEvent *) -{ -} - -Bool wxMediaPasteboard::CanInteractiveResize(wxSnip *) -{ - return TRUE; -} - -void wxMediaPasteboard::OnInteractiveResize(wxSnip *) -{ -} - -void wxMediaPasteboard::AfterInteractiveResize(wxSnip *) -{ -} - -/************************************************************************/ - -extern void wxmeGetDefaultSize(double *w, double *h); - -void *wxMediaPasteboard::BeginPrint(wxDC *, Bool) -{ - SizeCacheInvalid(); - - writeLocked++; - OnChange(); - --writeLocked; - - return NULL; -} - -void wxMediaPasteboard::EndPrint(wxDC *, void *) -{ - SizeCacheInvalid(); - - writeLocked++; - OnChange(); - --writeLocked; -} - -Bool wxMediaPasteboard::HasPrintPage(wxDC *dc, int p) -{ - double H, W, h, w; - long hm, vm, hcount, vcount; - - CheckRecalc(); - - dc->GetSize(&W, &H); - if (!W || !H) - wxmeGetDefaultSize(&W, &H); - wxGetMediaPrintMargin(&hm, &vm); - W -= 2 * hm; - H -= 2 * vm; - - w = h = 0.0; - GetExtent(&w, &h); - - hcount = (long)(w / W); - if (hcount * W < w) - hcount++; - - vcount = (long)(h / H); - if (vcount * H < h) - vcount++; - - return (p <= (hcount * vcount)); -} - -void wxMediaPasteboard::PrintToDC(wxDC *dc, int page) -{ - double H, W, FH, FW, h, w; - long hm, vm, hcount, vcount, hpos, vpos, startpage, endpage, p; - - CheckRecalc(); - - dc->GetSize(&W, &H); - if (!W || !H) - wxmeGetDefaultSize(&W, &H); - FH = H; - FW = W; - wxGetMediaPrintMargin(&hm, &vm); - W -= 2 * hm; - H -= 2 * vm; - - w = h = 0.0; - GetExtent(&w, &h); - - hcount = (long)(w / W); - if (hcount * W < w) - hcount++; - - vcount = (long)(h / H); - if (vcount * H < h) - vcount++; - - if (page < 0) { - startpage = 1; - endpage = hcount * vcount; - } else { - startpage = endpage = page; - } - - for (p = startpage; p <= endpage; p++) { - double x, y; - - vpos = (p - 1) / hcount; - hpos = (p - 1) % hcount; - - x = hpos * W; - y = vpos * H; - - if (page < 0) - dc->StartPage(); - - Draw(dc, -x + hm, -y + vm, - x, y, x + W, y + H, - FALSE, - NULL); - - if (page < 0) - dc->EndPage(); - } -} - -/************************************************************************/ - -wxSnipLocation::wxSnipLocation() -: wxObject(WXGC_NO_CLEANUP) -{ -} - -void wxSnipLocation::Resize(wxDC *dc) -{ - double ww, hh; - - ww = hh = 0.0; - snip->GetExtent(dc, x, y, &ww, &hh); - w = ww; - h = hh; - r = x + w; - b = y + h; - hm = x + w/2; - vm = y + h/2; - - needResize = FALSE; -} diff --git a/src/mred/wxme/wx_mpriv.cxx b/src/mred/wxme/wx_mpriv.cxx deleted file mode 100644 index 310222c76d..0000000000 --- a/src/mred/wxme/wx_mpriv.cxx +++ /dev/null @@ -1,3090 +0,0 @@ -/* - * File: wx_mpriv.cc - * Purpose: wxMediaEdit private methods implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#define Uses_wxPrintSetup /* for wx_xt */ -#define Uses_XLib /* for getting black pixel value */ -#include "common.h" -#include "wx_dialg.h" -#ifndef OLD_WXWINDOWS -# include "wx_cmdlg.h" -#endif -#include "wx_utils.h" -#include "wx_dcps.h" -#include "wx_media.h" -#ifdef wx_xt -# include "wx_types.h" -#else -# include "wx_main.h" -#endif - -#include -#include -#include -#include - -#include "wx_mpriv.h" - -#include "wx_gcrct.h" - -/* Debugging: */ -#define CHECK_CONSISTENCY 0 -#define LOOK_FOR_ZEROED 0 -#define PLOT_SNIP_DOT 0 - -#define A_VERY_BIG_NUMBER 1e50 - -/****************************************************************/ -/* PRIVATE */ -/****************************************************************/ - -void wxMediaEdit::_SetPosition(Bool setflash, int bias, long start, long end, - Bool ateol, Bool scroll, int seltype) -{ - long oldstart, oldend, sPos; - Bool oldateol; - wxSnip *snip; - Bool needRefresh, needFullRefresh, changedPos; - - if (flowLocked) - return; - - if (!setflash && (!flash || !flashautoreset || !flashdirectoff)) - EndStreaks(wxSTREAK_EXCEPT_DELAYED); - - if ((start < 0) - || ((end != -1) && (start > end))) - return; - - if (end == -1) - end = start; - else if (end > len) - end = len; - - if (start > len) - start = len; - - if (ateol) { - if (start != end) - ateol = FALSE; - else { - snip = FindSnip(start, -1, &sPos); - if (!(snip->flags & wxSNIP_NEWLINE) - || (snip->flags & wxSNIP_INVISIBLE) - || start != sPos + snip->count) - ateol = FALSE; - } - } - - if (flash) { - oldstart = flashstartpos; - oldend = flashendpos; - oldateol = flashposateol; - } else { - oldstart = startpos; - oldend = endpos; - oldateol = posateol; - } - - if (!setflash && flash && flashautoreset) { - flash = FALSE; - if (flashTimer) { - flashTimer->Stop(); - DELETE_OBJ flashTimer; - flashTimer = NULL; - } - } - - if (start == oldstart && end == oldend && ateol == oldateol) - needRefresh = changedPos = FALSE; - else { - needRefresh = changedPos = TRUE; - - if (setflash) { - flashstartpos = start; - flashendpos = end; - flashposateol = ateol; - } else { -#if ALLOW_X_STYLE_SELECTION - if (start == end || wxMediaXSelectionAllowed != this - || (seltype == wxLOCAL_SELECT)) { - if (!delayRefresh || needXCopy) { - needXCopy = FALSE; - CopyOutXSelection(); - } - } -#endif - - CheckMergeSnips(startpos); - CheckMergeSnips(endpos); - - caretStyle = NULL; - startpos = start; - endpos = end; - posateol = ateol; - } - } - - needFullRefresh = FALSE; -#if ALLOW_X_STYLE_SELECTION - if (!setflash && wxMediaXSelectionMode) { - if ((seltype != wxLOCAL_SELECT) - && start != end - && this != wxMediaXSelectionOwner) { - if (OwnXSelection(TRUE, FALSE, seltype == wxX_SELECT)) { - needFullRefresh = TRUE; - needRefresh = TRUE; - } - } else if ((start == end - || wxMediaXSelectionAllowed != this - || (seltype == wxLOCAL_SELECT)) - && this == wxMediaXSelectionOwner) { - if (OwnXSelection(FALSE, FALSE, FALSE)) { - needFullRefresh = TRUE; - needRefresh = TRUE; - } - } - } -#endif - - if (setflash) - flash = TRUE; - - if (scroll) { - long scrollStart, scrollEnd; - - if (bias < -1) { - scrollStart = scrollEnd = start; - bias = 0; - } else if (bias > 1) { - scrollStart = scrollEnd = end; - bias = 0; - } else { - scrollStart = start; - scrollEnd = end; - } - - { - int wasBlinked = caretBlinked; - caretBlinked = FALSE; - if (ScrollToPosition(scrollStart, posateol, TRUE, scrollEnd, bias)) - needRefresh = FALSE; - else - caretBlinked = wasBlinked; - } - } - - if (needRefresh) { - if (needRefresh) { - caretBlinked = FALSE; - if (start >= oldend || end <= oldstart || needFullRefresh) { - /* No overlap: */ - NeedRefresh(oldstart, oldend); - NeedRefresh(start, end); - } else { - if (start < oldstart) - NeedRefresh(start, oldstart); - if (oldstart < start) - NeedRefresh(oldstart, start); - if (end < oldend) - NeedRefresh(end, oldend); - if (oldend < end) - NeedRefresh(oldend, end); - } - } - } - - if (changedPos && !setflash) - AfterSetPosition(); -} - -void wxMediaFlashTimer::Notify(void) -{ - media->FlashOff(); -} - -/**********************************************************************/ - -void wxMediaEdit::_ChangeStyle(long start, long end, - wxStyle *newStyle, wxStyleDelta *delta, - Bool restoreSel, Bool counts_as_mod) -{ - wxSnip *gsnip, *startSnip, *endSnip; - wxStyleChangeRecord *rec; - wxStyle *style, *style2, *prev_style; - long p, prev_style_pos, extra_check_pos = 0; - int something; - - if (writeLocked || userLocked) - return; - - if (newStyle && (styleList->StyleToIndex(newStyle) < 0)) - return; - - if (start < 0) - start = 0; - if (start > len) - start = len; - if (end > len) - end = len; - if (start > end) - return; - - if (!newStyle && !delta) { - newStyle = GetDefaultStyle(); - if (!newStyle) - newStyle = styleList->BasicStyle(); - } - - if ((startpos == start) && (endpos == end) && (start == end) && len) { - if (stickyStyles) { - if (newStyle) - caretStyle = newStyle; - else { - /* handle delta */ - if (caretStyle) { - caretStyle = styleList->FindOrCreateStyle(caretStyle, delta); - } else { - gsnip = FindSnip(start, -1); - caretStyle = styleList->FindOrCreateStyle(gsnip->style, delta); - } - } - } - return; - } - - writeLocked = TRUE; - - if (!CanChangeStyle(start, end - start)) - goto give_up; - OnChangeStyle(start, end - start); - - flowLocked = TRUE; - - MakeSnipset(start, end); - - if (!len) { - startSnip = snips; - endSnip = NULL; - initialStyleNeeded = 0; - } else { - startSnip = FindSnip(start, +1); - endSnip = FindSnip(end, +2); - } - - if (!noundomode) - rec = new WXGC_PTRS wxStyleChangeRecord(start, end, delayedStreak || !modified, startpos, endpos, restoreSel); - else - rec = NULL; - - something = FALSE; - - prev_style = NULL; - prev_style_pos = start; - p = start; - for (gsnip = startSnip; PTRNE(gsnip, endSnip); gsnip = gsnip->next) { - style = gsnip->style; - - if (newStyle) - style2 = newStyle; - else - style2 = styleList->FindOrCreateStyle(style, delta); - - if (PTRNE(style, style2)) { - gsnip->style = style2; - - if (rec && (style != prev_style)) { - if (prev_style) { - rec->AddStyleChange(prev_style_pos, p, prev_style); - } - prev_style_pos = p; - prev_style = style; - } - - gsnip->SizeCacheInvalid(); - gsnip->line->MarkRecalculate(); - if (maxWidth > 0) - gsnip->line->MarkCheckFlow(); - - extra_check_pos = p; - - something = TRUE; - } else if (rec && prev_style) { - rec->AddStyleChange(prev_style_pos, p, prev_style); - prev_style = NULL; - } - - p += gsnip->count; - } - - if (rec && prev_style) { - rec->AddStyleChange(prev_style_pos, p, prev_style); - } - - if (something) { - if (startSnip->line->prev - && !(startSnip->line->prev->lastSnip->flags & wxSNIP_HARD_NEWLINE)) - startSnip->line->prev->MarkCheckFlow(); - - if (!modified) { - wxUnmodifyRecord *ur; - ur = new WXGC_PTRS wxUnmodifyRecord(delayedStreak); - AddUndo(ur); - } - if (rec) - AddUndo(rec); - if (delayRefresh) - delayedStreak = TRUE; - - CheckMergeSnips(start); - if (extra_check_pos) - CheckMergeSnips(extra_check_pos); - if (extra_check_pos != end) - CheckMergeSnips(end); - - if (!modified && counts_as_mod) - SetModified(TRUE); - - writeLocked = FALSE; - flowLocked = FALSE; - - RefreshByLineDemand(); - } else { - if (rec) - DELETE_OBJ rec; - writeLocked = FALSE; - flowLocked = FALSE; - - CheckMergeSnips(start); - CheckMergeSnips(end); - } - - AfterChangeStyle(start, end - start); - - return; - - give_up: - writeLocked = FALSE; - flowLocked = FALSE; - - return; -} - -/****************************************************************/ - -void wxMediaEdit::SettingAdmin(wxMediaAdmin * /* newadmin */) -{ -} - -void wxMediaEdit::InitNewAdmin(void) -{ - if (!delayRefresh && (!admin || !admin->DelayRefresh())) - Redraw(); -} - -void wxMediaEdit::EndStreaks(int exception) -{ - if (map && !(exception & wxSTREAK_EXCEPT_KEY_SEQUENCE) && !streaksPushed) - map->BreakSequence(); - if (flash && flashautoreset && !flashdirectoff) - FlashOff(); - - typingStreak = FALSE; - deletionStreak = FALSE; - if (!(exception & wxSTREAK_EXCEPT_CURSOR)) { - vcursorStreak = FALSE; - extendStreak = FALSE; - } - if (anchorStreak && !keepAnchorStreak) - SetAnchor(FALSE); - - if (!(exception & wxSTREAK_EXCEPT_DELAYED)) - delayedStreak = FALSE; - - killStreak = FALSE; - - prevPasteStart = -1; -} - -void wxMediaEdit::PushStreaks(void) -{ - streaksPushed = TRUE; - saveTypingStreak = typingStreak; - saveDeletionStreak = deletionStreak; - saveDelayedStreak = delayedStreak; - saveVcursorStreak = vcursorStreak; - saveKillStreak = killStreak; - saveAnchorStreak = anchorStreak; - saveExtendStreak = extendStreak; - savePrevPasteStart = prevPasteStart; - savePrevPasteEnd = prevPasteEnd; -} - -void wxMediaEdit::PopStreaks(void) -{ - if (streaksPushed) { - streaksPushed = FALSE; - typingStreak = saveTypingStreak; - deletionStreak = saveDeletionStreak; - delayedStreak = saveDelayedStreak; - vcursorStreak = saveVcursorStreak; - killStreak = saveKillStreak; - anchorStreak = saveAnchorStreak; - extendStreak = saveExtendStreak; - prevPasteStart = savePrevPasteStart; - prevPasteEnd = savePrevPasteEnd; - } -} - -/****************************************************************/ - -long wxMediaEdit::_FindPositionInLine(Bool internal, long i, double x, - Bool *ateol, Bool *onit, - double *how_close) -{ - double w, X, topy; - wxSnip *snip; - wxDC *dc; - long p, sPos; - wxMediaLine *line; - Bool atsnipend; - Bool wl, fl; - - if (onit) - *onit = FALSE; - if (how_close) - *how_close = 100; - - if (!internal && !CheckRecalc(TRUE, FALSE)) - return 0; - - if (i < 0) - return 0; - if (i >= numValidLines) - return len; - - line = lineRoot->FindLine(i); - - x -= line->GetLeftLocation(maxWidth); - - if (ateol) - *ateol = FALSE; - - if (x <= 0) - return FindFirstVisiblePosition(line); - - p = line->GetPosition(); - - if (x >= line->w) { - /* snip == the last one */ - snip = line->lastSnip; - sPos = p + line->len - snip->count; - p += line->len; - } else { - if (onit) - *onit = TRUE; - - dc = admin->GetDC(); - if (!dc) - return 0; - - X = 0; - - wl = writeLocked; - fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - /* linear seach for snip */ - snip = NULL; - topy = line->GetLocation(); - while(1) { - snip = snip ? snip->next : line->snip; - - w = 0.0; - snip->GetExtent(dc, X, topy, &w); - - if (x > w && snip->next) { - x -= w; - X += w; - p += snip->count; - } else { - /* Found the right snip */ - sPos = p; - p += _FindPositionInSnip(dc, X, topy, snip, x, how_close); - break; - } - } - - writeLocked = wl; - flowLocked = fl; - } - - /* Back up over invisibles */ - atsnipend = (p - sPos == snip->count); - if (atsnipend) - FindLastVisiblePosition(line, &p, &snip); - - if (ateol && atsnipend && snip && PTREQ(snip, line->lastSnip)) - *ateol = TRUE; - - return p; -} - -long wxMediaEdit::FindFirstVisiblePosition(wxMediaLine *line, wxSnip *snip) -{ - wxSnip *nextSnip; - long p, startp; - - if (readLocked) - return 0; - - if (!snip) - snip = line->snip; - - startp = line->GetPosition(); - p = startp; - nextSnip = line->lastSnip->next; - - while (PTRNE(snip, nextSnip)) { - if (snip->flags & wxSNIP_INVISIBLE) - p += snip->count; - else - break; - snip = snip->next; - } - - if (PTREQ(snip, nextSnip)) { - /* If everything is invisible, then presumably the CR is forced, - so go to the beginning of the line anyway */ - p = startp; - } - - return p; -} - -void wxMediaEdit::FindLastVisiblePosition(wxMediaLine *line, long *p, - wxSnip **snipP) -{ - wxSnip *snip; - - if (readLocked) - return; - - snip = snipP ? *snipP : (wxSnip *)NULL; - - if (!snip) - snip = line->lastSnip; - - do { - if (snip->flags & wxSNIP_INVISIBLE) { - *p -= snip->count; - if (PTRNE(snip, line->snip)) - snip = snip->prev; - } - } while ((snip->flags & wxSNIP_INVISIBLE) && PTRNE(snip, line->snip)); - - if (snipP) - *snipP = snip; -} - -/****************************************************************/ - -long wxMediaEdit::_FindStringAll(wxchar *str, int direction, - long start, long end, - long **positions, Bool justOne, - Bool bos, Bool caseSens) -{ - wxSnip *snip; - wxchar text[256], *oldStr, c; - long *smap; - long sPos, p, n, thistime, thisoffset, need, checked, offset, shorten, i; - long slen, s, sbase, beyond, sgoal, totalCount, allocFound, foundCount; - - if (!direction) - direction = 1; - if (direction < -1) - direction = -1; - else if (direction > 1) - direction = 1; - - if (start < 0) - start = startpos; - if (end < 0) { - if (direction < 0) - end = 0; - else - end = len; - } - if (start > len) - start = len; - if (end > len) - end = len; - - if (direction < 0) - totalCount = start - end; - else - totalCount = end - start; - if (totalCount < 0) - return -1; - - slen = wxstrlen(str); - if (!slen) - return -1; - - if (!caseSens) { - oldStr = str; - str = new WXGC_ATOMIC wxchar[slen + 1]; - for (i = 0; i < slen; i++) { - c = oldStr[i]; - str[i] = scheme_tofold(c); - } - str[i] = 0; - } - - snip = FindSnip(start, direction, &sPos); - if (!snip) - return -1; - - if (direction > 0) { - offset = start - sPos; - shorten = 0; - sbase = 0; - beyond = -1; - sgoal = slen; - } else { - shorten = (sPos + snip->count) - start; - offset = 0; - sbase = slen - 1; - beyond = slen; - sgoal = -1; - } - - smap = new WXGC_ATOMIC long[slen]; - - smap[sbase] = beyond; - s = beyond; - for (i = sbase + direction; i != sgoal; i += direction) { - while ((s != beyond) && (str[s + direction] != str[i])) { - s = smap[s]; - } - if (str[s + direction] == str[i]) - s += direction; - smap[i] = s; - } - - s = beyond; - - if (!justOne) { - long *naya; - allocFound = 10; - naya = new WXGC_ATOMIC long[allocFound]; - *positions = naya; - foundCount = 0; - } else - allocFound = foundCount = 0; - - while (snip && totalCount) { - need = snip->count - shorten - offset; - if (need > totalCount) { - if (direction < 0) - offset += (need - totalCount); - need = totalCount; - } - - checked = 0; - - totalCount -= need; - - do { - Bool wl, fl; - - thistime = need; - if (thistime > 255) - thistime = 255; - need -= thistime; - - thisoffset = offset + ((direction < 0) ? need : checked); - - wl = writeLocked, fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - snip->GetTextBang(text, thisoffset, thistime, 0); - - writeLocked = wl; - flowLocked = fl; - - text[thistime] = 0; - - i = (direction > 0) ? 0 : thistime - 1; - n = thistime; - while(n--) { - c = text[i]; - if (!caseSens) - c = scheme_tofold(c); - while ((s != beyond) && (str[s + direction] != c)) { - s = smap[s]; - } - if (str[s + direction] == c) { - s += direction; - if (s + direction == sgoal) { - p = sPos + i + thisoffset; - if (bos) { - if (direction < 0) - p += slen; - else - p -= (slen - 1); - } else if (direction > 0) - p++; - if (justOne) - goto search_done; - else { - if (foundCount == allocFound) { - long *old = *positions, *naya, oldCount = allocFound; - - allocFound *= 2; - naya = new WXGC_ATOMIC long[allocFound]; - *positions = naya; - - memcpy(*positions, old, oldCount * sizeof(long)); - } - (*positions)[foundCount++] = p; - s = beyond; - } - } - } - i += direction; - } - - checked += thistime; - } while(need); - - if (direction > 0) - sPos += snip->count; - snip = (direction > 0) ? snip->next : snip->prev; - if (snip) { - if (direction < 0) - sPos -= snip->count; - } - offset = shorten = 0; - } - - p = -1; - - search_done: - return justOne ? p : foundCount; -} - -/****************************************************************/ - -void wxMediaEdit::MakeOnlySnip(void) -{ - wxMediaLine *line; - - snips = new WXGC_PTRS wxTextSnip(); - snips->style = GetDefaultStyle(); - if (!snips->style) { - snips->style = styleList->BasicStyle(); - } -#if CHECK_CONSISTENCY - if (!snips->style) - fprintf(stderr, "NULL style for basic style!\n"); -#endif - snips->count = 0; - snips->SetAdmin(snipAdmin); - snips->prev = NULL; - snips->next = NULL; - - line = new WXGC_PTRS wxMediaLine; - snips->line = lineRoot = firstLine = lastLine = line; - lineRoot->SetStartsParagraph(TRUE); - - lineRoot->snip = lineRoot->lastSnip = snips; - - lastSnip = snips; - snipCount = 1; - - numValidLines = 1; -} - -void wxMediaEdit::SpliceSnip(wxSnip *snip, wxSnip *prev, wxSnip *next) -{ - if (prev) - prev->next = snip; - else - snips = snip; - snip->prev = prev; - snip->next = next; - if (next) - next->prev = snip; - else - lastSnip = snip; -} - -void wxMediaEdit::InsertSnip(wxSnip *before, wxSnip *snip) -{ - if (PTREQ(snips, lastSnip) && !snips->count) { - AppendSnip(snip); - } else { - SpliceSnip(snip, before->prev, before); - snipCount++; - } -} - -void wxMediaEdit::AppendSnip(wxSnip *snip) -{ - if (PTREQ(snips, lastSnip) && !snips->count) { - /* Get rid of empty snip */ - DELETE_OBJ snips; - snips = lastSnip = snip; - } else { - SpliceSnip(snip, lastSnip, NULL); - snipCount++; - } -} - -void wxMediaEdit::DeleteSnip(wxSnip *snip) -{ - if (snip->next) - SpliceSnip(snip->next, snip->prev, snip->next->next); - else if (snip->prev) - SpliceSnip(snip->prev, snip->prev->prev, snip->next); - else { - lastSnip = snips = NULL; - } - --snipCount; - snip->flags += wxSNIP_CAN_DISOWN; - SnipSetAdmin(snip, NULL); - snip->line = NULL; - snip->prev = snip->next = NULL; - snip->flags -= wxSNIP_CAN_DISOWN; -} - -wxSnip *wxMediaEdit::SnipSetAdmin(wxSnip *snip, wxSnipAdmin *a) -{ - wxSnipAdmin *orig_admin; - long orig_count = snip->count; - wxMediaLine *line = snip->line; - Bool wl = writeLocked, fl = flowLocked; - - orig_admin = snip->GetAdmin(); - - readLocked = writeLocked = flowLocked = TRUE; - snip->SetAdmin(a); - readLocked = FALSE; writeLocked = wl; flowLocked = fl; - - if (snip->GetAdmin() != a) { - /* Something went wrong. */ - if (!a && (snip->GetAdmin() == orig_admin)) { - /* Force admin to NULL. */ - snip->wxSnip::SetAdmin(NULL); - } else if (a) { - /* Snip didn't accept membership into this buffer. Give up on it. */ - wxSnip *naya; - naya = new WXGC_PTRS wxSnip(); - - naya->count = orig_count; - SpliceSnip(naya, snip->prev, snip->next); - naya->line = line; - - if (line) { - if (line->snip == snip) - line->snip = naya; - if (line->lastSnip == snip) - line->lastSnip = naya; - } - - snip->wxSnip::SetAdmin(NULL); - - naya->SetAdmin(a); - snip = naya; - } - } - - /* Force count to be consistent: */ - if (a && (snip->count != orig_count)) - snip->count = orig_count; - - return snip; -} - -void wxMediaEdit::SnipSplit(wxSnip *snip, long pos, wxSnip **a_ptr, wxSnip **b_ptr) -{ - int c = snip->count, nl = (snip->flags & wxSNIP_NEWLINE), hnl = (snip->flags & wxSNIP_HARD_NEWLINE); - wxSnip *a, *b; - Bool wl, fl; - wxSnip *orig; - - snip->flags |= wxSNIP_CAN_SPLIT; - orig = snip; - - DeleteSnip(snip); - orig->flags -= wxSNIP_OWNED; - - revision_count++; - - wl = writeLocked, fl = flowLocked; - readLocked = writeLocked = flowLocked = TRUE; - *a_ptr = NULL; - *b_ptr = NULL; - snip->Split(pos, a_ptr, b_ptr); - readLocked = FALSE; writeLocked = wl; flowLocked = fl; - - a = *a_ptr; - b = *b_ptr; - - if (!a) - a = new WXGC_PTRS wxSnip(); - if (!b) - b = new WXGC_PTRS wxSnip(); - - if (a->IsOwned()) { - /* uh-oh: make up a dummy */ - a = new WXGC_PTRS wxSnip(); - } - if (b->IsOwned()) { - /* uh-oh: make up a dummy */ - b = new WXGC_PTRS wxSnip(); - } - - *a_ptr = a; - *b_ptr = b; - - if (a->flags & wxSNIP_CAN_SPLIT) - a->flags -= wxSNIP_CAN_SPLIT; - if (b->flags & wxSNIP_CAN_SPLIT) - b->flags -= wxSNIP_CAN_SPLIT; - if (orig->flags & wxSNIP_CAN_SPLIT) - orig->flags -= wxSNIP_CAN_SPLIT; - - /* Make *sure* that count is right */ - a->count = pos; - b->count = c - pos; - - /* Make sure that NEWLINE & HARD_NEWLINE is consistent: */ - if (nl) - b->flags |= wxSNIP_NEWLINE; - if (hnl) - b->flags |= wxSNIP_HARD_NEWLINE; - if (a->flags & wxSNIP_NEWLINE) - a->flags -= wxSNIP_NEWLINE; - if (a->flags & wxSNIP_HARD_NEWLINE) - a->flags -= wxSNIP_HARD_NEWLINE; -} - -/****************************************************************/ - -wxSnip *wxMediaEdit::FindFirstSnip(void) -{ - if (!len) - return NULL; - else - return snips; -} - -wxSnip *wxMediaEdit::FindSnip(long p, int direction, long *sPos) -{ - wxSnip *snip; - wxMediaLine *line; - long pos; - - if ((direction < -1) && !p) - return NULL; - - line = lineRoot->FindPosition(p); - pos = line->GetPosition(); - p -= pos; - if (sPos) - *sPos = pos; - - snip = line->snip; - if (!p && snip->prev) { - /* Back up one: */ - snip = snip->prev; - p += snip->count; - if (sPos) - *sPos -= snip->count; - } - - for (; snip; snip = snip->next) { - p -= snip->count; - if ((!direction && !p) - || ((direction < 0) && (p <= 0)) - || ((direction > 0) && (p < 0))) - return snip; - - if (!direction && (p < 0)) - return NULL; - - if (sPos) - *sPos += snip->count; - } - - if (direction < 2) - return lastSnip; - else - return NULL; -} - -wxSnip *wxMediaEdit::FindNextNonTextSnip(wxSnip *snip) -{ - if (snip) { - if (snip->GetAdmin() != snipAdmin) - return NULL; - snip = snip->next; - } else if (!len) - return NULL; - else - snip = snips; - - while (snip && ((snip->__type == wxTYPE_TEXT_SNIP) - || (snip->__type == wxTYPE_TAB_SNIP))) { - snip = snip->next; - } - - return snip; -} - -void wxMediaEdit::MakeSnipset(long start, long end) -{ - long sPos; - wxSnip *prev, *next, *snip, *insSnip; - wxStyle *style; - wxMediaLine *line; - Bool atStart, atEnd; - - if (start) { - snip = FindSnip(start, +1, &sPos); - if (start != sPos) { - line = snip->line; - prev = snip->prev; next = snip->next; - style = snip->style; - - atStart = PTREQ(line->snip, snip); - atEnd = PTREQ(line->lastSnip, snip); - - SnipSplit(snip, start - sPos, &insSnip, &snip); - - snip->style = insSnip->style = style; - - snip->line = insSnip->line = line; - if (atStart) - line->snip = insSnip; - if (atEnd) - line->lastSnip = snip; - - SpliceSnip(snip, prev, next); - snipCount++; - InsertSnip(snip, insSnip); - - SnipSetAdmin(snip, snipAdmin); - SnipSetAdmin(insSnip, snipAdmin); - - OnSplitSnip(start - sPos); - } - } - - if (end) { - snip = FindSnip(end, -1, &sPos); - if (end != sPos + snip->count) { - line = snip->line; - prev = snip->prev; next = snip->next; - style = snip->style; - - atStart = PTREQ(line->snip, snip); - atEnd = PTREQ(line->lastSnip, snip); - - SnipSplit(snip, end - sPos, &insSnip, &snip); - - snip->style = insSnip->style = style; - - snip->line = insSnip->line = line; - if (atStart) - line->snip = insSnip; - if (atEnd) - line->lastSnip = snip; - - SpliceSnip(snip, prev, next); - snipCount++; - InsertSnip(snip, insSnip); - - SnipSetAdmin(snip, snipAdmin); - SnipSetAdmin(insSnip, snipAdmin); - - OnSplitSnip(end - sPos); - } - } -} - -wxTextSnip *wxMediaEdit::InsertTextSnip(long start, wxStyle *style) -{ - long sPos; - wxSnip *gsnip, *insGsnip, *prev, *next; - wxTextSnip *snip; - wxStyle *gstyle; - wxMediaLine *line; - Bool atStart, atEnd; - wxSnip *rsnip; - - snip = OnNewTextSnip(); - if (snip->IsOwned() || snip->count) { - /* Uh-oh. Resort to wxTextSnip() */ - snip = new WXGC_PTRS wxTextSnip(); - } - { - wxStyle *styl; - styl = (style ? style : GetDefaultStyle()); - snip->style = styl; - } - if (!snip->style) { - snip->style = styleList->BasicStyle(); - } - rsnip = SnipSetAdmin(snip, snipAdmin); - if (rsnip != snip) { - /* Uh-oh. Resort to wxTextSnip() */ - wxStyle *styl; - snip = new WXGC_PTRS wxTextSnip(); - styl = (style ? style : GetDefaultStyle()); - snip->style = styl; - if (!snip->style) { - snip->style = styleList->BasicStyle(); - } - snip->SetAdmin(snipAdmin); - } - snip->count = 0; - - gsnip = FindSnip(start, -2, &sPos); - if (gsnip - && (gsnip->count + sPos == start) - && (gsnip->flags & wxSNIP_NEWLINE) - && !(gsnip->flags & wxSNIP_HARD_NEWLINE)) { - /* We want the snip on the same line as the preceeding snip: */ - if (gsnip->next) - InsertSnip(gsnip->next, snip); - else - AppendSnip(snip); - gsnip->flags -= wxSNIP_NEWLINE; - snip->flags |= wxSNIP_NEWLINE; - snip->line = gsnip->line; - snip->line->lastSnip = snip; - } else { - gsnip = FindSnip(start, +2, &sPos); - if (!gsnip) { - AppendSnip(snip); - snip->line = lastLine; - if (PTREQ(lastLine->snip, lastSnip)) - lastLine->snip = lastLine->lastSnip = snip; - else - lastLine->lastSnip = snip; - } else if (start == sPos) { - InsertSnip(gsnip, snip); - snip->line = gsnip->line; - if (PTREQ(snip->line->snip, gsnip)) - snip->line->snip = snip; - } else { - prev = gsnip->prev; next = gsnip->next; - gstyle = gsnip->style; - line = gsnip->line; - - atStart = PTREQ(line->snip, gsnip); - atEnd = PTREQ(line->lastSnip, gsnip); - - SnipSplit(gsnip, start - sPos, &insGsnip, &gsnip); - - gsnip->style = insGsnip->style = gstyle; - - gsnip->line = insGsnip->line = snip->line = line; - if (atStart) - line->snip = insGsnip; - if (atEnd) - line->lastSnip = gsnip; - - SpliceSnip(gsnip, prev, next); - snipCount++; - InsertSnip(gsnip, snip); - InsertSnip(snip, insGsnip); - - SnipSetAdmin(gsnip, snipAdmin); - SnipSetAdmin(insGsnip,snipAdmin); - - OnSplitSnip(start - sPos); - } - } - - return snip; -} - -void wxMediaEdit::CheckMergeSnips(long start) -{ - wxSnip *snip1, *snip2, *prev, *next; - long sPos1, sPos2, c; - int did_something = 0; - wxMediaLine *line; - Bool atStart, atEnd; - - restart: - - snip1 = FindSnip(start, -1, &sPos1); - snip2 = FindSnip(start, +1, &sPos2); - - if (PTRNE(snip1, snip2)) { - if (snip1->snipclass -#if USE_OLD_TYPE_SYSTEM - && (snip1->__type == snip2->__type) -#endif - && PTREQ(snip1->snipclass, snip2->snipclass) - && PTREQ(snip1->style, snip2->style)) { - if (!(snip1->flags & wxSNIP_NEWLINE) - && (snip1->flags & wxSNIP_CAN_APPEND) - && (snip2->flags & wxSNIP_CAN_APPEND) - && (snip1->count + snip2->count < MAX_COUNT_FOR_SNIP) - && PTREQ(snip1->line, snip2->line)) { - did_something = 1; - if (!snip1->count) { - if (PTREQ(snip1->line->snip, snip1)) - snip1->line->snip = snip2; - DeleteSnip(snip1); - snip1->flags -= wxSNIP_OWNED; - goto restart; - } else if (!snip2->count) { - if (PTREQ(snip1->line->lastSnip, snip2)) { - snip1->line->lastSnip = snip1; - snip1->line->MarkRecalculate(); // need lastW updated - graphicMaybeInvalid = TRUE; - } - DeleteSnip(snip2); - snip2->flags -= wxSNIP_OWNED; - goto restart; - } else { - wxSnip *naya; - Bool wl, fl; - - c = snip1->count + snip2->count; - prev = snip1->prev; - next = snip2->next; - line = snip1->line; - atStart = PTREQ(line->snip, snip1); - atEnd = PTREQ(line->lastSnip, snip2); - snip2->flags |= wxSNIP_CAN_SPLIT; - - wl = writeLocked, fl = flowLocked; - readLocked = writeLocked = flowLocked = TRUE; - naya = snip2->MergeWith(snip1); - readLocked = FALSE; writeLocked = wl; flowLocked = fl; - - if (naya) { - if (snip1->flags & wxSNIP_CAN_SPLIT) - snip1->flags -= wxSNIP_CAN_SPLIT; - if (snip2->flags & wxSNIP_CAN_SPLIT) - snip2->flags -= wxSNIP_CAN_SPLIT; - - /* Claim snip1 & snip2 unowned for naya test: */ - snip1->flags -= wxSNIP_OWNED; - snip2->flags -= wxSNIP_OWNED; - if (naya->IsOwned()) { - /* Uh-oh. Make dummy */ - naya = new WXGC_PTRS wxSnip(); - } - if (naya->flags & wxSNIP_CAN_SPLIT) - naya->flags -= wxSNIP_CAN_SPLIT; - snip1->flags += wxSNIP_OWNED; - snip2->flags += wxSNIP_OWNED; - - DeleteSnip(snip1); - snip1->flags -= wxSNIP_OWNED; - DeleteSnip(snip2); - snip2->flags -= wxSNIP_OWNED; - - SpliceSnip(naya, prev, next); - snipCount++; - /* Make *sure* that count is right */ - naya->count = c; - - revision_count++; - - naya = SnipSetAdmin(naya, snipAdmin); - - naya->line = line; - if (atStart) - line->snip = naya; - if (atEnd) { - line->lastSnip = naya; - line->MarkRecalculate(); // need lastW updated - graphicMaybeInvalid = TRUE; - } - } else if (snip2->flags & wxSNIP_CAN_SPLIT) - snip2->flags -= wxSNIP_CAN_SPLIT; - } - } - } - } - - if (did_something) - OnMergeSnips(start); -} - -wxTextSnip *wxMediaEdit::OnNewTextSnip() -{ - return new WXGC_PTRS wxTextSnip(); -} - -wxTabSnip *wxMediaEdit::OnNewTabSnip() -{ - return new WXGC_PTRS wxTabSnip(); -} - -/****************************************************************/ - -Bool wxMediaEdit::GetSnipPositionAndLocation(wxSnip *thesnip, long *pos, - double *x, double *y) -{ - wxSnip *snip; - long p; - - if (!CheckRecalc(x || y, FALSE)) - return FALSE; - - if (!thesnip->line || PTRNE(thesnip->line->GetRoot(), lineRoot)) - return FALSE; - - if (pos || x || y) { - p = thesnip->line->GetPosition(); - - for (snip = thesnip->line->snip; PTRNE(snip, thesnip); snip = snip->next) { - p += snip->count; - } - - if (pos) - *pos = p; - - if (x || y) - PositionLocation(p, x, y); - } - - return TRUE; -} - -Bool wxMediaEdit::GetSnipLocation(wxSnip *thesnip, double *x, double *y, Bool bottomRight) -{ - double lx, ly; - - if (bottomRight) { - if (!x) - x = &lx; - if (!y) - y = &ly; - } - - if (GetSnipPositionAndLocation(thesnip, NULL, x, y)) { - if (bottomRight) { - wxDC *dc; - double w, h; - - Bool wl = writeLocked, fl = flowLocked; - writeLocked = TRUE; - flowLocked = TRUE; - - dc = admin->GetDC(); - - w = h = 0.0; - thesnip->GetExtent(dc, *x, *y, &w, &h); - - writeLocked = wl; - flowLocked = fl; - - *x += w; - *y += h; - } - - return TRUE; - } else - return FALSE; -} - -long wxMediaEdit::GetSnipPosition(wxSnip *thesnip) -{ - long pos; - - if (GetSnipPositionAndLocation(thesnip, &pos)) - return pos; - else - return -1; -} - -/****************************************************************/ - -void wxMediaEdit::AdjustClickbacks(long start, long end, - long d, wxDeleteRecord *rec) -{ - wxNode *node, *next; - wxClickback *click; - Bool deleteit; - - if (!clickbacks) - return; - - for (node = clickbacks->First(); node; node = next) { - next = node->Next(); - click = (wxClickback *)node->Data(); - deleteit = FALSE; - if (click->start >= start && click->end <= end) { - deleteit = TRUE; - } else if (click->start >= end) { - click->start += d; - click->end += d; - } else if (click->start <= start && click->end >= end) { - if ((d < 0) || (click->end > end)) - click->end += d; - } else if (click->start > start && click->end > end) { - click->start = start; - click->end += d; - } - - if (click->end == click->start) - deleteit = TRUE; - if (deleteit) { - clickbacks->DeleteNode(node); - if (rec) - rec->AddClickback(click); - else - DELETE_OBJ click; - } - } -} - -wxClickback *wxMediaEdit::FindClickback(long start, double y) -{ - wxNode *node; - wxClickback *click; - - if (!clickbacks) - return NULL; - - for (node = clickbacks->Last(); node; node = node->Previous()) { - click = (wxClickback *)node->Data(); - if (click->start <= start && click->end > start) { - /* We're in the right horizontal region, but maybe the mouse - is above or below the clickback. */ - wxSnip *start, *end; - double top, bottom, dummy; - - start = FindSnip(click->start, 1); - end = FindSnip(click->end, -1); - - if (start && end) { - GetSnipLocation(start, &dummy, &top, FALSE); - GetSnipLocation(start, &dummy, &bottom, TRUE); - while (start != end) { - double ntop, nbottom; - start = start->Next(); - GetSnipLocation(start, &dummy, &ntop, FALSE); - GetSnipLocation(start, &dummy, &nbottom, TRUE); - if (ntop < top) - top = ntop; - if (nbottom > bottom) - bottom = nbottom; - } - - if ((y >= top) && (y <= bottom)) - return click; - } - } - } - - return NULL; -} - -void wxMediaEdit::SetClickbackHilited(wxClickback *click, Bool on) -{ - if (on != click->hilited) { - if (on) { - interceptmode = TRUE; - intercepted = new WXGC_PTRS wxList(); - - BeginEditSequence(); - FlashOn(click->start, click->end, FALSE, FALSE, -1); - _ChangeStyle(click->start, click->end, NULL, click->delta, 0); - EndEditSequence(); - - click->unhilite = intercepted; - interceptmode = FALSE; - } else { - wxNode *node; - - PerformUndoList(click->unhilite); - - for (node = click->unhilite->First(); node; node = node->Next()) { - wxChangeRecord *cr; - cr = (wxChangeRecord *)node->Data(); - /* DELETE_OBJ cr; */ - } - - /* DELETE_OBJ click->unhilite; */ - FlashOff(); - } - click->hilited = on; - } -} - -/****************************************************************/ - -Bool wxMediaEdit::CheckRecalc(Bool need_graphic, Bool need_write, Bool no_display_ok) -{ - if (readLocked) - return FALSE; - if (writeLocked && need_write) - return FALSE; - - if (need_graphic) { - if (!admin) { - if (no_display_ok) - return TRUE; - return FALSE; - } - - if (graphicMaybeInvalid) { - wxDC *dc; - - if (flowLocked) - return FALSE; - - dc = admin->GetDC(); - if (!dc) { - if (no_display_ok) - return TRUE; - return FALSE; - } - - RecalcLines(dc, need_graphic); - } - } - - return TRUE; -} - -Bool wxMediaEdit::CheckFlow(double maxw, wxDC *dc, double Y, - long startp, wxSnip *start) - /* This method is called with writeLocked and flowLocked already TRUE */ -{ - long p, c, origc, b; - double _totalWidth, w; - wxSnip *snip; - Bool checkingUnderflow; // no overflow => check move up from next line - Bool checkingUnderflowAtNext; - Bool noChangeIfEndOfSnip, noChangeIfStartOfSnip; - Bool theFirstSnip, firstUnderflow, hadNewline; - Bool deletedANewline; - - _totalWidth = 0; - p = startp; - checkingUnderflow = FALSE; // start by ensuring no overflow - checkingUnderflowAtNext = FALSE; - noChangeIfEndOfSnip = TRUE; // Because an immediate overflow can't be helped - noChangeIfStartOfSnip = FALSE; - theFirstSnip = TRUE; - firstUnderflow = FALSE; - deletedANewline = FALSE; - - for (snip = start; - snip && !(snip->flags & wxSNIP_HARD_NEWLINE); - snip = snip->next) { - - if (!checkingUnderflow) { - checkingUnderflow = checkingUnderflowAtNext; - if (checkingUnderflow) - firstUnderflow = TRUE; - } - noChangeIfStartOfSnip = noChangeIfEndOfSnip; - - if (snip->flags & wxSNIP_NEWLINE) { - noChangeIfEndOfSnip = !checkingUnderflow; - snip->flags -= wxSNIP_NEWLINE; - checkingUnderflowAtNext = TRUE; - hadNewline = TRUE; - deletedANewline = TRUE; - /* Note: if the newline is restored, then the - return jumps directly out of the `for' loop. */ - } else { - noChangeIfEndOfSnip = FALSE; - checkingUnderflowAtNext = FALSE; - hadNewline = FALSE; - } - - { - Scheme_Thread *thread; - thread = scheme_get_current_thread(); - if (thread) SCHEME_USE_FUEL(1); - thread = NULL; - } - - w = 0.0; - snip->GetExtent(dc, _totalWidth, Y, &w); - _totalWidth += w; - if (_totalWidth > maxw) { - _totalWidth -= w; - /* Get best breaking position: (0.1 is hopefully a positive value smaller than any character) */ - origc = _FindPositionInSnip(dc, _totalWidth, Y, snip, maxw - _totalWidth - 0.1); - - /* get legal breaking position before optimal: */ - b = p + origc + 1; - FindWordbreak(&b, NULL, wxBREAK_FOR_LINE); - c = b - p; - if (c > origc) - c = origc; - - if (c <= 0) { - if ((b <= startp) && checkingUnderflow && origc) { - /* The word was currently force-broken; shift some part to here */ - p = p + origc; - } else if ((checkingUnderflow && firstUnderflow - && (b <= startp || c>= 0)) - || (!theFirstSnip - && (!c || (!origc && (c < 0) && (b <= startp))))) { - /* Can't fit this snip in the line */ - if (snip->prev) - snip->prev->flags |= wxSNIP_NEWLINE; - if (hadNewline && snip->next) - snip->flags |= wxSNIP_NEWLINE; - if (noChangeIfStartOfSnip && (!hadNewline || snip->next)) - return FALSE; - refreshAll = TRUE; - return TRUE; - } else if ((c < 0) && (b > startp)) { - /* Overflow, but previous wordbreak was before this snip */ - p = b; - } else { - /* Overflow: we have to break the word anyway */ - if (!origc) { - if ((snip->count == 1) - && snip->next - && (snip->next->flags & wxSNIP_HARD_NEWLINE)) { - /* don't insert a break before a real newline */ - break; - } else - p++; - } else - p += origc; - } - } else { - p = p + c; - } - MakeSnipset(p, p); - snip = FindSnip(p, -1); - if (snip->next) - snip->flags |= wxSNIP_NEWLINE; - refreshAll = TRUE; - return TRUE; - } - - p += snip->count; - - theFirstSnip = FALSE; - firstUnderflow = FALSE; - } - - if (!snip - && (lastSnip->flags & wxSNIP_NEWLINE) - && !(lastSnip->flags & wxSNIP_HARD_NEWLINE)) { - lastSnip->flags -= wxSNIP_NEWLINE; - refreshAll = TRUE; - return TRUE; - } - - if (!checkingUnderflow || noChangeIfEndOfSnip) - return deletedANewline; - else { - refreshAll = TRUE; - return TRUE; - } -} - -#if CHECK_CONSISTENCY -static int CheckRBConsistent(wxMediaLine *line) -{ - Bool red; - int l, r; - - if (line == NIL) - return 0; - - red = (line->flags & 1); - - if (red) { - if (line->left->flags & 1) - fprintf(stderr, "Red left inconsistency\n"); - if (line->right->flags & 1) - fprintf(stderr, "Red right inconsistency\n"); - } - - l = CheckRBConsistent(line->left); - r = CheckRBConsistent(line->right); - - if (l != r) - fprintf(stderr, "Black count inconsistency\n"); - - return l + (red ? 0 : 1); -} -#endif - -void wxMediaEdit::RecalcLines(wxDC *dc, Bool calcGraphics) -{ - wxMediaLine *line; - wxSnip *snip; - double X, Y, descent, space, lineBase, old_max_width; - Bool _changed, resized; - - if (!calcGraphics) - return; - - _changed = FALSE; - -#if CHECK_CONSISTENCY - long p, p2; - - snip = snips; - - if (firstLine != lineRoot->First()) - fprintf(stderr, "First line inconsistency\n"); - if (lastLine != lineRoot->Last()) - fprintf(stderr, "Last line inconsistency\n"); - - if (firstLine->prev) - fprintf(stderr, "First line prev inconsistency\n"); - if (lastLine->next) - fprintf(stderr, "First line next inconsistency\n"); - - if (firstLine->snip != snips) - fprintf(stderr, "First line first snip inconsistency\n"); - if (lastLine->lastSnip != lastSnip) - fprintf(stderr, "Last line last snip inconsistency\n"); - - CheckRBConsistent(lineRoot); - - Y = 0; - p = 0; - for (line = firstLine; line; line = line->next) { - if (line->snip != snip) - fprintf(stderr, "Line start inconsistency\n"); - - if (line->GetPosition() != p) - fprintf(stderr, "Line position inconsistency\n"); - if (line->GetLocation() != Y) - fprintf(stderr, "Line location inconsistency\n"); - - if (line->prev && (line->snip != line->prev->lastSnip->next)) - fprintf(stderr, "Line snip continuity inconsistency\n"); - - p2 = p; - for (snip = line->snip; snip && snip != line->lastSnip; snip = snip->next){ - if (snip->line != line) - fprintf(stderr, "Snip's line inconsistency\n"); - if (!snip->style) - fprintf(stderr, "Snip's style missing\n"); - if (snip->admin != snipAdmin) - fprintf(stderr, "Snip's admin inconsistency\n"); - if (!(snip->flags & wxSNIP_OWNED)) - fprintf(stderr, "Snip's is-owned inconsistency\n"); - p2 += snip->count; - } - if (snip->line != line) - fprintf(stderr, "Snip's line inconsistency\n"); - - if (!snip) - fprintf(stderr, "Line end inconsistency\n"); - - p2 += snip->count; - if ((p2 - p) != line->len) - fprintf(stderr, "Line count inconsistency\n"); - - snip = line->lastSnip->next; - - if (!line->next && line != lastLine) - fprintf(stderr, "Last line link inconsistency\n"); - - wxMediaLine *other; - if (line->left != NIL) { - for (other = line->prev; other && other != line->left; other=other->prev) { - } - if (!other) - fprintf(stderr, "Left link inconsistency\n"); - } - if (line->right != NIL) { - for (other=line->next; other && other!=line->right; other=other->next) { - } - if (!other) - fprintf(stderr, "Right link inconsistency\n"); - } - if (line->parent == NIL) { - if (line != lineRoot) - fprintf(stderr, "Root inconsistency\n"); - } else if (line != line->parent->right && line != line->parent->left) - fprintf(stderr, "Parent inconsistency\n"); - - Y += line->h; - p += line->len; - } - if (p != len) - fprintf(stderr, "Total count inconsistency\n"); - -#endif - - if (snipCacheInvalid) - for (snip = snips; snip; snip = snip->next) { - snip->SizeCacheInvalid(); - } - - old_max_width = maxWidth; - - if (flowInvalid && (maxWidth <= 0)) - maxWidth = A_VERY_BIG_NUMBER; - - if (graphicsInvalid || flowInvalid || snipCacheInvalid) { - /* Set all lines invalid. */ - for (line = firstLine; line; line = line->next) { - line->MarkRecalculate(); - if (flowInvalid) - line->MarkCheckFlow(); - } - } - -#if LOOK_FOR_ZEROED - if (len) - for (snip = snips, i = 0; snip; snip = snip->next) { - if (!snip->count) - fprintf(stderr, "zero snip found at %d\n", i); - else - i += snip->count; - } -#endif - - if (maxWidth > 0) { - double w; - Bool fl = flowLocked, wl = writeLocked; - wxMediaLine *lr; - - /* If any flow is update, snip sizing methods will be called. */ - flowLocked = TRUE; - writeLocked = TRUE; - - w = maxWidth - CURSOR_WIDTH; - lr = lineRoot; - while (lineRoot->UpdateFlow(&lr, this, w, dc)) { - lineRoot = lr; - _changed = TRUE; - } - lineRoot = lr; - - flowLocked = fl; - writeLocked = wl; - } - - if (old_max_width != maxWidth) - maxWidth = old_max_width; - - if (_changed) { - refreshAll = TRUE; - firstLine = lineRoot->First(); - lastLine = lineRoot->Last(); - numValidLines = lineRoot->Number(); - } - - if (lineRoot->UpdateGraphics(this, dc)) - _changed = TRUE; - - if (!_changed && !graphicMaybeInvalidForce) { - graphicMaybeInvalid = FALSE; - return; - } - - graphicMaybeInvalid = FALSE; - graphicMaybeInvalidForce = FALSE; - - Y = lastLine->GetLocation() + lastLine->h; - - if (lastSnip->flags & wxSNIP_NEWLINE) { - extraLine = TRUE; - extraLineH = lastLine->lastH + lineSpacing; - Y += extraLineH; - } else { - extraLine = FALSE; - extraLineH = 0; - } - - X = lineRoot->maxWidth + CURSOR_WIDTH; - if (minWidth > 0 && X < minWidth) - X = minWidth; - - if (minHeight > 0 && Y < minHeight) - Y = minHeight; - if (maxHeight > 0 && Y > maxHeight) - Y = maxHeight; - - descent = lastLine->h - lastLine->bottombase; - space = firstLine->topbase; - lineBase = firstLine->bottombase; - - if (totalHeight != Y || totalWidth != X - || finalDescent != descent - || initialSpace != space - || initialLineBase != lineBase) { - totalHeight = Y; - totalWidth = X; - finalDescent = descent; - initialSpace = space; - initialLineBase = lineBase; - resized = TRUE; - } else - resized = FALSE; - - graphicsInvalid = FALSE; - flowInvalid = FALSE; - snipCacheInvalid = FALSE; - - drawCachedInBitmap = FALSE; - - if (resized && admin) - admin->Resized(FALSE); - - OnReflow(); -} - -void wxMediaEdit::OnReflow(void) -{ -} - -wxBitmap *wxMediaEdit::SetAutowrapBitmap(wxBitmap *bm) -{ - wxBitmap *old; - double oldWidth; - - if (flowLocked) - return NULL; - - old = autoWrapBitmap; - - autoWrapBitmap = bm; - oldWidth = wrapBitmapWidth; - if (autoWrapBitmap) { - int bw; - bw = autoWrapBitmap->GetWidth(); - wrapBitmapWidth = bw; - } else - wrapBitmapWidth = 0; - - if (maxWidth > 0) - SetMaxWidth(maxWidth + oldWidth); - - return old; -} - -static int show_outline_for_inactive = 0; - -static wxPen *caretPen = NULL; -static wxPen *outlinePen = NULL; -static wxPen *outlineInactivePen = NULL; -static wxBrush *outlineBrush = NULL; -#if ALLOW_X_STYLE_SELECTION -static wxBrush *outlineNonownerBrush = NULL; -static char xpattern[32] = {0x88, 0x88, - 0, 0, - 0x22, 0x22, - 0, 0, - 0x88, 0x88, - 0, 0, - 0x22, 0x22, - 0, 0, - 0x88, 0x88, - 0, 0, - 0x22, 0x22, - 0, 0, - 0x88, 0x88, - 0, 0, - 0x22, 0x22, - 0, 0}; -#endif -static wxBrush *clearBrush = NULL; - -/* This does the actual drawing */ -void wxMediaEdit::Redraw(wxDC *dc, double starty, double endy, - double leftx, double rightx, - double dy, double dx, - int show_caret, int show_xsel, - wxColour *bgColor) -{ - wxMediaLine *line; - wxSnip *snip, *first, *last; - double x, topbase, bottombase, hxs, hxe, hsxs, hsxe, hsys, hsye, down, bottom; - double tleftx, tstarty, trightx, tendy; - double h, w, descent, space, ycounter, prevwasfirst = 0.0; - long p, pcounter; - long _startpos, _endpos; - Bool posAtEol; - Bool hilite, hiliteSome; - int align; - wxStyle *oldStyle; - wxPen *savePen; - wxBrush *saveBrush; - Bool wl; - - if (!show_outline_for_inactive) { - if (!wxGetBoolPreference("outlineInactiveSelection", &show_outline_for_inactive)) - show_outline_for_inactive = 0; - show_outline_for_inactive = !show_outline_for_inactive ? -1 : 1; - } - - wl = writeLocked; - - flowLocked = TRUE; - writeLocked = TRUE; - - if (flash) { - _startpos = flashstartpos; - _endpos = flashendpos; - posAtEol = flashposateol; - } else { - _startpos = startpos; - _endpos = endpos; - posAtEol = posateol; - } - - if (!outlinePen) { - wxREGGLOB(outlinePen); - wxREGGLOB(outlineInactivePen); - wxREGGLOB(outlineBrush); -#if ALLOW_X_STYLE_SELECTION - wxREGGLOB(outlineNonownerBrush); -#endif - wxREGGLOB(clearBrush); - - outlinePen = wxThePenList->FindOrCreatePen("BLACK", 0, wxTRANSPARENT); - if (!caretPen) { - wxREGGLOB(caretPen); - caretPen = wxThePenList->FindOrCreatePen("BLACK", 1, wxXOR); - } - outlineBrush = wxTheBrushList->FindOrCreateBrush("BLACK", wxCOLOR); - outlineInactivePen = wxThePenList->FindOrCreatePen("BLACK", 1, wxCOLOR); -#if ALLOW_X_STYLE_SELECTION - outlineNonownerBrush = new WXGC_PTRS wxBrush(); - outlineNonownerBrush->SetColour("BLACK"); - { - wxBitmap *bm; - bm = new WXGC_PTRS wxBitmap(xpattern, 16, 16); - outlineNonownerBrush->SetStipple(bm); - } - outlineNonownerBrush->SetStyle(wxXOR); -#endif - clearBrush = wxTheBrushList->FindOrCreateBrush("WHITE", wxSOLID); - } - - dc->SetBackgroundMode(wxSOLID); - - line = lineRoot->FindLocation(starty); - - if (bgColor) { - wxPen *lsavePen; - wxBrush *lsaveBrush, *wb; - - lsavePen = dc->GetPen(); - lsaveBrush = dc->GetBrush(); - - if (bgColor == wxWHITE) - wb = clearBrush; - else - wb = wxTheBrushList->FindOrCreateBrush(bgColor, wxSOLID); - dc->SetBrush(wb); - dc->SetPen(outlinePen); - - dc->DrawRectangle(leftx + dx, starty + dy, - rightx - leftx + GC_RECT_BRUSH_EXTEND, - endy - starty + GC_RECT_BRUSH_EXTEND); - - dc->SetBrush(lsaveBrush); - dc->SetPen(lsavePen); - } - - OnPaint(TRUE, dc, leftx, starty, rightx, endy, dx, dy, - (show_caret && !caretSnip) - ? show_caret - : (int)wxSNIP_DRAW_NO_CARET); - - if (!line) - goto paint_done; - - tleftx = leftx + dx; - tstarty = starty + dy; - trightx = rightx + dx; - tendy = endy + dy; - - oldStyle = NULL; - - ycounter = line->GetLocation(); - pcounter = line->GetPosition(); - - /* Quiet the compiler: */ - hsxs = hsxe = hsys = hsye = 0; - - for (; line; line = line->next) { - if (ycounter >= endy) - goto paint_done; - - first = line->snip; - last = line->lastSnip->next; - - x = line->GetLeftLocation(maxWidth); - - bottombase = ycounter + line->bottombase; - topbase = ycounter + line->topbase; - p = pcounter; - - hiliteSome = FALSE; - - for (snip = first; PTRNE(snip, last); snip = snip->next) { - snip->style->SwitchTo(dc, oldStyle); - oldStyle = snip->style; - - w = h = descent = space = 0.0; - snip->GetExtent(dc, x, ycounter, &w, &h, &descent, &space); - - align = snip->style->GetAlignment(); - - if (align == wxALIGN_BOTTOM) - down = bottombase - h + descent; - else if (align == wxALIGN_TOP) - down = topbase - space; - else { - down = (h - descent - space) / 2; - down = (topbase + bottombase) / 2 - down - space; - } - - if ((x <= rightx) && (x + w >= leftx)) { - snip->Draw(dc, x + dx, down + dy, - tleftx, tstarty, trightx, tendy, - dx, dy, - (PTREQ(snip, caretSnip) && show_caret) - ? show_caret - : (int)wxSNIP_DRAW_NO_CARET); - -#if PLOT_SNIP_DOT - dc->DrawLine(x + dx, down + dy, x + dx + 2, down + dy + 2); -#endif - } - - /* The rules for hiliting are surprisingly complicated: */ - - if (hiliteOn - && (show_xsel - || (!caretSnip - && ((show_caret == wxSNIP_DRAW_SHOW_CARET) - || ((show_caret >= inactiveCaretThreshold) - && (_startpos != _endpos)))))) { - if (posAtEol) - hilite = (_startpos == p + snip->count); - else - hilite = (((_startpos < p + snip->count) && (_endpos >= p) - && (_startpos == _endpos || _endpos > p)) - || (p + snip->count == len && _startpos == len)); - - if (hilite && (snip->flags & wxSNIP_NEWLINE)) - /* End of line: */ - hilite = ((_startpos != p + snip->count) - || (_startpos == _endpos && posAtEol) - || (_startpos != _endpos && _startpos < p + snip->count)); - if (hilite && PTREQ(snip, first)) - /* Beginning of line: */ - hilite = ((_endpos != p) - || (_startpos == _endpos && !posAtEol) - || (_startpos != _endpos && _endpos > p)); - } else - hilite = FALSE; - - if (hilite) { - bottom = down + h; - - if (_startpos <= p) { - if (_startpos < p) - hxs = 0; - else - hxs = x; - } else - hxs = x + snip->PartialOffset(dc, x, ycounter, _startpos - p); - - if (_endpos >= p + snip->count) { - if (snip->flags & wxSNIP_NEWLINE) { - if (_endpos == _startpos) - hxe = hxs; - else { - hxe = rightx; - bottom = ycounter + line->h; - } - } else - hxe = x + w; - } else - hxe = x + snip->PartialOffset(dc, x, ycounter, _endpos - p); - - if (!hiliteSome) { - hsxs = hxs; - hsxe = hxe; - hsys = down; - hsye = bottom; - hiliteSome = TRUE; - } else { - hsxe = hxe; - if (down < hsys) - hsys = down; - if (bottom > hsye) - hsye = bottom; - } - } - - x += w; - - p += snip->count; - } - - if (wrapBitmapWidth - && !(line->lastSnip->flags & wxSNIP_HARD_NEWLINE) - && last - && (rightx >= maxWidth) && autoWrapBitmap->Ok()) { - int h; - - if (autoWrapBitmap->Ok()) { - wxColour *osfg; - - h = (int)autoWrapBitmap->GetHeight(); - if (h > line->bottombase) - h = (int)line->bottombase; - - osfg = oldStyle->GetForeground(); - dc->Blit(maxWidth + dx - 1, bottombase - h + dy, - wrapBitmapWidth, h, - autoWrapBitmap, 0, 0, - wxSOLID, osfg); - } - } - - if (hiliteSome) { - if (hsxe != hsxs) { - if ((hsxs <= rightx) && (hsxe >= leftx)) { - savePen = dc->GetPen(); - - if (hsxs < leftx) - hsxs = leftx; - if (hsxe > rightx) - hsxe = rightx; - - if (!show_xsel && (show_caret < wxSNIP_DRAW_SHOW_CARET)) { - if (show_outline_for_inactive > 0) { - int lastHilite, firstHilite; - - firstHilite = (_startpos >= pcounter); - lastHilite = (_endpos <= pcounter + line->len); - - dc->SetPen(outlineInactivePen); - - if (firstHilite) { - dc->DrawLine(hsxs + dx, hsys + dy, hsxe + dx - 1, hsys + dy); - prevwasfirst = hsxs; - } else if (prevwasfirst) { - dc->DrawLine(0 + dx, hsys + dy, prevwasfirst + dx, hsys + dy); - prevwasfirst = 0.0; - } - dc->DrawLine(hsxs + dx, hsys + dy, hsxs + dx, hsye + dy - 1); - dc->DrawLine(hsxe + dx - 1, hsys + dy, hsxe + dx - 1, hsye + dy - 1); - if (lastHilite) { - dc->DrawLine(hsxs + dx, hsye + dy, hsxe + dx - 1, hsye + dy); - if (!firstHilite) - dc->DrawLine(hsxe + dx, hsys + dy, rightx + dx, hsys + dy); - } - } - } else { - saveBrush = dc->GetBrush(); - dc->SetPen(outlinePen); - dc->SetBrush(outlineBrush); - - dc->DrawRectangle(hsxs + dx, hsys + dy, - hsxe - hsxs + GC_RECT_BRUSH_EXTEND, - hsye - hsys + GC_RECT_BRUSH_EXTEND); -#if ALLOW_X_STYLE_SELECTION - if (show_xsel) { - dc->SetBrush(outlineNonownerBrush); - dc->DrawRectangle(hsxs + dx, hsys + dy, - hsxe - hsxs + GC_RECT_BRUSH_EXTEND, - hsye - hsys + GC_RECT_BRUSH_EXTEND); - } -#endif - - dc->SetBrush(saveBrush); - } - dc->SetPen(savePen); - } - } else { - if (show_caret == wxSNIP_DRAW_SHOW_CARET) { - if ((hsxs <= rightx) && (hsxs >= leftx)) { - savePen = dc->GetPen(); - dc->SetPen(caretPen); - dc->DrawLine(hsxs + dx, hsys + dy, - hsxs + dx, - hsye + dy - 1 + GC_LINE_EXTEND); - dc->SetPen(savePen); - } - } - } - } - - pcounter += line->len; - ycounter += line->h; - } - - { - wxStyle *bs; - bs = styleList->BasicStyle(); - bs->SwitchTo(dc, oldStyle); - } - - if ((show_caret == wxSNIP_DRAW_SHOW_CARET) && !caretSnip) - if (!line && extraLine) - if (!posAtEol && _startpos == len && _endpos == _startpos - && hiliteOn) { - double y; - y = ycounter; - - savePen = dc->GetPen(); - dc->SetPen(caretPen); - dc->DrawLine(dx, y + dy, dx, - y + extraLineH + dy - 1 + GC_LINE_EXTEND); - dc->SetPen(savePen); - } - -paint_done: - - OnPaint(FALSE, dc, leftx, starty, rightx, endy, dx, dy, - (show_caret && !caretSnip) - ? show_caret - : (int)wxSNIP_DRAW_NO_CARET); - - writeLocked = wl; - flowLocked = FALSE; -} - -/* This one notifies the administrator that we need to be updated. */ -void wxMediaEdit::Redraw() -{ - double w, h; - double top, bottom, height, width, left, right; - double x, y, origx, origy; - double fy, fx; - Bool oneline; - wxDC *dc; - Bool needs_update = TRUE; - - if (flowLocked || !admin) - return; - - if (admin->DelayRefresh()) { - /* Does the admin know the refresh box already? */ - if ((delayedscroll != -1) && !delayedscrollbox && (refreshAll || refreshUnset)) { - /* Yes ... */ - if (!refreshAll && refreshBoxUnset) - return; /* Nothing to do */ - admin->GetMaxView(&x, &y, &w, &h); - top = y; - bottom = y + h; - left = x; - right = left + w; - if (!refreshAll) { - if (refreshL > left) - left = refreshL; - if (refreshR < right) - right = refreshR; - if (refreshT > top) - top = refreshT; - if (refreshB < bottom) - bottom = refreshB; - } - refreshUnset = refreshBoxUnset = TRUE; - refreshAll = FALSE; - height = bottom - top; - width = right - left; - if ((width > 0) && (height > 0)) - admin->NeedsUpdate(left, top, width, height); - } - } - - dc = admin->GetDC(&x, &y); - - if (!dc) { - delayedscroll = -1; - delayedscrollbox = FALSE; - return; - } - - origx = x; - origy = y; - - RecalcLines(dc); - - if (delayedscroll != -1) { - if (ScrollToPosition(delayedscroll, delayedscrollateol, FALSE, - delayedscrollend, delayedscrollbias)) - refreshAll = TRUE; - } else if (delayedscrollbox) { - delayedscrollbox = FALSE; - if (ScrollTo(delayedscrollsnip, delayedscrollX, delayedscrollY, - delayedscrollW, delayedscrollH, FALSE, delayedscrollbias)) - refreshAll = TRUE; - } - - admin->GetDC(&x, &y); - - if (x != origx || y != origy) - refreshAll = TRUE; - - admin->GetMaxView(&x, &y, &w, &h); - - top = y; - bottom = y + h; - left = x; - right = left + w; - - /* Figure out the minimal refresh area. The refresh area may be - determined by character position ranges, box coordinates, or - both. If neither is specified, we have to assume that everything - needs to be refreshed. */ - - if (!refreshAll && (!refreshUnset || !refreshBoxUnset)) { - if (!refreshUnset) { - top = y; - if (refreshStart > -1 && refreshEnd > -1) { - // oneline = PositionLine(refreshStart) == PositionLine(refreshEnd); - oneline = FALSE; // b/c it doesn't seem to help - } else - oneline = FALSE; - if (refreshStart > -1) { - PositionLocation(refreshStart, - oneline ? (double *)&fx : (double *)NULL, (double *)&fy, - TRUE, TRUE, TRUE); - if (fy > top) - top = (long)fy; - if (oneline && fx > left) - left = fx; - } - bottom = y + h; - if (refreshEnd > -1) { - PositionLocation(refreshEnd, - oneline ? (double *)&fx : (double *)NULL, (double *)&fy, - FALSE, FALSE, TRUE); - if (fy < bottom) - bottom = (long)fy; - if (oneline && fx + CURSOR_WIDTH < right) - right = fx + CURSOR_WIDTH; - } - - if (!refreshBoxUnset) { - if (refreshT < top) - top = refreshT; - if (refreshB > bottom) - bottom = refreshB; - } - } else { - if (refreshL > left) - left = refreshL; - if (refreshR < right) - right = refreshR; - if (refreshT > top) - top = refreshT; - if (refreshB < bottom) - bottom = refreshB; - } - } else if (!refreshAll) { - /* Nothing needs to be updated! */ - needs_update = FALSE; - } - - refreshUnset = refreshBoxUnset = TRUE; - refreshAll = FALSE; - - height = bottom - top; - width = right - left; - - if (changed) { - Bool wl, fl; - - changed = FALSE; - wl = writeLocked; - fl = flowLocked; - writeLocked = flowLocked = TRUE; - OnChange(); - writeLocked = wl; - flowLocked = fl; - } - - if (needs_update && (width > 0) && (height > 0)) - admin->NeedsUpdate(left, top, width, height); -} - -/* This one is called by the administrator: */ -void wxMediaEdit::Refresh(double left, double top, double width, double height, - int show_caret, wxColour *bgColor) -{ - double x, y, bottom, right; - Bool ps; - wxDC *dc; - int show_xsel = 0; - - if ((width <= 0) || (height <= 0)) - return; - - /* BEWARE - this same test is in BlinkCaret() and AdjustCursor(): */ - if (graphicMaybeInvalid || flowLocked || delayRefresh) { - /* This Refresh command was not requested by us and we're busy. - (Probably in the middle of a begin-/end-edit-sequnce.) - Add the given region to our own invalid-region tracking and - we'll get back to it when we're done with whatever. */ - RefreshBox(left, top, width, height); - return; - } - - if (!admin) - return; - dc = admin->GetDC(&x, &y); - if (!dc) - return; - - BeginSequenceLock(); - - if (caretBlinked && show_caret && !caretSnip) { - /* Maintain caretBlinked invariant */ - show_caret = 0; - } - - if (ReadyOffscreen(width, height)) - drawCachedInBitmap = FALSE; - - /* Make sure all location information is integral, - so we can shift the coordinate system and generally - update on pixel boundaries. */ - x = floor(x); - y = floor(y); - bottom = ceil(top + height); - right = ceil(left + width); - top = floor(top); - left = floor(left); - width = right - left; - height = bottom - top; - - ps = (wxSubType(dc->__type, wxTYPE_DC_POSTSCRIPT) - || wxSubType(dc->__type, wxTYPE_DC_PRINTER)); - -#if ALLOW_X_STYLE_SELECTION - if (((show_caret != wxSNIP_DRAW_SHOW_CARET) || caretSnip) - && (wxMediaXSelectionOwner == this) - && !flash - && (startpos != endpos)) - show_xsel = 1; -#endif - - if (bgColor && !offscreenInUse && bitmap && bitmap->Ok() && offscreen->Ok() && !ps) { - unsigned char red, green, blue; - - red = (unsigned char)bgColor->Red(); - green = (unsigned char)bgColor->Green(); - blue = (unsigned char)bgColor->Blue(); - -#ifndef EACH_BUFFER_OWN_OFFSCREEN - offscreenInUse = TRUE; -#endif - if (!drawCachedInBitmap -#ifndef EACH_BUFFER_OWN_OFFSCREEN - || (lastUsedOffscreen != this) -#endif - || (top != lastDrawT) || (bottom != lastDrawB) - || (left != lastDrawL) || (right != lastDrawR) - || (lastDrawCaret != show_caret) - || (lastDrawXSel != show_xsel) - || (red != lastDrawRed) - || (green != lastDrawGreen) - || (blue != lastDrawBlue)) { - offscreen->BeginDrawing(); - Redraw(offscreen, top, bottom, left, right, -top, -left, - show_caret, show_xsel, bgColor); - offscreen->EndDrawing(); - lastDrawL = left; - lastDrawT = top; - lastDrawR = right; - lastDrawB = bottom; - lastDrawCaret = show_caret; - lastDrawXSel = show_xsel; - lastDrawRed = red; - lastDrawGreen = green; - lastDrawBlue = blue; - drawCachedInBitmap = TRUE; - } - - { - wxBitmap *bm; - bm = offscreen->GetObject(); - dc->Blit(left - x, top - y, width, height, bm, 0, 0, wxCOPY); - } -#ifndef EACH_BUFFER_OWN_OFFSCREEN - offscreenInUse = FALSE; - lastUsedOffscreen = this; -#endif - } else { - wxPen *pen; - wxBrush *brush; - wxFont *font; - wxColour *fg, *bg, *col; - wxRegion *rgn; - int bgmode; - - pen = dc->GetPen(); - brush = dc->GetBrush(); - font = dc->GetFont(); - col = dc->GetTextForeground(); - fg = new WXGC_PTRS wxColour(col); - col = dc->GetTextBackground(); - bg = new WXGC_PTRS wxColour(col); - bgmode = dc->GetBackgroundMode(); - - rgn = dc->GetClippingRegion(); - dc->SetClippingRect(left - x, top - y, width, height); - - Redraw(dc, top, bottom, left, right, -y, -x, show_caret, show_xsel, bgColor); - - dc->SetClippingRegion(rgn); - - dc->SetBrush(brush); - dc->SetPen(pen); - dc->SetFont(font); - dc->SetTextForeground(fg); - dc->SetTextBackground(bg); - dc->SetBackgroundMode(bgmode); - } - - EndSequenceLock(); -} - -/* This one is used internally to delay refreshes: */ -void wxMediaEdit::NeedRefresh(long start, long end) -{ - if (refreshUnset) { - refreshStart = start; - refreshEnd = end; - refreshUnset = FALSE; - } else { - if (start < refreshStart) - refreshStart = start; - if (end == -1) - refreshEnd = -1; - else if (refreshEnd != -1 && end > refreshEnd) - refreshEnd = end; - } - - drawCachedInBitmap = FALSE; - - ContinueRefresh(); -} - -void wxMediaEdit::RefreshByLineDemand(void) -{ - if (!graphicMaybeInvalid) - graphicMaybeInvalid = TRUE; - - ContinueRefresh(); -} - -void wxMediaEdit::ContinueRefresh(void) -{ - if (!delayRefresh && !printing && (!admin || !admin->DelayRefresh())) - Redraw(); - else { - int rs = 1; - if (!delayRefresh && ((delayedscroll != -1) - || delayedscrollbox)) { - if (!printing && admin) { - /* Although the administrator says to delay, - we can't just drop scroll requests. */ - Redraw(); - rs = 0; - } else { - delayedscroll = -1; - delayedscrollbox = 0; - } - } - if (admin && !admin->standard) - admin->Resized(FALSE); - } -} - -void wxMediaEdit::NeedCaretRefresh(void) -{ - NeedRefresh(startpos, endpos); -} - -/* 8.5" x 11" Paper, 0.5" Margin; usually not used */ -static long page_width = 612, page_height = 792; - -#define wxGetPrinterOrientation(local) (local = wxGetThePrintSetupData(), local->GetPrinterOrientation()) - -void wxmeGetDefaultSize(double *w, double *h) -{ - wxPrintSetupData *psd; - - *w = page_width; - *h = page_height; - - if (wxGetPrinterOrientation(psd) != PS_PORTRAIT) { - double tmp; - - tmp = *h; - *h = *w; - *w = tmp; - } -} - -void wxGetMediaPrintMargin(long *hm, long *vm) -{ - wxPrintSetupData *psd; - psd = wxGetThePrintSetupData(); - psd->GetEditorMargin(hm, vm); -} - -void wxSetMediaPrintMargin(long hm, long vm) -{ - wxPrintSetupData *psd; - psd = wxGetThePrintSetupData(); - psd->SetEditorMargin(hm, vm); -} - -class SaveSizeInfo { -public: - double maxw; - wxBitmap *bm; -}; - -void *wxMediaEdit::BeginPrint(wxDC *dc, Bool fit) -{ - SaveSizeInfo *savedInfo; - - if (flowLocked) - return NULL; - - CheckRecalc(); - - SizeCacheInvalid(); - - if (fit) { - double w, h; - long hm, vm; - - savedInfo = new WXGC_PTRS SaveSizeInfo; - - savedInfo->maxw = GetMaxWidth(); - savedInfo->bm = SetAutowrapBitmap(NULL); - - wxGetMediaPrintMargin(&hm, &vm); - - dc->GetSize(&w, &h); - w -= 2 * hm; - SetMaxWidth(w); - } else - savedInfo = NULL; - - RecalcLines(dc, TRUE); - - { - Bool wl, fl; - - wl = writeLocked; - fl = flowLocked; - writeLocked = flowLocked = TRUE; - OnChange(); - writeLocked = wl; - flowLocked = fl; - } - - - return savedInfo; -} - -void wxMediaEdit::EndPrint(wxDC *, void *data) -{ - if (flowLocked) - return; - - SizeCacheInvalid(); - - if (data) { - SaveSizeInfo *savedInfo = (SaveSizeInfo *)data; - - SetMaxWidth(savedInfo->maxw); - SetAutowrapBitmap(savedInfo->bm); - - /* DELETE_OBJ savedInfo; */ - } - - { - Bool wl, fl; - - wl = writeLocked; - fl = flowLocked; - writeLocked = flowLocked = TRUE; - OnChange(); - writeLocked = wl; - flowLocked = fl; - } -} - -Bool wxMediaEdit::HasPrintPage(wxDC *dc, int page) -{ - double H, W, h; - long vm, hm; - int i, this_page = 1; - wxMediaLine *line; - - if (flowLocked) - return FALSE; - - RecalcLines(dc, TRUE); - - dc->GetSize(&W, &H); - - if (!W || !H) - wxmeGetDefaultSize(&W, &H); - - wxGetMediaPrintMargin(&hm, &vm); - - H -= (2 * vm); - W -= (2 * hm); - - line = firstLine; - for (i = 0; i < numValidLines; this_page++) { - h = 0; - while (!h || ((i < numValidLines) && (line->h < H - h))) { - h += line->h; - i++; - line = line->next; - } - - if (this_page >= page) - return TRUE; - } - - return FALSE; -} - -void wxMediaEdit::PrintToDC(wxDC *dc, int page) -{ - double H, W, FH, FW, y, h, next_h; - long vm, hm; - int i, this_page = 1; - wxMediaLine *line; - wxPrintSetupData *psd; - - if (flowLocked) - return; - - RecalcLines(dc, TRUE); - - dc->GetSize(&W, &H); - - if (!W || !H) { - W = page_width; - H = page_height; - - if (wxGetPrinterOrientation(psd) != PS_PORTRAIT) { - double tmp; - - tmp = H; - H = W; - W = tmp; - } - } - - FH = H; - FW = W; - - wxGetMediaPrintMargin(&hm, &vm); - - H -= (2 * vm); - W -= (2 * hm); - - y = 0; - next_h = 0; - line = firstLine; - for (i = 0; (i < numValidLines) || next_h; this_page++) { - /* line is the line that we haven't finished printing. - H is the total page height. - y is the starting location to print for this page. - h is the height that we're hoping to fit into the page. */ - - h = next_h; /* for part of a line leftover last time */ - next_h = 0; - - while (!h || ((i < numValidLines) && (line->h < H - h))) { - h += line->h; - i++; - line = line->next; - } - - if ((h < H) && (i < numValidLines) && (line->h > H)) { - /* We'll have to break it up anyway. Start now? */ - int pos; - double py; - pos = FindScrollLine(y + H); - py = ScrollLineLocation(pos); - if (py > y + h) { - /* Yes, at least one line will fit */ - h += line->h; - i++; - line = line->next; - } - } - - if (h > H) { - /* Only happens if we have something that's too big to fit on a page. */ - /* Look for internal scroll positions */ - int pos; - double py; - pos = FindScrollLine(y + H); - py = ScrollLineLocation(pos); - if (py > y) { - double new_h = py - y; - next_h = h - new_h; - h = new_h; - } - } - - if (page < 0 || (page == this_page)) { - if (page < 0) - dc->StartPage(); - - Redraw(dc, y + (i ? 1 : 0), y + h - 1, 0, W, -y + vm, hm, - wxSNIP_DRAW_NO_CARET, 0, NULL); - - if (page < 0) - dc->EndPage(); - - if (page >= 0) - break; - } - - y += h; - } -} - -#if ALLOW_X_STYLE_SELECTION - -Bool wxMediaEdit::OwnXSelection(Bool on, Bool update, Bool force) -{ - if (DoOwnXSelection(on, force)) { - if (update) - NeedCaretRefresh(); - return TRUE; - } else - return FALSE; -} - -#endif - -/****************************************************************/ -/****************************************************************/ - -void wxMediaEdit::SetParagraghMargins(long i, double firstLeft, double left, double right) -{ - wxMediaLine *l; - wxMediaParagraph *p; - - if (i < 0) - i = 0; - - l = lineRoot->FindParagraph(i); - if (l) { - - p = l->paragraph->Clone(); - l->paragraph = p; - - p->leftMarginFirst = firstLeft; - p->leftMargin = left; - p->rightMargin = right; - - if (maxWidth > 0) { - l->MarkCheckFlow(); - l = l->next; - while (l && !(l->flags & WXLINE_STARTS_PARA)) { - l->MarkCheckFlow(); - l = l->next; - } - } else { - int start, end; - start = ParagraphStartPosition(i); - end = ParagraphEndPosition(i); - NeedRefresh(start, end); - } - - RefreshByLineDemand(); - } -} - -void wxMediaEdit::SetParagraghAlignment(long i, int align) -{ - wxMediaLine *l; - wxMediaParagraph *p; - - switch(align) { - case 1: - align = WXPARA_RIGHT; - break; - case 0: - align = WXPARA_CENTER; - break; - case -1: - default: - align = WXPARA_LEFT; - break; - } - - if (i < 0) - i = 0; - - l = lineRoot->FindParagraph(i); - if (l) { - int start, end; - - p = l->paragraph->Clone(); - l->paragraph = p; - - p->alignment = align; - - start = ParagraphStartPosition(i); - end = ParagraphEndPosition(i); - NeedRefresh(start, end); - - RefreshByLineDemand(); - } -} diff --git a/src/mred/wxme/wx_mpriv.h b/src/mred/wxme/wx_mpriv.h deleted file mode 100644 index 6c0e728813..0000000000 --- a/src/mred/wxme/wx_mpriv.h +++ /dev/null @@ -1,39 +0,0 @@ - -#include "wx_mline.h" - -#define MAX_COUNT_FOR_SNIP 500 - -enum { - wxSTREAK_EXCEPT_DELAYED = 1, - wxSTREAK_EXCEPT_KEY_SEQUENCE = 2, - wxSTREAK_EXCEPT_CURSOR = 4 - }; - -class wxClickback : public wxObject -{ - public: - wxClickback(); - - long start, end; - wxClickbackFunc f; - void *data; - Bool callOnDown; - - wxStyleDelta *delta; - - Bool hilited; - wxList *unhilite; -}; - -#include "wx_timer.h" - -class wxMediaFlashTimer : public wxTimer -{ - public: - wxMediaEdit *media; - void Notify(void); -}; - -#include "wx_clipb.h" - -#include "wx_ptreq.h" diff --git a/src/mred/wxme/wx_msnip.cxx b/src/mred/wxme/wx_msnip.cxx deleted file mode 100644 index 8955719fb8..0000000000 --- a/src/mred/wxme/wx_msnip.cxx +++ /dev/null @@ -1,1170 +0,0 @@ -/* - * File: wx_msnip.cc - * Purpose: wxMediaSnip implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" -#include "wx_media.h" - -#include -#include -#include -#include - -#include "wx_mpriv.h" -#include "wx_gcrct.h" - -wxMediaSnip::wxMediaSnip(wxMediaBuffer *useme, - Bool border, - int lm, int tm, int rm, int bm, - int li, int ti, int ri, int bi, - double w, double W, double h, double H) -{ - Bool istemp; - wxSnipClassList *scl; - -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_MEDIA_SNIP; -#endif - - flags |= wxSNIP_HANDLES_EVENTS; - - scl = &wxTheSnipClassList; - snipclass = scl->Find("wxmedia"); - - withBorder = border; - leftMargin = lm; - topMargin = tm; - rightMargin = rm; - bottomMargin = bm; - leftInset = li; - topInset = ti; - rightInset = ri; - bottomInset = bi; - - minWidth = w; - maxWidth = W; - minHeight = h; - maxHeight = H; - - if (useme && !useme->GetAdmin()) { - me = useme; - } else { - me = wxsMakeMediaEdit(); - } - { - wxMediaSnipMediaAdmin *msma; - msma = new WXGC_PTRS wxMediaSnipMediaAdmin(this); - myAdmin = msma; - } - - if (!me->GetFilename(&istemp) || istemp) - /* Turn on flag to mirror filename: */ - flags |= wxSNIP_USES_BUFFER_PATH; - - me->OwnCaret(FALSE); -} - -wxMediaSnip::~wxMediaSnip() -{ -#if 1 - /* The only way a snip should be deleted if by GC, and it wouldn't - get GC'd if the editor isn't also going to be GCd. It's important - *not* to call SetAdmin(), because that can trigger Scheme - code. */ - DELETE_OBJ me; - me = NULL; -#else - if (me) { - if (me->GetAdmin() == myAdmin) - me->SetAdmin(NULL); - } -#endif - - DELETE_OBJ myAdmin; -} - -void wxMediaSnip::SetAdmin(wxSnipAdmin *a) -{ - if (PTRNE(a, admin)) { - wxSnip::SetAdmin(a); - if (me) { - if (a) { - if (me->GetAdmin()) - me = NULL; /* traitor! - get rid of it */ - else - me->SetAdmin(myAdmin); - } else - me->SetAdmin(NULL); - } - } - - if (admin && (flags & wxSNIP_USES_BUFFER_PATH)) { - /* Propogate a filename change: */ - Bool istemp; - if (me && (!me->GetFilename(&istemp) || istemp)) { - wxMediaBuffer *b; - b = admin->GetMedia(); - if (b) { - char *filename; - filename = b->GetFilename(); - if (filename) - me->SetFilename(filename, TRUE); - } - } else - flags -= wxSNIP_USES_BUFFER_PATH; /* Turn off the flag; not needed */ - } -} - -void wxMediaSnip::SetMedia(wxMediaBuffer *b) -{ - if (me == b) - return; - - if (me && admin) - me->SetAdmin(NULL); - me = b; - if (b) { - if (b->GetAdmin()) { - me = NULL; - return; - } else if (admin) { - me->SetAdmin(myAdmin); - } - } - - if (admin) - admin->Resized(this, TRUE); -} - -wxMediaBuffer *wxMediaSnip::GetThisMedia(void) -{ - return me; -} - -wxCursor *wxMediaSnip::AdjustCursor(wxDC *dc, double x, double y, - double, double, wxMouseEvent *event) -{ - wxMSMA_SnipDrawState *save; - wxCursor *c; - - if (!me) - return NULL; - - save = new WXGC_PTRS wxMSMA_SnipDrawState; - myAdmin->SaveState(save, dc, x, y); - c = me->AdjustCursor(event); - myAdmin->RestoreState(save); - - return c; -} - -void wxMediaSnip::OnEvent(wxDC *dc, double x, double y, - double, double, wxMouseEvent *event) -{ - wxMSMA_SnipDrawState *save; - - if (!me) return; - - save = new WXGC_PTRS wxMSMA_SnipDrawState; - myAdmin->SaveState(save, dc, x, y); - me->OnEvent(event); - myAdmin->RestoreState(save); -} - -void wxMediaSnip::OnChar(wxDC *dc, double x, double y, - double, double, wxKeyEvent *event) -{ - wxMSMA_SnipDrawState *save; - - if (!me) return; - - save = new WXGC_PTRS wxMSMA_SnipDrawState; - myAdmin->SaveState(save, dc, x, y); - me->OnChar(event); - myAdmin->RestoreState(save); -} - -void wxMediaSnip::OwnCaret(Bool ownit) -{ - if (me) - me->OwnCaret(ownit); -} - -void wxMediaSnip::BlinkCaret(wxDC *dc, double x, double y) -{ - if (me) { - wxMSMA_SnipDrawState *save; - - save = new WXGC_PTRS wxMSMA_SnipDrawState; - myAdmin->SaveState(save, dc, x, y); - me->BlinkCaret(); - myAdmin->RestoreState(save); - } -} - -void wxMediaSnip::DoEdit(int op, Bool recursive, long time) -{ - if (me) - me->DoEdit(op, recursive, time); -} - -Bool wxMediaSnip::CanEdit(int op, Bool recursive) -{ - if (me) - return me->CanEdit(op, recursive); - else - return FALSE; -} - -void wxMediaSnip::DoFont(int op, Bool recursive) -{ - if (me) - me->DoFont(op, recursive); -} - -Bool wxMediaSnip::Match(wxSnip *) -{ - return FALSE; -} - -void wxMediaSnip::SizeCacheInvalid(void) -{ - if (me) - me->SizeCacheInvalid(); -} - -wxchar *wxMediaSnip::GetText(long offset, long num, Bool flat, long *got) -{ - if (offset >= 1 || !num) { - if (got) *got = 0; - return wx_empty_wxstr; - } - - if (!flat) { - wxchar *s; - s = new WXGC_ATOMIC wxchar[2]; - s[0] = '.'; - s[1] = 0; - if (got) *got = 1; - return s; - } else if (me) - return me->GetFlattenedText(got); - else - return wx_empty_wxstr; -} - - -void wxMediaSnip::GetExtent(wxDC *dc, - double x, double y, - double *w, double *h, - double *_descent, double *_space, - double *lspace, double *rspace) -{ - wxMSMA_SnipDrawState *save; - double descent, space, origH, dummyH; - - save = new WXGC_PTRS wxMSMA_SnipDrawState; - myAdmin->SaveState(save, dc, x, y); - - if (!h && alignTopLine) - h = &dummyH; - - if (me) - me->GetExtent(w, h); - else { - if (w) - *w = 0; - if (h) - *h = 0; - } - - origH = alignTopLine ? *h : 0.0; - - if (w) { - if (me && (me->bufferType == wxEDIT_BUFFER)) { - if (tightFit) - (*w) -= CURSOR_WIDTH; - else - --(*w); /* It still looks better to subtract 1 */ - if (*w < 0) - *w = 0; - } - if (*w < minWidth) - *w = minWidth; - else if (maxWidth > 0 && *w > maxWidth) - *w = maxWidth; - - (*w) += rightMargin + leftMargin; - } - if (h) { - if (me && (me->bufferType == wxEDIT_BUFFER)) { - if (tightFit) { - (*h) -= ((wxMediaEdit *)me)->GetLineSpacing(); - if (*h < 0) - *h = 0; - } - } - if (*h < minHeight) - *h = minHeight; - else if (maxHeight > 0 && *h > maxHeight) - *h = maxHeight; - - (*h) += topMargin + bottomMargin; - } - - { - descent = (me ? me->GetDescent() : 0.0) + bottomMargin; - if (me && (me->bufferType == wxEDIT_BUFFER)) { - if (alignTopLine) - descent = origH - ((wxMediaEdit *)me)->GetTopLineBase() + bottomMargin; - if (tightFit) { - descent -= ((wxMediaEdit *)me)->GetLineSpacing(); - if (descent < 0) - descent = 0; - } - } - } - space = (me ? me->GetSpace() : 0.0) + topMargin; - - if (maxHeight > 0 && (descent + space >= maxHeight + topMargin + bottomMargin)) { - /* Just give up on spaces in this case: */ - space = topMargin; - descent = bottomMargin; - } - - if (_descent) - *_descent = descent; - if (_space) - *_space = space; - if (lspace) - *lspace = leftMargin; - if (rspace) - *rspace = rightMargin; - - myAdmin->RestoreState(save); -} - -void wxMediaSnip::Draw(wxDC *dc, double x, double y, - double left, double top, double right, double bottom, - double WXUNUSED(dx), double WXUNUSED(dy), - int show_caret) -{ - double w, h, r, b, orig_x, orig_y; - double t, l; - wxColour *bgColor = wxWHITE; - - wxMSMA_SnipDrawState *save; - - save = new WXGC_PTRS wxMSMA_SnipDrawState; - myAdmin->SaveState(save, dc, x, y); - - if (me) { - w = h = 0.0; - me->GetExtent(&w, &h); - if (me && (me->bufferType == wxEDIT_BUFFER)) { - if (tightFit) - w -= CURSOR_WIDTH; - else - --w; /* It still looks better to subtract 1 */ - if (w < 0) - w = 0; - } - if (me && (me->bufferType == wxEDIT_BUFFER)) { - if (tightFit) { - h -= ((wxMediaEdit *)me)->GetLineSpacing(); - if (h < 0) - h = 0; - } - } - } else - w = h = 0.0; - - if (w < minWidth) - w = minWidth; - else if (maxWidth > 0 && w > maxWidth) - w = maxWidth; - - if (h < minHeight) - h = minHeight; - else if (maxHeight > 0 && h > maxHeight) - h = maxHeight; - - orig_x = x; - orig_y = y; - - x += leftMargin; - y += topMargin; - r = x + w; - b = y + h; - - l = ((x > left) ? x : left); - t = ((y > top) ? y : top); - r = ((r < right) ? r : right); - b = ((b < bottom) ? b : bottom); - - if (useStyleBG) { - if (style->GetTransparentTextBacking()) { - bgColor = NULL; - } else { - wxBrush *saveb, *fill; - wxPen *savep, *transPen; - - bgColor = style->GetBackground(); - - l = orig_x + leftInset; - t = orig_y + topInset; - r = l + (w + leftMargin + rightMargin - (leftInset + rightInset)) - 1; - b = t + (h + topMargin + bottomMargin - (topInset + bottomInset)) - 1; - - transPen = wxThePenList->FindOrCreatePen(bgColor, 0, wxTRANSPARENT); - fill = wxTheBrushList->FindOrCreateBrush(bgColor, wxSOLID); - - savep = dc->GetPen(); - saveb = dc->GetBrush(); - - dc->SetPen(transPen); - dc->SetBrush(fill); - - dc->DrawRectangle(l, t, r - l, b - t); - - dc->SetBrush(saveb); - dc->SetPen(savep); - } - } - - if (me) - me->Refresh(l - x, t - y, r - l, b - t, show_caret, bgColor); - - if (withBorder) { - double mt, ml, mb, mr; - - l = orig_x + leftInset; - t = orig_y + topInset; - r = l + (w + leftMargin + rightMargin - (leftInset + rightInset)) - 1; - b = t + (h + topMargin + bottomMargin - (topInset + bottomInset)) - 1; - - ml = ((l > left) ? ((l < right) ? l : right) : left); - mr = ((r > left) ? ((r < right) ? r : right) : left); - mt = ((t > top) ? ((t < bottom) ? t : bottom) : top); - mb = ((b > top) ? ((b < bottom) ? b : bottom) : top); - - if (l >= left && l < right && mt < mb + GC_LINE_EXTEND) - dc->DrawLine(l, mt, l, mb + GC_LINE_EXTEND); - if (r >= left && r < right && mt < mb + GC_LINE_EXTEND) - dc->DrawLine(r, mt, r, mb + GC_LINE_EXTEND); - - if (t >= top && t < bottom && ml < mr + GC_LINE_EXTEND) - dc->DrawLine(ml, t, mr + GC_LINE_EXTEND, t); - if (b >= top && b < bottom && ml < mr + GC_LINE_EXTEND) - dc->DrawLine(ml, b, mr + GC_LINE_EXTEND, b); - } - - myAdmin->RestoreState(save); -} - -wxSnip *wxMediaSnip::Copy(void) -{ - wxMediaSnip *ms; - wxMediaBuffer *mb; - - mb = (me ? me->CopySelf() : (wxMediaBuffer *)NULL); - ms = wxsMakeMediaSnip(mb, - withBorder, - leftMargin, topMargin, - rightMargin, bottomMargin, - leftInset, topInset, - rightInset, bottomInset, - minWidth, maxWidth, - minHeight, maxHeight); - - /* Copy core snip info: */ - wxSnip::Copy(ms); - - ms->tightFit = tightFit; - ms->alignTopLine = alignTopLine; - - if (!me) - ms->SetMedia(NULL); - - return ms; -} - -void wxMediaSnip::Write(wxMediaStreamOut *f) -{ - Bool wb = withBorder, tf = tightFit, ta = alignTopLine, usbg = useStyleBG; - - f->Put((me ? me->bufferType : 0)); - f->Put(wb); - f->Put(leftMargin); - f->Put(topMargin); - f->Put(rightMargin); - f->Put(bottomMargin); - f->Put(leftInset); - f->Put(topInset); - f->Put(rightInset); - f->Put(bottomInset); - f->Put(minWidth); - f->Put(maxWidth); - f->Put(minHeight); - f->Put(maxHeight); - f->Put(tf); - f->Put(ta); - f->Put(usbg); - - if (me) - me->WriteToFile(f); -} - -void wxMediaSnip::SetMaxWidth(double w) -{ - maxWidth = w; - if (admin) - admin->Resized(this, TRUE); -} - -void wxMediaSnip::SetMinWidth(double w) -{ - minWidth = w; - if (admin) - admin->Resized(this, TRUE); -} - -void wxMediaSnip::SetMaxHeight(double h) -{ - maxHeight = h; - if (admin) - admin->Resized(this, TRUE); -} - -void wxMediaSnip::SetMinHeight(double h) -{ - minHeight = h; - if (admin) - admin->Resized(this, TRUE); -} - -double wxMediaSnip::GetMaxWidth(void) { return maxWidth; } -double wxMediaSnip::GetMaxHeight(void) { return maxHeight; } -double wxMediaSnip::GetMinWidth(void) { return minWidth; } -double wxMediaSnip::GetMinHeight(void) { return minHeight; } - -Bool wxMediaSnip::GetTightTextFit(void) -{ - return tightFit; -} - -void wxMediaSnip::SetTightTextFit(Bool t) -{ - tightFit = (t ? TRUE : FALSE); - if (admin) - admin->Resized(this, TRUE); -} - -Bool wxMediaSnip::GetAlignTopLine(void) -{ - return alignTopLine; -} - -void wxMediaSnip::SetAlignTopLine(Bool t) -{ - alignTopLine = (t ? TRUE : FALSE); - if (admin) - admin->Resized(this, TRUE); -} - -void wxMediaSnip::UseStyleBG(Bool useit) -{ - if ((useStyleBG ? 1 : 0) != (useit ? 1 : 0)) { - useStyleBG = (useit ? TRUE : FALSE); - RequestRefresh(); - } -} - -Bool wxMediaSnip::StyleBGUsed() -{ - return useStyleBG; -} - -Bool wxMediaSnip::Resize(double w, double h) -{ - w -= leftMargin + rightMargin; - h -= topMargin + bottomMargin; - if (w < 0) - w = 0; - if (h < 0) - h = 0; - minWidth = maxWidth = w; - minHeight = maxHeight = h; - - if (me) { - me->SetMaxWidth(w); - me->SetMinWidth(w); - } - - if (admin) - admin->Resized(this, TRUE); - - return TRUE; -} - -void wxMediaSnip::RequestRefresh() -{ - if (admin) { - wxDC *dc; - double w, h; - - dc = admin->GetDC(); - if (dc) { - w = h = 0.0; - GetExtent(dc, 0, 0, &w, &h); - admin->NeedsUpdate(this, leftInset, topInset, - w + rightMargin - rightInset, - h + bottomMargin - bottomInset); - } - } -} - -void wxMediaSnip::ShowBorder(Bool show) -{ - if ((withBorder ? 1 : 0) != (show ? 1 : 0)) { - withBorder = (show ? TRUE : FALSE); - RequestRefresh(); - } -} - -Bool wxMediaSnip::BorderVisible() -{ - return withBorder; -} - -void wxMediaSnip::SetMargin(int lm, int tm, int rm, int bm) -{ - leftMargin = lm; - topMargin = tm; - rightMargin = rm; - bottomMargin = bm; - - if (admin) - admin->Resized(this, TRUE); -} - -void wxMediaSnip::GetMargin(int *lm, int *tm, int *rm, int *bm) -{ - *lm = leftMargin; - *tm = topMargin; - *rm = rightMargin; - *bm = bottomMargin; -} - -void wxMediaSnip::SetInset(int lm, int tm, int rm, int bm) -{ - leftMargin = lm; - topMargin = tm; - rightMargin = rm; - bottomMargin = bm; - - if (admin) { - wxDC *dc; - double w, h; - - dc = admin->GetDC(); - if (dc) { - w = h = 0.0; - GetExtent(dc, 0, 0, &w, &h); - admin->NeedsUpdate(this, 0, 0, - w + rightMargin + leftMargin, - h + bottomMargin + topMargin); - } - } -} - -void wxMediaSnip::GetInset(int *li, int *ti, int *ri, int *bi) -{ - *li = leftInset; - *ti = topInset; - *ri = rightInset; - *bi = bottomInset; -} - -long wxMediaSnip::GetNumScrollSteps() -{ - return (me ? me->NumScrollLines() : 1); -} - -long wxMediaSnip::FindScrollStep(double y) -{ - return (me ? me->FindScrollLine(y - topMargin) : 0); -} - -double wxMediaSnip::GetScrollStepOffset(long i) -{ - return (me ? me->ScrollLineLocation(i) + topMargin : 0); -} - -void wxMediaSnip::SetUnmodified() -{ - if (me) - me->SetModified(FALSE); -} - -/****************************************************************/ - -wxMediaSnipMediaAdmin::wxMediaSnipMediaAdmin(wxMediaSnip *s) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_MEDIA_SNIP_MEDIA_ADMIN; -#endif - - snip = s; - state = new WXGC_PTRS wxMSMA_SnipDrawState; - state->drawing = 0; - - WXGC_IGNORE(state, state->dc); -} - -wxMediaSnipMediaAdmin::~wxMediaSnipMediaAdmin() -{ - state->dc = NULL; -} - -wxDC *wxMediaSnipMediaAdmin::GetDC(double *xp, double *yp) -{ - if (state->drawing) { - if (xp) - *xp = -state->x; - if (yp) - *yp = -state->y; - } else { - if (xp) - *xp = 0; - if (yp) - *yp = 0; - } - - if (state->drawing) - return state->dc; - else { - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (sadmin) - return sadmin->GetDC(); - else - return NULL; - } -} - -void wxMediaSnipMediaAdmin::SaveState(wxMSMA_SnipDrawState *save, wxDC *dc, - double x, double y) -{ - save->drawing = state->drawing; - save->dc = state->dc; - save->x = state->x; - save->y = state->y; - - state->drawing = TRUE; - state->x = x + snip->leftMargin; - state->y = y + snip->topMargin; - state->dc = dc; -} - -void wxMediaSnipMediaAdmin::RestoreState(wxMSMA_SnipDrawState *saved) -{ - state->drawing = saved->drawing; - state->dc = saved->dc; - state->x = saved->x; - state->y = saved->y; -} - -void wxMediaSnipMediaAdmin::GetView(double *x, double *y, double *w, double *h, - Bool full) -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - - if (!sadmin) { - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; - return; - } - - if (full) { - sadmin->GetView(x, y, w, h, NULL); - } else { - double sx, sy, sw, sh; - sadmin->GetView(&sx, &sy, &sw, &sh, snip); - if (x) { - *x = sx - snip->leftMargin; - if (*x < 0) - *x = 0; - } - if (y) { - *y = sy - snip->topMargin; - if (*y < 0) - *y = 0; - } - - if (w || h) { - if (sw || sh) { - /* w and h might be too big due to margins - but - they might be small enough already because - part of the snip itself is not viewed. */ - double rw, rh; - - /* We want the internal, non-overridden method: */ - snip->wxMediaSnip::GetExtent(state->dc, 0, 0, &rw, &rh); - - /* remember: sx and sy are in snip coordinates */ - - if (w) { - double leftMargin, rightMargin; - - leftMargin = snip->leftMargin - sx; - if (leftMargin < 0) - leftMargin = 0; - sw -= leftMargin; - rw -= snip->leftMargin; - - rightMargin = snip->rightMargin - (rw - sw); - if (rightMargin < 0) - rightMargin = 0; - sw -= rightMargin; - - if (sw < 0) sw = 0; - *w = sw; - } - if (h) { - double topMargin, bottomMargin; - - topMargin = snip->topMargin - sy; - if (topMargin < 0) - topMargin = 0; - sh -= topMargin; - rh -= snip->topMargin; - - bottomMargin = snip->bottomMargin - (rh - sh); - if (bottomMargin < 0) - bottomMargin = 0; - sh -= bottomMargin; - - if (sh < 0) sh = 0; - *h = sh; - } - } else { - if (w) *w = 0; - if (h) *h = 0; - } - } - } -} - -Bool wxMediaSnipMediaAdmin::ScrollTo(double localx, double localy, double w, double h, - Bool refresh, int bias) -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (sadmin) - return sadmin->ScrollTo(snip, localx + snip->leftMargin, - localy + snip->topMargin, - w, h, refresh, bias); - else - return FALSE; -} - -void wxMediaSnipMediaAdmin::GrabCaret(int dist) -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (sadmin) - sadmin->SetCaretOwner(snip, dist); -} - -void wxMediaSnipMediaAdmin::Resized(Bool redraw_now) -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (sadmin) - sadmin->Resized(snip, redraw_now); -} - -void wxMediaSnipMediaAdmin::NeedsUpdate(double localx, double localy, - double w, double h) -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (sadmin) - sadmin->NeedsUpdate(snip, - localx + snip->leftMargin, - localy + snip->topMargin, - w, h); -} - -void wxMediaSnipMediaAdmin::UpdateCursor() -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (sadmin) - sadmin->UpdateCursor(); -} - -Bool wxMediaSnipMediaAdmin::PopupMenu(void *m, double x, double y) -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (sadmin) - return sadmin->PopupMenu(m, snip, - x + snip->leftMargin, - y + snip->topMargin); - else - return FALSE; -} - -Bool wxMediaSnipMediaAdmin::DelayRefresh() -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (!sadmin) - return 1; - - if (sadmin->__type == wxTYPE_MEDIA_SNIP_ADMIN) { - wxMediaBuffer *b; - b = ((wxStandardSnipAdmin *)sadmin)->GetMedia(); - - return b->RefreshDelayed(); - } else - return 0; -} - -void wxMediaSnipMediaAdmin::Modified(Bool modified) -{ - wxSnipAdmin *sadmin; - sadmin = snip->GetAdmin(); - if (sadmin) - sadmin->Modified(snip, modified); -} - -/************************************************************************/ - -extern wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char*, int); - -#define GET_EDIT(buf) ((buf->bufferType == wxEDIT_BUFFER) ? (wxMediaEdit *)buf : NULL) -#define GET_BUF(bv) objscheme_unbundle_wxMediaBuffer((Scheme_Object *)vb, NULL, 0) - -#define edf(name, action) \ - static Bool ed_##name(void *vb, wxEvent *, void *) \ - { wxMediaBuffer *buf; wxMediaEdit *b; \ - buf = GET_BUF(vb); \ - b = GET_EDIT(buf); \ - if (!b) return FALSE; \ - b->action; return TRUE; } \ - -edf(right, MovePosition(WXK_RIGHT)) -edf(left, MovePosition(WXK_LEFT)) -edf(up, MovePosition(WXK_UP)) -edf(down, MovePosition(WXK_DOWN)) -edf(pageup, MovePosition(WXK_UP, FALSE, wxMOVE_PAGE)) -edf(pagedown, MovePosition(WXK_DOWN, FALSE, wxMOVE_PAGE)) -edf(rightword, MovePosition(WXK_RIGHT, FALSE, wxMOVE_WORD)) -edf(leftword, MovePosition(WXK_LEFT, FALSE, wxMOVE_WORD)) - -edf(selectright, MovePosition(WXK_RIGHT, TRUE)) -edf(selectleft, MovePosition(WXK_LEFT, TRUE)) -edf(selectup, MovePosition(WXK_UP, TRUE)) -edf(selectdown, MovePosition(WXK_DOWN, TRUE)) -edf(selectpageup, MovePosition(WXK_UP, TRUE, wxMOVE_PAGE)) -edf(selectpagedown, MovePosition(WXK_DOWN, TRUE, wxMOVE_PAGE)) -edf(selectrightword, MovePosition(WXK_RIGHT, TRUE, wxMOVE_WORD)) -edf(selectleftword, MovePosition(WXK_LEFT, TRUE, wxMOVE_WORD)) - -edf(startofline, MovePosition(WXK_LEFT, FALSE, wxMOVE_LINE)) -edf(endofline, MovePosition(WXK_RIGHT, FALSE, wxMOVE_LINE)) -edf(home, MovePosition(WXK_HOME)) -edf(end, MovePosition(WXK_END)) - -edf(selecttostartofline, MovePosition(WXK_LEFT, TRUE, wxMOVE_LINE)) -edf(selecttoendofline, MovePosition(WXK_RIGHT, TRUE, wxMOVE_LINE)) -edf(selecttohome, MovePosition(WXK_HOME, TRUE)) -edf(selecttoend, MovePosition(WXK_END, TRUE)) - -edf(clear, Erase()) -edf(delete, Delete()) - -edf(pastenext, PasteNext()) - -static Bool ed_deletenext(void *vb, wxEvent *, void *) -{ - long s, e; - wxMediaEdit *edit; - wxMediaBuffer *buf; - buf = GET_BUF(vb); - edit = GET_EDIT(buf); - if (!edit) return FALSE; - - edit->GetPosition(&s, &e); - if (s != e) - edit->Delete(); - else - edit->Delete(s, s + 1); - return TRUE; -} - -static Bool ed_deletenextword(void *vb, wxEvent *event, void *) -{ - wxMediaEdit *edit; - wxMediaBuffer *buf; - buf = GET_BUF(vb); - edit = GET_EDIT(buf); - if (!edit) return FALSE; - - edit->BeginEditSequence(); - ed_selectrightword(edit, event, NULL); - ed_delete(edit, event, NULL); - edit->EndEditSequence(); - return TRUE; -} - -static Bool ed_deleteprevword(void *vb, wxEvent *event, void *) -{ - wxMediaEdit *edit; - wxMediaBuffer *buf; - buf = GET_BUF(vb); - edit = GET_EDIT(buf); - if (!edit) return FALSE; - - edit->BeginEditSequence(); - ed_selectleftword(edit, event, NULL); - ed_delete(edit, event, NULL); - edit->EndEditSequence(); - return TRUE; -} - -static Bool ed_deleteline(void *vb, wxEvent *event, void *) -{ - wxMediaEdit *edit; - wxMediaBuffer *buf; - buf = GET_BUF(vb); - edit = GET_EDIT(buf); - if (!edit) return FALSE; - - edit->BeginEditSequence(); - ed_startofline(edit, event, NULL); - ed_selecttoendofline(edit, event, NULL); - ed_delete(edit, event, NULL); - edit->EndEditSequence(); - return TRUE; -} - -void wxMediaEdit::AddEditorFunctions(wxKeymap *tab) -{ - wxAddMediaEditorFunctions(tab); -} - -void wxAddMediaEditorFunctions(wxKeymap *tab) -{ -#define setf(name, func) tab->AddFunction(name, ed_##func, NULL) - - setf("forward-character", right); - setf("backward-character", left); - setf("previous-line", up); - setf("next-line", down); - setf("previous-page", pageup); - setf("next-page", pagedown); - setf("forward-word", rightword); - setf("backward-word", leftword); - - setf("forward-select", selectright); - setf("backward-select", selectleft); - setf("select-down", selectdown); - setf("select-up", selectup); - setf("select-page-up", selectpageup); - setf("select-page-down", selectpagedown); - setf("forward-select-word", selectrightword); - setf("backward-select-word", selectleftword); - - setf("beginning-of-file", home); - setf("end-of-file", end); - setf("beginning-of-line", startofline); - setf("end-of-line", endofline); - - setf("select-to-beginning-of-file", selecttohome); - setf("select-to-end-of-file", selecttoend); - setf("select-to-beginning-of-line", selecttostartofline); - setf("select-to-end-of-line", selecttoendofline); - - setf("delete-previous-character", delete); - setf("delete-next-character", deletenext); - setf("clear-buffer", clear); - setf("delete-next-word", deletenextword); - setf("delete-previous-word", deleteprevword); - - setf("delete-line", deleteline); - setf("paste-next", pastenext); - - wxAddMediaBufferFunctions(tab); -} - -/*************************************************************/ - -wxMediaWordbreakMap::wxMediaWordbreakMap() -{ - int i; - char *old; - - usage = 0; - memset(map, 0, sizeof(map)); - - /* Use default locale... */ - old = setlocale(LC_CTYPE, NULL); - old = copystring(old); - setlocale(LC_CTYPE, ""); - - for (i = 0; i < 256; i++) { - if (isalnum(i)) - map[i] = wxBREAK_FOR_CARET | wxBREAK_FOR_LINE | wxBREAK_FOR_SELECTION; - else if ((i >= 128) || !isspace(i)) - map[i] = wxBREAK_FOR_LINE; - } - - setlocale(LC_CTYPE, old); - - map[(int)'-'] -= wxBREAK_FOR_LINE; -} - -void wxMediaWordbreakMap::SetMap(int ch, int mask) -{ - if ((ch >= 0) && (ch <= 255)) - map[ch] = mask; -} - -int wxMediaWordbreakMap::GetMap(int ch) -{ - if ((ch >= 0) && (ch <= 255)) - return map[ch]; - else - return 0; -} diff --git a/src/mred/wxme/wx_mtype.h b/src/mred/wxme/wx_mtype.h deleted file mode 100644 index bb79f57b84..0000000000 --- a/src/mred/wxme/wx_mtype.h +++ /dev/null @@ -1,36 +0,0 @@ - -#define USE_OLD_TYPE_SYSTEM 1 - -#define wxTYPE_MEDIA_CANVAS 344 -#define wxTYPE_MEDIA_BUFFER 345 -#define wxTYPE_MEDIA_EDIT 346 -#define wxTYPE_MEDIA_PASTEBOARD 347 -#define wxTYPE_SNIP 348 -#define wxTYPE_TEXT_SNIP 349 -#define wxTYPE_TAB_SNIP 350 -#define wxTYPE_MEDIA_SNIP 351 -#define wxTYPE_SNIP_CLASS 352 -#define wxTYPE_MEDIA_ADMIN 353 -#define wxTYPE_MEDIA_SNIP_ADMIN 354 -#define wxTYPE_MEDIA_SNIP_MEDIA_ADMIN 355 -#define wxTYPE_CANVAS_MEDIA_ADMIN 356 -#define wxTYPE_MEDIA_STREAM_IN 357 -#define wxTYPE_MEDIA_STREAM_OUT 358 -#define wxTYPE_MEDIA_STREAM_IN_BASE 359 -#define wxTYPE_MEDIA_STREAM_OUT_BASE 360 -#define wxTYPE_MEDIA_STREAM_IN_FILE_BASE 361 -#define wxTYPE_MEDIA_STREAM_IN_STRING_BASE 362 -#define wxTYPE_MEDIA_STREAM_OUT_FILE_BASE 363 -#define wxTYPE_MEDIA_STREAM_OUT_STRING_BASE 364 -#define wxTYPE_KEYMAP 365 -#define wxTYPE_MULT_COLOUR 366 -#define wxTYPE_ADD_COLOUR 367 -#define wxTYPE_STYLE 368 -#define wxTYPE_STYLE_DELTA 369 -#define wxTYPE_STYLE_LIST 370 -#define wxTYPE_IMAGE_SNIP 371 -#define wxTYPE_BUFFER_DATA 372 -#define wxTYPE_BUFFER_DATA_CLASS 373 -#define wxTYPE_BUFFER_DATA_CLASS_LIST 374 -#define wxTYPE_WORDBREAK_MAP 375 -#define wxTYPE_SNIP_CLASS_LIST 376 diff --git a/src/mred/wxme/wx_ptreq.h b/src/mred/wxme/wx_ptreq.h deleted file mode 100644 index a95aaab832..0000000000 --- a/src/mred/wxme/wx_ptreq.h +++ /dev/null @@ -1,8 +0,0 @@ - -#ifndef PTREQ - -/* Comparing pointers: */ -#define PTREQ(x, y) ((x) == (y)) -#define PTRNE(x, y) ((x) != (y)) - -#endif diff --git a/src/mred/wxme/wx_snip.cxx b/src/mred/wxme/wx_snip.cxx deleted file mode 100644 index b30e47d55b..0000000000 --- a/src/mred/wxme/wx_snip.cxx +++ /dev/null @@ -1,2211 +0,0 @@ -/* - * File: wx_snip.cc - * Purpose: wxSnip implementations - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995-2002, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" -#include "wx_dialg.h" -#ifndef OLD_WXWINDOWS -#include "wx_cmdlg.h" -#endif -#include "wx_utils.h" -#include "wx_media.h" -#include "wx_ptreq.h" -#include -#include "wx_gcrct.h" - -#define SETWD_NOT_PRESENT 1 - -#ifdef wx_x -#define CHECK_SPLIT 1 -#else -#define CHECK_SPLIT 0 -#endif - -#define CHECK_CS_FLAG 1 - -#ifdef MEMMOVE_NOT_PRESENT -static void memmove(char *dest, char *src, long size) -{ - if (dest < src) { - while (size--) - *(dest++) = *(src++); - } else { - dest += size; - src += size; - while (size--) - *(--dest) = *(--src); - } -} -#endif - -# define WXGC_CLEANUP_ARG(a) a - -/* MSW version needs this for just a little while longer... */ -#ifndef WXGC_ATOMIC -#define WXGC_ATOMIC /* empty */ -#endif - -#define MAX_WASTE 3 - -#define IMAGE_PIXELS_PER_SCROLL 20 -#define IMAGE_VOID_SIZE 20 - -#define ALWAYSZERO(x) if (x) *x = 0; - -extern void *wxMallocAtomicIfPossible(size_t s); - -#define STRALLOC(n) new WXGC_ATOMIC wxchar[n] -#define TRY_STRALLOC(n) (wxchar *)wxMallocAtomicIfPossible((n) * sizeof(wxchar)) -#define STRFREE(s) /* empty */ - -wxchar wx_empty_wxstr[1] = {0}; - -/***************************************************************/ - -wxSnipClass::wxSnipClass() -: wxObject(WXGC_NO_CLEANUP) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_SNIP_CLASS; -#endif - - classname = "wxbad"; - version = 0; - required = 0; -} - -Bool wxSnipClass::ReadHeader(wxMediaStreamIn *) -{ - return TRUE; -} - -Bool wxSnipClass::WriteHeader(wxMediaStreamOut *) -{ - return TRUE; -} - -int wxSnipClass::ReadingVersion(wxMediaStreamIn *f) -{ - return f->ReadingVersion(this); -} - -/***************************************************************/ - -wxSnip::wxSnip() : wxObject(WXGC_CLEANUP_ARG(WXGC_NO_CLEANUP)) -{ - Init(); -} - -wxSnip::wxSnip(Bool cleanup) : wxObject(WXGC_CLEANUP_ARG(cleanup)) -{ - Init(); -} - -wxInternalSnip::wxInternalSnip() : wxSnip() -{ -} - -wxInternalSnip::wxInternalSnip(Bool cleanup) : wxSnip(cleanup) -{ -} - -void wxSnip::Init(void) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_SNIP; -#endif - - count = 1; - - flags = 0; - - snipclass = NULL; - - - next = prev = NULL; - line = NULL; - - admin = NULL; - - style = wxTheStyleList->BasicStyle(); -} - -wxSnip::~wxSnip() -{ - next = prev = NULL; - line = NULL; -} - -wxSnip *wxSnip::Next(void) -{ - return next; -} - -wxSnip *wxSnip::Previous(void) -{ - return prev; -} - -wxSnipAdmin *wxSnip::GetAdmin(void) -{ - return admin; -} - -void wxSnip::SetAdmin(wxSnipAdmin *a) -{ - if (PTRNE(a, admin) && (flags & wxSNIP_OWNED) - && (a || !(flags & wxSNIP_CAN_DISOWN))) - return; - - admin = a; - SizeCacheInvalid(); - if (!a) { - prev = next = NULL; - line = NULL; - } else - flags |= wxSNIP_OWNED; -} - -void wxSnip::SetCount(long new_count) -{ - long old_count = count; - - if (new_count <= 0) - new_count = 1; - count = new_count; - if (admin) { - if (!admin->Recounted(this, TRUE)) - count = old_count; - } -} - -void wxInternalSnip::SetCount(long WXUNUSED(new_count)) -{ - /* reject change */ -} - -void wxSnip::SetFlags(long new_flags) -{ - /* Make sure that wxSNIP_HARD_NEWLINE implies a wxSNIP_NEWLINE */ - if (new_flags & wxSNIP_NEWLINE) - new_flags -= wxSNIP_NEWLINE; - if (new_flags & wxSNIP_HARD_NEWLINE) - new_flags |= wxSNIP_NEWLINE; - - /* Make sure ownership and splitness flags don't change */ - if (new_flags & wxSNIP_OWNED) - new_flags -= wxSNIP_OWNED; - if (new_flags & wxSNIP_CAN_DISOWN) - new_flags -= wxSNIP_CAN_DISOWN; - if (new_flags & wxSNIP_CAN_SPLIT) - new_flags -= wxSNIP_CAN_SPLIT; - - if (flags & wxSNIP_OWNED) - new_flags |= wxSNIP_OWNED; - if (flags & wxSNIP_CAN_DISOWN) - new_flags |= wxSNIP_CAN_DISOWN; - if (flags & wxSNIP_CAN_SPLIT) - new_flags |= wxSNIP_CAN_SPLIT; - - flags = new_flags; - if (admin) - admin->Resized(this, TRUE); -} - -void wxSnip::OnEvent(wxDC *, double, double, double, double, wxMouseEvent *) -{ -} - -wxCursor *wxSnip::AdjustCursor(wxDC *, double, double, double, double, wxMouseEvent *) -{ - return NULL; -} - -void wxSnip::OnChar(wxDC *, double, double, double, double, wxKeyEvent *) -{ -} - -void wxSnip::DoEdit(int, Bool, long) -{ -} - -Bool wxSnip::CanEdit(int, Bool) -{ - return FALSE; -} - -void wxSnip::DoFont(int, Bool) -{ -} - -Bool wxSnip::Match(wxSnip *other) -{ - if (PTRNE(other->snipclass, snipclass)) - return FALSE; - if (other->count != count) - return FALSE; - return TRUE; -} - -void wxSnip::OwnCaret(Bool) -{ -} - -void wxSnip::BlinkCaret(wxDC *, double, double) -{ -} - -void wxSnip::SizeCacheInvalid(void) -{ -} - -void wxSnip::GetExtent(wxDC *, - double, double, - double *w, double *h, - double *descent, double *space, - double *lspace, double *rspace) -{ - if (w) - *w = 0; - if (h) - *h = 0; - if (descent) - *descent = 0; - if (space) - *space = 0; - if (lspace) - *lspace = 0; - if (rspace) - *rspace = 0; -} - -double wxSnip::PartialOffset(wxDC *dc, - double x, double y, long offset) -{ - double w; - - if (!offset) - return 0.0; - - w = 0.0; - GetExtent(dc, x, y, &w); - return w; -} - -void wxSnip::Draw(wxDC *, double, double, - double, double, double, double, - double, double, int) -{ -} - -void wxSnip::Split(long position, wxSnip **first, wxSnip **second) -{ - wxSnip *snip; - - snip = new WXGC_PTRS wxSnip(); - snip->count = position; - count -= position; - - *first = snip; - *second = this; - -#if CHECK_CS_FLAG - if (!(flags & wxSNIP_CAN_SPLIT) && admin) - admin->Resized(this, TRUE); -#endif -} - -wxSnip *wxSnip::MergeWith(wxSnip *) -{ - return NULL; -} - -void wxSnip::GetTextBang(wxchar *s, long offset, long num, long dt) -{ - wxchar *str; - - if (num <= 0) - return; - str = GetText(offset + dt, num, FALSE); - if (!str) { - int i; - for (i = 0; i < num; i++) { - s[i] = '.'; - } - } else - memcpy(s, str, num * sizeof(wxchar)); -} - -wxchar *wxSnip::GetText(long offset, long num, - Bool WXUNUSED(flattened), long *got) -{ - wxchar *s; - int i; - - if (num <= 0) - return wx_empty_wxstr; - if (offset < 0) - offset = 0; - if (offset > count) - return wx_empty_wxstr; - if (num > count - offset) - num = count - offset; - - s = new WXGC_ATOMIC wxchar[num + 1]; - for (i = 0; i < num; i++) { - s[i] = '.'; - } - s[num] = 0; - - if (got) - *got = num; - - return s; -} - -char *wxSnip::GetTextUTF8(long offset, long num, Bool flattened, long *_got) -{ - wxchar *s; - long got, len; - char *r = NULL; - - s = GetText(offset, num, flattened, &got); - wxme_utf8_encode(s, got, &r, &len); - - if (_got) - *_got = len; - - return r; -} - -wxSnip *wxSnip::Copy() -{ - wxSnip *snip; - - snip = new WXGC_PTRS wxSnip(); - Copy(snip); - - return snip; -} - -void wxSnip::SetStyle(wxStyle *s) -{ - if (flags & wxSNIP_OWNED) - return; - - style = s; -} - -void wxSnip::Copy(wxSnip *snip) -{ - snip->count = count; - snip->flags = flags; - if (snip->flags & wxSNIP_OWNED) - snip->flags -= wxSNIP_OWNED; - if (snip->flags & wxSNIP_CAN_DISOWN) - snip->flags -= wxSNIP_CAN_DISOWN; - if (snip->flags & wxSNIP_CAN_SPLIT) - snip->flags -= wxSNIP_CAN_SPLIT; - snip->snipclass = snipclass; - snip->style = style; -} - -void wxSnip::Write(wxMediaStreamOut *) -{ -} - -Bool wxSnip::Resize(double, double) -{ - return FALSE; -} - -long wxSnip::GetNumScrollSteps() -{ - return 1; -} - -long wxSnip::FindScrollStep(double) -{ - return 0; -} - -double wxSnip::GetScrollStepOffset(long) -{ - return 0; -} - -Bool wxSnip::IsOwned(void) -{ - return !!(flags & wxSNIP_OWNED); -} - -Bool wxSnip::ReleaseFromOwner(void) -{ - if (!IsOwned()) - return TRUE; - - if (!admin) - return FALSE; - - if (admin->ReleaseSnip(this)) - return !(flags & wxSNIP_OWNED); - else - return FALSE; -} - -void wxSnip::SetUnmodified() -{ - /* do nothing */ -} - -/***************************************************************/ - -class TextSnipClass : public wxSnipClass -{ - public: - TextSnipClass(void); - - virtual wxSnip *Read(wxMediaStreamIn *); - wxSnip *Read(wxTextSnip *, wxMediaStreamIn *); -}; - -static TextSnipClass *TheTextSnipClass; - -TextSnipClass::TextSnipClass(void) -{ - classname = "wxtext"; - version = 3; - required = TRUE; -} - -wxSnip *TextSnipClass::Read(wxMediaStreamIn *f) -{ - wxTextSnip *s; - s = new WXGC_PTRS wxTextSnip(0); - return Read(s, f); -} - -wxSnip *TextSnipClass::Read(wxTextSnip *snip, wxMediaStreamIn *f) -{ - long flags; - long count, pos; - - f->Get(&flags); - - pos = f->Tell(); - f->Get(&count); - f->JumpTo(pos); - - if (count < 0) - count = 10; /* This is a failure. We make up something. */ - - snip->Read(count, f); - - snip->flags = flags; - - return snip; -} - -/***************************************************************/ - -#ifdef wx_mac -# define NON_BREAKING_SPACE 0xCA -#else -# define NON_BREAKING_SPACE 0xA0 -#endif - -static int dont_shrink_alloc_size; - -wxTextSnip::wxTextSnip(long allocsize) -{ - Init(allocsize); -} - -wxTextSnip::wxTextSnip(wxchar *initstring, long len) -{ - Init(len + 2); - Insert(initstring, len, 0); -} - -wxTextSnip::wxTextSnip(char *initstring, long len) -{ - Init(len + 2); - InsertUTF8(initstring, len, 0); -} - -void wxTextSnip::Init(long allocsize) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_TEXT_SNIP; -#endif - - flags |= wxSNIP_IS_TEXT | wxSNIP_CAN_APPEND; - - w = -1.0; - - if (!dont_shrink_alloc_size) - if (allocsize > 5000) - allocsize = 5000; - - allocated = (allocsize > 0) ? 2 * allocsize : 20; - buffer = STRALLOC(allocated + 1); - dtext = 0; - - snipclass = TheTextSnipClass; - - count = 0; -} - -wxTextSnip::~wxTextSnip() -{ - STRFREE(buffer); - buffer = NULL; -} - -void wxTextSnip::SizeCacheInvalid(void) -{ - w = -1.0; -} - -void wxTextSnip::GetTextExtent(wxDC *dc, int count, double *wo) -{ - double _w, h; - wxFont *font; - int i; - - for (i = count; i--; ) { - wxchar c = buffer[dtext + i]; - if (!c || (c == NON_BREAKING_SPACE)) - break; - } - - font = style->GetFont(); -#ifdef BROKEN_GET_TEXT_EXTENT - dc->SetFont(font); -#endif - - if (i < 0) { - dc->GetTextExtent((char *)buffer, &_w, &h, NULL, NULL, font, FALSE, TRUE, dtext, count); - } else { - /* text includes null chars */ - double ex_w; - int start = 0, i; - -#ifndef BROKEN_GET_TEXT_EXTENT - dc->SetFont(font); -#endif - dc->GetTextExtent(" ", &ex_w, &h, NULL, NULL, font); - - _w = 0; - for (i = 0; i <= count; i++) { - if (!buffer[dtext + i] || (buffer[dtext + i] == NON_BREAKING_SPACE) || (i == count)) { - if (i > start) { - double piece_w, h; - dc->GetTextExtent((char *)buffer, &piece_w, &h, NULL, NULL, NULL, FALSE, TRUE, dtext + start, i - start); - _w += piece_w; - } - if (i < count) { - start = i + 1; - _w += ex_w; - } - } - } - } - - *wo = _w; -} - -void wxTextSnip::GetExtent(wxDC *dc, - double WXUNUSED(x), double WXUNUSED(y), - double *wo, double *ho, double *dso, double *so, - double *ls, double *rs) -{ - - if (w < 0) { - if ((flags & wxSNIP_INVISIBLE) || !count - || (count == 1 && buffer[dtext] == '\n') - || (count == 1 && buffer[dtext] == '\t')) { - if (count == 1 && buffer[dtext] == '\t') { - double tw; - tw = style->GetTextWidth(dc); - w = tw; - } else - w = 0; - } else { - double ww; - GetTextExtent(dc, count, &ww); - w = ww; - } - } - - if (wo) - *wo = w; - if (ho) { - double th; - th = style->GetTextHeight(dc); - *ho = th; - } - if (dso) { - double td; - td = style->GetTextDescent(dc); - *dso = td; - } - if (so) { - double ts; - ts = style->GetTextSpace(dc); - *so = ts; - } - if (ls) - *ls = 0.0; - if (rs) - *rs = 0.0; -} - -double wxTextSnip::PartialOffset(wxDC *dc, double, double, long offset) -{ - double _w; - - if (offset > count) - offset = count; - - GetTextExtent(dc, offset, &_w); - - return _w; -} - -void wxTextSnip::Draw(wxDC *dc, double x, double y, - double, double, double, double, - double WXUNUSED(dx), double WXUNUSED(dy), - int) -{ - wxchar save; - int i; - - if (flags & wxSNIP_INVISIBLE) - return; - - save = buffer[dtext + count]; - buffer[dtext + count] = 0; - - for (i = count; i--; ) { - wxchar c = buffer[dtext + i]; - if (!c || (c == NON_BREAKING_SPACE)) - break; - } - - if (i < 0) - dc->DrawText((char *)buffer, x, y, FALSE, TRUE, dtext); - else { - /* text includes null chars */ - double px, h, ex_w; - int start = 0, i; - - dc->GetTextExtent(" ", &ex_w, &h, NULL, NULL); - - px = x; - for (i = 0; i <= count; i++) { - if (!buffer[dtext + i] || (buffer[dtext + i] == NON_BREAKING_SPACE) || (i == count)) { - if (i > start) { - double piece_w, h; - wxchar save = buffer[dtext + i]; - buffer[dtext + i] = 0; - dc->GetTextExtent((char *)buffer, &piece_w, &h, NULL, NULL, NULL, FALSE, TRUE, dtext + start); - dc->DrawText((char *)buffer, px, y, FALSE, TRUE, dtext + start); - buffer[dtext + i] = save; - px += piece_w; - } - if (i < count) { - /* In case there's a background, draw a space: */ - dc->DrawText(" ", px, y); - - /* Draw box for nul: */ - if (!buffer[dtext + i]) - if (h > 2 && ex_w > 2) - dc->DrawRectangle(px + 1, y + 1, ex_w - 2, h - 2); - - start = i + 1; - px += ex_w; - } - } - } - } - -#ifdef wx_x - if (style->GetUnderlined()) { - double descent, h; - - descent = style->GetTextDescent(dc); - h = style->GetTextHeight(dc); - - if (descent >= 2) - y += h - (descent / 2); - else - y += h - descent; - dc->DrawLine(x, y, x + w + GC_LINE_EXTEND, y); - } -#endif - - buffer[dtext + count] = save; -} - -void wxTextSnip::Split(long position, wxSnip **first, wxSnip **second) -{ - wxTextSnip *snip; - - if (position < 0 || position > count) - return; - - dont_shrink_alloc_size = 1; - snip = new WXGC_PTRS wxTextSnip(position); - dont_shrink_alloc_size = 0; - - w = -1.0; - - memcpy(snip->buffer + snip->dtext, buffer + dtext, position * sizeof(wxchar)); - dtext += position; - - snip->count = position; - count -= position; - - if (count && ((allocated / count) > MAX_WASTE)) { - wxchar *naya; - allocated = count; - naya = STRALLOC(allocated + 1); - memcpy(naya, buffer + dtext, (count + 1) * sizeof(wxchar)); - buffer = naya; - dtext = 0; - } - - *first = snip; - *second = this; - -#if CHECK_CS_FLAG - if (!(flags & wxSNIP_CAN_SPLIT) && admin) - admin->Resized(this, TRUE); -#endif -} - -wxSnip *wxTextSnip::MergeWith(wxSnip *pred) -{ -#if USE_OLD_TYPE_SYSTEM - if (pred->__type != wxTYPE_TEXT_SNIP) - return this; -#endif - - w = -1.0; - - InsertWithOffset(((wxTextSnip *)pred)->buffer, pred->count, ((wxTextSnip *)pred)->dtext, 0); - -#if CHECK_CS_FLAG - if (!(flags & wxSNIP_CAN_SPLIT) && admin) - admin->Resized(this, TRUE); -#endif - - return this; -} - -void wxTextSnip::InsertWithOffset(wxchar *str, long len, long delta, long pos) -{ - if (len <= 0) - return; - if (pos < 0) - pos = 0; - - if (allocated < count + len) { - wxchar *naya; - - allocated = 2 * (count + len); - naya = STRALLOC(allocated + 1); - - memcpy(naya, buffer + dtext, count * sizeof(wxchar)); - - buffer = naya; - dtext = 0; - } else if (dtext && (dtext + count + len > allocated)) { - memmove(buffer, buffer + dtext, count * sizeof(wxchar)); - dtext = 0; - } - - if (pos < count) - memmove(buffer + dtext + pos + len, - buffer + dtext + pos, - (count - pos) * sizeof(wxchar)); - memcpy(buffer + dtext + pos, str + delta, len * sizeof(wxchar)); - - count += len; - - w = -1.0; - -#if CHECK_CS_FLAG - if (!(flags & wxSNIP_CAN_SPLIT) && admin) - if (!admin->Recounted(this, TRUE)) - count -= len; -#endif -} - -void wxTextSnip::Insert(wxchar *str, long len, long pos) -{ - InsertWithOffset(str, len, 0, pos); -} - -void wxTextSnip::InsertUTF8(char *str, long len, long pos) -{ - long ulen; - wxchar *us = NULL; - wxme_utf8_decode(str, len, &us, &ulen); - Insert(us, ulen, pos); -} - -void wxTextSnip::GetTextBang(wxchar *s, long offset, long num, long dt) -{ - if (num <= 0) - return; - - memcpy(s + dt, buffer + dtext + offset, num * sizeof(wxchar)); -} - -wxchar *wxTextSnip::GetText(long offset, long num, Bool flat, long *got) -{ - if (offset < 0) offset = 0; - if ((num <= 0) || (offset >= count)) { - if (got) - *got = 0; - return wx_empty_wxstr; - } - if (num + offset > count) - num = count - offset; - - { - wxchar *s; - s = new WXGC_ATOMIC wxchar[num + 1]; - memcpy(s, buffer + dtext + offset, num * sizeof(wxchar)); - s[num] = 0; - if (got) - *got = num; - return s; - } -} - -wxSnip *wxTextSnip::Copy() -{ - wxTextSnip *snip; - - snip = new WXGC_PTRS wxTextSnip(count); - Copy(snip); - return snip; -} - -void wxTextSnip::Copy(wxTextSnip *snip) -{ - wxSnip::Copy(snip); - - if (snip->allocated < count) { - int a; - wxchar *s; - a = count + 10; - s = STRALLOC(a + 1); - snip->allocated = a; - snip->buffer = s; - } - - memcpy(snip->buffer + snip->dtext, buffer + dtext, count * sizeof(wxchar)); - snip->count = count; - snip->dtext = 0; - - snip->w = -1.0; -} - -void wxTextSnip::Write(wxMediaStreamOut *f) -{ - long writeFlags, ul; - char *ub, buf[128]; - - writeFlags = flags; - if (writeFlags & wxSNIP_OWNED) - writeFlags -= wxSNIP_OWNED; - if (writeFlags & wxSNIP_CAN_DISOWN) - writeFlags -= wxSNIP_CAN_DISOWN; - if (writeFlags & wxSNIP_CAN_SPLIT) - writeFlags -= wxSNIP_CAN_SPLIT; - - f->Put(writeFlags); - - ul = scheme_utf8_encode(buffer, dtext, dtext + count, NULL, 0, 0); - if (ul <= 128) - ub = buf; - else - ub = new WXGC_ATOMIC char[ul]; - scheme_utf8_encode(buffer, dtext, dtext + count, (unsigned char *)ub, 0, 0); - f->Put(ul, ub, 0); -} - -void wxTextSnip::Read(long len, wxMediaStreamIn *f) -{ - int rv; - - if (len <= 0) - return; - - if (allocated < len) { - long l = 2 * len; - if (l < 0) { - Read(100, f); - return; - } - STRFREE(buffer); - if (l > 500) { - wxchar *ts; - ts = TRY_STRALLOC(l + 1); - buffer = ts; - if (!buffer) { - Read(100, f); - return; - } - } else { - buffer = STRALLOC(l + 1); - } - - allocated = l; - if (!buffer) - Read(10, f); - } - - dtext = 0; - rv = f->ReadingVersion(TheTextSnipClass); - if (rv < 2) { - int i; - /* Read Latin-1: */ - f->Get((long *)&len, (char *)buffer); - /* Expand out Latin-1: */ - for (i = len; i--; ) { - buffer[i] = ((unsigned char *)buffer)[i]; - } - count = len; - } else if (rv > 2) { - /* Read UTF-8: */ - char *ub, buf[128]; - long bl; - if (len > 128) - ub = new WXGC_ATOMIC char[len]; - else - ub = buf; - bl = len; - f->Get(&bl, ub); - len = scheme_utf8_decode((unsigned char *)ub, 0, bl, - buffer, 0, len, - NULL, 0, 1); - count = len; - } else { - /* Version 2 wrote out UTF-32 directly -- bad idea! - because it uses the machine's endianness. */ - len *= sizeof(wxchar); - f->Get((long *)&len, (char *)buffer); - count = len / sizeof(wxchar); - } - w = -1.0; -} - -#ifdef MEMORY_USE_METHOD -long wxTextSnip::MemoryUse(void) -{ - return allocated + wxObject::MemoryUse(); -} -#endif - -/***************************************************************/ - -class TabSnipClass : public TextSnipClass -{ - public: - TabSnipClass(void); - - virtual wxSnip *Read(wxMediaStreamIn *); -}; - -static TabSnipClass *TheTabSnipClass; - -TabSnipClass::TabSnipClass(void) -{ - classname = "wxtab"; - version = 1; - required = TRUE; -} - -wxSnip *TabSnipClass::Read(wxMediaStreamIn *f) -{ - wxTabSnip *ts; - ts = new WXGC_PTRS wxTabSnip(); - return TextSnipClass::Read(ts, f); -} - -/***************************************************************/ - -wxTabSnip::wxTabSnip() : wxTextSnip(1) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_TAB_SNIP; -#endif - - snipclass = TheTabSnipClass; - - flags |= wxSNIP_WIDTH_DEPENDS_ON_X; - flags -= (flags & wxSNIP_CAN_APPEND); -} - -void wxTabSnip::GetExtent(wxDC *dc, - double x, double y, - double *wi, double *h, - double *descent, double *space, - double *lspace, double *rspace) -{ - double *tabs, oldw; - double tabspace; - int n, i; - Bool changed; - - changed = (w < 0); - oldw = w; - - wxTextSnip::GetExtent(dc, x, y, wi, h, descent, space, lspace, rspace); - - if (changed) { - /* w is now width of a space */ - double mult; - wxMediaBuffer *media = NULL; - - if (admin && (media = admin->GetMedia()) && (media->bufferType == wxEDIT_BUFFER)) { - double space; - Bool units; - wxMediaEdit *edt; - - edt = (wxMediaEdit *)admin->GetMedia(); - tabs = edt->GetTabs(&n, &space, &units); - tabspace = space; - mult = units ? 1 : w; - } else { - n = 0; - tabs = NULL; - tabspace = wxTAB_WIDTH; - mult = 1; - } - - for (i = 0; i < n; i++) { - if (tabs[i] * mult > x) { - w = tabs[i] * mult - x; - break; - } - } - - if (i >= n) { - double base; - - base = tabs ? (tabs[n - 1] * mult) : 0; - x -= base; - - tabspace *= mult; - w = base + ((long)tabspace - ((long)x % (long)tabspace)); - } - - } else - w = oldw; - - if (wi) - *wi = w; -} - -double wxTabSnip::PartialOffset(wxDC *dc, double x, double y, long offset) -{ - double _w; - - if (!offset) - return 0; - else { - _w = 0.0; - GetExtent(dc, x, y, &_w); - return _w; - } -} - -void wxTabSnip::Draw(wxDC *, double, double, - double, double, double, double, - double, double, int) -{ - /* Do nothing! */ -} - -wxSnip *wxTabSnip::Copy() -{ - wxTabSnip *snip; - - snip = new WXGC_PTRS wxTabSnip(); - wxTextSnip::Copy(snip); - return snip; -} - -/***************************************************************/ - -#define IMG_MOVE_BUF_SIZE 500 - -class ImageSnipClass : public wxSnipClass -{ - public: - ImageSnipClass(void); - - virtual wxSnip *Read(wxMediaStreamIn *); -}; - -static ImageSnipClass *TheImageSnipClass; - -ImageSnipClass::ImageSnipClass(void) -{ - classname = "wximage"; - version = 2; - required = FALSE; -} - -wxSnip *ImageSnipClass::Read(wxMediaStreamIn *f) -{ - wxImageSnip *snip; - char *filename, *delfile = NULL, *loadfile; - long type; - Bool relative, inlined = FALSE; - double w, h, dx, dy; - wxStandardSnipClassList *scl; - Bool canInline; - - scl = wxGetTheSnipClassList(); - canInline = (f->ReadingVersion(this) > 1); - - filename = f->GetString(NULL); - f->Get(&type); - f->Get(&w); - f->Get(&h); - f->Get(&dx); - f->Get(&dy); - f->Get(&relative); - - loadfile = filename; - - if (filename && !*filename && canInline && type) { - /* read inlined image */ - - long len; - f->GetFixed(&len); - - if ((len > 0) && f->Ok()) { - char *fname; - FILE *fi; - char buffer[IMG_MOVE_BUF_SIZE + 1]; - - fname = wxGetTempFileName("img", NULL); - - fi = fopen(fname, "wb"); - if (fi) { - long c; - - while (len--) { - c = IMG_MOVE_BUF_SIZE + 1; - f->Get(&c, buffer); - - if (!f->Ok()) - break; - - c = fwrite(buffer, 1, c, fi); - } - fclose(fi); - - loadfile = fname; - type = wxBITMAP_TYPE_MASK; /* use a mask if available (PNG) */ - inlined = TRUE; - } - - delfile = fname; - } - } - - snip = new WXGC_PTRS wxImageSnip(loadfile, type, relative, inlined); - - if (delfile) { - wxRemoveFile(delfile); - } - - snip->Resize(w, h); - snip->SetOffset(dx, dy); - - return (wxSnip *)snip; -} - -/***************************************************************/ - -wxImageSnip::wxImageSnip(char *name, long type, Bool relative, Bool inlineImg) -{ - Init(); - - if (name && *name) - LoadFile(name, type, relative, inlineImg); -} - -wxImageSnip::wxImageSnip(wxBitmap *bm, wxBitmap *mask) -{ - Init(); - - SetBitmap(bm, mask); -} - -void wxImageSnip::Init(void) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_IMAGE_SNIP; -#endif - - snipclass = TheImageSnipClass; - - contentsChanged = TRUE; - filename = NULL; - filetype = 0; - relativePath = FALSE; - bm = NULL; - vieww = viewh = -1.0; - viewdx = viewdy = 0.0; -} - -wxImageSnip::~wxImageSnip() -{ -} - -void wxImageSnip::SizeCacheInvalid(void) -{ - contentsChanged = TRUE; -} - - -void wxImageSnip::GetExtent(wxDC *, - double WXUNUSED(x), - double WXUNUSED(y), - double *wi, double *hi, - double *descent, double *space, - double *lspace, double *rspace) -{ - if (contentsChanged) { - if (bm && bm->Ok()) { - if (viewh < 0) { - int bmh; - bmh = bm->GetHeight(); - h = bmh; - } else - h = viewh; - if (vieww < 0) { - int bmw; - bmw = bm->GetWidth(); - w = bmw; - } else - w = vieww; - } else { - h = w = 0; - } - if (!h) - h = IMAGE_VOID_SIZE; - if (!w) - w = IMAGE_VOID_SIZE; - } - - if (wi) - *wi = w; - if (hi) - *hi = h; - if (descent) { - if (!bm || !bm->Ok()) - *descent = 1; - else - *descent = 0; - } - ALWAYSZERO(space); - ALWAYSZERO(lspace); - ALWAYSZERO(rspace); -} - -void wxImageSnip::Draw(wxDC *dc, double x, double y, - double WXUNUSED(l), double WXUNUSED(t), - double WXUNUSED(r), double WXUNUSED(b), - double WXUNUSED(dx), double WXUNUSED(dy), - int) -{ - wxBitmap *msk; - - if (!bm || !bm->Ok()) { - dc->DrawRectangle(x + 1, y + 1, - w - 2 + GC_RECT_FRAME_EXTEND, - h - 2 + GC_RECT_FRAME_EXTEND); - dc->DrawLine(x + 1, y + 1, - x + w - 2 + GC_LINE_EXTEND, - y + h - 2 + GC_LINE_EXTEND); - dc->DrawLine(x + 1, y + h - 2, - x + w - 2 + GC_LINE_EXTEND, - y + 1 - GC_LINE_EXTEND); - return; - } - - if (mask) - msk = mask; - else { - msk = bm->GetMask(); - if (msk && (!msk->Ok() - || (msk->GetWidth() != w) - || (msk->GetHeight() != h))) - msk = NULL; - } - - dc->Blit(x, y, w, h, bm, 0, 0, wxCOPY, NULL, msk); - return; -} - -wxSnip *wxImageSnip::Copy(void) -{ - wxImageSnip *snip; - - snip = new WXGC_PTRS wxImageSnip(); - Copy(snip); - - return (wxSnip *)snip; -} - -void wxImageSnip::Write(wxMediaStreamOut *f) -{ - int writeBm = 0, writePm = 0; - - f->Put((filename ? filename : (char *)"")); - if (filename) - f->Put(filetype); - else { - if (!bm) - f->Put(0); - else if (bm->GetDepth() == 1) { - f->Put(1); - writeBm = 1; - } else { - f->Put(2); - writePm = 1; - } - } - f->Put(vieww); - f->Put(viewh); - f->Put(viewdx); - f->Put(viewdy); - f->Put(relativePath); - - /* inline the image */ - if (writeBm || writePm) { - FILE *fi; - char buffer[IMG_MOVE_BUF_SIZE]; - long lenpos, numlines = 0; - char *fname; - long end; - - lenpos = f->Tell(); - f->PutFixed(0); - - fname = wxGetTempFileName("img", NULL); - - bm->SaveFile(fname, wxBITMAP_TYPE_PNG); - - fi = fopen(fname, "rb"); - if (fi) { - while (1) { - int c; - c = fread(buffer, 1, IMG_MOVE_BUF_SIZE, fi); - if (c) { - numlines++; - f->Put(c, buffer); - } else - break; - } - fclose(fi); - } - - wxRemoveFile(fname); - - end = f->Tell(); - f->JumpTo(lenpos); - f->PutFixed(numlines); - f->JumpTo(end); - } -} - -void wxImageSnip::LoadFile(char *name, long type, Bool relative, Bool inlineImg) -{ - if (name && !*name) - name = NULL; - - SetBitmap(NULL, NULL, FALSE); - - if (relative && name) { -#ifdef wx_mac - if (name[0] != ':') { - int i; - for (i = 0; name[i]; i++) { - if (name[i] == ':') { - relative = FALSE; - break; - } - } - } -#else - if (name[0] == '/') - relative = FALSE; -#ifdef wx_msw - if (name[0] == '\\') - relative = FALSE; - if (name[0] && name[1] == ':') - relative = FALSE; -#endif -#ifdef wx_x - if (name[0] == '~') - relative = FALSE; -#endif -#endif - } - - relativePath = relative && name; - - if (relativePath) - flags |= wxSNIP_USES_BUFFER_PATH; - else if (flags & wxSNIP_USES_BUFFER_PATH) - flags -= wxSNIP_USES_BUFFER_PATH; - - if (name) { - char *loadname, *fn; - wxBitmap *nbm = NULL; - - loadname = name; - - if (!relativePath || admin) { - if (relativePath) { - wxMediaBuffer *b; - char *path; - - b = admin ? admin->GetMedia() : (wxMediaBuffer *)NULL; - fn = b ? b->GetFilename() : (char *)NULL; - if (fn) { - path = wxPathOnly(fn); - if (path) { - loadname = new WXGC_ATOMIC char[strlen(path) + strlen(name) + 2]; - strcpy(loadname, path); -#ifdef wx_x - strcat(loadname, "/"); -#else -#ifdef wx_mac - strcat(loadname, ":"); -#else - strcat(loadname, "\\"); -#endif -#endif - strcat(loadname, name); - } - } - } - - fn = (char *)wxmeExpandFilename(loadname, "load-file in image-snip%", 0); - - wxBeginBusyCursor(); - - nbm = new WXGC_PTRS wxBitmap(fn, type); - - wxEndBusyCursor(); - - if (!nbm->Ok()) { - DELETE_OBJ nbm; - nbm = NULL; - } - } - - if (!inlineImg) { - filename = copystring(name); - filetype = type; - } else - filename = NULL; - - if (nbm) - SetBitmap(nbm, NULL, FALSE); - } else { - filename = NULL; - } - - /* For refresh: */ - SetBitmap(bm, mask); -} - -void wxImageSnip::Copy(wxImageSnip *newSnip) -{ - wxSnip::Copy(newSnip); - - if (filename) { - newSnip->filename = copystring(filename); - } else - newSnip->filename = NULL; - newSnip->filetype = filetype; - newSnip->relativePath = relativePath; - - newSnip->vieww = vieww; - newSnip->viewh = viewh; - newSnip->viewdx = viewdx; - newSnip->viewdy = viewdy; - - newSnip->bm = bm; - newSnip->mask = mask; - - if (bm) - bm->selectedIntoDC++; - if (mask) - mask->selectedIntoDC++; -} - -char *wxImageSnip::GetFilename(Bool *rel) -{ - if (rel) - *rel = filename && relativePath; - - return filename; -} - -long wxImageSnip::GetFiletype() -{ - return filename ? 0 : filetype; -} - -void wxImageSnip::SetBitmap(wxBitmap *map, wxBitmap *msk, int refresh) -{ - if ((map && (map->selectedIntoDC < 0)) - || (msk && (msk->selectedIntoDC < 0))) - return; - - if (bm) - --bm->selectedIntoDC; - if (mask) - --mask->selectedIntoDC; - - bm = NULL; - mask = NULL; - - if ((!map || map->Ok()) - && (!msk || msk->Ok())) { - if (map) - map->selectedIntoDC++; - if (msk) - msk->selectedIntoDC++; - - bm = map; - mask = msk; - } - - if (refresh) { - contentsChanged = TRUE; - - if (admin) - admin->Resized(this, TRUE); - } -} - -wxBitmap *wxImageSnip::GetSnipBitmap() -{ - return bm; -} - -wxBitmap *wxImageSnip::GetSnipBitmapMask() -{ - return mask; -} - -void wxImageSnip::SetOffset(double x, double y) -{ - viewdx = x; - viewdy = y; - - contentsChanged = TRUE; - - if (admin) - admin->NeedsUpdate(this, 0, 0, w, h); -} - -Bool wxImageSnip::Resize(double w, double h) -{ - vieww = w; - viewh = h; - - contentsChanged = TRUE; - - if (admin) - admin->Resized(this, TRUE); - - return TRUE; -} - -long wxImageSnip::GetNumScrollSteps() -{ - long ss; - - ss = (long)(h / IMAGE_PIXELS_PER_SCROLL); - - return ss ? ss : 1; -} - -long wxImageSnip::FindScrollStep(double y) -{ - return (long)(y / IMAGE_PIXELS_PER_SCROLL); -} - -double wxImageSnip::GetScrollStepOffset(long i) -{ - return ((double )i) * IMAGE_PIXELS_PER_SCROLL; -} - -void wxImageSnip::SetAdmin(wxSnipAdmin *a) -{ - if (PTRNE(admin, a)) - wxSnip::SetAdmin(a); - if (admin && relativePath && filename) - LoadFile(filename, filetype, TRUE); -} - -/***************************************************************/ - -class MediaSnipClass : public wxSnipClass -{ - public: - MediaSnipClass(void); - - virtual wxSnip *Read(wxMediaStreamIn *); -}; - -static MediaSnipClass *TheMediaSnipClass; - -MediaSnipClass::MediaSnipClass(void) -{ - classname = "wxmedia"; - version = 4; - required = TRUE; -} - -wxSnip *MediaSnipClass::Read(wxMediaStreamIn *f) -{ - wxMediaBuffer *media; - wxMediaSnip *snip; - Bool border, tightFit = 0, alignTopLine = 0, useStyleBG = 0; - int lm, tm, rm, bm, li, ti, ri, bi, type; - double w, W, h, H; - wxStandardSnipClassList *scl; - - f->Get(&type); - f->Get(&border); - f->Get(&lm); - f->Get(&tm); - f->Get(&rm); - f->Get(&bm); - f->Get(&li); - f->Get(&ti); - f->Get(&ri); - f->Get(&bi); - f->Get(&w); - f->Get(&W); - f->Get(&h); - f->Get(&H); - - scl = wxGetTheSnipClassList(); - if (f->ReadingVersion(this) > 1) - f->Get(&tightFit); - if (f->ReadingVersion(this) > 2) - f->Get(&alignTopLine); - if (f->ReadingVersion(this) > 3) - f->Get(&useStyleBG); - - if (!type) - media = NULL; - else if (type == wxEDIT_BUFFER) - media = wxsMakeMediaEdit(); - else - media = wxsMakeMediaPasteboard(); - - if (lm < 0) lm = 0; - if (tm < 0) tm = 0; - if (rm < 0) rm = 0; - if (bm < 0) bm = 0; - if (li < 0) li = 0; - if (ti < 0) ti = 0; - if (ri < 0) ri = 0; - if (bi < 0) bi = 0; - - snip = wxsMakeMediaSnip(media, border, lm, tm, rm, bm, li, ti, ri, bi, - w, W, h, H); - if (tightFit) - snip->SetTightTextFit(1); - if (alignTopLine) - snip->SetAlignTopLine(1); - if (useStyleBG) - snip->UseStyleBG(1); - - if (media) { - wxStyleList *sl; - sl = media->GetStyleList(); - media->ReadFromFile(f, TRUE); - } else - snip->SetMedia(NULL); - - return snip; -} - -/***************************************************************/ - -wxSnipClassList::wxSnipClassList(void) -: wxList((KeyType)wxKEY_STRING, FALSE) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_SNIP_CLASS_LIST; -#endif -} - -wxSnipClassList::~wxSnipClassList() -{ -} - -wxSnipClass *wxSnipClassList::Find(char *name) -{ - wxNode *node; - - node = wxList::Find(name); - if (!node) { - /* invoke getter and try again */ - wxSnipClass *sc; - sc = wxGetSnipClass(name); - if (sc) - Add(sc); - node = wxList::Find(name); - } - - return node ? (wxSnipClass *)node->Data() : (wxSnipClass *)NULL; -} - -short wxSnipClassList::FindPosition(wxSnipClass *sclass) -{ - wxNode *node; - short i; - - for (i = 0, node = First(); node; node = node->Next(), i++) { - if (PTREQ(sclass, (wxSnipClass *)node->Data())) - return i; - } - - return -1; -} - -void wxSnipClassList::Add(wxSnipClass *snipclass) -{ - Append(snipclass->classname, snipclass); -} - -int wxSnipClassList::Number(void) -{ - return wxList::Number(); -} - -wxSnipClass *wxSnipClassList::Nth(int n) -{ - wxNode *node; - node = wxList::Nth(n); - - if (node) - return (wxSnipClass *)node->Data(); - else - return NULL; -} - -/***************************************************************/ - -wxStandardSnipClassList::wxStandardSnipClassList(void) -{ - wxList *ul; - - ul = new WXGC_PTRS wxList((KeyType)wxKEY_INTEGER); - unknowns = ul; - - Add(TheTextSnipClass); - Add(TheTabSnipClass); - Add(TheMediaSnipClass); - Add(TheImageSnipClass); -} - -void wxStandardSnipClassList::ResetHeaderFlags(wxMediaStream *s) -{ - s->sl = NULL; - s->dl = NULL; -} - -Bool wxStandardSnipClassList::Write(wxMediaStreamOut *f) -{ - wxNode *node; - wxSnipClass *sclass; - short i; - - f->Put(Number()); - - for (i = 0, node = First(); node; node = node->Next(), i++) { - wxSnipClassLink *sl; - - sclass = (wxSnipClass *)node->Data(); - f->Put(sclass->classname); - f->Put(sclass->version); - f->Put(sclass->required); - - sl = new WXGC_PTRS wxSnipClassLink; - sl->c= sclass; - sl->mapPosition = i; - sl->headerFlag = 0; - sl->next = f->sl; - f->sl = sl; - } - - return TRUE; -} - -Bool wxStandardSnipClassList::Read(wxMediaStreamIn *f) -{ - int count, i; - long _n; - char buffer[256]; - int version; - Bool required; - wxNode *node, *next; - wxSnipClassLink *sl; - - f->Get(&count); - - buffer[255] = 0; - - for (node = unknowns->First(); node; node = next) { - next = node->Next(); - DELETE_OBJ node; - } - - for (i = 0; i < count; i++) { - _n = 255; - f->Get((long *)&_n, (char *)buffer); - f->Get(&version); - f->Get(&required); - if (!f->Ok()) - return FALSE; - - sl = new WXGC_PTRS wxSnipClassLink; - sl->c = NULL; - sl->mapPosition = i; - sl->next = f->sl; - f->sl = sl; - sl->name = copystring(buffer); - sl->readingVersion = version; - } - - return TRUE; -} - -wxSnipClass *wxStandardSnipClassList::FindByMapPosition(wxMediaStream *f, short n) -{ - wxSnipClassLink *sl; - wxSnipClass *sclass; - - if (n < 0) - return NULL; - - for (sl = f->sl; sl; sl = sl->next) { - if (sl->mapPosition == n) { - if (sl->name) { - sclass = Find(sl->name); - if (!sclass || (sclass->version < sl->readingVersion)) { - /* unknown class/version */ - /* since we zero out sl->name, error is only shown once */ - char buffer2[256]; - sprintf(buffer2, "Unknown snip class or version: \"%.100s\" version %d.", sl->name, sl->readingVersion); - wxmeError(buffer2); - } else { - sl->c = sclass; - } - sl->name = NULL; - } - - return sl->c; - } - } - - return NULL; -} - -wxStandardSnipClassList *wxMakeTheSnipClassList(void) -{ - return new WXGC_PTRS wxStandardSnipClassList; -} - -/***************************************************************/ - -wxBufferDataClass::wxBufferDataClass() -: wxObject(WXGC_NO_CLEANUP) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_BUFFER_DATA_CLASS; -#endif - - classname = "wxbad"; - required = 0; -} - -wxBufferData::wxBufferData() -: wxObject(WXGC_NO_CLEANUP) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_BUFFER_DATA; -#endif - - next = NULL; -} - -wxBufferData::~wxBufferData() -{ - if (next) { - DELETE_OBJ next; - next = NULL; - } -} - -class LocationBufferDataClass : public wxBufferDataClass -{ - public: - LocationBufferDataClass(); - wxBufferData *Read(wxMediaStreamIn *); -}; - -LocationBufferDataClass::LocationBufferDataClass() -{ - classname = "wxloc"; - required = 1; -} - -wxBufferData *LocationBufferDataClass::Read(wxMediaStreamIn *f) -{ - wxLocationBufferData *data; - - data = new WXGC_PTRS wxLocationBufferData; - f->Get(&data->x); - f->Get(&data->y); - - return data; -} - -static LocationBufferDataClass *TheLocationBufferDataClass; - -wxLocationBufferData::wxLocationBufferData() -{ - x = y = 0; - dataclass = TheLocationBufferDataClass; -} - -Bool wxLocationBufferData::Write(wxMediaStreamOut *f) -{ - f->Put(x); - f->Put(y); - return TRUE; -} - -/**************************************************************/ - -wxBufferDataClassList::wxBufferDataClassList(void) -: wxList((KeyType)wxKEY_STRING, FALSE) -{ - wxList *ul; - -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_BUFFER_DATA_CLASS_LIST; -#endif - - ul = new WXGC_PTRS wxList((KeyType)wxKEY_INTEGER); - unknowns = ul; - - Add(TheLocationBufferDataClass); -} - -wxBufferDataClassList::~wxBufferDataClassList() -{ -} - -wxBufferDataClass *wxBufferDataClassList::Find(char *name) -{ - wxNode *node; - - node = wxList::Find(name); - - if (!node) { - /* invoke getter and try again */ - wxBufferDataClass *bdc; - bdc = wxGetEditorDataClass(name); - if (bdc) - Add(bdc); - node = wxList::Find(name); - } - - return node ? (wxBufferDataClass *)node->Data() : (wxBufferDataClass *)NULL; -} - -short wxBufferDataClassList::FindPosition(wxBufferDataClass *sclass) -{ - wxNode *node; - short i; - - for (i = 0, node = First(); node; node = node->Next(), i++) { - if (PTREQ(sclass, (wxBufferDataClass *)node->Data())) - return i + 1; - } - - return 0; -} - -void wxBufferDataClassList::Add(wxBufferDataClass *dataclass) -{ - Append(dataclass->classname, dataclass); -} - -int wxBufferDataClassList::Number(void) -{ - return wxList::Number(); -} - -wxBufferDataClass *wxBufferDataClassList::Nth(int n) -{ - wxNode *o; - - o = wxList::Nth(n); - - if (!o) - return NULL; - else - return (wxBufferDataClass *)o->Data(); -} - -Bool wxBufferDataClassList::Write(wxMediaStreamOut *f) -{ - wxNode *node; - wxBufferDataClass *sclass; - wxDataClassLink *dl; - short i; - - f->Put(Number()); - - for (i = 0, node = First(); node; node = node->Next(), i++) { - sclass = (wxBufferDataClass *)node->Data(); - f->Put(sclass->classname); - - dl = new WXGC_PTRS wxDataClassLink; - dl->d = sclass; - dl->mapPosition = i + 1; - dl->next = f->dl; - f->dl = dl; - } - - return TRUE; -} - -Bool wxBufferDataClassList::Read(wxMediaStreamIn *f) -{ - int _count, i; - long _n; - wxDataClassLink *dl; - char buffer[256]; - - f->Get(&_count); - - buffer[255] = 0; - - for (i = 0; i < _count; i++) { - _n = 255; - f->Get((long *)&_n, (char *)buffer); - if (!f->Ok()) - return FALSE; - - dl = new WXGC_PTRS wxDataClassLink; - dl->d = NULL; - dl->mapPosition = i + 1; - dl->next = f->dl; - f->dl = dl; - dl->name = copystring(buffer); - } - - return TRUE; -} - -wxBufferDataClass *wxBufferDataClassList::FindByMapPosition(wxMediaStream *f, short n) -{ - wxDataClassLink *dl; - wxBufferDataClass *sclass; - - if (n <= 0) - return NULL; - - for (dl = f->dl; dl; dl = dl->next) { - if (dl->mapPosition == n) { - if (dl->name) { - sclass = Find(dl->name); - if (!sclass) { - char buffer2[256]; - sprintf(buffer2, "Unknown snip data class or version: \"%.100s\".", dl->name); - wxmeError(buffer2); - } else - dl->d = sclass; - dl->name = NULL; - } - - return dl->d; - } - } - - return NULL; -} - -wxBufferDataClassList *wxMakeTheBufferDataClassList() -{ - return new WXGC_PTRS wxBufferDataClassList; -} - -/**************************************************/ - -void wxInitSnips(void) -{ - wxREGGLOB(TheTextSnipClass); - wxREGGLOB(TheTabSnipClass); - wxREGGLOB(TheMediaSnipClass); - wxREGGLOB(TheImageSnipClass); - wxREGGLOB(TheLocationBufferDataClass); - - - TheTextSnipClass = new WXGC_PTRS TextSnipClass; - TheTabSnipClass = new WXGC_PTRS TabSnipClass; - TheMediaSnipClass = new WXGC_PTRS MediaSnipClass; - TheImageSnipClass = new WXGC_PTRS ImageSnipClass; - TheLocationBufferDataClass = new WXGC_PTRS LocationBufferDataClass; -} diff --git a/src/mred/wxme/wx_snip.h b/src/mred/wxme/wx_snip.h deleted file mode 100644 index 7e9bc99a4a..0000000000 --- a/src/mred/wxme/wx_snip.h +++ /dev/null @@ -1,541 +0,0 @@ - -#ifndef __WX_SNIP__ -#define __WX_SNIP__ - -class wxSnipAdmin; - -/* The default is that none of these flags are on: */ -enum { - wxSNIP_IS_TEXT = 0x1, - wxSNIP_CAN_APPEND = 0x2, - wxSNIP_INVISIBLE = 0x4, - wxSNIP_NEWLINE = 0x8, /* Soft newline, typically inserted by wxMediaEdit */ - wxSNIP_HARD_NEWLINE = 0x10, /* => Snip must be follwed by newline */ - wxSNIP_HANDLES_EVENTS = 0x20, - wxSNIP_WIDTH_DEPENDS_ON_X = 0x40, - wxSNIP_HEIGHT_DEPENDS_ON_Y = 0x80, - wxSNIP_WIDTH_DEPENDS_ON_Y = 0x100, - wxSNIP_HEIGHT_DEPENDS_ON_X = 0x200, - wxSNIP_ANCHORED = 0x400, - wxSNIP_USES_BUFFER_PATH = 0x800, - wxSNIP_CAN_SPLIT = 0x1000, /* safety feature */ - wxSNIP_OWNED = 0x2000, - wxSNIP_CAN_DISOWN = 0x4000 -}; - -extern void wxInitSnips(void); - -#define WRITE_FUNC \ - Bool wxmbWriteSnipsToFile(class wxMediaStreamOut *, \ - class wxStyleList *, \ - class wxList *, class wxSnip *, \ - class wxSnip *, wxList *, \ - class wxMediaBuffer *) - -class wxSnip; -extern WRITE_FUNC; - -class wxSnipClass : public wxObject -{ - public: - char *classname; - int version; - - /* If this flag is TRUE, then files saved to disk will be written - assuming that, when the file is read from disk, the class will - always be present. */ - Bool required; - - wxSnipClass(); - - virtual wxSnip *Read(wxMediaStreamIn *) = 0; - - virtual Bool ReadHeader(wxMediaStreamIn *); - - virtual Bool WriteHeader(wxMediaStreamOut *); - - int ReadingVersion(wxMediaStreamIn *); -}; - -class wxSnipClassList : public /* should be private */ wxList -{ - public: - wxSnipClassList(void); - ~wxSnipClassList(); - - wxSnipClass *Find(char *name); - short FindPosition(wxSnipClass *); - int ReadingVersion(wxSnipClass *); - void Add(wxSnipClass *snipclass); /* Checks for duplicates */ - int Number(void); - wxSnipClass *Nth(int); -}; - -enum { - wxRESET_NO_MSG = 0, - wxRESET_DONE_READ, - wxRESET_DONE_WRITE -}; - -class wxStandardSnipClassList : public wxSnipClassList -{ - private: - wxList *unknowns; - - public: - wxStandardSnipClassList(void); - - void ResetHeaderFlags(wxMediaStream *s); - Bool Write(wxMediaStreamOut *f); - Bool Read(wxMediaStreamIn *f); - wxSnipClass *FindByMapPosition(wxMediaStream *f, short n); -}; - -extern wxStandardSnipClassList *wxMakeTheSnipClassList(); -extern wxStandardSnipClassList *wxGetTheSnipClassList(); -#define wxTheSnipClassList (*wxGetTheSnipClassList()) - -extern wxSnipClass *wxGetSnipClass(const char *name); - -/******************************************************************/ - -class wxMediaLine; - -class wxSnip : public wxObject -{ - private: - friend class wxMediaEdit; - friend class wxMediaPasteboard; - friend class wxMediaBuffer; - friend class wxMediaLine; - friend WRITE_FUNC; - - /* For use only by the owning wxMediaBuffer */ - wxSnip *prev, *next; - wxMediaLine *line; - - void Init(void); - - protected: - wxSnipAdmin *admin; - - public: - long count; - long flags; - wxSnipClass *snipclass; - wxStyle *style; - - wxSnip(); - wxSnip(Bool cleanup); - ~wxSnip(); - - wxSnip *Next(void); - wxSnip *Previous(void); - - wxSnipAdmin *GetAdmin(void); - virtual void SetAdmin(wxSnipAdmin *); - - Bool IsOwned(void); - Bool ReleaseFromOwner(void); - - void SetCount(long count); - void SetFlags(long flags); - - virtual void OnEvent(wxDC *dc, double x, double y, - double mediax, double mediay, - wxMouseEvent *event); - virtual void OnChar(wxDC *dc, double x, double y, - double mediax, double mediay, - wxKeyEvent *event); - virtual wxCursor *AdjustCursor(wxDC *dc, double x, double y, - double mediax, double mediay, - wxMouseEvent *event); - virtual void OwnCaret(Bool); - virtual void BlinkCaret(wxDC *dc, double x, double y); - - virtual void DoEdit(int op, Bool recursive = TRUE, long time = 0); - virtual Bool CanEdit(int op, Bool recursive = TRUE); - virtual void DoFont(int op, Bool recursive = TRUE); - - virtual int Match(wxSnip *other); - - virtual void SizeCacheInvalid(void); - - virtual void GetExtent(wxDC *dc, - double x, double y, - double *w = NULL, double *h = NULL, - double *descent = NULL, double *space = NULL, - double *lspace = NULL, double *rspace = NULL); - virtual double PartialOffset(wxDC *, double x, double y, long); - - virtual void Draw(wxDC *dc, double x, double y, - double,double,double,double, - double dx, double xy, - int show_caret); - virtual void Split(long position, wxSnip **first, wxSnip **second); - virtual wxSnip *MergeWith(wxSnip *pred); - virtual void GetTextBang(wxchar *s, long offset, long num, long dt); - virtual wxchar *GetText(long offset, long num, Bool flattened = FALSE, long *got=NULL); - virtual char *GetTextUTF8(long offset, long num, Bool flattened = FALSE, long *got=NULL); - virtual wxSnip *Copy(); - virtual void Write(wxMediaStreamOut *f); - - virtual Bool Resize(double w, double h); - - virtual long GetNumScrollSteps(); - virtual long FindScrollStep(double y); - virtual double GetScrollStepOffset(long i); - - virtual void SetUnmodified(); - - void SetStyle(wxStyle *s); - - protected: - void Copy(wxSnip *); /* Copy basic values into given snip */ -}; - -class wxInternalSnip : public wxSnip -{ - public: - wxInternalSnip(); - wxInternalSnip(Bool cleanup); - void SetCount(long count); -}; - -class wxTextSnip : public wxInternalSnip -{ - protected: - double w; /* < 0 => need to recalc size */ - - void GetTextExtent(wxDC *dc, int count, double *wo); - - void Init(long allocsize); - - public: - long dtext; - wxchar *buffer; - - long allocated; - - wxTextSnip(long allocsize = 0); - wxTextSnip(wxchar *initstring, long len); - wxTextSnip(char *initstring, long len); - ~wxTextSnip(); - - virtual void SizeCacheInvalid(void); - - virtual void GetExtent(wxDC *dc, - double x, double y, - double *w = NULL, double *h = NULL, - double *descent = NULL, double *space = NULL, - double *lspace = NULL, double *rspace = NULL); - virtual double PartialOffset(wxDC *, double x, double y, long); - virtual void Draw(wxDC *dc, double x, double y, - double,double,double,double, - double dx, double dy, int); - virtual void Split(long position, wxSnip **first, wxSnip **second); - virtual wxSnip *MergeWith(wxSnip *pred); - - virtual void Insert(wxchar *str, long len, long pos = 0); - virtual void InsertWithOffset(wxchar *str, long len, long delta, long pos = 0); - virtual void InsertUTF8(char *str, long len, long pos = 0); - virtual void Read(long len, wxMediaStreamIn *f); - virtual void GetTextBang(wxchar *s, long offset, long num, long dt); - virtual wxchar *GetText(long offset, long num, Bool flattened = FALSE, long *got=NULL); - virtual wxSnip *Copy(void); - virtual void Write(wxMediaStreamOut *f); - - -#ifdef MEMORY_USE_METHOD - long MemoryUse(void); -#endif - - protected: - void Copy(wxTextSnip *); /* Copy text values into given snip */ -}; - -class wxTabSnip : public wxTextSnip -{ - public: - wxTabSnip(); - - virtual void GetExtent(wxDC *dc, - double x, double y, - double *w = NULL, double *h = NULL, - double *descent = NULL, double *space = NULL, - double *lspace = NULL, double *rspace = NULL); - virtual double PartialOffset(wxDC *, double x, double y, long); - virtual void Draw(wxDC *dc, double x, double y, - double,double,double,double, - double dx, double dy, int); - virtual wxSnip *Copy(); -}; - -class wxImageSnip : public wxInternalSnip -{ - private: - char *filename; - long filetype; /* file != NULL => type of file, otherwise loaded 1 => XBM and 2 => XPM */ - wxBitmap *bm, *mask; - Bool relativePath; - - void Init(void); - - protected: - double w, h, vieww, viewh, viewdx, viewdy; - Bool contentsChanged; - - public: - wxImageSnip(char *name = NULL, long type = 0, Bool relative = FALSE, Bool inlineImg = TRUE); - wxImageSnip(wxBitmap *bm, wxBitmap *mask = NULL); - ~wxImageSnip(); - - virtual void SizeCacheInvalid(void); - - virtual void GetExtent(wxDC *dc, - double x, double y, - double *w = NULL, double *h = NULL, - double *descent = NULL, double *space = NULL, - double *lspace = NULL, double *rspace = NULL); - - virtual void Draw(wxDC *dc, double x, double y, - double,double,double,double, - double dx, double dy, int); - - virtual wxSnip *Copy(void); - - virtual void Write(wxMediaStreamOut *f); - - void LoadFile(char *name, long type, Bool relative = FALSE, Bool inlineImg = TRUE); - char *GetFilename(Bool *relative); - long GetFiletype(); - - void SetBitmap(wxBitmap *, wxBitmap *mask = NULL, int refresh = TRUE); - wxBitmap *GetSnipBitmap(); - wxBitmap *GetSnipBitmapMask(); - - void SetOffset(double dx, double dy); - virtual Bool Resize(double w, double h); - - virtual long GetNumScrollSteps(); - virtual long FindScrollStep(double y); - virtual double GetScrollStepOffset(long i); - - virtual void SetAdmin(wxSnipAdmin *); - - protected: - void Copy(wxImageSnip *); -}; - -class wxSnipAdmin : public wxObject -{ - public: - inline wxSnipAdmin(); - - virtual wxMediaBuffer *GetMedia(void) = 0; - - virtual wxDC *GetDC() = 0; - virtual void GetViewSize(double *h, double *w) = 0; - virtual void GetView(double *x, double *y, double *h, double *w, wxSnip *snip = NULL) = 0; - virtual Bool ScrollTo(wxSnip *, double localx, double localy, - double w, double h, Bool refresh, int bias = 0) = 0; - virtual void SetCaretOwner(wxSnip *, int = wxFOCUS_IMMEDIATE) = 0; - virtual void Resized(wxSnip *, Bool redraw_now) = 0; - virtual Bool Recounted(wxSnip *, Bool redraw_now) = 0; - virtual void NeedsUpdate(wxSnip *, double localx, double localy, - double w, double h) = 0; - virtual Bool ReleaseSnip(wxSnip *) = 0; - - virtual void UpdateCursor() = 0; - virtual Bool PopupMenu(void *m, wxSnip *s, double x, double y) = 0; - - virtual void Modified(wxSnip *s, Bool mod) = 0; -}; - -inline wxSnipAdmin::wxSnipAdmin() - : wxObject(WXGC_NO_CLEANUP) -{ -} - -#define wxMSNIPBOX_XMARGIN 5 -#define wxMSNIPBOX_YMARGIN 5 -#define wxMSNIPBOX_XINSET 1 -#define wxMSNIPBOX_YINSET 1 - -class wxMediaSnipMediaAdmin; - -class wxMediaSnip : public wxInternalSnip -{ - friend class wxMediaSnipMediaAdmin; - - wxMediaBuffer *me; - wxMediaSnipMediaAdmin *myAdmin; - -#define TF_Flag(var) unsigned var : 1 - TF_Flag( withBorder ); - TF_Flag( tightFit ); - TF_Flag( alignTopLine ); - TF_Flag( useStyleBG ); -#undef TF_Flag - - int leftMargin, topMargin, rightMargin, bottomMargin; - int leftInset, topInset, rightInset, bottomInset; - - double minWidth, maxWidth, minHeight, maxHeight; - - public: - wxMediaSnip(wxMediaBuffer *useme = NULL, - Bool withBorder = TRUE, - int leftMargin = wxMSNIPBOX_XMARGIN, - int topMargin = wxMSNIPBOX_YMARGIN, - int rightMargin = wxMSNIPBOX_XMARGIN, - int bottomMargin = wxMSNIPBOX_YMARGIN, - int leftInset = wxMSNIPBOX_XINSET, - int topInset = wxMSNIPBOX_YINSET, - int rightInset = wxMSNIPBOX_XINSET, - int bottomInset = wxMSNIPBOX_YINSET, - double w = -1, double W = -1, - double h = -1, double H = -1); - ~wxMediaSnip(); - - virtual void SetAdmin(wxSnipAdmin *a); - - virtual void OnEvent(wxDC *, double, double, double,double, wxMouseEvent *event); - virtual void OnChar(wxDC *, double, double, double, double, wxKeyEvent *event); - virtual wxCursor *AdjustCursor(wxDC *, double, double, double,double, wxMouseEvent *event); - virtual void OwnCaret(Bool); - virtual void BlinkCaret(wxDC *dc, double x, double y); - - virtual void DoEdit(int op, Bool recursive = TRUE, long time = 0); - virtual Bool CanEdit(int op, Bool recursive = TRUE); - virtual void DoFont(int op, Bool recursive = TRUE); - - virtual Bool Match(wxSnip *other); - - virtual void SizeCacheInvalid(void); - - virtual wxchar *GetText(long offset, long num, Bool flattened = FALSE, long *got = NULL); - - virtual void GetExtent(wxDC *dc, - double x, double y, - double *w = NULL, double *h = NULL, - double *descent = NULL, double *space = NULL, - double *lspace = NULL, double *rspace = NULL); - virtual void Draw(wxDC *dc, double x, double y, - double, double, double, double, double dx, double dy, - int show_caret); - virtual wxSnip *Copy(void); - - virtual void Write(wxMediaStreamOut *f); - - virtual long GetNumScrollSteps(); - virtual long FindScrollStep(double y); - virtual double GetScrollStepOffset(long i); - - void SetMaxWidth(double); - void SetMaxHeight(double); - double GetMaxWidth(void); - double GetMaxHeight(void); - void SetMinWidth(double); - void SetMinHeight(double); - double GetMinWidth(void); - double GetMinHeight(void); - - Bool GetTightTextFit(void); - void SetTightTextFit(Bool); - Bool GetAlignTopLine(void); - void SetAlignTopLine(Bool); - - void ShowBorder(Bool show); - Bool BorderVisible(); - void UseStyleBG(Bool useit); - Bool StyleBGUsed(); - - void SetMargin(int lm, int tm, int rm, int bm); - void GetMargin(int *lm, int *tm, int *rm, int *bm); - void SetInset(int lm, int tm, int rm, int bm); - void GetInset(int *li, int *ti, int *ri, int *bi); - - virtual Bool Resize(double w, double h); - - void SetUnmodified(); - - wxMediaBuffer *GetThisMedia(void); - void SetMedia(wxMediaBuffer *b); - - void RequestRefresh(); -}; - -/**********************************************************************/ - -class wxMediaStreamOut; -class wxBufferData; - -class wxBufferDataClass : public wxObject -{ - private: - friend class wxBufferDataClassList; - friend class wxMediaBuffer; - friend WRITE_FUNC; - friend Bool wxmbWriteBufferData(wxMediaStreamOut *, wxBufferData *data); - - public: - char *classname; - Bool required; - - wxBufferDataClass(); - - virtual wxBufferData *Read(wxMediaStreamIn *) = 0; -}; - -class wxBufferData : public wxObject -{ - public: - wxBufferDataClass *dataclass; - wxBufferData *next; /* Used to chain them in a list */ - - wxBufferData(); - ~wxBufferData(); - - virtual Bool Write(wxMediaStreamOut *) = 0; -}; - -class wxBufferDataClassList : public /* should be private */ wxList -{ - private: - wxList *unknowns; - - public: - wxBufferDataClassList(); - ~wxBufferDataClassList(); - - wxBufferDataClass *Find(char *name); - short FindPosition(wxBufferDataClass *); - void Add(wxBufferDataClass *dataclass); /* Checks for duplicates */ - int Number(void); - wxBufferDataClass *Nth(int); - - Bool Write(wxMediaStreamOut *f); - Bool Read(wxMediaStreamIn *f); - wxBufferDataClass *FindByMapPosition(wxMediaStream *f, short n); -}; - -extern wxBufferDataClassList *wxMakeTheBufferDataClassList(); -extern wxBufferDataClassList *wxGetTheBufferDataClassList(); -#define wxTheBufferDataClassList (*wxGetTheBufferDataClassList()) - -extern wxBufferDataClass *wxGetEditorDataClass(const char *name); - -/**********************************************************************/ - -class wxLocationBufferData : public wxBufferData -{ - public: - double x, y; - - wxLocationBufferData(); - - Bool Write(wxMediaStreamOut *); -}; - -#endif /* __WX_SNIP__ */ diff --git a/src/mred/wxme/wx_style.cxx b/src/mred/wxme/wx_style.cxx deleted file mode 100644 index af6506447f..0000000000 --- a/src/mred/wxme/wx_style.cxx +++ /dev/null @@ -1,1894 +0,0 @@ -/* - * File: wx_style.cc - * Purpose: wxStyle and wxStyleList implementation - * Author: Matthew Flatt - * Created: 1995 - * Copyright: (c) 2004-2009 PLT Scheme Inc. - * Copyright: (c) 1995, Matthew Flatt - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301 USA. - - */ - -#if defined(_MSC_VER) && defined(MZ_PRECISE_GC) -# include "wx.h" -#endif -#include "common.h" -#include "wx_gdi.h" -#include "wx_main.h" -#include "wx_dialg.h" -#ifndef OLD_WXWINDOWS -# include "wx_cmdlg.h" -#endif -#include "wx_style.h" -#include "wx_mtype.h" -#include "wx_medio.h" -#include "wx_ptreq.h" -#include -#include "scheme.h" - -#ifdef wx_x -static int defaultSize = 12; -#endif -#ifdef wx_msw -static int defaultSize = 10; -#endif -#ifdef wx_mac -static int defaultSize = 12; -#endif - -# define FONT_DIRECTORY wxTheFontNameDirectory - -extern void wxmeError(const char *e); -extern int wxGetPreference(const char *, int *); - -wxStyleList *wxTheStyleList; - -static wxStyleDelta *quick_delta; - -#ifdef WX_USE_XFT -extern int wxXRenderHere(void); -#endif - -void wxInitStyles(void) -{ - if (wxTheStyleList) - return; - -#ifdef WX_USE_XFT - if (wxXRenderHere()) - defaultSize = 11; -#endif - - wxGetPreference("default-font-size", &defaultSize); - - wxREGGLOB(wxTheStyleList); - wxTheStyleList = new WXGC_PTRS wxStyleList; - - wxREGGLOB(quick_delta); -} - -void wxMultColour::Get(double *rf, double *gf, double *bf) -{ - *rf = r; - *gf = g; - *bf = b; -} - -void wxMultColour::Set(double rf, double gf, double bf) -{ - r = rf; - g = gf; - b = bf; -} - -void wxAddColour::Get(short *rf, short *gf, short *bf) -{ - *rf = r; - *gf = g; - *bf = b; -} - -void wxAddColour::Set(short rf, short gf, short bf) -{ - r = rf; - g = gf; - b = bf; -} - -wxStyleDelta::wxStyleDelta(int changeCommand, int param) -: wxObject(WXGC_NO_CLEANUP) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_STYLE_DELTA; -#endif - - face = NULL; - - SetDelta(wxCHANGE_NOTHING); - SetDelta(changeCommand, param); -} - -wxStyleDelta::~wxStyleDelta() -{ -} - -wxStyleDelta *wxStyleDelta::SetDelta(int changeCommand, int param) -{ - switch (changeCommand) { - case wxCHANGE_NOTHING: - family = wxBASE; - face = NULL; - sizeMult = 1; - sizeAdd = 0; - weightOn = wxBASE; - weightOff = wxBASE; - styleOn = wxBASE; - styleOff = wxBASE; - smoothingOn = wxBASE; - smoothingOff = wxBASE; - underlinedOn = underlinedOff = FALSE; - sipOn = sipOff = FALSE; - transparentTextBackingOn = transparentTextBackingOff = FALSE; - foregroundMult = new WXGC_PTRS wxMultColour; - foregroundMult->Set(1, 1, 1); - foregroundAdd = new WXGC_PTRS wxAddColour; - foregroundAdd->Set(0, 0, 0); - backgroundMult = new WXGC_PTRS wxMultColour; - backgroundMult->Set(1, 1, 1); - backgroundAdd = new WXGC_PTRS wxAddColour; - backgroundAdd->Set(0, 0, 0); - alignmentOn = wxBASE; - alignmentOff = wxBASE; - break; - case wxCHANGE_STYLE: - styleOn = param; - styleOff = wxBASE; - break; - case wxCHANGE_WEIGHT: - weightOn = param; - weightOff = wxBASE; - break; - case wxCHANGE_SMOOTHING: - smoothingOn = param; - smoothingOff = wxBASE; - break; - case wxCHANGE_UNDERLINE: - underlinedOn = param; - underlinedOff = !param; - break; - case wxCHANGE_SIP: - sipOn = param; - sipOff = !param; - break; - case wxCHANGE_SIZE: - sizeMult = 0; - sizeAdd = param; - break; - case wxCHANGE_FAMILY: - family = param; - face = NULL; - break; - case wxCHANGE_ALIGNMENT: - alignmentOn = param; - alignmentOff = wxBASE; - break; - case wxCHANGE_BOLD: - weightOn = wxBOLD; - weightOff = wxBASE; - break; - case wxCHANGE_ITALIC: - styleOn = wxITALIC; - styleOff = wxBASE; - break; - case wxCHANGE_TOGGLE_STYLE: - styleOn = param; - styleOff = param; - break; - case wxCHANGE_TOGGLE_WEIGHT: - weightOn = param; - weightOff = param; - break; - case wxCHANGE_TOGGLE_SMOOTHING: - smoothingOn = param; - smoothingOff = param; - break; - case wxCHANGE_TOGGLE_UNDERLINE: - underlinedOn = TRUE; - underlinedOff = TRUE; - break; - case wxCHANGE_TOGGLE_SIP: - sipOn = TRUE; - sipOff = TRUE; - break; - case wxCHANGE_BIGGER: - sizeMult = 1; - sizeAdd = param; - break; - case wxCHANGE_SMALLER: - sizeMult = 1; - sizeAdd = -param; - break; - case wxCHANGE_NORMAL: - family = wxDEFAULT; - face = NULL; - sizeMult = 0; - sizeAdd = defaultSize; - weightOn = wxNORMAL; - weightOff = wxBASE; - styleOn = wxNORMAL; - styleOff = wxBASE; - smoothingOn = wxSMOOTHING_DEFAULT; - smoothingOff = wxBASE; - underlinedOn = FALSE; - underlinedOff = TRUE; - sipOn = FALSE; - sipOff = TRUE; - alignmentOn = wxALIGN_BOTTOM; - alignmentOff = wxBASE; - /* fall through ... */ - case wxCHANGE_NORMAL_COLOUR: /* ^^ falls through */ - foregroundMult->Set(0, 0, 0); - foregroundAdd->Set(0, 0, 0); - backgroundMult->Set(0, 0, 0); - backgroundAdd->Set(255, 255, 255); - break; - } - - return this; -} - -wxStyleDelta *wxStyleDelta::SetDeltaFace(char *name, int fam) -{ - face = copystring(name); - family = fam; - - return this; -} - -wxStyleDelta *wxStyleDelta::SetDeltaBackground(char *name) -{ - wxColour *c; - - transparentTextBackingOn = FALSE; - transparentTextBackingOff = TRUE; - - if ((c = wxTheColourDatabase->FindColour(name))) - SetDeltaBackground(c); - - return this; -} - -wxStyleDelta *wxStyleDelta::SetDeltaBackground(wxColour *colour) -{ - unsigned char r, g, b; - - transparentTextBackingOn = FALSE; - transparentTextBackingOff = TRUE; - - backgroundMult->Set(0, 0, 0); - colour->Get(&r, &g, &b); - backgroundAdd->Set(r, g, b); - - return this; -} - -wxStyleDelta *wxStyleDelta::SetDeltaForeground(char *name) -{ - wxColour *c; - - if ((c = wxTheColourDatabase->FindColour(name))) - SetDeltaForeground(c); - return this; -} - -wxStyleDelta *wxStyleDelta::SetDeltaForeground(wxColour *colour) -{ - unsigned char r, g, b; - - foregroundMult->Set(0, 0, 0); - colour->Get(&r, &g, &b); - foregroundAdd->Set(r, g, b); - return this; -} - -Bool wxStyleDelta::Collapse(wxStyleDelta *deltaIn) -{ - double ambr, ambb, ambg, amfr, amfb, amfg; - double bmbr, bmbb, bmbg, bmfr, bmfb, bmfg; - short aabr, aabb, aabg, aafr, aafb, aafg; - short babr, babb, babg, bafr, bafb, bafg; - - /* If collapsing possible? */ - /* It may not be if add & multiply sequence occurs, */ - /* or certain toggling settings conflict or */ - if (sizeMult && sizeMult != 1.0 && deltaIn->sizeAdd != 0) - return FALSE; - - foregroundMult->Get(&amfr, &amfb, &amfg); - backgroundMult->Get(&ambr, &ambb, &ambg); - deltaIn->foregroundAdd->Get(&bafr, &bafb, &bafg); - deltaIn->backgroundAdd->Get(&babr, &babb, &babg); - if ((amfr && amfr != 1.0 && bafr != 0) - || (amfg && amfg != 1.0 && bafg != 0) - || (amfb && amfb != 1.0 && bafb != 0) - || (ambr && ambr != 1.0 && babr != 0) - || (ambg && ambg != 1.0 && babg != 0) - || (ambb && ambb != 1.0 && babb != 0)) - return FALSE; - - // Cases: simple or double toggle - // no further change - // formerly no change - // style definitely on - // style definitely off - if (!((styleOn == deltaIn->styleOn && styleOff == deltaIn->styleOff) - || (styleOn == wxBASE && styleOff == wxBASE) - || (deltaIn->styleOn == wxBASE && deltaIn->styleOff == wxBASE) - || (styleOn == wxBASE && styleOff != wxBASE) - || (styleOff == wxBASE && styleOn != wxBASE))) - return FALSE; - if (!((weightOn == deltaIn->weightOn && weightOff == deltaIn->weightOff) - || (weightOn == wxBASE && weightOff == wxBASE) - || (weightOn == wxBASE && weightOff != wxBASE) - || (weightOff == wxBASE && weightOn != wxBASE))) - return FALSE; - if (!((smoothingOn == deltaIn->smoothingOn && smoothingOff == deltaIn->smoothingOff) - || (smoothingOn == wxBASE && smoothingOff == wxBASE) - || (smoothingOn == wxBASE && smoothingOff != wxBASE) - || (smoothingOff == wxBASE && smoothingOn != wxBASE))) - return FALSE; - if (!((alignmentOn == deltaIn->alignmentOn - && alignmentOff == deltaIn->alignmentOff) - || (alignmentOn == wxBASE && alignmentOff == wxBASE) - || (alignmentOn == wxBASE && alignmentOff != wxBASE) - || (alignmentOff == wxBASE && alignmentOn != wxBASE))) - return FALSE; - - if (!((underlinedOn == deltaIn->underlinedOn - && underlinedOff == deltaIn->underlinedOff) - || (!underlinedOn && !underlinedOff) - || (!deltaIn->underlinedOn && !deltaIn->underlinedOff) - || (!underlinedOn && underlinedOff) - || (!underlinedOff && underlinedOn))) - return FALSE; - - if (!((sipOn == deltaIn->sipOn - && sipOff == deltaIn->sipOff) - || (!sipOn && !sipOff) - || (!deltaIn->sipOn && !deltaIn->sipOff) - || (!sipOn && sipOff) - || (!sipOff && sipOn))) - return FALSE; - - if (!((transparentTextBackingOn == deltaIn->transparentTextBackingOn - && transparentTextBackingOff == deltaIn->transparentTextBackingOff) - || (!transparentTextBackingOn && !transparentTextBackingOff) - || (!deltaIn->transparentTextBackingOn && !deltaIn->transparentTextBackingOff) - || (!transparentTextBackingOn && transparentTextBackingOff) - || (!transparentTextBackingOff && transparentTextBackingOn))) - return FALSE; - - /* Collapsing is possible. */ - - deltaIn->foregroundMult->Get(&bmfr, &bmfb, &bmfg); - deltaIn->backgroundMult->Get(&bmbr, &bmbb, &bmbg); - foregroundAdd->Get(&aafr, &aafb, &aafg); - backgroundAdd->Get(&aabr, &aabb, &aabg); - - sizeAdd += (int)(sizeMult * deltaIn->sizeAdd); - sizeMult *= deltaIn->sizeMult; - - foregroundMult->Set(amfr * bmfr, amfb * bmfb, amfg * bmfg); - backgroundMult->Set(ambr * bmbr, ambb * bmbb, ambg * bmbg); - foregroundAdd->Set(aafr + (int)(amfr * bafr), - aafb + (int)(amfb * bafb), - aafg + (int)(amfg * bafg)); - backgroundAdd->Set(aabr + (int)(ambr * babr), - aabb + (int)(ambb * babb), - aabg + (int)(ambg * babg)); - - if (family == wxBASE) { - family = deltaIn->family; - if (!face) { - face = deltaIn->face; - } - } - - if (styleOn == wxBASE && styleOff == wxBASE) { - styleOff = deltaIn->styleOff; - styleOn = deltaIn->styleOn; - } else if (styleOn != wxBASE && styleOff != wxBASE) { - if (deltaIn->styleOn != wxBASE || deltaIn->styleOff != wxBASE - && styleOn == styleOff) - styleOn = styleOff = wxBASE; // Double toggle - } - if (weightOn == wxBASE && weightOff == wxBASE) { - weightOff = deltaIn->weightOff; - weightOn = deltaIn->weightOn; - } else if (weightOn != wxBASE && weightOff != wxBASE) { - if (deltaIn->weightOn != wxBASE || deltaIn->weightOff != wxBASE - && weightOn == weightOff) - weightOn = weightOff = wxBASE; // Double toggle - } - if (smoothingOn == wxBASE && smoothingOff == wxBASE) { - smoothingOff = deltaIn->smoothingOff; - smoothingOn = deltaIn->smoothingOn; - } else if (smoothingOn != wxBASE && smoothingOff != wxBASE) { - if (deltaIn->smoothingOn != wxBASE || deltaIn->smoothingOff != wxBASE - && smoothingOn == smoothingOff) - smoothingOn = smoothingOff = wxBASE; // Double toggle - } - if (alignmentOn == wxBASE && alignmentOff == wxBASE) { - alignmentOff = deltaIn->alignmentOff; - alignmentOn = deltaIn->alignmentOn; - } else if (alignmentOn != wxBASE && alignmentOff != wxBASE) { - if (deltaIn->alignmentOn != wxBASE || deltaIn->alignmentOff != wxBASE - && alignmentOn == alignmentOff) - alignmentOn = alignmentOff = wxBASE; // Double toggle - } - if (!underlinedOn && !underlinedOff) { - underlinedOn = deltaIn->underlinedOn; - underlinedOff = deltaIn->underlinedOff; - } else if (underlinedOn && underlinedOff) { - if (deltaIn->underlinedOn && deltaIn->underlinedOff) - underlinedOn = underlinedOff = FALSE; - } - if (!sipOn && !sipOff) { - sipOn = deltaIn->sipOn; - sipOff = deltaIn->sipOff; - } else if (sipOn && sipOff) { - if (deltaIn->sipOn && deltaIn->sipOff) - sipOn = sipOff = FALSE; - } - if (!transparentTextBackingOn && !transparentTextBackingOff) { - transparentTextBackingOn = deltaIn->transparentTextBackingOn; - transparentTextBackingOff = deltaIn->transparentTextBackingOff; - } else if (transparentTextBackingOn && transparentTextBackingOff) { - if (deltaIn->transparentTextBackingOn && deltaIn->transparentTextBackingOff) - transparentTextBackingOn = transparentTextBackingOff = FALSE; - } - - return TRUE; -} - -Bool wxStyleDelta::Equal(wxStyleDelta *deltaIn) -{ -#define SAME_C(fld) ((fld->r == deltaIn->fld->r) \ - && (fld->g == deltaIn->fld->g) \ - && (fld->b == deltaIn->fld->b)) - - return ((family == deltaIn->family) - && ((face && deltaIn->face && !strcmp(face, deltaIn->face)) - || (!face && !deltaIn->face)) - && sizeMult == deltaIn->sizeMult - && sizeAdd == deltaIn->sizeAdd - && weightOn == deltaIn->weightOn - && weightOff == deltaIn->weightOff - && smoothingOn == deltaIn->smoothingOn - && smoothingOff == deltaIn->smoothingOff - && styleOn == deltaIn->styleOn - && styleOff == deltaIn->styleOff - && underlinedOn == deltaIn->underlinedOn - && underlinedOff == deltaIn->underlinedOff - && sipOn == deltaIn->sipOn - && sipOff == deltaIn->sipOff - && transparentTextBackingOn == deltaIn->transparentTextBackingOn - && transparentTextBackingOff == deltaIn->transparentTextBackingOff - && SAME_C(foregroundMult) - && SAME_C(backgroundMult) - && SAME_C(foregroundAdd) - && SAME_C(backgroundAdd) - && alignmentOn == deltaIn->alignmentOn - && alignmentOff == deltaIn->alignmentOff); -#undef SAME_C -} - -void wxStyleDelta::Copy(wxStyleDelta *in) -{ -#define DCOPY(x) x = in->x - DCOPY(family); - DCOPY(face); - DCOPY(sizeMult); - DCOPY(sizeAdd); - DCOPY(weightOn); - DCOPY(weightOff); - DCOPY(smoothingOn); - DCOPY(smoothingOff); - DCOPY(styleOn); - DCOPY(styleOff); - DCOPY(underlinedOn); - DCOPY(underlinedOff); - DCOPY(sipOn); - DCOPY(sipOff); - DCOPY(transparentTextBackingOn); - DCOPY(transparentTextBackingOff); - DCOPY(foregroundMult->r); - DCOPY(foregroundMult->g); - DCOPY(foregroundMult->b); - DCOPY(foregroundAdd->r); - DCOPY(foregroundAdd->g); - DCOPY(foregroundAdd->b); - DCOPY(backgroundMult->r); - DCOPY(backgroundMult->g); - DCOPY(backgroundMult->b); - DCOPY(backgroundAdd->r); - DCOPY(backgroundAdd->g); - DCOPY(backgroundAdd->b); - DCOPY(alignmentOn); - DCOPY(alignmentOff); -} - -/***************************************************************/ - -static unsigned char ColourNum(double v) -{ - if (v < 0) - return 0; - else if (v > 255) - return 255; - else - return (unsigned char)v; -} - -wxStyle::wxStyle() -: wxObject(WXGC_NO_CLEANUP) -{ - wxList *cl; - - __type = wxTYPE_STYLE; - - foreground = new WXGC_PTRS wxColour; - background = new WXGC_PTRS wxColour; - - cl = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); - children = cl; -} - -wxStyle::~wxStyle() -{ - DELETE_OBJ children; - styleList = NULL; - nonjoin_delta = NULL; - join_shiftStyle = NULL; -} - -void wxStyle::Update(wxStyle *basic, wxStyle *target, - Bool propogate, Bool topLevel, Bool send_notify) -{ - int size; - int fontid; - int style, weight, smoothing; - unsigned char r, g, b; - double rm, gm, bm; - short rp, gp, bp; - Bool match; - wxNode *node; - Bool underlined, sip; - wxStyle *base; - - base = baseStyle; - if (basic) { - if (!styleList || PTREQ(base, styleList->BasicStyle())) { - base = basic; - } else { - base->Update(basic, target, FALSE, FALSE); - base = target; - } - } - - if (!target) - target = this; - - if (join_shiftStyle) { - if (styleList) { - if (!PTREQ(join_shiftStyle, styleList->BasicStyle())) { - join_shiftStyle->Update(base, target, FALSE, topLevel); - } else { - target->alignment = base->alignment; - target->font = base->font; - target->pen = base->pen; - target->brush = base->brush; - target->cached_sizes = 0; - target->foreground->CopyFrom(base->foreground); - target->background->CopyFrom(base->background); - - if (styleList) { - styleList->StyleWasChanged(target); - if (topLevel) - styleList->StyleWasChanged(NULL); - } - } - } - return; - } - - size = (int)(nonjoin_delta->sizeMult * base->font->GetPointSize()); - size += nonjoin_delta->sizeAdd; - if (size <= 0) - size = 1; - - if (!nonjoin_delta->face && nonjoin_delta->family == wxBASE) { - fontid = base->font->GetFontId(); - } else { - int fam; - fam = nonjoin_delta->family; - if (fam == wxBASE) - fam = base->font->GetFamily(); - - if (nonjoin_delta->face) - fontid = FONT_DIRECTORY->FindOrCreateFontId(nonjoin_delta->face, fam); - else - fontid = fam; - } - - style = base->font->GetStyle(); - match = (style == nonjoin_delta->styleOff); - if (match) - style = wxNORMAL; - if (!match || (match && nonjoin_delta->styleOn != nonjoin_delta->styleOff)) - if (nonjoin_delta->styleOn != wxBASE) - style = nonjoin_delta->styleOn; - - weight = base->font->GetWeight(); - match = (weight == nonjoin_delta->weightOff); - if (match) - weight = wxNORMAL; - if (!match || (match && nonjoin_delta->weightOn != nonjoin_delta->weightOff)) - if (nonjoin_delta->weightOn != wxBASE) - weight = nonjoin_delta->weightOn; - - smoothing = base->font->GetSmoothing(); - match = (smoothing == nonjoin_delta->smoothingOff); - if (match) - smoothing = wxSMOOTHING_DEFAULT; - if (!match || (match && nonjoin_delta->smoothingOn != nonjoin_delta->smoothingOff)) - if (nonjoin_delta->smoothingOn != wxBASE) - smoothing = nonjoin_delta->smoothingOn; - - target->alignment = base->alignment; - match = (target->alignment == nonjoin_delta->alignmentOff); - if (match) - target->alignment = wxALIGN_BOTTOM; - if (!match || (match && nonjoin_delta->alignmentOn != nonjoin_delta->alignmentOff)) - if (nonjoin_delta->alignmentOn != wxBASE) - target->alignment = nonjoin_delta->alignmentOn; - - if (nonjoin_delta->underlinedOff && nonjoin_delta->underlinedOn) - underlined = !base->font->GetUnderlined(); - else if (nonjoin_delta->underlinedOff) - underlined = FALSE; - else if (nonjoin_delta->underlinedOn) - underlined = TRUE; - else - underlined = base->font->GetUnderlined(); - - if (nonjoin_delta->sipOff && nonjoin_delta->sipOn) - sip = !base->font->GetSizeInPixels(); - else if (nonjoin_delta->sipOff) - sip = FALSE; - else if (nonjoin_delta->sipOn) - sip = TRUE; - else - sip = base->font->GetSizeInPixels(); - - target->font = wxTheFontList->FindOrCreateFont(size, fontid, - style, weight, - underlined, smoothing, - sip); - - target->cached_sizes = 0; - - if (nonjoin_delta->transparentTextBackingOff && nonjoin_delta->transparentTextBackingOn) - transText = !base->transText; - else if (nonjoin_delta->transparentTextBackingOff) - transText = FALSE; - else if (nonjoin_delta->transparentTextBackingOn) - transText = TRUE; - else - transText = base->transText; - - base->foreground->Get(&r, &g, &b); - nonjoin_delta->foregroundMult->Get(&rm, &gm, &bm); - nonjoin_delta->foregroundAdd->Get(&rp, &gp, &bp); - r = ColourNum(r * rm + rp); - g = ColourNum(g * gm + gp); - b = ColourNum(b * bm + bp); - target->foreground->Set(r, g, b); - - base->background->Get(&r, &g, &b); - nonjoin_delta->backgroundMult->Get(&rm, &gm, &bm); - nonjoin_delta->backgroundAdd->Get(&rp, &gp, &bp); - r = ColourNum(r * rm + rp); - g = ColourNum(g * gm + gp); - b = ColourNum(b * bm + bp); - target->background->Set(r, g, b); - - target->pen = wxThePenList->FindOrCreatePen(foreground, 0, wxSOLID); - target->brush = wxTheBrushList->FindOrCreateBrush(background, wxSOLID); - - if (propogate) { - for (node = children->First(); node; node = node->Next()) { - wxStyle *stl; - stl = (wxStyle *)node->Data(); - stl->Update(NULL, NULL, TRUE, FALSE); - } - } - - if (send_notify) { - if (styleList) { - styleList->StyleWasChanged(target); - if (topLevel) - styleList->StyleWasChanged(NULL); - } - } -} - -char *wxStyle::GetName() -{ - return name; -} - -int wxStyle::GetFamily() -{ - return font->GetFamily(); -} - -char *wxStyle::GetFace() -{ - return font->GetFaceString(); -} - -wxFont *wxStyle::GetFont() -{ - return font; -} - -int wxStyle::GetSize() -{ - return font->GetPointSize(); -} - -int wxStyle::GetWeight() -{ - return font->GetWeight(); -} - -int wxStyle::GetStyle() -{ - return font->GetStyle(); -} - -int wxStyle::GetSmoothing() -{ - return font->GetSmoothing(); -} - -Bool wxStyle::GetUnderlined() -{ - return font->GetUnderlined(); -} - -Bool wxStyle::GetSizeInPixels() -{ - return font->GetSizeInPixels(); -} - -Bool wxStyle::GetTransparentTextBacking() -{ - return transText; -} - -wxColour *wxStyle::GetForeground() -{ - return foreground; -} - -wxColour *wxStyle::GetBackground() -{ - return background; -} - -int wxStyle::GetAlignment() -{ - return alignment; -} - -Bool wxStyle::IsJoin() -{ - return !!join_shiftStyle; -} - -void wxStyle::GetDelta(wxStyleDelta *d) -{ - if (join_shiftStyle) - d->SetDelta(wxCHANGE_NOTHING); - else - d->Copy(nonjoin_delta); -} - -void wxStyle::SetDelta(wxStyleDelta *d) -{ - if (join_shiftStyle || (styleList && PTREQ(this, styleList->BasicStyle()))) - return; - - if (!nonjoin_delta->Equal(d)) { - nonjoin_delta->Copy(d); - Update(); - } -} - -wxStyle *wxStyle::GetShiftStyle() -{ - if (join_shiftStyle) - return join_shiftStyle; - else if (styleList) - return styleList->BasicStyle(); - else - return wxTheStyleList->BasicStyle(); -} - -void wxStyle::SetShiftStyle(wxStyle *style) -{ - if (!join_shiftStyle || !styleList || (styleList->StyleToIndex(style) < 0)) - return; - - if (styleList->CheckForLoop(this, style)) - return; - - if (join_shiftStyle) - join_shiftStyle->children->DeleteObject(this); - style->children->Append(this); - - join_shiftStyle = style; - styleList->StyleHasNewChild(style, this); - - Update(); - - join_shiftStyle = style; - Update(); -} - -wxStyle *wxStyle::GetBaseStyle(void) -{ - return baseStyle; -} - -void wxStyle::SetBaseStyle(wxStyle *style) -{ - if (!styleList || PTREQ(this, styleList->BasicStyle())) - return; - - if (!style) - style = styleList->BasicStyle(); - else - if (styleList->StyleToIndex(style) < 0) - return; - - if (styleList->CheckForLoop(this, style)) - return; - - if (baseStyle) - baseStyle->children->DeleteObject(this); - - baseStyle = style; - style->children->Append(this); - - styleList->StyleHasNewChild(style, this); - - Update(); -} - -void wxStyle::SwitchTo(wxDC *dc, wxStyle *oldStyle) -{ - unsigned char afr, afg, afb, bfr, bfg, bfb; - unsigned char abr, abg, abb, bbr, bbg, bbb; - - if (oldStyle) { - oldStyle->foreground->Get(&afr, &afg, &afb); - foreground->Get(&bfr, &bfg, &bfb); - oldStyle->background->Get(&abr, &abg, &abb); - background->Get(&bbr, &bbg, &bbb); - } - - if (!oldStyle || oldStyle->font != font) - dc->SetFont(font); - if (!oldStyle || afr != bfr || afb != bfb || afg != bfg) - dc->SetTextForeground(foreground); - if (!oldStyle || abr != bbr || abb != bbb || abg != bbg) - dc->SetTextBackground(background); - if (!oldStyle || oldStyle->pen != pen) - dc->SetPen(pen); - if (!oldStyle || oldStyle->transText != transText) - dc->SetBackgroundMode(transText ? wxTRANSPARENT : wxSOLID); -} - -void wxStyle::ResetTextMetrics(wxDC *dc) -{ - double w, h, d, s; - int can_cache; - - can_cache = dc->CacheFontMetricsKey(); - - if (cached_sizes && (cached_sizes == can_cache)) - return; - -#ifdef BROKEN_GET_TEXT_EXTENT - dc->SetFont(style->GetFont()); -#endif - dc->GetTextExtent(" ", &w, &h, &d, &s, font); - textWidth = w; - textHeight = h; - textDescent = d; - textSpace = s; - - cached_sizes = can_cache; -} - -double wxStyle::GetTextWidth(wxDC *dc) -{ - ResetTextMetrics(dc); - - return textWidth; -} - -double wxStyle::GetTextHeight(wxDC *dc) -{ - ResetTextMetrics(dc); - - return textHeight; -} - -double wxStyle::GetTextDescent(wxDC *dc) -{ - ResetTextMetrics(dc); - - return textDescent; -} - -double wxStyle::GetTextSpace(wxDC *dc) -{ - ResetTextMetrics(dc); - - return textSpace; -} - -/***************************************************************/ - -class NotificationRec -#ifndef MZ_PRECISE_GC -: public gc -#endif -{ - public: - wxStyleNotifyFunc f; - void *data; -#ifdef MZ_PRECISE_GC -# define GET_WEAK_DATA(data) SCHEME_BOX_VAL(data) -#else -# define GET_WEAK_DATA(data) data -#endif - void *id; -}; - -wxStyleList::wxStyleList() : wxList(wxKEY_NONE, WXGC_NO_CLEANUP) -{ -#if USE_OLD_TYPE_SYSTEM - __type = wxTYPE_STYLE_LIST; -#endif - - basic = new WXGC_PTRS wxStyle; - /* Note: The file-reader relies on having a new `basic' when the - list is cleared: */ - - basic->styleList = this; - - basic->name = "Basic"; - basic->baseStyle = NULL; - - basic->nonjoin_delta = new WXGC_PTRS wxStyleDelta; - basic->nonjoin_delta->SetDelta(wxCHANGE_NORMAL); - - basic->font = wxTheFontList->FindOrCreateFont(defaultSize, wxDEFAULT, - wxNORMAL, wxNORMAL); - basic->foreground->CopyFrom(wxBLACK); - basic->background->CopyFrom(wxWHITE); - basic->pen = wxThePenList->FindOrCreatePen(basic->foreground, 0, wxSOLID); - basic->brush = wxTheBrushList->FindOrCreateBrush(basic->background, wxSOLID); - basic->alignment = wxALIGN_BOTTOM; - basic->transText = TRUE; - - Append(basic); - - notifications = new WXGC_PTRS wxList(wxKEY_NONE, FALSE); -} - -void wxStyleList::Copy(wxStyleList *other) -{ - wxNode *node; - - for (node = other->First(); node; node = node->Next()) { - wxStyle *s; - s = (wxStyle *)node->Data(); - Convert(s, 1); - } -} - -wxStyleList::~wxStyleList() -{ - DeleteContents(TRUE); -} - -wxStyle *wxStyleList::BasicStyle(void) -{ - return basic; -} - -wxStyle *wxStyleList::FindOrCreateStyle(wxStyle *baseStyle, - wxStyleDelta *deltain) -{ - wxNode *node; - wxStyle *style; - wxStyleDelta *delta; - - if (!baseStyle || (StyleToIndex(baseStyle) < 0)) - baseStyle = basic; - - /* Collapse the delta: */ - if (quick_delta) { - delta = quick_delta; - quick_delta = NULL; - } else - delta = new WXGC_PTRS wxStyleDelta; - delta->Copy(deltain); - while (!baseStyle->name && !baseStyle->join_shiftStyle) { - if (!delta->Collapse(baseStyle->nonjoin_delta)) - break; - baseStyle = baseStyle->baseStyle; - } - - for (node = First(); node; node = node->Next()) { - style = (wxStyle *)node->Data(); - if (!style->name - && !style->join_shiftStyle - && PTREQ(style->baseStyle, baseStyle) - && delta->Equal(style->nonjoin_delta)) { - quick_delta = delta; - return style; - } - } - - style = new WXGC_PTRS wxStyle; - - style->styleList = this; - - style->name = NULL; - - style->nonjoin_delta = delta; - - style->baseStyle = baseStyle; - baseStyle->children->Append(style); - - style->Update(NULL, NULL, FALSE, FALSE, FALSE); /* No need to propagate/notify, because we just created it. */ - - Append(style); - - return style; -} - -wxStyle *wxStyleList::FindOrCreateJoinStyle(wxStyle *baseStyle, - wxStyle *shiftStyle) -{ - wxNode *node; - wxStyle *style; - - if (!baseStyle || (StyleToIndex(baseStyle) < 0)) - baseStyle = basic; - if (!shiftStyle || (StyleToIndex(shiftStyle) < 0)) - return baseStyle; - - for (node = First(); node; node = node->Next()) { - style = (wxStyle *)node->Data(); - if (!style->name - && style->join_shiftStyle - && PTREQ(style->baseStyle, baseStyle) - && PTREQ(style->join_shiftStyle, shiftStyle)) - return style; - } - - style = new WXGC_PTRS wxStyle; - - style->styleList = this; - - style->name = NULL; - - style->join_shiftStyle = shiftStyle; - shiftStyle->children->Append(style); - - style->baseStyle = baseStyle; - baseStyle->children->Append(style); - - style->Update(); - - Append(style); - - return style; -} - -wxStyle *wxStyleList::FindNamedStyle(char *name) -{ - wxNode *node; - wxStyle *style; - - for (node = First(); node; node = node->Next()) { - style = (wxStyle *)node->Data(); - if (style->name && !strcmp(name, style->name)) - return style; - } - - return NULL; -} - -wxStyle *wxStyleList::DoNamedStyle(char *name, wxStyle *plainStyle, Bool replac) -{ - wxNode *node; - wxStyle *style; - - if (!plainStyle || (StyleToIndex(plainStyle) < 0)) - plainStyle = basic; - - style = NULL; - for (node = First(); node; node = node->Next()) { - style = (wxStyle *)node->Data(); - if (style->name && !strcmp(name, style->name)) { - if (!replac) - return style; - break; - } - } - - if (!node) { - style = new WXGC_PTRS wxStyle; - style->name = copystring(name); - style->styleList = this; - } else { - /* Can't replace basic style: */ - if (style == basic) - return basic; - - /* plainStyle must not depend on this style - (otherwise, we'd create a dependency cycle): */ - if (CheckForLoop(style, plainStyle)) - return style; - - style->baseStyle->children->DeleteObject(style); - if (style->join_shiftStyle) - style->join_shiftStyle->children->DeleteObject(style); - } - - if (plainStyle->join_shiftStyle) { - style->join_shiftStyle = plainStyle->join_shiftStyle; - style->join_shiftStyle->children->Append(style); - } else { - style->nonjoin_delta = new WXGC_PTRS wxStyleDelta; - if (PTRNE(plainStyle, basic)) - style->nonjoin_delta->Copy(plainStyle->nonjoin_delta); - } - - if (PTREQ(plainStyle, basic)) - style->baseStyle = basic; - else - style->baseStyle = plainStyle->baseStyle; - style->baseStyle->children->Append(style); - - style->Update(); - - if (!node) - Append(style); - - return style; -} - -wxStyle *wxStyleList::NewNamedStyle(char *name, wxStyle *plainStyle) -{ - return DoNamedStyle(name, plainStyle, FALSE); -} - -wxStyle *wxStyleList::ReplaceNamedStyle(char *name, wxStyle *plainStyle) -{ - return DoNamedStyle(name, plainStyle, TRUE); -} - -wxStyle *wxStyleList::Convert(wxStyle *style, Bool overwrite) -{ - wxStyle *base, *newstyle; - - if (StyleToIndex(style) >= 0) - return style; - - if (style->name && !overwrite) { - newstyle = FindNamedStyle(style->name); - if (newstyle) - return newstyle; - } - - if (!style->baseStyle) - base = BasicStyle(); - else - base = Convert(style->baseStyle); - - if (style->join_shiftStyle) { - wxStyle *shift; - - shift = Convert(style->join_shiftStyle); - newstyle = FindOrCreateJoinStyle(base, shift); - } else - newstyle = FindOrCreateStyle(base, style->nonjoin_delta); - - if (style->name) { - if (overwrite) - return ReplaceNamedStyle(style->name, newstyle); - else - return NewNamedStyle(style->name, newstyle); - } else - return newstyle; -} - -void wxStyleList::StyleWasChanged(wxStyle *which) -{ - NotificationRec *rec; - wxNode *node; - - for (node = notifications->First(); node; node = node->Next()) { - rec = (NotificationRec *)node->Data(); - rec->f(which, GET_WEAK_DATA(rec->data)); - } -} - -void *wxStyleList::NotifyOnChange(wxStyleNotifyFunc f, void *data, int weak) -{ - NotificationRec *rec, *orec; - wxNode *node; - -#ifdef MZ_PRECISE_GC - rec = new NotificationRec; - if (weak) { - rec->data = GC_malloc_weak_box(data, NULL, 0); - } else { - void *weak_data; - weak_data = (void *)scheme_box((Scheme_Object *)data); - GC_finalization_weak_ptr((void **)(void *)weak_data, - ((void **)(void *)&SCHEME_BOX_VAL(weak_data) - - (void **)(void *)weak_data)); - rec->data = weak_data; - } -#else - if (weak) - rec = new WXGC_ATOMIC NotificationRec; - else - rec = new WXGC_PTRS NotificationRec; - rec->data = data; - if (weak) - scheme_weak_reference((void **)(void *)&rec->data); - else - WXGC_IGNORE(rec, rec->data); -#endif - - rec->f = f; - rec->id = scheme_make_symbol("notify-change-key"); - - /* Look for dropped weak entries to replace: */ - for (node = notifications->First(); node; node = node->Next()) { - orec = (NotificationRec *)node->Data(); - if (!GET_WEAK_DATA(orec->data)) { - node->SetData((wxObject *)rec); - return rec->id; - } - } - - notifications->Append((wxObject *)rec); - - return rec->id; -} - -void wxStyleList::ForgetNotification(void *id) -{ - NotificationRec *rec; - wxNode *node; - - for (node = notifications->First(); node; node = node->Next()) { - rec = (NotificationRec *)node->Data(); - if (rec->id == id) { - notifications->DeleteNode(node); - DELETE_OBJ rec; - return; - } - } -} - -Bool wxStyleList::CheckForLoop(wxStyle *s, wxStyle *p) -{ - if (PTREQ(p, s)) - return TRUE; - - if (!p->baseStyle) - return FALSE; - - if (p->join_shiftStyle) { - if (CheckForLoop(s, p->baseStyle)) - return TRUE; - return CheckForLoop(s, p->join_shiftStyle); - } else - return CheckForLoop(s, p->baseStyle); -} - -void wxStyleList::StyleHasNewChild(wxStyle *s, wxStyle *c) -{ - wxNode *cnode, *snode, *node; - - /* Need to maintain the invariant that parents are in the list - before children... */ - cnode = Member(c); - snode = Member(s); - - for (node = cnode; node; node = node->Next()) { - if (PTREQ(node, snode)) { - /* Move base style to before this style */ - DeleteNode(snode); - Insert(cnode, s); - break; - } - } -} - -int wxStyleList::Number(void) -{ - return wxList::Number(); -} - -wxStyle *wxStyleList::IndexToStyle(int i) -{ - wxNode *node; - - for (node = First(); i && node; i--, node = node->Next()) { - } - - if (node) - return (wxStyle *)node->Data(); - else - return NULL; -} - -int wxStyleList::StyleToIndex(wxStyle *s) -{ - wxNode *node; - int i = 0; - - for (node = First(); - node && PTRNE((wxStyle *)node->Data(), s); - i++, node = node->Next()) { - } - - if (node) - return i; - else - return -1; -} - -Bool wxStyleList::WriteToFile(class wxMediaStreamOut *f) -{ - return wxmbWriteStylesToFile(this, f); -} - -wxStyle *wxStyleList::MapIndexToStyle(wxMediaStream *s, int i, long listId) -{ - wxStyleListLink *ssl; - - for (ssl = s->ssl; ssl; ssl = ssl->next) { - if (ssl->listId == listId) { - if (ssl->basic == basic) { - // If basic changes, that means list was cleared - if (ssl->styleMap && i < ssl->numMappedStyles) - return ssl->styleMap[i]; - else { - wxmeError("map-index-to-style: bad style index for snip"); - return basic; - } - } else { - wxmeError("map-index-to-style: cannot resolve style index; style list has been cleared"); - return basic; - } - } - } - - wxmeError("map-index-to-style: bad style list index for snip"); - - return basic; -} - -wxStyleList *wxReadStyleList(class wxMediaStreamIn *f) -{ - wxStyleList *l; - long listId; - - l = new WXGC_PTRS wxStyleList; - - return wxmbReadStylesFromFile(l, f, 0, &listId); -} - -void wxmbSetupStyleReadsWrites(wxMediaStream *s) -{ - s->ssl = NULL; -} - -void wxmbDoneStyleReadsWrites(wxMediaStream *s) -{ - s->ssl = NULL; -} - -static int FamilyStandardToThis(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case 71: - return wxDECORATIVE; - case 72: - return wxROMAN; - case 73: - return wxSCRIPT; - case 74: - return wxSWISS; - case 75: - return wxMODERN; - case 76: - return wxTELETYPE; - case 77: - return wxSYSTEM; - case 78: - return wxSYMBOL; - case 70: - default: - return wxDEFAULT; - } -} - -static int FamilyThisToStandard(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case wxDECORATIVE: - return 71; - case wxROMAN: - return 72; - case wxSCRIPT: - return 73; - case wxSWISS: - return 74; - case wxMODERN: - return 75; - case wxTELETYPE: - return 76; - case wxSYSTEM: - return 77; - case wxSYMBOL: - return 78; - case wxDEFAULT: - default: - return 70; - } -} - -static int WeightStandardToThis(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case 91: - return wxLIGHT; - case 92: - return wxBOLD; - case 90: - default: - return wxNORMAL; - } -} - -static int WeightThisToStandard(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case wxLIGHT: - return 91; - case wxBOLD: - return 92; - case wxNORMAL: - default: - return 90; - } -} - -static int StyleStandardToThis(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case 93: - return wxITALIC; - case 94: - return wxSLANT; - case 90: - default: - return wxNORMAL; - } -} - -static int StyleThisToStandard(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case wxITALIC: - return 93; - case wxSLANT: - return 94; - case wxNORMAL: - default: - return 90; - } -} - -static int SmoothingStandardToThis(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case 0: - return wxSMOOTHING_PARTIAL; - case 1: - return wxSMOOTHING_ON; - case 2: - return wxSMOOTHING_OFF; - case 3: - default: - return wxSMOOTHING_DEFAULT; - } -} - -static int SmoothingThisToStandard(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case wxSMOOTHING_PARTIAL: - return 0; - case wxSMOOTHING_ON: - return 1; - case wxSMOOTHING_OFF: - return 2; - case wxNORMAL: - default: - return 3; - } -} - - -static int AlignStandardToThis(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case 0: - return wxALIGN_TOP; - case 2: - return wxALIGN_CENTER; - case 1: - default: - return wxALIGN_BOTTOM; - } -} - -static int AlignThisToStandard(int v) -{ - switch (v) { - case wxBASE: - return wxBASE; - case wxALIGN_TOP: - return 0; - case wxALIGN_CENTER: - return 2; - case wxALIGN_BOTTOM: - default: - return 1; - } -} - -wxStyleList *wxmbReadStylesFromFile(wxStyleList *styleList, - wxMediaStreamIn *f, - Bool overwritename, - long *_listId) -{ -#define MAX_STYLE_NAME 256 - int baseIndex, shiftIndex; - long nameSize; - char name[MAX_STYLE_NAME]; - char face[MAX_STYLE_NAME]; - short r, g, b; - int i, isJoin, listId, nms, num; - double flt; - wxStyleDelta *delta; - wxStyle *bs; - wxStyleListLink *ssl; - - f->Get(&listId); - - *_listId = listId; - - for (ssl = f->ssl; ssl; ssl = ssl->next) { - if (ssl->listId == listId) - return ssl->styleList; - } - - ssl = new WXGC_PTRS wxStyleListLink; - ssl->styleList = styleList; - ssl->listId = listId; - ssl->basic = styleList->BasicStyle(); - ssl->next = f->ssl; - f->ssl = ssl; - - f->Get(&nms); - ssl->numMappedStyles = nms; - ssl->styleMap = new WXGC_PTRS wxStyle*[ssl->numMappedStyles]; - - bs = styleList->BasicStyle(); - ssl->styleMap[0] = bs; - for (i = 1; i < ssl->numMappedStyles; i++) { - f->Get(&baseIndex); - - if (baseIndex >= i) { - wxmeError("map-index-to-style: bad style index"); - return FALSE; - } - - nameSize = MAX_STYLE_NAME; - f->Get((long *)&nameSize, (char *)name); - - f->Get(&isJoin); - - if (isJoin) { - wxStyle *js; - - f->Get(&shiftIndex); - - if (shiftIndex >= i) { - wxmeError("map-index-to-style: bad shift-style index"); - return FALSE; - } - - js = styleList->FindOrCreateJoinStyle(ssl->styleMap[baseIndex], - ssl->styleMap[shiftIndex]); - ssl->styleMap[i] = js; - } else { - int fam; - - delta = new WXGC_PTRS wxStyleDelta; - - f->Get(&fam); - delta->family = FamilyStandardToThis(fam); - - nameSize = MAX_STYLE_NAME; - f->Get((long *)&nameSize, (char *)face); - - if (*face) { - char *str; - str = copystring(face); - delta->face = str; - } else - delta->face = NULL; - - // printf("%d %s\n", delta->family, delta->face ? delta->face : "NULL"); - - f->Get(&flt); delta->sizeMult = flt; - f->Get(&num); delta->sizeAdd = num; - f->Get(&num); - delta->weightOn = WeightStandardToThis(num); - f->Get(&num); - delta->weightOff = WeightStandardToThis(num); - f->Get(&num); - delta->styleOn = StyleStandardToThis(num); - f->Get(&num); - delta->styleOff = StyleStandardToThis(num); - if (WXME_VERSION_ONE(f) || WXME_VERSION_TWO(f) - || WXME_VERSION_THREE(f) || WXME_VERSION_FOUR(f)) { - delta->smoothingOn = wxSMOOTHING_DEFAULT; - delta->smoothingOff = wxSMOOTHING_DEFAULT; - } else { - f->Get(&num); - delta->smoothingOn = SmoothingStandardToThis(num); - f->Get(&num); - delta->smoothingOff = SmoothingStandardToThis(num); - } - f->Get(&num); delta->underlinedOn = num; - f->Get(&num); delta->underlinedOff = num; - if (WXME_VERSION_ONE(f) || WXME_VERSION_TWO(f) - || WXME_VERSION_THREE(f) || WXME_VERSION_FOUR(f) - || WXME_VERSION_FIVE(f)) { - delta->sipOn = FALSE; - delta->sipOff = FALSE; - } else { - f->Get(&num); delta->sipOn = num; - f->Get(&num); delta->sipOff = num; - } - if (WXME_VERSION_ONE(f) || WXME_VERSION_TWO(f)) { - delta->transparentTextBackingOn = FALSE; - delta->transparentTextBackingOff = FALSE; - } else { - f->Get(&num); delta->transparentTextBackingOn = num; - f->Get(&num); delta->transparentTextBackingOff = num; - } - - f->Get(&flt); delta->foregroundMult->r = flt; - f->Get(&flt); delta->foregroundMult->g = flt; - f->Get(&flt); delta->foregroundMult->b = flt; - f->Get(&flt); delta->backgroundMult->r = flt; - f->Get(&flt); delta->backgroundMult->g = flt; - f->Get(&flt); delta->backgroundMult->b = flt; - f->Get(&r); - f->Get(&g); - f->Get(&b); - delta->foregroundAdd->Set(r, g, b); - f->Get(&r); - f->Get(&g); - f->Get(&b); - delta->backgroundAdd->Set(r, g, b); - if (WXME_VERSION_ONE(f) || WXME_VERSION_TWO(f)) { - if (r || g || b) - delta->transparentTextBackingOff = TRUE; - } - - f->Get(&num); - delta->alignmentOn = AlignStandardToThis(num); - f->Get(&num); - delta->alignmentOff = AlignStandardToThis(num); - - { - wxStyle *cs; - cs = styleList->FindOrCreateStyle(ssl->styleMap[baseIndex], delta); - ssl->styleMap[i] = cs; - } - } - - if (*name) { - wxStyle *ns; - ns = (overwritename - ? styleList->ReplaceNamedStyle(name, ssl->styleMap[i]) - : styleList->NewNamedStyle(name, ssl->styleMap[i])); - ssl->styleMap[i] = ns; - } - } - - return styleList; -} - -Bool wxmbWriteStylesToFile(wxStyleList *styleList, wxMediaStreamOut *f) -{ - int i, count, lid; - wxStyle *style; - short r, g, b; - char *name; - wxStyleDelta *delta; - wxStyleListLink *ssl; - - for (ssl = f->ssl; ssl; ssl = ssl->next) { - if (ssl->styleList == styleList) { - f->Put(ssl->listId); - return TRUE; - } - } - - lid = f->styleCount + 1; - f->styleCount++; - - ssl = new WXGC_PTRS wxStyleListLink; - ssl->styleList = styleList; - ssl->listId = lid; - ssl->next = f->ssl; - f->ssl = ssl; - - f->Put(lid); - - count = styleList->Number(); - - f->Put(count); - - // Basic style is implied - - for (i = 1; i < count; i++) { - int idx; - wxStyle *bs; - - style = styleList->IndexToStyle(i); - - bs = style->GetBaseStyle(); - idx = styleList->StyleToIndex(bs); - f->Put(idx); - name = style->GetName(); - if (name) - f->Put(name); - else - f->Put(""); - - if (style->IsJoin()) { - int idx; - wxStyle *ss; - - f->Put(1); - - ss = style->GetShiftStyle(); - idx = styleList->StyleToIndex(ss); - f->Put(idx); - } else { - delta = new WXGC_PTRS wxStyleDelta; - - style->GetDelta(delta); - - f->Put(0); - - f->Put(FamilyThisToStandard(delta->family)); - if (delta->face) - f->Put(delta->face); - else - f->Put(""); - - f->Put(delta->sizeMult); - f->Put(delta->sizeAdd); - f->Put(WeightThisToStandard(delta->weightOn)); - f->Put(WeightThisToStandard(delta->weightOff)); - f->Put(StyleThisToStandard(delta->styleOn)); - f->Put(StyleThisToStandard(delta->styleOff)); - f->Put(SmoothingThisToStandard(delta->smoothingOn)); - f->Put(SmoothingThisToStandard(delta->smoothingOff)); - f->Put(delta->underlinedOn); - f->Put(delta->underlinedOff); - f->Put(delta->sipOn); - f->Put(delta->sipOff); - f->Put(delta->transparentTextBackingOn); - f->Put(delta->transparentTextBackingOff); - - f->Put(delta->foregroundMult->r); - f->Put(delta->foregroundMult->g); - f->Put(delta->foregroundMult->b); - f->Put(delta->backgroundMult->r); - f->Put(delta->backgroundMult->g); - f->Put(delta->backgroundMult->b); - delta->foregroundAdd->Get(&r, &g, &b); - f->Put(r); - f->Put(g); - f->Put(b); - delta->backgroundAdd->Get(&r, &g, &b); - f->Put(r); - f->Put(g); - f->Put(b); - - f->Put(AlignThisToStandard(delta->alignmentOn)); - f->Put(AlignThisToStandard(delta->alignmentOff)); - } - } - - return TRUE; -} diff --git a/src/mred/wxme/wx_style.h b/src/mred/wxme/wx_style.h deleted file mode 100644 index 1a6e2e307b..0000000000 --- a/src/mred/wxme/wx_style.h +++ /dev/null @@ -1,258 +0,0 @@ - -#ifndef __WXME_STYLE__ -#define __WXME_STYLE__ - -#include "wx_list.h" -#include "wx_gdi.h" -#include "wx_dc.h" -#include "wx_utils.h" - -#ifndef WXGC_NO_CLEANUP -#define WXGC_NO_CLEANUP /* empty */ -#endif - -#define wxBASE (-1) - -#ifndef wxALIGN_TOP -enum { - wxALIGN_TOP, - wxALIGN_BOTTOM -# ifndef wxALIGN_CENTER - , wxALIGN_CENTER -# endif -}; -#endif - -/* Simple style change commands */ -enum { - wxCHANGE_NOTHING, - - wxCHANGE_STYLE, - wxCHANGE_WEIGHT, - wxCHANGE_UNDERLINE, - wxCHANGE_SIZE, - wxCHANGE_FAMILY, - wxCHANGE_ALIGNMENT, - - wxCHANGE_BOLD, - wxCHANGE_ITALIC, - - wxCHANGE_SMOOTHING, - - wxCHANGE_TOGGLE_STYLE, - wxCHANGE_TOGGLE_WEIGHT, - wxCHANGE_TOGGLE_SMOOTHING, - wxCHANGE_TOGGLE_UNDERLINE, - - wxCHANGE_BIGGER, - wxCHANGE_SMALLER, - - wxCHANGE_NORMAL, - - wxCHANGE_NORMAL_COLOUR, - - wxCHANGE_SIP, - wxCHANGE_TOGGLE_SIP, -}; - -class wxMultColour : public wxObject -{ - public: - double r, g, b; - inline wxMultColour(); - void Get(double *r, double *g, double *b); - void Set(double r, double g, double b); -}; - -inline wxMultColour::wxMultColour() -: wxObject(WXGC_NO_CLEANUP) -{ -} - -class wxAddColour : public wxObject -{ - public: - short r, g, b; - inline wxAddColour(); - void Get(short *r, short *g, short *b); - void Set(short r, short g, short b); -}; - -inline wxAddColour::wxAddColour() - : wxObject(WXGC_NO_CLEANUP) -{ -} - -class wxStyleDelta : public wxObject -{ - public: - int family; - char *face; - double sizeMult; - int sizeAdd; - int weightOn; /* On == Off => Toggle */ - int weightOff; /* On & Off, but On != Off => Converting toggle */ - int styleOn; - int styleOff; - int smoothingOn; - int smoothingOff; - Bool underlinedOn; - Bool underlinedOff; - Bool sipOn; - Bool sipOff; - Bool transparentTextBackingOn; - Bool transparentTextBackingOff; - wxMultColour *foregroundMult, *backgroundMult; - wxAddColour *foregroundAdd, *backgroundAdd; - int alignmentOn; - int alignmentOff; - - wxStyleDelta(int changeCommand = wxCHANGE_NOTHING, int param = 0); - ~wxStyleDelta(); - - wxStyleDelta *SetDelta(int changeCommand, int param = 0); - wxStyleDelta *SetDeltaFace(char *name, int family = wxDEFAULT); - wxStyleDelta *SetDeltaBackground(char *name); - wxStyleDelta *SetDeltaBackground(wxColour *colour); - wxStyleDelta *SetDeltaForeground(char *name); - wxStyleDelta *SetDeltaForeground(wxColour *colour); - - Bool Collapse(wxStyleDelta *delta); - - Bool Equal(wxStyleDelta *delta); - - void Copy(wxStyleDelta *delta); -}; - -class wxStyleList; - -class wxStyle : public wxObject -{ - friend class wxStyleList; - - private: - wxStyleList *styleList; /* Points back to the list owning the style */ - - char *name; - - wxStyle *baseStyle; - - wxStyle *join_shiftStyle; - wxStyleDelta *nonjoin_delta; - - /* cache computation: */ - Bool transText; - wxColour *foreground, *background; - wxFont *font; - wxPen *pen; - wxBrush *brush; - int alignment; - - int cached_sizes; - double textWidth, textHeight, textDescent, textSpace; - - wxList *children; - - void Update(wxStyle *basic = NULL, wxStyle *target = NULL, - Bool propogate = TRUE, Bool topLevel = TRUE, Bool send_notify = TRUE); - - void ResetTextMetrics(wxDC *dc); - - public: - wxStyle(); - ~wxStyle(); - - char *GetName(); - int GetFamily(); - char *GetFace(); - int GetSize(); - int GetWeight(); - int GetStyle(); - int GetSmoothing(); - Bool GetUnderlined(); - Bool GetSizeInPixels(); - wxFont *GetFont(); - wxColour *GetForeground(); - wxColour *GetBackground(); - int GetAlignment(); - Bool GetTransparentTextBacking(); - - wxStyle *GetBaseStyle(void); - void SetBaseStyle(wxStyle *baseStyle); - - Bool IsJoin(void); - - void GetDelta(wxStyleDelta *delta); - void SetDelta(wxStyleDelta *delta); - - wxStyle *GetShiftStyle(); - void SetShiftStyle(wxStyle *); - - void SwitchTo(wxDC *dc, wxStyle *oldStyle); - - double GetTextWidth(wxDC *dc); - double GetTextHeight(wxDC *dc); - double GetTextDescent(wxDC *dc); - double GetTextSpace(wxDC *dc); -}; - -typedef void (*wxStyleNotifyFunc)(wxStyle *which, void *data); -class wxMediaStream; - -class wxStyleList : public wxList /* should be private */ -{ - wxStyle *basic; - wxList *notifications; - - wxStyle *DoNamedStyle(char *name, wxStyle *plainStyle, Bool replace); - - public: - wxStyleList(); - ~wxStyleList(); - - void Copy(wxStyleList *other); - - wxStyle *BasicStyle(void); - - int Number(void); - - /* Called automatically by style: */ - void StyleWasChanged(wxStyle *which); - void StyleHasNewChild(wxStyle *s, wxStyle *c); - Bool CheckForLoop(wxStyle *s, wxStyle *p); - - wxStyle *FindOrCreateStyle(wxStyle *baseStyle, wxStyleDelta *delta); - - wxStyle *FindOrCreateJoinStyle(wxStyle *baseStyle, wxStyle *shiftStyle); - - wxStyle *FindNamedStyle(char *name); - wxStyle *NewNamedStyle(char *name, wxStyle *plainStyle); - wxStyle *ReplaceNamedStyle(char *name, wxStyle *plainStyle); - - wxStyle *Convert(wxStyle *, Bool overwrite = FALSE); - - void *NotifyOnChange(wxStyleNotifyFunc f, void *data, int weak = 0); - void ForgetNotification(void *id); - - wxStyle *IndexToStyle(int i); - int StyleToIndex(wxStyle *); - - Bool WriteToFile(class wxMediaStreamOut *f); - wxStyle *MapIndexToStyle(wxMediaStream *f, int i, long listId); -}; - -extern wxStyleList *wxTheStyleList; - -void wxInitStyles(void); - -wxStyleList *wxReadStyleList(class wxMediaStreamIn *f); - -class wxMediaStream; - -/* Internal use only */ -Bool wxmbWriteStylesToFile(wxStyleList *styleList, class wxMediaStreamOut *f); -wxStyleList *wxmbReadStylesFromFile(wxStyleList *, class wxMediaStreamIn *f, Bool overwritename, long *listId); -void wxmbSetupStyleReadsWrites(wxMediaStream *); -void wxmbDoneStyleReadsWrites(wxMediaStream *); - -#endif diff --git a/src/mred/wxs/Makefile.in b/src/mred/wxs/Makefile.in index 9b072f3bcf..bf7dfd28cb 100644 --- a/src/mred/wxs/Makefile.in +++ b/src/mred/wxs/Makefile.in @@ -57,7 +57,6 @@ WXPRECOMPDIR = ../../wxmac/src WXSCHEMEHEADERS = $(srcdir)/wxscheme.h $(srcdir)/../../mzscheme/src/stypes.h $(srcdir)/../../mzscheme/utils/xcglue.h \ $(srcdir)/../../mzscheme/include/scheme.h $(OBJECTHEADER_@WXVARIANT@) \ $(srcdir)/../../wxcommon/wxGC.h $(srcdir)/../../wxcommon/wx_list.h @WXPRECOMP@ -MEDIAHEADERS = $(srcdir)/../wxme/wx_media.h $(srcdir)/../wxme/wx_medad.h $(srcdir)/../wxme/wx_snip.h WINDOWHEADERS_wx_xt = $(srcdir)/../../wxxt/src/Windows/Window.h @@ -92,35 +91,35 @@ CLIPBHEADER = $(CLIPBHEADER_@WXVARIANT@) OBJECTS = xcglue.@LTO@ wxs_bmap.@LTO@ wxs_butn.@LTO@ wxs_chce.@LTO@ wxs_ckbx.@LTO@ wxs_cnvs.@LTO@ \ wxs_dc.@LTO@ wxs_evnt.@LTO@ wxs_fram.@LTO@ wxs_gage.@LTO@ wxs_gdi.@LTO@ wxs_glob.@LTO@ \ - wxs_item.@LTO@ wxs_lbox.@LTO@ wxs_madm.@LTO@ wxs_mede.@LTO@ wxs_medi.@LTO@ wxs_menu.@LTO@ \ - wxs_mio.@LTO@ wxs_misc.@LTO@ wxs_mpb.@LTO@ wxs_obj.@LTO@ wxs_panl.@LTO@ wxs_rado.@LTO@ wxs_slid.@LTO@ \ - wxs_snip.@LTO@ wxs_styl.@LTO@ wxs_tabc.@LTO@ wxs_win.@LTO@ wxscheme.@LTO@ + wxs_item.@LTO@ wxs_lbox.@LTO@ wxs_menu.@LTO@ \ + wxs_misc.@LTO@ wxs_obj.@LTO@ wxs_panl.@LTO@ wxs_rado.@LTO@ wxs_slid.@LTO@ \ + wxs_tabc.@LTO@ wxs_win.@LTO@ wxscheme.@LTO@ SOURCES = $(srcdir)/wxs_bmap.cxx $(srcdir)/wxs_butn.cxx $(srcdir)/wxs_chce.cxx $(srcdir)/wxs_ckbx.cxx \ $(srcdir)/wxs_cnvs.cxx $(srcdir)/wxs_dc.cxx $(srcdir)/wxs_evnt.cxx $(srcdir)/wxs_fram.cxx \ $(srcdir)/wxs_gage.cxx $(srcdir)/wxs_gdi.cxx $(srcdir)/wxs_glob.cxx $(srcdir)/wxs_item.cxx \ - $(srcdir)/wxs_lbox.cxx $(srcdir)/wxs_madm.cxx $(srcdir)/wxs_mede.cxx $(srcdir)/wxs_medi.cxx \ - $(srcdir)/wxs_menu.cxx $(srcdir)/wxs_mio.cxx $(srcdir)/wxs_misc.cxx $(srcdir)/wxs_mpb.cxx \ + $(srcdir)/wxs_lbox.cxx \ + $(srcdir)/wxs_menu.cxx $(srcdir)/wxs_misc.cxx \ $(srcdir)/wxs_obj.cxx $(srcdir)/wxs_panl.cxx $(srcdir)/wxs_rado.cxx $(srcdir)/wxs_slid.cxx \ - $(srcdir)/wxs_snip.cxx $(srcdir)/wxs_styl.cxx $(srcdir)/wxs_tabc.cxx $(srcdir)/wxs_win.cxx $(srcdir)/wxscheme.cxx + $(srcdir)/wxs_tabc.cxx $(srcdir)/wxs_win.cxx $(srcdir)/wxscheme.cxx SCRIPTS = $(srcdir)/wxs_bmap.xc $(srcdir)/wxs_butn.xc $(srcdir)/wxs_chce.xc $(srcdir)/wxs_ckbx.xc \ $(srcdir)/wxs_cnvs.xc $(srcdir)/wxs_dc.xc $(srcdir)/wxs_evnt.xc $(srcdir)/wxs_fram.xc \ $(srcdir)/wxs_gage.xc $(srcdir)/wxs_gdi.xc $(srcdir)/wxs_glob.xc $(srcdir)/wxs_item.xc \ - $(srcdir)/wxs_lbox.xc $(srcdir)/wxs_madm.xc $(srcdir)/wxs_mede.xc $(srcdir)/wxs_medi.xc \ - $(srcdir)/wxs_menu.xc $(srcdir)/wxs_mio.xc $(srcdir)/wxs_misc.xc $(srcdir)/wxs_mpb.xc \ + $(srcdir)/wxs_lbox.xc \ + $(srcdir)/wxs_menu.xc $(srcdir)/wxs_misc.xc \ $(srcdir)/wxs_obj.xc $(srcdir)/wxs_panl.xc $(srcdir)/wxs_rado.xc $(srcdir)/wxs_slid.xc \ - $(srcdir)/wxs_snip.xc $(srcdir)/wxs_styl.xc $(srcdir)/wxs_tabc.xc $(srcdir)/wxs_win.xc + $(srcdir)/wxs_tabc.xc $(srcdir)/wxs_win.xc # Order matters: superclasses first -SSDESCS = $(srcdir)/wxs_obj.ss $(srcdir)/wxs_win.ss $(srcdir)/wxs_item.ss $(srcdir)/wxs_medi.ss \ +SSDESCS = $(srcdir)/wxs_obj.ss $(srcdir)/wxs_win.ss $(srcdir)/wxs_item.ss \ $(srcdir)/wxs_bmap.ss $(srcdir)/wxs_butn.ss $(srcdir)/wxs_chce.ss $(srcdir)/wxs_ckbx.ss \ $(srcdir)/wxs_cnvs.ss $(srcdir)/wxs_dc.ss $(srcdir)/wxs_evnt.ss $(srcdir)/wxs_fram.ss \ $(srcdir)/wxs_gage.ss $(srcdir)/wxs_gdi.ss $(srcdir)/wxs_glob.ss \ - $(srcdir)/wxs_lbox.ss $(srcdir)/wxs_madm.ss $(srcdir)/wxs_mede.ss \ - $(srcdir)/wxs_menu.ss $(srcdir)/wxs_mio.ss $(srcdir)/wxs_misc.ss $(srcdir)/wxs_mpb.ss \ + $(srcdir)/wxs_lbox.ss \ + $(srcdir)/wxs_menu.ss $(srcdir)/wxs_misc.ss \ $(srcdir)/wxs_panl.ss $(srcdir)/wxs_rado.ss $(srcdir)/wxs_slid.ss \ - $(srcdir)/wxs_snip.ss $(srcdir)/wxs_styl.ss $(srcdir)/wxs_tabc.ss + $(srcdir)/wxs_tabc.ss all: libwxscheme.@LIBSFX@ @@ -183,20 +182,10 @@ $(srcdir)/wxs_item.cxx : $(srcdir)/wxs_item.xc $(ITEM_DEPEND) $(XCDEPEND) if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_item.cxx ; else $(XCTOCXX) $(srcdir)/wxs_item.xc ; fi $(srcdir)/wxs_lbox.cxx : $(srcdir)/wxs_lbox.xc $(srcdir)/range.xci $(XCDEPEND) $(CB_DEPEND) $(LIST_DEPEND) $(ITEM_DEPEND) if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_lbox.cxx ; else $(XCTOCXX) $(srcdir)/wxs_lbox.xc ; fi -$(srcdir)/wxs_madm.cxx : $(srcdir)/wxs_madm.xc $(srcdir)/wxs_madm.xci $(srcdir)/wxs_fcs.xci $(srcdir)/wxs_bkt.xci $(srcdir)/wxs_win.xci $(XCDEPEND) - if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_madm.cxx ; else $(XCTOCXX) $(srcdir)/wxs_madm.xc ; fi -$(srcdir)/wxs_medi.cxx : $(srcdir)/wxs_medi.xc $(srcdir)/wxs_mbuf.xci $(srcdir)/wxs_fcs.xci $(srcdir)/wxs_eds.xci $(srcdir)/wxs_cret.xci $(srcdir)/wxs_eop.xci $(XCDEPEND) $(LIST_DEPEND) $(srcdir)/wxs_bmt.xci - if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_medi.cxx ; else $(XCTOCXX) $(srcdir)/wxs_medi.xc ; fi -$(srcdir)/wxs_mede.cxx : $(srcdir)/wxs_mede.xc $(srcdir)/wxs_mbuf.xci $(srcdir)/wxs_fcs.xci $(srcdir)/wxs_eds.xci $(srcdir)/wxs_cret.xci $(srcdir)/wxs_bkt.xci $(XCDEPEND) $(LIST_DEPEND) - if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_mede.cxx ; else $(XCTOCXX) $(srcdir)/wxs_mede.xc ; fi $(srcdir)/wxs_menu.cxx : $(srcdir)/wxs_menu.xc $(XCDEPEND) $(CB_DEPEND) $(LIST_DEPEND) if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_menu.cxx ; else $(XCTOCXX) $(srcdir)/wxs_menu.xc ; fi -$(srcdir)/wxs_mio.cxx : $(srcdir)/wxs_mio.xc $(XCDEPEND) $(LIST_DEPEND) - if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_mio.cxx ; else $(XCTOCXX) $(srcdir)/wxs_mio.xc ; fi $(srcdir)/wxs_misc.cxx : $(srcdir)/wxs_misc.xc $(srcdir)/wxs_espc.xci $(XCDEPEND) $(CB_DEPEND) if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_misc.cxx ; else $(XCTOCXX) $(srcdir)/wxs_misc.xc ; fi -$(srcdir)/wxs_mpb.cxx : $(srcdir)/wxs_mpb.xc $(srcdir)/wxs_mbuf.xci $(srcdir)/wxs_eds.xci $(srcdir)/wxs_cret.xci $(srcdir)/wxs_fcs.xci $(XCDEPEND) - if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_mpb.cxx ; else $(XCTOCXX) $(srcdir)/wxs_mpb.xc ; fi $(srcdir)/wxs_obj.cxx : $(srcdir)/wxs_obj.xc $(XCDEPEND) if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_obj.cxx ; else $(XCTOCXX) $(srcdir)/wxs_obj.xc ; fi $(srcdir)/wxs_panl.cxx : $(srcdir)/wxs_panl.xc $(srcdir)/wxs_panl.xci $(srcdir)/wxs_fram.xci $(srcdir)/wxs_cnvs.xci $(srcdir)/wxs_dorf.xci \ @@ -206,10 +195,6 @@ $(srcdir)/wxs_rado.cxx : $(srcdir)/wxs_rado.xc $(srcdir)/range.xci $(XCDEPEND) if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_rado.cxx ; else $(XCTOCXX) $(srcdir)/wxs_rado.xc ; fi $(srcdir)/wxs_slid.cxx : $(srcdir)/wxs_slid.xc $(XCDEPEND) $(CB_DEPEND) $(ITEM_DEPEND) if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_slid.cxx ; else $(XCTOCXX) $(srcdir)/wxs_slid.xc ; fi -$(srcdir)/wxs_snip.cxx : $(srcdir)/wxs_snip.xc $(srcdir)/wxs_snip.xci $(srcdir)/wxs_bmt.xci $(srcdir)/wxs_cret.xci $(srcdir)/wxs_eop.xci $(XCDEPEND) - if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_snip.cxx ; else $(XCTOCXX) $(srcdir)/wxs_snip.xc ; fi -$(srcdir)/wxs_styl.cxx : $(srcdir)/wxs_styl.xc $(XCDEPEND) - if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_styl.cxx ; else $(XCTOCXX) $(srcdir)/wxs_styl.xc ; fi $(srcdir)/wxs_tabc.cxx : $(srcdir)/wxs_tabc.xc $(srcdir)/range.xci $(srcdir)/wxs_item.xci $(LIST_DEPEND) $(CB_DEPEND) $(XCDEPEND) if [ "$(PERL)" = '' ] ; then touch $(srcdir)/wxs_tabc.cxx ; else $(XCTOCXX) $(srcdir)/wxs_tabc.xc ; fi $(srcdir)/wxs_win.cxx : $(srcdir)/wxs_win.xc $(srcdir)/wxs_win.xci $(XCDEPEND) @@ -217,7 +202,7 @@ $(srcdir)/wxs_win.cxx : $(srcdir)/wxs_win.xc $(srcdir)/wxs_win.xci $(XCDEPEND) WXSCC = $(CXX) @USE_WXPRECOMP@ $(WXSCXXFLAGS) $(CXXDEPFLAGS) $(LOCALFLAGS) -c -wxscheme.@LTO@ : $(srcdir)/wxscheme.cxx $(WXSCHEMEHEADERS) $(MEDIAHEADERS) $(DCHEADERS) $(srcdir)/wxsmred.h +wxscheme.@LTO@ : $(srcdir)/wxscheme.cxx $(WXSCHEMEHEADERS) $(DCHEADERS) $(srcdir)/wxsmred.h $(WXSCC) $(srcdir)/wxscheme.cxx -o wxscheme.@LTO@ xcglue.@LTO@ : $(srcdir)/../../mzscheme/utils/xcglue.c $(srcdir)/../../mzscheme/utils/xcglue.h $(WXSCHEMEHEADERS) @@ -249,20 +234,10 @@ wxs_item.@LTO@ : $(srcdir)/wxs_item.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) $(WXSCC) $(srcdir)/wxs_item.cxx -o wxs_item.@LTO@ wxs_lbox.@LTO@ : $(srcdir)/wxs_lbox.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) $(LISTBOXHEADER) $(WXSCC) $(srcdir)/wxs_lbox.cxx -o wxs_lbox.@LTO@ -wxs_madm.@LTO@ : $(srcdir)/wxs_madm.cxx $(WXSCHEMEHEADERS) $(MEDIAHEADERS) $(WINDOWHEADERS) $(MAINDCHEADERS) - $(WXSCC) $(srcdir)/wxs_madm.cxx -o wxs_madm.@LTO@ -wxs_medi.@LTO@ : $(srcdir)/wxs_medi.cxx $(WXSCHEMEHEADERS) $(MEDIAHEADERS) $(WINDOWHEADERS) $(MAINDCHEADERS) - $(WXSCC) $(srcdir)/wxs_medi.cxx -o wxs_medi.@LTO@ -wxs_mede.@LTO@ : $(srcdir)/wxs_mede.cxx $(WXSCHEMEHEADERS) $(MEDIAHEADERS) $(WINDOWHEADERS) $(MAINDCHEADERS) - $(WXSCC) $(srcdir)/wxs_mede.cxx -o wxs_mede.@LTO@ wxs_menu.@LTO@ : $(srcdir)/wxs_menu.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) $(WXSCC) $(srcdir)/wxs_menu.cxx -o wxs_menu.@LTO@ -wxs_mio.@LTO@ : $(srcdir)/wxs_mio.cxx $(WXSCHEMEHEADERS) $(MEDIAHEADERS) $(WINDOWHEADERS) - $(WXSCC) $(srcdir)/wxs_mio.cxx -o wxs_mio.@LTO@ wxs_misc.@LTO@ : $(srcdir)/wxs_misc.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) $(CLIPBHEADER) $(WXSCC) $(srcdir)/wxs_misc.cxx -o wxs_misc.@LTO@ -wxs_mpb.@LTO@ : $(srcdir)/wxs_mpb.cxx $(WXSCHEMEHEADERS) $(MEDIAHEADERS) $(WINDOWHEADERS) $(srcdir)/../wxme/wx_medpb.h $(MAINDCHEADERS) - $(WXSCC) $(srcdir)/wxs_mpb.cxx -o wxs_mpb.@LTO@ wxs_obj.@LTO@ : $(srcdir)/wxs_obj.cxx $(WXSCHEMEHEADERS) $(WXSCC) $(srcdir)/wxs_obj.cxx -o wxs_obj.@LTO@ wxs_panl.@LTO@ : $(srcdir)/wxs_panl.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) @@ -271,10 +246,6 @@ wxs_rado.@LTO@ : $(srcdir)/wxs_rado.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) $(WXSCC) $(srcdir)/wxs_rado.cxx -o wxs_rado.@LTO@ wxs_slid.@LTO@ : $(srcdir)/wxs_slid.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) $(WXSCC) $(srcdir)/wxs_slid.cxx -o wxs_slid.@LTO@ -wxs_snip.@LTO@ : $(srcdir)/wxs_snip.cxx $(WXSCHEMEHEADERS) $(MEDIAHEADERS) $(WINDOWHEADERS) $(MAINDCHEADERS) - $(WXSCC) $(srcdir)/wxs_snip.cxx -o wxs_snip.@LTO@ -wxs_styl.@LTO@ : $(srcdir)/wxs_styl.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) $(srcdir)/../wxme/wx_style.h $(MAINDCHEADERS) - $(WXSCC) $(srcdir)/wxs_styl.cxx -o wxs_styl.@LTO@ wxs_tabc.@LTO@ : $(srcdir)/wxs_tabc.cxx $(WXSCHEMEHEADERS) $(TABCDOWHEADERS) $(WXSCC) $(srcdir)/wxs_tabc.cxx -o wxs_tabc.@LTO@ wxs_win.@LTO@ : $(srcdir)/wxs_win.cxx $(WXSCHEMEHEADERS) $(WINDOWHEADERS) @@ -293,19 +264,12 @@ $(srcdir)/wxs_gdi.ss : $(srcdir)/wxs_gdi.cxx $(srcdir)/wxs_glob.ss : $(srcdir)/wxs_glob.cxx $(srcdir)/wxs_item.ss : $(srcdir)/wxs_item.cxx $(srcdir)/wxs_lbox.ss : $(srcdir)/wxs_lbox.cxx -$(srcdir)/wxs_madm.ss : $(srcdir)/wxs_madm.cxx -$(srcdir)/wxs_mede.ss : $(srcdir)/wxs_mede.cxx -$(srcdir)/wxs_medi.ss : $(srcdir)/wxs_medi.cxx $(srcdir)/wxs_menu.ss : $(srcdir)/wxs_menu.cxx -$(srcdir)/wxs_mio.ss : $(srcdir)/wxs_mio.cxx $(srcdir)/wxs_misc.ss : $(srcdir)/wxs_misc.cxx -$(srcdir)/wxs_mpb.ss : $(srcdir)/wxs_mpb.cxx $(srcdir)/wxs_obj.ss : $(srcdir)/wxs_obj.cxx $(srcdir)/wxs_panl.ss : $(srcdir)/wxs_panl.cxx $(srcdir)/wxs_rado.ss : $(srcdir)/wxs_rado.cxx $(srcdir)/wxs_slid.ss : $(srcdir)/wxs_slid.cxx -$(srcdir)/wxs_snip.ss : $(srcdir)/wxs_snip.cxx -$(srcdir)/wxs_styl.ss : $(srcdir)/wxs_styl.cxx $(srcdir)/wxs_tabc.ss : $(srcdir)/wxs_tabc.cxx $(srcdir)/wxs_win.ss : $(srcdir)/wxs_win.cxx @@ -323,19 +287,12 @@ $(srcdir)/wxs_win.ss : $(srcdir)/wxs_win.cxx @INCLUDEDEP@ wxs_glob.d @INCLUDEDEP@ wxs_item.d @INCLUDEDEP@ wxs_lbox.d -@INCLUDEDEP@ wxs_madm.d -@INCLUDEDEP@ wxs_mede.d -@INCLUDEDEP@ wxs_medi.d @INCLUDEDEP@ wxs_menu.d -@INCLUDEDEP@ wxs_mio.d @INCLUDEDEP@ wxs_misc.d -@INCLUDEDEP@ wxs_mpb.d @INCLUDEDEP@ wxs_obj.d @INCLUDEDEP@ wxs_panl.d @INCLUDEDEP@ wxs_rado.d @INCLUDEDEP@ wxs_slid.d -@INCLUDEDEP@ wxs_snip.d -@INCLUDEDEP@ wxs_styl.d @INCLUDEDEP@ wxs_tabc.d @INCLUDEDEP@ wxs_win.d @INCLUDEDEP@ wxscheme.d diff --git a/src/mred/wxs/ktail.ss b/src/mred/wxs/ktail.ss index 463412edd1..674cc0807a 100644 --- a/src/mred/wxs/ktail.ss +++ b/src/mred/wxs/ktail.ss @@ -3,7 +3,6 @@ (define-functions special-control-key special-option-key - map-command-as-meta-key application-file-handler application-quit-handler application-about-handler @@ -28,20 +27,19 @@ shortcut-visible-in-label? eventspace-shutdown? in-atomic-region - set-editor-snip-maker - set-text-editor-maker - set-pasteboard-editor-maker set-menu-tester location->window set-dialogs set-executer send-event file-creator-and-type - set-snip-class-getter - set-editor-data-class-getter set-ps-procs main-eventspace? - eventspace-handler-thread) + eventspace-handler-thread + begin-refresh-sequence + end-refresh-sequence + run-printout + get-double-click-time) ) ;; end diff --git a/src/mred/wxs/wxs_cret.xci b/src/mred/wxs/wxs_cret.xci deleted file mode 100644 index 84db1a1f8f..0000000000 --- a/src/mred/wxs/wxs_cret.xci +++ /dev/null @@ -1,7 +0,0 @@ - -@BEGINSYMBOLS caret > ONE > PRED -@SYM "no-caret" : wxSNIP_DRAW_NO_CARET -@SYM "show-caret" : wxSNIP_DRAW_SHOW_CARET -@SYM "show-inactive-caret" : wxSNIP_DRAW_SHOW_INACTIVE_CARET -@ENDSYMBOLS - diff --git a/src/mred/wxs/wxs_dc.cxx b/src/mred/wxs/wxs_dc.cxx index 808f707f41..e6c13b9dd7 100644 --- a/src/mred/wxs/wxs_dc.cxx +++ b/src/mred/wxs/wxs_dc.cxx @@ -1123,6 +1123,7 @@ static l_TYPE l_POINT *l_MAKE_ARRAY(Scheme_Object *l, l_INTTYPE *c, char *who) + class os_wxDC : public wxDC { public: @@ -1150,6 +1151,27 @@ os_wxDC::~os_wxDC() objscheme_destroy(this, (Scheme_Object *) __gc_external); } +static Scheme_Object *os_wxDCCacheFontMetricsKey(int n, Scheme_Object *p[]) +{ + WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) + REMEMBER_VAR_STACK(); + int r; + objscheme_check_valid(os_wxDC_class, "cache-font-metrics-key in dc<%>", n, p); + + SETUP_VAR_STACK_REMEMBERED(1); + VAR_STACK_PUSH(0, p); + + + + + r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->CacheFontMetricsKey()); + + + + READY_TO_RETURN; + return scheme_make_integer(r); +} + static Scheme_Object *os_wxDCGetAlpha(int n, Scheme_Object *p[]) { WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) @@ -2572,8 +2594,9 @@ void objscheme_setup_wxDC(Scheme_Env *env) wxREGGLOB(os_wxDC_class); wxREGGLOB(os_wxDC_interface); - os_wxDC_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "dc%", "object%", NULL, 51)); + os_wxDC_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "dc%", "object%", NULL, 52)); + WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "cache-font-metrics-key" " method", (Scheme_Method_Prim *)os_wxDCCacheFontMetricsKey, 0, 0)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-alpha" " method", (Scheme_Method_Prim *)os_wxDCGetAlpha, 0, 0)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-alpha" " method", (Scheme_Method_Prim *)os_wxDCSetAlpha, 1, 1)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "glyph-exists?" " method", (Scheme_Method_Prim *)os_wxDCGlyphAvailable, 1, 2)); diff --git a/src/mred/wxs/wxs_dc.xc b/src/mred/wxs/wxs_dc.xc index 9b2abf8414..d9046512ca 100644 --- a/src/mred/wxs/wxs_dc.xc +++ b/src/mred/wxs/wxs_dc.xc @@ -736,6 +736,8 @@ START_XFORM_SKIP; @ "set-alpha" : void SetAlpha(rdouble[0|1]); @ "get-alpha" : double GetAlpha(); +@ "cache-font-metrics-key" : int CacheFontMetricsKey(); + @END @GLOBAL wxDCGlobal diff --git a/src/mred/wxs/wxs_eds.xci b/src/mred/wxs/wxs_eds.xci deleted file mode 100644 index 6bdf9dd586..0000000000 --- a/src/mred/wxs/wxs_eds.xci +++ /dev/null @@ -1,19 +0,0 @@ - -@BEGINSYMBOLS bufferType > ONE > PRED -@SYM "text" : wxEDIT_BUFFER -@SYM "pasteboard" : wxPASTEBOARD_BUFFER -@ENDSYMBOLS - -@BEGINSYMBOLS fileType > ONE > PRED -@SYM "guess" : wxMEDIA_FF_GUESS -@SYM "standard" : wxMEDIA_FF_STD -@SYM "text" : wxMEDIA_FF_TEXT -@SYM "text-force-cr" : wxMEDIA_FF_TEXT_FORCE_CR -@SYM "same" : wxMEDIA_FF_SAME -@SYM "copy" : wxMEDIA_FF_COPY -@ENDSYMBOLS - -@INCLUDE wxs_fcs.xci - -@INCLUDE wxs_cret.xci - diff --git a/src/mred/wxs/wxs_fcs.xci b/src/mred/wxs/wxs_fcs.xci deleted file mode 100644 index 8e3dcc5616..0000000000 --- a/src/mred/wxs/wxs_fcs.xci +++ /dev/null @@ -1,15 +0,0 @@ - -@BEGINSYMBOLS focus > ONE > PRED -@SYM "immediate" : wxFOCUS_IMMEDIATE -@SYM "display" : wxFOCUS_DISPLAY -@SYM "global" : wxFOCUS_GLOBAL -@ENDSYMBOLS - -# define Sym_END 1 -# define Sym_START -1 -# define Sym_NONE 0 -@BEGINSYMBOLS bias > ONE > PRED -@SYM "start" : Sym_START -@SYM "none" : Sym_NONE -@SYM "end" : Sym_END -@ENDSYMBOLS diff --git a/src/mred/wxs/wxs_gdi.cxx b/src/mred/wxs/wxs_gdi.cxx index b9acb128cd..f1c68147ae 100644 --- a/src/mred/wxs/wxs_gdi.cxx +++ b/src/mred/wxs/wxs_gdi.cxx @@ -1000,6 +1000,9 @@ class os_wxColour : public wxColour { #endif #ifndef MZ_PRECISE_GC os_wxColour CONSTRUCTOR_ARGS((string x0)); +#endif +#ifndef MZ_PRECISE_GC + os_wxColour CONSTRUCTOR_ARGS((class wxColour* x0)); #endif ~os_wxColour(); #ifdef MZ_PRECISE_GC @@ -1038,6 +1041,13 @@ CONSTRUCTOR_INIT(: wxColour(x0)) } #endif +#ifndef MZ_PRECISE_GC +os_wxColour::os_wxColour CONSTRUCTOR_ARGS((class wxColour* x0)) +CONSTRUCTOR_INIT(: wxColour(x0)) +{ +} +#endif + os_wxColour::~os_wxColour() { objscheme_destroy(this, (Scheme_Object *) __gc_external); @@ -1183,7 +1193,29 @@ static Scheme_Object *os_wxColour_ConstructScheme(int n, Scheme_Object *p[]) PRE_VAR_STACK_PUSH(0, p); os_wxColour *realobj INIT_NULLED_OUT; REMEMBER_VAR_STACK(); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[POFFSET+0], NULL))) { + if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 1))) { + class wxColour* x0 INIT_NULLED_OUT; + + SETUP_VAR_STACK_PRE_REMEMBERED(3); + VAR_STACK_PUSH(0, p); + VAR_STACK_PUSH(1, realobj); + VAR_STACK_PUSH(2, x0); + + + if (n != (POFFSET+1)) + WITH_VAR_STACK(scheme_wrong_count_m("initialization in color% (color object case)", POFFSET+1, POFFSET+1, n, p, 1)); + x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "initialization in color% (color object case)", 1)); + + + realobj = WITH_VAR_STACK(new os_wxColour CONSTRUCTOR_ARGS((x0))); +#ifdef MZ_PRECISE_GC + WITH_VAR_STACK(realobj->gcInit_wxColour(x0)); +#endif + realobj->__gc_external = (void *)p[0]; + + + READY_TO_PRE_RETURN; + } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[POFFSET+0], NULL))) { string x0 INIT_NULLED_OUT; SETUP_VAR_STACK_PRE_REMEMBERED(3); diff --git a/src/mred/wxs/wxs_gdi.h b/src/mred/wxs/wxs_gdi.h index 7af1140c41..3088fc3105 100644 --- a/src/mred/wxs/wxs_gdi.h +++ b/src/mred/wxs/wxs_gdi.h @@ -14,6 +14,8 @@ Scheme_Object *objscheme_bundle_wxFontList(class wxFontList *realobj); class wxFontList *objscheme_unbundle_wxFontList(Scheme_Object *obj, const char *where, int nullOK); extern class wxColour *objscheme_unbundle_wxColour(Scheme_Object *, const char *, int); extern Scheme_Object *objscheme_bundle_wxColour(class wxColour *); +extern int objscheme_istype_wxColour(Scheme_Object *, const char *, int); +extern class wxColour *objscheme_unbundle_wxColour(Scheme_Object *, const char *, int); #endif void objscheme_setup_wxColour(Scheme_Env *env); #ifndef WXS_SETUP_ONLY diff --git a/src/mred/wxs/wxs_gdi.xc b/src/mred/wxs/wxs_gdi.xc index 8ee78d6ab4..c8895d8548 100644 --- a/src/mred/wxs/wxs_gdi.xc +++ b/src/mred/wxs/wxs_gdi.xc @@ -88,6 +88,7 @@ @CREATOR (); <> no argument @CREATOR (ubyte,ubyte,ubyte); <> rgb values @CREATOR (string); <> color name +@CREATOR (wxColour^); <> color object @ "copy-from" : wxColour! CopyFrom(wxColour!); : : /CHECKMUT[wxColour."color".METHODNAME("color%","copy-from")] // @ "get" : void Get(ubyte*,ubyte*,ubyte*); diff --git a/src/mred/wxs/wxs_madm.cxx b/src/mred/wxs/wxs_madm.cxx deleted file mode 100644 index 4407f955f2..0000000000 --- a/src/mred/wxs/wxs_madm.cxx +++ /dev/null @@ -1,5526 +0,0 @@ -/* DO NOT EDIT THIS FILE. */ -/* This file was generated by xctocc from "wxs_madm.xc". */ - - -#if defined(_MSC_VER) -# include "wx.h" -#endif -#if defined(OS_X) -# include "common.h" -#endif - -#include "wx_media.h" -#include "wx_frame.h" -#include "wx_panel.h" - - - - -#ifdef wx_x -# define BM_SELECTED(map) ((map)->selectedTo) -#endif -#if defined(wx_mac) || defined(wx_msw) -# define BM_SELECTED(map) ((map)->selectedInto) -#endif -# define BM_IN_USE(map) ((map)->selectedIntoDC) - - - - -#define ESCAPE_NO_RET_VAL /*empty*/ - - -#include "wxscheme.h" -#include "wxs_madm.h" - -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - -#include "wxs_obj.h" -#include "wxs_evnt.h" - -#ifndef wxCONTROL_BORDER -# define wxCONTROL_BORDER wxBORDER -#endif - - - -extern Bool wxsCheckIsPopupMenu(void *m); - -#ifndef wx_mac -# define wxRESIZE_CORNER 0 -#endif - -static Scheme_Object *style_wxMCANVAS_NO_H_SCROLL_sym = NULL; -static Scheme_Object *style_wxMCANVAS_NO_V_SCROLL_sym = NULL; -static Scheme_Object *style_wxMCANVAS_HIDE_H_SCROLL_sym = NULL; -static Scheme_Object *style_wxMCANVAS_HIDE_V_SCROLL_sym = NULL; -static Scheme_Object *style_wxMCANVAS_AUTO_H_SCROLL_sym = NULL; -static Scheme_Object *style_wxMCANVAS_AUTO_V_SCROLL_sym = NULL; -static Scheme_Object *style_wxINVISIBLE_sym = NULL; -static Scheme_Object *style_wxCONTROL_BORDER_sym = NULL; -static Scheme_Object *style_wxCOMBO_SIDE_sym = NULL; -static Scheme_Object *style_wxTRANSPARENT_WIN_sym = NULL; -static Scheme_Object *style_wxBORDER_sym = NULL; -static Scheme_Object *style_wxRESIZE_CORNER_sym = NULL; - -static void init_symset_style(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(style_wxMCANVAS_NO_H_SCROLL_sym); - style_wxMCANVAS_NO_H_SCROLL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("no-hscroll")); - wxREGGLOB(style_wxMCANVAS_NO_V_SCROLL_sym); - style_wxMCANVAS_NO_V_SCROLL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("no-vscroll")); - wxREGGLOB(style_wxMCANVAS_HIDE_H_SCROLL_sym); - style_wxMCANVAS_HIDE_H_SCROLL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hide-hscroll")); - wxREGGLOB(style_wxMCANVAS_HIDE_V_SCROLL_sym); - style_wxMCANVAS_HIDE_V_SCROLL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hide-vscroll")); - wxREGGLOB(style_wxMCANVAS_AUTO_H_SCROLL_sym); - style_wxMCANVAS_AUTO_H_SCROLL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("auto-hscroll")); - wxREGGLOB(style_wxMCANVAS_AUTO_V_SCROLL_sym); - style_wxMCANVAS_AUTO_V_SCROLL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("auto-vscroll")); - wxREGGLOB(style_wxINVISIBLE_sym); - style_wxINVISIBLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("deleted")); - wxREGGLOB(style_wxCONTROL_BORDER_sym); - style_wxCONTROL_BORDER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("control-border")); - wxREGGLOB(style_wxCOMBO_SIDE_sym); - style_wxCOMBO_SIDE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("combo")); - wxREGGLOB(style_wxTRANSPARENT_WIN_sym); - style_wxTRANSPARENT_WIN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("transparent")); - wxREGGLOB(style_wxBORDER_sym); - style_wxBORDER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("border")); - wxREGGLOB(style_wxRESIZE_CORNER_sym); - style_wxRESIZE_CORNER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("resize-corner")); -} - -static int unbundle_symset_style(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!style_wxRESIZE_CORNER_sym) WITH_VAR_STACK(init_symset_style()); - Scheme_Object *i INIT_NULLED_OUT, *l = v; - long result = 0; - while (SCHEME_PAIRP(l)) { - i = SCHEME_CAR(l); - if (0) { } - else if (i == style_wxMCANVAS_NO_H_SCROLL_sym) { result = result | wxMCANVAS_NO_H_SCROLL; } - else if (i == style_wxMCANVAS_NO_V_SCROLL_sym) { result = result | wxMCANVAS_NO_V_SCROLL; } - else if (i == style_wxMCANVAS_HIDE_H_SCROLL_sym) { result = result | wxMCANVAS_HIDE_H_SCROLL; } - else if (i == style_wxMCANVAS_HIDE_V_SCROLL_sym) { result = result | wxMCANVAS_HIDE_V_SCROLL; } - else if (i == style_wxMCANVAS_AUTO_H_SCROLL_sym) { result = result | wxMCANVAS_AUTO_H_SCROLL; } - else if (i == style_wxMCANVAS_AUTO_V_SCROLL_sym) { result = result | wxMCANVAS_AUTO_V_SCROLL; } - else if (i == style_wxINVISIBLE_sym) { result = result | wxINVISIBLE; } - else if (i == style_wxCONTROL_BORDER_sym) { result = result | wxCONTROL_BORDER; } - else if (i == style_wxCOMBO_SIDE_sym) { result = result | wxCOMBO_SIDE; } - else if (i == style_wxTRANSPARENT_WIN_sym) { result = result | wxTRANSPARENT_WIN; } - else if (i == style_wxBORDER_sym) { result = result | wxBORDER; } - else if (i == style_wxRESIZE_CORNER_sym) { result = result | wxRESIZE_CORNER; } - else { break; } - l = SCHEME_CDR(l); - } - if (SCHEME_NULLP(l)) { READY_TO_RETURN; return result; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "style symbol list", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - - -static Scheme_Object *focus_wxFOCUS_IMMEDIATE_sym = NULL; -static Scheme_Object *focus_wxFOCUS_DISPLAY_sym = NULL; -static Scheme_Object *focus_wxFOCUS_GLOBAL_sym = NULL; - -static void init_symset_focus(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(focus_wxFOCUS_IMMEDIATE_sym); - focus_wxFOCUS_IMMEDIATE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("immediate")); - wxREGGLOB(focus_wxFOCUS_DISPLAY_sym); - focus_wxFOCUS_DISPLAY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("display")); - wxREGGLOB(focus_wxFOCUS_GLOBAL_sym); - focus_wxFOCUS_GLOBAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("global")); -} - -static int unbundle_symset_focus(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!focus_wxFOCUS_GLOBAL_sym) WITH_VAR_STACK(init_symset_focus()); - if (0) { } - else if (v == focus_wxFOCUS_IMMEDIATE_sym) { READY_TO_RETURN; return wxFOCUS_IMMEDIATE; } - else if (v == focus_wxFOCUS_DISPLAY_sym) { READY_TO_RETURN; return wxFOCUS_DISPLAY; } - else if (v == focus_wxFOCUS_GLOBAL_sym) { READY_TO_RETURN; return wxFOCUS_GLOBAL; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "focus symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_focus(int v) { - if (!focus_wxFOCUS_GLOBAL_sym) init_symset_focus(); - switch (v) { - case wxFOCUS_IMMEDIATE: return focus_wxFOCUS_IMMEDIATE_sym; - case wxFOCUS_DISPLAY: return focus_wxFOCUS_DISPLAY_sym; - case wxFOCUS_GLOBAL: return focus_wxFOCUS_GLOBAL_sym; - default: return NULL; - } -} - - -# define Sym_END 1 -# define Sym_START -1 -# define Sym_NONE 0 -static Scheme_Object *bias_Sym_START_sym = NULL; -static Scheme_Object *bias_Sym_NONE_sym = NULL; -static Scheme_Object *bias_Sym_END_sym = NULL; - -static void init_symset_bias(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bias_Sym_START_sym); - bias_Sym_START_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("start")); - wxREGGLOB(bias_Sym_NONE_sym); - bias_Sym_NONE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("none")); - wxREGGLOB(bias_Sym_END_sym); - bias_Sym_END_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("end")); -} - -static int unbundle_symset_bias(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bias_Sym_END_sym) WITH_VAR_STACK(init_symset_bias()); - if (0) { } - else if (v == bias_Sym_START_sym) { READY_TO_RETURN; return Sym_START; } - else if (v == bias_Sym_NONE_sym) { READY_TO_RETURN; return Sym_NONE; } - else if (v == bias_Sym_END_sym) { READY_TO_RETURN; return Sym_END; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bias symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bias(int v) { - if (!bias_Sym_END_sym) init_symset_bias(); - switch (v) { - case Sym_START: return bias_Sym_START_sym; - case Sym_NONE: return bias_Sym_NONE_sym; - case Sym_END: return bias_Sym_END_sym; - default: return NULL; - } -} - - -static void *DoCAPOCallback(void *data) -{ - return (void *)scheme_apply_multi((Scheme_Object *)data, 0, NULL); -} - -typedef void *(*CAPOFunc)(void*); - - -// @CREATOR (wxFrame!,int=-1,int=-1,int=-1,int=-1, string="",SYM[style]=0,int=100,wxMediaBuffer^=NULL); : : /NOZERO[3]|NOZERO[4] <> frame - - - - - - -// No OnScroll, because it's handled more primitively to better support -// interactive scrolling on Mac OS X and Windows -// @ v "on-scroll" : void OnScroll(wxScrollEvent!); : JMPDECL/SETJMP/RESETJMP - - - - - - - - - - - - - - - - - - - - - -class os_wxMediaCanvas : public wxMediaCanvas { - public: - - os_wxMediaCanvas CONSTRUCTOR_ARGS((class wxPanel* x0, int x1 = -1, int x2 = -1, int x3 = -1, int x4 = -1, string x5 = "", int x6 = 0, int x7 = 100, class wxMediaBuffer* x8 = NULL, class wxGLConfig* x9 = NULL)); - ~os_wxMediaCanvas(); - void OnChar(class wxKeyEvent* x0); - void OnEvent(class wxMouseEvent* x0); - void OnPaint(); - void OnDropFile(epathname x0); - Bool PreOnEvent(class wxWindow* x0, class wxMouseEvent* x1); - Bool PreOnChar(class wxWindow* x0, class wxKeyEvent* x1); - void OnSize(int x0, int x1); - void OnSetFocus(); - void OnKillFocus(); - class wxMenu* PopupForMedia(class wxMediaBuffer* x0, void* x1); - void OnScrollOnChange(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaCanvas::gcMark() { - wxMediaCanvas::gcMark(); -} -void os_wxMediaCanvas::gcFixup() { - wxMediaCanvas::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaCanvas_class; - -os_wxMediaCanvas::os_wxMediaCanvas CONSTRUCTOR_ARGS((class wxPanel* x0, int x1, int x2, int x3, int x4, string x5, int x6, int x7, class wxMediaBuffer* x8, class wxGLConfig* x9)) -CONSTRUCTOR_INIT(: wxMediaCanvas(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)) -{ -} - -os_wxMediaCanvas::~os_wxMediaCanvas() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaCanvasOnChar(int n, Scheme_Object *p[]); - -void os_wxMediaCanvas::OnChar(class wxKeyEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasOnChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaCanvas::OnChar(x0); - } else { - mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread; - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x0)); - ESCAPE_BLOCK(ESCAPE_NO_RET_VAL) - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - { thread = scheme_get_current_thread(); thread->error_buf = savebuf; } - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaCanvasOnEvent(int n, Scheme_Object *p[]); - -void os_wxMediaCanvas::OnEvent(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasOnEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaCanvas::OnEvent(x0); - } else { - mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread; - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - ESCAPE_BLOCK(ESCAPE_NO_RET_VAL) - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - { thread = scheme_get_current_thread(); thread->error_buf = savebuf; } - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaCanvasOnPaint(int n, Scheme_Object *p[]); - -void os_wxMediaCanvas::OnPaint() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "on-paint", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasOnPaint)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaCanvas::OnPaint(); - } else { - mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread; - ESCAPE_BLOCK(ESCAPE_NO_RET_VAL) - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - { thread = scheme_get_current_thread(); thread->error_buf = savebuf; } - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaCanvasOnDropFile(int n, Scheme_Object *p[]); - -void os_wxMediaCanvas::OnDropFile(epathname x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "on-drop-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasOnDropFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaCanvas::OnDropFile(x0); - } else { - mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread; - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - ESCAPE_BLOCK(ESCAPE_NO_RET_VAL) - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - { thread = scheme_get_current_thread(); thread->error_buf = savebuf; } - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaCanvasPreOnEvent(int n, Scheme_Object *p[]); - -Bool os_wxMediaCanvas::PreOnEvent(class wxWindow* x0, class wxMouseEvent* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "pre-on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasPreOnEvent)) { - SET_VAR_STACK(); - return FALSE; - } else { - mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread; - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxWindow(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x1)); - ESCAPE_BLOCK(1) - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - { thread = scheme_get_current_thread(); thread->error_buf = savebuf; } - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "pre-on-event in editor-canvas%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaCanvasPreOnChar(int n, Scheme_Object *p[]); - -Bool os_wxMediaCanvas::PreOnChar(class wxWindow* x0, class wxKeyEvent* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "pre-on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasPreOnChar)) { - SET_VAR_STACK(); - return FALSE; - } else { - mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread; - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxWindow(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x1)); - ESCAPE_BLOCK(1) - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - { thread = scheme_get_current_thread(); thread->error_buf = savebuf; } - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "pre-on-char in editor-canvas%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaCanvasOnSize(int n, Scheme_Object *p[]); - -void os_wxMediaCanvas::OnSize(int x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "on-size", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasOnSize)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaCanvas::OnSize(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaCanvasOnSetFocus(int n, Scheme_Object *p[]); - -void os_wxMediaCanvas::OnSetFocus() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "on-set-focus", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasOnSetFocus)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaCanvas::OnSetFocus(); - } else { - mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread; - ESCAPE_BLOCK(ESCAPE_NO_RET_VAL) - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - { thread = scheme_get_current_thread(); thread->error_buf = savebuf; } - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaCanvasOnKillFocus(int n, Scheme_Object *p[]); - -void os_wxMediaCanvas::OnKillFocus() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "on-kill-focus", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasOnKillFocus)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaCanvas::OnKillFocus(); - } else { - mz_jmp_buf *savebuf, newbuf; Scheme_Thread *thread; - ESCAPE_BLOCK(ESCAPE_NO_RET_VAL) - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - { thread = scheme_get_current_thread(); thread->error_buf = savebuf; } - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaCanvasPopupForMedia(int n, Scheme_Object *p[]); - -class wxMenu* os_wxMediaCanvas::PopupForMedia(class wxMediaBuffer* x0, void* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "popup-for-editor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasPopupForMedia)) { - SET_VAR_STACK(); - return NULL; - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaBuffer(x0)); - p[POFFSET+1] = ((Scheme_Object *)x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - class wxMenu* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxMenu(v, "popup-for-editor in editor-canvas%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaCanvasOnScrollOnChange(int n, Scheme_Object *p[]); - -void os_wxMediaCanvas::OnScrollOnChange() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaCanvas *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaCanvas_class, "on-scroll-on-change", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaCanvasOnScrollOnChange)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaCanvas::OnScrollOnChange(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaCanvasOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "on-char in editor-canvas%", n, p); - class wxKeyEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+0], "on-char in editor-canvas%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::OnChar(x0)); - else - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->OnChar(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "on-event in editor-canvas%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "on-event in editor-canvas%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::OnEvent(x0)); - else - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->OnEvent(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasOnPaint(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "on-paint in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::OnPaint()); - else - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->OnPaint()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasOnDropFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "on-drop-file in editor-canvas%", n, p); - epathname x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "on-drop-file in editor-canvas%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::OnDropFile(x0)); - else - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->OnDropFile(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasPreOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaCanvas_class, "pre-on-event in editor-canvas%", n, p); - class wxWindow* x0 INIT_NULLED_OUT; - class wxMouseEvent* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxWindow(p[POFFSET+0], "pre-on-event in editor-canvas%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+1], "pre-on-event in editor-canvas%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)-> wxWindow::PreOnEvent(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->PreOnEvent(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaCanvasPreOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaCanvas_class, "pre-on-char in editor-canvas%", n, p); - class wxWindow* x0 INIT_NULLED_OUT; - class wxKeyEvent* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxWindow(p[POFFSET+0], "pre-on-char in editor-canvas%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+1], "pre-on-char in editor-canvas%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)-> wxWindow::PreOnChar(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->PreOnChar(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaCanvasOnSize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "on-size in editor-canvas%", n, p); - int x0; - int x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "on-size in editor-canvas%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+1], "on-size in editor-canvas%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::OnSize(x0, x1)); - else - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->OnSize(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasOnSetFocus(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "on-set-focus in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::OnSetFocus()); - else - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->OnSetFocus()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasOnKillFocus(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "on-kill-focus in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::OnKillFocus()); - else - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->OnKillFocus()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasPopupForMedia(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMenu* r; - objscheme_check_valid(os_wxMediaCanvas_class, "popup-for-editor in editor-canvas%", n, p); - class wxMediaBuffer* x0 INIT_NULLED_OUT; - void* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(p[POFFSET+0], "popup-for-editor in editor-canvas%", 1)); - x1 = ((void *)p[POFFSET+1]); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::PopupForMedia(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->PopupForMedia(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMenu(r)); -} - -static Scheme_Object *os_wxMediaCanvasCallAsPrimaryOwner(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - void* r; - objscheme_check_valid(os_wxMediaCanvas_class, "call-as-primary-owner in editor-canvas%", n, p); - CAPOFunc x0; - void* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - x0 = DoCAPOCallback; - x1 = p[POFFSET]; - - - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->CallAsPrimaryOwner(x0, x1)); - - - - READY_TO_RETURN; - return (Scheme_Object*)r; -} - -static Scheme_Object *os_wxMediaCanvasGetCanvasBackground(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxColour* r; - objscheme_check_valid(os_wxMediaCanvas_class, "get-canvas-background in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->GetCanvasBackground()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r)); -} - -static Scheme_Object *os_wxMediaCanvasSetCanvasBackground(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "set-canvas-background in editor-canvas%", n, p); - class wxColour* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "set-canvas-background in editor-canvas%", 1)); - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->SetCanvasBackground(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasSetYMargin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "set-y-margin in editor-canvas%", n, p); - nnint x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-y-margin in editor-canvas%")); - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->SetYMargin(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasSetXMargin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "set-x-margin in editor-canvas%", n, p); - nnint x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-x-margin in editor-canvas%")); - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->SetXMargin(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasGetYMargin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnint r; - objscheme_check_valid(os_wxMediaCanvas_class, "get-y-margin in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->GetYMargin()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaCanvasGetXMargin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnint r; - objscheme_check_valid(os_wxMediaCanvas_class, "get-x-margin in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->GetXMargin()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaCanvasClearMargins(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "clear-margins in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->ClearMargins()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasScrollTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaCanvas_class, "scroll-to in editor-canvas%", n, p); - double x0; - double x1; - nndouble x2; - nndouble x3; - Bool x4; - int x5; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "scroll-to in editor-canvas%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "scroll-to in editor-canvas%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "scroll-to in editor-canvas%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "scroll-to in editor-canvas%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "scroll-to in editor-canvas%")); - if (n > (POFFSET+5)) { - x5 = WITH_VAR_STACK(unbundle_symset_bias(p[POFFSET+5], "scroll-to in editor-canvas%")); - } else - x5 = 0; - - - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->ScrollTo(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaCanvasSetLazyRefresh(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "set-lazy-refresh in editor-canvas%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-lazy-refresh in editor-canvas%")); - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->SetLazyRefresh(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasGetLazyRefresh(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaCanvas_class, "get-lazy-refresh in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->GetLazyRefresh()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaCanvasScrollWithBottomBase(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "scroll-with-bottom-base in editor-canvas%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "scroll-with-bottom-base in editor-canvas%")); - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->ScrollWithBottomBase(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasAllowScrollToLast(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "allow-scroll-to-last in editor-canvas%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "allow-scroll-to-last in editor-canvas%")); - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->AllowScrollToLast(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasForceDisplayFocus(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "force-display-focus in editor-canvas%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "force-display-focus in editor-canvas%")); - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->ForceDisplayFocus(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasIsFocusOn(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaCanvas_class, "is-focus-on? in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->IsFocusOn()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaCanvasOnScrollOnChange(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "on-scroll-on-change in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaCanvas::OnScrollOnChange()); - else - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->OnScrollOnChange()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvasGetMedia(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaBuffer* r; - objscheme_check_valid(os_wxMediaCanvas_class, "get-editor in editor-canvas%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->GetMedia()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaBuffer(r)); -} - -static Scheme_Object *os_wxMediaCanvasSetMedia(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaCanvas_class, "set-editor in editor-canvas%", n, p); - class wxMediaBuffer* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(p[POFFSET+0], "set-editor in editor-canvas%", 1)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "set-editor in editor-canvas%")); - } else - x1 = TRUE; - - - WITH_VAR_STACK(((wxMediaCanvas *)((Scheme_Class_Object *)p[0])->primdata)->SetMedia(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxMediaCanvas_Getwheel_amt(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - nnint v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxMediaCanvas_class, "get-wheel-step in editor-canvas%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-wheel-step in editor-canvas%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxMediaCanvas *)cobj->primdata)->wxMediaCanvas::wheel_amt; - else - v = ((wxMediaCanvas *)cobj->primdata)->wheel_amt; - - return scheme_make_integer(v); -} - -static Scheme_Object *objscheme_wxMediaCanvas_Setwheel_amt(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - nnint v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxMediaCanvas_class, "set-wheel-step in editor-canvas%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-wheel-step in editor-canvas%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET], "set-wheel-step in editor-canvas%")); - ((wxMediaCanvas *)cobj->primdata)->wheel_amt = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaCanvas_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaCanvas *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - class wxPanel* x0 INIT_NULLED_OUT; - int x1; - int x2; - int x3; - int x4; - string x5 INIT_NULLED_OUT; - int x6; - int x7; - class wxMediaBuffer* x8 INIT_NULLED_OUT; - class wxGLConfig* x9 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(6); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x0); - VAR_STACK_PUSH(3, x5); - VAR_STACK_PUSH(4, x8); - VAR_STACK_PUSH(5, x9); - - - if ((n < (POFFSET+1)) || (n > (POFFSET+10))) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-canvas%", POFFSET+1, POFFSET+10, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxPanel(p[POFFSET+0], "initialization in editor-canvas%", 0)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+1], "initialization in editor-canvas%")); - } else - x1 = -1; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+2], "initialization in editor-canvas%")); - } else - x2 = -1; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+3], "initialization in editor-canvas%")); - } else - x3 = -1; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+4], "initialization in editor-canvas%")); - } else - x4 = -1; - if (n > (POFFSET+5)) { - x5 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+5], "initialization in editor-canvas%")); - } else - x5 = ""; - if (n > (POFFSET+6)) { - x6 = WITH_VAR_STACK(unbundle_symset_style(p[POFFSET+6], "initialization in editor-canvas%")); - } else - x6 = 0; - if (n > (POFFSET+7)) { - x7 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+7], "initialization in editor-canvas%")); - } else - x7 = 100; - if (n > (POFFSET+8)) { - x8 = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(p[POFFSET+8], "initialization in editor-canvas%", 1)); - } else - x8 = NULL; - if (n > (POFFSET+9)) { - x9 = WITH_VAR_STACK(objscheme_unbundle_wxGLConfig(p[POFFSET+9], "initialization in editor-canvas%", 1)); - } else - x9 = NULL; - - if (!x3) x3 = -1;if (!x4) x4 = -1; - realobj = WITH_VAR_STACK(new os_wxMediaCanvas CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4, x5, x6, x7, x8, x9))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaCanvas(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxMediaCanvas(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaCanvas_class); - - os_wxMediaCanvas_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-canvas%", "canvas%", (Scheme_Method_Prim *)os_wxMediaCanvas_ConstructScheme, 30)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "on-char" " method", (Scheme_Method_Prim *)os_wxMediaCanvasOnChar, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "on-event" " method", (Scheme_Method_Prim *)os_wxMediaCanvasOnEvent, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "on-paint" " method", (Scheme_Method_Prim *)os_wxMediaCanvasOnPaint, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "on-drop-file" " method", (Scheme_Method_Prim *)os_wxMediaCanvasOnDropFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "pre-on-event" " method", (Scheme_Method_Prim *)os_wxMediaCanvasPreOnEvent, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "pre-on-char" " method", (Scheme_Method_Prim *)os_wxMediaCanvasPreOnChar, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "on-size" " method", (Scheme_Method_Prim *)os_wxMediaCanvasOnSize, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "on-set-focus" " method", (Scheme_Method_Prim *)os_wxMediaCanvasOnSetFocus, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "on-kill-focus" " method", (Scheme_Method_Prim *)os_wxMediaCanvasOnKillFocus, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "popup-for-editor" " method", (Scheme_Method_Prim *)os_wxMediaCanvasPopupForMedia, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "call-as-primary-owner" " method", (Scheme_Method_Prim *)os_wxMediaCanvasCallAsPrimaryOwner, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "get-canvas-background" " method", (Scheme_Method_Prim *)os_wxMediaCanvasGetCanvasBackground, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "set-canvas-background" " method", (Scheme_Method_Prim *)os_wxMediaCanvasSetCanvasBackground, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "set-y-margin" " method", (Scheme_Method_Prim *)os_wxMediaCanvasSetYMargin, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "set-x-margin" " method", (Scheme_Method_Prim *)os_wxMediaCanvasSetXMargin, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "get-y-margin" " method", (Scheme_Method_Prim *)os_wxMediaCanvasGetYMargin, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "get-x-margin" " method", (Scheme_Method_Prim *)os_wxMediaCanvasGetXMargin, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "clear-margins" " method", (Scheme_Method_Prim *)os_wxMediaCanvasClearMargins, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "scroll-to" " method", (Scheme_Method_Prim *)os_wxMediaCanvasScrollTo, 5, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "set-lazy-refresh" " method", (Scheme_Method_Prim *)os_wxMediaCanvasSetLazyRefresh, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "get-lazy-refresh" " method", (Scheme_Method_Prim *)os_wxMediaCanvasGetLazyRefresh, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "scroll-with-bottom-base" " method", (Scheme_Method_Prim *)os_wxMediaCanvasScrollWithBottomBase, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "allow-scroll-to-last" " method", (Scheme_Method_Prim *)os_wxMediaCanvasAllowScrollToLast, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "force-display-focus" " method", (Scheme_Method_Prim *)os_wxMediaCanvasForceDisplayFocus, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "is-focus-on?" " method", (Scheme_Method_Prim *)os_wxMediaCanvasIsFocusOn, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "on-scroll-on-change" " method", (Scheme_Method_Prim *)os_wxMediaCanvasOnScrollOnChange, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "get-editor" " method", (Scheme_Method_Prim *)os_wxMediaCanvasGetMedia, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class, "set-editor" " method", (Scheme_Method_Prim *)os_wxMediaCanvasSetMedia, 1, 2)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class,"get-wheel-step" " method", (Scheme_Method_Prim *)objscheme_wxMediaCanvas_Getwheel_amt, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaCanvas_class,"set-wheel-step" " method", (Scheme_Method_Prim *)objscheme_wxMediaCanvas_Setwheel_amt, 1, 1)); - - WITH_VAR_STACK(scheme_made_class(os_wxMediaCanvas_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMediaCanvas, wxTYPE_MEDIA_CANVAS)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaCanvas(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaCanvas_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-canvas% object or " XC_NULL_STR: "editor-canvas% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaCanvas(class wxMediaCanvas *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_MEDIA_CANVAS) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaCanvas_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaCanvas *objscheme_unbundle_wxMediaCanvas(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaCanvas(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaCanvas *)o->primdata; - else - return (wxMediaCanvas *)o->primdata; -} - - - - - - - - -class os_wxMediaAdmin : public wxMediaAdmin { - public: - - os_wxMediaAdmin CONSTRUCTOR_ARGS(()); - ~os_wxMediaAdmin(); - void Modified(Bool x0); - Bool DelayRefresh(); - Bool PopupMenu(void* x0, double x1, double x2); - void UpdateCursor(); - void NeedsUpdate(double x0, double x1, nndouble x2, nndouble x3); - void Resized(Bool x0); - void GrabCaret(int x0 = wxFOCUS_GLOBAL); - Bool ScrollTo(double x0, double x1, nndouble x2, nndouble x3, Bool x4 = TRUE, int x5 = 0); - void GetMaxView(double* x0, double* x1, nndouble* x2, nndouble* x3, Bool x4 = FALSE); - void GetView(double* x0, double* x1, nndouble* x2, nndouble* x3, Bool x4 = FALSE); - class wxDC* GetDC(double* x0 = NULL, double* x1 = NULL); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaAdmin::gcMark() { - wxMediaAdmin::gcMark(); -} -void os_wxMediaAdmin::gcFixup() { - wxMediaAdmin::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaAdmin_class; - -os_wxMediaAdmin::os_wxMediaAdmin CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxMediaAdmin()) -{ -} - -os_wxMediaAdmin::~os_wxMediaAdmin() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaAdminModified(int n, Scheme_Object *p[]); - -void os_wxMediaAdmin::Modified(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "modified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminModified)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaAdminDelayRefresh(int n, Scheme_Object *p[]); - -Bool os_wxMediaAdmin::DelayRefresh() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "refresh-delayed?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminDelayRefresh)) { - SET_VAR_STACK(); - return FALSE; - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "refresh-delayed? in editor-admin%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaAdminPopupMenu(int n, Scheme_Object *p[]); - -Bool os_wxMediaAdmin::PopupMenu(void* x0, double x1, double x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "popup-menu", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminPopupMenu)) { - SET_VAR_STACK(); - return FALSE; - } else { - - p[POFFSET+0] = ((Scheme_Object *)x0); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "popup-menu in editor-admin%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaAdminUpdateCursor(int n, Scheme_Object *p[]); - -void os_wxMediaAdmin::UpdateCursor() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "update-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminUpdateCursor)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaAdminNeedsUpdate(int n, Scheme_Object *p[]); - -void os_wxMediaAdmin::NeedsUpdate(double x0, double x1, nndouble x2, nndouble x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "needs-update", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminNeedsUpdate)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaAdminResized(int n, Scheme_Object *p[]); - -void os_wxMediaAdmin::Resized(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "resized", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminResized)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaAdminGrabCaret(int n, Scheme_Object *p[]); - -void os_wxMediaAdmin::GrabCaret(int x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "grab-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminGrabCaret)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_focus(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaAdminScrollTo(int n, Scheme_Object *p[]); - -Bool os_wxMediaAdmin::ScrollTo(double x0, double x1, nndouble x2, nndouble x3, Bool x4, int x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "scroll-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminScrollTo)) { - SET_VAR_STACK(); - return FALSE; - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = (x4 ? scheme_true : scheme_false); - p[POFFSET+5] = WITH_VAR_STACK(bundle_symset_bias(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "scroll-to in editor-admin%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaAdminGetMaxView(int n, Scheme_Object *p[]); - -void os_wxMediaAdmin::GetMaxView(double* x0, double* x1, nndouble* x2, nndouble* x3, Bool x4) -{ - Scheme_Object *p[POFFSET+5] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(9); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+5); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - VAR_STACK_PUSH(7, x2); - VAR_STACK_PUSH(8, x3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "get-max-view", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminGetMaxView)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = ((x0) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x0))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+1] = ((x1) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+2] = ((x2) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+3] = ((x3) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x3))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+4] = (x4 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+5, p)); - - if (x0) *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-max-view in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-max-view in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-max-view in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-max-view in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-max-view in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-max-view in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x3) *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-max-view in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-max-view in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaAdminGetView(int n, Scheme_Object *p[]); - -void os_wxMediaAdmin::GetView(double* x0, double* x1, nndouble* x2, nndouble* x3, Bool x4) -{ - Scheme_Object *p[POFFSET+5] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(9); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+5); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - VAR_STACK_PUSH(7, x2); - VAR_STACK_PUSH(8, x3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "get-view", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminGetView)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = ((x0) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x0))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+1] = ((x1) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+2] = ((x2) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+3] = ((x3) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x3))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+4] = (x4 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+5, p)); - - if (x0) *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-view in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-view in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-view in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-view in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-view in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x3) *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-view in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaAdminGetDC(int n, Scheme_Object *p[]); - -class wxDC* os_wxMediaAdmin::GetDC(double* x0, double* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v INIT_NULLED_OUT; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaAdmin *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(8); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, v); - VAR_STACK_PUSH(6, x0); - VAR_STACK_PUSH(7, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaAdmin_class, "get-dc", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaAdminGetDC)) { - SET_VAR_STACK(); - return NULL; - } else { - - p[POFFSET+0] = ((x0) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x0))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+1] = ((x1) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - if (x0) *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-dc in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-dc in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-dc in editor-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-dc in editor-admin%"", extracting return value via box"", extracting boxed argument"))); - - { - class wxDC* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxDC(v, "get-dc in editor-admin%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaAdminModified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaAdmin_class, "modified in editor-admin%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "modified in editor-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->Modified(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaAdminDelayRefresh(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaAdmin_class, "refresh-delayed? in editor-admin%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = FALSE; - else - r = WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->DelayRefresh()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaAdminPopupMenu(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaAdmin_class, "popup-menu in editor-admin%", n, p); - void* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - if (!wxsCheckIsPopupMenu(p[POFFSET+0])) scheme_wrong_type(METHODNAME("editor-admin%","popup-menu"), "popup-menu% object", 0+POFFSET, n, p); - x0 = ((void *)p[POFFSET+0]); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "popup-menu in editor-admin%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "popup-menu in editor-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = FALSE; - else - r = WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->PopupMenu(x0, x1, x2)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaAdminUpdateCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaAdmin_class, "update-cursor in editor-admin%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->UpdateCursor()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaAdminNeedsUpdate(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaAdmin_class, "needs-update in editor-admin%", n, p); - double x0; - double x1; - nndouble x2; - nndouble x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "needs-update in editor-admin%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "needs-update in editor-admin%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "needs-update in editor-admin%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "needs-update in editor-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->NeedsUpdate(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaAdminResized(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaAdmin_class, "resized in editor-admin%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "resized in editor-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->Resized(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaAdminGrabCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaAdmin_class, "grab-caret in editor-admin%", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(unbundle_symset_focus(p[POFFSET+0], "grab-caret in editor-admin%")); - } else - x0 = wxFOCUS_GLOBAL; - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GrabCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaAdminScrollTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaAdmin_class, "scroll-to in editor-admin%", n, p); - double x0; - double x1; - nndouble x2; - nndouble x3; - Bool x4; - int x5; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "scroll-to in editor-admin%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "scroll-to in editor-admin%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "scroll-to in editor-admin%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "scroll-to in editor-admin%")); - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "scroll-to in editor-admin%")); - } else - x4 = TRUE; - if (n > (POFFSET+5)) { - x5 = WITH_VAR_STACK(unbundle_symset_bias(p[POFFSET+5], "scroll-to in editor-admin%")); - } else - x5 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = FALSE; - else - r = WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->ScrollTo(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaAdminGetMaxView(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaAdmin_class, "get-max-view in editor-admin%", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - nndouble _x2; - nndouble* x2 = &_x2; - nndouble _x3; - nndouble* x3 = &_x3; - Bool x4; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-max-view in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-max-view in editor-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-max-view in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-max-view in editor-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-max-view in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-max-view in editor-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-max-view in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-max-view in editor-admin%"", extracting boxed argument"))); - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "get-max-view in editor-admin%")); - } else - x4 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GetMaxView(x0, x1, x2, x3, x4)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaAdminGetView(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaAdmin_class, "get-view in editor-admin%", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - nndouble _x2; - nndouble* x2 = &_x2; - nndouble _x3; - nndouble* x3 = &_x3; - Bool x4; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-view in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-view in editor-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-view in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-view in editor-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-view in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view in editor-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-view in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view in editor-admin%"", extracting boxed argument"))); - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "get-view in editor-admin%")); - } else - x4 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GetView(x0, x1, x2, x3, x4)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaAdminGetDC(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxDC* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaAdmin_class, "get-dc in editor-admin%", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n > (POFFSET+0)) { - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-dc in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-dc in editor-admin%"", extracting boxed argument"))); - } else - x0 = NULL; - if (n > (POFFSET+1)) { - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-dc in editor-admin%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-dc in editor-admin%"", extracting boxed argument"))); - } else - x1 = NULL; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = NULL; - else - r = WITH_VAR_STACK(((wxMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GetDC(x0, x1)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxDC(r)); -} - -static Scheme_Object *os_wxMediaAdmin_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaAdmin *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-admin%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxMediaAdmin CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaAdmin()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxMediaAdmin(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaAdmin_class); - - os_wxMediaAdmin_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-admin%", "object%", (Scheme_Method_Prim *)os_wxMediaAdmin_ConstructScheme, 11)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "modified" " method", (Scheme_Method_Prim *)os_wxMediaAdminModified, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "refresh-delayed?" " method", (Scheme_Method_Prim *)os_wxMediaAdminDelayRefresh, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "popup-menu" " method", (Scheme_Method_Prim *)os_wxMediaAdminPopupMenu, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "update-cursor" " method", (Scheme_Method_Prim *)os_wxMediaAdminUpdateCursor, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "needs-update" " method", (Scheme_Method_Prim *)os_wxMediaAdminNeedsUpdate, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "resized" " method", (Scheme_Method_Prim *)os_wxMediaAdminResized, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "grab-caret" " method", (Scheme_Method_Prim *)os_wxMediaAdminGrabCaret, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "scroll-to" " method", (Scheme_Method_Prim *)os_wxMediaAdminScrollTo, 4, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "get-max-view" " method", (Scheme_Method_Prim *)os_wxMediaAdminGetMaxView, 4, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "get-view" " method", (Scheme_Method_Prim *)os_wxMediaAdminGetView, 4, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaAdmin_class, "get-dc" " method", (Scheme_Method_Prim *)os_wxMediaAdminGetDC, 0, 2)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaAdmin_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMediaAdmin, wxTYPE_MEDIA_ADMIN)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaAdmin(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaAdmin_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-admin% object or " XC_NULL_STR: "editor-admin% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaAdmin(class wxMediaAdmin *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_MEDIA_ADMIN) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaAdmin_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaAdmin *objscheme_unbundle_wxMediaAdmin(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaAdmin(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaAdmin *)o->primdata; - else - return (wxMediaAdmin *)o->primdata; -} - - - - - -class os_wxMediaSnipMediaAdmin : public wxMediaSnipMediaAdmin { - public: - - ~os_wxMediaSnipMediaAdmin(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaSnipMediaAdmin::gcMark() { - wxMediaSnipMediaAdmin::gcMark(); -} -void os_wxMediaSnipMediaAdmin::gcFixup() { - wxMediaSnipMediaAdmin::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaSnipMediaAdmin_class; -static Scheme_Object *os_wxMediaSnipMediaAdmin_interface; - -os_wxMediaSnipMediaAdmin::~os_wxMediaSnipMediaAdmin() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaSnipMediaAdminGetSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaSnip* r; - objscheme_check_valid(os_wxMediaSnipMediaAdmin_class, "get-snip in editor-snip-editor-admin<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnipMediaAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GetSnip()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaSnip(r)); -} - -void objscheme_setup_wxMediaSnipMediaAdmin(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaSnipMediaAdmin_class); - wxREGGLOB(os_wxMediaSnipMediaAdmin_interface); - - os_wxMediaSnipMediaAdmin_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-snip-editor-admin%", "editor-admin%", NULL, 1)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnipMediaAdmin_class, "get-snip" " method", (Scheme_Method_Prim *)os_wxMediaSnipMediaAdminGetSnip, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaSnipMediaAdmin_class)); - - os_wxMediaSnipMediaAdmin_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxMediaSnipMediaAdmin_class, "editor-snip-editor-admin" "<%>")); - - WITH_VAR_STACK(objscheme_add_global_interface(os_wxMediaSnipMediaAdmin_interface, "editor-snip-editor-admin" "<%>", env)); - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMediaSnipMediaAdmin, wxTYPE_MEDIA_SNIP_MEDIA_ADMIN)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaSnipMediaAdmin(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaSnipMediaAdmin_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-snip-editor-admin% object or " XC_NULL_STR: "editor-snip-editor-admin% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaSnipMediaAdmin(class wxMediaSnipMediaAdmin *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_MEDIA_SNIP_MEDIA_ADMIN) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaSnipMediaAdmin_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaSnipMediaAdmin *objscheme_unbundle_wxMediaSnipMediaAdmin(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaSnipMediaAdmin(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaSnipMediaAdmin *)o->primdata; - else - return (wxMediaSnipMediaAdmin *)o->primdata; -} - - - - - - -class os_wxSnipAdmin : public wxSnipAdmin { - public: - - os_wxSnipAdmin CONSTRUCTOR_ARGS(()); - ~os_wxSnipAdmin(); - void Modified(class wxSnip* x0, Bool x1); - Bool PopupMenu(void* x0, class wxSnip* x1, double x2, double x3); - void UpdateCursor(); - Bool ReleaseSnip(class wxSnip* x0); - void NeedsUpdate(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4); - Bool Recounted(class wxSnip* x0, Bool x1); - void Resized(class wxSnip* x0, Bool x1); - void SetCaretOwner(class wxSnip* x0, int x1); - Bool ScrollTo(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4, Bool x5, int x6 = 0); - void GetView(double* x0, double* x1, nndouble* x2, nndouble* x3, class wxSnip* x4 = NULL); - void GetViewSize(nndouble* x0, nndouble* x1); - class wxDC* GetDC(); - class wxMediaBuffer* GetMedia(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxSnipAdmin::gcMark() { - wxSnipAdmin::gcMark(); -} -void os_wxSnipAdmin::gcFixup() { - wxSnipAdmin::gcFixup(); -} -#endif - -static Scheme_Object *os_wxSnipAdmin_class; - -os_wxSnipAdmin::os_wxSnipAdmin CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxSnipAdmin()) -{ -} - -os_wxSnipAdmin::~os_wxSnipAdmin() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxSnipAdminModified(int n, Scheme_Object *p[]); - -void os_wxSnipAdmin::Modified(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "modified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminModified)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipAdminPopupMenu(int n, Scheme_Object *p[]); - -Bool os_wxSnipAdmin::PopupMenu(void* x0, class wxSnip* x1, double x2, double x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "popup-menu", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminPopupMenu)) { - SET_VAR_STACK(); - return FALSE; - } else { - - p[POFFSET+0] = ((Scheme_Object *)x0); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "popup-menu in snip-admin%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipAdminUpdateCursor(int n, Scheme_Object *p[]); - -void os_wxSnipAdmin::UpdateCursor() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "update-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminUpdateCursor)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipAdminReleaseSnip(int n, Scheme_Object *p[]); - -Bool os_wxSnipAdmin::ReleaseSnip(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "release-snip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminReleaseSnip)) { - SET_VAR_STACK(); - return FALSE; - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "release-snip in snip-admin%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipAdminNeedsUpdate(int n, Scheme_Object *p[]); - -void os_wxSnipAdmin::NeedsUpdate(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4) -{ - Scheme_Object *p[POFFSET+5] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+5); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "needs-update", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminNeedsUpdate)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+5, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipAdminRecounted(int n, Scheme_Object *p[]); - -Bool os_wxSnipAdmin::Recounted(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "recounted", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminRecounted)) { - SET_VAR_STACK(); - return FALSE; - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "recounted in snip-admin%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipAdminResized(int n, Scheme_Object *p[]); - -void os_wxSnipAdmin::Resized(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "resized", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminResized)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipAdminSetCaretOwner(int n, Scheme_Object *p[]); - -void os_wxSnipAdmin::SetCaretOwner(class wxSnip* x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "set-caret-owner", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminSetCaretOwner)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_focus(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipAdminScrollTo(int n, Scheme_Object *p[]); - -Bool os_wxSnipAdmin::ScrollTo(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4, Bool x5, int x6) -{ - Scheme_Object *p[POFFSET+7] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+7); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "scroll-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminScrollTo)) { - SET_VAR_STACK(); - return FALSE; - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = (x5 ? scheme_true : scheme_false); - p[POFFSET+6] = WITH_VAR_STACK(bundle_symset_bias(x6)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+7, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "scroll-to in snip-admin%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipAdminGetView(int n, Scheme_Object *p[]); - -void os_wxSnipAdmin::GetView(double* x0, double* x1, nndouble* x2, nndouble* x3, class wxSnip* x4) -{ - Scheme_Object *p[POFFSET+5] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(10); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+5); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - VAR_STACK_PUSH(7, x2); - VAR_STACK_PUSH(8, x3); - VAR_STACK_PUSH(9, x4); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "get-view", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminGetView)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = ((x0) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x0))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+1] = ((x1) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+2] = ((x2) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+3] = ((x3) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x3))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+4] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x4)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+5, p)); - - if (x0) *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-view in snip-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-view in snip-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-view in snip-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-view in snip-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-view in snip-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view in snip-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x3) *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-view in snip-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view in snip-admin%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipAdminGetViewSize(int n, Scheme_Object *p[]); - -void os_wxSnipAdmin::GetViewSize(nndouble* x0, nndouble* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "get-view-size", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminGetViewSize)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = ((x0) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x0))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+1] = ((x1) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - if (x0) *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-view-size in snip-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view-size in snip-admin%"", extracting return value via box"", extracting boxed argument"))); - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-view-size in snip-admin%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view-size in snip-admin%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipAdminGetDC(int n, Scheme_Object *p[]); - -class wxDC* os_wxSnipAdmin::GetDC() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "get-dc", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminGetDC)) { - SET_VAR_STACK(); - return NULL; - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxDC* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxDC(v, "get-dc in snip-admin%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipAdminGetMedia(int n, Scheme_Object *p[]); - -class wxMediaBuffer* os_wxSnipAdmin::GetMedia() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipAdmin *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipAdmin_class, "get-editor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdminGetMedia)) { - SET_VAR_STACK(); - return NULL; - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxMediaBuffer* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(v, "get-editor in snip-admin%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipAdminModified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnipAdmin_class, "modified in snip-admin%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "modified in snip-admin%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "modified in snip-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->Modified(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipAdminPopupMenu(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnipAdmin_class, "popup-menu in snip-admin%", n, p); - void* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - double x2; - double x3; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - if (!wxsCheckIsPopupMenu(p[POFFSET+0])) scheme_wrong_type(METHODNAME("snip-admin%","popup-menu"), "popup-menu% object", 0+POFFSET, n, p); - x0 = ((void *)p[POFFSET+0]); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "popup-menu in snip-admin%", 0)); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "popup-menu in snip-admin%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "popup-menu in snip-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = FALSE; - else - r = WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->PopupMenu(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipAdminUpdateCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnipAdmin_class, "update-cursor in snip-admin%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->UpdateCursor()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipAdminReleaseSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnipAdmin_class, "release-snip in snip-admin%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "release-snip in snip-admin%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = FALSE; - else - r = WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->ReleaseSnip(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipAdminNeedsUpdate(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnipAdmin_class, "needs-update in snip-admin%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble x3; - nndouble x4; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "needs-update in snip-admin%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "needs-update in snip-admin%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "needs-update in snip-admin%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "needs-update in snip-admin%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+4], "needs-update in snip-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->NeedsUpdate(x0, x1, x2, x3, x4)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipAdminRecounted(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnipAdmin_class, "recounted in snip-admin%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "recounted in snip-admin%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "recounted in snip-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = FALSE; - else - r = WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->Recounted(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipAdminResized(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnipAdmin_class, "resized in snip-admin%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "resized in snip-admin%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "resized in snip-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->Resized(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipAdminSetCaretOwner(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnipAdmin_class, "set-caret-owner in snip-admin%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "set-caret-owner in snip-admin%", 0)); - x1 = WITH_VAR_STACK(unbundle_symset_focus(p[POFFSET+1], "set-caret-owner in snip-admin%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->SetCaretOwner(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipAdminScrollTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnipAdmin_class, "scroll-to in snip-admin%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble x3; - nndouble x4; - Bool x5; - int x6; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "scroll-to in snip-admin%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "scroll-to in snip-admin%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "scroll-to in snip-admin%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "scroll-to in snip-admin%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+4], "scroll-to in snip-admin%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "scroll-to in snip-admin%")); - if (n > (POFFSET+6)) { - x6 = WITH_VAR_STACK(unbundle_symset_bias(p[POFFSET+6], "scroll-to in snip-admin%")); - } else - x6 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = FALSE; - else - r = WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->ScrollTo(x0, x1, x2, x3, x4, x5, x6)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipAdminGetView(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnipAdmin_class, "get-view in snip-admin%", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - nndouble _x2; - nndouble* x2 = &_x2; - nndouble _x3; - nndouble* x3 = &_x3; - class wxSnip* x4 INIT_NULLED_OUT; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x4); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-view in snip-admin%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-view in snip-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-view in snip-admin%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-view in snip-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-view in snip-admin%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view in snip-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-view in snip-admin%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view in snip-admin%"", extracting boxed argument"))); - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+4], "get-view in snip-admin%", 1)); - } else - x4 = NULL; - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GetView(x0, x1, x2, x3, x4)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipAdminGetViewSize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnipAdmin_class, "get-view-size in snip-admin%", n, p); - nndouble _x0; - nndouble* x0 = &_x0; - nndouble _x1; - nndouble* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-view-size in snip-admin%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view-size in snip-admin%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-view-size in snip-admin%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view-size in snip-admin%"", extracting boxed argument"))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GetViewSize(x0, x1)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipAdminGetDC(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxDC* r; - objscheme_check_valid(os_wxSnipAdmin_class, "get-dc in snip-admin%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = NULL; - else - r = WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GetDC()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxDC(r)); -} - -static Scheme_Object *os_wxSnipAdminGetMedia(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaBuffer* r; - objscheme_check_valid(os_wxSnipAdmin_class, "get-editor in snip-admin%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = NULL; - else - r = WITH_VAR_STACK(((wxSnipAdmin *)((Scheme_Class_Object *)p[0])->primdata)->GetMedia()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaBuffer(r)); -} - -static Scheme_Object *os_wxSnipAdmin_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxSnipAdmin *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in snip-admin%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxSnipAdmin CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxSnipAdmin()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxSnipAdmin(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxSnipAdmin_class); - - os_wxSnipAdmin_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "snip-admin%", "object%", (Scheme_Method_Prim *)os_wxSnipAdmin_ConstructScheme, 13)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "modified" " method", (Scheme_Method_Prim *)os_wxSnipAdminModified, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "popup-menu" " method", (Scheme_Method_Prim *)os_wxSnipAdminPopupMenu, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "update-cursor" " method", (Scheme_Method_Prim *)os_wxSnipAdminUpdateCursor, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "release-snip" " method", (Scheme_Method_Prim *)os_wxSnipAdminReleaseSnip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "needs-update" " method", (Scheme_Method_Prim *)os_wxSnipAdminNeedsUpdate, 5, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "recounted" " method", (Scheme_Method_Prim *)os_wxSnipAdminRecounted, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "resized" " method", (Scheme_Method_Prim *)os_wxSnipAdminResized, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "set-caret-owner" " method", (Scheme_Method_Prim *)os_wxSnipAdminSetCaretOwner, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "scroll-to" " method", (Scheme_Method_Prim *)os_wxSnipAdminScrollTo, 6, 7)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "get-view" " method", (Scheme_Method_Prim *)os_wxSnipAdminGetView, 4, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "get-view-size" " method", (Scheme_Method_Prim *)os_wxSnipAdminGetViewSize, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "get-dc" " method", (Scheme_Method_Prim *)os_wxSnipAdminGetDC, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipAdmin_class, "get-editor" " method", (Scheme_Method_Prim *)os_wxSnipAdminGetMedia, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxSnipAdmin_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxSnipAdmin, wxTYPE_MEDIA_SNIP_ADMIN)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxSnipAdmin(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxSnipAdmin_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "snip-admin% object or " XC_NULL_STR: "snip-admin% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxSnipAdmin(class wxSnipAdmin *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_MEDIA_SNIP_ADMIN) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxSnipAdmin_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxSnipAdmin *objscheme_unbundle_wxSnipAdmin(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxSnipAdmin(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxSnipAdmin *)o->primdata; - else - return (wxSnipAdmin *)o->primdata; -} - - - - - - - - -class os_wxSnipClass : public wxSnipClass { - public: - - os_wxSnipClass CONSTRUCTOR_ARGS(()); - ~os_wxSnipClass(); - Bool WriteHeader(class wxMediaStreamOut* x0); - Bool ReadHeader(class wxMediaStreamIn* x0); - class wxSnip* Read(class wxMediaStreamIn* x0); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxSnipClass::gcMark() { - wxSnipClass::gcMark(); -} -void os_wxSnipClass::gcFixup() { - wxSnipClass::gcFixup(); -} -#endif - -static Scheme_Object *os_wxSnipClass_class; - -os_wxSnipClass::os_wxSnipClass CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxSnipClass()) -{ -} - -os_wxSnipClass::~os_wxSnipClass() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxSnipClassWriteHeader(int n, Scheme_Object *p[]); - -Bool os_wxSnipClass::WriteHeader(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipClass *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipClass_class, "write-header", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipClassWriteHeader)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnipClass::WriteHeader(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "write-header in snip-class%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipClassReadHeader(int n, Scheme_Object *p[]); - -Bool os_wxSnipClass::ReadHeader(class wxMediaStreamIn* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipClass *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipClass_class, "read-header", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipClassReadHeader)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnipClass::ReadHeader(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamIn(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "read-header in snip-class%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipClassRead(int n, Scheme_Object *p[]); - -class wxSnip* os_wxSnipClass::Read(class wxMediaStreamIn* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnipClass *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnipClass_class, "read", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipClassRead)) { - SET_VAR_STACK(); - return NULL; - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamIn(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "read in snip-class%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipClassReadingVersion(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxSnipClass_class, "reading-version in snip-class%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "reading-version in snip-class%", 0)); - - - r = WITH_VAR_STACK(((wxSnipClass *)((Scheme_Class_Object *)p[0])->primdata)->ReadingVersion(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxSnipClassWriteHeader(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnipClass_class, "write-header in snip-class%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write-header in snip-class%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnipClass *)((Scheme_Class_Object *)p[0])->primdata)->wxSnipClass::WriteHeader(x0)); - else - r = WITH_VAR_STACK(((wxSnipClass *)((Scheme_Class_Object *)p[0])->primdata)->WriteHeader(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipClassReadHeader(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnipClass_class, "read-header in snip-class%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read-header in snip-class%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnipClass *)((Scheme_Class_Object *)p[0])->primdata)->wxSnipClass::ReadHeader(x0)); - else - r = WITH_VAR_STACK(((wxSnipClass *)((Scheme_Class_Object *)p[0])->primdata)->ReadHeader(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipClassRead(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxSnipClass_class, "read in snip-class%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read in snip-class%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = NULL; - else - r = WITH_VAR_STACK(((wxSnipClass *)((Scheme_Class_Object *)p[0])->primdata)->Read(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *objscheme_wxSnipClass_Getclassname(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - string v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxSnipClass_class, "get-classname in snip-class%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-classname in snip-class%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxSnipClass *)cobj->primdata)->wxSnipClass::classname; - else - v = ((wxSnipClass *)cobj->primdata)->classname; - - return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)v)); -} - -static Scheme_Object *objscheme_wxSnipClass_Setclassname(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - string v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxSnipClass_class, "set-classname in snip-class%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-classname in snip-class%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET], "set-classname in snip-class%")); - ((wxSnipClass *)cobj->primdata)->classname = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxSnipClass_Getversion(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxSnipClass_class, "get-version in snip-class%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-version in snip-class%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxSnipClass *)cobj->primdata)->wxSnipClass::version; - else - v = ((wxSnipClass *)cobj->primdata)->version; - - return scheme_make_integer(v); -} - -static Scheme_Object *objscheme_wxSnipClass_Setversion(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxSnipClass_class, "set-version in snip-class%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-version in snip-class%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET], "set-version in snip-class%")); - ((wxSnipClass *)cobj->primdata)->version = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipClass_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxSnipClass *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in snip-class%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxSnipClass CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxSnipClass()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxSnipClass(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxSnipClass_class); - - os_wxSnipClass_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "snip-class%", "object%", (Scheme_Method_Prim *)os_wxSnipClass_ConstructScheme, 8)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClass_class, "reading-version" " method", (Scheme_Method_Prim *)os_wxSnipClassReadingVersion, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClass_class, "write-header" " method", (Scheme_Method_Prim *)os_wxSnipClassWriteHeader, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClass_class, "read-header" " method", (Scheme_Method_Prim *)os_wxSnipClassReadHeader, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClass_class, "read" " method", (Scheme_Method_Prim *)os_wxSnipClassRead, 1, 1)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClass_class,"get-classname" " method", (Scheme_Method_Prim *)objscheme_wxSnipClass_Getclassname, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClass_class,"set-classname" " method", (Scheme_Method_Prim *)objscheme_wxSnipClass_Setclassname, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClass_class,"get-version" " method", (Scheme_Method_Prim *)objscheme_wxSnipClass_Getversion, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClass_class,"set-version" " method", (Scheme_Method_Prim *)objscheme_wxSnipClass_Setversion, 1, 1)); - - WITH_VAR_STACK(scheme_made_class(os_wxSnipClass_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxSnipClass, wxTYPE_SNIP_CLASS)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxSnipClass(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxSnipClass_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "snip-class% object or " XC_NULL_STR: "snip-class% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxSnipClass(class wxSnipClass *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_SNIP_CLASS) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxSnipClass_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxSnipClass *objscheme_unbundle_wxSnipClass(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxSnipClass(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxSnipClass *)o->primdata; - else - return (wxSnipClass *)o->primdata; -} - - - - - - -class os_wxSnipClassList : public wxSnipClassList { - public: - - ~os_wxSnipClassList(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxSnipClassList::gcMark() { - wxSnipClassList::gcMark(); -} -void os_wxSnipClassList::gcFixup() { - wxSnipClassList::gcFixup(); -} -#endif - -static Scheme_Object *os_wxSnipClassList_class; -static Scheme_Object *os_wxSnipClassList_interface; - -os_wxSnipClassList::~os_wxSnipClassList() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxSnipClassListNth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnipClass* r; - objscheme_check_valid(os_wxSnipClassList_class, "nth in snip-class-list<%>", n, p); - nnint x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "nth in snip-class-list<%>")); - - - r = WITH_VAR_STACK(((wxSnipClassList *)((Scheme_Class_Object *)p[0])->primdata)->Nth(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnipClass(r)); -} - -static Scheme_Object *os_wxSnipClassListNumber(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxSnipClassList_class, "number in snip-class-list<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxSnipClassList *)((Scheme_Class_Object *)p[0])->primdata)->Number()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxSnipClassListAdd(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnipClassList_class, "add in snip-class-list<%>", n, p); - class wxSnipClass* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnipClass(p[POFFSET+0], "add in snip-class-list<%>", 0)); - - - WITH_VAR_STACK(((wxSnipClassList *)((Scheme_Class_Object *)p[0])->primdata)->Add(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipClassListFindPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - short r; - objscheme_check_valid(os_wxSnipClassList_class, "find-position in snip-class-list<%>", n, p); - class wxSnipClass* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnipClass(p[POFFSET+0], "find-position in snip-class-list<%>", 0)); - - - r = WITH_VAR_STACK(((wxSnipClassList *)((Scheme_Class_Object *)p[0])->primdata)->FindPosition(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxSnipClassListFind(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnipClass* r; - objscheme_check_valid(os_wxSnipClassList_class, "find in snip-class-list<%>", n, p); - string x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "find in snip-class-list<%>")); - - - r = WITH_VAR_STACK(((wxSnipClassList *)((Scheme_Class_Object *)p[0])->primdata)->Find(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnipClass(r)); -} - -void objscheme_setup_wxSnipClassList(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxSnipClassList_class); - wxREGGLOB(os_wxSnipClassList_interface); - - os_wxSnipClassList_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "snip-class-list%", "object%", NULL, 5)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClassList_class, "nth" " method", (Scheme_Method_Prim *)os_wxSnipClassListNth, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClassList_class, "number" " method", (Scheme_Method_Prim *)os_wxSnipClassListNumber, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClassList_class, "add" " method", (Scheme_Method_Prim *)os_wxSnipClassListAdd, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClassList_class, "find-position" " method", (Scheme_Method_Prim *)os_wxSnipClassListFindPosition, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnipClassList_class, "find" " method", (Scheme_Method_Prim *)os_wxSnipClassListFind, 1, 1)); - - - WITH_VAR_STACK(scheme_made_class(os_wxSnipClassList_class)); - - os_wxSnipClassList_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxSnipClassList_class, "snip-class-list" "<%>")); - - WITH_VAR_STACK(objscheme_add_global_interface(os_wxSnipClassList_interface, "snip-class-list" "<%>", env)); - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxSnipClassList, wxTYPE_SNIP_CLASS_LIST)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxSnipClassList(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxSnipClassList_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "snip-class-list% object or " XC_NULL_STR: "snip-class-list% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxSnipClassList(class wxSnipClassList *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_SNIP_CLASS_LIST) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxSnipClassList_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxSnipClassList *objscheme_unbundle_wxSnipClassList(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxSnipClassList(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxSnipClassList *)o->primdata; - else - return (wxSnipClassList *)o->primdata; -} - - - - -typedef Scheme_Object KeymapCallbackToSchemeRec; -#define kctsr(o) o - -static Bool KMCallbackToScheme(UNKNOWN_OBJ, wxEvent *, KeymapCallbackToSchemeRec *data); -static Bool GrabKeyCallbackToScheme(char *s, wxKeymap *km, UNKNOWN_OBJ, wxKeyEvent *, KeymapCallbackToSchemeRec *data); -static Bool GrabMouseCallbackToScheme(char *s, wxKeymap *km, UNKNOWN_OBJ, wxMouseEvent *, KeymapCallbackToSchemeRec *data); -static void BreakSequenceCallbackToScheme(KeymapCallbackToSchemeRec *data); - - - - - - - - - - -class os_wxKeymap : public wxKeymap { - public: - - os_wxKeymap CONSTRUCTOR_ARGS(()); - ~os_wxKeymap(); - Bool HandleMouseEvent(UNKNOWN_OBJ x0, class wxMouseEvent* x1); - Bool HandleKeyEvent(UNKNOWN_OBJ x0, class wxKeyEvent* x1); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxKeymap::gcMark() { - wxKeymap::gcMark(); -} -void os_wxKeymap::gcFixup() { - wxKeymap::gcFixup(); -} -#endif - -static Scheme_Object *os_wxKeymap_class; - -os_wxKeymap::os_wxKeymap CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxKeymap()) -{ -} - -os_wxKeymap::~os_wxKeymap() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxKeymapHandleMouseEvent(int n, Scheme_Object *p[]); - -Bool os_wxKeymap::HandleMouseEvent(UNKNOWN_OBJ x0, class wxMouseEvent* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxKeymap *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxKeymap_class, "handle-mouse-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxKeymapHandleMouseEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxKeymap::HandleMouseEvent(x0, x1); - } else { - - p[POFFSET+0] = ((Scheme_Object *)x0); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "handle-mouse-event in keymap%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxKeymapHandleKeyEvent(int n, Scheme_Object *p[]); - -Bool os_wxKeymap::HandleKeyEvent(UNKNOWN_OBJ x0, class wxKeyEvent* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxKeymap *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxKeymap_class, "handle-key-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxKeymapHandleKeyEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxKeymap::HandleKeyEvent(x0, x1); - } else { - - p[POFFSET+0] = ((Scheme_Object *)x0); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "handle-key-event in keymap%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxKeymapRemoveChainedKeymap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "remove-chained-keymap in keymap%", n, p); - class wxKeymap* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeymap(p[POFFSET+0], "remove-chained-keymap in keymap%", 0)); - - - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->RemoveChainedKeymap(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapChainToKeymap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "chain-to-keymap in keymap%", n, p); - class wxKeymap* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeymap(p[POFFSET+0], "chain-to-keymap in keymap%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "chain-to-keymap in keymap%")); - - - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->ChainToKeymap(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapSetBreakSequenceCallback(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "set-break-sequence-callback in keymap%", n, p); - wxBreakSequenceFunction x0; - void* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - KeymapCallbackToSchemeRec *cb; - x0 = (wxBreakSequenceFunction)BreakSequenceCallbackToScheme; - - kctsr(cb) = p[POFFSET+0]; x1 = (void *)cb; - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->SetBreakSequenceCallback(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapCallFunction(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxKeymap_class, "call-function in keymap%", n, p); - string x0 INIT_NULLED_OUT; - UNKNOWN_OBJ x1 INIT_NULLED_OUT; - class wxEvent* x2 INIT_NULLED_OUT; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(4); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - VAR_STACK_PUSH(3, x2); - - - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "call-function in keymap%")); - x1 = ((void *)p[POFFSET+1]); - x2 = WITH_VAR_STACK(objscheme_unbundle_wxEvent(p[POFFSET+2], "call-function in keymap%", 0)); - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "call-function in keymap%")); - } else - x3 = FALSE; - - - r = WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->CallFunction(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxKeymapRemoveGrabMouseFunction(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "remove-grab-mouse-function in keymap%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->RemoveGrabMouseFunction()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapSetGrabMouseFunction(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "set-grab-mouse-function in keymap%", n, p); - wxGrabMouseFunction x0; - void* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - KeymapCallbackToSchemeRec *cb; - x0 = (wxGrabMouseFunction)GrabMouseCallbackToScheme; - - kctsr(cb) = p[POFFSET+0]; x1 = (void *)cb; - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->SetGrabMouseFunction(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapRemoveGrabKeyFunction(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "remove-grab-key-function in keymap%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->RemoveGrabKeyFunction()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapSetGrabKeyFunction(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "set-grab-key-function in keymap%", n, p); - wxGrabKeyFunction x0; - void* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - KeymapCallbackToSchemeRec *cb; - x0 = (wxGrabKeyFunction)GrabKeyCallbackToScheme; - - kctsr(cb) = p[POFFSET+0]; x1 = (void *)cb; - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->SetGrabKeyFunction(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapAddFunction(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "add-function in keymap%", n, p); - string x0 INIT_NULLED_OUT; - wxKMFunction x1; - void* x2 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x2); - - KeymapCallbackToSchemeRec *cb; - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "add-function in keymap%")); - x1 = (wxKMFunction)KMCallbackToScheme; - - kctsr(cb) = p[POFFSET+1]; x2 = (void *)cb; - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->AddFunction(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapMapFunction(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "map-function in keymap%", n, p); - mzstring x0 INIT_NULLED_OUT; - string x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+0], "map-function in keymap%")); - x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "map-function in keymap%")); - - - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->MapFunction(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapBreakSequence(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "break-sequence in keymap%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->BreakSequence()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapHandleMouseEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxKeymap_class, "handle-mouse-event in keymap%", n, p); - UNKNOWN_OBJ x0 INIT_NULLED_OUT; - class wxMouseEvent* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = ((void *)p[POFFSET+0]); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+1], "handle-mouse-event in keymap%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->wxKeymap::HandleMouseEvent(x0, x1)); - else - r = WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->HandleMouseEvent(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxKeymapHandleKeyEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxKeymap_class, "handle-key-event in keymap%", n, p); - UNKNOWN_OBJ x0 INIT_NULLED_OUT; - class wxKeyEvent* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = ((void *)p[POFFSET+0]); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+1], "handle-key-event in keymap%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->wxKeymap::HandleKeyEvent(x0, x1)); - else - r = WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->HandleKeyEvent(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxKeymapSetDoubleClickInterval(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxKeymap_class, "set-double-click-interval in keymap%", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+0], 0, 1000000, "set-double-click-interval in keymap%")); - - - WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->SetDoubleClickInterval(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxKeymapGetDoubleClickInterval(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxKeymap_class, "get-double-click-interval in keymap%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxKeymap *)((Scheme_Class_Object *)p[0])->primdata)->GetDoubleClickInterval()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxKeymap_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxKeymap *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in keymap%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxKeymap CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxKeymap()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxKeymap(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxKeymap_class); - - os_wxKeymap_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "keymap%", "object%", (Scheme_Method_Prim *)os_wxKeymap_ConstructScheme, 15)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "remove-chained-keymap" " method", (Scheme_Method_Prim *)os_wxKeymapRemoveChainedKeymap, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "chain-to-keymap" " method", (Scheme_Method_Prim *)os_wxKeymapChainToKeymap, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "set-break-sequence-callback" " method", (Scheme_Method_Prim *)os_wxKeymapSetBreakSequenceCallback, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "call-function" " method", (Scheme_Method_Prim *)os_wxKeymapCallFunction, 3, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "remove-grab-mouse-function" " method", (Scheme_Method_Prim *)os_wxKeymapRemoveGrabMouseFunction, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "set-grab-mouse-function" " method", (Scheme_Method_Prim *)os_wxKeymapSetGrabMouseFunction, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "remove-grab-key-function" " method", (Scheme_Method_Prim *)os_wxKeymapRemoveGrabKeyFunction, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "set-grab-key-function" " method", (Scheme_Method_Prim *)os_wxKeymapSetGrabKeyFunction, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "add-function" " method", (Scheme_Method_Prim *)os_wxKeymapAddFunction, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "map-function" " method", (Scheme_Method_Prim *)os_wxKeymapMapFunction, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "break-sequence" " method", (Scheme_Method_Prim *)os_wxKeymapBreakSequence, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "handle-mouse-event" " method", (Scheme_Method_Prim *)os_wxKeymapHandleMouseEvent, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "handle-key-event" " method", (Scheme_Method_Prim *)os_wxKeymapHandleKeyEvent, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "set-double-click-interval" " method", (Scheme_Method_Prim *)os_wxKeymapSetDoubleClickInterval, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxKeymap_class, "get-double-click-interval" " method", (Scheme_Method_Prim *)os_wxKeymapGetDoubleClickInterval, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxKeymap_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxKeymap, wxTYPE_KEYMAP)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxKeymap(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxKeymap_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "keymap% object or " XC_NULL_STR: "keymap% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxKeymap(class wxKeymap *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_KEYMAP) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxKeymap_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxKeymap *objscheme_unbundle_wxKeymap(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxKeymap(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxKeymap *)o->primdata; - else - return (wxKeymap *)o->primdata; -} - - -static Bool KMCallbackToScheme(UNKNOWN_OBJ media, wxEvent *event, - KeymapCallbackToSchemeRec *data) -{ - Scheme_Object *p[2], *obj = NULL; - Bool r; - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, p[0]); - VAR_STACK_PUSH(1, p[1]); - VAR_STACK_PUSH(2, obj); - VAR_STACK_PUSH(3, event); - VAR_STACK_PUSH(4, data); - - p[0] = (Scheme_Object *)media; - p[1] = NULL; - p[1] = WITH_VAR_STACK(objscheme_bundle_wxEvent(event)); - - obj = WITH_VAR_STACK(scheme_apply(kctsr(data), 2, p)); - r = WITH_VAR_STACK(objscheme_unbundle_bool(obj, "Scheme key callback")); - READY_TO_RETURN; - return r; -} - -static Bool GrabKeyCallbackToScheme(char *s, wxKeymap *km, - UNKNOWN_OBJ media, wxKeyEvent *event, - KeymapCallbackToSchemeRec *data) -{ - Scheme_Object *p[4], *obj = NULL; - Bool r; - SETUP_VAR_STACK(6); - VAR_STACK_PUSH_ARRAY(0, p, 4); - VAR_STACK_PUSH(3, obj); - VAR_STACK_PUSH(4, event); - VAR_STACK_PUSH(5, data); - VAR_STACK_PUSH(6, km); - - p[0] = NULL; - p[1] = NULL; - p[3] = NULL; - - p[2] = (Scheme_Object *)media; - - p[0] = WITH_VAR_STACK(objscheme_bundle_string(s)); - p[1] = WITH_VAR_STACK(objscheme_bundle_wxKeymap(km)); - p[3] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(event)); - - obj = WITH_VAR_STACK(scheme_apply(kctsr(data), 4, p)); - r = WITH_VAR_STACK(objscheme_unbundle_bool(obj, "Scheme grab-key callback")); - READY_TO_RETURN; - return r; -} - -static Bool GrabMouseCallbackToScheme(char *s, wxKeymap *km, - UNKNOWN_OBJ media, wxMouseEvent *event, - KeymapCallbackToSchemeRec *data) -{ - Scheme_Object *p[4], *obj = NULL; - Bool r; - SETUP_VAR_STACK(6); - VAR_STACK_PUSH_ARRAY(0, p, 4); - VAR_STACK_PUSH(3, obj); - VAR_STACK_PUSH(4, event); - VAR_STACK_PUSH(5, data); - VAR_STACK_PUSH(6, km); - - p[0] = NULL; - p[1] = NULL; - p[3] = NULL; - - p[2] = (Scheme_Object *)media; - - p[0] = WITH_VAR_STACK(objscheme_bundle_string(s)); - p[1] = WITH_VAR_STACK(objscheme_bundle_wxKeymap(km)); - p[3] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(event)); - - obj = WITH_VAR_STACK(scheme_apply(kctsr(data), 4, p)); - r = WITH_VAR_STACK(objscheme_unbundle_bool(obj, "Scheme grab-mouse callback")); - READY_TO_RETURN; - return r; -} - -static void BreakSequenceCallbackToScheme(KeymapCallbackToSchemeRec *data) -{ - scheme_apply_multi(kctsr(data), 0, NULL); -} - - -static Scheme_Object *breakType_wxBREAK_FOR_CARET_sym = NULL; -static Scheme_Object *breakType_wxBREAK_FOR_LINE_sym = NULL; -static Scheme_Object *breakType_wxBREAK_FOR_SELECTION_sym = NULL; -static Scheme_Object *breakType_wxBREAK_FOR_USER_1_sym = NULL; -static Scheme_Object *breakType_wxBREAK_FOR_USER_2_sym = NULL; - -static void init_symset_breakType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(breakType_wxBREAK_FOR_CARET_sym); - breakType_wxBREAK_FOR_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("caret")); - wxREGGLOB(breakType_wxBREAK_FOR_LINE_sym); - breakType_wxBREAK_FOR_LINE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("line")); - wxREGGLOB(breakType_wxBREAK_FOR_SELECTION_sym); - breakType_wxBREAK_FOR_SELECTION_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("selection")); - wxREGGLOB(breakType_wxBREAK_FOR_USER_1_sym); - breakType_wxBREAK_FOR_USER_1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("user1")); - wxREGGLOB(breakType_wxBREAK_FOR_USER_2_sym); - breakType_wxBREAK_FOR_USER_2_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("user2")); -} - -static int unbundle_symset_breakType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!breakType_wxBREAK_FOR_USER_2_sym) WITH_VAR_STACK(init_symset_breakType()); - Scheme_Object *i INIT_NULLED_OUT, *l = v; - long result = 0; - while (SCHEME_PAIRP(l)) { - i = SCHEME_CAR(l); - if (0) { } - else if (i == breakType_wxBREAK_FOR_CARET_sym) { result = result | wxBREAK_FOR_CARET; } - else if (i == breakType_wxBREAK_FOR_LINE_sym) { result = result | wxBREAK_FOR_LINE; } - else if (i == breakType_wxBREAK_FOR_SELECTION_sym) { result = result | wxBREAK_FOR_SELECTION; } - else if (i == breakType_wxBREAK_FOR_USER_1_sym) { result = result | wxBREAK_FOR_USER_1; } - else if (i == breakType_wxBREAK_FOR_USER_2_sym) { result = result | wxBREAK_FOR_USER_2; } - else { break; } - l = SCHEME_CDR(l); - } - if (SCHEME_NULLP(l)) { READY_TO_RETURN; return result; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "breakType symbol list", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_breakType(int v) { - REMEMBER_VAR_STACK(); - if (!breakType_wxBREAK_FOR_USER_2_sym) init_symset_breakType(); - Scheme_Object *l = scheme_null; - if (v & wxBREAK_FOR_CARET) l = WITH_REMEMBERED_STACK(scheme_make_pair(breakType_wxBREAK_FOR_CARET_sym, l)); - if (v & wxBREAK_FOR_LINE) l = WITH_REMEMBERED_STACK(scheme_make_pair(breakType_wxBREAK_FOR_LINE_sym, l)); - if (v & wxBREAK_FOR_SELECTION) l = WITH_REMEMBERED_STACK(scheme_make_pair(breakType_wxBREAK_FOR_SELECTION_sym, l)); - if (v & wxBREAK_FOR_USER_1) l = WITH_REMEMBERED_STACK(scheme_make_pair(breakType_wxBREAK_FOR_USER_1_sym, l)); - if (v & wxBREAK_FOR_USER_2) l = WITH_REMEMBERED_STACK(scheme_make_pair(breakType_wxBREAK_FOR_USER_2_sym, l)); - return l; -} - - - - - - -class os_wxMediaWordbreakMap : public wxMediaWordbreakMap { - public: - - os_wxMediaWordbreakMap CONSTRUCTOR_ARGS(()); - ~os_wxMediaWordbreakMap(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaWordbreakMap::gcMark() { - wxMediaWordbreakMap::gcMark(); -} -void os_wxMediaWordbreakMap::gcFixup() { - wxMediaWordbreakMap::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaWordbreakMap_class; - -os_wxMediaWordbreakMap::os_wxMediaWordbreakMap CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxMediaWordbreakMap()) -{ -} - -os_wxMediaWordbreakMap::~os_wxMediaWordbreakMap() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaWordbreakMapGetMap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxMediaWordbreakMap_class, "get-map in editor-wordbreak-map%", n, p); - unsigned char x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = ((unsigned char)WITH_VAR_STACK(objscheme_unbundle_char(p[POFFSET+0], "get-map in editor-wordbreak-map%"))); - - - r = WITH_VAR_STACK(((wxMediaWordbreakMap *)((Scheme_Class_Object *)p[0])->primdata)->GetMap(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_breakType(r)); -} - -static Scheme_Object *os_wxMediaWordbreakMapSetMap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaWordbreakMap_class, "set-map in editor-wordbreak-map%", n, p); - unsigned char x0; - int x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = ((unsigned char)WITH_VAR_STACK(objscheme_unbundle_char(p[POFFSET+0], "set-map in editor-wordbreak-map%"))); - x1 = WITH_VAR_STACK(unbundle_symset_breakType(p[POFFSET+1], "set-map in editor-wordbreak-map%")); - - - WITH_VAR_STACK(((wxMediaWordbreakMap *)((Scheme_Class_Object *)p[0])->primdata)->SetMap(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaWordbreakMap_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaWordbreakMap *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-wordbreak-map%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxMediaWordbreakMap CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaWordbreakMap()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxMediaWordbreakMap(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaWordbreakMap_class); - - os_wxMediaWordbreakMap_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-wordbreak-map%", "object%", (Scheme_Method_Prim *)os_wxMediaWordbreakMap_ConstructScheme, 2)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaWordbreakMap_class, "get-map" " method", (Scheme_Method_Prim *)os_wxMediaWordbreakMapGetMap, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaWordbreakMap_class, "set-map" " method", (Scheme_Method_Prim *)os_wxMediaWordbreakMapSetMap, 2, 2)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaWordbreakMap_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMediaWordbreakMap, wxTYPE_WORDBREAK_MAP)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaWordbreakMap(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaWordbreakMap_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-wordbreak-map% object or " XC_NULL_STR: "editor-wordbreak-map% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaWordbreakMap(class wxMediaWordbreakMap *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_WORDBREAK_MAP) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaWordbreakMap_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaWordbreakMap *objscheme_unbundle_wxMediaWordbreakMap(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaWordbreakMap(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaWordbreakMap *)o->primdata; - else - return (wxMediaWordbreakMap *)o->primdata; -} - - -static wxMediaWordbreakMap* wxGetTheMediaWordbreakMap() -{ - return wxTheMediaWordbreakMap; -} - -static Scheme_Object *wxGlobalMediaWordbreakMapwxGetTheMediaWordbreakMap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaWordbreakMap* r; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(wxGetTheMediaWordbreakMap()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaWordbreakMap(r)); -} - -void objscheme_setup_wxGlobalMediaWordbreakMap(Scheme_Env *env) -{ - Scheme_Object *functmp INIT_NULLED_OUT; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxGlobalMediaWordbreakMapwxGetTheMediaWordbreakMap, "get-the-editor-wordbreak-map", 0, 0)); - WITH_VAR_STACK(scheme_install_xc_global("get-the-editor-wordbreak-map", functmp, env)); - READY_TO_RETURN; -} - - diff --git a/src/mred/wxs/wxs_madm.h b/src/mred/wxs/wxs_madm.h deleted file mode 100644 index aff4c72699..0000000000 --- a/src/mred/wxs/wxs_madm.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef WXS_SETUP_ONLY -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxWindow(class wxWindow *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxWindow(class wxWindow *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *); -extern class wxMenu *objscheme_unbundle_wxMenu(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxWindow *objscheme_unbundle_wxWindow(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxWindow *objscheme_unbundle_wxWindow(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxMenu(class wxMenu *); -extern Scheme_Object *objscheme_bundle_wxColour(class wxColour *); -extern class wxColour *objscheme_unbundle_wxColour(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern class wxPanel *objscheme_unbundle_wxPanel(Scheme_Object *, const char *, int); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern class wxGLConfig *objscheme_unbundle_wxGLConfig(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxMediaCanvas(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaCanvas(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaCanvas(class wxMediaCanvas *realobj); -class wxMediaCanvas *objscheme_unbundle_wxMediaCanvas(Scheme_Object *obj, const char *where, int nullOK); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -#endif -void objscheme_setup_wxMediaAdmin(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaAdmin(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaAdmin(class wxMediaAdmin *realobj); -class wxMediaAdmin *objscheme_unbundle_wxMediaAdmin(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxMediaSnip(class wxMediaSnip *); -#endif -void objscheme_setup_wxMediaSnipMediaAdmin(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaSnipMediaAdmin(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaSnipMediaAdmin(class wxMediaSnipMediaAdmin *realobj); -class wxMediaSnipMediaAdmin *objscheme_unbundle_wxMediaSnipMediaAdmin(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *); -#endif -void objscheme_setup_wxSnipAdmin(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxSnipAdmin(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxSnipAdmin(class wxSnipAdmin *realobj); -class wxSnipAdmin *objscheme_unbundle_wxSnipAdmin(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -#endif -void objscheme_setup_wxSnipClass(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxSnipClass(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxSnipClass(class wxSnipClass *realobj); -class wxSnipClass *objscheme_unbundle_wxSnipClass(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxSnipClass(class wxSnipClass *); -extern class wxSnipClass *objscheme_unbundle_wxSnipClass(Scheme_Object *, const char *, int); -extern class wxSnipClass *objscheme_unbundle_wxSnipClass(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnipClass(class wxSnipClass *); -#endif -void objscheme_setup_wxSnipClassList(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxSnipClassList(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxSnipClassList(class wxSnipClassList *realobj); -class wxSnipClassList *objscheme_unbundle_wxSnipClassList(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern class wxKeymap *objscheme_unbundle_wxKeymap(Scheme_Object *, const char *, int); -extern class wxKeymap *objscheme_unbundle_wxKeymap(Scheme_Object *, const char *, int); -extern class wxEvent *objscheme_unbundle_wxEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxKeymap(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxKeymap(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxKeymap(class wxKeymap *realobj); -class wxKeymap *objscheme_unbundle_wxKeymap(Scheme_Object *obj, const char *where, int nullOK); -#endif -void objscheme_setup_wxMediaWordbreakMap(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaWordbreakMap(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaWordbreakMap(class wxMediaWordbreakMap *realobj); -class wxMediaWordbreakMap *objscheme_unbundle_wxMediaWordbreakMap(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxMediaWordbreakMap(class wxMediaWordbreakMap *); -#endif -void objscheme_setup_wxGlobalMediaWordbreakMap(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -#endif diff --git a/src/mred/wxs/wxs_madm.xc b/src/mred/wxs/wxs_madm.xc deleted file mode 100644 index 27eec2a9f2..0000000000 --- a/src/mred/wxs/wxs_madm.xc +++ /dev/null @@ -1,350 +0,0 @@ - -@INCLUDE prefix.xci - -#include "wx_media.h" -#include "wx_frame.h" -#include "wx_panel.h" - -@INCLUDE wxs.xci - -@HEADER - -#include "wxs_obj.h" -#include "wxs_evnt.h" - -#ifndef wxCONTROL_BORDER -# define wxCONTROL_BORDER wxBORDER -#endif - -@MACRO rNULL = return NULL; -@MACRO rFALSE = return FALSE; -@MACRO rZERO = return 0; - -@MACRO bAnythingFromVoid = ((Scheme_Object *){x}) -@MACRO ubAnythingToVoid = ((void *){x}) -@MACRO cAnything = 1 - -extern Bool wxsCheckIsPopupMenu(void *m); -@MACRO CHECKMENU[n.p] = if (!wxsCheckIsPopupMenu(p[POFFSET+

])) scheme_wrong_type(, "popup-menu% object",

+POFFSET, n, p); - -#ifndef wx_mac -# define wxRESIZE_CORNER 0 -#endif - -@BEGINSYMBOLS style > > PRED BUNDLE -@SYM "no-hscroll" : wxMCANVAS_NO_H_SCROLL -@SYM "no-vscroll" : wxMCANVAS_NO_V_SCROLL -@SYM "hide-hscroll" : wxMCANVAS_HIDE_H_SCROLL -@SYM "hide-vscroll" : wxMCANVAS_HIDE_V_SCROLL -@SYM "auto-hscroll" : wxMCANVAS_AUTO_H_SCROLL -@SYM "auto-vscroll" : wxMCANVAS_AUTO_V_SCROLL -@SYM "deleted" : wxINVISIBLE -@SYM "control-border" : wxCONTROL_BORDER -@SYM "combo" : wxCOMBO_SIDE -@SYM "transparent" : wxTRANSPARENT_WIN -@SYM "border" : wxBORDER -@SYM "resize-corner" : wxRESIZE_CORNER -@ENDSYMBOLS - -@INCLUDE wxs_fcs.xci - -static void *DoCAPOCallback(void *data) -{ - return (void *)scheme_apply_multi((Scheme_Object *)data, 0, NULL); -} - -typedef void *(*CAPOFunc)(void*); - -@CLASSBASE wxMediaCanvas "editor-canvas" : "canvas" - -// @CREATOR (wxFrame!,int=-1,int=-1,int=-1,int=-1, string="",SYM[style]=0,int=100,wxMediaBuffer^=NULL); : : /NOZERO[3]|NOZERO[4] <> frame -@CREATOR (wxPanel!,int=-1,int=-1,int=-1,int=-1, string="",SYM[style]=0,int=100,wxMediaBuffer^=NULL,wxGLConfig^=NULL); : : /NOZERO[3]|NOZERO[4] <> panel - -@CLASSID wxTYPE_MEDIA_CANVAS - -@IVAR "wheel-step" : nnint wheel_amt - -@ "set-editor" : void SetMedia(wxMediaBuffer^,bool=TRUE); -@ "get-editor" : wxMediaBuffer^ GetMedia(); - -@ v "on-set-focus" : void OnSetFocus(); -@ v "on-kill-focus" : void OnKillFocus(); - -@ v "on-scroll-on-change" : void OnScrollOnChange(); - -// No OnScroll, because it's handled more primitively to better support -// interactive scrolling on Mac OS X and Windows -// @ v "on-scroll" : void OnScroll(wxScrollEvent!); : JMPDECL/SETJMP/RESETJMP - -@ "is-focus-on?" : bool IsFocusOn(); - -@ "force-display-focus" : void ForceDisplayFocus(bool); - -@ "allow-scroll-to-last" : void AllowScrollToLast(bool); -@ "scroll-with-bottom-base" : void ScrollWithBottomBase(bool); - -@ "get-lazy-refresh" : bool GetLazyRefresh(); -@ "set-lazy-refresh" : void SetLazyRefresh(bool); - -@ "scroll-to" : bool ScrollTo(double,double,nndouble,nndouble, bool,SYM[bias]=0); : : : rFALSE - -@ "clear-margins" : void ClearMargins(); - -@ "get-x-margin" : nnint GetXMargin(); -@ "get-y-margin" : nnint GetYMargin(); -@ "set-x-margin" : void SetXMargin(nnint); -@ "set-y-margin" : void SetYMargin(nnint); - -@ "set-canvas-background" : void SetCanvasBackground(wxColour^); -@ "get-canvas-background" : wxColour^ GetCanvasBackground(); - -@MACRO CastToSO = (Scheme_Object*){x} -@MACRO ubTestFunc = DoCAPOCallback -@MACRO ubData = p[POFFSET] -@MACRO spAnything = _ -@MACRO spCAPOProc = (-> _) - -@ "call-as-primary-owner" : void[]/CastToSO//spAnything CallAsPrimaryOwner(CAPOFunc//ubTestFunc///spCAPOProc/nopush, -void[]//ubData////push); - -@ v "popup-for-editor" : wxMenu^ PopupForMedia(wxMediaBuffer^,void[]/bAnythingFromVoid/ubAnythingToVoid/cAnything///push); : : : rNULL - -@SETMARK w = d -@INCLUDE wxs_win.xci - -@SETMARK c = d -@INCLUDE wxs_cnvs.xci - -@END - - -@CLASSBASE wxMediaAdmin "editor-admin":"object" / nofnl - -@CREATOR (); - -@CLASSID wxTYPE_MEDIA_ADMIN - -@SETMARK A = V -@INCLUDE wxs_madm.xci - -@END - -@CLASSBASE wxMediaSnipMediaAdmin "editor-snip-editor-admin":"editor-admin" / nofnl -@INTERFACE "editor-snip-editor-admin" - -@CLASSID wxTYPE_MEDIA_SNIP_MEDIA_ADMIN - -@ "get-snip" : wxMediaSnip! GetSnip() - -@END - -@CLASSBASE wxSnipAdmin "snip-admin":"object" / nofnl - -@CREATOR (); - -@CLASSID wxTYPE_MEDIA_SNIP_ADMIN - -@ V "get-editor" : wxMediaBuffer^ GetMedia(); : : : rNULL -@ V "get-dc" : wxDC^ GetDC(); : : : rNULL -@ V "get-view-size" : void GetViewSize(nndouble?, nndouble?); -@ V "get-view" : void GetView(double?, double?, nndouble?, nndouble?, wxSnip^=NULL); -@ V "scroll-to" : bool ScrollTo(wxSnip!, double,double,nndouble,nndouble, bool,SYM[bias]=0); : : : rFALSE -@ V "set-caret-owner" : void SetCaretOwner(wxSnip!,SYM[focus]); -@ V "resized" : void Resized(wxSnip!, bool); -@ V "recounted" : bool Recounted(wxSnip!, bool); : : : rFALSE -@ V "needs-update" : void NeedsUpdate(wxSnip!, double,double,nndouble,nndouble); -@ V "release-snip" : bool ReleaseSnip(wxSnip!); : : : rFALSE -@ V "update-cursor" : void UpdateCursor(); -@ V "popup-menu" : bool PopupMenu(void[]/bAnythingFromVoid/ubAnythingToVoid/cAnything///push,wxSnip!,double,double); : : CHECKMENU[METHODNAME("snip-admin%","popup-menu").0] : rFALSE -@ V "modified" : void Modified(wxSnip!, bool); - -@END - - -@CLASSBASE wxSnipClass "snip-class" : "object" - -@CREATOR (); - -@CLASSID wxTYPE_SNIP_CLASS - -@IVAR "classname" : string classname -@IVAR "version" : int version - -@ V "read" : wxSnip^ Read(wxMediaStreamIn!); : : : rNULL -@ v "read-header" : bool ReadHeader(wxMediaStreamIn!); -@ v "write-header" : bool WriteHeader(wxMediaStreamOut!); -@ "reading-version" : int ReadingVersion(wxMediaStreamIn!); - -@END - - -@CLASSBASE wxSnipClassList "snip-class-list" : "object" -@INTERFACE "snip-class-list" - -@CLASSID wxTYPE_SNIP_CLASS_LIST - -@ "find" : wxSnipClass^ Find(string); -@ "find-position" : short FindPosition(wxSnipClass!); -@ "add" : void Add(wxSnipClass!); -@ "number" : int Number(); -@ "nth" : wxSnipClass^ Nth(nnint); - -@END - - -@CLASSBASE wxKeymap "keymap":"object" / nofnl - -typedef Scheme_Object KeymapCallbackToSchemeRec; -#define kctsr(o) o - -static Bool KMCallbackToScheme(UNKNOWN_OBJ, wxEvent *, KeymapCallbackToSchemeRec *data); -static Bool GrabKeyCallbackToScheme(char *s, wxKeymap *km, UNKNOWN_OBJ, wxKeyEvent *, KeymapCallbackToSchemeRec *data); -static Bool GrabMouseCallbackToScheme(char *s, wxKeymap *km, UNKNOWN_OBJ, wxMouseEvent *, KeymapCallbackToSchemeRec *data); -static void BreakSequenceCallbackToScheme(KeymapCallbackToSchemeRec *data); - -@MACRO bCallback = -@MACRO ubSetup = KeymapCallbackToSchemeRec *cb; - -@MACRO ubCallbackKM = (wxKMFunction)KMCallbackToScheme -@MACRO ubCallbackGrabKey = (wxGrabKeyFunction)GrabKeyCallbackToScheme -@MACRO ubCallbackGrabMouse = (wxGrabMouseFunction)GrabMouseCallbackToScheme -@MACRO ubCallbackBreak = (wxBreakSequenceFunction)BreakSequenceCallbackToScheme - -@MACRO spCallbackKM = (wxObject-object wxEvent-object -> bool) -@MACRO spCallbackGrabKey = (str wxKeymap-object wxObject-object wxKeyEvent-object -> bool) -@MACRO spCallbackGrabMouse = (str wxKeymap-object wxObject-object wxMouseEvent-object -> bool) -@MACRO spCallbackBreak = (-> void) - -@MACRO ubData = NULL - -@MACRO ubSetData[n.m] = kctsr(cb) = p[POFFSET+]; x = (void *)cb; - -@CREATOR (); - -@CLASSID wxTYPE_KEYMAP - -@ "get-double-click-interval" : int GetDoubleClickInterval(); -@ "set-double-click-interval" : void SetDoubleClickInterval(rint[0|1000000]); - -@ v "handle-key-event" : bool HandleKeyEvent(UNKNOWN_OBJ/bAnythingFromVoid/ubAnythingToVoid/cAnything///push,wxKeyEvent!); -@ v "handle-mouse-event" : bool HandleMouseEvent(UNKNOWN_OBJ/bAnythingFromVoid/ubAnythingToVoid/cAnything///push,wxMouseEvent!); -@ "break-sequence" : void BreakSequence(); -@ "map-function" : void MapFunction(mzstring,string); -@ "add-function" : void AddFunction(string,wxKMFunction/bCallback/ubCallbackKM/cCallback//spCallbackKM/nopush,-unknown#void*=NULL); : : ubSetup / ubSetData[1.2] -@ "set-grab-key-function" : void SetGrabKeyFunction(wxGrabKeyFunction/bCallback/ubCallbackGrabKey/cCallback//spCallbackGrabKey/nopush,-unknown#void*=NULL); : : ubSetup / ubSetData[0.1] -@ "remove-grab-key-function" : void RemoveGrabKeyFunction() -@ "set-grab-mouse-function" : void SetGrabMouseFunction(wxGrabMouseFunction/bCallback/ubCallbackGrabMouse/cCallback//spCallbackGrabMouse/nopush,-unknown#void*=NULL); : : ubSetup / ubSetData[0.1] -@ "remove-grab-mouse-function" : void RemoveGrabMouseFunction() -@ "call-function" : bool CallFunction(string,UNKNOWN_OBJ/bAnythingFromVoid/ubAnythingToVoid/cAnything///push,wxEvent!,bool=FALSE); -@ "set-break-sequence-callback" : void SetBreakSequenceCallback(wxBreakSequenceFunction/bCallback/ubCallbackBreak/cCallback//spCallbackBreak/nopush,-unknown#void*=NULL); : : ubSetup / ubSetData[0.1] -@ "chain-to-keymap" : void ChainToKeymap(wxKeymap!,bool); -@ "remove-chained-keymap" : void RemoveChainedKeymap(wxKeymap!); - -@END - -static Bool KMCallbackToScheme(UNKNOWN_OBJ media, wxEvent *event, - KeymapCallbackToSchemeRec *data) -{ - Scheme_Object *p[2], *obj = NULL; - Bool r; - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, p[0]); - VAR_STACK_PUSH(1, p[1]); - VAR_STACK_PUSH(2, obj); - VAR_STACK_PUSH(3, event); - VAR_STACK_PUSH(4, data); - - p[0] = (Scheme_Object *)media; - p[1] = NULL; - p[1] = WITH_VAR_STACK(objscheme_bundle_wxEvent(event)); - - obj = WITH_VAR_STACK(scheme_apply(kctsr(data), 2, p)); - r = WITH_VAR_STACK(objscheme_unbundle_bool(obj, "Scheme key callback")); - READY_TO_RETURN; - return r; -} - -static Bool GrabKeyCallbackToScheme(char *s, wxKeymap *km, - UNKNOWN_OBJ media, wxKeyEvent *event, - KeymapCallbackToSchemeRec *data) -{ - Scheme_Object *p[4], *obj = NULL; - Bool r; - SETUP_VAR_STACK(6); - VAR_STACK_PUSH_ARRAY(0, p, 4); - VAR_STACK_PUSH(3, obj); - VAR_STACK_PUSH(4, event); - VAR_STACK_PUSH(5, data); - VAR_STACK_PUSH(6, km); - - p[0] = NULL; - p[1] = NULL; - p[3] = NULL; - - p[2] = (Scheme_Object *)media; - - p[0] = WITH_VAR_STACK(objscheme_bundle_string(s)); - p[1] = WITH_VAR_STACK(objscheme_bundle_wxKeymap(km)); - p[3] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(event)); - - obj = WITH_VAR_STACK(scheme_apply(kctsr(data), 4, p)); - r = WITH_VAR_STACK(objscheme_unbundle_bool(obj, "Scheme grab-key callback")); - READY_TO_RETURN; - return r; -} - -static Bool GrabMouseCallbackToScheme(char *s, wxKeymap *km, - UNKNOWN_OBJ media, wxMouseEvent *event, - KeymapCallbackToSchemeRec *data) -{ - Scheme_Object *p[4], *obj = NULL; - Bool r; - SETUP_VAR_STACK(6); - VAR_STACK_PUSH_ARRAY(0, p, 4); - VAR_STACK_PUSH(3, obj); - VAR_STACK_PUSH(4, event); - VAR_STACK_PUSH(5, data); - VAR_STACK_PUSH(6, km); - - p[0] = NULL; - p[1] = NULL; - p[3] = NULL; - - p[2] = (Scheme_Object *)media; - - p[0] = WITH_VAR_STACK(objscheme_bundle_string(s)); - p[1] = WITH_VAR_STACK(objscheme_bundle_wxKeymap(km)); - p[3] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(event)); - - obj = WITH_VAR_STACK(scheme_apply(kctsr(data), 4, p)); - r = WITH_VAR_STACK(objscheme_unbundle_bool(obj, "Scheme grab-mouse callback")); - READY_TO_RETURN; - return r; -} - -static void BreakSequenceCallbackToScheme(KeymapCallbackToSchemeRec *data) -{ - scheme_apply_multi(kctsr(data), 0, NULL); -} - -@INCLUDE wxs_bkt.xci - -@CLASSBASE wxMediaWordbreakMap "editor-wordbreak-map" : "object" - -@CREATOR () - -@CLASSID wxTYPE_WORDBREAK_MAP - -@ "set-map" : void SetMap(uchar,SYM[breakType]); -@ "get-map" : SYM[breakType] GetMap(uchar); - -@END - -static wxMediaWordbreakMap* wxGetTheMediaWordbreakMap() -{ - return wxTheMediaWordbreakMap; -} - -@GLOBAL wxGlobalMediaWordbreakMap -@ "get-the-editor-wordbreak-map" : wxMediaWordbreakMap! wxGetTheMediaWordbreakMap() -@END - diff --git a/src/mred/wxs/wxs_madm.xci b/src/mred/wxs/wxs_madm.xci deleted file mode 100644 index 38c0d8d631..0000000000 --- a/src/mred/wxs/wxs_madm.xci +++ /dev/null @@ -1,12 +0,0 @@ - -@ A "get-dc" : wxDC^ GetDC(double?=NULL,double?=NULL); : : : rNULL -@ A "get-view" : void GetView(double?,double?,nndouble?,nndouble?,bool=FALSE); -@ A "get-max-view" : void GetMaxView(double?,double?,nndouble?,nndouble?,bool=FALSE); -@ A "scroll-to" : bool ScrollTo(double,double,nndouble,nndouble,bool=TRUE,SYM[bias]=0); : : : rFALSE -@ A "grab-caret" : void GrabCaret(SYM[focus]=wxFOCUS_GLOBAL); -@ A "resized" : void Resized(bool); -@ A "needs-update" : void NeedsUpdate(double,double,nndouble,nndouble); -@ A "update-cursor" : void UpdateCursor(); -@ A "popup-menu" : bool PopupMenu(void[]/bAnythingFromVoid/ubAnythingToVoid/cAnything///push,double,double); : : CHECKMENU[METHODNAME("editor-admin%","popup-menu").0] : rFALSE -@ A "refresh-delayed?" : bool DelayRefresh(); : : : rFALSE -@ A "modified" : void Modified(bool) diff --git a/src/mred/wxs/wxs_mbuf.xci b/src/mred/wxs/wxs_mbuf.xci deleted file mode 100644 index ac8d912ae7..0000000000 --- a/src/mred/wxs/wxs_mbuf.xci +++ /dev/null @@ -1,98 +0,0 @@ - -/* - X = Not meant for virtual, defined in wxMediaEdit/wxMediaPasteboard - and overloaded there - Y = Virtual, defined in wxMediaEdit/wxMediaPasteboard - Z = Virtual, defined in wxMediaBuffer -*/ - -@MACRO XrZERO = return 0; -@MACRO XrNULL = return NULL; - -@ X "change-style" : void ChangeStyle(wxStyleDelta^); <> style-delta% without position or snip% -@ X "insert" : void Insert(wxSnip!); <> snip% without position - -@ X "cut" : void Cut(bool=FALSE,ExactLong=0); <> without position -@ X "copy" : void Copy(bool=FALSE,ExactLong=0); <> without position -@ X "paste" : void Paste(ExactLong=0); <> without position -@ X "paste-x-selection" : void PasteSelection(ExactLong=0); <> without position -@ X "kill" : void Kill(ExactLong=0); <> without position - -@ Y "copy-self" : wxMediaBuffer! CopySelf(); : : : : XrZERO -@ Y "copy-self-to" : void CopySelfTo(wxMediaBuffer!); - -@ Y "on-event" : void OnEvent(wxMouseEvent!); -@ Y "on-char" : void OnChar(wxKeyEvent!); -@ Y "adjust-cursor" : wxCursor^ AdjustCursor(wxMouseEvent!); : : : : XrNULL -@ Y "refresh" : void Refresh(double,double,nndouble,nndouble,SYM[caret],wxColour^); -@ Y "own-caret" : void OwnCaret(bool); -@ Y "blink-caret" : void BlinkCaret(); - -@ Y "get-extent" : void GetExtent(nndouble?,nndouble?); -@ Y "get-descent" : double GetDescent(); : : : : XrZERO -@ Y "get-space" : double GetSpace(); : : : : XrZERO - -@ X "find-first-snip" : wxSnip^ FindFirstSnip(); - -@ Z "on-local-event" : void OnLocalEvent(wxMouseEvent!); -@ Z "on-local-char" : void OnLocalChar(wxKeyEvent!); -@ Y "on-default-event" : void OnDefaultEvent(wxMouseEvent!); -@ Y "on-default-char" : void OnDefaultChar(wxKeyEvent!); - -@ Z "on-focus" : void OnFocus(bool); - -@ Y "on-change" : void OnChange(); - -@ Z "on-display-size" : void OnDisplaySize(); -@ Z "on-display-size-when-ready" : void OnDisplaySizeWhenReady(); - -@ Y "scroll-to" : bool ScrollTo(wxSnip!,double,double,nndouble,nndouble,bool,SYM[bias]=0); : : : : XrZERO -@ Y "set-caret-owner" : void SetCaretOwner(wxSnip^,SYM[focus]=wxFOCUS_IMMEDIATE); -@ Y "resized" : void Resized(wxSnip!,bool); -@ Y "needs-update" : void NeedsUpdate(wxSnip!,double,double,nndouble,nndouble); - -@ Y "get-snip-data" : wxBufferData^ GetSnipData(wxSnip!); : : : : XrZERO -@ Y "set-snip-data" : void SetSnipData(wxSnip!, wxBufferData^); - -@ Y "scroll-editor-to" : bool AdminScrollTo(double,double,nndouble,nndouble,bool,SYM[bias]); : : : : XrZERO - -@ Z "set-modified" : void SetModified(bool); -@ Z "on-snip-modified" : void OnSnipModified(wxSnip!,bool); - -@ Y "release-snip" : bool ReleaseSnip(wxSnip!); : : : : XrZERO - -@ Y "set-filename" : void SetFilename(nxpathname,bool=FALSE); - -@ X "read-from-file" : bool ReadFromFile(wxMediaStreamIn!,bool=FALSE); <> without position -@ X "write-to-file" : bool WriteToFile(wxMediaStreamOut!); <> without position - -@ Z "read-header-from-file" : bool ReadHeaderFromFile(wxMediaStreamIn!,string); -@ Z "read-footer-from-file" : bool ReadFooterFromFile(wxMediaStreamIn!,string); -@ Z "write-headers-to-file" : bool WriteHeadersToFile(wxMediaStreamOut!); -@ Z "write-footers-to-file" : bool WriteFootersToFile(wxMediaStreamOut!); - -@ Z "on-paint" : void OnPaint(bool,wxDC!,double,double,double,double,double,double,SYM[caret]); : : /CHECKDCOK[1.METHODNAME("editor<%>","on-paint")] -@ Y "invalidate-bitmap-cache" : void InvalidateBitmapCache(double=0.0,double=0.0,nnfs[end]=-1.0,nnfs[end]=-1.0); -@ Y "size-cache-invalid" : void SizeCacheInvalid(); - -@ Z "on-new-image-snip" : wxImageSnip! OnNewImageSnip(nxpathname,SYM[bitmapType],bool,bool); -@ Z "on-new-box" : wxSnip! OnNewBox(SYM[bufferType]); - -@ Z "can-save-file?" : bool CanSaveFile(epathname,SYM[fileType]); -@ Z "on-save-file" : void OnSaveFile(epathname,SYM[fileType]); -@ Z "after-save-file" : void AfterSaveFile(bool); -@ Z "can-load-file?" : bool CanLoadFile(epathname,SYM[fileType]); -@ Z "on-load-file" : void OnLoadFile(epathname,SYM[fileType]); -@ Z "after-load-file" : void AfterLoadFile(bool); - -@ Z "on-edit-sequence" : void OnEditSequence(); -@ Z "after-edit-sequence" : void AfterEditSequence(); - -@ Z "get-file" : npathname GetFile(nepathname); -@ Z "put-file" : npathname PutFile(nepathname, nepathname); - -@MACRO makeNoCopyFlatString[len] = WITH_VAR_STACK(scheme_make_sized_char_string(r, , 0)) - -@ X "get-flattened-text" : mzstring/makeNoCopyFlatString[_x0] GetFlattenedText(-long*); - -@ Z "default-style-name" : string GetDefaultStyleName() diff --git a/src/mred/wxs/wxs_mede.cxx b/src/mred/wxs/wxs_mede.cxx deleted file mode 100644 index a81ace7f7d..0000000000 --- a/src/mred/wxs/wxs_mede.cxx +++ /dev/null @@ -1,9058 +0,0 @@ -/* DO NOT EDIT THIS FILE. */ -/* This file was generated by xctocc from "wxs_mede.xc". */ - - -#if defined(_MSC_VER) -# include "wx.h" -#endif -#if defined(OS_X) -# include "common.h" -#endif - -#include "wx_media.h" - - - - -#ifdef wx_x -# define BM_SELECTED(map) ((map)->selectedTo) -#endif -#if defined(wx_mac) || defined(wx_msw) -# define BM_SELECTED(map) ((map)->selectedInto) -#endif -# define BM_IN_USE(map) ((map)->selectedIntoDC) - - - - -#define ESCAPE_NO_RET_VAL /*empty*/ - - -#include "wxscheme.h" -#include "wxs_mede.h" - -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - -#undef l_ADDRESS -#undef l_DEREF -#undef l_TEST -#undef l_POINT -#undef l_TYPE -#undef l_LIST_ITEM_BUNDLE -#undef l_LIST_ITEM_UNBUNDLE -#undef l_MAKE_LIST -#undef l_MAKE_ARRAY -#undef l_EXTRA -#undef l_TERMINATE -#undef l_COPY -#undef l_OKTEST -#undef l_INTTYPE - -#define l_ADDRESS -#define l_DEREF -#define l_NEWATOMIC (UseGC) -#define l_NULLOK 0 -#define l_TEST -#define l_POINT -#define l_EXTRA 0 -#define l_TERMINATE -#define l_COPY l_COPYDEST=l_COPYSRC; -#define l_OKTEST -#define l_INTTYPE int -#define l_DIRECTMALLOC 0 - -#define l_TYPE double -#define l_LIST_ITEM_BUNDLE objscheme_bundle_double -#define l_LIST_ITEM_UNBUNDLE objscheme_unbundle_double -#define l_MAKE_LIST __MakedoubleList -#define l_MAKE_ARRAY __MakedoubleArray - - - - - -static Scheme_Object *l_MAKE_LIST(l_TYPE l_POINT *f, l_INTTYPE c) -{ - Scheme_Object *cdr = scheme_null, *obj = NULL; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cdr); - - while (c--) { - obj = WITH_VAR_STACK(l_LIST_ITEM_BUNDLE(l_ADDRESS f[c])); - cdr = WITH_VAR_STACK(scheme_make_pair(obj, cdr)); - } - - READY_TO_RETURN; - - return cdr; -} - -static l_TYPE l_POINT *l_MAKE_ARRAY(Scheme_Object *l, l_INTTYPE *c, char *who) -{ - Scheme_Object *orig_l = l; - int i = 0; - long len; - l_TYPE l_POINT *f = NULL; - - SETUP_VAR_STACK(3); - VAR_STACK_PUSH(0, l); - VAR_STACK_PUSH(1, orig_l); - VAR_STACK_PUSH(2, f); - - len = WITH_VAR_STACK(scheme_proper_list_length(l)); - if (len < 0) WITH_VAR_STACK(scheme_wrong_type(who, "proper-list", -1, 0, &l)); - if (c) *c = len; - - if (!(len + l_EXTRA)) { - READY_TO_RETURN; - return NULL; - } - -#if l_DIRECTMALLOC - f = (l_TYPE l_POINT *)WITH_VAR_STACK(GC_malloc_atomic(sizeof(l_TYPE l_POINT) * (len + l_EXTRA))); -#else - f = WITH_VAR_STACK(new l_NEWATOMIC l_TYPE l_POINT[len + l_EXTRA]); -#endif - - while (!SCHEME_NULLP(l)) { - if (!SCHEME_LISTP(l)) { - WITH_VAR_STACK(scheme_arg_mismatch(who, "expected a proper list: ", orig_l)); - READY_TO_RETURN; - return NULL; - } - -#define l_COPYDEST f[i] -#define l_COPYSRC (l_DEREF WITH_VAR_STACK(l_LIST_ITEM_UNBUNDLE(SCHEME_CAR(l), who l_TEST))) - - l_COPY - - l_OKTEST - - i++; - - l = SCHEME_CDR(l); - } - l_TERMINATE - - READY_TO_RETURN; - - return f; -} - - - -static Scheme_Object *selType_wxDEFAULT_SELECT_sym = NULL; -static Scheme_Object *selType_wxX_SELECT_sym = NULL; -static Scheme_Object *selType_wxLOCAL_SELECT_sym = NULL; - -static void init_symset_selType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(selType_wxDEFAULT_SELECT_sym); - selType_wxDEFAULT_SELECT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("default")); - wxREGGLOB(selType_wxX_SELECT_sym); - selType_wxX_SELECT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("x")); - wxREGGLOB(selType_wxLOCAL_SELECT_sym); - selType_wxLOCAL_SELECT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("local")); -} - -static int unbundle_symset_selType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!selType_wxLOCAL_SELECT_sym) WITH_VAR_STACK(init_symset_selType()); - if (0) { } - else if (v == selType_wxDEFAULT_SELECT_sym) { READY_TO_RETURN; return wxDEFAULT_SELECT; } - else if (v == selType_wxX_SELECT_sym) { READY_TO_RETURN; return wxX_SELECT; } - else if (v == selType_wxLOCAL_SELECT_sym) { READY_TO_RETURN; return wxLOCAL_SELECT; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "selType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - -static Scheme_Object *moveCode_WXK_HOME_sym = NULL; -static Scheme_Object *moveCode_WXK_END_sym = NULL; -static Scheme_Object *moveCode_WXK_RIGHT_sym = NULL; -static Scheme_Object *moveCode_WXK_LEFT_sym = NULL; -static Scheme_Object *moveCode_WXK_UP_sym = NULL; -static Scheme_Object *moveCode_WXK_DOWN_sym = NULL; - -static void init_symset_moveCode(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(moveCode_WXK_HOME_sym); - moveCode_WXK_HOME_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("home")); - wxREGGLOB(moveCode_WXK_END_sym); - moveCode_WXK_END_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("end")); - wxREGGLOB(moveCode_WXK_RIGHT_sym); - moveCode_WXK_RIGHT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("right")); - wxREGGLOB(moveCode_WXK_LEFT_sym); - moveCode_WXK_LEFT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("left")); - wxREGGLOB(moveCode_WXK_UP_sym); - moveCode_WXK_UP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("up")); - wxREGGLOB(moveCode_WXK_DOWN_sym); - moveCode_WXK_DOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("down")); -} - -static int unbundle_symset_moveCode(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!moveCode_WXK_DOWN_sym) WITH_VAR_STACK(init_symset_moveCode()); - if (0) { } - else if (v == moveCode_WXK_HOME_sym) { READY_TO_RETURN; return WXK_HOME; } - else if (v == moveCode_WXK_END_sym) { READY_TO_RETURN; return WXK_END; } - else if (v == moveCode_WXK_RIGHT_sym) { READY_TO_RETURN; return WXK_RIGHT; } - else if (v == moveCode_WXK_LEFT_sym) { READY_TO_RETURN; return WXK_LEFT; } - else if (v == moveCode_WXK_UP_sym) { READY_TO_RETURN; return WXK_UP; } - else if (v == moveCode_WXK_DOWN_sym) { READY_TO_RETURN; return WXK_DOWN; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "moveCode symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - -static Scheme_Object *move_wxMOVE_SIMPLE_sym = NULL; -static Scheme_Object *move_wxMOVE_LINE_sym = NULL; -static Scheme_Object *move_wxMOVE_PAGE_sym = NULL; -static Scheme_Object *move_wxMOVE_WORD_sym = NULL; - -static void init_symset_move(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(move_wxMOVE_SIMPLE_sym); - move_wxMOVE_SIMPLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("simple")); - wxREGGLOB(move_wxMOVE_LINE_sym); - move_wxMOVE_LINE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("line")); - wxREGGLOB(move_wxMOVE_PAGE_sym); - move_wxMOVE_PAGE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("page")); - wxREGGLOB(move_wxMOVE_WORD_sym); - move_wxMOVE_WORD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("word")); -} - -static int unbundle_symset_move(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!move_wxMOVE_WORD_sym) WITH_VAR_STACK(init_symset_move()); - if (0) { } - else if (v == move_wxMOVE_SIMPLE_sym) { READY_TO_RETURN; return wxMOVE_SIMPLE; } - else if (v == move_wxMOVE_LINE_sym) { READY_TO_RETURN; return wxMOVE_LINE; } - else if (v == move_wxMOVE_PAGE_sym) { READY_TO_RETURN; return wxMOVE_PAGE; } - else if (v == move_wxMOVE_WORD_sym) { READY_TO_RETURN; return wxMOVE_WORD; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "move symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - -static Scheme_Object *findKind_wxSNIP_BEFORE_OR_NULL_sym = NULL; -static Scheme_Object *findKind_wxSNIP_BEFORE_sym = NULL; -static Scheme_Object *findKind_wxSNIP_AFTER_sym = NULL; -static Scheme_Object *findKind_wxSNIP_AFTER_OR_NULL_sym = NULL; - -static void init_symset_findKind(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(findKind_wxSNIP_BEFORE_OR_NULL_sym); - findKind_wxSNIP_BEFORE_OR_NULL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("before-or-none")); - wxREGGLOB(findKind_wxSNIP_BEFORE_sym); - findKind_wxSNIP_BEFORE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("before")); - wxREGGLOB(findKind_wxSNIP_AFTER_sym); - findKind_wxSNIP_AFTER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("after")); - wxREGGLOB(findKind_wxSNIP_AFTER_OR_NULL_sym); - findKind_wxSNIP_AFTER_OR_NULL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("after-or-none")); -} - -static int unbundle_symset_findKind(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!findKind_wxSNIP_AFTER_OR_NULL_sym) WITH_VAR_STACK(init_symset_findKind()); - if (0) { } - else if (v == findKind_wxSNIP_BEFORE_OR_NULL_sym) { READY_TO_RETURN; return wxSNIP_BEFORE_OR_NULL; } - else if (v == findKind_wxSNIP_BEFORE_sym) { READY_TO_RETURN; return wxSNIP_BEFORE; } - else if (v == findKind_wxSNIP_AFTER_sym) { READY_TO_RETURN; return wxSNIP_AFTER; } - else if (v == findKind_wxSNIP_AFTER_OR_NULL_sym) { READY_TO_RETURN; return wxSNIP_AFTER_OR_NULL; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "findKind symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - -static Scheme_Object *breakType_wxBREAK_FOR_CARET_sym = NULL; -static Scheme_Object *breakType_wxBREAK_FOR_LINE_sym = NULL; -static Scheme_Object *breakType_wxBREAK_FOR_SELECTION_sym = NULL; -static Scheme_Object *breakType_wxBREAK_FOR_USER_1_sym = NULL; -static Scheme_Object *breakType_wxBREAK_FOR_USER_2_sym = NULL; - -static void init_symset_breakType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(breakType_wxBREAK_FOR_CARET_sym); - breakType_wxBREAK_FOR_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("caret")); - wxREGGLOB(breakType_wxBREAK_FOR_LINE_sym); - breakType_wxBREAK_FOR_LINE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("line")); - wxREGGLOB(breakType_wxBREAK_FOR_SELECTION_sym); - breakType_wxBREAK_FOR_SELECTION_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("selection")); - wxREGGLOB(breakType_wxBREAK_FOR_USER_1_sym); - breakType_wxBREAK_FOR_USER_1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("user1")); - wxREGGLOB(breakType_wxBREAK_FOR_USER_2_sym); - breakType_wxBREAK_FOR_USER_2_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("user2")); -} - -static int unbundle_symset_breakType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!breakType_wxBREAK_FOR_USER_2_sym) WITH_VAR_STACK(init_symset_breakType()); - if (0) { } - else if (v == breakType_wxBREAK_FOR_CARET_sym) { READY_TO_RETURN; return wxBREAK_FOR_CARET; } - else if (v == breakType_wxBREAK_FOR_LINE_sym) { READY_TO_RETURN; return wxBREAK_FOR_LINE; } - else if (v == breakType_wxBREAK_FOR_SELECTION_sym) { READY_TO_RETURN; return wxBREAK_FOR_SELECTION; } - else if (v == breakType_wxBREAK_FOR_USER_1_sym) { READY_TO_RETURN; return wxBREAK_FOR_USER_1; } - else if (v == breakType_wxBREAK_FOR_USER_2_sym) { READY_TO_RETURN; return wxBREAK_FOR_USER_2; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "breakType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_breakType(int v) { - if (!breakType_wxBREAK_FOR_USER_2_sym) init_symset_breakType(); - switch (v) { - case wxBREAK_FOR_CARET: return breakType_wxBREAK_FOR_CARET_sym; - case wxBREAK_FOR_LINE: return breakType_wxBREAK_FOR_LINE_sym; - case wxBREAK_FOR_SELECTION: return breakType_wxBREAK_FOR_SELECTION_sym; - case wxBREAK_FOR_USER_1: return breakType_wxBREAK_FOR_USER_1_sym; - case wxBREAK_FOR_USER_2: return breakType_wxBREAK_FOR_USER_2_sym; - default: return NULL; - } -} - - -# define Sym_FORWARD 1 -# define Sym_BACKWARD -1 -static Scheme_Object *direction_Sym_FORWARD_sym = NULL; -static Scheme_Object *direction_Sym_BACKWARD_sym = NULL; - -static void init_symset_direction(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(direction_Sym_FORWARD_sym); - direction_Sym_FORWARD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("forward")); - wxREGGLOB(direction_Sym_BACKWARD_sym); - direction_Sym_BACKWARD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("backward")); -} - -static int unbundle_symset_direction(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!direction_Sym_BACKWARD_sym) WITH_VAR_STACK(init_symset_direction()); - if (0) { } - else if (v == direction_Sym_FORWARD_sym) { READY_TO_RETURN; return Sym_FORWARD; } - else if (v == direction_Sym_BACKWARD_sym) { READY_TO_RETURN; return Sym_BACKWARD; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "direction symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_direction(int v) { - if (!direction_Sym_BACKWARD_sym) init_symset_direction(); - switch (v) { - case Sym_FORWARD: return direction_Sym_FORWARD_sym; - case Sym_BACKWARD: return direction_Sym_BACKWARD_sym; - default: return NULL; - } -} - - -# define Sym_RIGHT 1 -# define Sym_CENTER 0 -# define Sym_LEFT -1 -static Scheme_Object *horizontalAlignment_Sym_LEFT_sym = NULL; -static Scheme_Object *horizontalAlignment_Sym_RIGHT_sym = NULL; -static Scheme_Object *horizontalAlignment_Sym_CENTER_sym = NULL; - -static void init_symset_horizontalAlignment(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(horizontalAlignment_Sym_LEFT_sym); - horizontalAlignment_Sym_LEFT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("left")); - wxREGGLOB(horizontalAlignment_Sym_RIGHT_sym); - horizontalAlignment_Sym_RIGHT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("right")); - wxREGGLOB(horizontalAlignment_Sym_CENTER_sym); - horizontalAlignment_Sym_CENTER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("center")); -} - -static int unbundle_symset_horizontalAlignment(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!horizontalAlignment_Sym_CENTER_sym) WITH_VAR_STACK(init_symset_horizontalAlignment()); - if (0) { } - else if (v == horizontalAlignment_Sym_LEFT_sym) { READY_TO_RETURN; return Sym_LEFT; } - else if (v == horizontalAlignment_Sym_RIGHT_sym) { READY_TO_RETURN; return Sym_RIGHT; } - else if (v == horizontalAlignment_Sym_CENTER_sym) { READY_TO_RETURN; return Sym_CENTER; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "horizontalAlignment symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - - -static Scheme_Object *bufferType_wxEDIT_BUFFER_sym = NULL; -static Scheme_Object *bufferType_wxPASTEBOARD_BUFFER_sym = NULL; - -static void init_symset_bufferType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bufferType_wxEDIT_BUFFER_sym); - bufferType_wxEDIT_BUFFER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text")); - wxREGGLOB(bufferType_wxPASTEBOARD_BUFFER_sym); - bufferType_wxPASTEBOARD_BUFFER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pasteboard")); -} - -static int unbundle_symset_bufferType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bufferType_wxPASTEBOARD_BUFFER_sym) WITH_VAR_STACK(init_symset_bufferType()); - if (0) { } - else if (v == bufferType_wxEDIT_BUFFER_sym) { READY_TO_RETURN; return wxEDIT_BUFFER; } - else if (v == bufferType_wxPASTEBOARD_BUFFER_sym) { READY_TO_RETURN; return wxPASTEBOARD_BUFFER; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bufferType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bufferType(int v) { - if (!bufferType_wxPASTEBOARD_BUFFER_sym) init_symset_bufferType(); - switch (v) { - case wxEDIT_BUFFER: return bufferType_wxEDIT_BUFFER_sym; - case wxPASTEBOARD_BUFFER: return bufferType_wxPASTEBOARD_BUFFER_sym; - default: return NULL; - } -} - - -static Scheme_Object *fileType_wxMEDIA_FF_GUESS_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_STD_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_TEXT_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_SAME_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_COPY_sym = NULL; - -static void init_symset_fileType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(fileType_wxMEDIA_FF_GUESS_sym); - fileType_wxMEDIA_FF_GUESS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("guess")); - wxREGGLOB(fileType_wxMEDIA_FF_STD_sym); - fileType_wxMEDIA_FF_STD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("standard")); - wxREGGLOB(fileType_wxMEDIA_FF_TEXT_sym); - fileType_wxMEDIA_FF_TEXT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text")); - wxREGGLOB(fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym); - fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text-force-cr")); - wxREGGLOB(fileType_wxMEDIA_FF_SAME_sym); - fileType_wxMEDIA_FF_SAME_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("same")); - wxREGGLOB(fileType_wxMEDIA_FF_COPY_sym); - fileType_wxMEDIA_FF_COPY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("copy")); -} - -static int unbundle_symset_fileType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!fileType_wxMEDIA_FF_COPY_sym) WITH_VAR_STACK(init_symset_fileType()); - if (0) { } - else if (v == fileType_wxMEDIA_FF_GUESS_sym) { READY_TO_RETURN; return wxMEDIA_FF_GUESS; } - else if (v == fileType_wxMEDIA_FF_STD_sym) { READY_TO_RETURN; return wxMEDIA_FF_STD; } - else if (v == fileType_wxMEDIA_FF_TEXT_sym) { READY_TO_RETURN; return wxMEDIA_FF_TEXT; } - else if (v == fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym) { READY_TO_RETURN; return wxMEDIA_FF_TEXT_FORCE_CR; } - else if (v == fileType_wxMEDIA_FF_SAME_sym) { READY_TO_RETURN; return wxMEDIA_FF_SAME; } - else if (v == fileType_wxMEDIA_FF_COPY_sym) { READY_TO_RETURN; return wxMEDIA_FF_COPY; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "fileType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_fileType(int v) { - if (!fileType_wxMEDIA_FF_COPY_sym) init_symset_fileType(); - switch (v) { - case wxMEDIA_FF_GUESS: return fileType_wxMEDIA_FF_GUESS_sym; - case wxMEDIA_FF_STD: return fileType_wxMEDIA_FF_STD_sym; - case wxMEDIA_FF_TEXT: return fileType_wxMEDIA_FF_TEXT_sym; - case wxMEDIA_FF_TEXT_FORCE_CR: return fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym; - case wxMEDIA_FF_SAME: return fileType_wxMEDIA_FF_SAME_sym; - case wxMEDIA_FF_COPY: return fileType_wxMEDIA_FF_COPY_sym; - default: return NULL; - } -} - - - -static Scheme_Object *focus_wxFOCUS_IMMEDIATE_sym = NULL; -static Scheme_Object *focus_wxFOCUS_DISPLAY_sym = NULL; -static Scheme_Object *focus_wxFOCUS_GLOBAL_sym = NULL; - -static void init_symset_focus(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(focus_wxFOCUS_IMMEDIATE_sym); - focus_wxFOCUS_IMMEDIATE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("immediate")); - wxREGGLOB(focus_wxFOCUS_DISPLAY_sym); - focus_wxFOCUS_DISPLAY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("display")); - wxREGGLOB(focus_wxFOCUS_GLOBAL_sym); - focus_wxFOCUS_GLOBAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("global")); -} - -static int unbundle_symset_focus(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!focus_wxFOCUS_GLOBAL_sym) WITH_VAR_STACK(init_symset_focus()); - if (0) { } - else if (v == focus_wxFOCUS_IMMEDIATE_sym) { READY_TO_RETURN; return wxFOCUS_IMMEDIATE; } - else if (v == focus_wxFOCUS_DISPLAY_sym) { READY_TO_RETURN; return wxFOCUS_DISPLAY; } - else if (v == focus_wxFOCUS_GLOBAL_sym) { READY_TO_RETURN; return wxFOCUS_GLOBAL; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "focus symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_focus(int v) { - if (!focus_wxFOCUS_GLOBAL_sym) init_symset_focus(); - switch (v) { - case wxFOCUS_IMMEDIATE: return focus_wxFOCUS_IMMEDIATE_sym; - case wxFOCUS_DISPLAY: return focus_wxFOCUS_DISPLAY_sym; - case wxFOCUS_GLOBAL: return focus_wxFOCUS_GLOBAL_sym; - default: return NULL; - } -} - - -# define Sym_END 1 -# define Sym_START -1 -# define Sym_NONE 0 -static Scheme_Object *bias_Sym_START_sym = NULL; -static Scheme_Object *bias_Sym_NONE_sym = NULL; -static Scheme_Object *bias_Sym_END_sym = NULL; - -static void init_symset_bias(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bias_Sym_START_sym); - bias_Sym_START_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("start")); - wxREGGLOB(bias_Sym_NONE_sym); - bias_Sym_NONE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("none")); - wxREGGLOB(bias_Sym_END_sym); - bias_Sym_END_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("end")); -} - -static int unbundle_symset_bias(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bias_Sym_END_sym) WITH_VAR_STACK(init_symset_bias()); - if (0) { } - else if (v == bias_Sym_START_sym) { READY_TO_RETURN; return Sym_START; } - else if (v == bias_Sym_NONE_sym) { READY_TO_RETURN; return Sym_NONE; } - else if (v == bias_Sym_END_sym) { READY_TO_RETURN; return Sym_END; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bias symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bias(int v) { - if (!bias_Sym_END_sym) init_symset_bias(); - switch (v) { - case Sym_START: return bias_Sym_START_sym; - case Sym_NONE: return bias_Sym_NONE_sym; - case Sym_END: return bias_Sym_END_sym; - default: return NULL; - } -} - - - -static Scheme_Object *caret_wxSNIP_DRAW_NO_CARET_sym = NULL; -static Scheme_Object *caret_wxSNIP_DRAW_SHOW_CARET_sym = NULL; -static Scheme_Object *caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym = NULL; - -static void init_symset_caret(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(caret_wxSNIP_DRAW_NO_CARET_sym); - caret_wxSNIP_DRAW_NO_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("no-caret")); - wxREGGLOB(caret_wxSNIP_DRAW_SHOW_CARET_sym); - caret_wxSNIP_DRAW_SHOW_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("show-caret")); - wxREGGLOB(caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym); - caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("show-inactive-caret")); -} - -static int unbundle_symset_caret(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) WITH_VAR_STACK(init_symset_caret()); - if (0) { } - else if (v == caret_wxSNIP_DRAW_NO_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_NO_CARET; } - else if (v == caret_wxSNIP_DRAW_SHOW_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_SHOW_CARET; } - else if (v == caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_SHOW_INACTIVE_CARET; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "caret symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_caret(int v) { - if (!caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) init_symset_caret(); - switch (v) { - case wxSNIP_DRAW_NO_CARET: return caret_wxSNIP_DRAW_NO_CARET_sym; - case wxSNIP_DRAW_SHOW_CARET: return caret_wxSNIP_DRAW_SHOW_CARET_sym; - case wxSNIP_DRAW_SHOW_INACTIVE_CARET: return caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym; - default: return NULL; - } -} - - - - -#ifndef wx_mac -# define wxBITMAP_TYPE_PICT 101 -#endif - -#define wxBITMAP_TYPE_UNKNOWN 0 -#define wxBITMAP_TYPE_GIF_MASK (wxBITMAP_TYPE_GIF | wxBITMAP_TYPE_MASK) -#define wxBITMAP_TYPE_PNG_MASK (wxBITMAP_TYPE_PNG | wxBITMAP_TYPE_MASK) - -static Scheme_Object *bitmapType_wxBITMAP_TYPE_BMP_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_XBM_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_XPM_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PICT_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_JPEG_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_MASK_sym = NULL; - -static void init_symset_bitmapType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_BMP_sym); - bitmapType_wxBITMAP_TYPE_BMP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bmp")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_sym); - bitmapType_wxBITMAP_TYPE_GIF_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_MASK_sym); - bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif/mask")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_XBM_sym); - bitmapType_wxBITMAP_TYPE_XBM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xbm")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_XPM_sym); - bitmapType_wxBITMAP_TYPE_XPM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xpm")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PICT_sym); - bitmapType_wxBITMAP_TYPE_PICT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pict")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_JPEG_sym); - bitmapType_wxBITMAP_TYPE_JPEG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("jpeg")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_sym); - bitmapType_wxBITMAP_TYPE_PNG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_MASK_sym); - bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png/mask")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_UNKNOWN_sym); - bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_MASK_sym); - bitmapType_wxBITMAP_TYPE_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown/mask")); -} - -static int unbundle_symset_bitmapType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bitmapType_wxBITMAP_TYPE_MASK_sym) WITH_VAR_STACK(init_symset_bitmapType()); - if (0) { } - else if (v == bitmapType_wxBITMAP_TYPE_BMP_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_BMP; } - else if (v == bitmapType_wxBITMAP_TYPE_GIF_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF; } - else if (v == bitmapType_wxBITMAP_TYPE_GIF_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF_MASK; } - else if (v == bitmapType_wxBITMAP_TYPE_XBM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XBM; } - else if (v == bitmapType_wxBITMAP_TYPE_XPM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XPM; } - else if (v == bitmapType_wxBITMAP_TYPE_PICT_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PICT; } - else if (v == bitmapType_wxBITMAP_TYPE_JPEG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_JPEG; } - else if (v == bitmapType_wxBITMAP_TYPE_PNG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG; } - else if (v == bitmapType_wxBITMAP_TYPE_PNG_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG_MASK; } - else if (v == bitmapType_wxBITMAP_TYPE_UNKNOWN_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_UNKNOWN; } - else if (v == bitmapType_wxBITMAP_TYPE_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_MASK; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bitmapType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bitmapType(int v) { - if (!bitmapType_wxBITMAP_TYPE_MASK_sym) init_symset_bitmapType(); - switch (v) { - case wxBITMAP_TYPE_BMP: return bitmapType_wxBITMAP_TYPE_BMP_sym; - case wxBITMAP_TYPE_GIF: return bitmapType_wxBITMAP_TYPE_GIF_sym; - case wxBITMAP_TYPE_GIF_MASK: return bitmapType_wxBITMAP_TYPE_GIF_MASK_sym; - case wxBITMAP_TYPE_XBM: return bitmapType_wxBITMAP_TYPE_XBM_sym; - case wxBITMAP_TYPE_XPM: return bitmapType_wxBITMAP_TYPE_XPM_sym; - case wxBITMAP_TYPE_PICT: return bitmapType_wxBITMAP_TYPE_PICT_sym; - case wxBITMAP_TYPE_JPEG: return bitmapType_wxBITMAP_TYPE_JPEG_sym; - case wxBITMAP_TYPE_PNG: return bitmapType_wxBITMAP_TYPE_PNG_sym; - case wxBITMAP_TYPE_PNG_MASK: return bitmapType_wxBITMAP_TYPE_PNG_MASK_sym; - case wxBITMAP_TYPE_UNKNOWN: return bitmapType_wxBITMAP_TYPE_UNKNOWN_sym; - case wxBITMAP_TYPE_MASK: return bitmapType_wxBITMAP_TYPE_MASK_sym; - default: return NULL; - } -} - - - -# define Sym_END_ONLY 2 -# define Sym_START_ONLY -2 -static Scheme_Object *Bias_Sym_START_ONLY_sym = NULL; -static Scheme_Object *Bias_Sym_START_sym = NULL; -static Scheme_Object *Bias_Sym_NONE_sym = NULL; -static Scheme_Object *Bias_Sym_END_sym = NULL; -static Scheme_Object *Bias_Sym_END_ONLY_sym = NULL; - -static void init_symset_Bias(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(Bias_Sym_START_ONLY_sym); - Bias_Sym_START_ONLY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("start-only")); - wxREGGLOB(Bias_Sym_START_sym); - Bias_Sym_START_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("start")); - wxREGGLOB(Bias_Sym_NONE_sym); - Bias_Sym_NONE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("none")); - wxREGGLOB(Bias_Sym_END_sym); - Bias_Sym_END_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("end")); - wxREGGLOB(Bias_Sym_END_ONLY_sym); - Bias_Sym_END_ONLY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("end-only")); -} - -static int unbundle_symset_Bias(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!Bias_Sym_END_ONLY_sym) WITH_VAR_STACK(init_symset_Bias()); - if (0) { } - else if (v == Bias_Sym_START_ONLY_sym) { READY_TO_RETURN; return Sym_START_ONLY; } - else if (v == Bias_Sym_START_sym) { READY_TO_RETURN; return Sym_START; } - else if (v == Bias_Sym_NONE_sym) { READY_TO_RETURN; return Sym_NONE; } - else if (v == Bias_Sym_END_sym) { READY_TO_RETURN; return Sym_END; } - else if (v == Bias_Sym_END_ONLY_sym) { READY_TO_RETURN; return Sym_END_ONLY; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "Bias symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - - - - - - -/* - X = Not meant for virtual, defined in wxMediaEdit/wxMediaPasteboard - and overloaded there - Y = Virtual, defined in wxMediaEdit/wxMediaPasteboard - Z = Virtual, defined in wxMediaBuffer -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#undef l_ADDRESS -#undef l_DEREF -#undef l_TEST -#undef l_POINT -#undef l_TYPE -#undef l_LIST_ITEM_BUNDLE -#undef l_LIST_ITEM_UNBUNDLE -#undef l_MAKE_LIST -#undef l_MAKE_ARRAY -#undef l_EXTRA -#undef l_TERMINATE -#undef l_COPY -#undef l_OKTEST -#undef l_INTTYPE - -#define l_ADDRESS -#define l_DEREF -#define l_NEWATOMIC (UseGC) -#define l_NULLOK 0 -#define l_TEST -#define l_POINT -#define l_EXTRA 0 -#define l_TERMINATE -#define l_COPY l_COPYDEST=l_COPYSRC; -#define l_OKTEST -#define l_INTTYPE int -#define l_DIRECTMALLOC 0 - -#define l_TYPE long -#define l_LIST_ITEM_BUNDLE objscheme_bundle_long -#define l_LIST_ITEM_UNBUNDLE objscheme_unbundle_long -#define l_MAKE_LIST __MakelongList -#define l_MAKE_ARRAY __MakelongArray - - - - - -static Scheme_Object *l_MAKE_LIST(l_TYPE l_POINT *f, l_INTTYPE c) -{ - Scheme_Object *cdr = scheme_null, *obj = NULL; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cdr); - - while (c--) { - obj = WITH_VAR_STACK(l_LIST_ITEM_BUNDLE(l_ADDRESS f[c])); - cdr = WITH_VAR_STACK(scheme_make_pair(obj, cdr)); - } - - READY_TO_RETURN; - - return cdr; -} - -static l_TYPE l_POINT *l_MAKE_ARRAY(Scheme_Object *l, l_INTTYPE *c, char *who) -{ - Scheme_Object *orig_l = l; - int i = 0; - long len; - l_TYPE l_POINT *f = NULL; - - SETUP_VAR_STACK(3); - VAR_STACK_PUSH(0, l); - VAR_STACK_PUSH(1, orig_l); - VAR_STACK_PUSH(2, f); - - len = WITH_VAR_STACK(scheme_proper_list_length(l)); - if (len < 0) WITH_VAR_STACK(scheme_wrong_type(who, "proper-list", -1, 0, &l)); - if (c) *c = len; - - if (!(len + l_EXTRA)) { - READY_TO_RETURN; - return NULL; - } - -#if l_DIRECTMALLOC - f = (l_TYPE l_POINT *)WITH_VAR_STACK(GC_malloc_atomic(sizeof(l_TYPE l_POINT) * (len + l_EXTRA))); -#else - f = WITH_VAR_STACK(new l_NEWATOMIC l_TYPE l_POINT[len + l_EXTRA]); -#endif - - while (!SCHEME_NULLP(l)) { - if (!SCHEME_LISTP(l)) { - WITH_VAR_STACK(scheme_arg_mismatch(who, "expected a proper list: ", orig_l)); - READY_TO_RETURN; - return NULL; - } - -#define l_COPYDEST f[i] -#define l_COPYSRC (l_DEREF WITH_VAR_STACK(l_LIST_ITEM_UNBUNDLE(SCHEME_CAR(l), who l_TEST))) - - l_COPY - - l_OKTEST - - i++; - - l = SCHEME_CDR(l); - } - l_TERMINATE - - READY_TO_RETURN; - - return f; -} - - - - - - - - - - - - - - - - - - - - - -static void WordbreakCallbackToScheme(wxMediaEdit *,long*,long*,int,Scheme_Object *); - - - - - -static void WordbreakCallbackToScheme(wxMediaEdit *media, - long *start, long *end, - int reason, - Scheme_Object *f) -{ - Scheme_Object *p[4], *s = NULL, *e = NULL; - SETUP_VAR_STACK(8); - VAR_STACK_PUSH_ARRAY(0, p, 4); - VAR_STACK_PUSH(3, s); - VAR_STACK_PUSH(4, e); - VAR_STACK_PUSH(5, start); - VAR_STACK_PUSH(6, end); - VAR_STACK_PUSH(7, f); - - p[0] = p[1] = p[2] = p[3] = NULL; - - p[0] = WITH_VAR_STACK(objscheme_bundle_wxMediaEdit(media)); - if (start) - s = WITH_VAR_STACK(scheme_box(WITH_VAR_STACK(objscheme_bundle_integer(*start)))); - else - s = XC_SCHEME_NULL; - if (end) - e = WITH_VAR_STACK(scheme_box(WITH_VAR_STACK(objscheme_bundle_integer(*end)))); - else - e = XC_SCHEME_NULL; - p[1] = s; - p[2] = e; - p[3] = WITH_VAR_STACK(bundle_symset_breakType(reason)); - - WITH_VAR_STACK(scheme_apply_multi(f, 4, p)); - if (start) - *start = WITH_VAR_STACK(objscheme_unbundle_integer(WITH_VAR_STACK(scheme_unbox(s)), "Scheme wordbreak callback")); - if (end) - *end = WITH_VAR_STACK(objscheme_unbundle_integer(WITH_VAR_STACK(scheme_unbox(e)), "Scheme wordbreak callback")); - - READY_TO_RETURN; -} - -static void ClickbackToScheme(wxMediaEdit *media, - long start, long end, - Scheme_Object *f) -{ - Scheme_Object *p[3]; - SETUP_VAR_STACK(4); - VAR_STACK_PUSH_ARRAY(0, p, 3); - VAR_STACK_PUSH(3, f); - - p[0] = p[1] = p[2] = NULL; - - p[0] = WITH_VAR_STACK(objscheme_bundle_wxMediaEdit(media)); - p[1] = WITH_VAR_STACK(objscheme_bundle_integer(start)); - p[2] = WITH_VAR_STACK(objscheme_bundle_integer(end)); - - WITH_VAR_STACK(scheme_apply_multi(f, 3, p)); - - READY_TO_RETURN; -} - -class os_wxMediaEdit : public wxMediaEdit { - public: - Scheme_Object *scroll_closure; - - os_wxMediaEdit CONSTRUCTOR_ARGS((nndouble x0 = 1.0, double* x1 = NULL, int x2 = 0)); - ~os_wxMediaEdit(); - void OnReflow(); - class wxTabSnip* OnNewTabSnip(); - class wxTextSnip* OnNewTextSnip(); - void SetRegionData(nnlong x0, nnlong x1, class wxBufferData* x2); - class wxBufferData* GetRegionData(nnlong x0, nnlong x1); - void OnMergeSnips(nnlong x0); - void OnSplitSnip(nnlong x0); - void AfterSetSizeConstraint(); - void OnSetSizeConstraint(); - Bool CanSetSizeConstraint(); - void AfterSetPosition(); - void AfterChangeStyle(nnlong x0, nnlong x1); - void OnChangeStyle(nnlong x0, nnlong x1); - Bool CanChangeStyle(nnlong x0, nnlong x1); - void AfterDelete(nnlong x0, nnlong x1); - void OnDelete(nnlong x0, nnlong x1); - Bool CanDelete(nnlong x0, nnlong x1); - void AfterInsert(nnlong x0, nnlong x1); - void OnInsert(nnlong x0, nnlong x1); - Bool CanInsert(nnlong x0, nnlong x1); - void DoPasteSelection(nnlong x0, ExactLong x1); - void DoPaste(nnlong x0, ExactLong x1); - void DoCopy(nnlong x0, nnlong x1, ExactLong x2, Bool x3); - void SetAnchor(Bool x0); - string GetDefaultStyleName(); - npathname PutFile(nepathname x0, nepathname x1); - npathname GetFile(nepathname x0); - void AfterEditSequence(); - void OnEditSequence(); - void AfterLoadFile(Bool x0); - void OnLoadFile(epathname x0, int x1); - Bool CanLoadFile(epathname x0, int x1); - void AfterSaveFile(Bool x0); - void OnSaveFile(epathname x0, int x1); - Bool CanSaveFile(epathname x0, int x1); - class wxSnip* OnNewBox(int x0); - class wxImageSnip* OnNewImageSnip(nxpathname x0, int x1, Bool x2, Bool x3); - void SizeCacheInvalid(); - void InvalidateBitmapCache(double x0 = 0.0, double x1 = 0.0, double x2 = -1.0, double x3 = -1.0); - void OnPaint(Bool x0, class wxDC* x1, double x2, double x3, double x4, double x5, double x6, double x7, int x8); - Bool WriteFootersToFile(class wxMediaStreamOut* x0); - Bool WriteHeadersToFile(class wxMediaStreamOut* x0); - Bool ReadFooterFromFile(class wxMediaStreamIn* x0, string x1); - Bool ReadHeaderFromFile(class wxMediaStreamIn* x0, string x1); - void SetFilename(nxpathname x0, Bool x1 = FALSE); - Bool ReleaseSnip(class wxSnip* x0); - void OnSnipModified(class wxSnip* x0, Bool x1); - void SetModified(Bool x0); - Bool AdminScrollTo(double x0, double x1, nndouble x2, nndouble x3, Bool x4, int x5); - void SetSnipData(class wxSnip* x0, class wxBufferData* x1); - class wxBufferData* GetSnipData(class wxSnip* x0); - void NeedsUpdate(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4); - void Resized(class wxSnip* x0, Bool x1); - void SetCaretOwner(class wxSnip* x0, int x1 = wxFOCUS_IMMEDIATE); - Bool ScrollTo(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4, Bool x5, int x6 = 0); - void OnDisplaySizeWhenReady(); - void OnDisplaySize(); - void OnChange(); - void OnFocus(Bool x0); - void OnDefaultChar(class wxKeyEvent* x0); - void OnDefaultEvent(class wxMouseEvent* x0); - void OnLocalChar(class wxKeyEvent* x0); - void OnLocalEvent(class wxMouseEvent* x0); - double GetSpace(); - double GetDescent(); - void GetExtent(nndouble* x0, nndouble* x1); - void BlinkCaret(); - void OwnCaret(Bool x0); - void Refresh(double x0, double x1, nndouble x2, nndouble x3, int x4, class wxColour* x5); - class wxCursor* AdjustCursor(class wxMouseEvent* x0); - void OnChar(class wxKeyEvent* x0); - void OnEvent(class wxMouseEvent* x0); - void CopySelfTo(class wxMediaBuffer* x0); - class wxMediaBuffer* CopySelf(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaEdit::gcMark() { - wxMediaEdit::gcMark(); - gcMARK_TYPED(Scheme_Object *, scroll_closure); -} -void os_wxMediaEdit::gcFixup() { - wxMediaEdit::gcFixup(); - gcFIXUP_TYPED(Scheme_Object *, scroll_closure); -} -#endif - -static Scheme_Object *os_wxMediaEdit_class; - -os_wxMediaEdit::os_wxMediaEdit CONSTRUCTOR_ARGS((nndouble x0, double* x1, int x2)) -CONSTRUCTOR_INIT(: wxMediaEdit(x0, x1, x2)) -{ -} - -os_wxMediaEdit::~os_wxMediaEdit() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaEditOnReflow(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnReflow() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-reflow", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnReflow)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnReflow(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnNewTabSnip(int n, Scheme_Object *p[]); - -class wxTabSnip* os_wxMediaEdit::OnNewTabSnip() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-new-tab-snip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnNewTabSnip)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::OnNewTabSnip(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxTabSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxTabSnip(v, "on-new-tab-snip in text%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditOnNewTextSnip(int n, Scheme_Object *p[]); - -class wxTextSnip* os_wxMediaEdit::OnNewTextSnip() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-new-string-snip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnNewTextSnip)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::OnNewTextSnip(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxTextSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxTextSnip(v, "on-new-string-snip in text%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditSetRegionData(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::SetRegionData(nnlong x0, nnlong x1, class wxBufferData* x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "set-region-data", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditSetRegionData)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::SetRegionData(x0, x1, x2); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = WITH_VAR_STACK(objscheme_bundle_wxBufferData(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditGetRegionData(int n, Scheme_Object *p[]); - -class wxBufferData* os_wxMediaEdit::GetRegionData(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "get-region-data", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditGetRegionData)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::GetRegionData(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - class wxBufferData* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxBufferData(v, "get-region-data in text%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditOnMergeSnips(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnMergeSnips(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-merge-snips", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnMergeSnips)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnMergeSnips(x0); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnSplitSnip(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnSplitSnip(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-split-snip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnSplitSnip)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnSplitSnip(x0); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditAfterSetSizeConstraint(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::AfterSetSizeConstraint() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-set-size-constraint", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAfterSetSizeConstraint)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::AfterSetSizeConstraint(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnSetSizeConstraint(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnSetSizeConstraint() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-set-size-constraint", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnSetSizeConstraint)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnSetSizeConstraint(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditCanSetSizeConstraint(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::CanSetSizeConstraint() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "can-set-size-constraint?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditCanSetSizeConstraint)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::CanSetSizeConstraint(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-set-size-constraint? in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditAfterSetPosition(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::AfterSetPosition() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-set-position", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAfterSetPosition)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::AfterSetPosition(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditAfterChangeStyle(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::AfterChangeStyle(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-change-style", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAfterChangeStyle)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::AfterChangeStyle(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnChangeStyle(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnChangeStyle(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-change-style", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnChangeStyle)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnChangeStyle(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditCanChangeStyle(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::CanChangeStyle(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "can-change-style?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditCanChangeStyle)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::CanChangeStyle(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-change-style? in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditAfterDelete(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::AfterDelete(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-delete", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAfterDelete)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::AfterDelete(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnDelete(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnDelete(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-delete", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnDelete)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnDelete(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditCanDelete(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::CanDelete(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "can-delete?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditCanDelete)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::CanDelete(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-delete? in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditAfterInsert(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::AfterInsert(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-insert", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAfterInsert)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::AfterInsert(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnInsert(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnInsert(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-insert", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnInsert)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnInsert(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditCanInsert(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::CanInsert(nnlong x0, nnlong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "can-insert?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditCanInsert)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::CanInsert(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-insert? in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditDoPasteSelection(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::DoPasteSelection(nnlong x0, ExactLong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "do-paste-x-selection", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditDoPasteSelection)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::DoPasteSelection(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_integer_value(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditDoPaste(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::DoPaste(nnlong x0, ExactLong x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "do-paste", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditDoPaste)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::DoPaste(x0, x1); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_integer_value(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditDoCopy(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::DoCopy(nnlong x0, nnlong x1, ExactLong x2, Bool x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "do-copy", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditDoCopy)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::DoCopy(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_integer_value(x2)); - p[POFFSET+3] = (x3 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditSetAnchor(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::SetAnchor(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "set-anchor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditSetAnchor)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::SetAnchor(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditGetDefaultStyleName(int n, Scheme_Object *p[]); - -string os_wxMediaEdit::GetDefaultStyleName() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "default-style-name", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditGetDefaultStyleName)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::GetDefaultStyleName(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - string resval; - resval = (string)WITH_VAR_STACK(objscheme_unbundle_string(v, "default-style-name in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditPutFile(int n, Scheme_Object *p[]); - -npathname os_wxMediaEdit::PutFile(nepathname x0, nepathname x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "put-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditPutFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::PutFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - npathname resval; - resval = (npathname)WITH_VAR_STACK(objscheme_unbundle_nullable_pathname(v, "put-file in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditGetFile(int n, Scheme_Object *p[]); - -npathname os_wxMediaEdit::GetFile(nepathname x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "get-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditGetFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::GetFile(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - npathname resval; - resval = (npathname)WITH_VAR_STACK(objscheme_unbundle_nullable_pathname(v, "get-file in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditAfterEditSequence(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::AfterEditSequence() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-edit-sequence", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAfterEditSequence)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::AfterEditSequence(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnEditSequence(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnEditSequence() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-edit-sequence", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnEditSequence)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnEditSequence(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditAfterLoadFile(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::AfterLoadFile(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-load-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAfterLoadFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::AfterLoadFile(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnLoadFile(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnLoadFile(epathname x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-load-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnLoadFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnLoadFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_fileType(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditCanLoadFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::CanLoadFile(epathname x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "can-load-file?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditCanLoadFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::CanLoadFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_fileType(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-load-file? in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditAfterSaveFile(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::AfterSaveFile(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "after-save-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAfterSaveFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::AfterSaveFile(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnSaveFile(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnSaveFile(epathname x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-save-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnSaveFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnSaveFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_fileType(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditCanSaveFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::CanSaveFile(epathname x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "can-save-file?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditCanSaveFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::CanSaveFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_fileType(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-save-file? in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditOnNewBox(int n, Scheme_Object *p[]); - -class wxSnip* os_wxMediaEdit::OnNewBox(int x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-new-box", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnNewBox)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::OnNewBox(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_bufferType(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "on-new-box in text%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditOnNewImageSnip(int n, Scheme_Object *p[]); - -class wxImageSnip* os_wxMediaEdit::OnNewImageSnip(nxpathname x0, int x1, Bool x2, Bool x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-new-image-snip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnNewImageSnip)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::OnNewImageSnip(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_bitmapType(x1)); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - p[POFFSET+3] = (x3 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - class wxImageSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxImageSnip(v, "on-new-image-snip in text%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditSizeCacheInvalid(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::SizeCacheInvalid() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "size-cache-invalid", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditSizeCacheInvalid)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::SizeCacheInvalid(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditInvalidateBitmapCache(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::InvalidateBitmapCache(double x0, double x1, double x2, double x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "invalidate-bitmap-cache", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditInvalidateBitmapCache)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::InvalidateBitmapCache(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(objscheme_bundle_nonnegative_symbol_double(x2, "end")); - p[POFFSET+3] = WITH_VAR_STACK(objscheme_bundle_nonnegative_symbol_double(x3, "end")); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnPaint(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnPaint(Bool x0, class wxDC* x1, double x2, double x3, double x4, double x5, double x6, double x7, int x8) -{ - Scheme_Object *p[POFFSET+9] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+9); - VAR_STACK_PUSH(5, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-paint", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnPaint)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnPaint(x0, x1, x2, x3, x4, x5, x6, x7, x8); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxDC(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(scheme_make_double(x5)); - p[POFFSET+6] = WITH_VAR_STACK(scheme_make_double(x6)); - p[POFFSET+7] = WITH_VAR_STACK(scheme_make_double(x7)); - p[POFFSET+8] = WITH_VAR_STACK(bundle_symset_caret(x8)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+9, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditWriteFootersToFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::WriteFootersToFile(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "write-footers-to-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditWriteFootersToFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::WriteFootersToFile(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "write-footers-to-file in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditWriteHeadersToFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::WriteHeadersToFile(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "write-headers-to-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditWriteHeadersToFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::WriteHeadersToFile(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "write-headers-to-file in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditReadFooterFromFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::ReadFooterFromFile(class wxMediaStreamIn* x0, string x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "read-footer-from-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditReadFooterFromFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::ReadFooterFromFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamIn(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_string((char *)x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "read-footer-from-file in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditReadHeaderFromFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::ReadHeaderFromFile(class wxMediaStreamIn* x0, string x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "read-header-from-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditReadHeaderFromFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::ReadHeaderFromFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamIn(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_string((char *)x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "read-header-from-file in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditSetFilename(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::SetFilename(nxpathname x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "set-filename", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditSetFilename)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::SetFilename(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditReleaseSnip(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::ReleaseSnip(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "release-snip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditReleaseSnip)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::ReleaseSnip(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "release-snip in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditOnSnipModified(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnSnipModified(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-snip-modified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnSnipModified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnSnipModified(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditSetModified(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::SetModified(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "set-modified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditSetModified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::SetModified(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditAdminScrollTo(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::AdminScrollTo(double x0, double x1, nndouble x2, nndouble x3, Bool x4, int x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "scroll-editor-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAdminScrollTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::AdminScrollTo(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = (x4 ? scheme_true : scheme_false); - p[POFFSET+5] = WITH_VAR_STACK(bundle_symset_bias(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "scroll-editor-to in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditSetSnipData(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::SetSnipData(class wxSnip* x0, class wxBufferData* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "set-snip-data", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditSetSnipData)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::SetSnipData(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxBufferData(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditGetSnipData(int n, Scheme_Object *p[]); - -class wxBufferData* os_wxMediaEdit::GetSnipData(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "get-snip-data", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditGetSnipData)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::GetSnipData(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxBufferData* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxBufferData(v, "get-snip-data in text%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditNeedsUpdate(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::NeedsUpdate(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4) -{ - Scheme_Object *p[POFFSET+5] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+5); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "needs-update", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditNeedsUpdate)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::NeedsUpdate(x0, x1, x2, x3, x4); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+5, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditResized(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::Resized(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "resized", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditResized)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::Resized(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditSetCaretOwner(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::SetCaretOwner(class wxSnip* x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "set-caret-owner", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditSetCaretOwner)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::SetCaretOwner(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_focus(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditScrollTo(int n, Scheme_Object *p[]); - -Bool os_wxMediaEdit::ScrollTo(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4, Bool x5, int x6) -{ - Scheme_Object *p[POFFSET+7] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+7); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "scroll-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditScrollTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::ScrollTo(x0, x1, x2, x3, x4, x5, x6); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = (x5 ? scheme_true : scheme_false); - p[POFFSET+6] = WITH_VAR_STACK(bundle_symset_bias(x6)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+7, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "scroll-to in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditOnDisplaySizeWhenReady(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnDisplaySizeWhenReady() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-display-size-when-ready", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnDisplaySizeWhenReady)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnDisplaySizeWhenReady(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnDisplaySize(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnDisplaySize() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-display-size", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnDisplaySize)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnDisplaySize(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnChange(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnChange() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-change", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnChange)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnChange(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnFocus(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnFocus(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-focus", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnFocus)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnFocus(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnDefaultChar(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnDefaultChar(class wxKeyEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-default-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnDefaultChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnDefaultChar(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnDefaultEvent(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnDefaultEvent(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-default-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnDefaultEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnDefaultEvent(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnLocalChar(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnLocalChar(class wxKeyEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-local-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnLocalChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnLocalChar(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnLocalEvent(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnLocalEvent(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-local-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnLocalEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnLocalEvent(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditGetSpace(int n, Scheme_Object *p[]); - -double os_wxMediaEdit::GetSpace() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "get-space", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditGetSpace)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::GetSpace(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "get-space in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditGetDescent(int n, Scheme_Object *p[]); - -double os_wxMediaEdit::GetDescent() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "get-descent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditGetDescent)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::GetDescent(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "get-descent in text%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditGetExtent(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::GetExtent(nndouble* x0, nndouble* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "get-extent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditGetExtent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::GetExtent(x0, x1); - } else { - - p[POFFSET+0] = ((x0) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x0))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+1] = ((x1) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - if (x0) *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-extent in text%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in text%"", extracting return value via box"", extracting boxed argument"))); - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-extent in text%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in text%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditBlinkCaret(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::BlinkCaret() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "blink-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditBlinkCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::BlinkCaret(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOwnCaret(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OwnCaret(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "own-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOwnCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OwnCaret(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditRefresh(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::Refresh(double x0, double x1, nndouble x2, nndouble x3, int x4, class wxColour* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "refresh", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditRefresh)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::Refresh(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(bundle_symset_caret(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxColour(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditAdjustCursor(int n, Scheme_Object *p[]); - -class wxCursor* os_wxMediaEdit::AdjustCursor(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "adjust-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditAdjustCursor)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::AdjustCursor(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxCursor* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxCursor(v, "adjust-cursor in text%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditOnChar(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnChar(class wxKeyEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnChar(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditOnEvent(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::OnEvent(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditOnEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::OnEvent(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditCopySelfTo(int n, Scheme_Object *p[]); - -void os_wxMediaEdit::CopySelfTo(class wxMediaBuffer* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "copy-self-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditCopySelfTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaEdit::CopySelfTo(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaBuffer(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaEditCopySelf(int n, Scheme_Object *p[]); - -class wxMediaBuffer* os_wxMediaEdit::CopySelf() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaEdit *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaEdit_class, "copy-self", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaEditCopySelf)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaEdit::CopySelf(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxMediaBuffer* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(v, "copy-self in text%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaEditCallClickback(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "call-clickback in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "call-clickback in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "call-clickback in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CallClickback(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditRemoveClickback(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "remove-clickback in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "remove-clickback in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "remove-clickback in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->RemoveClickback(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetClickback(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-clickback in text%", n, p); - nnlong x0; - nnlong x1; - wxClickbackFunc x2; - void* x3 INIT_NULLED_OUT; - class wxStyleDelta* x4 INIT_NULLED_OUT; - Bool x5; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x3); - VAR_STACK_PUSH(2, x4); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-clickback in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "set-clickback in text%")); - x2 = (wxClickbackFunc)ClickbackToScheme; - x3 = p[POFFSET+2]; - if (n > (POFFSET+3)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+3], "set-clickback in text%", 1)); - } else - x4 = NULL; - if (n > (POFFSET+4)) { - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "set-clickback in text%")); - } else - x5 = FALSE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetClickback(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetWordbreakFunc(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-wordbreak-func in text%", n, p); - wxWordbreakFunc x0; - void* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - x0 = (wxWordbreakFunc)WordbreakCallbackToScheme; - x1 = p[POFFSET]; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetWordbreakFunc(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetAutowrapBitmap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBitmap* r; - objscheme_check_valid(os_wxMediaEdit_class, "set-autowrap-bitmap in text%", n, p); - class wxBitmap* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "set-autowrap-bitmap in text%", 1)); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetAutowrapBitmap(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r)); -} - -static Scheme_Object *os_wxMediaEditOnReflow(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-reflow in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnReflow()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnReflow()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnNewTabSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxTabSnip* r; - objscheme_check_valid(os_wxMediaEdit_class, "on-new-tab-snip in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnNewTabSnip()); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnNewTabSnip()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxTabSnip(r)); -} - -static Scheme_Object *os_wxMediaEditOnNewTextSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxTextSnip* r; - objscheme_check_valid(os_wxMediaEdit_class, "on-new-string-snip in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnNewTextSnip()); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnNewTextSnip()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxTextSnip(r)); -} - -static Scheme_Object *os_wxMediaEditCaretHidden(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "caret-hidden? in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CaretHidden()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditHideCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "hide-caret in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "hide-caret in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->HideCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetWordbreakMap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaWordbreakMap* r; - objscheme_check_valid(os_wxMediaEdit_class, "get-wordbreak-map in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetWordbreakMap()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaWordbreakMap(r)); -} - -static Scheme_Object *os_wxMediaEditSetWordbreakMap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-wordbreak-map in text%", n, p); - class wxMediaWordbreakMap* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaWordbreakMap(p[POFFSET+0], "set-wordbreak-map in text%", 1)); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetWordbreakMap(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditFindWordbreak(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "find-wordbreak in text%", n, p); - nnlong _x0; - nnlong* x0 = &_x0; - nnlong _x1; - nnlong* x1 = &_x1; - int x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "find-wordbreak in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "find-wordbreak in text%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "find-wordbreak in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "find-wordbreak in text%"", extracting boxed argument"))); - x2 = WITH_VAR_STACK(unbundle_symset_breakType(p[POFFSET+2], "find-wordbreak in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindWordbreak(x0, x1, x2)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetRegionData(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-region-data in text%", n, p); - nnlong x0; - nnlong x1; - class wxBufferData* x2 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x2); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-region-data in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "set-region-data in text%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_wxBufferData(p[POFFSET+2], "set-region-data in text%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::SetRegionData(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetRegionData(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetRegionData(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBufferData* r; - objscheme_check_valid(os_wxMediaEdit_class, "get-region-data in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-region-data in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-region-data in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::GetRegionData(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetRegionData(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferData(r)); -} - -static Scheme_Object *os_wxMediaEditGetRevisionNumber(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaEdit_class, "get-revision-number in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetRevisionNumber()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaEditOnMergeSnips(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-merge-snips in text%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "after-merge-snips in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnMergeSnips(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnMergeSnips(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnSplitSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-split-snip in text%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "after-split-snip in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnSplitSnip(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnSplitSnip(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditAfterSetSizeConstraint(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-set-size-constraint in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AfterSetSizeConstraint()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AfterSetSizeConstraint()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnSetSizeConstraint(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-set-size-constraint in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnSetSizeConstraint()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnSetSizeConstraint()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCanSetSizeConstraint(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "can-set-size-constraint? in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::CanSetSizeConstraint()); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CanSetSizeConstraint()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditAfterSetPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-set-position in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AfterSetPosition()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AfterSetPosition()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditAfterChangeStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-change-style in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "after-change-style in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "after-change-style in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AfterChangeStyle(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AfterChangeStyle(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnChangeStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-change-style in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "on-change-style in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "on-change-style in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnChangeStyle(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnChangeStyle(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCanChangeStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "can-change-style? in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "can-change-style? in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "can-change-style? in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::CanChangeStyle(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CanChangeStyle(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditAfterDelete(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-delete in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "after-delete in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "after-delete in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AfterDelete(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AfterDelete(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnDelete(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-delete in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "on-delete in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "on-delete in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnDelete(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnDelete(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCanDelete(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "can-delete? in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "can-delete? in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "can-delete? in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::CanDelete(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CanDelete(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditAfterInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-insert in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "after-insert in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "after-insert in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AfterInsert(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AfterInsert(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-insert in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "on-insert in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "on-insert in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnInsert(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnInsert(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCanInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "can-insert? in text%", n, p); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "can-insert? in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "can-insert? in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::CanInsert(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CanInsert(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditSetTabs(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-tabs in text%", n, p); - double* x0 INIT_NULLED_OUT; - int x1; - double x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = NULL; - if (n > (POFFSET+1)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set-tabs in text%")); - } else - x2 = wxTAB_WIDTH; - if (n > (POFFSET+2)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "set-tabs in text%")); - } else - x3 = TRUE; - - x0 = WITH_VAR_STACK(__MakedoubleArray((0+POFFSET < n) ? p[POFFSET+0] : scheme_null, &x1, METHODNAME("text%","set-tabs"))); - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetTabs(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetTabs(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaEdit_class, "get-tabs in text%", n, p); - nnint _x0; - nnint* x0 = &_x0; - double _x1; - double* x1 = &_x1; - Bool _x2; - Bool* x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n > (POFFSET+0)) { - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-tabs in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-tabs in text%"", extracting boxed argument"))); - } else - x0 = NULL; - if (n > (POFFSET+1)) { - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-tabs in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-tabs in text%"", extracting boxed argument"))); - } else - x1 = NULL; - if (n > (POFFSET+2)) { - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-tabs in text%")), WITH_VAR_STACK(objscheme_unbundle_bool(sbox_tmp, "get-tabs in text%"", extracting boxed argument"))); - } else - x2 = NULL; - - if (!x0) x0 = &_x0; - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetTabs(x0, x1, x2)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = (_x2 ? scheme_true : scheme_false); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return WITH_VAR_STACK(__MakedoubleList(r, *x0));; -} - -static Scheme_Object *os_wxMediaEditSetOverwriteMode(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-overwrite-mode in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-overwrite-mode in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetOverwriteMode(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetOverwriteMode(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "get-overwrite-mode in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetOverwriteMode()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditSetFileFormat(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-file-format in text%", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+0], "set-file-format in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetFileFormat(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetFileFormat(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxMediaEdit_class, "get-file-format in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetFileFormat()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_fileType(r)); -} - -static Scheme_Object *os_wxMediaEditWriteToFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "write-to-file in text%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_wxMediaStreamOut(p[POFFSET+0], NULL, 0)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+1], NULL))) { - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - nnlong x1; - long x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if ((n < (POFFSET+2)) || (n > (POFFSET+3))) - WITH_VAR_STACK(scheme_wrong_count_m("write-to-file in text% (with position case)", POFFSET+2, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write-to-file in text% (with position case)", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "write-to-file in text% (with position case)")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "eof", "write-to-file in text% (with position case)")); - } else - x2 = -1; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->WriteToFile(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else { - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("write-to-file in text% (without position case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write-to-file in text% (without position case)", 0)); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->WriteToFile(x0)); - - - - READY_TO_PRE_RETURN; - } - - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditReadFromFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "read-from-file in text%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_wxMediaStreamIn(p[POFFSET+0], NULL, 0)) && WITH_REMEMBERED_STACK(objscheme_istype_nonnegative_symbol_integer(p[POFFSET+1], "start", NULL))) { - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - long x1; - Bool x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if ((n < (POFFSET+2)) || (n > (POFFSET+3))) - WITH_VAR_STACK(scheme_wrong_count_m("read-from-file in text% (with position case)", POFFSET+2, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read-from-file in text% (with position case)", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+1], "start", "read-from-file in text% (with position case)")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "read-from-file in text% (with position case)")); - } else - x2 = FALSE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ReadFromFile(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else { - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if ((n < (POFFSET+1)) || (n > (POFFSET+2))) - WITH_VAR_STACK(scheme_wrong_count_m("read-from-file in text% (without position case)", POFFSET+1, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read-from-file in text% (without position case)", 0)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "read-from-file in text% (without position case)")); - } else - x1 = FALSE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ReadFromFile(x0, x1)); - - - - READY_TO_PRE_RETURN; - } - - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditGetCharacter(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzchar r; - objscheme_check_valid(os_wxMediaEdit_class, "get-character in text%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-character in text%")); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetCharacter(x0)); - - - - READY_TO_RETURN; - return scheme_make_char(r); -} - -static Scheme_Object *os_wxMediaEditGetText(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzstring r; - objscheme_check_valid(os_wxMediaEdit_class, "get-text in text%", n, p); - nnlong x0; - long x1; - Bool x2; - Bool x3; - long _x4; - long* x4 = &_x4; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-text in text%")); - } else - x0 = 0; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+1], "eof", "get-text in text%")); - } else - x1 = -1; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-text in text%")); - } else - x2 = FALSE; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "get-text in text%")); - } else - x3 = FALSE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetText(x0, x1, x2, x3, x4)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(scheme_make_sized_char_string(r, _x4, 0)); -} - -static Scheme_Object *os_wxMediaEditFindNextNonTextSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaEdit_class, "find-next-non-string-snip in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "find-next-non-string-snip in text%", 1)); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindNextNonTextSnip(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaEditGetSnipPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "get-snip-position in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "get-snip-position in text%", 0)); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetSnipPosition(x0)); - - - - READY_TO_RETURN; - return ((r < 0) ? scheme_false : scheme_make_integer(r)); -} - -static Scheme_Object *os_wxMediaEditGetSnipPositionAndLocation(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "get-snip-position-and-location in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - nnlong _x1; - nnlong* x1 = &_x1; - double _x2; - double* x2 = &_x2; - double _x3; - double* x3 = &_x3; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "get-snip-position-and-location in text%", 0)); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-snip-position-and-location in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-snip-position-and-location in text%"", extracting boxed argument"))); - if (n > (POFFSET+2)) { - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-snip-position-and-location in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-snip-position-and-location in text%"", extracting boxed argument"))); - } else - x2 = NULL; - if (n > (POFFSET+3)) { - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-snip-position-and-location in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-snip-position-and-location in text%"", extracting boxed argument"))); - } else - x3 = NULL; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetSnipPositionAndLocation(x0, x1, x2, x3)); - - - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditFindSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaEdit_class, "find-snip in text%", n, p); - nnlong x0; - int x1; - nnlong _x2; - nnlong* x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "find-snip in text%")); - x1 = WITH_VAR_STACK(unbundle_symset_findKind(p[POFFSET+1], "find-snip in text%")); - if (n > (POFFSET+2)) { - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "find-snip in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "find-snip in text%"", extracting boxed argument"))); - } else - x2 = NULL; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindSnip(x0, x1, x2)); - - - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = scheme_make_integer(_x2); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaEditFindStringAll(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long* r; - objscheme_check_valid(os_wxMediaEdit_class, "find-string-all in text%", n, p); - mzstring x0 INIT_NULLED_OUT; - long _x1; - long* x1 = &_x1; - int x2; - long x3; - long x4; - Bool x5; - Bool x6; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+0], "find-string-all in text%")); - if (n > (POFFSET+1)) { - x2 = WITH_VAR_STACK(unbundle_symset_direction(p[POFFSET+1], "find-string-all in text%")); - } else - x2 = 1; - if (n > (POFFSET+2)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "start", "find-string-all in text%")); - } else - x3 = -1; - if (n > (POFFSET+3)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+3], "eof", "find-string-all in text%")); - } else - x4 = -1; - if (n > (POFFSET+4)) { - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "find-string-all in text%")); - } else - x5 = TRUE; - if (n > (POFFSET+5)) { - x6 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "find-string-all in text%")); - } else - x6 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindStringAll(x0, x1, x2, x3, x4, x5, x6)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(__MakelongList(r, *x1));; -} - -static Scheme_Object *os_wxMediaEditFindString(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "find-string in text%", n, p); - mzstring x0 INIT_NULLED_OUT; - int x1; - long x2; - long x3; - Bool x4; - Bool x5; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+0], "find-string in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_direction(p[POFFSET+1], "find-string in text%")); - } else - x1 = 1; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "start", "find-string in text%")); - } else - x2 = -1; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+3], "eof", "find-string in text%")); - } else - x3 = -1; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "find-string in text%")); - } else - x4 = TRUE; - if (n > (POFFSET+5)) { - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "find-string in text%")); - } else - x5 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindString(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return ((r < 0) ? scheme_false : scheme_make_integer(r)); -} - -static Scheme_Object *os_wxMediaEditSetStickyStyles(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-styles-sticky in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-styles-sticky in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetStickyStyles(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetStickyStyles(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "get-styles-sticky in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetStickyStyles()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditSetLineSpacing(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-line-spacing in text%", n, p); - nndouble x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "set-line-spacing in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetLineSpacing(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetLineSpacing(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nndouble r; - objscheme_check_valid(os_wxMediaEdit_class, "get-line-spacing in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetLineSpacing()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaEditSetParagraghAlignment(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-paragraph-alignment in text%", n, p); - nnlong x0; - int x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-paragraph-alignment in text%")); - x1 = WITH_VAR_STACK(unbundle_symset_horizontalAlignment(p[POFFSET+1], "set-paragraph-alignment in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetParagraghAlignment(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetParagraghMargins(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-paragraph-margins in text%", n, p); - nnlong x0; - nndouble x1; - nndouble x2; - nndouble x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-paragraph-margins in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "set-paragraph-margins in text%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "set-paragraph-margins in text%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "set-paragraph-margins in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetParagraghMargins(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditLastParagraph(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "last-paragraph in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->LastParagraph()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditParagraphEndLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "paragraph-end-line in text%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "paragraph-end-line in text%")); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ParagraphEndLine(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditParagraphStartLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "paragraph-start-line in text%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "paragraph-start-line in text%")); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ParagraphStartLine(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditLineParagraph(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "line-paragraph in text%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "line-paragraph in text%")); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->LineParagraph(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditParagraphEndPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "paragraph-end-position in text%", n, p); - nnlong x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "paragraph-end-position in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "paragraph-end-position in text%")); - } else - x1 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ParagraphEndPosition(x0, x1)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditParagraphStartPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "paragraph-start-position in text%", n, p); - nnlong x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "paragraph-start-position in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "paragraph-start-position in text%")); - } else - x1 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ParagraphStartPosition(x0, x1)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditPositionParagraph(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "position-paragraph in text%", n, p); - nnlong x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "position-paragraph in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "position-paragraph in text%")); - } else - x1 = FALSE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->PositionParagraph(x0, x1)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditLastLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "last-line in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->LastLine()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditLastPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "last-position in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->LastPosition()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditLineLength(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "line-length in text%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "line-length in text%")); - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->LineLength(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditLineEndPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "line-end-position in text%", n, p); - nnlong x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "line-end-position in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "line-end-position in text%")); - } else - x1 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->LineEndPosition(x0, x1)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditLineStartPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "line-start-position in text%", n, p); - nnlong x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "line-start-position in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "line-start-position in text%")); - } else - x1 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->LineStartPosition(x0, x1)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditLineLocation(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaEdit_class, "line-location in text%", n, p); - nnlong x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "line-location in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "line-location in text%")); - } else - x1 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->LineLocation(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaEditPositionLocations(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "position-locations in text%", n, p); - nnlong x0; - double _x1; - double* x1 = &_x1; - double _x2; - double* x2 = &_x2; - double _x3; - double* x3 = &_x3; - double _x4; - double* x4 = &_x4; - Bool x5; - Bool x6; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "position-locations in text%")); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "position-locations in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "position-locations in text%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "position-locations in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "position-locations in text%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "position-locations in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "position-locations in text%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+4])) - x4 = NULL; - else - *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "position-locations in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "position-locations in text%"", extracting boxed argument"))); - if (n > (POFFSET+5)) { - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "position-locations in text%")); - } else - x5 = FALSE; - if (n > (POFFSET+6)) { - x6 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+6], "position-locations in text%")); - } else - x6 = FALSE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->PositionLocations(x0, x1, x2, x3, x4, x5, x6)); - - - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - if (n > (POFFSET+4) && !XC_SCHEME_NULLP(p[POFFSET+4])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x4)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+4], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditPositionLocation(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "position-location in text%", n, p); - nnlong x0; - double _x1; - double* x1 = &_x1; - double _x2; - double* x2 = &_x2; - Bool x3; - Bool x4; - Bool x5; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "position-location in text%")); - if (n > (POFFSET+1)) { - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "position-location in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "position-location in text%"", extracting boxed argument"))); - } else - x1 = NULL; - if (n > (POFFSET+2)) { - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "position-location in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "position-location in text%"", extracting boxed argument"))); - } else - x2 = NULL; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "position-location in text%")); - } else - x3 = TRUE; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "position-location in text%")); - } else - x4 = FALSE; - if (n > (POFFSET+5)) { - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "position-location in text%")); - } else - x5 = FALSE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->PositionLocation(x0, x1, x2, x3, x4, x5)); - - - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditPositionLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "position-line in text%", n, p); - nnlong x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "position-line in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "position-line in text%")); - } else - x1 = FALSE; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->PositionLine(x0, x1)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditSetBetweenThreshold(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-between-threshold in text%", n, p); - nndouble x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "set-between-threshold in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetBetweenThreshold(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetBetweenThreshold(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaEdit_class, "get-between-threshold in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetBetweenThreshold()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaEditFindPositionInLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "find-position-in-line in text%", n, p); - nnlong x0; - double x1; - Bool _x2; - Bool* x2 = &_x2; - Bool _x3; - Bool* x3 = &_x3; - double _x4; - double* x4 = &_x4; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "find-position-in-line in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "find-position-in-line in text%")); - if (n > (POFFSET+2)) { - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "find-position-in-line in text%")), WITH_VAR_STACK(objscheme_unbundle_bool(sbox_tmp, "find-position-in-line in text%"", extracting boxed argument"))); - } else - x2 = NULL; - if (n > (POFFSET+3)) { - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "find-position-in-line in text%")), WITH_VAR_STACK(objscheme_unbundle_bool(sbox_tmp, "find-position-in-line in text%"", extracting boxed argument"))); - } else - x3 = NULL; - if (n > (POFFSET+4)) { - if (XC_SCHEME_NULLP(p[POFFSET+4])) - x4 = NULL; - else - *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "find-position-in-line in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "find-position-in-line in text%"", extracting boxed argument"))); - } else - x4 = NULL; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindPositionInLine(x0, x1, x2, x3, x4)); - - - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = (_x2 ? scheme_true : scheme_false); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = (_x3 ? scheme_true : scheme_false); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - if (n > (POFFSET+4) && !XC_SCHEME_NULLP(p[POFFSET+4])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x4)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+4], sbv_)); } - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditFindLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "find-line in text%", n, p); - double x0; - Bool _x1; - Bool* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-line in text%")); - if (n > (POFFSET+1)) { - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "find-line in text%")), WITH_VAR_STACK(objscheme_unbundle_bool(sbox_tmp, "find-line in text%"", extracting boxed argument"))); - } else - x1 = NULL; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindLine(x0, x1)); - - - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = (_x1 ? scheme_true : scheme_false); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditFindPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "find-position in text%", n, p); - double x0; - double x1; - Bool _x2; - Bool* x2 = &_x2; - Bool _x3; - Bool* x3 = &_x3; - double _x4; - double* x4 = &_x4; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-position in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "find-position in text%")); - if (n > (POFFSET+2)) { - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "find-position in text%")), WITH_VAR_STACK(objscheme_unbundle_bool(sbox_tmp, "find-position in text%"", extracting boxed argument"))); - } else - x2 = NULL; - if (n > (POFFSET+3)) { - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "find-position in text%")), WITH_VAR_STACK(objscheme_unbundle_bool(sbox_tmp, "find-position in text%"", extracting boxed argument"))); - } else - x3 = NULL; - if (n > (POFFSET+4)) { - if (XC_SCHEME_NULLP(p[POFFSET+4])) - x4 = NULL; - else - *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "find-position in text%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "find-position in text%"", extracting boxed argument"))); - } else - x4 = NULL; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindPosition(x0, x1, x2, x3, x4)); - - - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = (_x2 ? scheme_true : scheme_false); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = (_x3 ? scheme_true : scheme_false); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - if (n > (POFFSET+4) && !XC_SCHEME_NULLP(p[POFFSET+4])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x4)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+4], sbv_)); } - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditSplitSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "split-snip in text%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "split-snip in text%")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SplitSnip(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditChangeStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "change-style in text%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_wxStyleDelta(p[POFFSET+0], NULL, 1)) && WITH_REMEMBERED_STACK(objscheme_istype_nonnegative_symbol_integer(p[POFFSET+1], "start", NULL))) { - class wxStyleDelta* x0 INIT_NULLED_OUT; - long x1; - long x2; - Bool x3; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if ((n < (POFFSET+2)) || (n > (POFFSET+4))) - WITH_VAR_STACK(scheme_wrong_count_m("change-style in text% (style-delta% and position case)", POFFSET+2, POFFSET+4, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "change-style in text% (style-delta% and position case)", 1)); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+1], "start", "change-style in text% (style-delta% and position case)")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "end", "change-style in text% (style-delta% and position case)")); - } else - x2 = -1; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "change-style in text% (style-delta% and position case)")); - } else - x3 = TRUE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ChangeStyle(x0, x1, x2, x3)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxStyleDelta(p[POFFSET+0], NULL, 1))) { - class wxStyleDelta* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("change-style in text% (style-delta% without position or snip% case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "change-style in text% (style-delta% without position or snip% case)", 1)); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ChangeStyle(x0)); - - - - READY_TO_PRE_RETURN; - } else { - class wxStyle* x0 INIT_NULLED_OUT; - long x1; - long x2; - Bool x3; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if ((n < (POFFSET+1)) || (n > (POFFSET+4))) - WITH_VAR_STACK(scheme_wrong_count_m("change-style in text% (style% case)", POFFSET+1, POFFSET+4, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "change-style in text% (style% case)", 1)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+1], "start", "change-style in text% (style% case)")); - } else - x1 = -1; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "end", "change-style in text% (style% case)")); - } else - x2 = -1; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "change-style in text% (style% case)")); - } else - x3 = TRUE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ChangeStyle(x0, x1, x2, x3)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditDoPasteSelection(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "do-paste-x-selection in text%", n, p); - nnlong x0; - ExactLong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "do-paste-x-selection in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "do-paste-x-selection in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::DoPasteSelection(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->DoPasteSelection(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditDoPaste(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "do-paste in text%", n, p); - nnlong x0; - ExactLong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "do-paste in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "do-paste in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::DoPaste(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->DoPaste(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditDoCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "do-copy in text%", n, p); - nnlong x0; - nnlong x1; - ExactLong x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "do-copy in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "do-copy in text%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+2], "do-copy in text%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "do-copy in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::DoCopy(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->DoCopy(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditKill(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "kill in text%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_ExactLong(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+1], NULL))) { - ExactLong x0; - nnlong x1; - nnlong x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n != (POFFSET+3)) - WITH_VAR_STACK(scheme_wrong_count_m("kill in text% (position case)", POFFSET+3, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "kill in text% (position case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "kill in text% (position case)")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "kill in text% (position case)")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Kill(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else { - ExactLong x0; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n > (POFFSET+1))) - WITH_VAR_STACK(scheme_wrong_count_m("kill in text% (without position case)", POFFSET+POFFSET, POFFSET+1, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "kill in text% (without position case)")); - } else - x0 = 0; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Kill(x0)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditPasteNext(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "paste-next in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->PasteNext()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditPasteSelection(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "paste-x-selection in text%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_ExactLong(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_nonnegative_symbol_integer(p[POFFSET+1], "end", NULL))) { - ExactLong x0; - long x1; - long x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n < (POFFSET+2)) || (n > (POFFSET+3))) - WITH_VAR_STACK(scheme_wrong_count_m("paste-x-selection in text% (position case)", POFFSET+2, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "paste-x-selection in text% (position case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+1], "end", "paste-x-selection in text% (position case)")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "same", "paste-x-selection in text% (position case)")); - } else - x2 = -1; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->PasteSelection(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else { - ExactLong x0; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n > (POFFSET+1))) - WITH_VAR_STACK(scheme_wrong_count_m("paste-x-selection in text% (without position case)", POFFSET+POFFSET, POFFSET+1, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "paste-x-selection in text% (without position case)")); - } else - x0 = 0; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->PasteSelection(x0)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditPaste(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "paste in text%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_ExactLong(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_nonnegative_symbol_integer(p[POFFSET+1], "end", NULL))) { - ExactLong x0; - long x1; - long x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n < (POFFSET+2)) || (n > (POFFSET+3))) - WITH_VAR_STACK(scheme_wrong_count_m("paste in text% (position case)", POFFSET+2, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "paste in text% (position case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+1], "end", "paste in text% (position case)")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "same", "paste in text% (position case)")); - } else - x2 = -1; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Paste(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else { - ExactLong x0; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n > (POFFSET+1))) - WITH_VAR_STACK(scheme_wrong_count_m("paste in text% (without position case)", POFFSET+POFFSET, POFFSET+1, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "paste in text% (without position case)")); - } else - x0 = 0; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Paste(x0)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "copy in text%", n, p); - if ((n >= (POFFSET+3)) && WITH_REMEMBERED_STACK(objscheme_istype_bool(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_ExactLong(p[POFFSET+1], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_nonnegative_symbol_integer(p[POFFSET+2], "start", NULL))) { - Bool x0; - ExactLong x1; - long x2; - long x3; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n < (POFFSET+3)) || (n > (POFFSET+4))) - WITH_VAR_STACK(scheme_wrong_count_m("copy in text% (position case)", POFFSET+3, POFFSET+4, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "copy in text% (position case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "copy in text% (position case)")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "start", "copy in text% (position case)")); - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+3], "end", "copy in text% (position case)")); - } else - x3 = -1; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Copy(x0, x1, x2, x3)); - - - - READY_TO_PRE_RETURN; - } else { - Bool x0; - ExactLong x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n > (POFFSET+2))) - WITH_VAR_STACK(scheme_wrong_count_m("copy in text% (without position case)", POFFSET+POFFSET, POFFSET+2, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "copy in text% (without position case)")); - } else - x0 = FALSE; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "copy in text% (without position case)")); - } else - x1 = 0; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Copy(x0, x1)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCut(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "cut in text%", n, p); - if ((n >= (POFFSET+3)) && WITH_REMEMBERED_STACK(objscheme_istype_bool(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_ExactLong(p[POFFSET+1], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_nonnegative_symbol_integer(p[POFFSET+2], "start", NULL))) { - Bool x0; - ExactLong x1; - long x2; - long x3; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n < (POFFSET+3)) || (n > (POFFSET+4))) - WITH_VAR_STACK(scheme_wrong_count_m("cut in text% (position case)", POFFSET+3, POFFSET+4, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "cut in text% (position case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "cut in text% (position case)")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "start", "cut in text% (position case)")); - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+3], "end", "cut in text% (position case)")); - } else - x3 = -1; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Cut(x0, x1, x2, x3)); - - - - READY_TO_PRE_RETURN; - } else { - Bool x0; - ExactLong x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n > (POFFSET+2))) - WITH_VAR_STACK(scheme_wrong_count_m("cut in text% (without position case)", POFFSET+POFFSET, POFFSET+2, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "cut in text% (without position case)")); - } else - x0 = FALSE; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "cut in text% (without position case)")); - } else - x1 = 0; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Cut(x0, x1)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditErase(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "erase in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Erase()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditDelete(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "delete in text%", n, p); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_nonnegative_symbol_integer(p[POFFSET+0], "start", NULL))) { - long x0; - long x1; - Bool x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n < (POFFSET+1)) || (n > (POFFSET+3))) - WITH_VAR_STACK(scheme_wrong_count_m("delete in text% (position case)", POFFSET+1, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+0], "start", "delete in text% (position case)")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+1], "back", "delete in text% (position case)")); - } else - x1 = -1; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "delete in text% (position case)")); - } else - x2 = TRUE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Delete(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else { - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("delete in text% (no position case)", POFFSET+0, POFFSET+0, n, p, 1)); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Delete()); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "insert in text%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_mzstring(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+1], NULL))) { - long x0; - mzstring x1 INIT_NULLED_OUT; - nnlong x2; - long x3; - Bool x4; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - if ((n < (POFFSET+2)) || (n > (POFFSET+4))) - WITH_VAR_STACK(scheme_wrong_count_m("insert in text% (string and position case)", POFFSET+2, POFFSET+4, n, p, 1)); - x1 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+0], "insert in text% (string and position case)")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "insert in text% (string and position case)")); - if (n > (POFFSET+2)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "same", "insert in text% (string and position case)")); - } else - x3 = -1; - if (n > (POFFSET+3)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "insert in text% (string and position case)")); - } else - x4 = TRUE; - - x0 = SCHEME_CHAR_STRTAG_VAL(p[POFFSET+0]); - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1, x2, x3, x4)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_mzstring(p[POFFSET+0], NULL))) { - long x0; - mzstring x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("insert in text% (string without position case)", POFFSET+1, POFFSET+1, n, p, 1)); - x1 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+0], "insert in text% (string without position case)")); - - x0 = SCHEME_CHAR_STRTAG_VAL(p[POFFSET+0]); - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+3)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_mzstring(p[POFFSET+1], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+2], NULL))) { - nnlong x0; - mzstring x1 INIT_NULLED_OUT; - nnlong x2; - long x3; - Bool x4; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - if ((n < (POFFSET+3)) || (n > (POFFSET+5))) - WITH_VAR_STACK(scheme_wrong_count_m("insert in text% (length and string without position case)", POFFSET+3, POFFSET+5, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "insert in text% (length and string without position case)")); - x1 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+1], "insert in text% (length and string without position case)")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "insert in text% (length and string without position case)")); - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+3], "same", "insert in text% (length and string without position case)")); - } else - x3 = -1; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "insert in text% (length and string without position case)")); - } else - x4 = TRUE; - - if ((x0 < 0) || (x0 > SCHEME_CHAR_STRTAG_VAL(p[POFFSET+1]))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("text%","insert"), "bad string length: ", p[POFFSET+0])); - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1, x2, x3, x4)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+0], NULL))) { - nnlong x0; - mzstring x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("insert in text% (length, string, and position case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "insert in text% (length, string, and position case)")); - x1 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+1], "insert in text% (length, string, and position case)")); - - if ((x0 < 0) || (x0 > SCHEME_CHAR_STRTAG_VAL(p[POFFSET+1]))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("text%","insert"), "bad string length: ", p[POFFSET+0])); - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+0], NULL, 0)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+1], NULL))) { - class wxSnip* x0 INIT_NULLED_OUT; - nnlong x1; - long x2; - Bool x3; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if ((n < (POFFSET+2)) || (n > (POFFSET+4))) - WITH_VAR_STACK(scheme_wrong_count_m("insert in text% (snip% and position case)", POFFSET+2, POFFSET+4, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "insert in text% (snip% and position case)", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "insert in text% (snip% and position case)")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "same", "insert in text% (snip% and position case)")); - } else - x2 = -1; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "insert in text% (snip% and position case)")); - } else - x3 = TRUE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1, x2, x3)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+0], NULL, 0))) { - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("insert in text% (snip% without position case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "insert in text% (snip% without position case)", 0)); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_char(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+1], NULL))) { - mzchar x0; - nnlong x1; - long x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if ((n < (POFFSET+2)) || (n > (POFFSET+3))) - WITH_VAR_STACK(scheme_wrong_count_m("insert in text% (character and position case)", POFFSET+2, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_char(p[POFFSET+0], "insert in text% (character and position case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "insert in text% (character and position case)")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "same", "insert in text% (character and position case)")); - } else - x2 = -1; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else { - mzchar x0; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("insert in text% (character without position case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_char(p[POFFSET+0], "insert in text% (character without position case)")); - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetTopLineBase(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaEdit_class, "get-top-line-base in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetTopLineBase()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaEditFlashOff(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "flash-off in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FlashOff()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditFlashOn(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "flash-on in text%", n, p); - nnlong x0; - nnlong x1; - Bool x2; - Bool x3; - nnlong x4; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "flash-on in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "flash-on in text%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "flash-on in text%")); - } else - x2 = FALSE; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "flash-on in text%")); - } else - x3 = TRUE; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+4], "flash-on in text%")); - } else - x4 = 500; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FlashOn(x0, x1, x2, x3, x4)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetAnchor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "get-anchor in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetAnchor()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditSetAnchor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-anchor in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-anchor in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::SetAnchor(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetAnchor(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetVisibleLineRange(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "get-visible-line-range in text%", n, p); - nnlong _x0; - nnlong* x0 = &_x0; - nnlong _x1; - nnlong* x1 = &_x1; - Bool x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-visible-line-range in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-visible-line-range in text%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-visible-line-range in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-visible-line-range in text%"", extracting boxed argument"))); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-visible-line-range in text%")); - } else - x2 = TRUE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetVisibleLineRange(x0, x1, x2)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetVisiblePositionRange(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "get-visible-position-range in text%", n, p); - nnlong _x0; - nnlong* x0 = &_x0; - nnlong _x1; - nnlong* x1 = &_x1; - Bool x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-visible-position-range in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-visible-position-range in text%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-visible-position-range in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-visible-position-range in text%"", extracting boxed argument"))); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-visible-position-range in text%")); - } else - x2 = TRUE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetVisiblePositionRange(x0, x1, x2)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditScrollToPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "scroll-to-position in text%", n, p); - nnlong x0; - Bool x1; - long x2; - int x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "scroll-to-position in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "scroll-to-position in text%")); - } else - x1 = FALSE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "same", "scroll-to-position in text%")); - } else - x2 = -1; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(unbundle_symset_bias(p[POFFSET+3], "scroll-to-position in text%")); - } else - x3 = 0; - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ScrollToPosition(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditMovePosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "move-position in text%", n, p); - int x0; - Bool x1; - int x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_moveCode(p[POFFSET+0], "move-position in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "move-position in text%")); - } else - x1 = FALSE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(unbundle_symset_move(p[POFFSET+2], "move-position in text%")); - } else - x2 = wxMOVE_SIMPLE; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->MovePosition(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetPositionBiasScroll(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-position-bias-scroll in text%", n, p); - int x0; - nnlong x1; - long x2; - Bool x3; - Bool x4; - int x5; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_Bias(p[POFFSET+0], "set-position-bias-scroll in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "set-position-bias-scroll in text%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+2], "same", "set-position-bias-scroll in text%")); - } else - x2 = -1; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "set-position-bias-scroll in text%")); - } else - x3 = FALSE; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "set-position-bias-scroll in text%")); - } else - x4 = TRUE; - if (n > (POFFSET+5)) { - x5 = WITH_VAR_STACK(unbundle_symset_selType(p[POFFSET+5], "set-position-bias-scroll in text%")); - } else - x5 = wxDEFAULT_SELECT; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetPositionBiasScroll(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-position in text%", n, p); - nnlong x0; - long x1; - Bool x2; - Bool x3; - int x4; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-position in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+1], "same", "set-position in text%")); - } else - x1 = -1; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "set-position in text%")); - } else - x2 = FALSE; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "set-position in text%")); - } else - x3 = TRUE; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(unbundle_symset_selType(p[POFFSET+4], "set-position in text%")); - } else - x4 = wxDEFAULT_SELECT; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetPosition(x0, x1, x2, x3, x4)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetEndPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "get-end-position in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetEndPosition()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditGetStartPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaEdit_class, "get-start-position in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetStartPosition()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaEditGetPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "get-position in text%", n, p); - nnlong _x0; - nnlong* x0 = &_x0; - nnlong _x1; - nnlong* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-position in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-position in text%"", extracting boxed argument"))); - if (n > (POFFSET+1)) { - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-position in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-position in text%"", extracting boxed argument"))); - } else - x1 = NULL; - - - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetPosition(x0, x1)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetDefaultStyleName(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - string r; - objscheme_check_valid(os_wxMediaEdit_class, "default-style-name in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::GetDefaultStyleName()); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetDefaultStyleName()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r)); -} - -static Scheme_Object *os_wxMediaEditGetFlattenedText(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzstring r; - objscheme_check_valid(os_wxMediaEdit_class, "get-flattened-text in text%", n, p); - long _x0; - long* x0 = &_x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetFlattenedText(x0)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(scheme_make_sized_char_string(r, _x0, 0)); -} - -static Scheme_Object *os_wxMediaEditPutFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - npathname r; - objscheme_check_valid(os_wxMediaEdit_class, "put-file in text%", n, p); - nepathname x0 INIT_NULLED_OUT; - nepathname x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = (nepathname)WITH_VAR_STACK(objscheme_unbundle_nullable_epathname(p[POFFSET+0], "put-file in text%")); - x1 = (nepathname)WITH_VAR_STACK(objscheme_unbundle_nullable_epathname(p[POFFSET+1], "put-file in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::PutFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->PutFile(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_pathname((char *)r)); -} - -static Scheme_Object *os_wxMediaEditGetFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - npathname r; - objscheme_check_valid(os_wxMediaEdit_class, "get-file in text%", n, p); - nepathname x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (nepathname)WITH_VAR_STACK(objscheme_unbundle_nullable_epathname(p[POFFSET+0], "get-file in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::GetFile(x0)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetFile(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_pathname((char *)r)); -} - -static Scheme_Object *os_wxMediaEditAfterEditSequence(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-edit-sequence in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AfterEditSequence()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AfterEditSequence()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnEditSequence(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-edit-sequence in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnEditSequence()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnEditSequence()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditAfterLoadFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-load-file in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "after-load-file in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AfterLoadFile(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AfterLoadFile(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnLoadFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-load-file in text%", n, p); - epathname x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "on-load-file in text%")); - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "on-load-file in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnLoadFile(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnLoadFile(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCanLoadFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "can-load-file? in text%", n, p); - epathname x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "can-load-file? in text%")); - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "can-load-file? in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::CanLoadFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CanLoadFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditAfterSaveFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "after-save-file in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "after-save-file in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AfterSaveFile(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AfterSaveFile(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnSaveFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-save-file in text%", n, p); - epathname x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "on-save-file in text%")); - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "on-save-file in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnSaveFile(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnSaveFile(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCanSaveFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "can-save-file? in text%", n, p); - epathname x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "can-save-file? in text%")); - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "can-save-file? in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::CanSaveFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CanSaveFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditOnNewBox(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaEdit_class, "on-new-box in text%", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_bufferType(p[POFFSET+0], "on-new-box in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnNewBox(x0)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnNewBox(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaEditOnNewImageSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxImageSnip* r; - objscheme_check_valid(os_wxMediaEdit_class, "on-new-image-snip in text%", n, p); - nxpathname x0 INIT_NULLED_OUT; - int x1; - Bool x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (nxpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_xpathname(p[POFFSET+0], "on-new-image-snip in text%")); - x1 = WITH_VAR_STACK(unbundle_symset_bitmapType(p[POFFSET+1], "on-new-image-snip in text%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "on-new-image-snip in text%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "on-new-image-snip in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnNewImageSnip(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnNewImageSnip(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxImageSnip(r)); -} - -static Scheme_Object *os_wxMediaEditSizeCacheInvalid(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "size-cache-invalid in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::SizeCacheInvalid()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SizeCacheInvalid()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditInvalidateBitmapCache(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "invalidate-bitmap-cache in text%", n, p); - double x0; - double x1; - double x2; - double x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "invalidate-bitmap-cache in text%")); - } else - x0 = 0.0; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "invalidate-bitmap-cache in text%")); - } else - x1 = 0.0; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+2], "end", "invalidate-bitmap-cache in text%")); - } else - x2 = -1.0; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+3], "end", "invalidate-bitmap-cache in text%")); - } else - x3 = -1.0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::InvalidateBitmapCache(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->InvalidateBitmapCache(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnPaint(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-paint in text%", n, p); - Bool x0; - class wxDC* x1 INIT_NULLED_OUT; - double x2; - double x3; - double x4; - double x5; - double x6; - double x7; - int x8; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "on-paint in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+1], "on-paint in text%", 0)); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-paint in text%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-paint in text%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-paint in text%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "on-paint in text%")); - x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+6], "on-paint in text%")); - x7 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+7], "on-paint in text%")); - x8 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+8], "on-paint in text%")); - - if (x1 && !x1->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("editor<%>","on-paint"), "bad device context: ", p[POFFSET+1])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnPaint(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnPaint(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditWriteFootersToFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "write-footers-to-file in text%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write-footers-to-file in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::WriteFootersToFile(x0)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->WriteFootersToFile(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditWriteHeadersToFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "write-headers-to-file in text%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write-headers-to-file in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::WriteHeadersToFile(x0)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->WriteHeadersToFile(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditReadFooterFromFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "read-footer-from-file in text%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - string x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read-footer-from-file in text%", 0)); - x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "read-footer-from-file in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::ReadFooterFromFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ReadFooterFromFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditReadHeaderFromFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "read-header-from-file in text%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - string x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read-header-from-file in text%", 0)); - x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "read-header-from-file in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::ReadHeaderFromFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ReadHeaderFromFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditSetFilename(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-filename in text%", n, p); - nxpathname x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (nxpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_xpathname(p[POFFSET+0], "set-filename in text%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "set-filename in text%")); - } else - x1 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::SetFilename(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetFilename(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditReleaseSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "release-snip in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "release-snip in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::ReleaseSnip(x0)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ReleaseSnip(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditOnSnipModified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-snip-modified in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-snip-modified in text%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "on-snip-modified in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnSnipModified(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnSnipModified(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetModified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-modified in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-modified in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::SetModified(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetModified(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditAdminScrollTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "scroll-editor-to in text%", n, p); - double x0; - double x1; - nndouble x2; - nndouble x3; - Bool x4; - int x5; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "scroll-editor-to in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "scroll-editor-to in text%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "scroll-editor-to in text%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "scroll-editor-to in text%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "scroll-editor-to in text%")); - x5 = WITH_VAR_STACK(unbundle_symset_bias(p[POFFSET+5], "scroll-editor-to in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AdminScrollTo(x0, x1, x2, x3, x4, x5)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AdminScrollTo(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditSetSnipData(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-snip-data in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxBufferData* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "set-snip-data in text%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxBufferData(p[POFFSET+1], "set-snip-data in text%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::SetSnipData(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetSnipData(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditGetSnipData(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBufferData* r; - objscheme_check_valid(os_wxMediaEdit_class, "get-snip-data in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "get-snip-data in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::GetSnipData(x0)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetSnipData(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferData(r)); -} - -static Scheme_Object *os_wxMediaEditNeedsUpdate(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "needs-update in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble x3; - nndouble x4; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "needs-update in text%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "needs-update in text%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "needs-update in text%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "needs-update in text%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+4], "needs-update in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::NeedsUpdate(x0, x1, x2, x3, x4)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->NeedsUpdate(x0, x1, x2, x3, x4)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditResized(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "resized in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "resized in text%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "resized in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::Resized(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Resized(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditSetCaretOwner(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "set-caret-owner in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "set-caret-owner in text%", 1)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_focus(p[POFFSET+1], "set-caret-owner in text%")); - } else - x1 = wxFOCUS_IMMEDIATE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::SetCaretOwner(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->SetCaretOwner(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditScrollTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaEdit_class, "scroll-to in text%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble x3; - nndouble x4; - Bool x5; - int x6; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "scroll-to in text%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "scroll-to in text%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "scroll-to in text%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "scroll-to in text%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+4], "scroll-to in text%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "scroll-to in text%")); - if (n > (POFFSET+6)) { - x6 = WITH_VAR_STACK(unbundle_symset_bias(p[POFFSET+6], "scroll-to in text%")); - } else - x6 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::ScrollTo(x0, x1, x2, x3, x4, x5, x6)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->ScrollTo(x0, x1, x2, x3, x4, x5, x6)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaEditOnDisplaySizeWhenReady(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-display-size-when-ready in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnDisplaySizeWhenReady()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnDisplaySizeWhenReady()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnDisplaySize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-display-size in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnDisplaySize()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnDisplaySize()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnChange(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-change in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnChange()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnChange()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnFocus(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-focus in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "on-focus in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnFocus(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnFocus(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnDefaultChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-default-char in text%", n, p); - class wxKeyEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+0], "on-default-char in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnDefaultChar(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnDefaultChar(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnDefaultEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-default-event in text%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "on-default-event in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnDefaultEvent(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnDefaultEvent(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnLocalChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-local-char in text%", n, p); - class wxKeyEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+0], "on-local-char in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnLocalChar(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnLocalChar(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnLocalEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-local-event in text%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "on-local-event in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnLocalEvent(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnLocalEvent(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditFindFirstSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaEdit_class, "find-first-snip in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->FindFirstSnip()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaEditGetSpace(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaEdit_class, "get-space in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::GetSpace()); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetSpace()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaEditGetDescent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaEdit_class, "get-descent in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::GetDescent()); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetDescent()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaEditGetExtent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "get-extent in text%", n, p); - nndouble _x0; - nndouble* x0 = &_x0; - nndouble _x1; - nndouble* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-extent in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in text%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-extent in text%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in text%"", extracting boxed argument"))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::GetExtent(x0, x1)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->GetExtent(x0, x1)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditBlinkCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "blink-caret in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::BlinkCaret()); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->BlinkCaret()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOwnCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "own-caret in text%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "own-caret in text%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OwnCaret(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OwnCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditRefresh(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "refresh in text%", n, p); - double x0; - double x1; - nndouble x2; - nndouble x3; - int x4; - class wxColour* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "refresh in text%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "refresh in text%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "refresh in text%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "refresh in text%")); - x4 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+4], "refresh in text%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+5], "refresh in text%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::Refresh(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->Refresh(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditAdjustCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxCursor* r; - objscheme_check_valid(os_wxMediaEdit_class, "adjust-cursor in text%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "adjust-cursor in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::AdjustCursor(x0)); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->AdjustCursor(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxCursor(r)); -} - -static Scheme_Object *os_wxMediaEditOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-char in text%", n, p); - class wxKeyEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+0], "on-char in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnChar(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnChar(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "on-event in text%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "on-event in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::OnEvent(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->OnEvent(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCopySelfTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaEdit_class, "copy-self-to in text%", n, p); - class wxMediaBuffer* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(p[POFFSET+0], "copy-self-to in text%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::CopySelfTo(x0)); - else - WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CopySelfTo(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaEditCopySelf(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaBuffer* r; - objscheme_check_valid(os_wxMediaEdit_class, "copy-self in text%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaEdit::CopySelf()); - else - r = WITH_VAR_STACK(((wxMediaEdit *)((Scheme_Class_Object *)p[0])->primdata)->CopySelf()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaBuffer(r)); -} - -static Scheme_Object *os_wxMediaEdit_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaEdit *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - nndouble x0; - double* x1 INIT_NULLED_OUT; - int x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x1); - - - if ((n > (POFFSET+2))) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in text%", POFFSET+POFFSET, POFFSET+2, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "initialization in text%")); - } else - x0 = 1.0; - if (n > (POFFSET+1)) { - x1 = NULL; - } else - x1 = NULL; - - x1 = WITH_VAR_STACK(__MakedoubleArray((1+POFFSET < n) ? p[POFFSET+1] : scheme_null, &x2, METHODNAME("text%","initialization"))); - realobj = WITH_VAR_STACK(new os_wxMediaEdit CONSTRUCTOR_ARGS((x0, x1, x2))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaEdit(x0, x1, x2)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxMediaEdit(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaEdit_class); - - os_wxMediaEdit_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "text%", "editor%", (Scheme_Method_Prim *)os_wxMediaEdit_ConstructScheme, 154)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "call-clickback" " method", (Scheme_Method_Prim *)os_wxMediaEditCallClickback, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "remove-clickback" " method", (Scheme_Method_Prim *)os_wxMediaEditRemoveClickback, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-clickback" " method", (Scheme_Method_Prim *)os_wxMediaEditSetClickback, 3, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-wordbreak-func" " method", (Scheme_Method_Prim *)os_wxMediaEditSetWordbreakFunc, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-autowrap-bitmap" " method", (Scheme_Method_Prim *)os_wxMediaEditSetAutowrapBitmap, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-reflow" " method", (Scheme_Method_Prim *)os_wxMediaEditOnReflow, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-new-tab-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditOnNewTabSnip, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-new-string-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditOnNewTextSnip, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "caret-hidden?" " method", (Scheme_Method_Prim *)os_wxMediaEditCaretHidden, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "hide-caret" " method", (Scheme_Method_Prim *)os_wxMediaEditHideCaret, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-wordbreak-map" " method", (Scheme_Method_Prim *)os_wxMediaEditGetWordbreakMap, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-wordbreak-map" " method", (Scheme_Method_Prim *)os_wxMediaEditSetWordbreakMap, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-wordbreak" " method", (Scheme_Method_Prim *)os_wxMediaEditFindWordbreak, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-region-data" " method", (Scheme_Method_Prim *)os_wxMediaEditSetRegionData, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-region-data" " method", (Scheme_Method_Prim *)os_wxMediaEditGetRegionData, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-revision-number" " method", (Scheme_Method_Prim *)os_wxMediaEditGetRevisionNumber, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-merge-snips" " method", (Scheme_Method_Prim *)os_wxMediaEditOnMergeSnips, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-split-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditOnSplitSnip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-set-size-constraint" " method", (Scheme_Method_Prim *)os_wxMediaEditAfterSetSizeConstraint, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-set-size-constraint" " method", (Scheme_Method_Prim *)os_wxMediaEditOnSetSizeConstraint, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "can-set-size-constraint?" " method", (Scheme_Method_Prim *)os_wxMediaEditCanSetSizeConstraint, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-set-position" " method", (Scheme_Method_Prim *)os_wxMediaEditAfterSetPosition, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-change-style" " method", (Scheme_Method_Prim *)os_wxMediaEditAfterChangeStyle, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-change-style" " method", (Scheme_Method_Prim *)os_wxMediaEditOnChangeStyle, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "can-change-style?" " method", (Scheme_Method_Prim *)os_wxMediaEditCanChangeStyle, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-delete" " method", (Scheme_Method_Prim *)os_wxMediaEditAfterDelete, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-delete" " method", (Scheme_Method_Prim *)os_wxMediaEditOnDelete, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "can-delete?" " method", (Scheme_Method_Prim *)os_wxMediaEditCanDelete, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-insert" " method", (Scheme_Method_Prim *)os_wxMediaEditAfterInsert, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-insert" " method", (Scheme_Method_Prim *)os_wxMediaEditOnInsert, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "can-insert?" " method", (Scheme_Method_Prim *)os_wxMediaEditCanInsert, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-tabs" " method", (Scheme_Method_Prim *)os_wxMediaEditSetTabs, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-tabs" " method", (Scheme_Method_Prim *)os_wxMediaEditGetTabs, 0, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-overwrite-mode" " method", (Scheme_Method_Prim *)os_wxMediaEditSetOverwriteMode, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-overwrite-mode" " method", (Scheme_Method_Prim *)os_wxMediaEditGetOverwriteMode, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-file-format" " method", (Scheme_Method_Prim *)os_wxMediaEditSetFileFormat, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-file-format" " method", (Scheme_Method_Prim *)os_wxMediaEditGetFileFormat, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "write-to-file" " method", (Scheme_Method_Prim *)os_wxMediaEditWriteToFile, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "read-from-file" " method", (Scheme_Method_Prim *)os_wxMediaEditReadFromFile, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-character" " method", (Scheme_Method_Prim *)os_wxMediaEditGetCharacter, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-text" " method", (Scheme_Method_Prim *)os_wxMediaEditGetText, 0, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-next-non-string-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditFindNextNonTextSnip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-snip-position" " method", (Scheme_Method_Prim *)os_wxMediaEditGetSnipPosition, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-snip-position-and-location" " method", (Scheme_Method_Prim *)os_wxMediaEditGetSnipPositionAndLocation, 2, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditFindSnip, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-string-all" " method", (Scheme_Method_Prim *)os_wxMediaEditFindStringAll, 1, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-string" " method", (Scheme_Method_Prim *)os_wxMediaEditFindString, 1, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-styles-sticky" " method", (Scheme_Method_Prim *)os_wxMediaEditSetStickyStyles, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-styles-sticky" " method", (Scheme_Method_Prim *)os_wxMediaEditGetStickyStyles, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-line-spacing" " method", (Scheme_Method_Prim *)os_wxMediaEditSetLineSpacing, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-line-spacing" " method", (Scheme_Method_Prim *)os_wxMediaEditGetLineSpacing, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-paragraph-alignment" " method", (Scheme_Method_Prim *)os_wxMediaEditSetParagraghAlignment, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-paragraph-margins" " method", (Scheme_Method_Prim *)os_wxMediaEditSetParagraghMargins, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "last-paragraph" " method", (Scheme_Method_Prim *)os_wxMediaEditLastParagraph, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "paragraph-end-line" " method", (Scheme_Method_Prim *)os_wxMediaEditParagraphEndLine, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "paragraph-start-line" " method", (Scheme_Method_Prim *)os_wxMediaEditParagraphStartLine, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "line-paragraph" " method", (Scheme_Method_Prim *)os_wxMediaEditLineParagraph, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "paragraph-end-position" " method", (Scheme_Method_Prim *)os_wxMediaEditParagraphEndPosition, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "paragraph-start-position" " method", (Scheme_Method_Prim *)os_wxMediaEditParagraphStartPosition, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "position-paragraph" " method", (Scheme_Method_Prim *)os_wxMediaEditPositionParagraph, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "last-line" " method", (Scheme_Method_Prim *)os_wxMediaEditLastLine, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "last-position" " method", (Scheme_Method_Prim *)os_wxMediaEditLastPosition, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "line-length" " method", (Scheme_Method_Prim *)os_wxMediaEditLineLength, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "line-end-position" " method", (Scheme_Method_Prim *)os_wxMediaEditLineEndPosition, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "line-start-position" " method", (Scheme_Method_Prim *)os_wxMediaEditLineStartPosition, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "line-location" " method", (Scheme_Method_Prim *)os_wxMediaEditLineLocation, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "position-locations" " method", (Scheme_Method_Prim *)os_wxMediaEditPositionLocations, 5, 7)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "position-location" " method", (Scheme_Method_Prim *)os_wxMediaEditPositionLocation, 1, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "position-line" " method", (Scheme_Method_Prim *)os_wxMediaEditPositionLine, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-between-threshold" " method", (Scheme_Method_Prim *)os_wxMediaEditSetBetweenThreshold, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-between-threshold" " method", (Scheme_Method_Prim *)os_wxMediaEditGetBetweenThreshold, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-position-in-line" " method", (Scheme_Method_Prim *)os_wxMediaEditFindPositionInLine, 2, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-line" " method", (Scheme_Method_Prim *)os_wxMediaEditFindLine, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-position" " method", (Scheme_Method_Prim *)os_wxMediaEditFindPosition, 2, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "split-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditSplitSnip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "change-style" " method", (Scheme_Method_Prim *)os_wxMediaEditChangeStyle, 1, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "do-paste-x-selection" " method", (Scheme_Method_Prim *)os_wxMediaEditDoPasteSelection, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "do-paste" " method", (Scheme_Method_Prim *)os_wxMediaEditDoPaste, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "do-copy" " method", (Scheme_Method_Prim *)os_wxMediaEditDoCopy, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "kill" " method", (Scheme_Method_Prim *)os_wxMediaEditKill, 0, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "paste-next" " method", (Scheme_Method_Prim *)os_wxMediaEditPasteNext, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "paste-x-selection" " method", (Scheme_Method_Prim *)os_wxMediaEditPasteSelection, 0, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "paste" " method", (Scheme_Method_Prim *)os_wxMediaEditPaste, 0, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "copy" " method", (Scheme_Method_Prim *)os_wxMediaEditCopy, 0, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "cut" " method", (Scheme_Method_Prim *)os_wxMediaEditCut, 0, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "erase" " method", (Scheme_Method_Prim *)os_wxMediaEditErase, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "delete" " method", (Scheme_Method_Prim *)os_wxMediaEditDelete, 0, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "insert" " method", (Scheme_Method_Prim *)os_wxMediaEditInsert, 1, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-top-line-base" " method", (Scheme_Method_Prim *)os_wxMediaEditGetTopLineBase, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "flash-off" " method", (Scheme_Method_Prim *)os_wxMediaEditFlashOff, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "flash-on" " method", (Scheme_Method_Prim *)os_wxMediaEditFlashOn, 2, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-anchor" " method", (Scheme_Method_Prim *)os_wxMediaEditGetAnchor, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-anchor" " method", (Scheme_Method_Prim *)os_wxMediaEditSetAnchor, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-visible-line-range" " method", (Scheme_Method_Prim *)os_wxMediaEditGetVisibleLineRange, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-visible-position-range" " method", (Scheme_Method_Prim *)os_wxMediaEditGetVisiblePositionRange, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "scroll-to-position" " method", (Scheme_Method_Prim *)os_wxMediaEditScrollToPosition, 1, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "move-position" " method", (Scheme_Method_Prim *)os_wxMediaEditMovePosition, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-position-bias-scroll" " method", (Scheme_Method_Prim *)os_wxMediaEditSetPositionBiasScroll, 2, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-position" " method", (Scheme_Method_Prim *)os_wxMediaEditSetPosition, 1, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-end-position" " method", (Scheme_Method_Prim *)os_wxMediaEditGetEndPosition, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-start-position" " method", (Scheme_Method_Prim *)os_wxMediaEditGetStartPosition, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-position" " method", (Scheme_Method_Prim *)os_wxMediaEditGetPosition, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "default-style-name" " method", (Scheme_Method_Prim *)os_wxMediaEditGetDefaultStyleName, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-flattened-text" " method", (Scheme_Method_Prim *)os_wxMediaEditGetFlattenedText, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "put-file" " method", (Scheme_Method_Prim *)os_wxMediaEditPutFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-file" " method", (Scheme_Method_Prim *)os_wxMediaEditGetFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-edit-sequence" " method", (Scheme_Method_Prim *)os_wxMediaEditAfterEditSequence, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-edit-sequence" " method", (Scheme_Method_Prim *)os_wxMediaEditOnEditSequence, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-load-file" " method", (Scheme_Method_Prim *)os_wxMediaEditAfterLoadFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-load-file" " method", (Scheme_Method_Prim *)os_wxMediaEditOnLoadFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "can-load-file?" " method", (Scheme_Method_Prim *)os_wxMediaEditCanLoadFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "after-save-file" " method", (Scheme_Method_Prim *)os_wxMediaEditAfterSaveFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-save-file" " method", (Scheme_Method_Prim *)os_wxMediaEditOnSaveFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "can-save-file?" " method", (Scheme_Method_Prim *)os_wxMediaEditCanSaveFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-new-box" " method", (Scheme_Method_Prim *)os_wxMediaEditOnNewBox, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-new-image-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditOnNewImageSnip, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "size-cache-invalid" " method", (Scheme_Method_Prim *)os_wxMediaEditSizeCacheInvalid, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "invalidate-bitmap-cache" " method", (Scheme_Method_Prim *)os_wxMediaEditInvalidateBitmapCache, 0, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-paint" " method", (Scheme_Method_Prim *)os_wxMediaEditOnPaint, 9, 9)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "write-footers-to-file" " method", (Scheme_Method_Prim *)os_wxMediaEditWriteFootersToFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "write-headers-to-file" " method", (Scheme_Method_Prim *)os_wxMediaEditWriteHeadersToFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "read-footer-from-file" " method", (Scheme_Method_Prim *)os_wxMediaEditReadFooterFromFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "read-header-from-file" " method", (Scheme_Method_Prim *)os_wxMediaEditReadHeaderFromFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-filename" " method", (Scheme_Method_Prim *)os_wxMediaEditSetFilename, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "release-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditReleaseSnip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-snip-modified" " method", (Scheme_Method_Prim *)os_wxMediaEditOnSnipModified, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-modified" " method", (Scheme_Method_Prim *)os_wxMediaEditSetModified, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "scroll-editor-to" " method", (Scheme_Method_Prim *)os_wxMediaEditAdminScrollTo, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-snip-data" " method", (Scheme_Method_Prim *)os_wxMediaEditSetSnipData, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-snip-data" " method", (Scheme_Method_Prim *)os_wxMediaEditGetSnipData, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "needs-update" " method", (Scheme_Method_Prim *)os_wxMediaEditNeedsUpdate, 5, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "resized" " method", (Scheme_Method_Prim *)os_wxMediaEditResized, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "set-caret-owner" " method", (Scheme_Method_Prim *)os_wxMediaEditSetCaretOwner, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "scroll-to" " method", (Scheme_Method_Prim *)os_wxMediaEditScrollTo, 6, 7)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-display-size-when-ready" " method", (Scheme_Method_Prim *)os_wxMediaEditOnDisplaySizeWhenReady, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-display-size" " method", (Scheme_Method_Prim *)os_wxMediaEditOnDisplaySize, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-change" " method", (Scheme_Method_Prim *)os_wxMediaEditOnChange, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-focus" " method", (Scheme_Method_Prim *)os_wxMediaEditOnFocus, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-default-char" " method", (Scheme_Method_Prim *)os_wxMediaEditOnDefaultChar, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-default-event" " method", (Scheme_Method_Prim *)os_wxMediaEditOnDefaultEvent, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-local-char" " method", (Scheme_Method_Prim *)os_wxMediaEditOnLocalChar, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-local-event" " method", (Scheme_Method_Prim *)os_wxMediaEditOnLocalEvent, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "find-first-snip" " method", (Scheme_Method_Prim *)os_wxMediaEditFindFirstSnip, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-space" " method", (Scheme_Method_Prim *)os_wxMediaEditGetSpace, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-descent" " method", (Scheme_Method_Prim *)os_wxMediaEditGetDescent, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "get-extent" " method", (Scheme_Method_Prim *)os_wxMediaEditGetExtent, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "blink-caret" " method", (Scheme_Method_Prim *)os_wxMediaEditBlinkCaret, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "own-caret" " method", (Scheme_Method_Prim *)os_wxMediaEditOwnCaret, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "refresh" " method", (Scheme_Method_Prim *)os_wxMediaEditRefresh, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "adjust-cursor" " method", (Scheme_Method_Prim *)os_wxMediaEditAdjustCursor, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-char" " method", (Scheme_Method_Prim *)os_wxMediaEditOnChar, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "on-event" " method", (Scheme_Method_Prim *)os_wxMediaEditOnEvent, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "copy-self-to" " method", (Scheme_Method_Prim *)os_wxMediaEditCopySelfTo, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaEdit_class, "copy-self" " method", (Scheme_Method_Prim *)os_wxMediaEditCopySelf, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaEdit_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMediaEdit, wxTYPE_MEDIA_EDIT)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaEdit(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaEdit_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "text% object or " XC_NULL_STR: "text% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaEdit(class wxMediaEdit *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_MEDIA_EDIT) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaEdit_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaEdit *objscheme_unbundle_wxMediaEdit(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaEdit(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaEdit *)o->primdata; - else - return (wxMediaEdit *)o->primdata; -} - diff --git a/src/mred/wxs/wxs_mede.h b/src/mred/wxs/wxs_mede.h deleted file mode 100644 index 52af9fe9fc..0000000000 --- a/src/mred/wxs/wxs_mede.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef WXS_SETUP_ONLY -extern class wxTabSnip *objscheme_unbundle_wxTabSnip(Scheme_Object *, const char *, int); -extern class wxTextSnip *objscheme_unbundle_wxTextSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *); -extern class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxImageSnip *objscheme_unbundle_wxImageSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxColour(class wxColour *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxBitmap *objscheme_unbundle_wxBitmap(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBitmap(class wxBitmap *); -extern Scheme_Object *objscheme_bundle_wxTabSnip(class wxTabSnip *); -extern Scheme_Object *objscheme_bundle_wxTextSnip(class wxTextSnip *); -extern Scheme_Object *objscheme_bundle_wxMediaWordbreakMap(class wxMediaWordbreakMap *); -extern class wxMediaWordbreakMap *objscheme_unbundle_wxMediaWordbreakMap(Scheme_Object *, const char *, int); -extern class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *); -extern int objscheme_istype_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern int objscheme_istype_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxImageSnip(class wxImageSnip *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxColour *objscheme_unbundle_wxColour(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxCursor(class wxCursor *); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *); -#endif -void objscheme_setup_wxMediaEdit(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaEdit(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaEdit(class wxMediaEdit *realobj); -class wxMediaEdit *objscheme_unbundle_wxMediaEdit(Scheme_Object *obj, const char *where, int nullOK); -#endif diff --git a/src/mred/wxs/wxs_mede.xc b/src/mred/wxs/wxs_mede.xc deleted file mode 100644 index c1aa98f33f..0000000000 --- a/src/mred/wxs/wxs_mede.xc +++ /dev/null @@ -1,327 +0,0 @@ - -@INCLUDE prefix.xci - -#include "wx_media.h" - -@INCLUDE wxs.xci - -@HEADER - -@SET TYPE = double -@SET NOTEST = 1 -@INCLUDE list.xci - -@MACRO rNULL = return NULL; -@MACRO rFALSE = return FALSE; -@MACRO rZERO = return 0; - -@BEGINSYMBOLS selType > ONE > PRED BUNDLE -@SYM "default" : wxDEFAULT_SELECT -@SYM "x" : wxX_SELECT -@SYM "local" : wxLOCAL_SELECT -@ENDSYMBOLS - -@BEGINSYMBOLS moveCode > ONE > PRED BUNDLE -@SYM "home" : WXK_HOME -@SYM "end" : WXK_END -@SYM "right" : WXK_RIGHT -@SYM "left" : WXK_LEFT -@SYM "up" : WXK_UP -@SYM "down" : WXK_DOWN -@ENDSYMBOLS - -@BEGINSYMBOLS move > ONE > PRED BUNDLE -@SYM "simple" : wxMOVE_SIMPLE -@SYM "line" : wxMOVE_LINE -@SYM "page" : wxMOVE_PAGE -@SYM "word" : wxMOVE_WORD -@ENDSYMBOLS - -@BEGINSYMBOLS findKind > ONE > PRED BUNDLE -@SYM "before-or-none" : wxSNIP_BEFORE_OR_NULL -@SYM "before" : wxSNIP_BEFORE -@SYM "after" : wxSNIP_AFTER -@SYM "after-or-none" : wxSNIP_AFTER_OR_NULL -@ENDSYMBOLS - -@BEGINSYMBOLS breakType > ONE > PRED -@SYM "caret" : wxBREAK_FOR_CARET -@SYM "line" : wxBREAK_FOR_LINE -@SYM "selection" : wxBREAK_FOR_SELECTION -@SYM "user1" : wxBREAK_FOR_USER_1 -@SYM "user2" : wxBREAK_FOR_USER_2 -@ENDSYMBOLS - -# define Sym_FORWARD 1 -# define Sym_BACKWARD -1 -@BEGINSYMBOLS direction > ONE > PRED -@SYM "forward" : Sym_FORWARD -@SYM "backward" : Sym_BACKWARD -@ENDSYMBOLS - -# define Sym_RIGHT 1 -# define Sym_CENTER 0 -# define Sym_LEFT -1 -@BEGINSYMBOLS horizontalAlignment > ONE > PRED BUNDLE -@SYM "left" : Sym_LEFT -@SYM "right" : Sym_RIGHT -@SYM "center" : Sym_CENTER -@ENDSYMBOLS - -@INCLUDE wxs_eds.xci -@INCLUDE wxs_bmt.xci - -# define Sym_END_ONLY 2 -# define Sym_START_ONLY -2 -@BEGINSYMBOLS Bias > ONE > PRED BUNDLE -@SYM "start-only" : Sym_START_ONLY -@SYM "start" : Sym_START -@SYM "none" : Sym_NONE -@SYM "end" : Sym_END -@SYM "end-only" : Sym_END_ONLY -@ENDSYMBOLS - -@CLASSBASE wxMediaEdit "text" : "editor" / nofnl - -@CREATOR (nndouble=1.0,double[]=NULL/bList/ubList/cList///push,-int=0); : : /glueListSet[double.1.1.2.METHODNAME("text%","initialization")]// - -@CLASSID wxTYPE_MEDIA_EDIT - -@VAR Scheme_Object *scroll_closure; - -@SETMARK X = -@SETMARK Y = d -@SETMARK Z = d -@INCLUDE wxs_mbuf.xci - -@ "get-position" : void GetPosition(nnlong?,nnlong?=NULL); -@ "get-start-position" : long GetStartPosition(); -@ "get-end-position" : long GetEndPosition(); -@ "set-position" : void SetPosition(nnlong,nnls[same]=-1,bool=FALSE,bool=TRUE,SYM[selType]=wxDEFAULT_SELECT); -@ "set-position-bias-scroll" : void SetPositionBiasScroll(SYM[Bias],nnlong,nnls[same]=-1,bool=FALSE,bool=TRUE,SYM[selType]=wxDEFAULT_SELECT); -@ "move-position" : void MovePosition(SYM[moveCode],bool=FALSE,SYM[move]=wxMOVE_SIMPLE); -@ "scroll-to-position" : bool ScrollToPosition(nnlong,bool=FALSE,nnls[same]=-1,SYM[bias]=0); -@ "get-visible-position-range" : void GetVisiblePositionRange(nnlong?,nnlong?,bool=TRUE); -@ "get-visible-line-range" : void GetVisibleLineRange(nnlong?,nnlong?,bool=TRUE); - -@ v "set-anchor" : void SetAnchor(bool); -@ "get-anchor" : bool GetAnchor(); - -@ "flash-on" : void FlashOn(nnlong,nnlong,bool=FALSE,bool=TRUE,nnlong=500); -@ "flash-off" : void FlashOff(); - -@ "get-top-line-base" : double GetTopLineBase(); : : : : XrZERO - -@MACRO setStringLen[i.s] = x = SCHEME_CHAR_STRTAG_VAL(p[POFFSET+]); -@MACRO checkStringLen[i.s] = if ((x < 0) || (x > SCHEME_CHAR_STRTAG_VAL(p[POFFSET+]))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("text%","insert"), "bad string length: ", p[POFFSET+])); - -@ "insert" : void Insert(-long,mzstring,nnlong,nnls[same]=-1,bool=TRUE); : : /setStringLen[0.0] <> string and position -@ "insert" : void Insert(-long,mzstring); : : /setStringLen[0.0] <> string without position -@ "insert" : void Insert(nnlong,mzstring,nnlong,nnls[same]=-1,bool=TRUE); : : /checkStringLen[0.1] <> length and string without position -@ "insert" : void Insert(nnlong,mzstring); : : /checkStringLen[0.1] <> length, string, and position -@ "insert" : void Insert(wxSnip!,nnlong,nnls[same]=-1,bool=TRUE); <> snip% and position -@ "insert" : void Insert(mzchar); <> character without position -@ "insert" : void Insert(mzchar,nnlong,nnls[same]=-1); <> character and position - -@ "delete" : void Delete(nnls[start],nnls[back]=-1,bool=TRUE); <> position -@ "delete" : void Delete(); <> no position -@ "erase" : void Erase(); - -@ "cut" : void Cut(bool,ExactLong,nnls[start],nnls[end]=-1); <> position -@ "copy" : void Copy(bool,ExactLong,nnls[start],nnls[end]=-1); <> position -@ "paste" : void Paste(ExactLong,nnls[end],nnls[same]=-1); <> position -@ "paste-x-selection" : void PasteSelection(ExactLong,nnls[end],nnls[same]=-1); <> position -@ "paste-next" : void PasteNext(); -@ "kill" : void Kill(ExactLong,nnlong,nnlong); <> position - -@ v "do-copy" : void DoCopy(nnlong,nnlong,ExactLong,bool); -@ v "do-paste" : void DoPaste(nnlong,ExactLong); -@ v "do-paste-x-selection" : void DoPasteSelection(nnlong,ExactLong); - -@ "change-style" : void ChangeStyle(wxStyleDelta^,nnls[start],nnls[end]=-1,bool=TRUE); <> style-delta% and position -@ "change-style" : void ChangeStyle(wxStyle^,nnls[start]=-1,nnls[end]=-1,bool=TRUE); <> style% - -@ "split-snip" : void SplitSnip(nnlong); - -@ "find-position" : long FindPosition(double,double,bool?=NULL,bool?=NULL,double?=NULL); -@ "find-line" : long FindLine(double,bool?=NULL); -@ "find-position-in-line" : long FindPositionInLine(nnlong,double,bool?=NULL,bool?=NULL,double?=NULL); - -@ "get-between-threshold" : double GetBetweenThreshold(); -@ "set-between-threshold" : void SetBetweenThreshold(nndouble); - -@ "position-line" : long PositionLine(nnlong,bool=FALSE); -@ "position-location" : void PositionLocation(nnlong,double?=NULL,double?=NULL,bool=TRUE,bool=FALSE,bool=FALSE); -@ "position-locations" : void PositionLocations(nnlong,double?,double?,double?,double?,bool=FALSE,bool=FALSE); -@ "line-location" : double LineLocation(nnlong,bool=TRUE); - -@ "line-start-position" : long LineStartPosition(nnlong,bool=TRUE); -@ "line-end-position" : long LineEndPosition(nnlong,bool=TRUE); -@ "line-length" : long LineLength(nnlong); -@ "last-position" : long LastPosition(); -@ "last-line" : long LastLine(); - -@ "position-paragraph" : long PositionParagraph(nnlong,bool=FALSE); -@ "paragraph-start-position" : long ParagraphStartPosition(nnlong,bool=TRUE); -@ "paragraph-end-position" : long ParagraphEndPosition(nnlong,bool=TRUE); -@ "line-paragraph" : long LineParagraph(nnlong); -@ "paragraph-start-line" : long ParagraphStartLine(nnlong); -@ "paragraph-end-line" : long ParagraphEndLine(nnlong); -@ "last-paragraph" : long LastParagraph(); - -@ "set-paragraph-margins" : void SetParagraghMargins(nnlong,nndouble,nndouble,nndouble); -@ "set-paragraph-alignment" : void SetParagraghAlignment(nnlong,SYM[horizontalAlignment]); - -@ "get-line-spacing" : nndouble GetLineSpacing(); -@ "set-line-spacing" : void SetLineSpacing(nndouble); - -@ "get-styles-sticky" : bool GetStickyStyles(); -@ "set-styles-sticky" : void SetStickyStyles(bool); - -@MACRO bNegAsFalse = (({x} < 0) ? scheme_false : scheme_make_integer({x})) - -@ "find-string" : long/bNegAsFalse FindString(mzstring,SYM[direction]=1,nnls[start]=-1,nnls[eof]=-1,bool=TRUE,bool=TRUE); - -@SET TYPE = long -@SET NOTEST = 1 -@INCLUDE list.xci - -@ "find-string-all" : long[]/bReturnList[long.1] FindStringAll(mzstring,-long*,SYM[direction]=1,nnls[start]=-1,nnls[eof]=-1,bool=TRUE,bool=TRUE); - -@ "find-snip" : wxSnip^ FindSnip(nnlong,SYM[findKind],nnlong?=NULL) -@ "get-snip-position-and-location" : bool GetSnipPositionAndLocation(wxSnip!,nnlong?,double?=NULL,double?=NULL); -@ "get-snip-position" : long/bNegAsFalse GetSnipPosition(wxSnip!); - -@ "find-next-non-string-snip" : wxSnip^ FindNextNonTextSnip(wxSnip^) - -@MACRO makeNoCopyString[len] = WITH_VAR_STACK(scheme_make_sized_char_string(r, , 0)) - -@ "get-text" : mzstring/makeNoCopyString[_x4] GetText(nnlong=0,nnls[eof]=-1,bool=FALSE,bool=FALSE,-long*=NULL); -@ "get-character" : mzchar GetCharacter(nnlong); - -@ "read-from-file" : bool ReadFromFile(wxMediaStreamIn!,nnls[start],bool=FALSE); <> with position -@ "write-to-file" : bool WriteToFile(wxMediaStreamOut!,nnlong,nnls[eof]=-1); <> with position - -@ "get-file-format" : SYM[fileType] GetFileFormat(); -@ "set-file-format" : void SetFileFormat(SYM[fileType]); - -@ "get-overwrite-mode" : bool GetOverwriteMode(); -@ "set-overwrite-mode" : void SetOverwriteMode(bool); - -@MACRO checkNull = if (!x0) x0 = &_x0; - -@ "get-tabs" : double[]/bReturnList[double.0]///push GetTabs(nnint?=NULL,double?=NULL,bool?=NULL); : : /checkNull/ -@ "set-tabs" : void SetTabs(double[]/bList/ubList/cList///push,-int,double=wxTAB_WIDTH,bool=TRUE); : : /glueListSet[double.0.0.1.METHODNAME("text%","set-tabs")]// - -@ v "can-insert?" : bool CanInsert(nnlong,nnlong); -@ v "on-insert" : void OnInsert(nnlong,nnlong); -@ v "after-insert" : void AfterInsert(nnlong,nnlong); -@ v "can-delete?" : bool CanDelete(nnlong,nnlong); -@ v "on-delete" : void OnDelete(nnlong,nnlong); -@ v "after-delete" : void AfterDelete(nnlong,nnlong); -@ v "can-change-style?" : bool CanChangeStyle(nnlong,nnlong); -@ v "on-change-style" : void OnChangeStyle(nnlong,nnlong); -@ v "after-change-style" : void AfterChangeStyle(nnlong,nnlong); -@ v "after-set-position" : void AfterSetPosition(); -@ v "can-set-size-constraint?" : bool CanSetSizeConstraint(); -@ v "on-set-size-constraint" : void OnSetSizeConstraint(); -@ v "after-set-size-constraint" : void AfterSetSizeConstraint(); -@ v "after-split-snip" : void OnSplitSnip(nnlong); -@ v "after-merge-snips" : void OnMergeSnips(nnlong); - -@ "get-revision-number" : double GetRevisionNumber(); - -@ v "get-region-data" : wxBufferData^ GetRegionData(nnlong,nnlong); -@ v "set-region-data" : void SetRegionData(nnlong,nnlong,wxBufferData^); - -@ "find-wordbreak" : void FindWordbreak(nnlong?,nnlong?,SYM[breakType]); - -@ "set-wordbreak-map" : void SetWordbreakMap(wxMediaWordbreakMap^); -@ "get-wordbreak-map" : wxMediaWordbreakMap^ GetWordbreakMap(); - -@ "hide-caret" : void HideCaret(bool); -@ "caret-hidden?" : bool CaretHidden(); - -@ v "on-new-string-snip" : wxTextSnip! OnNewTextSnip(); -@ v "on-new-tab-snip" : wxTabSnip! OnNewTabSnip(); - -@ v "on-reflow" : void OnReflow(); - -@ "set-autowrap-bitmap" : wxBitmap^ SetAutowrapBitmap(wxBitmap^); - -static void WordbreakCallbackToScheme(wxMediaEdit *,long*,long*,int,Scheme_Object *); - -@MACRO ubCallback = (wxWordbreakFunc)WordbreakCallbackToScheme -@MACRO ubData = p[POFFSET] -@MACRO spCallback = (wxMediaEdit-object (box num) (box num) num -> void) - -@MACRO ubCallback2 = (wxClickbackFunc)ClickbackToScheme -@MACRO ubData2 = p[POFFSET+2] -@MACRO cCallback2 = SCHEME_PROCP({x}) -@MACRO spCallback2 = (wxMediaEdit-object num num -> void) - -@ "set-wordbreak-func" : void SetWordbreakFunc(wxWordbreakFunc//ubCallback/cCallback//spCallback/nopush,-unknown#void*//ubData); - -@ "set-clickback" : void SetClickback(nnlong,nnlong,wxClickbackFunc//ubCallback2/cCallback2//spCallback2/nopush,-unknown#void*//ubData2,wxStyleDelta^=NULL,bool=FALSE); -@ "remove-clickback" : void RemoveClickback(nnlong,nnlong); -@ "call-clickback" : void CallClickback(nnlong,nnlong); - -static void WordbreakCallbackToScheme(wxMediaEdit *media, - long *start, long *end, - int reason, - Scheme_Object *f) -{ - Scheme_Object *p[4], *s = NULL, *e = NULL; - SETUP_VAR_STACK(8); - VAR_STACK_PUSH_ARRAY(0, p, 4); - VAR_STACK_PUSH(3, s); - VAR_STACK_PUSH(4, e); - VAR_STACK_PUSH(5, start); - VAR_STACK_PUSH(6, end); - VAR_STACK_PUSH(7, f); - - p[0] = p[1] = p[2] = p[3] = NULL; - - p[0] = WITH_VAR_STACK(objscheme_bundle_wxMediaEdit(media)); - if (start) - s = WITH_VAR_STACK(scheme_box(WITH_VAR_STACK(objscheme_bundle_integer(*start)))); - else - s = XC_SCHEME_NULL; - if (end) - e = WITH_VAR_STACK(scheme_box(WITH_VAR_STACK(objscheme_bundle_integer(*end)))); - else - e = XC_SCHEME_NULL; - p[1] = s; - p[2] = e; - p[3] = WITH_VAR_STACK(bundle_symset_breakType(reason)); - - WITH_VAR_STACK(scheme_apply_multi(f, 4, p)); - if (start) - *start = WITH_VAR_STACK(objscheme_unbundle_integer(WITH_VAR_STACK(scheme_unbox(s)), "Scheme wordbreak callback")); - if (end) - *end = WITH_VAR_STACK(objscheme_unbundle_integer(WITH_VAR_STACK(scheme_unbox(e)), "Scheme wordbreak callback")); - - READY_TO_RETURN; -} - -static void ClickbackToScheme(wxMediaEdit *media, - long start, long end, - Scheme_Object *f) -{ - Scheme_Object *p[3]; - SETUP_VAR_STACK(4); - VAR_STACK_PUSH_ARRAY(0, p, 3); - VAR_STACK_PUSH(3, f); - - p[0] = p[1] = p[2] = NULL; - - p[0] = WITH_VAR_STACK(objscheme_bundle_wxMediaEdit(media)); - p[1] = WITH_VAR_STACK(objscheme_bundle_integer(start)); - p[2] = WITH_VAR_STACK(objscheme_bundle_integer(end)); - - WITH_VAR_STACK(scheme_apply_multi(f, 3, p)); - - READY_TO_RETURN; -} - -@END diff --git a/src/mred/wxs/wxs_medi.cxx b/src/mred/wxs/wxs_medi.cxx deleted file mode 100644 index 04ed059ec0..0000000000 --- a/src/mred/wxs/wxs_medi.cxx +++ /dev/null @@ -1,2731 +0,0 @@ -/* DO NOT EDIT THIS FILE. */ -/* This file was generated by xctocc from "wxs_medi.xc". */ - - -#if defined(_MSC_VER) -# include "wx.h" -#endif -#if defined(OS_X) -# include "common.h" -#endif - -#include "wx_media.h" - - - - -#ifdef wx_x -# define BM_SELECTED(map) ((map)->selectedTo) -#endif -#if defined(wx_mac) || defined(wx_msw) -# define BM_SELECTED(map) ((map)->selectedInto) -#endif -# define BM_IN_USE(map) ((map)->selectedIntoDC) - - - - -#define ESCAPE_NO_RET_VAL /*empty*/ - - -#include "wxscheme.h" -#include "wxs_medi.h" - -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - -static void *wxbBufferToDC(wxMediaBuffer *b, double x, double y) -{ - Scheme_Object *a[2]; - void *r; - SETUP_VAR_STACK(3); - VAR_STACK_PUSH_ARRAY(0, a, 2); - - a[0] = a[1] = NULL; - - WITH_VAR_STACK(b->LocalToGlobal(&x, &y)); - - a[0] = WITH_VAR_STACK(objscheme_bundle_double(x)); - a[1] = WITH_VAR_STACK(objscheme_bundle_double(y)); - - r = WITH_VAR_STACK(scheme_values(2, a)); - READY_TO_RETURN; - return r; -} - -static void *wxbDCToBuffer(wxMediaBuffer *b, double x, double y) -{ - Scheme_Object *a[2]; - void *r; - SETUP_VAR_STACK(3); - VAR_STACK_PUSH_ARRAY(0, a, 2); - - a[0] = a[1] = NULL; - - WITH_VAR_STACK(b->GlobalToLocal(&x, &y)); - - a[0] = WITH_VAR_STACK(objscheme_bundle_double(x)); - a[1] = WITH_VAR_STACK(objscheme_bundle_double(y)); - - r = WITH_VAR_STACK(scheme_values(2, a)); - READY_TO_RETURN; - return r; -} - - - - -static Scheme_Object *bufferType_wxEDIT_BUFFER_sym = NULL; -static Scheme_Object *bufferType_wxPASTEBOARD_BUFFER_sym = NULL; - -static void init_symset_bufferType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bufferType_wxEDIT_BUFFER_sym); - bufferType_wxEDIT_BUFFER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text")); - wxREGGLOB(bufferType_wxPASTEBOARD_BUFFER_sym); - bufferType_wxPASTEBOARD_BUFFER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pasteboard")); -} - -static int unbundle_symset_bufferType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bufferType_wxPASTEBOARD_BUFFER_sym) WITH_VAR_STACK(init_symset_bufferType()); - if (0) { } - else if (v == bufferType_wxEDIT_BUFFER_sym) { READY_TO_RETURN; return wxEDIT_BUFFER; } - else if (v == bufferType_wxPASTEBOARD_BUFFER_sym) { READY_TO_RETURN; return wxPASTEBOARD_BUFFER; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bufferType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bufferType(int v) { - if (!bufferType_wxPASTEBOARD_BUFFER_sym) init_symset_bufferType(); - switch (v) { - case wxEDIT_BUFFER: return bufferType_wxEDIT_BUFFER_sym; - case wxPASTEBOARD_BUFFER: return bufferType_wxPASTEBOARD_BUFFER_sym; - default: return NULL; - } -} - - -static Scheme_Object *fileType_wxMEDIA_FF_GUESS_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_STD_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_TEXT_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_SAME_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_COPY_sym = NULL; - -static void init_symset_fileType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(fileType_wxMEDIA_FF_GUESS_sym); - fileType_wxMEDIA_FF_GUESS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("guess")); - wxREGGLOB(fileType_wxMEDIA_FF_STD_sym); - fileType_wxMEDIA_FF_STD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("standard")); - wxREGGLOB(fileType_wxMEDIA_FF_TEXT_sym); - fileType_wxMEDIA_FF_TEXT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text")); - wxREGGLOB(fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym); - fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text-force-cr")); - wxREGGLOB(fileType_wxMEDIA_FF_SAME_sym); - fileType_wxMEDIA_FF_SAME_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("same")); - wxREGGLOB(fileType_wxMEDIA_FF_COPY_sym); - fileType_wxMEDIA_FF_COPY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("copy")); -} - -static int unbundle_symset_fileType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!fileType_wxMEDIA_FF_COPY_sym) WITH_VAR_STACK(init_symset_fileType()); - if (0) { } - else if (v == fileType_wxMEDIA_FF_GUESS_sym) { READY_TO_RETURN; return wxMEDIA_FF_GUESS; } - else if (v == fileType_wxMEDIA_FF_STD_sym) { READY_TO_RETURN; return wxMEDIA_FF_STD; } - else if (v == fileType_wxMEDIA_FF_TEXT_sym) { READY_TO_RETURN; return wxMEDIA_FF_TEXT; } - else if (v == fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym) { READY_TO_RETURN; return wxMEDIA_FF_TEXT_FORCE_CR; } - else if (v == fileType_wxMEDIA_FF_SAME_sym) { READY_TO_RETURN; return wxMEDIA_FF_SAME; } - else if (v == fileType_wxMEDIA_FF_COPY_sym) { READY_TO_RETURN; return wxMEDIA_FF_COPY; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "fileType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_fileType(int v) { - if (!fileType_wxMEDIA_FF_COPY_sym) init_symset_fileType(); - switch (v) { - case wxMEDIA_FF_GUESS: return fileType_wxMEDIA_FF_GUESS_sym; - case wxMEDIA_FF_STD: return fileType_wxMEDIA_FF_STD_sym; - case wxMEDIA_FF_TEXT: return fileType_wxMEDIA_FF_TEXT_sym; - case wxMEDIA_FF_TEXT_FORCE_CR: return fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym; - case wxMEDIA_FF_SAME: return fileType_wxMEDIA_FF_SAME_sym; - case wxMEDIA_FF_COPY: return fileType_wxMEDIA_FF_COPY_sym; - default: return NULL; - } -} - - - -static Scheme_Object *focus_wxFOCUS_IMMEDIATE_sym = NULL; -static Scheme_Object *focus_wxFOCUS_DISPLAY_sym = NULL; -static Scheme_Object *focus_wxFOCUS_GLOBAL_sym = NULL; - -static void init_symset_focus(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(focus_wxFOCUS_IMMEDIATE_sym); - focus_wxFOCUS_IMMEDIATE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("immediate")); - wxREGGLOB(focus_wxFOCUS_DISPLAY_sym); - focus_wxFOCUS_DISPLAY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("display")); - wxREGGLOB(focus_wxFOCUS_GLOBAL_sym); - focus_wxFOCUS_GLOBAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("global")); -} - -static int unbundle_symset_focus(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!focus_wxFOCUS_GLOBAL_sym) WITH_VAR_STACK(init_symset_focus()); - if (0) { } - else if (v == focus_wxFOCUS_IMMEDIATE_sym) { READY_TO_RETURN; return wxFOCUS_IMMEDIATE; } - else if (v == focus_wxFOCUS_DISPLAY_sym) { READY_TO_RETURN; return wxFOCUS_DISPLAY; } - else if (v == focus_wxFOCUS_GLOBAL_sym) { READY_TO_RETURN; return wxFOCUS_GLOBAL; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "focus symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_focus(int v) { - if (!focus_wxFOCUS_GLOBAL_sym) init_symset_focus(); - switch (v) { - case wxFOCUS_IMMEDIATE: return focus_wxFOCUS_IMMEDIATE_sym; - case wxFOCUS_DISPLAY: return focus_wxFOCUS_DISPLAY_sym; - case wxFOCUS_GLOBAL: return focus_wxFOCUS_GLOBAL_sym; - default: return NULL; - } -} - - -# define Sym_END 1 -# define Sym_START -1 -# define Sym_NONE 0 -static Scheme_Object *bias_Sym_START_sym = NULL; -static Scheme_Object *bias_Sym_NONE_sym = NULL; -static Scheme_Object *bias_Sym_END_sym = NULL; - -static void init_symset_bias(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bias_Sym_START_sym); - bias_Sym_START_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("start")); - wxREGGLOB(bias_Sym_NONE_sym); - bias_Sym_NONE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("none")); - wxREGGLOB(bias_Sym_END_sym); - bias_Sym_END_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("end")); -} - -static int unbundle_symset_bias(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bias_Sym_END_sym) WITH_VAR_STACK(init_symset_bias()); - if (0) { } - else if (v == bias_Sym_START_sym) { READY_TO_RETURN; return Sym_START; } - else if (v == bias_Sym_NONE_sym) { READY_TO_RETURN; return Sym_NONE; } - else if (v == bias_Sym_END_sym) { READY_TO_RETURN; return Sym_END; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bias symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bias(int v) { - if (!bias_Sym_END_sym) init_symset_bias(); - switch (v) { - case Sym_START: return bias_Sym_START_sym; - case Sym_NONE: return bias_Sym_NONE_sym; - case Sym_END: return bias_Sym_END_sym; - default: return NULL; - } -} - - - -static Scheme_Object *caret_wxSNIP_DRAW_NO_CARET_sym = NULL; -static Scheme_Object *caret_wxSNIP_DRAW_SHOW_CARET_sym = NULL; -static Scheme_Object *caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym = NULL; - -static void init_symset_caret(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(caret_wxSNIP_DRAW_NO_CARET_sym); - caret_wxSNIP_DRAW_NO_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("no-caret")); - wxREGGLOB(caret_wxSNIP_DRAW_SHOW_CARET_sym); - caret_wxSNIP_DRAW_SHOW_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("show-caret")); - wxREGGLOB(caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym); - caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("show-inactive-caret")); -} - -static int unbundle_symset_caret(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) WITH_VAR_STACK(init_symset_caret()); - if (0) { } - else if (v == caret_wxSNIP_DRAW_NO_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_NO_CARET; } - else if (v == caret_wxSNIP_DRAW_SHOW_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_SHOW_CARET; } - else if (v == caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_SHOW_INACTIVE_CARET; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "caret symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_caret(int v) { - if (!caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) init_symset_caret(); - switch (v) { - case wxSNIP_DRAW_NO_CARET: return caret_wxSNIP_DRAW_NO_CARET_sym; - case wxSNIP_DRAW_SHOW_CARET: return caret_wxSNIP_DRAW_SHOW_CARET_sym; - case wxSNIP_DRAW_SHOW_INACTIVE_CARET: return caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym; - default: return NULL; - } -} - - - - - -static Scheme_Object *editOp_wxEDIT_UNDO_sym = NULL; -static Scheme_Object *editOp_wxEDIT_REDO_sym = NULL; -static Scheme_Object *editOp_wxEDIT_CLEAR_sym = NULL; -static Scheme_Object *editOp_wxEDIT_CUT_sym = NULL; -static Scheme_Object *editOp_wxEDIT_COPY_sym = NULL; -static Scheme_Object *editOp_wxEDIT_PASTE_sym = NULL; -static Scheme_Object *editOp_wxEDIT_KILL_sym = NULL; -static Scheme_Object *editOp_wxEDIT_INSERT_TEXT_BOX_sym = NULL; -static Scheme_Object *editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym = NULL; -static Scheme_Object *editOp_wxEDIT_INSERT_IMAGE_sym = NULL; -static Scheme_Object *editOp_wxEDIT_SELECT_ALL_sym = NULL; - -static void init_symset_editOp(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(editOp_wxEDIT_UNDO_sym); - editOp_wxEDIT_UNDO_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("undo")); - wxREGGLOB(editOp_wxEDIT_REDO_sym); - editOp_wxEDIT_REDO_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("redo")); - wxREGGLOB(editOp_wxEDIT_CLEAR_sym); - editOp_wxEDIT_CLEAR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("clear")); - wxREGGLOB(editOp_wxEDIT_CUT_sym); - editOp_wxEDIT_CUT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("cut")); - wxREGGLOB(editOp_wxEDIT_COPY_sym); - editOp_wxEDIT_COPY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("copy")); - wxREGGLOB(editOp_wxEDIT_PASTE_sym); - editOp_wxEDIT_PASTE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("paste")); - wxREGGLOB(editOp_wxEDIT_KILL_sym); - editOp_wxEDIT_KILL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("kill")); - wxREGGLOB(editOp_wxEDIT_INSERT_TEXT_BOX_sym); - editOp_wxEDIT_INSERT_TEXT_BOX_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("insert-text-box")); - wxREGGLOB(editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym); - editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("insert-pasteboard-box")); - wxREGGLOB(editOp_wxEDIT_INSERT_IMAGE_sym); - editOp_wxEDIT_INSERT_IMAGE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("insert-image")); - wxREGGLOB(editOp_wxEDIT_SELECT_ALL_sym); - editOp_wxEDIT_SELECT_ALL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("select-all")); -} - -static int unbundle_symset_editOp(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!editOp_wxEDIT_SELECT_ALL_sym) WITH_VAR_STACK(init_symset_editOp()); - if (0) { } - else if (v == editOp_wxEDIT_UNDO_sym) { READY_TO_RETURN; return wxEDIT_UNDO; } - else if (v == editOp_wxEDIT_REDO_sym) { READY_TO_RETURN; return wxEDIT_REDO; } - else if (v == editOp_wxEDIT_CLEAR_sym) { READY_TO_RETURN; return wxEDIT_CLEAR; } - else if (v == editOp_wxEDIT_CUT_sym) { READY_TO_RETURN; return wxEDIT_CUT; } - else if (v == editOp_wxEDIT_COPY_sym) { READY_TO_RETURN; return wxEDIT_COPY; } - else if (v == editOp_wxEDIT_PASTE_sym) { READY_TO_RETURN; return wxEDIT_PASTE; } - else if (v == editOp_wxEDIT_KILL_sym) { READY_TO_RETURN; return wxEDIT_KILL; } - else if (v == editOp_wxEDIT_INSERT_TEXT_BOX_sym) { READY_TO_RETURN; return wxEDIT_INSERT_TEXT_BOX; } - else if (v == editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym) { READY_TO_RETURN; return wxEDIT_INSERT_GRAPHIC_BOX; } - else if (v == editOp_wxEDIT_INSERT_IMAGE_sym) { READY_TO_RETURN; return wxEDIT_INSERT_IMAGE; } - else if (v == editOp_wxEDIT_SELECT_ALL_sym) { READY_TO_RETURN; return wxEDIT_SELECT_ALL; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "editOp symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_editOp(int v) { - if (!editOp_wxEDIT_SELECT_ALL_sym) init_symset_editOp(); - switch (v) { - case wxEDIT_UNDO: return editOp_wxEDIT_UNDO_sym; - case wxEDIT_REDO: return editOp_wxEDIT_REDO_sym; - case wxEDIT_CLEAR: return editOp_wxEDIT_CLEAR_sym; - case wxEDIT_CUT: return editOp_wxEDIT_CUT_sym; - case wxEDIT_COPY: return editOp_wxEDIT_COPY_sym; - case wxEDIT_PASTE: return editOp_wxEDIT_PASTE_sym; - case wxEDIT_KILL: return editOp_wxEDIT_KILL_sym; - case wxEDIT_INSERT_TEXT_BOX: return editOp_wxEDIT_INSERT_TEXT_BOX_sym; - case wxEDIT_INSERT_GRAPHIC_BOX: return editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym; - case wxEDIT_INSERT_IMAGE: return editOp_wxEDIT_INSERT_IMAGE_sym; - case wxEDIT_SELECT_ALL: return editOp_wxEDIT_SELECT_ALL_sym; - default: return NULL; - } -} - - -static Scheme_Object *printMethod_0_sym = NULL; -static Scheme_Object *printMethod_1_sym = NULL; - -static void init_symset_printMethod(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(printMethod_0_sym); - printMethod_0_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("standard")); - wxREGGLOB(printMethod_1_sym); - printMethod_1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("postscript")); -} - -static int unbundle_symset_printMethod(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!printMethod_1_sym) WITH_VAR_STACK(init_symset_printMethod()); - if (0) { } - else if (v == printMethod_0_sym) { READY_TO_RETURN; return 0; } - else if (v == printMethod_1_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "printMethod symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - -static void NoLoadFile(wxMediaBuffer *) -{ -} - -static void NoInsertFile(wxMediaBuffer *) -{ -} - - -#ifndef wx_mac -# define wxBITMAP_TYPE_PICT 101 -#endif - -#define wxBITMAP_TYPE_UNKNOWN 0 -#define wxBITMAP_TYPE_GIF_MASK (wxBITMAP_TYPE_GIF | wxBITMAP_TYPE_MASK) -#define wxBITMAP_TYPE_PNG_MASK (wxBITMAP_TYPE_PNG | wxBITMAP_TYPE_MASK) - -static Scheme_Object *bitmapType_wxBITMAP_TYPE_BMP_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_XBM_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_XPM_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PICT_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_JPEG_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_MASK_sym = NULL; - -static void init_symset_bitmapType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_BMP_sym); - bitmapType_wxBITMAP_TYPE_BMP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bmp")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_sym); - bitmapType_wxBITMAP_TYPE_GIF_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_MASK_sym); - bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif/mask")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_XBM_sym); - bitmapType_wxBITMAP_TYPE_XBM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xbm")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_XPM_sym); - bitmapType_wxBITMAP_TYPE_XPM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xpm")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PICT_sym); - bitmapType_wxBITMAP_TYPE_PICT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pict")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_JPEG_sym); - bitmapType_wxBITMAP_TYPE_JPEG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("jpeg")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_sym); - bitmapType_wxBITMAP_TYPE_PNG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_MASK_sym); - bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png/mask")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_UNKNOWN_sym); - bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_MASK_sym); - bitmapType_wxBITMAP_TYPE_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown/mask")); -} - -static int unbundle_symset_bitmapType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bitmapType_wxBITMAP_TYPE_MASK_sym) WITH_VAR_STACK(init_symset_bitmapType()); - if (0) { } - else if (v == bitmapType_wxBITMAP_TYPE_BMP_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_BMP; } - else if (v == bitmapType_wxBITMAP_TYPE_GIF_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF; } - else if (v == bitmapType_wxBITMAP_TYPE_GIF_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF_MASK; } - else if (v == bitmapType_wxBITMAP_TYPE_XBM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XBM; } - else if (v == bitmapType_wxBITMAP_TYPE_XPM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XPM; } - else if (v == bitmapType_wxBITMAP_TYPE_PICT_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PICT; } - else if (v == bitmapType_wxBITMAP_TYPE_JPEG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_JPEG; } - else if (v == bitmapType_wxBITMAP_TYPE_PNG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG; } - else if (v == bitmapType_wxBITMAP_TYPE_PNG_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG_MASK; } - else if (v == bitmapType_wxBITMAP_TYPE_UNKNOWN_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_UNKNOWN; } - else if (v == bitmapType_wxBITMAP_TYPE_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_MASK; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bitmapType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bitmapType(int v) { - if (!bitmapType_wxBITMAP_TYPE_MASK_sym) init_symset_bitmapType(); - switch (v) { - case wxBITMAP_TYPE_BMP: return bitmapType_wxBITMAP_TYPE_BMP_sym; - case wxBITMAP_TYPE_GIF: return bitmapType_wxBITMAP_TYPE_GIF_sym; - case wxBITMAP_TYPE_GIF_MASK: return bitmapType_wxBITMAP_TYPE_GIF_MASK_sym; - case wxBITMAP_TYPE_XBM: return bitmapType_wxBITMAP_TYPE_XBM_sym; - case wxBITMAP_TYPE_XPM: return bitmapType_wxBITMAP_TYPE_XPM_sym; - case wxBITMAP_TYPE_PICT: return bitmapType_wxBITMAP_TYPE_PICT_sym; - case wxBITMAP_TYPE_JPEG: return bitmapType_wxBITMAP_TYPE_JPEG_sym; - case wxBITMAP_TYPE_PNG: return bitmapType_wxBITMAP_TYPE_PNG_sym; - case wxBITMAP_TYPE_PNG_MASK: return bitmapType_wxBITMAP_TYPE_PNG_MASK_sym; - case wxBITMAP_TYPE_UNKNOWN: return bitmapType_wxBITMAP_TYPE_UNKNOWN_sym; - case wxBITMAP_TYPE_MASK: return bitmapType_wxBITMAP_TYPE_MASK_sym; - default: return NULL; - } -} - - - - - - -/* - X = Not meant for virtual, defined in wxMediaEdit/wxMediaPasteboard - and overloaded there - Y = Virtual, defined in wxMediaEdit/wxMediaPasteboard - Z = Virtual, defined in wxMediaBuffer -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// W are Methods not intended to be overriden by the user, -// but acutally are implemented with virtual - - -// No longer actually in C, but we want them in the editor<%> interface: - - - - - - - - - - - - - - - - - - - - - - - - - -/* : : /DLGORFRAME[3.METHODNAME("editor<%>","print")] */ - - - - - - -class os_wxMediaBuffer : public wxMediaBuffer { - public: - - ~os_wxMediaBuffer(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaBuffer::gcMark() { - wxMediaBuffer::gcMark(); -} -void os_wxMediaBuffer::gcFixup() { - wxMediaBuffer::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaBuffer_class; -static Scheme_Object *os_wxMediaBuffer_interface; - -os_wxMediaBuffer::~os_wxMediaBuffer() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaBufferwxbDCToBuffer(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - void* r; - objscheme_check_valid(os_wxMediaBuffer_class, "dc-location-to-editor-location in editor<%>", n, p); - double x0; - double x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "dc-location-to-editor-location in editor<%>")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "dc-location-to-editor-location in editor<%>")); - - - r = WITH_VAR_STACK(wxbDCToBuffer(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata), x0, x1)); - - - - READY_TO_RETURN; - return ((Scheme_Object *)r); -} - -static Scheme_Object *os_wxMediaBufferwxbBufferToDC(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - void* r; - objscheme_check_valid(os_wxMediaBuffer_class, "editor-location-to-dc-location in editor<%>", n, p); - double x0; - double x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "editor-location-to-dc-location in editor<%>")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "editor-location-to-dc-location in editor<%>")); - - - r = WITH_VAR_STACK(wxbBufferToDC(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata), x0, x1)); - - - - READY_TO_RETURN; - return ((Scheme_Object *)r); -} - -static Scheme_Object *os_wxMediaBufferSetInactiveCaretThreshold(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-inactive-caret-threshold in editor<%>", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+0], "set-inactive-caret-threshold in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetInactiveCaretThreshold(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetInactiveCaretThreshold(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-inactive-caret-threshold in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetInactiveCaretThreshold()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_caret(r)); -} - -static Scheme_Object *os_wxMediaBufferGetFocusSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-focus-snip in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetFocusSnip()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaBufferEndWriteHeaderFooterToFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "end-write-header-footer-to-file in editor<%>", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - long x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "end-write-header-footer-to-file in editor<%>", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+1], "end-write-header-footer-to-file in editor<%>")); - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->EndWriteHeaderFooterToFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferBeginWriteHeaderFooterToFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "begin-write-header-footer-to-file in editor<%>", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - string x1 INIT_NULLED_OUT; - long _x2; - long* x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "begin-write-header-footer-to-file in editor<%>", 0)); - x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "begin-write-header-footer-to-file in editor<%>")); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "begin-write-header-footer-to-file in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "begin-write-header-footer-to-file in editor<%>"", extracting boxed argument"))); - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->BeginWriteHeaderFooterToFile(x0, x1, x2)); - - - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = scheme_make_integer(_x2); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferPrint(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "print in editor<%>", n, p); - Bool x0; - Bool x1; - int x2; - class wxWindow* x3 INIT_NULLED_OUT; - Bool x4; - Bool x5; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x3); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "print in editor<%>")); - } else - x0 = TRUE; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "print in editor<%>")); - } else - x1 = TRUE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(unbundle_symset_printMethod(p[POFFSET+2], "print in editor<%>")); - } else - x2 = 0; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_wxWindow(p[POFFSET+3], "print in editor<%>", 1)); - } else - x3 = NULL; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "print in editor<%>")); - } else - x4 = TRUE; - if (n > (POFFSET+5)) { - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "print in editor<%>")); - } else - x5 = FALSE; - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->Print(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferInsertImage(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "insert-image in editor<%>", n, p); - nxpathname x0 INIT_NULLED_OUT; - int x1; - Bool x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n > (POFFSET+0)) { - x0 = (nxpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_xpathname(p[POFFSET+0], "insert-image in editor<%>")); - } else - x0 = NULL; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_bitmapType(p[POFFSET+1], "insert-image in editor<%>")); - } else - x1 = 0; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "insert-image in editor<%>")); - } else - x2 = FALSE; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "insert-image in editor<%>")); - } else - x3 = TRUE; - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->InsertImage(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferInsertBox(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "insert-box in editor<%>", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(unbundle_symset_bufferType(p[POFFSET+0], "insert-box in editor<%>")); - } else - x0 = wxEDIT_BUFFER; - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->InsertBox(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetFilename(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - npathname r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaBuffer_class, "get-filename in editor<%>", n, p); - Bool _x0; - Bool* x0 = &_x0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n > (POFFSET+0)) { - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-filename in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_bool(sbox_tmp, "get-filename in editor<%>"", extracting boxed argument"))); - } else - x0 = NULL; - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetFilename(x0)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = (_x0 ? scheme_true : scheme_false); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_pathname((char *)r)); -} - -static Scheme_Object *os_wxMediaBufferModified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "is-modified? in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->Modified()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferIsLocked(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "is-locked? in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->IsLocked()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferLock(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "lock in editor<%>", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "lock in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->Lock(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferSetCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-cursor in editor<%>", n, p); - class wxCursor* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxCursor(p[POFFSET+0], "set-cursor in editor<%>", 1)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "set-cursor in editor<%>")); - } else - x1 = TRUE; - - if (x0 && !x0->Ok()) { READY_TO_RETURN; return scheme_void; } - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetCursor(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetPasteTextOnly(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-paste-text-only in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetPasteTextOnly()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferSetPasteTextOnly(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-paste-text-only in editor<%>", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-paste-text-only in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetPasteTextOnly(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetLoadOverwritesStyles(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-load-overwrites-styles in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetLoadOverwritesStyles()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferSetLoadOverwritesStyles(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-load-overwrites-styles in editor<%>", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-load-overwrites-styles in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetLoadOverwritesStyles(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferSetStyleList(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-style-list in editor<%>", n, p); - class wxStyleList* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleList(p[POFFSET+0], "set-style-list in editor<%>", 0)); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetStyleList(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetStyleList(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyleList* r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-style-list in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetStyleList()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyleList(r)); -} - -static Scheme_Object *os_wxMediaBufferGetKeymap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxKeymap* r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-keymap in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetKeymap()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxKeymap(r)); -} - -static Scheme_Object *os_wxMediaBufferSetKeymap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-keymap in editor<%>", n, p); - class wxKeymap* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeymap(p[POFFSET+0], "set-keymap in editor<%>", 1)); - } else - x0 = NULL; - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetKeymap(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferCanEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "can-do-edit-operation? in editor<%>", n, p); - int x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "can-do-edit-operation? in editor<%>")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "can-do-edit-operation? in editor<%>")); - } else - x1 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->CanEdit(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferDoEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "do-edit-operation in editor<%>", n, p); - int x0; - Bool x1; - ExactLong x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "do-edit-operation in editor<%>")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "do-edit-operation in editor<%>")); - } else - x1 = TRUE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+2], "do-edit-operation in editor<%>")); - } else - x2 = 0; - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->DoEdit(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetMaxUndoHistory(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-max-undo-history in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetMaxUndoHistory()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaBufferSetMaxUndoHistory(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-max-undo-history in editor<%>", n, p); - long x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_integer(p[POFFSET+0], "forever", "set-max-undo-history in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetMaxUndoHistory(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferAddSchemeUndo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "add-undo in editor<%>", n, p); - UNKNOWN_OBJ x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = ((void *)p[POFFSET+0]); - - WITH_VAR_STACK(scheme_check_proc_arity(METHODNAME("editor<%>","add-undo"), 0, POFFSET, n, p)); - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->AddSchemeUndo(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferClearUndos(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "clear-undos in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->ClearUndos()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferRedo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "redo in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->Redo()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferUndo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "undo in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->Undo()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferSelectAll(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "select-all in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SelectAll()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferClear(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "clear in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->Clear()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetViewSize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "get-view-size in editor<%>", n, p); - nndouble _x0; - nndouble* x0 = &_x0; - nndouble _x1; - nndouble* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-view-size in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view-size in editor<%>"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-view-size in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-view-size in editor<%>"", extracting boxed argument"))); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetViewSize(x0, x1)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetDC(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxDC* r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-dc in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetDC()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxDC(r)); -} - -static Scheme_Object *os_wxMediaBufferLocalToGlobal(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "local-to-global in editor<%>", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "local-to-global in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "local-to-global in editor<%>"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "local-to-global in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "local-to-global in editor<%>"", extracting boxed argument"))); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->LocalToGlobal(x0, x1)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGlobalToLocal(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "global-to-local in editor<%>", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "global-to-local in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "global-to-local in editor<%>"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "global-to-local in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "global-to-local in editor<%>"", extracting boxed argument"))); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GlobalToLocal(x0, x1)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferIsLockedForFlow(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "locked-for-flow? in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->IsLockedForFlow()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferIsLockedForWrite(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "locked-for-write? in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->IsLockedForWrite()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferIsLockedForRead(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "locked-for-read? in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->IsLockedForRead()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferSetAdmin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-admin in editor<%>", n, p); - class wxMediaAdmin* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaAdmin(p[POFFSET+0], "set-admin in editor<%>", 1)); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetAdmin(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetAdmin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaAdmin* r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-admin in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetAdmin()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaAdmin(r)); -} - -static Scheme_Object *os_wxMediaBufferPrintToDC(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "print-to-dc in editor<%>", n, p); - class wxDC* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "print-to-dc in editor<%>", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("editor<%>","print-to-dc"), "bad device context: ", p[POFFSET+0])); - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->PrintToDC(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferFindScrollLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaBuffer_class, "find-scroll-line in editor<%>", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-scroll-line in editor<%>")); - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->FindScrollLine(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaBufferNumScrollLines(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaBuffer_class, "num-scroll-lines in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->NumScrollLines()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaBufferScrollLineLocation(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaBuffer_class, "scroll-line-location in editor<%>", n, p); - long x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "scroll-line-location in editor<%>")); - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->ScrollLineLocation(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaBufferGetSnipLocation(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-snip-location in editor<%>", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double _x1; - double* x1 = &_x1; - double _x2; - double* x2 = &_x2; - Bool x3; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "get-snip-location in editor<%>", 0)); - if (n > (POFFSET+1)) { - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-snip-location in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-snip-location in editor<%>"", extracting boxed argument"))); - } else - x1 = NULL; - if (n > (POFFSET+2)) { - if (XC_SCHEME_NULLP(p[POFFSET+2])) - x2 = NULL; - else - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+2], "get-snip-location in editor<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-snip-location in editor<%>"", extracting boxed argument"))); - } else - x2 = NULL; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "get-snip-location in editor<%>")); - } else - x3 = FALSE; - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetSnipLocation(x0, x1, x2, x3)); - - - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2) && !XC_SCHEME_NULLP(p[POFFSET+2])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferLocationsUpToDate(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "locations-computed? in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->LocationsUpToDate()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferInEditSequence(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "in-edit-sequence? in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->InEditSequence()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferRefreshDelayed(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "refresh-delayed? in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->RefreshDelayed()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaBufferEndEditSequence(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "end-edit-sequence in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->EndEditSequence()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferBeginEditSequence(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "begin-edit-sequence in editor<%>", n, p); - Bool x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "begin-edit-sequence in editor<%>")); - } else - x0 = TRUE; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "begin-edit-sequence in editor<%>")); - } else - x1 = TRUE; - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->BeginEditSequence(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferStyleHasChanged(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "style-has-changed in editor<%>", n, p); - class wxStyle* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "style-has-changed in editor<%>", 1)); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->StyleHasChanged(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferSetMinHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-min-height in editor<%>", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+0], "none", "set-min-height in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetMinHeight(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferSetMaxHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-max-height in editor<%>", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+0], "none", "set-max-height in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetMaxHeight(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetMinHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-min-height in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetMinHeight()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_nonnegative_symbol_double(r, "none")); -} - -static Scheme_Object *os_wxMediaBufferGetMaxHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-max-height in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetMaxHeight()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_nonnegative_symbol_double(r, "none")); -} - -static Scheme_Object *os_wxMediaBufferSetMinWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-min-width in editor<%>", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+0], "none", "set-min-width in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetMinWidth(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferSetMaxWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "set-max-width in editor<%>", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+0], "none", "set-max-width in editor<%>")); - - - WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SetMaxWidth(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferGetMinWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-min-width in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetMinWidth()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_nonnegative_symbol_double(r, "none")); -} - -static Scheme_Object *os_wxMediaBufferGetMaxWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaBuffer_class, "get-max-width in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->GetMaxWidth()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_nonnegative_symbol_double(r, "none")); -} - -static Scheme_Object *os_wxMediaBufferNoInsertFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "insert-file in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(NoInsertFile(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata))); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferNoLoadFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaBuffer_class, "load-file in editor<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(NoLoadFile(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata))); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaBufferInsertPort(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxMediaBuffer_class, "insert-port in editor<%>", n, p); - Scheme_Object* x0 INIT_NULLED_OUT; - int x1; - Bool x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (SCHEME_INPUT_PORTP(p[POFFSET+0]) ? p[POFFSET+0] : (scheme_wrong_type(METHODNAME("editor<%>","insert-port"), "input port", -1, 1, &p[POFFSET+0]), (Scheme_Object *)NULL)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "insert-port in editor<%>")); - } else - x1 = wxMEDIA_FF_GUESS; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "insert-port in editor<%>")); - } else - x2 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->InsertPort(x0, x1, x2)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_fileType(r)); -} - -static Scheme_Object *os_wxMediaBufferSavePort(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaBuffer_class, "save-port in editor<%>", n, p); - Scheme_Object* x0 INIT_NULLED_OUT; - int x1; - Bool x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (SCHEME_OUTPUT_PORTP(p[POFFSET+0]) ? p[POFFSET+0] : (scheme_wrong_type(METHODNAME("editor<%>","save-port"), "output port", -1, 1, &p[POFFSET+0]), (Scheme_Object *)NULL)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "save-port in editor<%>")); - } else - x1 = wxMEDIA_FF_SAME; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "save-port in editor<%>")); - } else - x2 = TRUE; - - - r = WITH_VAR_STACK(((wxMediaBuffer *)((Scheme_Class_Object *)p[0])->primdata)->SavePort(x0, x1, x2)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -void objscheme_setup_wxMediaBuffer(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaBuffer_class); - wxREGGLOB(os_wxMediaBuffer_interface); - - os_wxMediaBuffer_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor%", "object%", NULL, 65)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "dc-location-to-editor-location" " method", (Scheme_Method_Prim *)os_wxMediaBufferwxbDCToBuffer, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "editor-location-to-dc-location" " method", (Scheme_Method_Prim *)os_wxMediaBufferwxbBufferToDC, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-inactive-caret-threshold" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetInactiveCaretThreshold, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-inactive-caret-threshold" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetInactiveCaretThreshold, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-focus-snip" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetFocusSnip, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "end-write-header-footer-to-file" " method", (Scheme_Method_Prim *)os_wxMediaBufferEndWriteHeaderFooterToFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "begin-write-header-footer-to-file" " method", (Scheme_Method_Prim *)os_wxMediaBufferBeginWriteHeaderFooterToFile, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "print" " method", (Scheme_Method_Prim *)os_wxMediaBufferPrint, 0, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "insert-image" " method", (Scheme_Method_Prim *)os_wxMediaBufferInsertImage, 0, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "insert-box" " method", (Scheme_Method_Prim *)os_wxMediaBufferInsertBox, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-filename" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetFilename, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "is-modified?" " method", (Scheme_Method_Prim *)os_wxMediaBufferModified, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "is-locked?" " method", (Scheme_Method_Prim *)os_wxMediaBufferIsLocked, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "lock" " method", (Scheme_Method_Prim *)os_wxMediaBufferLock, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-cursor" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetCursor, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-paste-text-only" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetPasteTextOnly, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-paste-text-only" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetPasteTextOnly, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-load-overwrites-styles" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetLoadOverwritesStyles, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-load-overwrites-styles" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetLoadOverwritesStyles, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-style-list" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetStyleList, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-style-list" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetStyleList, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-keymap" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetKeymap, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-keymap" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetKeymap, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "can-do-edit-operation?" " method", (Scheme_Method_Prim *)os_wxMediaBufferCanEdit, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "do-edit-operation" " method", (Scheme_Method_Prim *)os_wxMediaBufferDoEdit, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-max-undo-history" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetMaxUndoHistory, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-max-undo-history" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetMaxUndoHistory, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "add-undo" " method", (Scheme_Method_Prim *)os_wxMediaBufferAddSchemeUndo, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "clear-undos" " method", (Scheme_Method_Prim *)os_wxMediaBufferClearUndos, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "redo" " method", (Scheme_Method_Prim *)os_wxMediaBufferRedo, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "undo" " method", (Scheme_Method_Prim *)os_wxMediaBufferUndo, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "select-all" " method", (Scheme_Method_Prim *)os_wxMediaBufferSelectAll, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "clear" " method", (Scheme_Method_Prim *)os_wxMediaBufferClear, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-view-size" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetViewSize, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-dc" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetDC, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "local-to-global" " method", (Scheme_Method_Prim *)os_wxMediaBufferLocalToGlobal, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "global-to-local" " method", (Scheme_Method_Prim *)os_wxMediaBufferGlobalToLocal, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "locked-for-flow?" " method", (Scheme_Method_Prim *)os_wxMediaBufferIsLockedForFlow, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "locked-for-write?" " method", (Scheme_Method_Prim *)os_wxMediaBufferIsLockedForWrite, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "locked-for-read?" " method", (Scheme_Method_Prim *)os_wxMediaBufferIsLockedForRead, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-admin" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetAdmin, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-admin" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetAdmin, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "print-to-dc" " method", (Scheme_Method_Prim *)os_wxMediaBufferPrintToDC, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "find-scroll-line" " method", (Scheme_Method_Prim *)os_wxMediaBufferFindScrollLine, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "num-scroll-lines" " method", (Scheme_Method_Prim *)os_wxMediaBufferNumScrollLines, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "scroll-line-location" " method", (Scheme_Method_Prim *)os_wxMediaBufferScrollLineLocation, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-snip-location" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetSnipLocation, 1, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "locations-computed?" " method", (Scheme_Method_Prim *)os_wxMediaBufferLocationsUpToDate, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "in-edit-sequence?" " method", (Scheme_Method_Prim *)os_wxMediaBufferInEditSequence, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "refresh-delayed?" " method", (Scheme_Method_Prim *)os_wxMediaBufferRefreshDelayed, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "end-edit-sequence" " method", (Scheme_Method_Prim *)os_wxMediaBufferEndEditSequence, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "begin-edit-sequence" " method", (Scheme_Method_Prim *)os_wxMediaBufferBeginEditSequence, 0, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "style-has-changed" " method", (Scheme_Method_Prim *)os_wxMediaBufferStyleHasChanged, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-min-height" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetMinHeight, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-max-height" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetMaxHeight, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-min-height" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetMinHeight, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-max-height" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetMaxHeight, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-min-width" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetMinWidth, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "set-max-width" " method", (Scheme_Method_Prim *)os_wxMediaBufferSetMaxWidth, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-min-width" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetMinWidth, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "get-max-width" " method", (Scheme_Method_Prim *)os_wxMediaBufferGetMaxWidth, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "insert-file" " method", (Scheme_Method_Prim *)os_wxMediaBufferNoInsertFile, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "load-file" " method", (Scheme_Method_Prim *)os_wxMediaBufferNoLoadFile, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "insert-port" " method", (Scheme_Method_Prim *)os_wxMediaBufferInsertPort, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaBuffer_class, "save-port" " method", (Scheme_Method_Prim *)os_wxMediaBufferSavePort, 1, 3)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaBuffer_class)); - - os_wxMediaBuffer_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxMediaBuffer_class, "editor" "<%>")); - - WITH_VAR_STACK(objscheme_add_global_interface(os_wxMediaBuffer_interface, "editor" "<%>", env)); - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMediaBuffer, wxTYPE_MEDIA_BUFFER)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaBuffer(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaBuffer_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor% object or " XC_NULL_STR: "editor% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_MEDIA_BUFFER) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaBuffer_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaBuffer(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaBuffer *)o->primdata; - else - return (wxMediaBuffer *)o->primdata; -} - - - - - - - - - -static Scheme_Object *wxMediaGlobalwxGetTheBufferDataClassList(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBufferDataClassList* r; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(wxGetTheBufferDataClassList()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferDataClassList(r)); -} - -static Scheme_Object *wxMediaGlobalwxGetTheSnipClassList(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnipClassList* r; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(wxGetTheSnipClassList()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnipClassList(r)); -} - -static Scheme_Object *wxMediaGlobalwxMediaSetXSelectionMode(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[0+0], "editor-set-x-selection-mode in editor%")); - - - WITH_VAR_STACK(wxMediaSetXSelectionMode(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *wxMediaGlobalwxAddMediaPasteboardFunctions(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxKeymap* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeymap(p[0+0], "add-pasteboard-keymap-functions in editor%", 0)); - - - WITH_VAR_STACK(wxAddMediaPasteboardFunctions(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *wxMediaGlobalwxAddMediaEditorFunctions(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxKeymap* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeymap(p[0+0], "add-text-keymap-functions in editor%", 0)); - - - WITH_VAR_STACK(wxAddMediaEditorFunctions(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *wxMediaGlobalwxAddMediaBufferFunctions(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxKeymap* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeymap(p[0+0], "add-editor-keymap-functions in editor%", 0)); - - - WITH_VAR_STACK(wxAddMediaBufferFunctions(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *wxMediaGlobalwxWriteMediaGlobalFooter(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[0+0], "write-editor-global-footer in editor%", 0)); - - - r = WITH_VAR_STACK(wxWriteMediaGlobalFooter(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *wxMediaGlobalwxWriteMediaGlobalHeader(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[0+0], "write-editor-global-header in editor%", 0)); - - - r = WITH_VAR_STACK(wxWriteMediaGlobalHeader(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *wxMediaGlobalwxReadMediaGlobalFooter(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[0+0], "read-editor-global-footer in editor%", 0)); - - - r = WITH_VAR_STACK(wxReadMediaGlobalFooter(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *wxMediaGlobalwxReadMediaGlobalHeader(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[0+0], "read-editor-global-header in editor%", 0)); - - - r = WITH_VAR_STACK(wxReadMediaGlobalHeader(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *wxMediaGlobalwxReadMediaVersion(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - class wxMediaStreamInBase* x1 INIT_NULLED_OUT; - Bool x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[0+0], "read-editor-version in editor%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamInBase(p[0+1], "read-editor-version in editor%", 0)); - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[0+2], "read-editor-version in editor%")); - if (n > (0+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[0+3], "read-editor-version in editor%")); - } else - x3 = TRUE; - - - r = WITH_VAR_STACK(wxReadMediaVersion(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *wxMediaGlobalwxWriteMediaVersion(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - class wxMediaStreamOutBase* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[0+0], "write-editor-version in editor%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOutBase(p[0+1], "write-editor-version in editor%", 0)); - - - r = WITH_VAR_STACK(wxWriteMediaVersion(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *wxMediaGlobalwxSetMediaPrintMargin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong x0; - nnlong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[0+0], "set-editor-print-margin in editor%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[0+1], "set-editor-print-margin in editor%")); - - - WITH_VAR_STACK(wxSetMediaPrintMargin(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *wxMediaGlobalwxGetMediaPrintMargin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong _x0; - nnlong* x0 = &_x0; - nnlong _x1; - nnlong* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[0+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[0+0], "get-editor-print-margin in editor%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-editor-print-margin in editor%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[0+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[0+1], "get-editor-print-margin in editor%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-editor-print-margin in editor%"", extracting boxed argument"))); - - - WITH_VAR_STACK(wxGetMediaPrintMargin(x0, x1)); - - - if (n > (0+0) && !XC_SCHEME_NULLP(p[0+0])) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[0+0], sbv_)); } - if (n > (0+1) && !XC_SCHEME_NULLP(p[0+1])) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[0+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -void objscheme_setup_wxMediaGlobal(Scheme_Env *env) -{ - Scheme_Object *functmp INIT_NULLED_OUT; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxGetTheBufferDataClassList, "get-the-editor-data-class-list", 0, 0)); - WITH_VAR_STACK(scheme_install_xc_global("get-the-editor-data-class-list", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxGetTheSnipClassList, "get-the-snip-class-list", 0, 0)); - WITH_VAR_STACK(scheme_install_xc_global("get-the-snip-class-list", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxMediaSetXSelectionMode, "editor-set-x-selection-mode", 1, 1)); - WITH_VAR_STACK(scheme_install_xc_global("editor-set-x-selection-mode", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxAddMediaPasteboardFunctions, "add-pasteboard-keymap-functions", 1, 1)); - WITH_VAR_STACK(scheme_install_xc_global("add-pasteboard-keymap-functions", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxAddMediaEditorFunctions, "add-text-keymap-functions", 1, 1)); - WITH_VAR_STACK(scheme_install_xc_global("add-text-keymap-functions", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxAddMediaBufferFunctions, "add-editor-keymap-functions", 1, 1)); - WITH_VAR_STACK(scheme_install_xc_global("add-editor-keymap-functions", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxWriteMediaGlobalFooter, "write-editor-global-footer", 1, 1)); - WITH_VAR_STACK(scheme_install_xc_global("write-editor-global-footer", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxWriteMediaGlobalHeader, "write-editor-global-header", 1, 1)); - WITH_VAR_STACK(scheme_install_xc_global("write-editor-global-header", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxReadMediaGlobalFooter, "read-editor-global-footer", 1, 1)); - WITH_VAR_STACK(scheme_install_xc_global("read-editor-global-footer", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxReadMediaGlobalHeader, "read-editor-global-header", 1, 1)); - WITH_VAR_STACK(scheme_install_xc_global("read-editor-global-header", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxReadMediaVersion, "read-editor-version", 3, 4)); - WITH_VAR_STACK(scheme_install_xc_global("read-editor-version", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxWriteMediaVersion, "write-editor-version", 2, 2)); - WITH_VAR_STACK(scheme_install_xc_global("write-editor-version", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxSetMediaPrintMargin, "set-editor-print-margin", 2, 2)); - WITH_VAR_STACK(scheme_install_xc_global("set-editor-print-margin", functmp, env)); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxMediaGlobalwxGetMediaPrintMargin, "get-editor-print-margin", 2, 2)); - WITH_VAR_STACK(scheme_install_xc_global("get-editor-print-margin", functmp, env)); - READY_TO_RETURN; -} - - -/* Called from plt/src/mred/wxme/wx_cgrec.cxx */ -int wxsSchemeUndo(void *f) -{ - Scheme_Object *v = scheme_apply((Scheme_Object *)f, 0, NULL); - return SCHEME_TRUEP(v); -} diff --git a/src/mred/wxs/wxs_medi.h b/src/mred/wxs/wxs_medi.h deleted file mode 100644 index fbb341d82d..0000000000 --- a/src/mred/wxs/wxs_medi.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef WXS_SETUP_ONLY -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxWindow *objscheme_unbundle_wxWindow(Scheme_Object *, const char *, int); -extern class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *, const char *, int); -extern class wxStyleList *objscheme_unbundle_wxStyleList(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyleList(class wxStyleList *); -extern Scheme_Object *objscheme_bundle_wxKeymap(class wxKeymap *); -extern class wxKeymap *objscheme_unbundle_wxKeymap(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern class wxMediaAdmin *objscheme_unbundle_wxMediaAdmin(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxMediaAdmin(class wxMediaAdmin *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxMediaBuffer(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaBuffer(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *realobj); -class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxBufferDataClassList(class wxBufferDataClassList *); -extern Scheme_Object *objscheme_bundle_wxSnipClassList(class wxSnipClassList *); -extern class wxKeymap *objscheme_unbundle_wxKeymap(Scheme_Object *, const char *, int); -extern class wxKeymap *objscheme_unbundle_wxKeymap(Scheme_Object *, const char *, int); -extern class wxKeymap *objscheme_unbundle_wxKeymap(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamInBase *objscheme_unbundle_wxMediaStreamInBase(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamOutBase *objscheme_unbundle_wxMediaStreamOutBase(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxMediaGlobal(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -#endif diff --git a/src/mred/wxs/wxs_medi.xc b/src/mred/wxs/wxs_medi.xc deleted file mode 100644 index a1754a2251..0000000000 --- a/src/mred/wxs/wxs_medi.xc +++ /dev/null @@ -1,223 +0,0 @@ - -@INCLUDE prefix.xci - -#include "wx_media.h" - -@INCLUDE wxs.xci - -@HEADER - -static void *wxbBufferToDC(wxMediaBuffer *b, double x, double y) -{ - Scheme_Object *a[2]; - void *r; - SETUP_VAR_STACK(3); - VAR_STACK_PUSH_ARRAY(0, a, 2); - - a[0] = a[1] = NULL; - - WITH_VAR_STACK(b->LocalToGlobal(&x, &y)); - - a[0] = WITH_VAR_STACK(objscheme_bundle_double(x)); - a[1] = WITH_VAR_STACK(objscheme_bundle_double(y)); - - r = WITH_VAR_STACK(scheme_values(2, a)); - READY_TO_RETURN; - return r; -} - -static void *wxbDCToBuffer(wxMediaBuffer *b, double x, double y) -{ - Scheme_Object *a[2]; - void *r; - SETUP_VAR_STACK(3); - VAR_STACK_PUSH_ARRAY(0, a, 2); - - a[0] = a[1] = NULL; - - WITH_VAR_STACK(b->GlobalToLocal(&x, &y)); - - a[0] = WITH_VAR_STACK(objscheme_bundle_double(x)); - a[1] = WITH_VAR_STACK(objscheme_bundle_double(y)); - - r = WITH_VAR_STACK(scheme_values(2, a)); - READY_TO_RETURN; - return r; -} - -@MACRO rNULL = return NULL; -@MACRO rFALSE = return FALSE; -@MACRO rZERO = return 0; - -@MACRO ubiPort[who] = (SCHEME_INPUT_PORTP({x}) ? {x} : (scheme_wrong_type(METHODNAME("editor<%>",), "input port", -1, 1, &{x}), (Scheme_Object *)NULL)) -@MACRO ciPort = SCHEME_INPUT_PORTP({x}) -@MACRO uboPort[who] = (SCHEME_OUTPUT_PORTP({x}) ? {x} : (scheme_wrong_type(METHODNAME("editor<%>",), "output port", -1, 1, &{x}), (Scheme_Object *)NULL)) -@MACRO coPort = SCHEME_OUTPUT_PORTP({x}) - -@INCLUDE wxs_eds.xci - -@INCLUDE wxs_eop.xci - -@BEGINSYMBOLS printMethod > ONE > PRED BUNDLE -@SYM "standard" : 0 -@SYM "postscript" : 1 -@ENDSYMBOLS - -static void NoLoadFile(wxMediaBuffer *) -{ -} - -static void NoInsertFile(wxMediaBuffer *) -{ -} - -@INCLUDE wxs_bmt.xci - -@CLASSBASE wxMediaBuffer "editor" : "object" / nofnl -@INTERFACE "editor" - -@CLASSID wxTYPE_MEDIA_BUFFER - -@SETMARK X = p -@SETMARK Y = p -@SETMARK Z = p -@INCLUDE wxs_mbuf.xci - -// W are Methods not intended to be overriden by the user, -// but acutally are implemented with virtual -@SETMARK W = D - -@ W "save-port" : bool SavePort(Scheme_Object[]//uboPort["save-port"]/coPort///push,SYM[fileType]=wxMEDIA_FF_SAME,bool=TRUE); -@ W "insert-port" : SYM[fileType] InsertPort(Scheme_Object[]//ubiPort["insert-port"]/ciPort///push,SYM[fileType]=wxMEDIA_FF_GUESS,bool=TRUE); <> port - -// No longer actually in C, but we want them in the editor<%> interface: -@ m "load-file" : void NoLoadFile() -@ m "insert-file" : void NoInsertFile() - -@ W "get-max-width" : nnfs[none] GetMaxWidth(); : : : : XrZERO -@ W "get-min-width" : nnfs[none] GetMinWidth(); : : : : XrZERO -@ W "set-max-width" : void SetMaxWidth(nnfs[none]); -@ W "set-min-width" : void SetMinWidth(nnfs[none]); -@ W "get-max-height" : nnfs[none] GetMaxHeight(); : : : : XrZERO -@ W "get-min-height" : nnfs[none] GetMinHeight(); : : : : XrZERO -@ W "set-max-height" : void SetMaxHeight(nnfs[none]); -@ W "set-min-height" : void SetMinHeight(nnfs[none]); - -@ W "style-has-changed" : void StyleHasChanged(wxStyle^); - -@ W "begin-edit-sequence" : void BeginEditSequence(bool=TRUE,bool=TRUE); -@ W "end-edit-sequence" : void EndEditSequence(); -@ W "refresh-delayed?" : bool RefreshDelayed(); -@ W "in-edit-sequence?" : bool InEditSequence(); -@ W "locations-computed?" : bool LocationsUpToDate(); - -@ W "get-snip-location" : bool GetSnipLocation(wxSnip!,double?=NULL,double?=NULL,bool=FALSE); : : : : XrZERO - -@ W "scroll-line-location" : double ScrollLineLocation(long); : : : : XrZERO -@ W "num-scroll-lines" : long NumScrollLines(); : : : : XrZERO -@ W "find-scroll-line" : long FindScrollLine(double); : : : : XrZERO - -@ W "print-to-dc" : void PrintToDC(wxDC!); : : /CHECKDCOK[0.METHODNAME("editor<%>","print-to-dc")] - -@ W "get-admin" : wxMediaAdmin^ GetAdmin(); : : : rNULL -@ W "set-admin" : void SetAdmin(wxMediaAdmin^); - -@ W "locked-for-read?" : bool IsLockedForRead(); -@ W "locked-for-write?" : bool IsLockedForWrite(); -@ W "locked-for-flow?" : bool IsLockedForFlow(); - -@ "global-to-local" : void GlobalToLocal(double?,double?); -@ "local-to-global" : void LocalToGlobal(double?,double?); - -@ "get-dc" : wxDC^ GetDC(); -@ "get-view-size" : void GetViewSize(nndouble?,nndouble?); - -@ "clear" : void Clear(); -@ "select-all" : void SelectAll(); - -@ "undo" : void Undo(); -@ "redo": void Redo() -@ "clear-undos" : void ClearUndos(); - -@MACRO ubUndoer = ((void *){x}) -@MACRO CHECKUNDOER = WITH_VAR_STACK(scheme_check_proc_arity(METHODNAME("editor<%>","add-undo"), 0, POFFSET, n, p)); - -@ "add-undo" : void AddSchemeUndo(UNKNOWN_OBJ//ubUndoer////push); : : /CHECKUNDOER - -@ "set-max-undo-history" : void SetMaxUndoHistory(nnls[forever]); -@ "get-max-undo-history" : int GetMaxUndoHistory(); - -@ "do-edit-operation" : void DoEdit(SYM[editOp],bool=TRUE,ExactLong=0); -@ "can-do-edit-operation?" : bool CanEdit(SYM[editOp],bool=TRUE); - -@ "set-keymap" : void SetKeymap(wxKeymap^=NULL); -@ "get-keymap" : wxKeymap^ GetKeymap(); - -@ "get-style-list" : wxStyleList! GetStyleList(); -@ "set-style-list" : void SetStyleList(wxStyleList!); - -@ "set-load-overwrites-styles" : void SetLoadOverwritesStyles(bool) -@ "get-load-overwrites-styles" : bool GetLoadOverwritesStyles(); - -@ "set-paste-text-only" : void SetPasteTextOnly(bool) -@ "get-paste-text-only" : bool GetPasteTextOnly(); - -@ "set-cursor" : void SetCursor(wxCursor^,bool=TRUE); : : /CHECKVOIDABLEOK[0] - -@ "lock" : void Lock(bool); -@ "is-locked?" : bool IsLocked(); -@ "is-modified?" : bool Modified(); - -@ "get-filename" : npathname GetFilename(bool?=NULL); - -@ "insert-box" : void InsertBox(SYM[bufferType]=wxEDIT_BUFFER); -@ "insert-image" : void InsertImage(nxpathname=NULL,SYM[bitmapType]=0,bool=FALSE,bool=TRUE); - -@ "print" : void Print(bool=TRUE,bool=TRUE,SYM[printMethod]=0,wxWindow^=NULL,bool=TRUE,bool=FALSE); -/* : : /DLGORFRAME[3.METHODNAME("editor<%>","print")] */ - -@ "begin-write-header-footer-to-file" : bool BeginWriteHeaderFooterToFile(wxMediaStreamOut!,string,long*); -@ "end-write-header-footer-to-file" : bool EndWriteHeaderFooterToFile(wxMediaStreamOut!,long); - -@ "get-focus-snip" : wxSnip^ GetFocusSnip(); - -@ "get-inactive-caret-threshold" : SYM[caret] GetInactiveCaretThreshold(); -@ "set-inactive-caret-threshold" : void SetInactiveCaretThreshold(SYM[caret]); - -@MACRO bundleAny = ((Scheme_Object *){x}) - -@ m "editor-location-to-dc-location" : void*/bundleAny wxbBufferToDC(double, double); -@ m "dc-location-to-editor-location" : void*/bundleAny wxbDCToBuffer(double, double); - -@END - -@GLOBAL wxMediaGlobal - -@ "get-editor-print-margin" : void wxGetMediaPrintMargin(nnlong?,nnlong?); -@ "set-editor-print-margin" : void wxSetMediaPrintMargin(nnlong,nnlong); - -@ "write-editor-version" : bool wxWriteMediaVersion(wxMediaStreamOut!, wxMediaStreamOutBase!); -@ "read-editor-version" : bool wxReadMediaVersion(wxMediaStreamIn!, wxMediaStreamInBase!, bool, bool=TRUE); - -@ "read-editor-global-header" : bool wxReadMediaGlobalHeader(wxMediaStreamIn!); -@ "read-editor-global-footer" : bool wxReadMediaGlobalFooter(wxMediaStreamIn!); -@ "write-editor-global-header" : bool wxWriteMediaGlobalHeader(wxMediaStreamOut!); -@ "write-editor-global-footer" : bool wxWriteMediaGlobalFooter(wxMediaStreamOut!); - -@ "add-editor-keymap-functions" : void wxAddMediaBufferFunctions(wxKeymap!); -@ "add-text-keymap-functions" : void wxAddMediaEditorFunctions(wxKeymap!); -@ "add-pasteboard-keymap-functions" : void wxAddMediaPasteboardFunctions(wxKeymap!); - -@ "editor-set-x-selection-mode" : void wxMediaSetXSelectionMode(bool); - -@ "get-the-snip-class-list" : wxSnipClassList! wxGetTheSnipClassList() -@ "get-the-editor-data-class-list" : wxBufferDataClassList! wxGetTheBufferDataClassList() - -@END - -/* Called from plt/src/mred/wxme/wx_cgrec.cxx */ -int wxsSchemeUndo(void *f) -{ - Scheme_Object *v = scheme_apply((Scheme_Object *)f, 0, NULL); - return SCHEME_TRUEP(v); -} diff --git a/src/mred/wxs/wxs_mio.cxx b/src/mred/wxs/wxs_mio.cxx deleted file mode 100644 index fc75ec6cbe..0000000000 --- a/src/mred/wxs/wxs_mio.cxx +++ /dev/null @@ -1,2221 +0,0 @@ -/* DO NOT EDIT THIS FILE. */ -/* This file was generated by xctocc from "wxs_mio.xc". */ - - -#if defined(_MSC_VER) -# include "wx.h" -#endif -#if defined(OS_X) -# include "common.h" -#endif - -#include "wx_obj.h" -#include "wx_medio.h" - - - - -#ifdef wx_x -# define BM_SELECTED(map) ((map)->selectedTo) -#endif -#if defined(wx_mac) || defined(wx_msw) -# define BM_SELECTED(map) ((map)->selectedInto) -#endif -# define BM_IN_USE(map) ((map)->selectedIntoDC) - - - - -#define ESCAPE_NO_RET_VAL /*empty*/ - - -#include "wxscheme.h" -#include "wxs_mio.h" - -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - - -#undef l_ADDRESS -#undef l_DEREF -#undef l_TEST -#undef l_POINT -#undef l_TYPE -#undef l_LIST_ITEM_BUNDLE -#undef l_LIST_ITEM_UNBUNDLE -#undef l_MAKE_LIST -#undef l_MAKE_ARRAY -#undef l_EXTRA -#undef l_TERMINATE -#undef l_COPY -#undef l_OKTEST -#undef l_INTTYPE - -#define l_ADDRESS -#define l_DEREF -#define l_NEWATOMIC (UseGC) -#define l_NULLOK 0 -#define l_TEST -#define l_POINT -#define l_EXTRA 0 -#define l_TERMINATE -#define l_COPY l_COPYDEST=l_COPYSRC; -#define l_OKTEST -#define l_INTTYPE long -#define l_DIRECTMALLOC 0 - -#define l_TYPE char -#define l_LIST_ITEM_BUNDLE objscheme_bundle_char -#define l_LIST_ITEM_UNBUNDLE objscheme_unbundle_char -#define l_MAKE_LIST __MakecharList -#define l_MAKE_ARRAY __MakecharArray - - - - - -static Scheme_Object *l_MAKE_LIST(l_TYPE l_POINT *f, l_INTTYPE c) -{ - Scheme_Object *cdr = scheme_null, *obj = NULL; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cdr); - - while (c--) { - obj = WITH_VAR_STACK(l_LIST_ITEM_BUNDLE(l_ADDRESS f[c])); - cdr = WITH_VAR_STACK(scheme_make_pair(obj, cdr)); - } - - READY_TO_RETURN; - - return cdr; -} - -static l_TYPE l_POINT *l_MAKE_ARRAY(Scheme_Object *l, l_INTTYPE *c, char *who) -{ - Scheme_Object *orig_l = l; - int i = 0; - long len; - l_TYPE l_POINT *f = NULL; - - SETUP_VAR_STACK(3); - VAR_STACK_PUSH(0, l); - VAR_STACK_PUSH(1, orig_l); - VAR_STACK_PUSH(2, f); - - len = WITH_VAR_STACK(scheme_proper_list_length(l)); - if (len < 0) WITH_VAR_STACK(scheme_wrong_type(who, "proper-list", -1, 0, &l)); - if (c) *c = len; - - if (!(len + l_EXTRA)) { - READY_TO_RETURN; - return NULL; - } - -#if l_DIRECTMALLOC - f = (l_TYPE l_POINT *)WITH_VAR_STACK(GC_malloc_atomic(sizeof(l_TYPE l_POINT) * (len + l_EXTRA))); -#else - f = WITH_VAR_STACK(new l_NEWATOMIC l_TYPE l_POINT[len + l_EXTRA]); -#endif - - while (!SCHEME_NULLP(l)) { - if (!SCHEME_LISTP(l)) { - WITH_VAR_STACK(scheme_arg_mismatch(who, "expected a proper list: ", orig_l)); - READY_TO_RETURN; - return NULL; - } - -#define l_COPYDEST f[i] -#define l_COPYSRC (l_DEREF WITH_VAR_STACK(l_LIST_ITEM_UNBUNDLE(SCHEME_CAR(l), who l_TEST))) - - l_COPY - - l_OKTEST - - i++; - - l = SCHEME_CDR(l); - } - l_TERMINATE - - READY_TO_RETURN; - - return f; -} - - - -static char *VectorToArray(char *r, Scheme_Object *vec, long *len, long delta) -{ - long c, i; - Scheme_Object **a = NULL; - SETUP_VAR_STACK(3); - VAR_STACK_PUSH(0, r); - VAR_STACK_PUSH(1, vec); - VAR_STACK_PUSH(2, a); - - if (!SCHEME_VECTORP(vec)) - WITH_VAR_STACK(scheme_wrong_type(METHODNAME("editor-stream-in-base%","read"), - "character vector", -1, 0, &vec)); - - c = *len = SCHEME_VEC_SIZE(vec); - - if (!r) { - r = WITH_VAR_STACK((char *)scheme_malloc_atomic(c)); - delta = 0; - } - - for (a = SCHEME_VEC_ELS(vec), i = 0; i < c; i++) { - if (!SCHEME_CHARP(a[i])) - WITH_VAR_STACK(scheme_wrong_type(METHODNAME("editor-stream-in-base%","read"), - "character vector", -1, 0, &vec)); - r[i+delta] = SCHEME_CHAR_VAL(a[i]); - } - - READY_TO_RETURN; - return r; -} - -static Scheme_Object *ArrayToVector(char *r, Scheme_Object *vec, long len, long delta) -{ - long i; - Scheme_Object **a = NULL; - SETUP_VAR_STACK(3); - VAR_STACK_PUSH(0, r); - VAR_STACK_PUSH(1, vec); - VAR_STACK_PUSH(2, a); - - if (!vec) - vec = WITH_VAR_STACK(scheme_make_vector(len, WITH_VAR_STACK(scheme_make_char(0)))); - else if (!SCHEME_VECTORP(vec)) - WITH_VAR_STACK(scheme_wrong_type(METHODNAME("editor-stream-in-base%","read"), - "character vector", -1, 0, &vec)); - - for (a = SCHEME_VEC_ELS(vec), i = 0; i < len; i++) - a[i] = WITH_VAR_STACK(scheme_make_ascii_character(r[i+delta])); - - READY_TO_RETURN; - - return vec; -} - - - - -class os_wxMediaStreamInBase : public wxMediaStreamInBase { - public: - - os_wxMediaStreamInBase CONSTRUCTOR_ARGS(()); - ~os_wxMediaStreamInBase(); - long Read(char* x0, long x1, long x2); - Bool Bad(); - void Skip(nnlong x0); - void Seek(nnlong x0); - long Tell(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaStreamInBase::gcMark() { - wxMediaStreamInBase::gcMark(); -} -void os_wxMediaStreamInBase::gcFixup() { - wxMediaStreamInBase::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaStreamInBase_class; - -os_wxMediaStreamInBase::os_wxMediaStreamInBase CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxMediaStreamInBase()) -{ -} - -os_wxMediaStreamInBase::~os_wxMediaStreamInBase() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaStreamInBaseRead(int n, Scheme_Object *p[]); - -long os_wxMediaStreamInBase::Read(char* x0, long x1, long x2) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamInBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamInBase_class, "read", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamInBaseRead)) { - SET_VAR_STACK(); - return 0; - } else { - - p[POFFSET+0] = NULL; - p[POFFSET] = ArrayToVector(x0, NULL, x1, x2); - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - VectorToArray(x0, p[POFFSET], &x1, x2); - - { - long resval; - resval = WITH_VAR_STACK(objscheme_unbundle_integer(v, "read in editor-stream-in-base%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaStreamInBaseBad(int n, Scheme_Object *p[]); - -Bool os_wxMediaStreamInBase::Bad() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamInBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamInBase_class, "bad?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamInBaseBad)) { - SET_VAR_STACK(); - return 0; - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "bad? in editor-stream-in-base%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaStreamInBaseSkip(int n, Scheme_Object *p[]); - -void os_wxMediaStreamInBase::Skip(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamInBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamInBase_class, "skip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamInBaseSkip)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaStreamInBaseSeek(int n, Scheme_Object *p[]); - -void os_wxMediaStreamInBase::Seek(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamInBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamInBase_class, "seek", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamInBaseSeek)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaStreamInBaseTell(int n, Scheme_Object *p[]); - -long os_wxMediaStreamInBase::Tell() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamInBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamInBase_class, "tell", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamInBaseTell)) { - SET_VAR_STACK(); - return 0; - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - long resval; - resval = WITH_VAR_STACK(objscheme_unbundle_integer(v, "tell in editor-stream-in-base%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaStreamInBaseRead(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaStreamInBase_class, "read in editor-stream-in-base%", n, p); - char* x0 INIT_NULLED_OUT; - long x1; - long x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = NULL; - - x2 = 0; x0 = VectorToArray(NULL, p[POFFSET], &x1, x2); - if (((Scheme_Class_Object *)p[0])->primflag) - r = 0; - else - r = WITH_VAR_STACK(((wxMediaStreamInBase *)((Scheme_Class_Object *)p[0])->primdata)->Read(x0, x1, x2)); - - ArrayToVector(x0, p[POFFSET], x1, x2); - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaStreamInBaseBad(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaStreamInBase_class, "bad? in editor-stream-in-base%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = 0; - else - r = WITH_VAR_STACK(((wxMediaStreamInBase *)((Scheme_Class_Object *)p[0])->primdata)->Bad()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaStreamInBaseSkip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamInBase_class, "skip in editor-stream-in-base%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "skip in editor-stream-in-base%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaStreamInBase *)((Scheme_Class_Object *)p[0])->primdata)->Skip(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamInBaseSeek(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamInBase_class, "seek in editor-stream-in-base%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "seek in editor-stream-in-base%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaStreamInBase *)((Scheme_Class_Object *)p[0])->primdata)->Seek(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamInBaseTell(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaStreamInBase_class, "tell in editor-stream-in-base%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = 0; - else - r = WITH_VAR_STACK(((wxMediaStreamInBase *)((Scheme_Class_Object *)p[0])->primdata)->Tell()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaStreamInBase_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaStreamInBase *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-stream-in-base%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxMediaStreamInBase CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaStreamInBase()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxMediaStreamInBase(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaStreamInBase_class); - - os_wxMediaStreamInBase_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-stream-in-base%", "object%", (Scheme_Method_Prim *)os_wxMediaStreamInBase_ConstructScheme, 5)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamInBase_class, "read" " method", (Scheme_Method_Prim *)os_wxMediaStreamInBaseRead, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamInBase_class, "bad?" " method", (Scheme_Method_Prim *)os_wxMediaStreamInBaseBad, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamInBase_class, "skip" " method", (Scheme_Method_Prim *)os_wxMediaStreamInBaseSkip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamInBase_class, "seek" " method", (Scheme_Method_Prim *)os_wxMediaStreamInBaseSeek, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamInBase_class, "tell" " method", (Scheme_Method_Prim *)os_wxMediaStreamInBaseTell, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaStreamInBase_class)); - - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaStreamInBase(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaStreamInBase_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-stream-in-base% object or " XC_NULL_STR: "editor-stream-in-base% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaStreamInBase(class wxMediaStreamInBase *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaStreamInBase_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaStreamInBase *objscheme_unbundle_wxMediaStreamInBase(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaStreamInBase(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaStreamInBase *)o->primdata; - else - return (wxMediaStreamInBase *)o->primdata; -} - - - - - -class os_wxMediaStreamOutBase : public wxMediaStreamOutBase { - public: - - os_wxMediaStreamOutBase CONSTRUCTOR_ARGS(()); - ~os_wxMediaStreamOutBase(); - void Write(char* x0, long x1); - Bool Bad(); - void Seek(nnlong x0); - long Tell(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaStreamOutBase::gcMark() { - wxMediaStreamOutBase::gcMark(); -} -void os_wxMediaStreamOutBase::gcFixup() { - wxMediaStreamOutBase::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaStreamOutBase_class; - -os_wxMediaStreamOutBase::os_wxMediaStreamOutBase CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxMediaStreamOutBase()) -{ -} - -os_wxMediaStreamOutBase::~os_wxMediaStreamOutBase() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaStreamOutBaseWrite(int n, Scheme_Object *p[]); - -void os_wxMediaStreamOutBase::Write(char* x0, long x1) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamOutBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamOutBase_class, "write", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamOutBaseWrite)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = NULL; - p[POFFSET+0] = WITH_VAR_STACK(__MakecharList(x0, x1)); - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaStreamOutBaseBad(int n, Scheme_Object *p[]); - -Bool os_wxMediaStreamOutBase::Bad() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamOutBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamOutBase_class, "bad?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamOutBaseBad)) { - SET_VAR_STACK(); - return 0; - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "bad? in editor-stream-out-base%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaStreamOutBaseSeek(int n, Scheme_Object *p[]); - -void os_wxMediaStreamOutBase::Seek(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamOutBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamOutBase_class, "seek", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamOutBaseSeek)) { - SET_VAR_STACK(); - { READY_TO_RETURN; return; } - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaStreamOutBaseTell(int n, Scheme_Object *p[]); - -long os_wxMediaStreamOutBase::Tell() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaStreamOutBase *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaStreamOutBase_class, "tell", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaStreamOutBaseTell)) { - SET_VAR_STACK(); - return 0; - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - long resval; - resval = WITH_VAR_STACK(objscheme_unbundle_integer(v, "tell in editor-stream-out-base%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaStreamOutBaseWrite(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamOutBase_class, "write in editor-stream-out-base%", n, p); - char* x0 INIT_NULLED_OUT; - long x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = NULL; - - x0 = WITH_VAR_STACK(__MakecharArray((0+POFFSET < n) ? p[POFFSET+0] : scheme_null, &x1, METHODNAME("editor-stream-out-base%","write"))); - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaStreamOutBase *)((Scheme_Class_Object *)p[0])->primdata)->Write(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamOutBaseBad(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaStreamOutBase_class, "bad? in editor-stream-out-base%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = 0; - else - r = WITH_VAR_STACK(((wxMediaStreamOutBase *)((Scheme_Class_Object *)p[0])->primdata)->Bad()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaStreamOutBaseSeek(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamOutBase_class, "seek in editor-stream-out-base%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "seek in editor-stream-out-base%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - {} - else - WITH_VAR_STACK(((wxMediaStreamOutBase *)((Scheme_Class_Object *)p[0])->primdata)->Seek(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamOutBaseTell(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaStreamOutBase_class, "tell in editor-stream-out-base%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = 0; - else - r = WITH_VAR_STACK(((wxMediaStreamOutBase *)((Scheme_Class_Object *)p[0])->primdata)->Tell()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaStreamOutBase_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaStreamOutBase *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-stream-out-base%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxMediaStreamOutBase CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaStreamOutBase()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxMediaStreamOutBase(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaStreamOutBase_class); - - os_wxMediaStreamOutBase_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-stream-out-base%", "object%", (Scheme_Method_Prim *)os_wxMediaStreamOutBase_ConstructScheme, 4)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOutBase_class, "write" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutBaseWrite, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOutBase_class, "bad?" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutBaseBad, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOutBase_class, "seek" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutBaseSeek, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOutBase_class, "tell" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutBaseTell, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaStreamOutBase_class)); - - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaStreamOutBase(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaStreamOutBase_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-stream-out-base% object or " XC_NULL_STR: "editor-stream-out-base% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaStreamOutBase(class wxMediaStreamOutBase *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaStreamOutBase_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaStreamOutBase *objscheme_unbundle_wxMediaStreamOutBase(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaStreamOutBase(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaStreamOutBase *)o->primdata; - else - return (wxMediaStreamOutBase *)o->primdata; -} - - - - - - -class os_wxMediaStreamInStringBase : public wxMediaStreamInStringBase { - public: - - os_wxMediaStreamInStringBase CONSTRUCTOR_ARGS((bstring x0, long x1)); - ~os_wxMediaStreamInStringBase(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaStreamInStringBase::gcMark() { - wxMediaStreamInStringBase::gcMark(); -} -void os_wxMediaStreamInStringBase::gcFixup() { - wxMediaStreamInStringBase::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaStreamInStringBase_class; - -os_wxMediaStreamInStringBase::os_wxMediaStreamInStringBase CONSTRUCTOR_ARGS((bstring x0, long x1)) -CONSTRUCTOR_INIT(: wxMediaStreamInStringBase(x0, x1)) -{ -} - -os_wxMediaStreamInStringBase::~os_wxMediaStreamInStringBase() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaStreamInStringBase_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaStreamInStringBase *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - bstring x0 INIT_NULLED_OUT; - long x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-stream-in-bytes-base%", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = (bstring)WITH_VAR_STACK(objscheme_unbundle_bstring(p[POFFSET+0], "initialization in editor-stream-in-bytes-base%")); - - x1 = SCHEME_BYTE_STRTAG_VAL(p[POFFSET+0]); - realobj = WITH_VAR_STACK(new os_wxMediaStreamInStringBase CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaStreamInStringBase(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxMediaStreamInStringBase(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaStreamInStringBase_class); - - os_wxMediaStreamInStringBase_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-stream-in-bytes-base%", "editor-stream-in-base%", (Scheme_Method_Prim *)os_wxMediaStreamInStringBase_ConstructScheme, 0)); - - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaStreamInStringBase_class)); - - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaStreamInStringBase(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaStreamInStringBase_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-stream-in-bytes-base% object or " XC_NULL_STR: "editor-stream-in-bytes-base% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaStreamInStringBase(class wxMediaStreamInStringBase *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaStreamInStringBase_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaStreamInStringBase *objscheme_unbundle_wxMediaStreamInStringBase(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaStreamInStringBase(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaStreamInStringBase *)o->primdata; - else - return (wxMediaStreamInStringBase *)o->primdata; -} - - - - - - -class os_wxMediaStreamOutStringBase : public wxMediaStreamOutStringBase { - public: - - os_wxMediaStreamOutStringBase CONSTRUCTOR_ARGS(()); - ~os_wxMediaStreamOutStringBase(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaStreamOutStringBase::gcMark() { - wxMediaStreamOutStringBase::gcMark(); -} -void os_wxMediaStreamOutStringBase::gcFixup() { - wxMediaStreamOutStringBase::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaStreamOutStringBase_class; - -os_wxMediaStreamOutStringBase::os_wxMediaStreamOutStringBase CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxMediaStreamOutStringBase()) -{ -} - -os_wxMediaStreamOutStringBase::~os_wxMediaStreamOutStringBase() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaStreamOutStringBaseGetString(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nbstring r; - objscheme_check_valid(os_wxMediaStreamOutStringBase_class, "get-bytes in editor-stream-out-bytes-base%", n, p); - long _x0; - long* x0 = &_x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaStreamOutStringBase *)((Scheme_Class_Object *)p[0])->primdata)->GetString(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_make_sized_byte_string(r, _x0, 0) : XC_SCHEME_NULL); -} - -static Scheme_Object *os_wxMediaStreamOutStringBase_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaStreamOutStringBase *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-stream-out-bytes-base%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxMediaStreamOutStringBase CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaStreamOutStringBase()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxMediaStreamOutStringBase(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaStreamOutStringBase_class); - - os_wxMediaStreamOutStringBase_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-stream-out-bytes-base%", "editor-stream-out-base%", (Scheme_Method_Prim *)os_wxMediaStreamOutStringBase_ConstructScheme, 1)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOutStringBase_class, "get-bytes" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutStringBaseGetString, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaStreamOutStringBase_class)); - - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaStreamOutStringBase(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaStreamOutStringBase_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-stream-out-bytes-base% object or " XC_NULL_STR: "editor-stream-out-bytes-base% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaStreamOutStringBase(class wxMediaStreamOutStringBase *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaStreamOutStringBase_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaStreamOutStringBase *objscheme_unbundle_wxMediaStreamOutStringBase(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaStreamOutStringBase(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaStreamOutStringBase *)o->primdata; - else - return (wxMediaStreamOutStringBase *)o->primdata; -} - - -static long GetExact(wxMediaStreamIn *s) -{ - long l; - s->Get(&l); - return l; -} -static double GetInexact(wxMediaStreamIn *s) -{ - double d; - s->Get(&d); - return d; -} - -#define GET Get - - - - - -/* Subtract 1 here because the nul terminator is already included */ - - - - - - -class os_wxMediaStreamIn : public wxMediaStreamIn { - public: - - os_wxMediaStreamIn CONSTRUCTOR_ARGS((class wxMediaStreamInBase* x0)); - ~os_wxMediaStreamIn(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaStreamIn::gcMark() { - wxMediaStreamIn::gcMark(); -} -void os_wxMediaStreamIn::gcFixup() { - wxMediaStreamIn::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaStreamIn_class; - -os_wxMediaStreamIn::os_wxMediaStreamIn CONSTRUCTOR_ARGS((class wxMediaStreamInBase* x0)) -CONSTRUCTOR_INIT(: wxMediaStreamIn(x0)) -{ -} - -os_wxMediaStreamIn::~os_wxMediaStreamIn() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaStreamInOk(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaStreamIn_class, "ok? in editor-stream-in%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->Ok()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaStreamInJumpTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamIn_class, "jump-to in editor-stream-in%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "jump-to in editor-stream-in%")); - - - WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->JumpTo(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamInTell(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaStreamIn_class, "tell in editor-stream-in%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->Tell()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaStreamInSkip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamIn_class, "skip in editor-stream-in%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "skip in editor-stream-in%")); - - - WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->Skip(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamInRemoveBoundary(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamIn_class, "remove-boundary in editor-stream-in%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->RemoveBoundary()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamInSetBoundary(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamIn_class, "set-boundary in editor-stream-in%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-boundary in editor-stream-in%")); - - - WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->SetBoundary(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamInGetInexact(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaStreamIn_class, "get-inexact in editor-stream-in%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(GetInexact(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata))); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaStreamInGetExact(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaStreamIn_class, "get-exact in editor-stream-in%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(GetExact(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata))); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaStreamInGetFixed(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaStreamIn* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaStreamIn_class, "get-fixed in editor-stream-in%", n, p); - long _x0; - long* x0 = &_x0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get-fixed in editor-stream-in%")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "get-fixed in editor-stream-in%"", extracting boxed argument"))); - - - r = WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->GetFixed(x0)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaStreamIn(r)); -} - -static Scheme_Object *os_wxMediaStreamInGetStringPlusOne(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nbstring r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaStreamIn_class, "get-unterminated-bytes in editor-stream-in%", n, p); - nnlong _x0; - nnlong* x0 = &_x0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n > (POFFSET+0)) { - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-unterminated-bytes in editor-stream-in%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-unterminated-bytes in editor-stream-in%"", extracting boxed argument"))); - } else - x0 = NULL; - - x0 = &_x0; - r = WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->GetStringPlusOne(x0)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - - READY_TO_RETURN; - return (r ? scheme_make_sized_byte_string(r, _x0, 0) : XC_SCHEME_NULL); -} - -static Scheme_Object *os_wxMediaStreamInGetString(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nbstring r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaStreamIn_class, "get-bytes in editor-stream-in%", n, p); - nnlong _x0; - nnlong* x0 = &_x0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n > (POFFSET+0)) { - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-bytes in editor-stream-in%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-bytes in editor-stream-in%"", extracting boxed argument"))); - } else - x0 = NULL; - - x0 = &_x0; - r = WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->GetString(x0)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - - READY_TO_RETURN; - return (r ? scheme_make_sized_byte_string(r, _x0 ? _x0 - 1 : 0, 0) : XC_SCHEME_NULL); -} - -static Scheme_Object *os_wxMediaStreamInGet(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - class wxMediaStreamIn* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaStreamIn_class, "get in editor-stream-in%", n, p); - if ((n >= (POFFSET+1)) && (WITH_REMEMBERED_STACK(objscheme_istype_box(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_integer(objscheme_unbox(p[POFFSET+0], NULL), NULL)))) { - long _x0; - long* x0 = &_x0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("get in editor-stream-in% (exact number case)", POFFSET+1, POFFSET+1, n, p, 1)); - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get in editor-stream-in% (exact number case)")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "get in editor-stream-in% (exact number case)"", extracting boxed argument"))); - - - r = WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->Get(x0)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - - READY_TO_PRE_RETURN; - } else { - double _x0; - double* x0 = &_x0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("get in editor-stream-in% (inexact number case)", POFFSET+1, POFFSET+1, n, p, 1)); - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get in editor-stream-in% (inexact number case)")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get in editor-stream-in% (inexact number case)"", extracting boxed argument"))); - - - r = WITH_VAR_STACK(((wxMediaStreamIn *)((Scheme_Class_Object *)p[0])->primdata)->Get(x0)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - - READY_TO_PRE_RETURN; - } - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaStreamIn(r)); -} - -static Scheme_Object *os_wxMediaStreamIn_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaStreamIn *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - class wxMediaStreamInBase* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-stream-in%", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamInBase(p[POFFSET+0], "initialization in editor-stream-in%", 0)); - - - realobj = WITH_VAR_STACK(new os_wxMediaStreamIn CONSTRUCTOR_ARGS((x0))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaStreamIn(x0)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxMediaStreamIn(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaStreamIn_class); - - os_wxMediaStreamIn_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-stream-in%", "object%", (Scheme_Method_Prim *)os_wxMediaStreamIn_ConstructScheme, 12)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "ok?" " method", (Scheme_Method_Prim *)os_wxMediaStreamInOk, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "jump-to" " method", (Scheme_Method_Prim *)os_wxMediaStreamInJumpTo, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "tell" " method", (Scheme_Method_Prim *)os_wxMediaStreamInTell, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "skip" " method", (Scheme_Method_Prim *)os_wxMediaStreamInSkip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "remove-boundary" " method", (Scheme_Method_Prim *)os_wxMediaStreamInRemoveBoundary, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "set-boundary" " method", (Scheme_Method_Prim *)os_wxMediaStreamInSetBoundary, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "get-inexact" " method", (Scheme_Method_Prim *)os_wxMediaStreamInGetInexact, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "get-exact" " method", (Scheme_Method_Prim *)os_wxMediaStreamInGetExact, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "get-fixed" " method", (Scheme_Method_Prim *)os_wxMediaStreamInGetFixed, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "get-unterminated-bytes" " method", (Scheme_Method_Prim *)os_wxMediaStreamInGetStringPlusOne, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "get-bytes" " method", (Scheme_Method_Prim *)os_wxMediaStreamInGetString, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamIn_class, "get" " method", (Scheme_Method_Prim *)os_wxMediaStreamInGet, 1, 1)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaStreamIn_class)); - - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaStreamIn(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaStreamIn_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-stream-in% object or " XC_NULL_STR: "editor-stream-in% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaStreamIn_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaStreamIn(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaStreamIn *)o->primdata; - else - return (wxMediaStreamIn *)o->primdata; -} - - -#define PUT Put - - - - - - - - -class os_wxMediaStreamOut : public wxMediaStreamOut { - public: - - os_wxMediaStreamOut CONSTRUCTOR_ARGS((class wxMediaStreamOutBase* x0)); - ~os_wxMediaStreamOut(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaStreamOut::gcMark() { - wxMediaStreamOut::gcMark(); -} -void os_wxMediaStreamOut::gcFixup() { - wxMediaStreamOut::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaStreamOut_class; - -os_wxMediaStreamOut::os_wxMediaStreamOut CONSTRUCTOR_ARGS((class wxMediaStreamOutBase* x0)) -CONSTRUCTOR_INIT(: wxMediaStreamOut(x0)) -{ -} - -os_wxMediaStreamOut::~os_wxMediaStreamOut() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaStreamOutOk(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaStreamOut_class, "ok? in editor-stream-out%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->Ok()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaStreamOutPrettyFinish(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamOut_class, "pretty-finish in editor-stream-out%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->PrettyFinish()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamOutJumpTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaStreamOut_class, "jump-to in editor-stream-out%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "jump-to in editor-stream-out%")); - - - WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->JumpTo(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaStreamOutTell(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxMediaStreamOut_class, "tell in editor-stream-out%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->Tell()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaStreamOutPutFixed(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaStreamOut* r; - objscheme_check_valid(os_wxMediaStreamOut_class, "put-fixed in editor-stream-out%", n, p); - long x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "put-fixed in editor-stream-out%")); - - - r = WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->PutFixed(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaStreamOut(r)); -} - -static Scheme_Object *os_wxMediaStreamOutPut(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - class wxMediaStreamOut* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxMediaStreamOut_class, "put in editor-stream-out%", n, p); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_bstring(p[POFFSET+0], NULL))) { - long x0; - bstring x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - VAR_STACK_PUSH(2, x1); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("put in editor-stream-out% (byte string without length case)", POFFSET+1, POFFSET+1, n, p, 1)); - x1 = (bstring)WITH_VAR_STACK(objscheme_unbundle_bstring(p[POFFSET+0], "put in editor-stream-out% (byte string without length case)")); - - x0 = (SCHEME_BYTE_STRTAG_VAL(p[POFFSET+0]) + 1); - r = WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->Put(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+0], NULL)) && WITH_REMEMBERED_STACK(objscheme_istype_bstring(p[POFFSET+1], NULL))) { - nnint x0; - bstring x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - VAR_STACK_PUSH(2, x1); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("put in editor-stream-out% (length and byte string case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "put in editor-stream-out% (length and byte string case)")); - x1 = (bstring)WITH_VAR_STACK(objscheme_unbundle_bstring(p[POFFSET+1], "put in editor-stream-out% (length and byte string case)")); - - if ((x0 - 1) > SCHEME_BYTE_STRTAG_VAL(p[POFFSET+1])) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("editor-stream-out","put"), "byte length too large: ", p[POFFSET])); - r = WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->Put(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_integer(p[POFFSET+0], NULL))) { - long x0; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("put in editor-stream-out% (exact number case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+0], "put in editor-stream-out% (exact number case)")); - - - r = WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->Put(x0)); - - - - READY_TO_PRE_RETURN; - } else { - double x0; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("put in editor-stream-out% (inexact number case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "put in editor-stream-out% (inexact number case)")); - - - r = WITH_VAR_STACK(((wxMediaStreamOut *)((Scheme_Class_Object *)p[0])->primdata)->Put(x0)); - - - - READY_TO_PRE_RETURN; - } - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaStreamOut(r)); -} - -static Scheme_Object *os_wxMediaStreamOut_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaStreamOut *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - class wxMediaStreamOutBase* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-stream-out%", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOutBase(p[POFFSET+0], "initialization in editor-stream-out%", 0)); - - - realobj = WITH_VAR_STACK(new os_wxMediaStreamOut CONSTRUCTOR_ARGS((x0))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaStreamOut(x0)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxMediaStreamOut(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaStreamOut_class); - - os_wxMediaStreamOut_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-stream-out%", "object%", (Scheme_Method_Prim *)os_wxMediaStreamOut_ConstructScheme, 6)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOut_class, "ok?" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutOk, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOut_class, "pretty-finish" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutPrettyFinish, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOut_class, "jump-to" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutJumpTo, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOut_class, "tell" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutTell, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOut_class, "put-fixed" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutPutFixed, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaStreamOut_class, "put" " method", (Scheme_Method_Prim *)os_wxMediaStreamOutPut, 1, 2)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaStreamOut_class)); - - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaStreamOut(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaStreamOut_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-stream-out% object or " XC_NULL_STR: "editor-stream-out% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaStreamOut_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaStreamOut(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaStreamOut *)o->primdata; - else - return (wxMediaStreamOut *)o->primdata; -} - - diff --git a/src/mred/wxs/wxs_mio.h b/src/mred/wxs/wxs_mio.h deleted file mode 100644 index 64429641b3..0000000000 --- a/src/mred/wxs/wxs_mio.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef WXS_SETUP_ONLY -#endif -void objscheme_setup_wxMediaStreamInBase(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaStreamInBase(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaStreamInBase(class wxMediaStreamInBase *realobj); -class wxMediaStreamInBase *objscheme_unbundle_wxMediaStreamInBase(Scheme_Object *obj, const char *where, int nullOK); -#endif -void objscheme_setup_wxMediaStreamOutBase(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaStreamOutBase(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaStreamOutBase(class wxMediaStreamOutBase *realobj); -class wxMediaStreamOutBase *objscheme_unbundle_wxMediaStreamOutBase(Scheme_Object *obj, const char *where, int nullOK); -#endif -void objscheme_setup_wxMediaStreamInStringBase(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaStreamInStringBase(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaStreamInStringBase(class wxMediaStreamInStringBase *realobj); -class wxMediaStreamInStringBase *objscheme_unbundle_wxMediaStreamInStringBase(Scheme_Object *obj, const char *where, int nullOK); -#endif -void objscheme_setup_wxMediaStreamOutStringBase(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaStreamOutStringBase(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaStreamOutStringBase(class wxMediaStreamOutStringBase *realobj); -class wxMediaStreamOutStringBase *objscheme_unbundle_wxMediaStreamOutStringBase(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern class wxMediaStreamInBase *objscheme_unbundle_wxMediaStreamInBase(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxMediaStreamIn(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaStreamIn(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *realobj); -class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern class wxMediaStreamOutBase *objscheme_unbundle_wxMediaStreamOutBase(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxMediaStreamOut(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaStreamOut(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *realobj); -class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *obj, const char *where, int nullOK); -#endif diff --git a/src/mred/wxs/wxs_mio.xc b/src/mred/wxs/wxs_mio.xc deleted file mode 100644 index 1c493e1fda..0000000000 --- a/src/mred/wxs/wxs_mio.xc +++ /dev/null @@ -1,188 +0,0 @@ - -@INCLUDE prefix.xci - -#include "wx_obj.h" -#include "wx_medio.h" - -@INCLUDE wxs.xci - -@HEADER - -@MACRO rZERO = return 0; - -@SET TYPE = char -@SET NOTEST = 1 -@SET SIZEISLONG = 1 -@INCLUDE list.xci - -@CLASSBASE wxMediaStreamInBase "editor-stream-in-base" : "object" - -static char *VectorToArray(char *r, Scheme_Object *vec, long *len, long delta) -{ - long c, i; - Scheme_Object **a = NULL; - SETUP_VAR_STACK(3); - VAR_STACK_PUSH(0, r); - VAR_STACK_PUSH(1, vec); - VAR_STACK_PUSH(2, a); - - if (!SCHEME_VECTORP(vec)) - WITH_VAR_STACK(scheme_wrong_type(METHODNAME("editor-stream-in-base%","read"), - "character vector", -1, 0, &vec)); - - c = *len = SCHEME_VEC_SIZE(vec); - - if (!r) { - r = WITH_VAR_STACK((char *)scheme_malloc_atomic(c)); - delta = 0; - } - - for (a = SCHEME_VEC_ELS(vec), i = 0; i < c; i++) { - if (!SCHEME_CHARP(a[i])) - WITH_VAR_STACK(scheme_wrong_type(METHODNAME("editor-stream-in-base%","read"), - "character vector", -1, 0, &vec)); - r[i+delta] = SCHEME_CHAR_VAL(a[i]); - } - - READY_TO_RETURN; - return r; -} - -static Scheme_Object *ArrayToVector(char *r, Scheme_Object *vec, long len, long delta) -{ - long i; - Scheme_Object **a = NULL; - SETUP_VAR_STACK(3); - VAR_STACK_PUSH(0, r); - VAR_STACK_PUSH(1, vec); - VAR_STACK_PUSH(2, a); - - if (!vec) - vec = WITH_VAR_STACK(scheme_make_vector(len, WITH_VAR_STACK(scheme_make_char(0)))); - else if (!SCHEME_VECTORP(vec)) - WITH_VAR_STACK(scheme_wrong_type(METHODNAME("editor-stream-in-base%","read"), - "character vector", -1, 0, &vec)); - - for (a = SCHEME_VEC_ELS(vec), i = 0; i < len; i++) - a[i] = WITH_VAR_STACK(scheme_make_ascii_character(r[i+delta])); - - READY_TO_RETURN; - - return vec; -} - -@MACRO setNULL = NULL -@MACRO arrayToVector = p[POFFSET] = ArrayToVector(x0, NULL, x1, x2); -@MACRO copyArrayToVector = ArrayToVector(x0, p[POFFSET], x1, x2); -@MACRO vectorToArray = x2 = 0; x0 = VectorToArray(NULL, p[POFFSET], &x1, x2); -@MACRO copyVectorToArray = VectorToArray(x0, p[POFFSET], &x1, x2); - -@CREATOR (); - -@ V "tell" : long Tell(); : : : rZERO -@ V "seek" : void Seek(nnlong); -@ V "skip" : void Skip(nnlong); -@ V "bad?" : bool Bad(); : : : rZERO -@ V "read" : long Read(char[]/setNULL/setNULL////push,-long,-long); : /arrayToVector/copyVectorToArray : /vectorToArray/copyArrayToVector : rZERO - -@END - -@CLASSBASE wxMediaStreamOutBase "editor-stream-out-base" : "object" - -@CREATOR (); - -@ V "tell" : long Tell(); : : : rZERO -@ V "seek" : void Seek(nnlong); -@ V "bad?" : bool Bad(); : : : rZERO -@ V "write" : void Write(char[]/bList/ubList/cList///push,-long); : /methListSet[char.0.0.1] : /glueListSet[char.0.0.1.METHODNAME("editor-stream-out-base%","write")] - -@END - - -@CLASSBASE wxMediaStreamInStringBase "editor-stream-in-bytes-base" : "editor-stream-in-base" - -@MACRO setStringSize[ss.cn] = x = SCHEME_BYTE_STRTAG_VAL(p[POFFSET+]); - -@CREATOR (bstring,-long); : : /setStringSize[0.1] - -@END - -@CLASSBASE wxMediaStreamOutStringBase "editor-stream-out-bytes-base" : "editor-stream-out-base" - -@CREATOR () - -@MACRO makeSizedString = (r ? scheme_make_sized_byte_string(r, _x0, 0) : XC_SCHEME_NULL) - -@ "get-bytes" : nbstring/makeSizedString GetString(-long*); - -@END - -static long GetExact(wxMediaStreamIn *s) -{ - long l; - s->Get(&l); - return l; -} -static double GetInexact(wxMediaStreamIn *s) -{ - double d; - s->Get(&d); - return d; -} - -#define GET Get - -@CLASSBASE wxMediaStreamIn "editor-stream-in" : "object" - -@CREATOR (wxMediaStreamInBase!); - -@ "get" : wxMediaStreamIn! Get(Long*////long); <> exact number -@ "get" : wxMediaStreamIn! Get(Double*); <> inexact number - -@MACRO alwaysPassPtr = x0 = &_x0; - -/* Subtract 1 here because the nul terminator is already included */ -@MACRO makeSizedStringX = (r ? scheme_make_sized_byte_string(r, _x0 ? _x0 - 1 : 0, 0) : XC_SCHEME_NULL) - -@ "get-bytes" : nbstring/makeSizedStringX GetString(nnlong?=NULL); : : /alwaysPassPtr/ -@ "get-unterminated-bytes" : nbstring/makeSizedString GetStringPlusOne(nnlong?=NULL); : : /alwaysPassPtr/ -@ "get-fixed" : wxMediaStreamIn! GetFixed(long*); - -@ m "get-exact" : long GetExact(); -@ m "get-inexact" : double GetInexact(); - -@ "set-boundary" : void SetBoundary(nnlong); -@ "remove-boundary" : void RemoveBoundary(); - -@ "skip" : void Skip(nnlong); -@ "tell" : long Tell(); -@ "jump-to" : void JumpTo(nnlong); - -@ "ok?" : bool Ok(); - -@END - -#define PUT Put - -@MACRO CheckBytesLength = if ((x0 - 1) > SCHEME_BYTE_STRTAG_VAL(p[POFFSET+1])) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("editor-stream-out","put"), "byte length too large: ", p[POFFSET])); -@MACRO SetBytesLength = x0 = (SCHEME_BYTE_STRTAG_VAL(p[POFFSET+0]) + 1); -@CLASSBASE wxMediaStreamOut "editor-stream-out" : "object" - -@CREATOR (wxMediaStreamOutBase!); - -@ "put" : wxMediaStreamOut! Put(nnint////long,bstring); : : /CheckBytesLength/ <> length and byte string -@ "put" : wxMediaStreamOut! Put(-long,bstring); : : /SetBytesLength/ <> byte string without length -@ "put" : wxMediaStreamOut! Put(Long////long); <> exact number -@ "put" : wxMediaStreamOut! Put(Double); <> inexact number - -@ "put-fixed" : wxMediaStreamOut! PutFixed(long); - -@ "tell" : long Tell(); -@ "jump-to" : void JumpTo(nnlong); - -@ "pretty-finish" : void PrettyFinish(); - -@ "ok?" : bool Ok(); - -@END - diff --git a/src/mred/wxs/wxs_misc.cxx b/src/mred/wxs/wxs_misc.cxx index 8999f7cc4a..0e2910266f 100644 --- a/src/mred/wxs/wxs_misc.cxx +++ b/src/mred/wxs/wxs_misc.cxx @@ -356,11 +356,24 @@ Scheme_Object *GetTypes(wxClipboardClient *c) return first; } +typedef Scheme_Object *Scheme_Object_Ptr; +static int SameClipboardClientEventspace(wxClipboardClient *c, Scheme_Object *es) +{ + return (c->context == es); +} + +static int SameClipboardClient(wxClipboard *cb, wxClipboardClient *cc) +{ + return (cb->GetClipboardClient() == cc); +} + + // @ "get-clipboard-client" : wxClipboardClient^ GetClipboardClient(); + class os_wxClipboard : public wxClipboard { public: @@ -388,6 +401,30 @@ os_wxClipboard::~os_wxClipboard() objscheme_destroy(this, (Scheme_Object *) __gc_external); } +static Scheme_Object *os_wxClipboardSameClipboardClient(int n, Scheme_Object *p[]) +{ + WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) + REMEMBER_VAR_STACK(); + Bool r; + objscheme_check_valid(os_wxClipboard_class, "same-clipboard-client? in clipboard<%>", n, p); + class wxClipboardClient* x0 INIT_NULLED_OUT; + + SETUP_VAR_STACK_REMEMBERED(2); + VAR_STACK_PUSH(0, p); + VAR_STACK_PUSH(1, x0); + + + x0 = WITH_VAR_STACK(objscheme_unbundle_wxClipboardClient(p[POFFSET+0], "same-clipboard-client? in clipboard<%>", 0)); + + + r = WITH_VAR_STACK(SameClipboardClient(((wxClipboard *)((Scheme_Class_Object *)p[0])->primdata), x0)); + + + + READY_TO_RETURN; + return (r ? scheme_true : scheme_false); +} + static Scheme_Object *os_wxClipboardGetClipboardBitmap(int n, Scheme_Object *p[]) { WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) @@ -545,8 +582,9 @@ void objscheme_setup_wxClipboard(Scheme_Env *env) wxREGGLOB(os_wxClipboard_class); wxREGGLOB(os_wxClipboard_interface); - os_wxClipboard_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "clipboard%", "object%", NULL, 6)); + os_wxClipboard_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "clipboard%", "object%", NULL, 7)); + WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "same-clipboard-client?" " method", (Scheme_Method_Prim *)os_wxClipboardSameClipboardClient, 1, 1)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "get-clipboard-bitmap" " method", (Scheme_Method_Prim *)os_wxClipboardGetClipboardBitmap, 1, 1)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "set-clipboard-bitmap" " method", (Scheme_Method_Prim *)os_wxClipboardSetClipboardBitmap, 2, 2)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboard_class, "get-clipboard-data" " method", (Scheme_Method_Prim *)os_wxClipboardGetClipboardData, 2, 2)); @@ -694,6 +732,7 @@ void objscheme_setup_wxClipboardGlobal(Scheme_Env *env) + class os_wxClipboardClient : public wxClipboardClient { public: @@ -803,6 +842,30 @@ void os_wxClipboardClient::BeingReplaced() } } +static Scheme_Object *os_wxClipboardClientSameClipboardClientEventspace(int n, Scheme_Object *p[]) +{ + WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) + REMEMBER_VAR_STACK(); + Bool r; + objscheme_check_valid(os_wxClipboardClient_class, "same-eventspace? in clipboard-client%", n, p); + Scheme_Object_Ptr x0 INIT_NULLED_OUT; + + SETUP_VAR_STACK_REMEMBERED(2); + VAR_STACK_PUSH(0, p); + VAR_STACK_PUSH(1, x0); + + + x0 = p[POFFSET+0]; + + + r = WITH_VAR_STACK(SameClipboardClientEventspace(((wxClipboardClient *)((Scheme_Class_Object *)p[0])->primdata), x0)); + + + + READY_TO_RETURN; + return (r ? scheme_true : scheme_false); +} + static Scheme_Object *os_wxClipboardClientGetTypes(int n, Scheme_Object *p[]) { WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) @@ -936,8 +999,9 @@ void objscheme_setup_wxClipboardClient(Scheme_Env *env) wxREGGLOB(os_wxClipboardClient_class); - os_wxClipboardClient_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "clipboard-client%", "object%", (Scheme_Method_Prim *)os_wxClipboardClient_ConstructScheme, 4)); + os_wxClipboardClient_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "clipboard-client%", "object%", (Scheme_Method_Prim *)os_wxClipboardClient_ConstructScheme, 5)); + WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "same-eventspace?" " method", (Scheme_Method_Prim *)os_wxClipboardClientSameClipboardClientEventspace, 1, 1)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "get-types" " method", (Scheme_Method_Prim *)os_wxClipboardClientGetTypes, 0, 0)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "add-type" " method", (Scheme_Method_Prim *)os_wxClipboardClientAddType, 1, 1)); WITH_VAR_STACK(scheme_add_method_w_arity(os_wxClipboardClient_class, "get-data" " method", (Scheme_Method_Prim *)os_wxClipboardClientGetData, 1, 1)); diff --git a/src/mred/wxs/wxs_misc.h b/src/mred/wxs/wxs_misc.h index a9e8b52965..1346df31ef 100644 --- a/src/mred/wxs/wxs_misc.h +++ b/src/mred/wxs/wxs_misc.h @@ -5,6 +5,7 @@ void objscheme_setup_wxTimer(Scheme_Env *env); int objscheme_istype_wxTimer(Scheme_Object *obj, const char *stop, int nullOK); Scheme_Object *objscheme_bundle_wxTimer(class wxTimer *realobj); class wxTimer *objscheme_unbundle_wxTimer(Scheme_Object *obj, const char *where, int nullOK); +extern class wxClipboardClient *objscheme_unbundle_wxClipboardClient(Scheme_Object *, const char *, int); extern Scheme_Object *objscheme_bundle_wxBitmap(class wxBitmap *); extern class wxBitmap *objscheme_unbundle_wxBitmap(Scheme_Object *, const char *, int); extern class wxClipboardClient *objscheme_unbundle_wxClipboardClient(Scheme_Object *, const char *, int); diff --git a/src/mred/wxs/wxs_misc.xc b/src/mred/wxs/wxs_misc.xc index 0c3fd5f810..9c8299329e 100644 --- a/src/mred/wxs/wxs_misc.xc +++ b/src/mred/wxs/wxs_misc.xc @@ -71,6 +71,18 @@ Scheme_Object *GetTypes(wxClipboardClient *c) return first; } +typedef Scheme_Object *Scheme_Object_Ptr; +static int SameClipboardClientEventspace(wxClipboardClient *c, Scheme_Object *es) +{ + return (c->context == es); +} + +static int SameClipboardClient(wxClipboard *cb, wxClipboardClient *cc) +{ + return (cb->GetClipboardClient() == cc); +} + + @MACRO makeSizedString[i] = (r ? scheme_make_sized_byte_string(r, _x, 1) : XC_SCHEME_NULL) @CLASSBASE wxClipboard "clipboard" : "object" @@ -85,6 +97,8 @@ Scheme_Object *GetTypes(wxClipboardClient *c) @ "set-clipboard-bitmap" : void SetClipboardBitmap(wxBitmap!,ExactLong); @ "get-clipboard-bitmap" : wxBitmap^ GetClipboardBitmap(ExactLong); +@ m "same-clipboard-client?" : bool SameClipboardClient(wxClipboardClient!) + @END static wxClipboard* wxGetTheClipboard() @@ -123,6 +137,8 @@ static wxClipboard* wxGetTheXSelection() @ m "add-type" : void AddType(string); @ m "get-types" : Scheme_Object*/identity//sbString GetTypes(); +@ m "same-eventspace?" : bool SameClipboardClientEventspace(Scheme_Object_Ptr/identity/identity////push) + @END diff --git a/src/mred/wxs/wxs_mpb.cxx b/src/mred/wxs/wxs_mpb.cxx deleted file mode 100644 index e61d08798e..0000000000 --- a/src/mred/wxs/wxs_mpb.cxx +++ /dev/null @@ -1,7241 +0,0 @@ -/* DO NOT EDIT THIS FILE. */ -/* This file was generated by xctocc from "wxs_mpb.xc". */ - - -#if defined(_MSC_VER) -# include "wx.h" -#endif -#if defined(OS_X) -# include "common.h" -#endif - -#include "wx_media.h" - - - - -#ifdef wx_x -# define BM_SELECTED(map) ((map)->selectedTo) -#endif -#if defined(wx_mac) || defined(wx_msw) -# define BM_SELECTED(map) ((map)->selectedInto) -#endif -# define BM_IN_USE(map) ((map)->selectedIntoDC) - - - - -#define ESCAPE_NO_RET_VAL /*empty*/ - - -#include "wxscheme.h" -#include "wxs_mpb.h" - -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - - -static Scheme_Object *bufferType_wxEDIT_BUFFER_sym = NULL; -static Scheme_Object *bufferType_wxPASTEBOARD_BUFFER_sym = NULL; - -static void init_symset_bufferType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bufferType_wxEDIT_BUFFER_sym); - bufferType_wxEDIT_BUFFER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text")); - wxREGGLOB(bufferType_wxPASTEBOARD_BUFFER_sym); - bufferType_wxPASTEBOARD_BUFFER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pasteboard")); -} - -static int unbundle_symset_bufferType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bufferType_wxPASTEBOARD_BUFFER_sym) WITH_VAR_STACK(init_symset_bufferType()); - if (0) { } - else if (v == bufferType_wxEDIT_BUFFER_sym) { READY_TO_RETURN; return wxEDIT_BUFFER; } - else if (v == bufferType_wxPASTEBOARD_BUFFER_sym) { READY_TO_RETURN; return wxPASTEBOARD_BUFFER; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bufferType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bufferType(int v) { - if (!bufferType_wxPASTEBOARD_BUFFER_sym) init_symset_bufferType(); - switch (v) { - case wxEDIT_BUFFER: return bufferType_wxEDIT_BUFFER_sym; - case wxPASTEBOARD_BUFFER: return bufferType_wxPASTEBOARD_BUFFER_sym; - default: return NULL; - } -} - - -static Scheme_Object *fileType_wxMEDIA_FF_GUESS_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_STD_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_TEXT_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_SAME_sym = NULL; -static Scheme_Object *fileType_wxMEDIA_FF_COPY_sym = NULL; - -static void init_symset_fileType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(fileType_wxMEDIA_FF_GUESS_sym); - fileType_wxMEDIA_FF_GUESS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("guess")); - wxREGGLOB(fileType_wxMEDIA_FF_STD_sym); - fileType_wxMEDIA_FF_STD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("standard")); - wxREGGLOB(fileType_wxMEDIA_FF_TEXT_sym); - fileType_wxMEDIA_FF_TEXT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text")); - wxREGGLOB(fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym); - fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("text-force-cr")); - wxREGGLOB(fileType_wxMEDIA_FF_SAME_sym); - fileType_wxMEDIA_FF_SAME_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("same")); - wxREGGLOB(fileType_wxMEDIA_FF_COPY_sym); - fileType_wxMEDIA_FF_COPY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("copy")); -} - -static int unbundle_symset_fileType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!fileType_wxMEDIA_FF_COPY_sym) WITH_VAR_STACK(init_symset_fileType()); - if (0) { } - else if (v == fileType_wxMEDIA_FF_GUESS_sym) { READY_TO_RETURN; return wxMEDIA_FF_GUESS; } - else if (v == fileType_wxMEDIA_FF_STD_sym) { READY_TO_RETURN; return wxMEDIA_FF_STD; } - else if (v == fileType_wxMEDIA_FF_TEXT_sym) { READY_TO_RETURN; return wxMEDIA_FF_TEXT; } - else if (v == fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym) { READY_TO_RETURN; return wxMEDIA_FF_TEXT_FORCE_CR; } - else if (v == fileType_wxMEDIA_FF_SAME_sym) { READY_TO_RETURN; return wxMEDIA_FF_SAME; } - else if (v == fileType_wxMEDIA_FF_COPY_sym) { READY_TO_RETURN; return wxMEDIA_FF_COPY; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "fileType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_fileType(int v) { - if (!fileType_wxMEDIA_FF_COPY_sym) init_symset_fileType(); - switch (v) { - case wxMEDIA_FF_GUESS: return fileType_wxMEDIA_FF_GUESS_sym; - case wxMEDIA_FF_STD: return fileType_wxMEDIA_FF_STD_sym; - case wxMEDIA_FF_TEXT: return fileType_wxMEDIA_FF_TEXT_sym; - case wxMEDIA_FF_TEXT_FORCE_CR: return fileType_wxMEDIA_FF_TEXT_FORCE_CR_sym; - case wxMEDIA_FF_SAME: return fileType_wxMEDIA_FF_SAME_sym; - case wxMEDIA_FF_COPY: return fileType_wxMEDIA_FF_COPY_sym; - default: return NULL; - } -} - - - -static Scheme_Object *focus_wxFOCUS_IMMEDIATE_sym = NULL; -static Scheme_Object *focus_wxFOCUS_DISPLAY_sym = NULL; -static Scheme_Object *focus_wxFOCUS_GLOBAL_sym = NULL; - -static void init_symset_focus(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(focus_wxFOCUS_IMMEDIATE_sym); - focus_wxFOCUS_IMMEDIATE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("immediate")); - wxREGGLOB(focus_wxFOCUS_DISPLAY_sym); - focus_wxFOCUS_DISPLAY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("display")); - wxREGGLOB(focus_wxFOCUS_GLOBAL_sym); - focus_wxFOCUS_GLOBAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("global")); -} - -static int unbundle_symset_focus(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!focus_wxFOCUS_GLOBAL_sym) WITH_VAR_STACK(init_symset_focus()); - if (0) { } - else if (v == focus_wxFOCUS_IMMEDIATE_sym) { READY_TO_RETURN; return wxFOCUS_IMMEDIATE; } - else if (v == focus_wxFOCUS_DISPLAY_sym) { READY_TO_RETURN; return wxFOCUS_DISPLAY; } - else if (v == focus_wxFOCUS_GLOBAL_sym) { READY_TO_RETURN; return wxFOCUS_GLOBAL; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "focus symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_focus(int v) { - if (!focus_wxFOCUS_GLOBAL_sym) init_symset_focus(); - switch (v) { - case wxFOCUS_IMMEDIATE: return focus_wxFOCUS_IMMEDIATE_sym; - case wxFOCUS_DISPLAY: return focus_wxFOCUS_DISPLAY_sym; - case wxFOCUS_GLOBAL: return focus_wxFOCUS_GLOBAL_sym; - default: return NULL; - } -} - - -# define Sym_END 1 -# define Sym_START -1 -# define Sym_NONE 0 -static Scheme_Object *bias_Sym_START_sym = NULL; -static Scheme_Object *bias_Sym_NONE_sym = NULL; -static Scheme_Object *bias_Sym_END_sym = NULL; - -static void init_symset_bias(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bias_Sym_START_sym); - bias_Sym_START_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("start")); - wxREGGLOB(bias_Sym_NONE_sym); - bias_Sym_NONE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("none")); - wxREGGLOB(bias_Sym_END_sym); - bias_Sym_END_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("end")); -} - -static int unbundle_symset_bias(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bias_Sym_END_sym) WITH_VAR_STACK(init_symset_bias()); - if (0) { } - else if (v == bias_Sym_START_sym) { READY_TO_RETURN; return Sym_START; } - else if (v == bias_Sym_NONE_sym) { READY_TO_RETURN; return Sym_NONE; } - else if (v == bias_Sym_END_sym) { READY_TO_RETURN; return Sym_END; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bias symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bias(int v) { - if (!bias_Sym_END_sym) init_symset_bias(); - switch (v) { - case Sym_START: return bias_Sym_START_sym; - case Sym_NONE: return bias_Sym_NONE_sym; - case Sym_END: return bias_Sym_END_sym; - default: return NULL; - } -} - - - -static Scheme_Object *caret_wxSNIP_DRAW_NO_CARET_sym = NULL; -static Scheme_Object *caret_wxSNIP_DRAW_SHOW_CARET_sym = NULL; -static Scheme_Object *caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym = NULL; - -static void init_symset_caret(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(caret_wxSNIP_DRAW_NO_CARET_sym); - caret_wxSNIP_DRAW_NO_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("no-caret")); - wxREGGLOB(caret_wxSNIP_DRAW_SHOW_CARET_sym); - caret_wxSNIP_DRAW_SHOW_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("show-caret")); - wxREGGLOB(caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym); - caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("show-inactive-caret")); -} - -static int unbundle_symset_caret(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) WITH_VAR_STACK(init_symset_caret()); - if (0) { } - else if (v == caret_wxSNIP_DRAW_NO_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_NO_CARET; } - else if (v == caret_wxSNIP_DRAW_SHOW_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_SHOW_CARET; } - else if (v == caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_SHOW_INACTIVE_CARET; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "caret symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_caret(int v) { - if (!caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) init_symset_caret(); - switch (v) { - case wxSNIP_DRAW_NO_CARET: return caret_wxSNIP_DRAW_NO_CARET_sym; - case wxSNIP_DRAW_SHOW_CARET: return caret_wxSNIP_DRAW_SHOW_CARET_sym; - case wxSNIP_DRAW_SHOW_INACTIVE_CARET: return caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym; - default: return NULL; - } -} - - - - -#ifndef wx_mac -# define wxBITMAP_TYPE_PICT 101 -#endif - -#define wxBITMAP_TYPE_UNKNOWN 0 -#define wxBITMAP_TYPE_GIF_MASK (wxBITMAP_TYPE_GIF | wxBITMAP_TYPE_MASK) -#define wxBITMAP_TYPE_PNG_MASK (wxBITMAP_TYPE_PNG | wxBITMAP_TYPE_MASK) - -static Scheme_Object *bitmapType_wxBITMAP_TYPE_BMP_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_XBM_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_XPM_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PICT_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_JPEG_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_MASK_sym = NULL; - -static void init_symset_bitmapType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_BMP_sym); - bitmapType_wxBITMAP_TYPE_BMP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bmp")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_sym); - bitmapType_wxBITMAP_TYPE_GIF_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_MASK_sym); - bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif/mask")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_XBM_sym); - bitmapType_wxBITMAP_TYPE_XBM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xbm")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_XPM_sym); - bitmapType_wxBITMAP_TYPE_XPM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xpm")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PICT_sym); - bitmapType_wxBITMAP_TYPE_PICT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pict")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_JPEG_sym); - bitmapType_wxBITMAP_TYPE_JPEG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("jpeg")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_sym); - bitmapType_wxBITMAP_TYPE_PNG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_MASK_sym); - bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png/mask")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_UNKNOWN_sym); - bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_MASK_sym); - bitmapType_wxBITMAP_TYPE_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown/mask")); -} - -static int unbundle_symset_bitmapType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bitmapType_wxBITMAP_TYPE_MASK_sym) WITH_VAR_STACK(init_symset_bitmapType()); - if (0) { } - else if (v == bitmapType_wxBITMAP_TYPE_BMP_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_BMP; } - else if (v == bitmapType_wxBITMAP_TYPE_GIF_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF; } - else if (v == bitmapType_wxBITMAP_TYPE_GIF_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF_MASK; } - else if (v == bitmapType_wxBITMAP_TYPE_XBM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XBM; } - else if (v == bitmapType_wxBITMAP_TYPE_XPM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XPM; } - else if (v == bitmapType_wxBITMAP_TYPE_PICT_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PICT; } - else if (v == bitmapType_wxBITMAP_TYPE_JPEG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_JPEG; } - else if (v == bitmapType_wxBITMAP_TYPE_PNG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG; } - else if (v == bitmapType_wxBITMAP_TYPE_PNG_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG_MASK; } - else if (v == bitmapType_wxBITMAP_TYPE_UNKNOWN_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_UNKNOWN; } - else if (v == bitmapType_wxBITMAP_TYPE_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_MASK; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bitmapType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bitmapType(int v) { - if (!bitmapType_wxBITMAP_TYPE_MASK_sym) init_symset_bitmapType(); - switch (v) { - case wxBITMAP_TYPE_BMP: return bitmapType_wxBITMAP_TYPE_BMP_sym; - case wxBITMAP_TYPE_GIF: return bitmapType_wxBITMAP_TYPE_GIF_sym; - case wxBITMAP_TYPE_GIF_MASK: return bitmapType_wxBITMAP_TYPE_GIF_MASK_sym; - case wxBITMAP_TYPE_XBM: return bitmapType_wxBITMAP_TYPE_XBM_sym; - case wxBITMAP_TYPE_XPM: return bitmapType_wxBITMAP_TYPE_XPM_sym; - case wxBITMAP_TYPE_PICT: return bitmapType_wxBITMAP_TYPE_PICT_sym; - case wxBITMAP_TYPE_JPEG: return bitmapType_wxBITMAP_TYPE_JPEG_sym; - case wxBITMAP_TYPE_PNG: return bitmapType_wxBITMAP_TYPE_PNG_sym; - case wxBITMAP_TYPE_PNG_MASK: return bitmapType_wxBITMAP_TYPE_PNG_MASK_sym; - case wxBITMAP_TYPE_UNKNOWN: return bitmapType_wxBITMAP_TYPE_UNKNOWN_sym; - case wxBITMAP_TYPE_MASK: return bitmapType_wxBITMAP_TYPE_MASK_sym; - default: return NULL; - } -} - - - - - - - -/* - X = Not meant for virtual, defined in wxMediaEdit/wxMediaPasteboard - and overloaded there - Y = Virtual, defined in wxMediaEdit/wxMediaPasteboard - Z = Virtual, defined in wxMediaBuffer -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -class os_wxMediaPasteboard : public wxMediaPasteboard { - public: - - os_wxMediaPasteboard CONSTRUCTOR_ARGS(()); - ~os_wxMediaPasteboard(); - void AfterInteractiveResize(class wxSnip* x0); - void OnInteractiveResize(class wxSnip* x0); - Bool CanInteractiveResize(class wxSnip* x0); - void AfterInteractiveMove(class wxMouseEvent* x0); - void OnInteractiveMove(class wxMouseEvent* x0); - Bool CanInteractiveMove(class wxMouseEvent* x0); - void InteractiveAdjustResize(class wxSnip* x0, nndouble* x1, nndouble* x2); - void InteractiveAdjustMove(class wxSnip* x0, double* x1, double* x2); - void InteractiveAdjustMouse(double* x0, double* x1); - void OnDoubleClick(class wxSnip* x0, class wxMouseEvent* x1); - void AfterSelect(class wxSnip* x0, Bool x1); - void OnSelect(class wxSnip* x0, Bool x1); - Bool CanSelect(class wxSnip* x0, Bool x1); - void AfterReorder(class wxSnip* x0, class wxSnip* x1, Bool x2); - void OnReorder(class wxSnip* x0, class wxSnip* x1, Bool x2); - Bool CanReorder(class wxSnip* x0, class wxSnip* x1, Bool x2); - void AfterResize(class wxSnip* x0, nndouble x1, nndouble x2, Bool x3); - void OnResize(class wxSnip* x0, nndouble x1, nndouble x2); - Bool CanResize(class wxSnip* x0, nndouble x1, nndouble x2); - void AfterMoveTo(class wxSnip* x0, double x1, double x2, Bool x3); - void OnMoveTo(class wxSnip* x0, double x1, double x2, Bool x3); - Bool CanMoveTo(class wxSnip* x0, double x1, double x2, Bool x3); - void AfterDelete(class wxSnip* x0); - void OnDelete(class wxSnip* x0); - Bool CanDelete(class wxSnip* x0); - void AfterInsert(class wxSnip* x0, class wxSnip* x1, double x2, double x3); - void OnInsert(class wxSnip* x0, class wxSnip* x1, double x2, double x3); - Bool CanInsert(class wxSnip* x0, class wxSnip* x1, double x2, double x3); - void DoPasteSelection(ExactLong x0); - void DoPaste(ExactLong x0); - void DoCopy(ExactLong x0, Bool x1); - string GetDefaultStyleName(); - npathname PutFile(nepathname x0, nepathname x1); - npathname GetFile(nepathname x0); - void AfterEditSequence(); - void OnEditSequence(); - void AfterLoadFile(Bool x0); - void OnLoadFile(epathname x0, int x1); - Bool CanLoadFile(epathname x0, int x1); - void AfterSaveFile(Bool x0); - void OnSaveFile(epathname x0, int x1); - Bool CanSaveFile(epathname x0, int x1); - class wxSnip* OnNewBox(int x0); - class wxImageSnip* OnNewImageSnip(nxpathname x0, int x1, Bool x2, Bool x3); - void SizeCacheInvalid(); - void InvalidateBitmapCache(double x0 = 0.0, double x1 = 0.0, double x2 = -1.0, double x3 = -1.0); - void OnPaint(Bool x0, class wxDC* x1, double x2, double x3, double x4, double x5, double x6, double x7, int x8); - Bool WriteFootersToFile(class wxMediaStreamOut* x0); - Bool WriteHeadersToFile(class wxMediaStreamOut* x0); - Bool ReadFooterFromFile(class wxMediaStreamIn* x0, string x1); - Bool ReadHeaderFromFile(class wxMediaStreamIn* x0, string x1); - void SetFilename(nxpathname x0, Bool x1 = FALSE); - Bool ReleaseSnip(class wxSnip* x0); - void OnSnipModified(class wxSnip* x0, Bool x1); - void SetModified(Bool x0); - Bool AdminScrollTo(double x0, double x1, nndouble x2, nndouble x3, Bool x4, int x5); - void SetSnipData(class wxSnip* x0, class wxBufferData* x1); - class wxBufferData* GetSnipData(class wxSnip* x0); - void NeedsUpdate(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4); - void Resized(class wxSnip* x0, Bool x1); - void SetCaretOwner(class wxSnip* x0, int x1 = wxFOCUS_IMMEDIATE); - Bool ScrollTo(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4, Bool x5, int x6 = 0); - void OnDisplaySizeWhenReady(); - void OnDisplaySize(); - void OnChange(); - void OnFocus(Bool x0); - void OnDefaultChar(class wxKeyEvent* x0); - void OnDefaultEvent(class wxMouseEvent* x0); - void OnLocalChar(class wxKeyEvent* x0); - void OnLocalEvent(class wxMouseEvent* x0); - double GetSpace(); - double GetDescent(); - void GetExtent(nndouble* x0, nndouble* x1); - void BlinkCaret(); - void OwnCaret(Bool x0); - void Refresh(double x0, double x1, nndouble x2, nndouble x3, int x4, class wxColour* x5); - class wxCursor* AdjustCursor(class wxMouseEvent* x0); - void OnChar(class wxKeyEvent* x0); - void OnEvent(class wxMouseEvent* x0); - void CopySelfTo(class wxMediaBuffer* x0); - class wxMediaBuffer* CopySelf(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaPasteboard::gcMark() { - wxMediaPasteboard::gcMark(); -} -void os_wxMediaPasteboard::gcFixup() { - wxMediaPasteboard::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaPasteboard_class; - -os_wxMediaPasteboard::os_wxMediaPasteboard CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxMediaPasteboard()) -{ -} - -os_wxMediaPasteboard::~os_wxMediaPasteboard() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaPasteboardAfterInteractiveResize(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterInteractiveResize(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-interactive-resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterInteractiveResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterInteractiveResize(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnInteractiveResize(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnInteractiveResize(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-interactive-resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnInteractiveResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnInteractiveResize(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanInteractiveResize(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanInteractiveResize(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-interactive-resize?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanInteractiveResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanInteractiveResize(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-interactive-resize? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterInteractiveMove(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterInteractiveMove(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-interactive-move", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterInteractiveMove)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterInteractiveMove(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnInteractiveMove(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnInteractiveMove(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-interactive-move", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnInteractiveMove)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnInteractiveMove(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanInteractiveMove(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanInteractiveMove(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-interactive-move?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanInteractiveMove)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanInteractiveMove(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-interactive-move? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardInteractiveAdjustResize(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::InteractiveAdjustResize(class wxSnip* x0, nndouble* x1, nndouble* x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(8); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - VAR_STACK_PUSH(7, x2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "interactive-adjust-resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardInteractiveAdjustResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::InteractiveAdjustResize(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - p[POFFSET+2] = (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "interactive-adjust-resize in pasteboard%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "interactive-adjust-resize in pasteboard%"", extracting return value via box"", extracting boxed argument"))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "interactive-adjust-resize in pasteboard%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "interactive-adjust-resize in pasteboard%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardInteractiveAdjustMove(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::InteractiveAdjustMove(class wxSnip* x0, double* x1, double* x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(8); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - VAR_STACK_PUSH(7, x2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "interactive-adjust-move", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardInteractiveAdjustMove)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::InteractiveAdjustMove(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - p[POFFSET+2] = (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "interactive-adjust-move in pasteboard%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "interactive-adjust-move in pasteboard%"", extracting return value via box"", extracting boxed argument"))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "interactive-adjust-move in pasteboard%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "interactive-adjust-move in pasteboard%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardInteractiveAdjustMouse(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::InteractiveAdjustMouse(double* x0, double* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "interactive-adjust-mouse", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardInteractiveAdjustMouse)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::InteractiveAdjustMouse(x0, x1); - } else { - - p[POFFSET+0] = (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x0))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - p[POFFSET+1] = (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - if (x0) *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "interactive-adjust-mouse in pasteboard%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "interactive-adjust-mouse in pasteboard%"", extracting return value via box"", extracting boxed argument"))); - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "interactive-adjust-mouse in pasteboard%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "interactive-adjust-mouse in pasteboard%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnDoubleClick(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnDoubleClick(class wxSnip* x0, class wxMouseEvent* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-double-click", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnDoubleClick)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnDoubleClick(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterSelect(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterSelect(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-select", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterSelect)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterSelect(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnSelect(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnSelect(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-select", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnSelect)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnSelect(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanSelect(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanSelect(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-select?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanSelect)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanSelect(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-select? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterReorder(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterReorder(class wxSnip* x0, class wxSnip* x1, Bool x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-reorder", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterReorder)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterReorder(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x1)); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnReorder(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnReorder(class wxSnip* x0, class wxSnip* x1, Bool x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-reorder", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnReorder)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnReorder(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x1)); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanReorder(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanReorder(class wxSnip* x0, class wxSnip* x1, Bool x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-reorder?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanReorder)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanReorder(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x1)); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-reorder? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterResize(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterResize(class wxSnip* x0, nndouble x1, nndouble x2, Bool x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterResize(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = (x3 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnResize(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnResize(class wxSnip* x0, nndouble x1, nndouble x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnResize(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanResize(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanResize(class wxSnip* x0, nndouble x1, nndouble x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-resize?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanResize(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-resize? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterMoveTo(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterMoveTo(class wxSnip* x0, double x1, double x2, Bool x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-move-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterMoveTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterMoveTo(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = (x3 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnMoveTo(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnMoveTo(class wxSnip* x0, double x1, double x2, Bool x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-move-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnMoveTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnMoveTo(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = (x3 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanMoveTo(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanMoveTo(class wxSnip* x0, double x1, double x2, Bool x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-move-to?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanMoveTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanMoveTo(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = (x3 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-move-to? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterDelete(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterDelete(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-delete", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterDelete)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterDelete(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnDelete(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnDelete(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-delete", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnDelete)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnDelete(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanDelete(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanDelete(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-delete?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanDelete)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanDelete(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-delete? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterInsert(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterInsert(class wxSnip* x0, class wxSnip* x1, double x2, double x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-insert", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterInsert)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterInsert(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnInsert(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnInsert(class wxSnip* x0, class wxSnip* x1, double x2, double x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-insert", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnInsert)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnInsert(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanInsert(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanInsert(class wxSnip* x0, class wxSnip* x1, double x2, double x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-insert?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanInsert)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanInsert(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-insert? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardDoPasteSelection(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::DoPasteSelection(ExactLong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "do-paste-x-selection", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardDoPasteSelection)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::DoPasteSelection(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_integer_value(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardDoPaste(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::DoPaste(ExactLong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "do-paste", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardDoPaste)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::DoPaste(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_integer_value(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardDoCopy(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::DoCopy(ExactLong x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "do-copy", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardDoCopy)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::DoCopy(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_integer_value(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardGetDefaultStyleName(int n, Scheme_Object *p[]); - -string os_wxMediaPasteboard::GetDefaultStyleName() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "default-style-name", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardGetDefaultStyleName)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::GetDefaultStyleName(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - string resval; - resval = (string)WITH_VAR_STACK(objscheme_unbundle_string(v, "default-style-name in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardPutFile(int n, Scheme_Object *p[]); - -npathname os_wxMediaPasteboard::PutFile(nepathname x0, nepathname x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "put-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardPutFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::PutFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - npathname resval; - resval = (npathname)WITH_VAR_STACK(objscheme_unbundle_nullable_pathname(v, "put-file in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardGetFile(int n, Scheme_Object *p[]); - -npathname os_wxMediaPasteboard::GetFile(nepathname x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "get-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardGetFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::GetFile(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - npathname resval; - resval = (npathname)WITH_VAR_STACK(objscheme_unbundle_nullable_pathname(v, "get-file in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterEditSequence(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterEditSequence() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-edit-sequence", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterEditSequence)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterEditSequence(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnEditSequence(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnEditSequence() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-edit-sequence", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnEditSequence)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnEditSequence(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterLoadFile(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterLoadFile(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-load-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterLoadFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterLoadFile(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnLoadFile(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnLoadFile(epathname x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-load-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnLoadFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnLoadFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_fileType(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanLoadFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanLoadFile(epathname x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-load-file?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanLoadFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanLoadFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_fileType(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-load-file? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardAfterSaveFile(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::AfterSaveFile(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "after-save-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAfterSaveFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::AfterSaveFile(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnSaveFile(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnSaveFile(epathname x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-save-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnSaveFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnSaveFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_fileType(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCanSaveFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::CanSaveFile(epathname x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "can-save-file?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCanSaveFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CanSaveFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_fileType(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-save-file? in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardOnNewBox(int n, Scheme_Object *p[]); - -class wxSnip* os_wxMediaPasteboard::OnNewBox(int x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-new-box", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnNewBox)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::OnNewBox(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_bufferType(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "on-new-box in pasteboard%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardOnNewImageSnip(int n, Scheme_Object *p[]); - -class wxImageSnip* os_wxMediaPasteboard::OnNewImageSnip(nxpathname x0, int x1, Bool x2, Bool x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-new-image-snip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnNewImageSnip)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::OnNewImageSnip(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_bitmapType(x1)); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - p[POFFSET+3] = (x3 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - class wxImageSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxImageSnip(v, "on-new-image-snip in pasteboard%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardSizeCacheInvalid(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::SizeCacheInvalid() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "size-cache-invalid", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardSizeCacheInvalid)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::SizeCacheInvalid(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardInvalidateBitmapCache(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::InvalidateBitmapCache(double x0, double x1, double x2, double x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "invalidate-bitmap-cache", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardInvalidateBitmapCache)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::InvalidateBitmapCache(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(objscheme_bundle_nonnegative_symbol_double(x2, "end")); - p[POFFSET+3] = WITH_VAR_STACK(objscheme_bundle_nonnegative_symbol_double(x3, "end")); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnPaint(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnPaint(Bool x0, class wxDC* x1, double x2, double x3, double x4, double x5, double x6, double x7, int x8) -{ - Scheme_Object *p[POFFSET+9] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+9); - VAR_STACK_PUSH(5, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-paint", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnPaint)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnPaint(x0, x1, x2, x3, x4, x5, x6, x7, x8); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxDC(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(scheme_make_double(x5)); - p[POFFSET+6] = WITH_VAR_STACK(scheme_make_double(x6)); - p[POFFSET+7] = WITH_VAR_STACK(scheme_make_double(x7)); - p[POFFSET+8] = WITH_VAR_STACK(bundle_symset_caret(x8)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+9, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardWriteFootersToFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::WriteFootersToFile(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "write-footers-to-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardWriteFootersToFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::WriteFootersToFile(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "write-footers-to-file in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardWriteHeadersToFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::WriteHeadersToFile(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "write-headers-to-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardWriteHeadersToFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::WriteHeadersToFile(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "write-headers-to-file in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardReadFooterFromFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::ReadFooterFromFile(class wxMediaStreamIn* x0, string x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "read-footer-from-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardReadFooterFromFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::ReadFooterFromFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamIn(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_string((char *)x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "read-footer-from-file in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardReadHeaderFromFile(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::ReadHeaderFromFile(class wxMediaStreamIn* x0, string x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "read-header-from-file", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardReadHeaderFromFile)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::ReadHeaderFromFile(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamIn(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_string((char *)x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "read-header-from-file in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardSetFilename(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::SetFilename(nxpathname x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "set-filename", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardSetFilename)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::SetFilename(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_pathname((char *)x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardReleaseSnip(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::ReleaseSnip(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "release-snip", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardReleaseSnip)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::ReleaseSnip(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "release-snip in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardOnSnipModified(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnSnipModified(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-snip-modified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnSnipModified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnSnipModified(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardSetModified(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::SetModified(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "set-modified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardSetModified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::SetModified(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardAdminScrollTo(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::AdminScrollTo(double x0, double x1, nndouble x2, nndouble x3, Bool x4, int x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "scroll-editor-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAdminScrollTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::AdminScrollTo(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = (x4 ? scheme_true : scheme_false); - p[POFFSET+5] = WITH_VAR_STACK(bundle_symset_bias(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "scroll-editor-to in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardSetSnipData(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::SetSnipData(class wxSnip* x0, class wxBufferData* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "set-snip-data", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardSetSnipData)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::SetSnipData(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(objscheme_bundle_wxBufferData(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardGetSnipData(int n, Scheme_Object *p[]); - -class wxBufferData* os_wxMediaPasteboard::GetSnipData(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "get-snip-data", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardGetSnipData)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::GetSnipData(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxBufferData* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxBufferData(v, "get-snip-data in pasteboard%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardNeedsUpdate(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::NeedsUpdate(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4) -{ - Scheme_Object *p[POFFSET+5] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+5); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "needs-update", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardNeedsUpdate)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::NeedsUpdate(x0, x1, x2, x3, x4); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+5, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardResized(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::Resized(class wxSnip* x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "resized", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardResized)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::Resized(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardSetCaretOwner(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::SetCaretOwner(class wxSnip* x0, int x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "set-caret-owner", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardSetCaretOwner)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::SetCaretOwner(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(bundle_symset_focus(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardScrollTo(int n, Scheme_Object *p[]); - -Bool os_wxMediaPasteboard::ScrollTo(class wxSnip* x0, double x1, double x2, nndouble x3, nndouble x4, Bool x5, int x6) -{ - Scheme_Object *p[POFFSET+7] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+7); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "scroll-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardScrollTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::ScrollTo(x0, x1, x2, x3, x4, x5, x6); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = (x5 ? scheme_true : scheme_false); - p[POFFSET+6] = WITH_VAR_STACK(bundle_symset_bias(x6)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+7, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "scroll-to in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardOnDisplaySizeWhenReady(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnDisplaySizeWhenReady() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-display-size-when-ready", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnDisplaySizeWhenReady)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnDisplaySizeWhenReady(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnDisplaySize(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnDisplaySize() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-display-size", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnDisplaySize)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnDisplaySize(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnChange(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnChange() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-change", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnChange)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnChange(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnFocus(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnFocus(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-focus", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnFocus)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnFocus(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnDefaultChar(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnDefaultChar(class wxKeyEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-default-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnDefaultChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnDefaultChar(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnDefaultEvent(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnDefaultEvent(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-default-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnDefaultEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnDefaultEvent(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnLocalChar(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnLocalChar(class wxKeyEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-local-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnLocalChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnLocalChar(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnLocalEvent(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnLocalEvent(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-local-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnLocalEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnLocalEvent(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardGetSpace(int n, Scheme_Object *p[]); - -double os_wxMediaPasteboard::GetSpace() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "get-space", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardGetSpace)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::GetSpace(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "get-space in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardGetDescent(int n, Scheme_Object *p[]); - -double os_wxMediaPasteboard::GetDescent() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "get-descent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardGetDescent)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::GetDescent(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "get-descent in pasteboard%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardGetExtent(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::GetExtent(nndouble* x0, nndouble* x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "get-extent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardGetExtent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::GetExtent(x0, x1); - } else { - - p[POFFSET+0] = ((x0) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x0))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+1] = ((x1) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - if (x0) *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-extent in pasteboard%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in pasteboard%"", extracting return value via box"", extracting boxed argument"))); - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-extent in pasteboard%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in pasteboard%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardBlinkCaret(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::BlinkCaret() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "blink-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardBlinkCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::BlinkCaret(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOwnCaret(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OwnCaret(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "own-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOwnCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OwnCaret(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardRefresh(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::Refresh(double x0, double x1, nndouble x2, nndouble x3, int x4, class wxColour* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "refresh", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardRefresh)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::Refresh(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(bundle_symset_caret(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxColour(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardAdjustCursor(int n, Scheme_Object *p[]); - -class wxCursor* os_wxMediaPasteboard::AdjustCursor(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "adjust-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardAdjustCursor)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::AdjustCursor(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxCursor* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxCursor(v, "adjust-cursor in pasteboard%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardOnChar(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnChar(class wxKeyEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnChar(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardOnEvent(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::OnEvent(class wxMouseEvent* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardOnEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::OnEvent(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCopySelfTo(int n, Scheme_Object *p[]); - -void os_wxMediaPasteboard::CopySelfTo(class wxMediaBuffer* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "copy-self-to", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCopySelfTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaPasteboard::CopySelfTo(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaBuffer(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaPasteboardCopySelf(int n, Scheme_Object *p[]); - -class wxMediaBuffer* os_wxMediaPasteboard::CopySelf() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaPasteboard *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaPasteboard_class, "copy-self", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaPasteboardCopySelf)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaPasteboard::CopySelf(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxMediaBuffer* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(v, "copy-self in pasteboard%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaPasteboardSetScrollStep(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-scroll-step in pasteboard%", n, p); - nndouble x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "set-scroll-step in pasteboard%")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetScrollStep(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardGetScrollStep(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaPasteboard_class, "get-scroll-step in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetScrollStep()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaPasteboardSetSelectionVisible(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-selection-visible in pasteboard%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-selection-visible in pasteboard%")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetSelectionVisible(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardGetSelectionVisible(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "get-selection-visible in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetSelectionVisible()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardSetDragable(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-dragable in pasteboard%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-dragable in pasteboard%")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetDragable(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardGetDragable(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "get-dragable in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetDragable()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardAfterInteractiveResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-interactive-resize in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "after-interactive-resize in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterInteractiveResize(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterInteractiveResize(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnInteractiveResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-interactive-resize in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-interactive-resize in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnInteractiveResize(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnInteractiveResize(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanInteractiveResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-interactive-resize? in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "can-interactive-resize? in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanInteractiveResize(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanInteractiveResize(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardAfterInteractiveMove(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-interactive-move in pasteboard%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "after-interactive-move in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterInteractiveMove(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterInteractiveMove(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnInteractiveMove(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-interactive-move in pasteboard%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "on-interactive-move in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnInteractiveMove(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnInteractiveMove(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanInteractiveMove(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-interactive-move? in pasteboard%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "can-interactive-move? in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanInteractiveMove(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanInteractiveMove(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardInteractiveAdjustResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "interactive-adjust-resize in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - nndouble _x1; - nndouble* x1 = &_x1; - nndouble _x2; - nndouble* x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "interactive-adjust-resize in pasteboard%", 0)); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "interactive-adjust-resize in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "interactive-adjust-resize in pasteboard%"", extracting boxed argument"))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "interactive-adjust-resize in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "interactive-adjust-resize in pasteboard%"", extracting boxed argument"))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::InteractiveAdjustResize(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->InteractiveAdjustResize(x0, x1, x2)); - - - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardInteractiveAdjustMove(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "interactive-adjust-move in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double _x1; - double* x1 = &_x1; - double _x2; - double* x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "interactive-adjust-move in pasteboard%", 0)); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "interactive-adjust-move in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "interactive-adjust-move in pasteboard%"", extracting boxed argument"))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "interactive-adjust-move in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "interactive-adjust-move in pasteboard%"", extracting boxed argument"))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::InteractiveAdjustMove(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->InteractiveAdjustMove(x0, x1, x2)); - - - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardInteractiveAdjustMouse(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "interactive-adjust-mouse in pasteboard%", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "interactive-adjust-mouse in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "interactive-adjust-mouse in pasteboard%"", extracting boxed argument"))); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "interactive-adjust-mouse in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "interactive-adjust-mouse in pasteboard%"", extracting boxed argument"))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::InteractiveAdjustMouse(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->InteractiveAdjustMouse(x0, x1)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnDoubleClick(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-double-click in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxMouseEvent* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-double-click in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+1], "on-double-click in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnDoubleClick(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnDoubleClick(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardAfterSelect(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-select in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "after-select in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "after-select in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterSelect(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterSelect(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnSelect(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-select in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-select in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "on-select in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnSelect(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnSelect(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanSelect(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-select? in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "can-select? in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "can-select? in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanSelect(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanSelect(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardAfterReorder(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-reorder in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - Bool x2; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "after-reorder in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "after-reorder in pasteboard%", 0)); - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "after-reorder in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterReorder(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterReorder(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnReorder(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-reorder in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - Bool x2; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-reorder in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "on-reorder in pasteboard%", 0)); - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "on-reorder in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnReorder(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnReorder(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanReorder(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-reorder? in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - Bool x2; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "can-reorder? in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "can-reorder? in pasteboard%", 0)); - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "can-reorder? in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanReorder(x0, x1, x2)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanReorder(x0, x1, x2)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardAfterResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-resize in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - nndouble x1; - nndouble x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "after-resize in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "after-resize in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "after-resize in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "after-resize in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterResize(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterResize(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-resize in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - nndouble x1; - nndouble x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-resize in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "on-resize in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "on-resize in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnResize(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnResize(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-resize? in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - nndouble x1; - nndouble x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "can-resize? in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "can-resize? in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "can-resize? in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanResize(x0, x1, x2)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanResize(x0, x1, x2)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardAfterMoveTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-move-to in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "after-move-to in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "after-move-to in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "after-move-to in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "after-move-to in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterMoveTo(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterMoveTo(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnMoveTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-move-to in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-move-to in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-move-to in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-move-to in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "on-move-to in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnMoveTo(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnMoveTo(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanMoveTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-move-to? in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "can-move-to? in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "can-move-to? in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "can-move-to? in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "can-move-to? in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanMoveTo(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanMoveTo(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardAfterDelete(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-delete in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "after-delete in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterDelete(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterDelete(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnDelete(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-delete in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-delete in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnDelete(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnDelete(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanDelete(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-delete? in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "can-delete? in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanDelete(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanDelete(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardAfterInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-insert in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - double x2; - double x3; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "after-insert in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "after-insert in pasteboard%", 1)); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "after-insert in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "after-insert in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterInsert(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterInsert(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-insert in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - double x2; - double x3; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-insert in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "on-insert in pasteboard%", 1)); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-insert in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-insert in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnInsert(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnInsert(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-insert? in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - double x2; - double x3; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "can-insert? in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "can-insert? in pasteboard%", 1)); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "can-insert? in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "can-insert? in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanInsert(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanInsert(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardFindNextSelectedSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaPasteboard_class, "find-next-selected-snip in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "find-next-selected-snip in pasteboard%", 1)); - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->FindNextSelectedSnip(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaPasteboardIsSelected(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "is-selected? in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "is-selected? in pasteboard%", 1)); - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->IsSelected(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardFindSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaPasteboard_class, "find-snip in pasteboard%", n, p); - double x0; - double x1; - class wxSnip* x2 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x2); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-snip in pasteboard%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "find-snip in pasteboard%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+2], "find-snip in pasteboard%", 1)); - } else - x2 = NULL; - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->FindSnip(x0, x1, x2)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaPasteboardGetCenter(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "get-center in pasteboard%", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get-center in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-center in pasteboard%"", extracting boxed argument"))); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get-center in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get-center in pasteboard%"", extracting boxed argument"))); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetCenter(x0, x1)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardRemoveSelected(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "remove-selected in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "remove-selected in pasteboard%", 0)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->RemoveSelected(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardNoSelected(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "no-selected in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->NoSelected()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardAddSelected(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "add-selected in pasteboard%", n, p); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+0], NULL, 0))) { - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("add-selected in pasteboard% (snip% case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "add-selected in pasteboard% (snip% case)", 0)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AddSelected(x0)); - - - - READY_TO_PRE_RETURN; - } else { - double x0; - double x1; - nndouble x2; - nndouble x3; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n != (POFFSET+4)) - WITH_VAR_STACK(scheme_wrong_count_m("add-selected in pasteboard% (rectangle case)", POFFSET+4, POFFSET+4, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "add-selected in pasteboard% (rectangle case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "add-selected in pasteboard% (rectangle case)")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "add-selected in pasteboard% (rectangle case)")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "add-selected in pasteboard% (rectangle case)")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AddSelected(x0, x1, x2, x3)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardSetSelected(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-selected in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "set-selected in pasteboard%", 0)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetSelected(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardChangeStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "change-style in pasteboard%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_wxStyleDelta(p[POFFSET+0], NULL, 1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+1], NULL, 1))) { - class wxStyleDelta* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("change-style in pasteboard% (style-delta% and snip% case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "change-style in pasteboard% (style-delta% and snip% case)", 1)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "change-style in pasteboard% (style-delta% and snip% case)", 1)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->ChangeStyle(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxStyleDelta(p[POFFSET+0], NULL, 1))) { - class wxStyleDelta* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("change-style in pasteboard% (style-delta% without position or snip% case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "change-style in pasteboard% (style-delta% without position or snip% case)", 1)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->ChangeStyle(x0)); - - - - READY_TO_PRE_RETURN; - } else { - class wxStyle* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - if ((n < (POFFSET+1)) || (n > (POFFSET+2))) - WITH_VAR_STACK(scheme_wrong_count_m("change-style in pasteboard% (style% case)", POFFSET+1, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "change-style in pasteboard% (style% case)", 1)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "change-style in pasteboard% (style% case)", 1)); - } else - x1 = NULL; - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->ChangeStyle(x0, x1)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardSetAfter(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-after in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "set-after in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "set-after in pasteboard%", 1)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetAfter(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardSetBefore(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-before in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "set-before in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "set-before in pasteboard%", 1)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetBefore(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardLower(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "lower in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "lower in pasteboard%", 0)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Lower(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardRaise(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "raise in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "raise in pasteboard%", 0)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Raise(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "resize in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - nndouble x1; - nndouble x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "resize in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "resize in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "resize in pasteboard%")); - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Resize(x0, x1, x2)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardMove(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "move in pasteboard%", n, p); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+0], NULL, 0))) { - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+3)) - WITH_VAR_STACK(scheme_wrong_count_m("move in pasteboard% (snip% case)", POFFSET+3, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "move in pasteboard% (snip% case)", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "move in pasteboard% (snip% case)")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "move in pasteboard% (snip% case)")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Move(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else { - double x0; - double x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("move in pasteboard% (without snip% case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "move in pasteboard% (without snip% case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "move in pasteboard% (without snip% case)")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Move(x0, x1)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardMoveTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "move-to in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "move-to in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "move-to in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "move-to in pasteboard%")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->MoveTo(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardRemove(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "remove in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "remove in pasteboard%", 0)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Remove(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardErase(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "erase in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Erase()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardDoPasteSelection(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "do-paste-x-selection in pasteboard%", n, p); - ExactLong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "do-paste-x-selection in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::DoPasteSelection(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->DoPasteSelection(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardDoPaste(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "do-paste in pasteboard%", n, p); - ExactLong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "do-paste in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::DoPaste(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->DoPaste(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardDoCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "do-copy in pasteboard%", n, p); - ExactLong x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "do-copy in pasteboard%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "do-copy in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::DoCopy(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->DoCopy(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardDelete(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "delete in pasteboard%", n, p); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+0], NULL, 0))) { - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("delete in pasteboard% (snip% case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "delete in pasteboard% (snip% case)", 0)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Delete(x0)); - - - - READY_TO_PRE_RETURN; - } else { - - SETUP_VAR_STACK_PRE_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("delete in pasteboard% (no argument case)", POFFSET+0, POFFSET+0, n, p, 1)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Delete()); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "insert in pasteboard%", n, p); - if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+0], NULL, 0)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+1], NULL))) { - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+3)) - WITH_VAR_STACK(scheme_wrong_count_m("insert in pasteboard% (snip% with location case)", POFFSET+3, POFFSET+3, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "insert in pasteboard% (snip% with location case)", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "insert in pasteboard% (snip% with location case)")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "insert in pasteboard% (snip% with location case)")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1, x2)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+3)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+0], NULL, 0)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+1], NULL, 1)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+2], NULL))) { - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - double x2; - double x3; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - if (n != (POFFSET+4)) - WITH_VAR_STACK(scheme_wrong_count_m("insert in pasteboard% (snip% with before-snip% and location case)", POFFSET+4, POFFSET+4, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "insert in pasteboard% (snip% with before-snip% and location case)", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "insert in pasteboard% (snip% with before-snip% and location case)", 1)); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "insert in pasteboard% (snip% with before-snip% and location case)")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "insert in pasteboard% (snip% with before-snip% and location case)")); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1, x2, x3)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+2)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+0], NULL, 0)) && WITH_REMEMBERED_STACK(objscheme_istype_wxSnip(p[POFFSET+1], NULL, 1))) { - class wxSnip* x0 INIT_NULLED_OUT; - class wxSnip* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("insert in pasteboard% (snip% with before-snip% case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "insert in pasteboard% (snip% with before-snip% case)", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+1], "insert in pasteboard% (snip% with before-snip% case)", 1)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else { - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("insert in pasteboard% (snip% without position case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "insert in pasteboard% (snip% without position case)", 0)); - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0)); - - - - READY_TO_PRE_RETURN; - } - - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardGetDefaultStyleName(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - string r; - objscheme_check_valid(os_wxMediaPasteboard_class, "default-style-name in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::GetDefaultStyleName()); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetDefaultStyleName()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r)); -} - -static Scheme_Object *os_wxMediaPasteboardGetFlattenedText(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzstring r; - objscheme_check_valid(os_wxMediaPasteboard_class, "get-flattened-text in pasteboard%", n, p); - long _x0; - long* x0 = &_x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetFlattenedText(x0)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(scheme_make_sized_char_string(r, _x0, 0)); -} - -static Scheme_Object *os_wxMediaPasteboardPutFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - npathname r; - objscheme_check_valid(os_wxMediaPasteboard_class, "put-file in pasteboard%", n, p); - nepathname x0 INIT_NULLED_OUT; - nepathname x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = (nepathname)WITH_VAR_STACK(objscheme_unbundle_nullable_epathname(p[POFFSET+0], "put-file in pasteboard%")); - x1 = (nepathname)WITH_VAR_STACK(objscheme_unbundle_nullable_epathname(p[POFFSET+1], "put-file in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::PutFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->PutFile(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_pathname((char *)r)); -} - -static Scheme_Object *os_wxMediaPasteboardGetFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - npathname r; - objscheme_check_valid(os_wxMediaPasteboard_class, "get-file in pasteboard%", n, p); - nepathname x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (nepathname)WITH_VAR_STACK(objscheme_unbundle_nullable_epathname(p[POFFSET+0], "get-file in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::GetFile(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetFile(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_pathname((char *)r)); -} - -static Scheme_Object *os_wxMediaPasteboardAfterEditSequence(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-edit-sequence in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterEditSequence()); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterEditSequence()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnEditSequence(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-edit-sequence in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnEditSequence()); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnEditSequence()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardAfterLoadFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-load-file in pasteboard%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "after-load-file in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterLoadFile(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterLoadFile(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnLoadFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-load-file in pasteboard%", n, p); - epathname x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "on-load-file in pasteboard%")); - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "on-load-file in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnLoadFile(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnLoadFile(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanLoadFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-load-file? in pasteboard%", n, p); - epathname x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "can-load-file? in pasteboard%")); - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "can-load-file? in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanLoadFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanLoadFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardAfterSaveFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "after-save-file in pasteboard%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "after-save-file in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AfterSaveFile(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AfterSaveFile(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnSaveFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-save-file in pasteboard%", n, p); - epathname x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "on-save-file in pasteboard%")); - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "on-save-file in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnSaveFile(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnSaveFile(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCanSaveFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "can-save-file? in pasteboard%", n, p); - epathname x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (epathname)WITH_VAR_STACK(objscheme_unbundle_epathname(p[POFFSET+0], "can-save-file? in pasteboard%")); - x1 = WITH_VAR_STACK(unbundle_symset_fileType(p[POFFSET+1], "can-save-file? in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CanSaveFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CanSaveFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardOnNewBox(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaPasteboard_class, "on-new-box in pasteboard%", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_bufferType(p[POFFSET+0], "on-new-box in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnNewBox(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnNewBox(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaPasteboardOnNewImageSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxImageSnip* r; - objscheme_check_valid(os_wxMediaPasteboard_class, "on-new-image-snip in pasteboard%", n, p); - nxpathname x0 INIT_NULLED_OUT; - int x1; - Bool x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (nxpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_xpathname(p[POFFSET+0], "on-new-image-snip in pasteboard%")); - x1 = WITH_VAR_STACK(unbundle_symset_bitmapType(p[POFFSET+1], "on-new-image-snip in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "on-new-image-snip in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "on-new-image-snip in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnNewImageSnip(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnNewImageSnip(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxImageSnip(r)); -} - -static Scheme_Object *os_wxMediaPasteboardSizeCacheInvalid(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "size-cache-invalid in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::SizeCacheInvalid()); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SizeCacheInvalid()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardInvalidateBitmapCache(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "invalidate-bitmap-cache in pasteboard%", n, p); - double x0; - double x1; - double x2; - double x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "invalidate-bitmap-cache in pasteboard%")); - } else - x0 = 0.0; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "invalidate-bitmap-cache in pasteboard%")); - } else - x1 = 0.0; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+2], "end", "invalidate-bitmap-cache in pasteboard%")); - } else - x2 = -1.0; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+3], "end", "invalidate-bitmap-cache in pasteboard%")); - } else - x3 = -1.0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::InvalidateBitmapCache(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->InvalidateBitmapCache(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnPaint(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-paint in pasteboard%", n, p); - Bool x0; - class wxDC* x1 INIT_NULLED_OUT; - double x2; - double x3; - double x4; - double x5; - double x6; - double x7; - int x8; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "on-paint in pasteboard%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+1], "on-paint in pasteboard%", 0)); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-paint in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-paint in pasteboard%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-paint in pasteboard%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "on-paint in pasteboard%")); - x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+6], "on-paint in pasteboard%")); - x7 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+7], "on-paint in pasteboard%")); - x8 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+8], "on-paint in pasteboard%")); - - if (x1 && !x1->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("editor<%>","on-paint"), "bad device context: ", p[POFFSET+1])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnPaint(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnPaint(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardWriteFootersToFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "write-footers-to-file in pasteboard%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write-footers-to-file in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::WriteFootersToFile(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->WriteFootersToFile(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardWriteHeadersToFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "write-headers-to-file in pasteboard%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write-headers-to-file in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::WriteHeadersToFile(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->WriteHeadersToFile(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardReadFooterFromFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "read-footer-from-file in pasteboard%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - string x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read-footer-from-file in pasteboard%", 0)); - x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "read-footer-from-file in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::ReadFooterFromFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->ReadFooterFromFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardReadHeaderFromFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "read-header-from-file in pasteboard%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - string x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read-header-from-file in pasteboard%", 0)); - x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+1], "read-header-from-file in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::ReadHeaderFromFile(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->ReadHeaderFromFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardWriteToFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "write-to-file in pasteboard%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write-to-file in pasteboard%", 0)); - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->WriteToFile(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardReadFromFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "read-from-file in pasteboard%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read-from-file in pasteboard%", 0)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "read-from-file in pasteboard%")); - } else - x1 = FALSE; - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->ReadFromFile(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardSetFilename(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-filename in pasteboard%", n, p); - nxpathname x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (nxpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_xpathname(p[POFFSET+0], "set-filename in pasteboard%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "set-filename in pasteboard%")); - } else - x1 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::SetFilename(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetFilename(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardReleaseSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "release-snip in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "release-snip in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::ReleaseSnip(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->ReleaseSnip(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardOnSnipModified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-snip-modified in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "on-snip-modified in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "on-snip-modified in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnSnipModified(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnSnipModified(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardSetModified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-modified in pasteboard%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-modified in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::SetModified(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetModified(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardAdminScrollTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "scroll-editor-to in pasteboard%", n, p); - double x0; - double x1; - nndouble x2; - nndouble x3; - Bool x4; - int x5; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "scroll-editor-to in pasteboard%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "scroll-editor-to in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "scroll-editor-to in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "scroll-editor-to in pasteboard%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+4], "scroll-editor-to in pasteboard%")); - x5 = WITH_VAR_STACK(unbundle_symset_bias(p[POFFSET+5], "scroll-editor-to in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AdminScrollTo(x0, x1, x2, x3, x4, x5)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AdminScrollTo(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardSetSnipData(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-snip-data in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - class wxBufferData* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "set-snip-data in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxBufferData(p[POFFSET+1], "set-snip-data in pasteboard%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::SetSnipData(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetSnipData(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardGetSnipData(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBufferData* r; - objscheme_check_valid(os_wxMediaPasteboard_class, "get-snip-data in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "get-snip-data in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::GetSnipData(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetSnipData(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferData(r)); -} - -static Scheme_Object *os_wxMediaPasteboardNeedsUpdate(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "needs-update in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble x3; - nndouble x4; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "needs-update in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "needs-update in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "needs-update in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "needs-update in pasteboard%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+4], "needs-update in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::NeedsUpdate(x0, x1, x2, x3, x4)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->NeedsUpdate(x0, x1, x2, x3, x4)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardResized(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "resized in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "resized in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "resized in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::Resized(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Resized(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardSetCaretOwner(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "set-caret-owner in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "set-caret-owner in pasteboard%", 1)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_focus(p[POFFSET+1], "set-caret-owner in pasteboard%")); - } else - x1 = wxFOCUS_IMMEDIATE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::SetCaretOwner(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->SetCaretOwner(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardScrollTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaPasteboard_class, "scroll-to in pasteboard%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble x3; - nndouble x4; - Bool x5; - int x6; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "scroll-to in pasteboard%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "scroll-to in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "scroll-to in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "scroll-to in pasteboard%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+4], "scroll-to in pasteboard%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "scroll-to in pasteboard%")); - if (n > (POFFSET+6)) { - x6 = WITH_VAR_STACK(unbundle_symset_bias(p[POFFSET+6], "scroll-to in pasteboard%")); - } else - x6 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::ScrollTo(x0, x1, x2, x3, x4, x5, x6)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->ScrollTo(x0, x1, x2, x3, x4, x5, x6)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaPasteboardOnDisplaySizeWhenReady(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-display-size-when-ready in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnDisplaySizeWhenReady()); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnDisplaySizeWhenReady()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnDisplaySize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-display-size in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnDisplaySize()); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnDisplaySize()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnChange(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-change in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnChange()); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnChange()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnFocus(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-focus in pasteboard%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "on-focus in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnFocus(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnFocus(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnDefaultChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-default-char in pasteboard%", n, p); - class wxKeyEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+0], "on-default-char in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnDefaultChar(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnDefaultChar(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnDefaultEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-default-event in pasteboard%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "on-default-event in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnDefaultEvent(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnDefaultEvent(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnLocalChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-local-char in pasteboard%", n, p); - class wxKeyEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+0], "on-local-char in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnLocalChar(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnLocalChar(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnLocalEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-local-event in pasteboard%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "on-local-event in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnLocalEvent(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnLocalEvent(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardFindFirstSnip(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaPasteboard_class, "find-first-snip in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->FindFirstSnip()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaPasteboardGetSpace(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaPasteboard_class, "get-space in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::GetSpace()); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetSpace()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaPasteboardGetDescent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaPasteboard_class, "get-descent in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::GetDescent()); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetDescent()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaPasteboardGetExtent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "get-extent in pasteboard%", n, p); - nndouble _x0; - nndouble* x0 = &_x0; - nndouble _x1; - nndouble* x1 = &_x1; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-extent in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in pasteboard%"", extracting boxed argument"))); - if (XC_SCHEME_NULLP(p[POFFSET+1])) - x1 = NULL; - else - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+1], "get-extent in pasteboard%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in pasteboard%"", extracting boxed argument"))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::GetExtent(x0, x1)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->GetExtent(x0, x1)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1) && !XC_SCHEME_NULLP(p[POFFSET+1])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardBlinkCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "blink-caret in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::BlinkCaret()); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->BlinkCaret()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOwnCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "own-caret in pasteboard%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "own-caret in pasteboard%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OwnCaret(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OwnCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardRefresh(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "refresh in pasteboard%", n, p); - double x0; - double x1; - nndouble x2; - nndouble x3; - int x4; - class wxColour* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "refresh in pasteboard%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "refresh in pasteboard%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "refresh in pasteboard%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "refresh in pasteboard%")); - x4 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+4], "refresh in pasteboard%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+5], "refresh in pasteboard%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::Refresh(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Refresh(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardAdjustCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxCursor* r; - objscheme_check_valid(os_wxMediaPasteboard_class, "adjust-cursor in pasteboard%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "adjust-cursor in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::AdjustCursor(x0)); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->AdjustCursor(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxCursor(r)); -} - -static Scheme_Object *os_wxMediaPasteboardOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-char in pasteboard%", n, p); - class wxKeyEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+0], "on-char in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnChar(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnChar(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "on-event in pasteboard%", n, p); - class wxMouseEvent* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+0], "on-event in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::OnEvent(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->OnEvent(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCopySelfTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "copy-self-to in pasteboard%", n, p); - class wxMediaBuffer* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(p[POFFSET+0], "copy-self-to in pasteboard%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CopySelfTo(x0)); - else - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CopySelfTo(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCopySelf(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaBuffer* r; - objscheme_check_valid(os_wxMediaPasteboard_class, "copy-self in pasteboard%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaPasteboard::CopySelf()); - else - r = WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->CopySelf()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaBuffer(r)); -} - -static Scheme_Object *os_wxMediaPasteboardKill(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "kill in pasteboard%", n, p); - ExactLong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "kill in pasteboard%")); - } else - x0 = 0; - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Kill(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardPasteSelection(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "paste-x-selection in pasteboard%", n, p); - ExactLong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "paste-x-selection in pasteboard%")); - } else - x0 = 0; - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->PasteSelection(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardPaste(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "paste in pasteboard%", n, p); - ExactLong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+0], "paste in pasteboard%")); - } else - x0 = 0; - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Paste(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "copy in pasteboard%", n, p); - Bool x0; - ExactLong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "copy in pasteboard%")); - } else - x0 = FALSE; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "copy in pasteboard%")); - } else - x1 = 0; - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Copy(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboardCut(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaPasteboard_class, "cut in pasteboard%", n, p); - Bool x0; - ExactLong x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "cut in pasteboard%")); - } else - x0 = FALSE; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_ExactLong(p[POFFSET+1], "cut in pasteboard%")); - } else - x1 = 0; - - - WITH_VAR_STACK(((wxMediaPasteboard *)((Scheme_Class_Object *)p[0])->primdata)->Cut(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaPasteboard_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaPasteboard *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in pasteboard%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxMediaPasteboard CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaPasteboard()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxMediaPasteboard(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaPasteboard_class); - - os_wxMediaPasteboard_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "pasteboard%", "editor%", (Scheme_Method_Prim *)os_wxMediaPasteboard_ConstructScheme, 116)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-scroll-step" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetScrollStep, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-scroll-step" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetScrollStep, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-selection-visible" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetSelectionVisible, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-selection-visible" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetSelectionVisible, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-dragable" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetDragable, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-dragable" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetDragable, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-interactive-resize" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterInteractiveResize, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-interactive-resize" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnInteractiveResize, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-interactive-resize?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanInteractiveResize, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-interactive-move" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterInteractiveMove, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-interactive-move" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnInteractiveMove, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-interactive-move?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanInteractiveMove, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "interactive-adjust-resize" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardInteractiveAdjustResize, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "interactive-adjust-move" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardInteractiveAdjustMove, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "interactive-adjust-mouse" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardInteractiveAdjustMouse, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-double-click" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnDoubleClick, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-select" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterSelect, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-select" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnSelect, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-select?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanSelect, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-reorder" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterReorder, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-reorder" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnReorder, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-reorder?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanReorder, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-resize" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterResize, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-resize" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnResize, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-resize?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanResize, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-move-to" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterMoveTo, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-move-to" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnMoveTo, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-move-to?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanMoveTo, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-delete" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterDelete, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-delete" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnDelete, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-delete?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanDelete, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-insert" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterInsert, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-insert" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnInsert, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-insert?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanInsert, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "find-next-selected-snip" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardFindNextSelectedSnip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "is-selected?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardIsSelected, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "find-snip" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardFindSnip, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-center" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetCenter, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "remove-selected" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardRemoveSelected, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "no-selected" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardNoSelected, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "add-selected" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAddSelected, 1, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-selected" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetSelected, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "change-style" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardChangeStyle, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-after" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetAfter, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-before" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetBefore, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "lower" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardLower, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "raise" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardRaise, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "resize" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardResize, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "move" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardMove, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "move-to" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardMoveTo, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "remove" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardRemove, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "erase" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardErase, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "do-paste-x-selection" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardDoPasteSelection, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "do-paste" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardDoPaste, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "do-copy" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardDoCopy, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "delete" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardDelete, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "insert" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardInsert, 1, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "default-style-name" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetDefaultStyleName, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-flattened-text" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetFlattenedText, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "put-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardPutFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-edit-sequence" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterEditSequence, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-edit-sequence" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnEditSequence, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-load-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterLoadFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-load-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnLoadFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-load-file?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanLoadFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "after-save-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAfterSaveFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-save-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnSaveFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "can-save-file?" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCanSaveFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-new-box" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnNewBox, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-new-image-snip" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnNewImageSnip, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "size-cache-invalid" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSizeCacheInvalid, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "invalidate-bitmap-cache" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardInvalidateBitmapCache, 0, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-paint" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnPaint, 9, 9)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "write-footers-to-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardWriteFootersToFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "write-headers-to-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardWriteHeadersToFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "read-footer-from-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardReadFooterFromFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "read-header-from-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardReadHeaderFromFile, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "write-to-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardWriteToFile, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "read-from-file" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardReadFromFile, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-filename" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetFilename, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "release-snip" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardReleaseSnip, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-snip-modified" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnSnipModified, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-modified" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetModified, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "scroll-editor-to" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAdminScrollTo, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-snip-data" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetSnipData, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-snip-data" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetSnipData, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "needs-update" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardNeedsUpdate, 5, 5)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "resized" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardResized, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "set-caret-owner" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardSetCaretOwner, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "scroll-to" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardScrollTo, 6, 7)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-display-size-when-ready" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnDisplaySizeWhenReady, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-display-size" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnDisplaySize, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-change" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnChange, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-focus" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnFocus, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-default-char" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnDefaultChar, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-default-event" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnDefaultEvent, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-local-char" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnLocalChar, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-local-event" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnLocalEvent, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "find-first-snip" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardFindFirstSnip, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-space" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetSpace, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-descent" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetDescent, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "get-extent" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardGetExtent, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "blink-caret" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardBlinkCaret, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "own-caret" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOwnCaret, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "refresh" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardRefresh, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "adjust-cursor" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardAdjustCursor, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-char" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnChar, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "on-event" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardOnEvent, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "copy-self-to" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCopySelfTo, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "copy-self" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCopySelf, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "kill" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardKill, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "paste-x-selection" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardPasteSelection, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "paste" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardPaste, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "copy" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCopy, 0, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaPasteboard_class, "cut" " method", (Scheme_Method_Prim *)os_wxMediaPasteboardCut, 0, 2)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaPasteboard_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMediaPasteboard, wxTYPE_MEDIA_PASTEBOARD)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaPasteboard(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaPasteboard_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "pasteboard% object or " XC_NULL_STR: "pasteboard% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaPasteboard(class wxMediaPasteboard *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_MEDIA_PASTEBOARD) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaPasteboard_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaPasteboard *objscheme_unbundle_wxMediaPasteboard(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaPasteboard(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaPasteboard *)o->primdata; - else - return (wxMediaPasteboard *)o->primdata; -} - diff --git a/src/mred/wxs/wxs_mpb.h b/src/mred/wxs/wxs_mpb.h deleted file mode 100644 index 2485da75f9..0000000000 --- a/src/mred/wxs/wxs_mpb.h +++ /dev/null @@ -1,176 +0,0 @@ -#ifndef WXS_SETUP_ONLY -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxImageSnip *objscheme_unbundle_wxImageSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxColour(class wxColour *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxStyleDelta(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxImageSnip(class wxImageSnip *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxColour *objscheme_unbundle_wxColour(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxCursor(class wxCursor *); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *); -#endif -void objscheme_setup_wxMediaPasteboard(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaPasteboard(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaPasteboard(class wxMediaPasteboard *realobj); -class wxMediaPasteboard *objscheme_unbundle_wxMediaPasteboard(Scheme_Object *obj, const char *where, int nullOK); -#endif diff --git a/src/mred/wxs/wxs_mpb.xc b/src/mred/wxs/wxs_mpb.xc deleted file mode 100644 index 9807757852..0000000000 --- a/src/mred/wxs/wxs_mpb.xc +++ /dev/null @@ -1,106 +0,0 @@ - -@INCLUDE prefix.xci - -#include "wx_media.h" - -@INCLUDE wxs.xci - -@HEADER - -@INCLUDE wxs_eds.xci -@INCLUDE wxs_bmt.xci - -@CLASSBASE wxMediaPasteboard "pasteboard" : "editor" / nofnl - -@CREATOR () - -@CLASSID wxTYPE_MEDIA_PASTEBOARD - -@SETMARK X = -@SETMARK Y = d -@SETMARK Z = d -@INCLUDE wxs_mbuf.xci - -@ "insert" : void Insert(wxSnip!,double,double); <> snip% with location -@ "insert" : void Insert(wxSnip!,wxSnip^); <> snip% with before-snip% -@ "insert" : void Insert(wxSnip!,wxSnip^,double,double); <> snip% with before-snip% and location - -@ "delete" : void Delete(); <> no argument -@ "delete" : void Delete(wxSnip!); <> snip% - -@ v "do-copy" : void DoCopy(ExactLong,bool); -@ v "do-paste" : void DoPaste(ExactLong); -@ v "do-paste-x-selection" : void DoPasteSelection(ExactLong); - -@ "erase" : void Erase(); - -@ "remove" : void Remove(wxSnip!); - -@ "move-to" : void MoveTo(wxSnip!,double,double); -@ "move" : void Move(wxSnip!,double,double); <> snip% -@ "move" : void Move(double,double); <> without snip% - -@ "resize" : bool Resize(wxSnip!, nndouble, nndouble); - -@ "raise" : void Raise(wxSnip!); -@ "lower" : void Lower(wxSnip!); -@ "set-before" : void SetBefore(wxSnip!,wxSnip^); -@ "set-after" : void SetAfter(wxSnip!,wxSnip^); - -@ "change-style" : void ChangeStyle(wxStyleDelta^,wxSnip^); <> style-delta% and snip% -@ "change-style" : void ChangeStyle(wxStyle^,wxSnip^=NULL); <> style% - -@ "set-selected" : void SetSelected(wxSnip!); -@ "add-selected" : void AddSelected(wxSnip!); <> snip% -@ "add-selected" : void AddSelected(double,double,nndouble,nndouble); <> rectangle -@ "no-selected" : void NoSelected(); -@ "remove-selected" : void RemoveSelected(wxSnip!); - -@ "get-center" : void GetCenter(double*, double*); - -@ "find-snip" : wxSnip^ FindSnip(double,double,wxSnip^=NULL); -@ "is-selected?" : bool IsSelected(wxSnip^); -@ "find-next-selected-snip" : wxSnip^ FindNextSelectedSnip(wxSnip^); - -@ v "can-insert?" : bool CanInsert(wxSnip!,wxSnip^,double, double); -@ v "on-insert" : void OnInsert(wxSnip!,wxSnip^,double, double); -@ v "after-insert" : void AfterInsert(wxSnip!,wxSnip^,double,double); -@ v "can-delete?" : bool CanDelete(wxSnip!); -@ v "on-delete" : void OnDelete(wxSnip!); -@ v "after-delete" : void AfterDelete(wxSnip!); -@ v "can-move-to?" : bool CanMoveTo(wxSnip!,double,double,bool); -@ v "on-move-to" : void OnMoveTo(wxSnip!,double,double,bool); -@ v "after-move-to" : void AfterMoveTo(wxSnip!,double,double,bool); -@ v "can-resize?" : bool CanResize(wxSnip!,nndouble,nndouble); -@ v "on-resize" : void OnResize(wxSnip!,nndouble,nndouble); -@ v "after-resize" : void AfterResize(wxSnip!,nndouble,nndouble,bool); -@ v "can-reorder?" : bool CanReorder(wxSnip!,wxSnip!,bool); -@ v "on-reorder" : void OnReorder(wxSnip!,wxSnip!,bool); -@ v "after-reorder" : void AfterReorder(wxSnip!,wxSnip!,bool); - -@ v "can-select?" : bool CanSelect(wxSnip!, bool); -@ v "on-select" : void OnSelect(wxSnip!, bool); -@ v "after-select" : void AfterSelect(wxSnip!, bool); - -@ v "on-double-click" : void OnDoubleClick(wxSnip!, wxMouseEvent!); - -@ v "interactive-adjust-mouse" : void InteractiveAdjustMouse(double*,double*); -@ v "interactive-adjust-move" : void InteractiveAdjustMove(wxSnip!,double*,double*); -@ v "interactive-adjust-resize" : void InteractiveAdjustResize(wxSnip!,nndouble*,nndouble*); - -@ v "can-interactive-move?" : bool CanInteractiveMove(wxMouseEvent!); -@ v "on-interactive-move" : void OnInteractiveMove(wxMouseEvent!); -@ v "after-interactive-move" : void AfterInteractiveMove(wxMouseEvent!); -@ v "can-interactive-resize?" : bool CanInteractiveResize(wxSnip!); -@ v "on-interactive-resize" : void OnInteractiveResize(wxSnip!); -@ v "after-interactive-resize" : void AfterInteractiveResize(wxSnip!); - -@ "get-dragable" : bool GetDragable(); -@ "set-dragable" : void SetDragable(bool); -@ "get-selection-visible" : bool GetSelectionVisible(); -@ "set-selection-visible" : void SetSelectionVisible(bool); - -@ "get-scroll-step" : double GetScrollStep(); -@ "set-scroll-step" : void SetScrollStep(nndouble); - -@END diff --git a/src/mred/wxs/wxs_snip.cxx b/src/mred/wxs/wxs_snip.cxx deleted file mode 100644 index e4e21ff7f3..0000000000 --- a/src/mred/wxs/wxs_snip.cxx +++ /dev/null @@ -1,12462 +0,0 @@ -/* DO NOT EDIT THIS FILE. */ -/* This file was generated by xctocc from "wxs_snip.xc". */ - - -#if defined(_MSC_VER) -# include "wx.h" -#endif -#if defined(OS_X) -# include "common.h" -#endif - -#include "wx_media.h" - - - - -#ifdef wx_x -# define BM_SELECTED(map) ((map)->selectedTo) -#endif -#if defined(wx_mac) || defined(wx_msw) -# define BM_SELECTED(map) ((map)->selectedInto) -#endif -# define BM_IN_USE(map) ((map)->selectedIntoDC) - - - - -#define ESCAPE_NO_RET_VAL /*empty*/ - - -#include "wxscheme.h" -#include "wxs_snip.h" - -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - - -static Scheme_Object *caret_wxSNIP_DRAW_NO_CARET_sym = NULL; -static Scheme_Object *caret_wxSNIP_DRAW_SHOW_CARET_sym = NULL; -static Scheme_Object *caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym = NULL; - -static void init_symset_caret(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(caret_wxSNIP_DRAW_NO_CARET_sym); - caret_wxSNIP_DRAW_NO_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("no-caret")); - wxREGGLOB(caret_wxSNIP_DRAW_SHOW_CARET_sym); - caret_wxSNIP_DRAW_SHOW_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("show-caret")); - wxREGGLOB(caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym); - caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("show-inactive-caret")); -} - -static int unbundle_symset_caret(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) WITH_VAR_STACK(init_symset_caret()); - if (0) { } - else if (v == caret_wxSNIP_DRAW_NO_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_NO_CARET; } - else if (v == caret_wxSNIP_DRAW_SHOW_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_SHOW_CARET; } - else if (v == caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) { READY_TO_RETURN; return wxSNIP_DRAW_SHOW_INACTIVE_CARET; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "caret symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_caret(int v) { - if (!caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym) init_symset_caret(); - switch (v) { - case wxSNIP_DRAW_NO_CARET: return caret_wxSNIP_DRAW_NO_CARET_sym; - case wxSNIP_DRAW_SHOW_CARET: return caret_wxSNIP_DRAW_SHOW_CARET_sym; - case wxSNIP_DRAW_SHOW_INACTIVE_CARET: return caret_wxSNIP_DRAW_SHOW_INACTIVE_CARET_sym; - default: return NULL; - } -} - - - -static Scheme_Object *flags_wxSNIP_CAN_APPEND_sym = NULL; -static Scheme_Object *flags_wxSNIP_NEWLINE_sym = NULL; -static Scheme_Object *flags_wxSNIP_HARD_NEWLINE_sym = NULL; -static Scheme_Object *flags_wxSNIP_IS_TEXT_sym = NULL; -static Scheme_Object *flags_wxSNIP_INVISIBLE_sym = NULL; -static Scheme_Object *flags_wxSNIP_HANDLES_EVENTS_sym = NULL; -static Scheme_Object *flags_wxSNIP_WIDTH_DEPENDS_ON_X_sym = NULL; -static Scheme_Object *flags_wxSNIP_HEIGHT_DEPENDS_ON_X_sym = NULL; -static Scheme_Object *flags_wxSNIP_WIDTH_DEPENDS_ON_Y_sym = NULL; -static Scheme_Object *flags_wxSNIP_HEIGHT_DEPENDS_ON_Y_sym = NULL; -static Scheme_Object *flags_wxSNIP_USES_BUFFER_PATH_sym = NULL; - -static void init_symset_flags(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(flags_wxSNIP_CAN_APPEND_sym); - flags_wxSNIP_CAN_APPEND_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("can-append")); - wxREGGLOB(flags_wxSNIP_NEWLINE_sym); - flags_wxSNIP_NEWLINE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("newline")); - wxREGGLOB(flags_wxSNIP_HARD_NEWLINE_sym); - flags_wxSNIP_HARD_NEWLINE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hard-newline")); - wxREGGLOB(flags_wxSNIP_IS_TEXT_sym); - flags_wxSNIP_IS_TEXT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("is-text")); - wxREGGLOB(flags_wxSNIP_INVISIBLE_sym); - flags_wxSNIP_INVISIBLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("invisible")); - wxREGGLOB(flags_wxSNIP_HANDLES_EVENTS_sym); - flags_wxSNIP_HANDLES_EVENTS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("handles-events")); - wxREGGLOB(flags_wxSNIP_WIDTH_DEPENDS_ON_X_sym); - flags_wxSNIP_WIDTH_DEPENDS_ON_X_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("width-depends-on-x")); - wxREGGLOB(flags_wxSNIP_HEIGHT_DEPENDS_ON_X_sym); - flags_wxSNIP_HEIGHT_DEPENDS_ON_X_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("height-depends-on-x")); - wxREGGLOB(flags_wxSNIP_WIDTH_DEPENDS_ON_Y_sym); - flags_wxSNIP_WIDTH_DEPENDS_ON_Y_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("width-depends-on-y")); - wxREGGLOB(flags_wxSNIP_HEIGHT_DEPENDS_ON_Y_sym); - flags_wxSNIP_HEIGHT_DEPENDS_ON_Y_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("height-depends-on-y")); - wxREGGLOB(flags_wxSNIP_USES_BUFFER_PATH_sym); - flags_wxSNIP_USES_BUFFER_PATH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("uses-buffer-path")); -} - -static int unbundle_symset_flags(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!flags_wxSNIP_USES_BUFFER_PATH_sym) WITH_VAR_STACK(init_symset_flags()); - Scheme_Object *i INIT_NULLED_OUT, *l = v; - long result = 0; - while (SCHEME_PAIRP(l)) { - i = SCHEME_CAR(l); - if (0) { } - else if (i == flags_wxSNIP_CAN_APPEND_sym) { result = result | wxSNIP_CAN_APPEND; } - else if (i == flags_wxSNIP_NEWLINE_sym) { result = result | wxSNIP_NEWLINE; } - else if (i == flags_wxSNIP_HARD_NEWLINE_sym) { result = result | wxSNIP_HARD_NEWLINE; } - else if (i == flags_wxSNIP_IS_TEXT_sym) { result = result | wxSNIP_IS_TEXT; } - else if (i == flags_wxSNIP_INVISIBLE_sym) { result = result | wxSNIP_INVISIBLE; } - else if (i == flags_wxSNIP_HANDLES_EVENTS_sym) { result = result | wxSNIP_HANDLES_EVENTS; } - else if (i == flags_wxSNIP_WIDTH_DEPENDS_ON_X_sym) { result = result | wxSNIP_WIDTH_DEPENDS_ON_X; } - else if (i == flags_wxSNIP_HEIGHT_DEPENDS_ON_X_sym) { result = result | wxSNIP_HEIGHT_DEPENDS_ON_X; } - else if (i == flags_wxSNIP_WIDTH_DEPENDS_ON_Y_sym) { result = result | wxSNIP_WIDTH_DEPENDS_ON_Y; } - else if (i == flags_wxSNIP_HEIGHT_DEPENDS_ON_Y_sym) { result = result | wxSNIP_HEIGHT_DEPENDS_ON_Y; } - else if (i == flags_wxSNIP_USES_BUFFER_PATH_sym) { result = result | wxSNIP_USES_BUFFER_PATH; } - else { break; } - l = SCHEME_CDR(l); - } - if (SCHEME_NULLP(l)) { READY_TO_RETURN; return result; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "flags symbol list", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_flags(int v) { - REMEMBER_VAR_STACK(); - if (!flags_wxSNIP_USES_BUFFER_PATH_sym) init_symset_flags(); - Scheme_Object *l = scheme_null; - if (v & wxSNIP_CAN_APPEND) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_CAN_APPEND_sym, l)); - if (v & wxSNIP_NEWLINE) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_NEWLINE_sym, l)); - if (v & wxSNIP_HARD_NEWLINE) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_HARD_NEWLINE_sym, l)); - if (v & wxSNIP_IS_TEXT) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_IS_TEXT_sym, l)); - if (v & wxSNIP_INVISIBLE) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_INVISIBLE_sym, l)); - if (v & wxSNIP_HANDLES_EVENTS) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_HANDLES_EVENTS_sym, l)); - if (v & wxSNIP_WIDTH_DEPENDS_ON_X) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_WIDTH_DEPENDS_ON_X_sym, l)); - if (v & wxSNIP_HEIGHT_DEPENDS_ON_X) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_HEIGHT_DEPENDS_ON_X_sym, l)); - if (v & wxSNIP_WIDTH_DEPENDS_ON_Y) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_WIDTH_DEPENDS_ON_Y_sym, l)); - if (v & wxSNIP_HEIGHT_DEPENDS_ON_Y) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_HEIGHT_DEPENDS_ON_Y_sym, l)); - if (v & wxSNIP_USES_BUFFER_PATH) l = WITH_REMEMBERED_STACK(scheme_make_pair(flags_wxSNIP_USES_BUFFER_PATH_sym, l)); - return l; -} - - - -static Scheme_Object *editOp_wxEDIT_UNDO_sym = NULL; -static Scheme_Object *editOp_wxEDIT_REDO_sym = NULL; -static Scheme_Object *editOp_wxEDIT_CLEAR_sym = NULL; -static Scheme_Object *editOp_wxEDIT_CUT_sym = NULL; -static Scheme_Object *editOp_wxEDIT_COPY_sym = NULL; -static Scheme_Object *editOp_wxEDIT_PASTE_sym = NULL; -static Scheme_Object *editOp_wxEDIT_KILL_sym = NULL; -static Scheme_Object *editOp_wxEDIT_INSERT_TEXT_BOX_sym = NULL; -static Scheme_Object *editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym = NULL; -static Scheme_Object *editOp_wxEDIT_INSERT_IMAGE_sym = NULL; -static Scheme_Object *editOp_wxEDIT_SELECT_ALL_sym = NULL; - -static void init_symset_editOp(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(editOp_wxEDIT_UNDO_sym); - editOp_wxEDIT_UNDO_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("undo")); - wxREGGLOB(editOp_wxEDIT_REDO_sym); - editOp_wxEDIT_REDO_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("redo")); - wxREGGLOB(editOp_wxEDIT_CLEAR_sym); - editOp_wxEDIT_CLEAR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("clear")); - wxREGGLOB(editOp_wxEDIT_CUT_sym); - editOp_wxEDIT_CUT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("cut")); - wxREGGLOB(editOp_wxEDIT_COPY_sym); - editOp_wxEDIT_COPY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("copy")); - wxREGGLOB(editOp_wxEDIT_PASTE_sym); - editOp_wxEDIT_PASTE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("paste")); - wxREGGLOB(editOp_wxEDIT_KILL_sym); - editOp_wxEDIT_KILL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("kill")); - wxREGGLOB(editOp_wxEDIT_INSERT_TEXT_BOX_sym); - editOp_wxEDIT_INSERT_TEXT_BOX_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("insert-text-box")); - wxREGGLOB(editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym); - editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("insert-pasteboard-box")); - wxREGGLOB(editOp_wxEDIT_INSERT_IMAGE_sym); - editOp_wxEDIT_INSERT_IMAGE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("insert-image")); - wxREGGLOB(editOp_wxEDIT_SELECT_ALL_sym); - editOp_wxEDIT_SELECT_ALL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("select-all")); -} - -static int unbundle_symset_editOp(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!editOp_wxEDIT_SELECT_ALL_sym) WITH_VAR_STACK(init_symset_editOp()); - if (0) { } - else if (v == editOp_wxEDIT_UNDO_sym) { READY_TO_RETURN; return wxEDIT_UNDO; } - else if (v == editOp_wxEDIT_REDO_sym) { READY_TO_RETURN; return wxEDIT_REDO; } - else if (v == editOp_wxEDIT_CLEAR_sym) { READY_TO_RETURN; return wxEDIT_CLEAR; } - else if (v == editOp_wxEDIT_CUT_sym) { READY_TO_RETURN; return wxEDIT_CUT; } - else if (v == editOp_wxEDIT_COPY_sym) { READY_TO_RETURN; return wxEDIT_COPY; } - else if (v == editOp_wxEDIT_PASTE_sym) { READY_TO_RETURN; return wxEDIT_PASTE; } - else if (v == editOp_wxEDIT_KILL_sym) { READY_TO_RETURN; return wxEDIT_KILL; } - else if (v == editOp_wxEDIT_INSERT_TEXT_BOX_sym) { READY_TO_RETURN; return wxEDIT_INSERT_TEXT_BOX; } - else if (v == editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym) { READY_TO_RETURN; return wxEDIT_INSERT_GRAPHIC_BOX; } - else if (v == editOp_wxEDIT_INSERT_IMAGE_sym) { READY_TO_RETURN; return wxEDIT_INSERT_IMAGE; } - else if (v == editOp_wxEDIT_SELECT_ALL_sym) { READY_TO_RETURN; return wxEDIT_SELECT_ALL; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "editOp symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_editOp(int v) { - if (!editOp_wxEDIT_SELECT_ALL_sym) init_symset_editOp(); - switch (v) { - case wxEDIT_UNDO: return editOp_wxEDIT_UNDO_sym; - case wxEDIT_REDO: return editOp_wxEDIT_REDO_sym; - case wxEDIT_CLEAR: return editOp_wxEDIT_CLEAR_sym; - case wxEDIT_CUT: return editOp_wxEDIT_CUT_sym; - case wxEDIT_COPY: return editOp_wxEDIT_COPY_sym; - case wxEDIT_PASTE: return editOp_wxEDIT_PASTE_sym; - case wxEDIT_KILL: return editOp_wxEDIT_KILL_sym; - case wxEDIT_INSERT_TEXT_BOX: return editOp_wxEDIT_INSERT_TEXT_BOX_sym; - case wxEDIT_INSERT_GRAPHIC_BOX: return editOp_wxEDIT_INSERT_GRAPHIC_BOX_sym; - case wxEDIT_INSERT_IMAGE: return editOp_wxEDIT_INSERT_IMAGE_sym; - case wxEDIT_SELECT_ALL: return editOp_wxEDIT_SELECT_ALL_sym; - default: return NULL; - } -} - - - - - - - - - - - - - - - - - - - - - - -class os_wxSnip : public wxSnip { - public: - - os_wxSnip CONSTRUCTOR_ARGS(()); - ~os_wxSnip(); - void SetUnmodified(); - nndouble GetScrollStepOffset(nnlong x0); - nnlong FindScrollStep(double x0); - nnlong GetNumScrollSteps(); - void SetAdmin(class wxSnipAdmin* x0); - Bool Resize(nndouble x0, nndouble x1); - void Write(class wxMediaStreamOut* x0); - Bool Match(class wxSnip* x0); - Bool CanEdit(int x0, Bool x1 = TRUE); - void DoEdit(int x0, Bool x1 = TRUE, long x2 = 0); - void BlinkCaret(class wxDC* x0, double x1, double x2); - void OwnCaret(Bool x0); - class wxCursor* AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5); - void OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void SizeCacheInvalid(); - class wxSnip* Copy(); - void GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3); - mzstring GetText(nnlong x0, nnlong x1, Bool x2 = FALSE, long* x3 = NULL); - class wxSnip* MergeWith(class wxSnip* x0); - void Split(nnlong x0, class wxSnip** x1, class wxSnip** x2); - void Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9); - double PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3); - void GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3 = NULL, nndouble* x4 = NULL, nndouble* x5 = NULL, nndouble* x6 = NULL, nndouble* x7 = NULL, nndouble* x8 = NULL); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxSnip::gcMark() { - wxSnip::gcMark(); -} -void os_wxSnip::gcFixup() { - wxSnip::gcFixup(); -} -#endif - -static Scheme_Object *os_wxSnip_class; - -os_wxSnip::os_wxSnip CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxSnip()) -{ -} - -os_wxSnip::~os_wxSnip() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxSnipSetUnmodified(int n, Scheme_Object *p[]); - -void os_wxSnip::SetUnmodified() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "set-unmodified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipSetUnmodified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::SetUnmodified(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipGetScrollStepOffset(int n, Scheme_Object *p[]); - -nndouble os_wxSnip::GetScrollStepOffset(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "get-scroll-step-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipGetScrollStepOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::GetScrollStepOffset(x0); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nndouble resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(v, "get-scroll-step-offset in snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipFindScrollStep(int n, Scheme_Object *p[]); - -nnlong os_wxSnip::FindScrollStep(double x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "find-scroll-step", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipFindScrollStep)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::FindScrollStep(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "find-scroll-step in snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipGetNumScrollSteps(int n, Scheme_Object *p[]); - -nnlong os_wxSnip::GetNumScrollSteps() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "get-num-scroll-steps", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipGetNumScrollSteps)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::GetNumScrollSteps(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "get-num-scroll-steps in snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipSetAdmin(int n, Scheme_Object *p[]); - -void os_wxSnip::SetAdmin(class wxSnipAdmin* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "set-admin", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipSetAdmin)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::SetAdmin(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnipAdmin(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipResize(int n, Scheme_Object *p[]); - -Bool os_wxSnip::Resize(nndouble x0, nndouble x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::Resize(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "resize in snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipWrite(int n, Scheme_Object *p[]); - -void os_wxSnip::Write(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "write", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipWrite)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::Write(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipMatch(int n, Scheme_Object *p[]); - -Bool os_wxSnip::Match(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "match?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipMatch)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::Match(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "match? in snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipCanEdit(int n, Scheme_Object *p[]); - -Bool os_wxSnip::CanEdit(int x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "can-do-edit-operation?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipCanEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::CanEdit(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-do-edit-operation? in snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipDoEdit(int n, Scheme_Object *p[]); - -void os_wxSnip::DoEdit(int x0, Bool x1, long x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "do-edit-operation", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipDoEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::DoEdit(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - p[POFFSET+2] = scheme_make_integer(x2); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipBlinkCaret(int n, Scheme_Object *p[]); - -void os_wxSnip::BlinkCaret(class wxDC* x0, double x1, double x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "blink-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipBlinkCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::BlinkCaret(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipOwnCaret(int n, Scheme_Object *p[]); - -void os_wxSnip::OwnCaret(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "own-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipOwnCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::OwnCaret(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipAdjustCursor(int n, Scheme_Object *p[]); - -class wxCursor* os_wxSnip::AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "adjust-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipAdjustCursor)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::AdjustCursor(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - { - class wxCursor* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxCursor(v, "adjust-cursor in snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipOnChar(int n, Scheme_Object *p[]); - -void os_wxSnip::OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipOnChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::OnChar(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipOnEvent(int n, Scheme_Object *p[]); - -void os_wxSnip::OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipOnEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::OnEvent(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipSizeCacheInvalid(int n, Scheme_Object *p[]); - -void os_wxSnip::SizeCacheInvalid() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "size-cache-invalid", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipSizeCacheInvalid)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::SizeCacheInvalid(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipCopy(int n, Scheme_Object *p[]); - -class wxSnip* os_wxSnip::Copy() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "copy", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipCopy)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::Copy(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "copy in snip%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipGetTextBang(int n, Scheme_Object *p[]); - -void os_wxSnip::GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "get-text!", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipGetTextBang)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::GetTextBang(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_sized_char_string(x0, x2+x3, 0)); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = scheme_make_integer(x2); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipGetText(int n, Scheme_Object *p[]); - -mzstring os_wxSnip::GetText(nnlong x0, nnlong x1, Bool x2, long* x3) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "get-text", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipGetText)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::GetText(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - { - mzstring resval; - resval = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(v, "get-text in snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipMergeWith(int n, Scheme_Object *p[]); - -class wxSnip* os_wxSnip::MergeWith(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "merge-with", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipMergeWith)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::MergeWith(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "merge-with in snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipSplit(int n, Scheme_Object *p[]); - -void os_wxSnip::Split(nnlong x0, class wxSnip** x1, class wxSnip** x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x1); - VAR_STACK_PUSH(6, x2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "split", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipSplit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::Split(x0, x1, x2); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - p[POFFSET+2] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in snip%"", extracting return value via box"", extracting boxed argument", 0))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in snip%"", extracting return value via box"", extracting boxed argument", 0))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipDraw(int n, Scheme_Object *p[]); - -void os_wxSnip::Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9) -{ - Scheme_Object *p[POFFSET+10] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+10); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "draw", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipDraw)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(scheme_make_double(x5)); - p[POFFSET+6] = WITH_VAR_STACK(scheme_make_double(x6)); - p[POFFSET+7] = WITH_VAR_STACK(scheme_make_double(x7)); - p[POFFSET+8] = WITH_VAR_STACK(scheme_make_double(x8)); - p[POFFSET+9] = WITH_VAR_STACK(bundle_symset_caret(x9)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+10, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipPartialOffset(int n, Scheme_Object *p[]); - -double os_wxSnip::PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "partial-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipPartialOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxSnip::PartialOffset(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "partial-offset in snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxSnipGetExtent(int n, Scheme_Object *p[]); - -void os_wxSnip::GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3, nndouble* x4, nndouble* x5, nndouble* x6, nndouble* x7, nndouble* x8) -{ - Scheme_Object *p[POFFSET+9] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(12); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+9); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x3); - VAR_STACK_PUSH(7, x4); - VAR_STACK_PUSH(8, x5); - VAR_STACK_PUSH(9, x6); - VAR_STACK_PUSH(10, x7); - VAR_STACK_PUSH(11, x8); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxSnip_class, "get-extent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxSnipGetExtent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = ((x3) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x3))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+4] = ((x4) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x4))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+5] = ((x5) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x5))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+6] = ((x6) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x6))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+7] = ((x7) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x7))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+8] = ((x8) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x8))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+9, p)); - - if (x3) *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting return value via box"", extracting boxed argument"))); - if (x4) *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting return value via box"", extracting boxed argument"))); - if (x5) *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting return value via box"", extracting boxed argument"))); - if (x6) *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting return value via box"", extracting boxed argument"))); - if (x7) *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting return value via box"", extracting boxed argument"))); - if (x8) *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxSnipPrevious(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxSnip_class, "previous in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->Previous()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxSnipNext(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxSnip_class, "next in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->Next()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxSnipSetUnmodified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "set-unmodified in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::SetUnmodified()); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetUnmodified()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipGetScrollStepOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nndouble r; - objscheme_check_valid(os_wxSnip_class, "get-scroll-step-offset in snip%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-scroll-step-offset in snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::GetScrollStepOffset(x0)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetScrollStepOffset(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxSnipFindScrollStep(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxSnip_class, "find-scroll-step in snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-scroll-step in snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::FindScrollStep(x0)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->FindScrollStep(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxSnipGetNumScrollSteps(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxSnip_class, "get-num-scroll-steps in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::GetNumScrollSteps()); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetNumScrollSteps()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxSnipSetAdmin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "set-admin in snip%", n, p); - class wxSnipAdmin* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnipAdmin(p[POFFSET+0], "set-admin in snip%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::SetAdmin(x0)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetAdmin(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnip_class, "resize in snip%", n, p); - nndouble x0; - nndouble x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "resize in snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "resize in snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::Resize(x0, x1)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->Resize(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipWrite(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "write in snip%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write in snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::Write(x0)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->Write(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipMatch(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnip_class, "match? in snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "match? in snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::Match(x0)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->Match(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipCanEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnip_class, "can-do-edit-operation? in snip%", n, p); - int x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "can-do-edit-operation? in snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "can-do-edit-operation? in snip%")); - } else - x1 = TRUE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::CanEdit(x0, x1)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->CanEdit(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipDoEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "do-edit-operation in snip%", n, p); - int x0; - Bool x1; - long x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "do-edit-operation in snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "do-edit-operation in snip%")); - } else - x1 = TRUE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+2], "do-edit-operation in snip%")); - } else - x2 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::DoEdit(x0, x1, x2)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->DoEdit(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipBlinkCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "blink-caret in snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "blink-caret in snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "blink-caret in snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "blink-caret in snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::BlinkCaret(x0, x1, x2)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->BlinkCaret(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipOwnCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "own-caret in snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "own-caret in snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::OwnCaret(x0)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->OwnCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipAdjustCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxCursor* r; - objscheme_check_valid(os_wxSnip_class, "adjust-cursor in snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "adjust-cursor in snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "adjust-cursor in snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "adjust-cursor in snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "adjust-cursor in snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "adjust-cursor in snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "adjust-cursor in snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","adjust-cursor"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::AdjustCursor(x0, x1, x2, x3, x4, x5)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->AdjustCursor(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxCursor(r)); -} - -static Scheme_Object *os_wxSnipOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "on-char in snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxKeyEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-char in snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-char in snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-char in snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-char in snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-char in snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+5], "on-char in snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-char"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::OnChar(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnChar(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "on-event in snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-event in snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-event in snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-event in snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-event in snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-event in snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "on-event in snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-event"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::OnEvent(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnEvent(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipSizeCacheInvalid(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "size-cache-invalid in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::SizeCacheInvalid()); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->SizeCacheInvalid()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxSnip_class, "copy in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::Copy()); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->Copy()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxSnipGetTextBang(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "get-text! in snip%", n, p); - wmzstring x0 INIT_NULLED_OUT; - nnlong x1; - nnlong x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (wmzstring)WITH_VAR_STACK(objscheme_unbundle_mutable_mzstring(p[POFFSET+0], "get-text! in snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text! in snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "get-text! in snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "get-text! in snip%")); - - if (SCHEME_CHAR_STRTAG_VAL(p[0+POFFSET]) < (x2 + x3)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-text!"), "string too short: ", p[0+POFFSET])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::GetTextBang(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetTextBang(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipGetText(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzstring r; - objscheme_check_valid(os_wxSnip_class, "get-text in snip%", n, p); - nnlong x0; - nnlong x1; - Bool x2; - long _x3; - long* x3 = &_x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-text in snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text in snip%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-text in snip%")); - } else - x2 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::GetText(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetText(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(scheme_make_sized_char_string(r, _x3, 0)); -} - -static Scheme_Object *os_wxSnipMergeWith(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxSnip_class, "merge-with in snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "merge-with in snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::MergeWith(x0)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->MergeWith(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxSnipSplit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "split in snip%", n, p); - nnlong x0; - class wxSnip* _x1; - class wxSnip** x1 = &_x1; - class wxSnip* _x2; - class wxSnip** x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "split in snip%")); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in snip%"", extracting boxed argument", 0))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in snip%"", extracting boxed argument", 0))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::Split(x0, x1, x2)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->Split(x0, x1, x2)); - - - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipDraw(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "draw in snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - double x5; - double x6; - double x7; - double x8; - int x9; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "draw in snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw in snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw in snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "draw in snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw in snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw in snip%")); - x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+6], "draw in snip%")); - x7 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+7], "draw in snip%")); - x8 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+8], "draw in snip%")); - x9 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+9], "draw in snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","draw"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipPartialOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxSnip_class, "partial-offset in snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "partial-offset in snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "partial-offset in snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "partial-offset in snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "partial-offset in snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","partial-offset"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::PartialOffset(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->PartialOffset(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxSnipGetExtent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "get-extent in snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble _x3; - nndouble* x3 = &_x3; - nndouble _x4; - nndouble* x4 = &_x4; - nndouble _x5; - nndouble* x5 = &_x5; - nndouble _x6; - nndouble* x6 = &_x6; - nndouble _x7; - nndouble* x7 = &_x7; - nndouble _x8; - nndouble* x8 = &_x8; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-extent in snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "get-extent in snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "get-extent in snip%")); - if (n > (POFFSET+3)) { - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting boxed argument"))); - } else - x3 = NULL; - if (n > (POFFSET+4)) { - if (XC_SCHEME_NULLP(p[POFFSET+4])) - x4 = NULL; - else - *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting boxed argument"))); - } else - x4 = NULL; - if (n > (POFFSET+5)) { - if (XC_SCHEME_NULLP(p[POFFSET+5])) - x5 = NULL; - else - *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting boxed argument"))); - } else - x5 = NULL; - if (n > (POFFSET+6)) { - if (XC_SCHEME_NULLP(p[POFFSET+6])) - x6 = NULL; - else - *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting boxed argument"))); - } else - x6 = NULL; - if (n > (POFFSET+7)) { - if (XC_SCHEME_NULLP(p[POFFSET+7])) - x7 = NULL; - else - *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting boxed argument"))); - } else - x7 = NULL; - if (n > (POFFSET+8)) { - if (XC_SCHEME_NULLP(p[POFFSET+8])) - x8 = NULL; - else - *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in snip%"", extracting boxed argument"))); - } else - x8 = NULL; - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-extent"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - else - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - - - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - if (n > (POFFSET+4) && !XC_SCHEME_NULLP(p[POFFSET+4])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x4)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+4], sbv_)); } - if (n > (POFFSET+5) && !XC_SCHEME_NULLP(p[POFFSET+5])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x5)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+5], sbv_)); } - if (n > (POFFSET+6) && !XC_SCHEME_NULLP(p[POFFSET+6])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x6)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+6], sbv_)); } - if (n > (POFFSET+7) && !XC_SCHEME_NULLP(p[POFFSET+7])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x7)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+7], sbv_)); } - if (n > (POFFSET+8) && !XC_SCHEME_NULLP(p[POFFSET+8])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x8)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+8], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipReleaseFromOwner(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnip_class, "release-from-owner in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->ReleaseFromOwner()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipIsOwned(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxSnip_class, "is-owned? in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->IsOwned()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxSnipSetStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "set-style in snip%", n, p); - class wxStyle* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "set-style in snip%", 0)); - - - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetStyle(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipSetFlags(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "set-flags in snip%", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_flags(p[POFFSET+0], "set-flags in snip%")); - - - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetFlags(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipSetCount(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxSnip_class, "set-count in snip%", n, p); - int x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+0], 1, 100000, "set-count in snip%")); - - - WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetCount(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnipGetAdmin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnipAdmin* r; - objscheme_check_valid(os_wxSnip_class, "get-admin in snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetAdmin()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnipAdmin(r)); -} - -static Scheme_Object *objscheme_wxSnip_Getcount(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - long v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxSnip_class, "get-count in snip%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-count in snip%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxSnip *)cobj->primdata)->wxSnip::count; - else - v = ((wxSnip *)cobj->primdata)->count; - - return scheme_make_integer(v); -} - -static Scheme_Object *objscheme_wxSnip_Getflags(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxSnip_class, "get-flags in snip%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-flags in snip%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxSnip *)cobj->primdata)->wxSnip::flags; - else - v = ((wxSnip *)cobj->primdata)->flags; - - return WITH_REMEMBERED_STACK(bundle_symset_flags(v)); -} - -static Scheme_Object *objscheme_wxSnip_Getstyle(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - class wxStyle* v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxSnip_class, "get-style in snip%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-style in snip%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxSnip *)cobj->primdata)->wxSnip::style; - else - v = ((wxSnip *)cobj->primdata)->style; - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(v)); -} - -static Scheme_Object *objscheme_wxSnip_Getsnipclass(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - class wxSnipClass* v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxSnip_class, "get-snipclass in snip%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-snipclass in snip%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxSnip *)cobj->primdata)->wxSnip::snipclass; - else - v = ((wxSnip *)cobj->primdata)->snipclass; - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnipClass(v)); -} - -static Scheme_Object *objscheme_wxSnip_Setsnipclass(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - class wxSnipClass* v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxSnip_class, "set-snipclass in snip%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-snipclass in snip%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_wxSnipClass(p[POFFSET], "set-snipclass in snip%", 1)); - ((wxSnip *)cobj->primdata)->snipclass = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxSnip_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxSnip *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in snip%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxSnip CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxSnip()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxSnip(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxSnip_class); - - os_wxSnip_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "snip%", "object%", (Scheme_Method_Prim *)os_wxSnip_ConstructScheme, 37)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "previous" " method", (Scheme_Method_Prim *)os_wxSnipPrevious, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "next" " method", (Scheme_Method_Prim *)os_wxSnipNext, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "set-unmodified" " method", (Scheme_Method_Prim *)os_wxSnipSetUnmodified, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "get-scroll-step-offset" " method", (Scheme_Method_Prim *)os_wxSnipGetScrollStepOffset, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "find-scroll-step" " method", (Scheme_Method_Prim *)os_wxSnipFindScrollStep, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "get-num-scroll-steps" " method", (Scheme_Method_Prim *)os_wxSnipGetNumScrollSteps, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "set-admin" " method", (Scheme_Method_Prim *)os_wxSnipSetAdmin, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "resize" " method", (Scheme_Method_Prim *)os_wxSnipResize, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "write" " method", (Scheme_Method_Prim *)os_wxSnipWrite, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "match?" " method", (Scheme_Method_Prim *)os_wxSnipMatch, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "can-do-edit-operation?" " method", (Scheme_Method_Prim *)os_wxSnipCanEdit, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "do-edit-operation" " method", (Scheme_Method_Prim *)os_wxSnipDoEdit, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "blink-caret" " method", (Scheme_Method_Prim *)os_wxSnipBlinkCaret, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "own-caret" " method", (Scheme_Method_Prim *)os_wxSnipOwnCaret, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "adjust-cursor" " method", (Scheme_Method_Prim *)os_wxSnipAdjustCursor, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "on-char" " method", (Scheme_Method_Prim *)os_wxSnipOnChar, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "on-event" " method", (Scheme_Method_Prim *)os_wxSnipOnEvent, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "size-cache-invalid" " method", (Scheme_Method_Prim *)os_wxSnipSizeCacheInvalid, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "copy" " method", (Scheme_Method_Prim *)os_wxSnipCopy, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "get-text!" " method", (Scheme_Method_Prim *)os_wxSnipGetTextBang, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "get-text" " method", (Scheme_Method_Prim *)os_wxSnipGetText, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "merge-with" " method", (Scheme_Method_Prim *)os_wxSnipMergeWith, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "split" " method", (Scheme_Method_Prim *)os_wxSnipSplit, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "draw" " method", (Scheme_Method_Prim *)os_wxSnipDraw, 10, 10)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "partial-offset" " method", (Scheme_Method_Prim *)os_wxSnipPartialOffset, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "get-extent" " method", (Scheme_Method_Prim *)os_wxSnipGetExtent, 3, 9)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "release-from-owner" " method", (Scheme_Method_Prim *)os_wxSnipReleaseFromOwner, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "is-owned?" " method", (Scheme_Method_Prim *)os_wxSnipIsOwned, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "set-style" " method", (Scheme_Method_Prim *)os_wxSnipSetStyle, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "set-flags" " method", (Scheme_Method_Prim *)os_wxSnipSetFlags, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "set-count" " method", (Scheme_Method_Prim *)os_wxSnipSetCount, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class, "get-admin" " method", (Scheme_Method_Prim *)os_wxSnipGetAdmin, 0, 0)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class,"get-count" " method", (Scheme_Method_Prim *)objscheme_wxSnip_Getcount, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class,"get-flags" " method", (Scheme_Method_Prim *)objscheme_wxSnip_Getflags, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class,"get-style" " method", (Scheme_Method_Prim *)objscheme_wxSnip_Getstyle, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class,"get-snipclass" " method", (Scheme_Method_Prim *)objscheme_wxSnip_Getsnipclass, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxSnip_class,"set-snipclass" " method", (Scheme_Method_Prim *)objscheme_wxSnip_Setsnipclass, 1, 1)); - - WITH_VAR_STACK(scheme_made_class(os_wxSnip_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxSnip, wxTYPE_SNIP)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxSnip(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxSnip_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "snip% object or " XC_NULL_STR: "snip% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_SNIP) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxSnip_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxSnip(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxSnip *)o->primdata; - else - return (wxSnip *)o->primdata; -} - - - - - - - - - - - - - - - - - - -class os_wxTextSnip : public wxTextSnip { - public: - - os_wxTextSnip CONSTRUCTOR_ARGS((nnlong x0 = 0)); -#ifndef MZ_PRECISE_GC - os_wxTextSnip CONSTRUCTOR_ARGS((mzstring x0, long x1)); -#endif - ~os_wxTextSnip(); - void SetUnmodified(); - nndouble GetScrollStepOffset(nnlong x0); - nnlong FindScrollStep(double x0); - nnlong GetNumScrollSteps(); - void SetAdmin(class wxSnipAdmin* x0); - Bool Resize(nndouble x0, nndouble x1); - void Write(class wxMediaStreamOut* x0); - Bool Match(class wxSnip* x0); - Bool CanEdit(int x0, Bool x1 = TRUE); - void DoEdit(int x0, Bool x1 = TRUE, long x2 = 0); - void BlinkCaret(class wxDC* x0, double x1, double x2); - void OwnCaret(Bool x0); - class wxCursor* AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5); - void OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void SizeCacheInvalid(); - class wxSnip* Copy(); - void GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3); - mzstring GetText(nnlong x0, nnlong x1, Bool x2 = FALSE, long* x3 = NULL); - class wxSnip* MergeWith(class wxSnip* x0); - void Split(nnlong x0, class wxSnip** x1, class wxSnip** x2); - void Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9); - double PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3); - void GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3 = NULL, nndouble* x4 = NULL, nndouble* x5 = NULL, nndouble* x6 = NULL, nndouble* x7 = NULL, nndouble* x8 = NULL); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxTextSnip::gcMark() { - wxTextSnip::gcMark(); -} -void os_wxTextSnip::gcFixup() { - wxTextSnip::gcFixup(); -} -#endif - -static Scheme_Object *os_wxTextSnip_class; - -os_wxTextSnip::os_wxTextSnip CONSTRUCTOR_ARGS((nnlong x0)) -CONSTRUCTOR_INIT(: wxTextSnip(x0)) -{ -} - -#ifndef MZ_PRECISE_GC -os_wxTextSnip::os_wxTextSnip CONSTRUCTOR_ARGS((mzstring x0, long x1)) -CONSTRUCTOR_INIT(: wxTextSnip(x0, x1)) -{ -} -#endif - -os_wxTextSnip::~os_wxTextSnip() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxTextSnipSetUnmodified(int n, Scheme_Object *p[]); - -void os_wxTextSnip::SetUnmodified() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "set-unmodified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipSetUnmodified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::SetUnmodified(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipGetScrollStepOffset(int n, Scheme_Object *p[]); - -nndouble os_wxTextSnip::GetScrollStepOffset(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "get-scroll-step-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipGetScrollStepOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::GetScrollStepOffset(x0); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nndouble resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(v, "get-scroll-step-offset in string-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipFindScrollStep(int n, Scheme_Object *p[]); - -nnlong os_wxTextSnip::FindScrollStep(double x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "find-scroll-step", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipFindScrollStep)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::FindScrollStep(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "find-scroll-step in string-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipGetNumScrollSteps(int n, Scheme_Object *p[]); - -nnlong os_wxTextSnip::GetNumScrollSteps() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "get-num-scroll-steps", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipGetNumScrollSteps)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::GetNumScrollSteps(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "get-num-scroll-steps in string-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipSetAdmin(int n, Scheme_Object *p[]); - -void os_wxTextSnip::SetAdmin(class wxSnipAdmin* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "set-admin", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipSetAdmin)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::SetAdmin(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnipAdmin(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipResize(int n, Scheme_Object *p[]); - -Bool os_wxTextSnip::Resize(nndouble x0, nndouble x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::Resize(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "resize in string-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipWrite(int n, Scheme_Object *p[]); - -void os_wxTextSnip::Write(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "write", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipWrite)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::Write(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipMatch(int n, Scheme_Object *p[]); - -Bool os_wxTextSnip::Match(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "match?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipMatch)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::Match(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "match? in string-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipCanEdit(int n, Scheme_Object *p[]); - -Bool os_wxTextSnip::CanEdit(int x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "can-do-edit-operation?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipCanEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::CanEdit(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-do-edit-operation? in string-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipDoEdit(int n, Scheme_Object *p[]); - -void os_wxTextSnip::DoEdit(int x0, Bool x1, long x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "do-edit-operation", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipDoEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::DoEdit(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - p[POFFSET+2] = scheme_make_integer(x2); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipBlinkCaret(int n, Scheme_Object *p[]); - -void os_wxTextSnip::BlinkCaret(class wxDC* x0, double x1, double x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "blink-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipBlinkCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::BlinkCaret(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipOwnCaret(int n, Scheme_Object *p[]); - -void os_wxTextSnip::OwnCaret(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "own-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipOwnCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::OwnCaret(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipAdjustCursor(int n, Scheme_Object *p[]); - -class wxCursor* os_wxTextSnip::AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "adjust-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipAdjustCursor)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::AdjustCursor(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - { - class wxCursor* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxCursor(v, "adjust-cursor in string-snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipOnChar(int n, Scheme_Object *p[]); - -void os_wxTextSnip::OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipOnChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::OnChar(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipOnEvent(int n, Scheme_Object *p[]); - -void os_wxTextSnip::OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipOnEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::OnEvent(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipSizeCacheInvalid(int n, Scheme_Object *p[]); - -void os_wxTextSnip::SizeCacheInvalid() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "size-cache-invalid", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipSizeCacheInvalid)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::SizeCacheInvalid(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipCopy(int n, Scheme_Object *p[]); - -class wxSnip* os_wxTextSnip::Copy() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "copy", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipCopy)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::Copy(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "copy in string-snip%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipGetTextBang(int n, Scheme_Object *p[]); - -void os_wxTextSnip::GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "get-text!", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipGetTextBang)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::GetTextBang(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_sized_char_string(x0, x2+x3, 0)); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = scheme_make_integer(x2); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipGetText(int n, Scheme_Object *p[]); - -mzstring os_wxTextSnip::GetText(nnlong x0, nnlong x1, Bool x2, long* x3) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "get-text", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipGetText)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::GetText(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - { - mzstring resval; - resval = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(v, "get-text in string-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipMergeWith(int n, Scheme_Object *p[]); - -class wxSnip* os_wxTextSnip::MergeWith(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "merge-with", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipMergeWith)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::MergeWith(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "merge-with in string-snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipSplit(int n, Scheme_Object *p[]); - -void os_wxTextSnip::Split(nnlong x0, class wxSnip** x1, class wxSnip** x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x1); - VAR_STACK_PUSH(6, x2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "split", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipSplit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::Split(x0, x1, x2); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - p[POFFSET+2] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in string-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in string-snip%"", extracting return value via box"", extracting boxed argument", 0))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in string-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in string-snip%"", extracting return value via box"", extracting boxed argument", 0))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipDraw(int n, Scheme_Object *p[]); - -void os_wxTextSnip::Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9) -{ - Scheme_Object *p[POFFSET+10] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+10); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "draw", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipDraw)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(scheme_make_double(x5)); - p[POFFSET+6] = WITH_VAR_STACK(scheme_make_double(x6)); - p[POFFSET+7] = WITH_VAR_STACK(scheme_make_double(x7)); - p[POFFSET+8] = WITH_VAR_STACK(scheme_make_double(x8)); - p[POFFSET+9] = WITH_VAR_STACK(bundle_symset_caret(x9)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+10, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipPartialOffset(int n, Scheme_Object *p[]); - -double os_wxTextSnip::PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "partial-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipPartialOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTextSnip::PartialOffset(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "partial-offset in string-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTextSnipGetExtent(int n, Scheme_Object *p[]); - -void os_wxTextSnip::GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3, nndouble* x4, nndouble* x5, nndouble* x6, nndouble* x7, nndouble* x8) -{ - Scheme_Object *p[POFFSET+9] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTextSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(12); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+9); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x3); - VAR_STACK_PUSH(7, x4); - VAR_STACK_PUSH(8, x5); - VAR_STACK_PUSH(9, x6); - VAR_STACK_PUSH(10, x7); - VAR_STACK_PUSH(11, x8); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTextSnip_class, "get-extent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTextSnipGetExtent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTextSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = ((x3) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x3))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+4] = ((x4) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x4))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+5] = ((x5) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x5))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+6] = ((x6) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x6))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+7] = ((x7) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x7))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+8] = ((x8) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x8))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+9, p)); - - if (x3) *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in string-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x4) *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in string-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x5) *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in string-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x6) *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in string-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x7) *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in string-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x8) *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in string-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTextSnipRead(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "read in string-snip%", n, p); - nnlong x0; - class wxMediaStreamIn* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "read in string-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+1], "read in string-snip%", 0)); - - - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->Read(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipInsert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "insert in string-snip%", n, p); - mzstring x0 INIT_NULLED_OUT; - nnlong x1; - nnlong x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+0], "insert in string-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "insert in string-snip%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "insert in string-snip%")); - } else - x2 = 0; - - - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->Insert(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipSetUnmodified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "set-unmodified in string-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::SetUnmodified()); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetUnmodified()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipGetScrollStepOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nndouble r; - objscheme_check_valid(os_wxTextSnip_class, "get-scroll-step-offset in string-snip%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-scroll-step-offset in string-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::GetScrollStepOffset(x0)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetScrollStepOffset(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxTextSnipFindScrollStep(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxTextSnip_class, "find-scroll-step in string-snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-scroll-step in string-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::FindScrollStep(x0)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->FindScrollStep(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxTextSnipGetNumScrollSteps(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxTextSnip_class, "get-num-scroll-steps in string-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::GetNumScrollSteps()); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetNumScrollSteps()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxTextSnipSetAdmin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "set-admin in string-snip%", n, p); - class wxSnipAdmin* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnipAdmin(p[POFFSET+0], "set-admin in string-snip%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::SetAdmin(x0)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetAdmin(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxTextSnip_class, "resize in string-snip%", n, p); - nndouble x0; - nndouble x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "resize in string-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "resize in string-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::Resize(x0, x1)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->Resize(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxTextSnipWrite(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "write in string-snip%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write in string-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::Write(x0)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->Write(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipMatch(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxTextSnip_class, "match? in string-snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "match? in string-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::Match(x0)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->Match(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxTextSnipCanEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxTextSnip_class, "can-do-edit-operation? in string-snip%", n, p); - int x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "can-do-edit-operation? in string-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "can-do-edit-operation? in string-snip%")); - } else - x1 = TRUE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::CanEdit(x0, x1)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->CanEdit(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxTextSnipDoEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "do-edit-operation in string-snip%", n, p); - int x0; - Bool x1; - long x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "do-edit-operation in string-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "do-edit-operation in string-snip%")); - } else - x1 = TRUE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+2], "do-edit-operation in string-snip%")); - } else - x2 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::DoEdit(x0, x1, x2)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->DoEdit(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipBlinkCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "blink-caret in string-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "blink-caret in string-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "blink-caret in string-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "blink-caret in string-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::BlinkCaret(x0, x1, x2)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->BlinkCaret(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipOwnCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "own-caret in string-snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "own-caret in string-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::OwnCaret(x0)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->OwnCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipAdjustCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxCursor* r; - objscheme_check_valid(os_wxTextSnip_class, "adjust-cursor in string-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "adjust-cursor in string-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "adjust-cursor in string-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "adjust-cursor in string-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "adjust-cursor in string-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "adjust-cursor in string-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "adjust-cursor in string-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","adjust-cursor"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::AdjustCursor(x0, x1, x2, x3, x4, x5)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->AdjustCursor(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxCursor(r)); -} - -static Scheme_Object *os_wxTextSnipOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "on-char in string-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxKeyEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-char in string-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-char in string-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-char in string-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-char in string-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-char in string-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+5], "on-char in string-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-char"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::OnChar(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnChar(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "on-event in string-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-event in string-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-event in string-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-event in string-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-event in string-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-event in string-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "on-event in string-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-event"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::OnEvent(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnEvent(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipSizeCacheInvalid(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "size-cache-invalid in string-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::SizeCacheInvalid()); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->SizeCacheInvalid()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxTextSnip_class, "copy in string-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::Copy()); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->Copy()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxTextSnipGetTextBang(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "get-text! in string-snip%", n, p); - wmzstring x0 INIT_NULLED_OUT; - nnlong x1; - nnlong x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (wmzstring)WITH_VAR_STACK(objscheme_unbundle_mutable_mzstring(p[POFFSET+0], "get-text! in string-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text! in string-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "get-text! in string-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "get-text! in string-snip%")); - - if (SCHEME_CHAR_STRTAG_VAL(p[0+POFFSET]) < (x2 + x3)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-text!"), "string too short: ", p[0+POFFSET])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::GetTextBang(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetTextBang(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipGetText(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzstring r; - objscheme_check_valid(os_wxTextSnip_class, "get-text in string-snip%", n, p); - nnlong x0; - nnlong x1; - Bool x2; - long _x3; - long* x3 = &_x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-text in string-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text in string-snip%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-text in string-snip%")); - } else - x2 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::GetText(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetText(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(scheme_make_sized_char_string(r, _x3, 0)); -} - -static Scheme_Object *os_wxTextSnipMergeWith(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxTextSnip_class, "merge-with in string-snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "merge-with in string-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::MergeWith(x0)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->MergeWith(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxTextSnipSplit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "split in string-snip%", n, p); - nnlong x0; - class wxSnip* _x1; - class wxSnip** x1 = &_x1; - class wxSnip* _x2; - class wxSnip** x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "split in string-snip%")); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in string-snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in string-snip%"", extracting boxed argument", 0))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in string-snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in string-snip%"", extracting boxed argument", 0))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::Split(x0, x1, x2)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->Split(x0, x1, x2)); - - - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipDraw(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "draw in string-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - double x5; - double x6; - double x7; - double x8; - int x9; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "draw in string-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw in string-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw in string-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "draw in string-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw in string-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw in string-snip%")); - x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+6], "draw in string-snip%")); - x7 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+7], "draw in string-snip%")); - x8 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+8], "draw in string-snip%")); - x9 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+9], "draw in string-snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","draw"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnipPartialOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxTextSnip_class, "partial-offset in string-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "partial-offset in string-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "partial-offset in string-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "partial-offset in string-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "partial-offset in string-snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","partial-offset"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::PartialOffset(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->PartialOffset(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxTextSnipGetExtent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTextSnip_class, "get-extent in string-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble _x3; - nndouble* x3 = &_x3; - nndouble _x4; - nndouble* x4 = &_x4; - nndouble _x5; - nndouble* x5 = &_x5; - nndouble _x6; - nndouble* x6 = &_x6; - nndouble _x7; - nndouble* x7 = &_x7; - nndouble _x8; - nndouble* x8 = &_x8; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-extent in string-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "get-extent in string-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "get-extent in string-snip%")); - if (n > (POFFSET+3)) { - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in string-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting boxed argument"))); - } else - x3 = NULL; - if (n > (POFFSET+4)) { - if (XC_SCHEME_NULLP(p[POFFSET+4])) - x4 = NULL; - else - *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in string-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting boxed argument"))); - } else - x4 = NULL; - if (n > (POFFSET+5)) { - if (XC_SCHEME_NULLP(p[POFFSET+5])) - x5 = NULL; - else - *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in string-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting boxed argument"))); - } else - x5 = NULL; - if (n > (POFFSET+6)) { - if (XC_SCHEME_NULLP(p[POFFSET+6])) - x6 = NULL; - else - *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in string-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting boxed argument"))); - } else - x6 = NULL; - if (n > (POFFSET+7)) { - if (XC_SCHEME_NULLP(p[POFFSET+7])) - x7 = NULL; - else - *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in string-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting boxed argument"))); - } else - x7 = NULL; - if (n > (POFFSET+8)) { - if (XC_SCHEME_NULLP(p[POFFSET+8])) - x8 = NULL; - else - *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in string-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in string-snip%"", extracting boxed argument"))); - } else - x8 = NULL; - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-extent"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTextSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - else - WITH_VAR_STACK(((wxTextSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - - - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - if (n > (POFFSET+4) && !XC_SCHEME_NULLP(p[POFFSET+4])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x4)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+4], sbv_)); } - if (n > (POFFSET+5) && !XC_SCHEME_NULLP(p[POFFSET+5])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x5)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+5], sbv_)); } - if (n > (POFFSET+6) && !XC_SCHEME_NULLP(p[POFFSET+6])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x6)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+6], sbv_)); } - if (n > (POFFSET+7) && !XC_SCHEME_NULLP(p[POFFSET+7])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x7)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+7], sbv_)); } - if (n > (POFFSET+8) && !XC_SCHEME_NULLP(p[POFFSET+8])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x8)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+8], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTextSnip_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxTextSnip *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_mzstring(p[POFFSET+0], NULL))) { - mzstring x0 INIT_NULLED_OUT; - long x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in string-snip% (initial string case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+0], "initialization in string-snip% (initial string case)")); - - x1 = SCHEME_CHAR_STRLEN_VAL(p[POFFSET]); - realobj = WITH_VAR_STACK(new os_wxTextSnip CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxTextSnip(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else { - nnlong x0; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if ((n > (POFFSET+1))) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in string-snip% (initial size case)", POFFSET+POFFSET, POFFSET+1, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "initialization in string-snip% (initial size case)")); - } else - x0 = 0; - - - realobj = WITH_VAR_STACK(new os_wxTextSnip CONSTRUCTOR_ARGS((x0))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxTextSnip(x0)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } - - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxTextSnip(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxTextSnip_class); - - os_wxTextSnip_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "string-snip%", "snip%", (Scheme_Method_Prim *)os_wxTextSnip_ConstructScheme, 26)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "read" " method", (Scheme_Method_Prim *)os_wxTextSnipRead, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "insert" " method", (Scheme_Method_Prim *)os_wxTextSnipInsert, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "set-unmodified" " method", (Scheme_Method_Prim *)os_wxTextSnipSetUnmodified, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "get-scroll-step-offset" " method", (Scheme_Method_Prim *)os_wxTextSnipGetScrollStepOffset, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "find-scroll-step" " method", (Scheme_Method_Prim *)os_wxTextSnipFindScrollStep, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "get-num-scroll-steps" " method", (Scheme_Method_Prim *)os_wxTextSnipGetNumScrollSteps, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "set-admin" " method", (Scheme_Method_Prim *)os_wxTextSnipSetAdmin, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "resize" " method", (Scheme_Method_Prim *)os_wxTextSnipResize, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "write" " method", (Scheme_Method_Prim *)os_wxTextSnipWrite, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "match?" " method", (Scheme_Method_Prim *)os_wxTextSnipMatch, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "can-do-edit-operation?" " method", (Scheme_Method_Prim *)os_wxTextSnipCanEdit, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "do-edit-operation" " method", (Scheme_Method_Prim *)os_wxTextSnipDoEdit, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "blink-caret" " method", (Scheme_Method_Prim *)os_wxTextSnipBlinkCaret, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "own-caret" " method", (Scheme_Method_Prim *)os_wxTextSnipOwnCaret, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "adjust-cursor" " method", (Scheme_Method_Prim *)os_wxTextSnipAdjustCursor, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "on-char" " method", (Scheme_Method_Prim *)os_wxTextSnipOnChar, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "on-event" " method", (Scheme_Method_Prim *)os_wxTextSnipOnEvent, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "size-cache-invalid" " method", (Scheme_Method_Prim *)os_wxTextSnipSizeCacheInvalid, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "copy" " method", (Scheme_Method_Prim *)os_wxTextSnipCopy, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "get-text!" " method", (Scheme_Method_Prim *)os_wxTextSnipGetTextBang, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "get-text" " method", (Scheme_Method_Prim *)os_wxTextSnipGetText, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "merge-with" " method", (Scheme_Method_Prim *)os_wxTextSnipMergeWith, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "split" " method", (Scheme_Method_Prim *)os_wxTextSnipSplit, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "draw" " method", (Scheme_Method_Prim *)os_wxTextSnipDraw, 10, 10)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "partial-offset" " method", (Scheme_Method_Prim *)os_wxTextSnipPartialOffset, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTextSnip_class, "get-extent" " method", (Scheme_Method_Prim *)os_wxTextSnipGetExtent, 3, 9)); - - - WITH_VAR_STACK(scheme_made_class(os_wxTextSnip_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxTextSnip, wxTYPE_TEXT_SNIP)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxTextSnip(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxTextSnip_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "string-snip% object or " XC_NULL_STR: "string-snip% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxTextSnip(class wxTextSnip *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_TEXT_SNIP) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxTextSnip_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxTextSnip *objscheme_unbundle_wxTextSnip(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxTextSnip(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxTextSnip *)o->primdata; - else - return (wxTextSnip *)o->primdata; -} - - - - - - - - - - - - - - - - - -class os_wxTabSnip : public wxTabSnip { - public: - - os_wxTabSnip CONSTRUCTOR_ARGS(()); - ~os_wxTabSnip(); - void SetUnmodified(); - nndouble GetScrollStepOffset(nnlong x0); - nnlong FindScrollStep(double x0); - nnlong GetNumScrollSteps(); - void SetAdmin(class wxSnipAdmin* x0); - Bool Resize(nndouble x0, nndouble x1); - void Write(class wxMediaStreamOut* x0); - Bool Match(class wxSnip* x0); - Bool CanEdit(int x0, Bool x1 = TRUE); - void DoEdit(int x0, Bool x1 = TRUE, long x2 = 0); - void BlinkCaret(class wxDC* x0, double x1, double x2); - void OwnCaret(Bool x0); - class wxCursor* AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5); - void OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void SizeCacheInvalid(); - class wxSnip* Copy(); - void GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3); - mzstring GetText(nnlong x0, nnlong x1, Bool x2 = FALSE, long* x3 = NULL); - class wxSnip* MergeWith(class wxSnip* x0); - void Split(nnlong x0, class wxSnip** x1, class wxSnip** x2); - void Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9); - double PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3); - void GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3 = NULL, nndouble* x4 = NULL, nndouble* x5 = NULL, nndouble* x6 = NULL, nndouble* x7 = NULL, nndouble* x8 = NULL); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxTabSnip::gcMark() { - wxTabSnip::gcMark(); -} -void os_wxTabSnip::gcFixup() { - wxTabSnip::gcFixup(); -} -#endif - -static Scheme_Object *os_wxTabSnip_class; - -os_wxTabSnip::os_wxTabSnip CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxTabSnip()) -{ -} - -os_wxTabSnip::~os_wxTabSnip() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxTabSnipSetUnmodified(int n, Scheme_Object *p[]); - -void os_wxTabSnip::SetUnmodified() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "set-unmodified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipSetUnmodified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::SetUnmodified(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipGetScrollStepOffset(int n, Scheme_Object *p[]); - -nndouble os_wxTabSnip::GetScrollStepOffset(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "get-scroll-step-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipGetScrollStepOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::GetScrollStepOffset(x0); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nndouble resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(v, "get-scroll-step-offset in tab-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipFindScrollStep(int n, Scheme_Object *p[]); - -nnlong os_wxTabSnip::FindScrollStep(double x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "find-scroll-step", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipFindScrollStep)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::FindScrollStep(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "find-scroll-step in tab-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipGetNumScrollSteps(int n, Scheme_Object *p[]); - -nnlong os_wxTabSnip::GetNumScrollSteps() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "get-num-scroll-steps", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipGetNumScrollSteps)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::GetNumScrollSteps(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "get-num-scroll-steps in tab-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipSetAdmin(int n, Scheme_Object *p[]); - -void os_wxTabSnip::SetAdmin(class wxSnipAdmin* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "set-admin", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipSetAdmin)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::SetAdmin(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnipAdmin(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipResize(int n, Scheme_Object *p[]); - -Bool os_wxTabSnip::Resize(nndouble x0, nndouble x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::Resize(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "resize in tab-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipWrite(int n, Scheme_Object *p[]); - -void os_wxTabSnip::Write(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "write", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipWrite)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::Write(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipMatch(int n, Scheme_Object *p[]); - -Bool os_wxTabSnip::Match(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "match?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipMatch)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::Match(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "match? in tab-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipCanEdit(int n, Scheme_Object *p[]); - -Bool os_wxTabSnip::CanEdit(int x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "can-do-edit-operation?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipCanEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::CanEdit(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-do-edit-operation? in tab-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipDoEdit(int n, Scheme_Object *p[]); - -void os_wxTabSnip::DoEdit(int x0, Bool x1, long x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "do-edit-operation", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipDoEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::DoEdit(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - p[POFFSET+2] = scheme_make_integer(x2); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipBlinkCaret(int n, Scheme_Object *p[]); - -void os_wxTabSnip::BlinkCaret(class wxDC* x0, double x1, double x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "blink-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipBlinkCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::BlinkCaret(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipOwnCaret(int n, Scheme_Object *p[]); - -void os_wxTabSnip::OwnCaret(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "own-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipOwnCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::OwnCaret(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipAdjustCursor(int n, Scheme_Object *p[]); - -class wxCursor* os_wxTabSnip::AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "adjust-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipAdjustCursor)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::AdjustCursor(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - { - class wxCursor* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxCursor(v, "adjust-cursor in tab-snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipOnChar(int n, Scheme_Object *p[]); - -void os_wxTabSnip::OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipOnChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::OnChar(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipOnEvent(int n, Scheme_Object *p[]); - -void os_wxTabSnip::OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipOnEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::OnEvent(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipSizeCacheInvalid(int n, Scheme_Object *p[]); - -void os_wxTabSnip::SizeCacheInvalid() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "size-cache-invalid", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipSizeCacheInvalid)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::SizeCacheInvalid(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipCopy(int n, Scheme_Object *p[]); - -class wxSnip* os_wxTabSnip::Copy() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "copy", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipCopy)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::Copy(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "copy in tab-snip%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipGetTextBang(int n, Scheme_Object *p[]); - -void os_wxTabSnip::GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "get-text!", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipGetTextBang)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::GetTextBang(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_sized_char_string(x0, x2+x3, 0)); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = scheme_make_integer(x2); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipGetText(int n, Scheme_Object *p[]); - -mzstring os_wxTabSnip::GetText(nnlong x0, nnlong x1, Bool x2, long* x3) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "get-text", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipGetText)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::GetText(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - { - mzstring resval; - resval = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(v, "get-text in tab-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipMergeWith(int n, Scheme_Object *p[]); - -class wxSnip* os_wxTabSnip::MergeWith(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "merge-with", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipMergeWith)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::MergeWith(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "merge-with in tab-snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipSplit(int n, Scheme_Object *p[]); - -void os_wxTabSnip::Split(nnlong x0, class wxSnip** x1, class wxSnip** x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x1); - VAR_STACK_PUSH(6, x2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "split", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipSplit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::Split(x0, x1, x2); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - p[POFFSET+2] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in tab-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in tab-snip%"", extracting return value via box"", extracting boxed argument", 0))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in tab-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in tab-snip%"", extracting return value via box"", extracting boxed argument", 0))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipDraw(int n, Scheme_Object *p[]); - -void os_wxTabSnip::Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9) -{ - Scheme_Object *p[POFFSET+10] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+10); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "draw", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipDraw)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(scheme_make_double(x5)); - p[POFFSET+6] = WITH_VAR_STACK(scheme_make_double(x6)); - p[POFFSET+7] = WITH_VAR_STACK(scheme_make_double(x7)); - p[POFFSET+8] = WITH_VAR_STACK(scheme_make_double(x8)); - p[POFFSET+9] = WITH_VAR_STACK(bundle_symset_caret(x9)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+10, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipPartialOffset(int n, Scheme_Object *p[]); - -double os_wxTabSnip::PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "partial-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipPartialOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxTabSnip::PartialOffset(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "partial-offset in tab-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxTabSnipGetExtent(int n, Scheme_Object *p[]); - -void os_wxTabSnip::GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3, nndouble* x4, nndouble* x5, nndouble* x6, nndouble* x7, nndouble* x8) -{ - Scheme_Object *p[POFFSET+9] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxTabSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(12); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+9); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x3); - VAR_STACK_PUSH(7, x4); - VAR_STACK_PUSH(8, x5); - VAR_STACK_PUSH(9, x6); - VAR_STACK_PUSH(10, x7); - VAR_STACK_PUSH(11, x8); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxTabSnip_class, "get-extent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxTabSnipGetExtent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxTabSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = ((x3) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x3))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+4] = ((x4) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x4))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+5] = ((x5) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x5))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+6] = ((x6) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x6))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+7] = ((x7) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x7))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+8] = ((x8) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x8))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+9, p)); - - if (x3) *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in tab-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x4) *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in tab-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x5) *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in tab-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x6) *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in tab-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x7) *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in tab-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x8) *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in tab-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxTabSnipSetUnmodified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "set-unmodified in tab-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::SetUnmodified()); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetUnmodified()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipGetScrollStepOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nndouble r; - objscheme_check_valid(os_wxTabSnip_class, "get-scroll-step-offset in tab-snip%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-scroll-step-offset in tab-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::GetScrollStepOffset(x0)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetScrollStepOffset(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxTabSnipFindScrollStep(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxTabSnip_class, "find-scroll-step in tab-snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-scroll-step in tab-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::FindScrollStep(x0)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->FindScrollStep(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxTabSnipGetNumScrollSteps(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxTabSnip_class, "get-num-scroll-steps in tab-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::GetNumScrollSteps()); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetNumScrollSteps()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxTabSnipSetAdmin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "set-admin in tab-snip%", n, p); - class wxSnipAdmin* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnipAdmin(p[POFFSET+0], "set-admin in tab-snip%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::SetAdmin(x0)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetAdmin(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxTabSnip_class, "resize in tab-snip%", n, p); - nndouble x0; - nndouble x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "resize in tab-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "resize in tab-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::Resize(x0, x1)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->Resize(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxTabSnipWrite(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "write in tab-snip%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write in tab-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::Write(x0)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->Write(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipMatch(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxTabSnip_class, "match? in tab-snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "match? in tab-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::Match(x0)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->Match(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxTabSnipCanEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxTabSnip_class, "can-do-edit-operation? in tab-snip%", n, p); - int x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "can-do-edit-operation? in tab-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "can-do-edit-operation? in tab-snip%")); - } else - x1 = TRUE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::CanEdit(x0, x1)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->CanEdit(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxTabSnipDoEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "do-edit-operation in tab-snip%", n, p); - int x0; - Bool x1; - long x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "do-edit-operation in tab-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "do-edit-operation in tab-snip%")); - } else - x1 = TRUE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+2], "do-edit-operation in tab-snip%")); - } else - x2 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::DoEdit(x0, x1, x2)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->DoEdit(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipBlinkCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "blink-caret in tab-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "blink-caret in tab-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "blink-caret in tab-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "blink-caret in tab-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::BlinkCaret(x0, x1, x2)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->BlinkCaret(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipOwnCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "own-caret in tab-snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "own-caret in tab-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::OwnCaret(x0)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->OwnCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipAdjustCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxCursor* r; - objscheme_check_valid(os_wxTabSnip_class, "adjust-cursor in tab-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "adjust-cursor in tab-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "adjust-cursor in tab-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "adjust-cursor in tab-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "adjust-cursor in tab-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "adjust-cursor in tab-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "adjust-cursor in tab-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","adjust-cursor"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::AdjustCursor(x0, x1, x2, x3, x4, x5)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->AdjustCursor(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxCursor(r)); -} - -static Scheme_Object *os_wxTabSnipOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "on-char in tab-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxKeyEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-char in tab-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-char in tab-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-char in tab-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-char in tab-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-char in tab-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+5], "on-char in tab-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-char"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::OnChar(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnChar(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "on-event in tab-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-event in tab-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-event in tab-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-event in tab-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-event in tab-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-event in tab-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "on-event in tab-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-event"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::OnEvent(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnEvent(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipSizeCacheInvalid(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "size-cache-invalid in tab-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::SizeCacheInvalid()); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->SizeCacheInvalid()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxTabSnip_class, "copy in tab-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::Copy()); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->Copy()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxTabSnipGetTextBang(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "get-text! in tab-snip%", n, p); - wmzstring x0 INIT_NULLED_OUT; - nnlong x1; - nnlong x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (wmzstring)WITH_VAR_STACK(objscheme_unbundle_mutable_mzstring(p[POFFSET+0], "get-text! in tab-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text! in tab-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "get-text! in tab-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "get-text! in tab-snip%")); - - if (SCHEME_CHAR_STRTAG_VAL(p[0+POFFSET]) < (x2 + x3)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-text!"), "string too short: ", p[0+POFFSET])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::GetTextBang(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetTextBang(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipGetText(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzstring r; - objscheme_check_valid(os_wxTabSnip_class, "get-text in tab-snip%", n, p); - nnlong x0; - nnlong x1; - Bool x2; - long _x3; - long* x3 = &_x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-text in tab-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text in tab-snip%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-text in tab-snip%")); - } else - x2 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::GetText(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetText(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(scheme_make_sized_char_string(r, _x3, 0)); -} - -static Scheme_Object *os_wxTabSnipMergeWith(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxTabSnip_class, "merge-with in tab-snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "merge-with in tab-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::MergeWith(x0)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->MergeWith(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxTabSnipSplit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "split in tab-snip%", n, p); - nnlong x0; - class wxSnip* _x1; - class wxSnip** x1 = &_x1; - class wxSnip* _x2; - class wxSnip** x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "split in tab-snip%")); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in tab-snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in tab-snip%"", extracting boxed argument", 0))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in tab-snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in tab-snip%"", extracting boxed argument", 0))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::Split(x0, x1, x2)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->Split(x0, x1, x2)); - - - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipDraw(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "draw in tab-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - double x5; - double x6; - double x7; - double x8; - int x9; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "draw in tab-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw in tab-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw in tab-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "draw in tab-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw in tab-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw in tab-snip%")); - x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+6], "draw in tab-snip%")); - x7 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+7], "draw in tab-snip%")); - x8 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+8], "draw in tab-snip%")); - x9 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+9], "draw in tab-snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","draw"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnipPartialOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxTabSnip_class, "partial-offset in tab-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "partial-offset in tab-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "partial-offset in tab-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "partial-offset in tab-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "partial-offset in tab-snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","partial-offset"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::PartialOffset(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->PartialOffset(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxTabSnipGetExtent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxTabSnip_class, "get-extent in tab-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble _x3; - nndouble* x3 = &_x3; - nndouble _x4; - nndouble* x4 = &_x4; - nndouble _x5; - nndouble* x5 = &_x5; - nndouble _x6; - nndouble* x6 = &_x6; - nndouble _x7; - nndouble* x7 = &_x7; - nndouble _x8; - nndouble* x8 = &_x8; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-extent in tab-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "get-extent in tab-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "get-extent in tab-snip%")); - if (n > (POFFSET+3)) { - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in tab-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting boxed argument"))); - } else - x3 = NULL; - if (n > (POFFSET+4)) { - if (XC_SCHEME_NULLP(p[POFFSET+4])) - x4 = NULL; - else - *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in tab-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting boxed argument"))); - } else - x4 = NULL; - if (n > (POFFSET+5)) { - if (XC_SCHEME_NULLP(p[POFFSET+5])) - x5 = NULL; - else - *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in tab-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting boxed argument"))); - } else - x5 = NULL; - if (n > (POFFSET+6)) { - if (XC_SCHEME_NULLP(p[POFFSET+6])) - x6 = NULL; - else - *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in tab-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting boxed argument"))); - } else - x6 = NULL; - if (n > (POFFSET+7)) { - if (XC_SCHEME_NULLP(p[POFFSET+7])) - x7 = NULL; - else - *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in tab-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting boxed argument"))); - } else - x7 = NULL; - if (n > (POFFSET+8)) { - if (XC_SCHEME_NULLP(p[POFFSET+8])) - x8 = NULL; - else - *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in tab-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in tab-snip%"", extracting boxed argument"))); - } else - x8 = NULL; - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-extent"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxTabSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - else - WITH_VAR_STACK(((wxTabSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - - - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - if (n > (POFFSET+4) && !XC_SCHEME_NULLP(p[POFFSET+4])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x4)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+4], sbv_)); } - if (n > (POFFSET+5) && !XC_SCHEME_NULLP(p[POFFSET+5])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x5)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+5], sbv_)); } - if (n > (POFFSET+6) && !XC_SCHEME_NULLP(p[POFFSET+6])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x6)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+6], sbv_)); } - if (n > (POFFSET+7) && !XC_SCHEME_NULLP(p[POFFSET+7])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x7)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+7], sbv_)); } - if (n > (POFFSET+8) && !XC_SCHEME_NULLP(p[POFFSET+8])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x8)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+8], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxTabSnip_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxTabSnip *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in tab-snip%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxTabSnip CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxTabSnip()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxTabSnip(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxTabSnip_class); - - os_wxTabSnip_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "tab-snip%", "string-snip%", (Scheme_Method_Prim *)os_wxTabSnip_ConstructScheme, 24)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "set-unmodified" " method", (Scheme_Method_Prim *)os_wxTabSnipSetUnmodified, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "get-scroll-step-offset" " method", (Scheme_Method_Prim *)os_wxTabSnipGetScrollStepOffset, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "find-scroll-step" " method", (Scheme_Method_Prim *)os_wxTabSnipFindScrollStep, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "get-num-scroll-steps" " method", (Scheme_Method_Prim *)os_wxTabSnipGetNumScrollSteps, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "set-admin" " method", (Scheme_Method_Prim *)os_wxTabSnipSetAdmin, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "resize" " method", (Scheme_Method_Prim *)os_wxTabSnipResize, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "write" " method", (Scheme_Method_Prim *)os_wxTabSnipWrite, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "match?" " method", (Scheme_Method_Prim *)os_wxTabSnipMatch, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "can-do-edit-operation?" " method", (Scheme_Method_Prim *)os_wxTabSnipCanEdit, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "do-edit-operation" " method", (Scheme_Method_Prim *)os_wxTabSnipDoEdit, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "blink-caret" " method", (Scheme_Method_Prim *)os_wxTabSnipBlinkCaret, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "own-caret" " method", (Scheme_Method_Prim *)os_wxTabSnipOwnCaret, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "adjust-cursor" " method", (Scheme_Method_Prim *)os_wxTabSnipAdjustCursor, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "on-char" " method", (Scheme_Method_Prim *)os_wxTabSnipOnChar, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "on-event" " method", (Scheme_Method_Prim *)os_wxTabSnipOnEvent, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "size-cache-invalid" " method", (Scheme_Method_Prim *)os_wxTabSnipSizeCacheInvalid, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "copy" " method", (Scheme_Method_Prim *)os_wxTabSnipCopy, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "get-text!" " method", (Scheme_Method_Prim *)os_wxTabSnipGetTextBang, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "get-text" " method", (Scheme_Method_Prim *)os_wxTabSnipGetText, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "merge-with" " method", (Scheme_Method_Prim *)os_wxTabSnipMergeWith, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "split" " method", (Scheme_Method_Prim *)os_wxTabSnipSplit, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "draw" " method", (Scheme_Method_Prim *)os_wxTabSnipDraw, 10, 10)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "partial-offset" " method", (Scheme_Method_Prim *)os_wxTabSnipPartialOffset, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxTabSnip_class, "get-extent" " method", (Scheme_Method_Prim *)os_wxTabSnipGetExtent, 3, 9)); - - - WITH_VAR_STACK(scheme_made_class(os_wxTabSnip_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxTabSnip, wxTYPE_TAB_SNIP)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxTabSnip(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxTabSnip_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "tab-snip% object or " XC_NULL_STR: "tab-snip% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxTabSnip(class wxTabSnip *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_TAB_SNIP) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxTabSnip_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxTabSnip *objscheme_unbundle_wxTabSnip(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxTabSnip(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxTabSnip *)o->primdata; - else - return (wxTabSnip *)o->primdata; -} - - - - -#ifndef wx_mac -# define wxBITMAP_TYPE_PICT 101 -#endif - -#define wxBITMAP_TYPE_UNKNOWN 0 -#define wxBITMAP_TYPE_GIF_MASK (wxBITMAP_TYPE_GIF | wxBITMAP_TYPE_MASK) -#define wxBITMAP_TYPE_PNG_MASK (wxBITMAP_TYPE_PNG | wxBITMAP_TYPE_MASK) - -static Scheme_Object *bitmapType_wxBITMAP_TYPE_BMP_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_XBM_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_XPM_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PICT_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_JPEG_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = NULL; -static Scheme_Object *bitmapType_wxBITMAP_TYPE_MASK_sym = NULL; - -static void init_symset_bitmapType(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_BMP_sym); - bitmapType_wxBITMAP_TYPE_BMP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bmp")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_sym); - bitmapType_wxBITMAP_TYPE_GIF_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_MASK_sym); - bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif/mask")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_XBM_sym); - bitmapType_wxBITMAP_TYPE_XBM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xbm")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_XPM_sym); - bitmapType_wxBITMAP_TYPE_XPM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xpm")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PICT_sym); - bitmapType_wxBITMAP_TYPE_PICT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pict")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_JPEG_sym); - bitmapType_wxBITMAP_TYPE_JPEG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("jpeg")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_sym); - bitmapType_wxBITMAP_TYPE_PNG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_MASK_sym); - bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png/mask")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_UNKNOWN_sym); - bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown")); - wxREGGLOB(bitmapType_wxBITMAP_TYPE_MASK_sym); - bitmapType_wxBITMAP_TYPE_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown/mask")); -} - -static int unbundle_symset_bitmapType(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!bitmapType_wxBITMAP_TYPE_MASK_sym) WITH_VAR_STACK(init_symset_bitmapType()); - if (0) { } - else if (v == bitmapType_wxBITMAP_TYPE_BMP_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_BMP; } - else if (v == bitmapType_wxBITMAP_TYPE_GIF_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF; } - else if (v == bitmapType_wxBITMAP_TYPE_GIF_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF_MASK; } - else if (v == bitmapType_wxBITMAP_TYPE_XBM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XBM; } - else if (v == bitmapType_wxBITMAP_TYPE_XPM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XPM; } - else if (v == bitmapType_wxBITMAP_TYPE_PICT_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PICT; } - else if (v == bitmapType_wxBITMAP_TYPE_JPEG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_JPEG; } - else if (v == bitmapType_wxBITMAP_TYPE_PNG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG; } - else if (v == bitmapType_wxBITMAP_TYPE_PNG_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG_MASK; } - else if (v == bitmapType_wxBITMAP_TYPE_UNKNOWN_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_UNKNOWN; } - else if (v == bitmapType_wxBITMAP_TYPE_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_MASK; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bitmapType symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_bitmapType(int v) { - if (!bitmapType_wxBITMAP_TYPE_MASK_sym) init_symset_bitmapType(); - switch (v) { - case wxBITMAP_TYPE_BMP: return bitmapType_wxBITMAP_TYPE_BMP_sym; - case wxBITMAP_TYPE_GIF: return bitmapType_wxBITMAP_TYPE_GIF_sym; - case wxBITMAP_TYPE_GIF_MASK: return bitmapType_wxBITMAP_TYPE_GIF_MASK_sym; - case wxBITMAP_TYPE_XBM: return bitmapType_wxBITMAP_TYPE_XBM_sym; - case wxBITMAP_TYPE_XPM: return bitmapType_wxBITMAP_TYPE_XPM_sym; - case wxBITMAP_TYPE_PICT: return bitmapType_wxBITMAP_TYPE_PICT_sym; - case wxBITMAP_TYPE_JPEG: return bitmapType_wxBITMAP_TYPE_JPEG_sym; - case wxBITMAP_TYPE_PNG: return bitmapType_wxBITMAP_TYPE_PNG_sym; - case wxBITMAP_TYPE_PNG_MASK: return bitmapType_wxBITMAP_TYPE_PNG_MASK_sym; - case wxBITMAP_TYPE_UNKNOWN: return bitmapType_wxBITMAP_TYPE_UNKNOWN_sym; - case wxBITMAP_TYPE_MASK: return bitmapType_wxBITMAP_TYPE_MASK_sym; - default: return NULL; - } -} - - - -extern void wxGetARGBPixels(wxBitmap *bm, double x, double y, int w, int h, char *s, Bool get_alpha); -static bool EqualTo(wxImageSnip* bm, wxImageSnip* bm2, void *recur); - -#ifdef MZ_PRECISE_GC -END_XFORM_SKIP; -#endif -static bool OtherEqualTo(wxImageSnip* snip, wxImageSnip* snip2, void *recur) -{ - int w, h; - char *s1, *s2; - wxBitmap *bm, *bm2, *mask; - - bm = snip->GetSnipBitmap(); - bm2 = snip2->GetSnipBitmap(); - - if (!bm || !bm->Ok()) return FALSE; - if (!bm2 || !bm2->Ok()) return FALSE; - if (bm->GetDepth() != bm2->GetDepth()) return FALSE; - w = bm->GetWidth(); - h = bm->GetHeight(); - if (w != bm2->GetWidth()) return FALSE; - if (h != bm2->GetHeight()) return FALSE; - - s1 = (char *)scheme_malloc_atomic(w * h * 4); - s2 = (char *)scheme_malloc_atomic(w * h * 4); - - memset(s1, 255, w * h * 4); - memset(s2, 255, w * h * 4); - - wxGetARGBPixels(bm, 0, 0, w, h, s1, 0); - wxGetARGBPixels(bm2, 0, 0, w, h, s2, 0); - - mask = snip->GetSnipBitmapMask(); - if (mask && mask->Ok() && (mask->GetWidth() == w) && (mask->GetHeight() == h)) { - wxGetARGBPixels(mask, 0, 0, w, h, s1, 1); - } - mask = snip2->GetSnipBitmapMask(); - if (mask && mask->Ok() && (mask->GetWidth() == w) && (mask->GetHeight() == h)) { - wxGetARGBPixels(mask, 0, 0, w, h, s2, 1); - } - - return !memcmp(s1, s2, w * h * 4); -} - -static long HashCodeOf(wxImageSnip *snip, void *recur) -{ - int w, h, i; - long hk = 0; - char *s1; - wxBitmap *bm; - - bm = snip->GetSnipBitmap(); - if (!bm) return 0; - - if (!bm->Ok()) return 0; - w = bm->GetWidth(); - h = bm->GetHeight(); - - s1 = (char *)scheme_malloc_atomic(w * h * 4); - - wxGetARGBPixels(bm, 0, 0, w, h, s1, 0); - - for (i = w * h * 4; i; i -= 4) { - hk += s1[i - 4] + s1[i - 3] + s1[i - 2]; - hk = (hk << 1) + hk; - } - - return hk; -} - -static long SecondaryHashCodeOf(wxImageSnip *snip, void *recur) -{ - wxBitmap *bm; - - bm = snip->GetSnipBitmap(); - if (!bm) return 0; - - return bm->GetWidth() + bm->GetHeight(); -} -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - -#define UNKNOWN_OBJ void* - - - - - - - - - - - - - - - - -// This isn't `pathname' because it expands internally - - - - - - -class os_wxImageSnip : public wxImageSnip { - public: - - os_wxImageSnip CONSTRUCTOR_ARGS((nxpathname x0 = NULL, int x1 = 0, Bool x2 = FALSE, Bool x3 = TRUE)); -#ifndef MZ_PRECISE_GC - os_wxImageSnip CONSTRUCTOR_ARGS((class wxBitmap* x0, class wxBitmap* x1 = NULL)); -#endif - ~os_wxImageSnip(); - Bool OtherEqualTo_method(class wxImageSnip* x0, UNKNOWN_OBJ x1); - Bool EqualTo_method(class wxImageSnip* x0, UNKNOWN_OBJ x1); - void SetUnmodified(); - nndouble GetScrollStepOffset(nnlong x0); - nnlong FindScrollStep(double x0); - nnlong GetNumScrollSteps(); - void SetAdmin(class wxSnipAdmin* x0); - Bool Resize(nndouble x0, nndouble x1); - void Write(class wxMediaStreamOut* x0); - Bool Match(class wxSnip* x0); - Bool CanEdit(int x0, Bool x1 = TRUE); - void DoEdit(int x0, Bool x1 = TRUE, long x2 = 0); - void BlinkCaret(class wxDC* x0, double x1, double x2); - void OwnCaret(Bool x0); - class wxCursor* AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5); - void OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void SizeCacheInvalid(); - class wxSnip* Copy(); - void GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3); - mzstring GetText(nnlong x0, nnlong x1, Bool x2 = FALSE, long* x3 = NULL); - class wxSnip* MergeWith(class wxSnip* x0); - void Split(nnlong x0, class wxSnip** x1, class wxSnip** x2); - void Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9); - double PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3); - void GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3 = NULL, nndouble* x4 = NULL, nndouble* x5 = NULL, nndouble* x6 = NULL, nndouble* x7 = NULL, nndouble* x8 = NULL); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxImageSnip::gcMark() { - wxImageSnip::gcMark(); -} -void os_wxImageSnip::gcFixup() { - wxImageSnip::gcFixup(); -} -#endif - -static Scheme_Object *os_wxImageSnip_class; - -os_wxImageSnip::os_wxImageSnip CONSTRUCTOR_ARGS((nxpathname x0, int x1, Bool x2, Bool x3)) -CONSTRUCTOR_INIT(: wxImageSnip(x0, x1, x2, x3)) -{ -} - -#ifndef MZ_PRECISE_GC -os_wxImageSnip::os_wxImageSnip CONSTRUCTOR_ARGS((class wxBitmap* x0, class wxBitmap* x1)) -CONSTRUCTOR_INIT(: wxImageSnip(x0, x1)) -{ -} -#endif - -os_wxImageSnip::~os_wxImageSnip() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxImageSnipOtherEqualTo(int n, Scheme_Object *p[]); - -Bool os_wxImageSnip::OtherEqualTo_method(class wxImageSnip* x0, UNKNOWN_OBJ x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "other-equal-to?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipOtherEqualTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; return OtherEqualTo(SELF__, x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxImageSnip(x0)); - p[POFFSET+1] = ((Scheme_Object *)x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "other-equal-to? in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipEqualTo(int n, Scheme_Object *p[]); - -Bool os_wxImageSnip::EqualTo_method(class wxImageSnip* x0, UNKNOWN_OBJ x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "equal-to?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipEqualTo)) { - SET_VAR_STACK(); - READY_TO_RETURN; return EqualTo(SELF__, x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxImageSnip(x0)); - p[POFFSET+1] = ((Scheme_Object *)x1); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "equal-to? in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipSetUnmodified(int n, Scheme_Object *p[]); - -void os_wxImageSnip::SetUnmodified() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "set-unmodified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipSetUnmodified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::SetUnmodified(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipGetScrollStepOffset(int n, Scheme_Object *p[]); - -nndouble os_wxImageSnip::GetScrollStepOffset(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "get-scroll-step-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipGetScrollStepOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::GetScrollStepOffset(x0); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nndouble resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(v, "get-scroll-step-offset in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipFindScrollStep(int n, Scheme_Object *p[]); - -nnlong os_wxImageSnip::FindScrollStep(double x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "find-scroll-step", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipFindScrollStep)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::FindScrollStep(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "find-scroll-step in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipGetNumScrollSteps(int n, Scheme_Object *p[]); - -nnlong os_wxImageSnip::GetNumScrollSteps() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "get-num-scroll-steps", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipGetNumScrollSteps)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::GetNumScrollSteps(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "get-num-scroll-steps in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipSetAdmin(int n, Scheme_Object *p[]); - -void os_wxImageSnip::SetAdmin(class wxSnipAdmin* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "set-admin", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipSetAdmin)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::SetAdmin(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnipAdmin(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipResize(int n, Scheme_Object *p[]); - -Bool os_wxImageSnip::Resize(nndouble x0, nndouble x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::Resize(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "resize in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipWrite(int n, Scheme_Object *p[]); - -void os_wxImageSnip::Write(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "write", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipWrite)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::Write(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipMatch(int n, Scheme_Object *p[]); - -Bool os_wxImageSnip::Match(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "match?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipMatch)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::Match(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "match? in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipCanEdit(int n, Scheme_Object *p[]); - -Bool os_wxImageSnip::CanEdit(int x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "can-do-edit-operation?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipCanEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::CanEdit(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-do-edit-operation? in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipDoEdit(int n, Scheme_Object *p[]); - -void os_wxImageSnip::DoEdit(int x0, Bool x1, long x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "do-edit-operation", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipDoEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::DoEdit(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - p[POFFSET+2] = scheme_make_integer(x2); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipBlinkCaret(int n, Scheme_Object *p[]); - -void os_wxImageSnip::BlinkCaret(class wxDC* x0, double x1, double x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "blink-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipBlinkCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::BlinkCaret(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipOwnCaret(int n, Scheme_Object *p[]); - -void os_wxImageSnip::OwnCaret(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "own-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipOwnCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::OwnCaret(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipAdjustCursor(int n, Scheme_Object *p[]); - -class wxCursor* os_wxImageSnip::AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "adjust-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipAdjustCursor)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::AdjustCursor(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - { - class wxCursor* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxCursor(v, "adjust-cursor in image-snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipOnChar(int n, Scheme_Object *p[]); - -void os_wxImageSnip::OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipOnChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::OnChar(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipOnEvent(int n, Scheme_Object *p[]); - -void os_wxImageSnip::OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipOnEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::OnEvent(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipSizeCacheInvalid(int n, Scheme_Object *p[]); - -void os_wxImageSnip::SizeCacheInvalid() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "size-cache-invalid", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipSizeCacheInvalid)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::SizeCacheInvalid(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipCopy(int n, Scheme_Object *p[]); - -class wxSnip* os_wxImageSnip::Copy() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "copy", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipCopy)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::Copy(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "copy in image-snip%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipGetTextBang(int n, Scheme_Object *p[]); - -void os_wxImageSnip::GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "get-text!", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipGetTextBang)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::GetTextBang(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_sized_char_string(x0, x2+x3, 0)); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = scheme_make_integer(x2); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipGetText(int n, Scheme_Object *p[]); - -mzstring os_wxImageSnip::GetText(nnlong x0, nnlong x1, Bool x2, long* x3) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "get-text", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipGetText)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::GetText(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - { - mzstring resval; - resval = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(v, "get-text in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipMergeWith(int n, Scheme_Object *p[]); - -class wxSnip* os_wxImageSnip::MergeWith(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "merge-with", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipMergeWith)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::MergeWith(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "merge-with in image-snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipSplit(int n, Scheme_Object *p[]); - -void os_wxImageSnip::Split(nnlong x0, class wxSnip** x1, class wxSnip** x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x1); - VAR_STACK_PUSH(6, x2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "split", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipSplit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::Split(x0, x1, x2); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - p[POFFSET+2] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in image-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in image-snip%"", extracting return value via box"", extracting boxed argument", 0))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in image-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in image-snip%"", extracting return value via box"", extracting boxed argument", 0))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipDraw(int n, Scheme_Object *p[]); - -void os_wxImageSnip::Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9) -{ - Scheme_Object *p[POFFSET+10] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+10); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "draw", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipDraw)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(scheme_make_double(x5)); - p[POFFSET+6] = WITH_VAR_STACK(scheme_make_double(x6)); - p[POFFSET+7] = WITH_VAR_STACK(scheme_make_double(x7)); - p[POFFSET+8] = WITH_VAR_STACK(scheme_make_double(x8)); - p[POFFSET+9] = WITH_VAR_STACK(bundle_symset_caret(x9)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+10, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipPartialOffset(int n, Scheme_Object *p[]); - -double os_wxImageSnip::PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "partial-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipPartialOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxImageSnip::PartialOffset(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "partial-offset in image-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxImageSnipGetExtent(int n, Scheme_Object *p[]); - -void os_wxImageSnip::GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3, nndouble* x4, nndouble* x5, nndouble* x6, nndouble* x7, nndouble* x8) -{ - Scheme_Object *p[POFFSET+9] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxImageSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(12); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+9); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x3); - VAR_STACK_PUSH(7, x4); - VAR_STACK_PUSH(8, x5); - VAR_STACK_PUSH(9, x6); - VAR_STACK_PUSH(10, x7); - VAR_STACK_PUSH(11, x8); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxImageSnip_class, "get-extent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxImageSnipGetExtent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxImageSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = ((x3) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x3))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+4] = ((x4) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x4))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+5] = ((x5) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x5))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+6] = ((x6) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x6))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+7] = ((x7) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x7))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+8] = ((x8) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x8))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+9, p)); - - if (x3) *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in image-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x4) *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in image-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x5) *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in image-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x6) *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in image-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x7) *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in image-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x8) *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in image-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxImageSnipSecondaryHashCodeOf(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxImageSnip_class, "equal-secondary-hash-code-of in image-snip%", n, p); - UNKNOWN_OBJ x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = ((void *)p[POFFSET+0]); - - - r = WITH_VAR_STACK(SecondaryHashCodeOf(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata), x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxImageSnipHashCodeOf(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - long r; - objscheme_check_valid(os_wxImageSnip_class, "equal-hash-code-of in image-snip%", n, p); - UNKNOWN_OBJ x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = ((void *)p[POFFSET+0]); - - - r = WITH_VAR_STACK(HashCodeOf(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata), x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxImageSnipOtherEqualTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxImageSnip_class, "other-equal-to? in image-snip%", n, p); - class wxImageSnip* x0 INIT_NULLED_OUT; - UNKNOWN_OBJ x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxImageSnip(p[POFFSET+0], "other-equal-to? in image-snip%", 1)); - x1 = ((void *)p[POFFSET+1]); - - - r = WITH_VAR_STACK(OtherEqualTo(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata), x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxImageSnipEqualTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxImageSnip_class, "equal-to? in image-snip%", n, p); - class wxImageSnip* x0 INIT_NULLED_OUT; - UNKNOWN_OBJ x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxImageSnip(p[POFFSET+0], "equal-to? in image-snip%", 1)); - x1 = ((void *)p[POFFSET+1]); - - - r = WITH_VAR_STACK(EqualTo(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata), x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxImageSnipSetOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "set-offset in image-snip%", n, p); - double x0; - double x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "set-offset in image-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set-offset in image-snip%")); - - - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetOffset(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipGetSnipBitmapMask(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBitmap* r; - objscheme_check_valid(os_wxImageSnip_class, "get-bitmap-mask in image-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetSnipBitmapMask()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r)); -} - -static Scheme_Object *os_wxImageSnipGetSnipBitmap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBitmap* r; - objscheme_check_valid(os_wxImageSnip_class, "get-bitmap in image-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetSnipBitmap()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r)); -} - -static Scheme_Object *os_wxImageSnipSetBitmap(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "set-bitmap in image-snip%", n, p); - class wxBitmap* x0 INIT_NULLED_OUT; - class wxBitmap* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "set-bitmap in image-snip%", 0)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+1], "set-bitmap in image-snip%", 1)); - } else - x1 = NULL; - - if (x1 && (x1->GetDepth() != 1)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","set-bitmap"), "mask bitmap is not monochrome: ", p[POFFSET+1]));{ if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","set-bitmap"), "bad bitmap: ", p[POFFSET+0])); if (x0 && BM_SELECTED(x0)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","set-bitmap"), "bitmap is currently installed into a bitmap-dc%: ", p[POFFSET+0])); }{ if (x1 && !x1->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","set-bitmap"), "bad bitmap: ", p[POFFSET+1])); if (x1 && BM_SELECTED(x1)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","set-bitmap"), "bitmap is currently installed into a bitmap-dc%: ", p[POFFSET+1])); }if (x1 && ((x0->GetWidth() != x1->GetWidth()) || (x0->GetHeight() != x1->GetHeight()))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","set-bitmap"), "mask bitmap size does not match bitmap to draw: ", p[POFFSET+0])); - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetBitmap(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipGetFiletype(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxImageSnip_class, "get-filetype in image-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetFiletype()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_bitmapType(r)); -} - -static Scheme_Object *os_wxImageSnipGetFilename(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - npathname r INIT_NULLED_OUT; - objscheme_check_valid(os_wxImageSnip_class, "get-filename in image-snip%", n, p); - Bool _x0; - Bool* x0 = &_x0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n > (POFFSET+0)) { - if (XC_SCHEME_NULLP(p[POFFSET+0])) - x0 = NULL; - else - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+0], "get-filename in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_bool(sbox_tmp, "get-filename in image-snip%"", extracting boxed argument"))); - } else - x0 = NULL; - - - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetFilename(x0)); - - - if (n > (POFFSET+0) && !XC_SCHEME_NULLP(p[POFFSET+0])) - { Scheme_Object *sbv_ = (_x0 ? scheme_true : scheme_false); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_pathname((char *)r)); -} - -static Scheme_Object *os_wxImageSnipLoadFile(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "load-file in image-snip%", n, p); - nxpathname x0 INIT_NULLED_OUT; - int x1; - Bool x2; - Bool x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (nxpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_xpathname(p[POFFSET+0], "load-file in image-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_bitmapType(p[POFFSET+1], "load-file in image-snip%")); - } else - x1 = 0; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "load-file in image-snip%")); - } else - x2 = FALSE; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "load-file in image-snip%")); - } else - x3 = TRUE; - - - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->LoadFile(x0, x1, x2, x3)); - - if (x0) WITH_VAR_STACK(scheme_thread_block(0.0)); - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipSetUnmodified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "set-unmodified in image-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::SetUnmodified()); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetUnmodified()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipGetScrollStepOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nndouble r; - objscheme_check_valid(os_wxImageSnip_class, "get-scroll-step-offset in image-snip%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-scroll-step-offset in image-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::GetScrollStepOffset(x0)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetScrollStepOffset(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxImageSnipFindScrollStep(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxImageSnip_class, "find-scroll-step in image-snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-scroll-step in image-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::FindScrollStep(x0)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->FindScrollStep(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxImageSnipGetNumScrollSteps(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxImageSnip_class, "get-num-scroll-steps in image-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::GetNumScrollSteps()); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetNumScrollSteps()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxImageSnipSetAdmin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "set-admin in image-snip%", n, p); - class wxSnipAdmin* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnipAdmin(p[POFFSET+0], "set-admin in image-snip%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::SetAdmin(x0)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetAdmin(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxImageSnip_class, "resize in image-snip%", n, p); - nndouble x0; - nndouble x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "resize in image-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "resize in image-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::Resize(x0, x1)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->Resize(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxImageSnipWrite(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "write in image-snip%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write in image-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::Write(x0)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->Write(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipMatch(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxImageSnip_class, "match? in image-snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "match? in image-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::Match(x0)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->Match(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxImageSnipCanEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxImageSnip_class, "can-do-edit-operation? in image-snip%", n, p); - int x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "can-do-edit-operation? in image-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "can-do-edit-operation? in image-snip%")); - } else - x1 = TRUE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::CanEdit(x0, x1)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->CanEdit(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxImageSnipDoEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "do-edit-operation in image-snip%", n, p); - int x0; - Bool x1; - long x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "do-edit-operation in image-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "do-edit-operation in image-snip%")); - } else - x1 = TRUE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+2], "do-edit-operation in image-snip%")); - } else - x2 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::DoEdit(x0, x1, x2)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->DoEdit(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipBlinkCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "blink-caret in image-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "blink-caret in image-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "blink-caret in image-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "blink-caret in image-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::BlinkCaret(x0, x1, x2)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->BlinkCaret(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipOwnCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "own-caret in image-snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "own-caret in image-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::OwnCaret(x0)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->OwnCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipAdjustCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxCursor* r; - objscheme_check_valid(os_wxImageSnip_class, "adjust-cursor in image-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "adjust-cursor in image-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "adjust-cursor in image-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "adjust-cursor in image-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "adjust-cursor in image-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "adjust-cursor in image-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "adjust-cursor in image-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","adjust-cursor"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::AdjustCursor(x0, x1, x2, x3, x4, x5)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->AdjustCursor(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxCursor(r)); -} - -static Scheme_Object *os_wxImageSnipOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "on-char in image-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxKeyEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-char in image-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-char in image-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-char in image-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-char in image-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-char in image-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+5], "on-char in image-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-char"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::OnChar(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnChar(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "on-event in image-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-event in image-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-event in image-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-event in image-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-event in image-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-event in image-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "on-event in image-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-event"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::OnEvent(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnEvent(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipSizeCacheInvalid(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "size-cache-invalid in image-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::SizeCacheInvalid()); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->SizeCacheInvalid()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxImageSnip_class, "copy in image-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::Copy()); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->Copy()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxImageSnipGetTextBang(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "get-text! in image-snip%", n, p); - wmzstring x0 INIT_NULLED_OUT; - nnlong x1; - nnlong x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (wmzstring)WITH_VAR_STACK(objscheme_unbundle_mutable_mzstring(p[POFFSET+0], "get-text! in image-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text! in image-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "get-text! in image-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "get-text! in image-snip%")); - - if (SCHEME_CHAR_STRTAG_VAL(p[0+POFFSET]) < (x2 + x3)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-text!"), "string too short: ", p[0+POFFSET])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::GetTextBang(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetTextBang(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipGetText(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzstring r; - objscheme_check_valid(os_wxImageSnip_class, "get-text in image-snip%", n, p); - nnlong x0; - nnlong x1; - Bool x2; - long _x3; - long* x3 = &_x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-text in image-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text in image-snip%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-text in image-snip%")); - } else - x2 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::GetText(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetText(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(scheme_make_sized_char_string(r, _x3, 0)); -} - -static Scheme_Object *os_wxImageSnipMergeWith(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxImageSnip_class, "merge-with in image-snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "merge-with in image-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::MergeWith(x0)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->MergeWith(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxImageSnipSplit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "split in image-snip%", n, p); - nnlong x0; - class wxSnip* _x1; - class wxSnip** x1 = &_x1; - class wxSnip* _x2; - class wxSnip** x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "split in image-snip%")); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in image-snip%"", extracting boxed argument", 0))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in image-snip%"", extracting boxed argument", 0))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::Split(x0, x1, x2)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->Split(x0, x1, x2)); - - - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipDraw(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "draw in image-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - double x5; - double x6; - double x7; - double x8; - int x9; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "draw in image-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw in image-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw in image-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "draw in image-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw in image-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw in image-snip%")); - x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+6], "draw in image-snip%")); - x7 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+7], "draw in image-snip%")); - x8 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+8], "draw in image-snip%")); - x9 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+9], "draw in image-snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","draw"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnipPartialOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxImageSnip_class, "partial-offset in image-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "partial-offset in image-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "partial-offset in image-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "partial-offset in image-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "partial-offset in image-snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","partial-offset"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::PartialOffset(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->PartialOffset(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxImageSnipGetExtent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxImageSnip_class, "get-extent in image-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble _x3; - nndouble* x3 = &_x3; - nndouble _x4; - nndouble* x4 = &_x4; - nndouble _x5; - nndouble* x5 = &_x5; - nndouble _x6; - nndouble* x6 = &_x6; - nndouble _x7; - nndouble* x7 = &_x7; - nndouble _x8; - nndouble* x8 = &_x8; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-extent in image-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "get-extent in image-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "get-extent in image-snip%")); - if (n > (POFFSET+3)) { - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting boxed argument"))); - } else - x3 = NULL; - if (n > (POFFSET+4)) { - if (XC_SCHEME_NULLP(p[POFFSET+4])) - x4 = NULL; - else - *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting boxed argument"))); - } else - x4 = NULL; - if (n > (POFFSET+5)) { - if (XC_SCHEME_NULLP(p[POFFSET+5])) - x5 = NULL; - else - *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting boxed argument"))); - } else - x5 = NULL; - if (n > (POFFSET+6)) { - if (XC_SCHEME_NULLP(p[POFFSET+6])) - x6 = NULL; - else - *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting boxed argument"))); - } else - x6 = NULL; - if (n > (POFFSET+7)) { - if (XC_SCHEME_NULLP(p[POFFSET+7])) - x7 = NULL; - else - *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting boxed argument"))); - } else - x7 = NULL; - if (n > (POFFSET+8)) { - if (XC_SCHEME_NULLP(p[POFFSET+8])) - x8 = NULL; - else - *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in image-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in image-snip%"", extracting boxed argument"))); - } else - x8 = NULL; - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-extent"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxImageSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - else - WITH_VAR_STACK(((wxImageSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - - - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - if (n > (POFFSET+4) && !XC_SCHEME_NULLP(p[POFFSET+4])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x4)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+4], sbv_)); } - if (n > (POFFSET+5) && !XC_SCHEME_NULLP(p[POFFSET+5])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x5)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+5], sbv_)); } - if (n > (POFFSET+6) && !XC_SCHEME_NULLP(p[POFFSET+6])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x6)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+6], sbv_)); } - if (n > (POFFSET+7) && !XC_SCHEME_NULLP(p[POFFSET+7])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x7)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+7], sbv_)); } - if (n > (POFFSET+8) && !XC_SCHEME_NULLP(p[POFFSET+8])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x8)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+8], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxImageSnip_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxImageSnip *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxBitmap(p[POFFSET+0], NULL, 0))) { - class wxBitmap* x0 INIT_NULLED_OUT; - class wxBitmap* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(4); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x0); - VAR_STACK_PUSH(3, x1); - - - if ((n < (POFFSET+1)) || (n > (POFFSET+2))) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in image-snip% (bitmap case)", POFFSET+1, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "initialization in image-snip% (bitmap case)", 0)); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+1], "initialization in image-snip% (bitmap case)", 1)); - } else - x1 = NULL; - - if (x1 && (x1->GetDepth() != 1)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","initialization"), "mask bitmap is not monochrome: ", p[POFFSET+1]));{ if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","initialization"), "bad bitmap: ", p[POFFSET+0])); if (x0 && BM_SELECTED(x0)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","initialization"), "bitmap is currently installed into a bitmap-dc%: ", p[POFFSET+0])); }{ if (x1 && !x1->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","initialization"), "bad bitmap: ", p[POFFSET+1])); if (x1 && BM_SELECTED(x1)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","initialization"), "bitmap is currently installed into a bitmap-dc%: ", p[POFFSET+1])); }if (x1 && ((x0->GetWidth() != x1->GetWidth()) || (x0->GetHeight() != x1->GetHeight()))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("image-snip%","initialization"), "mask bitmap size does not match bitmap to draw: ", p[POFFSET+0])); - realobj = WITH_VAR_STACK(new os_wxImageSnip CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxImageSnip(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else { - nxpathname x0 INIT_NULLED_OUT; - int x1; - Bool x2; - Bool x3; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x0); - - - if ((n > (POFFSET+4))) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in image-snip% (filename case)", POFFSET+POFFSET, POFFSET+4, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = (nxpathname)WITH_VAR_STACK(objscheme_unbundle_nullable_xpathname(p[POFFSET+0], "initialization in image-snip% (filename case)")); - } else - x0 = NULL; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_bitmapType(p[POFFSET+1], "initialization in image-snip% (filename case)")); - } else - x1 = 0; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "initialization in image-snip% (filename case)")); - } else - x2 = FALSE; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "initialization in image-snip% (filename case)")); - } else - x3 = TRUE; - - - realobj = WITH_VAR_STACK(new os_wxImageSnip CONSTRUCTOR_ARGS((x0, x1, x2, x3))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxImageSnip(x0, x1, x2, x3)); -#endif - realobj->__gc_external = (void *)p[0]; - if (x0) WITH_VAR_STACK(scheme_thread_block(0.0)); - - READY_TO_PRE_RETURN; - } - - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxImageSnip(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxImageSnip_class); - - os_wxImageSnip_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "image-snip%", "snip%", (Scheme_Method_Prim *)os_wxImageSnip_ConstructScheme, 35)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "equal-secondary-hash-code-of" " method", (Scheme_Method_Prim *)os_wxImageSnipSecondaryHashCodeOf, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "equal-hash-code-of" " method", (Scheme_Method_Prim *)os_wxImageSnipHashCodeOf, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "other-equal-to?" " method", (Scheme_Method_Prim *)os_wxImageSnipOtherEqualTo, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "equal-to?" " method", (Scheme_Method_Prim *)os_wxImageSnipEqualTo, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "set-offset" " method", (Scheme_Method_Prim *)os_wxImageSnipSetOffset, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-bitmap-mask" " method", (Scheme_Method_Prim *)os_wxImageSnipGetSnipBitmapMask, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-bitmap" " method", (Scheme_Method_Prim *)os_wxImageSnipGetSnipBitmap, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "set-bitmap" " method", (Scheme_Method_Prim *)os_wxImageSnipSetBitmap, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-filetype" " method", (Scheme_Method_Prim *)os_wxImageSnipGetFiletype, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-filename" " method", (Scheme_Method_Prim *)os_wxImageSnipGetFilename, 0, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "load-file" " method", (Scheme_Method_Prim *)os_wxImageSnipLoadFile, 1, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "set-unmodified" " method", (Scheme_Method_Prim *)os_wxImageSnipSetUnmodified, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-scroll-step-offset" " method", (Scheme_Method_Prim *)os_wxImageSnipGetScrollStepOffset, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "find-scroll-step" " method", (Scheme_Method_Prim *)os_wxImageSnipFindScrollStep, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-num-scroll-steps" " method", (Scheme_Method_Prim *)os_wxImageSnipGetNumScrollSteps, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "set-admin" " method", (Scheme_Method_Prim *)os_wxImageSnipSetAdmin, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "resize" " method", (Scheme_Method_Prim *)os_wxImageSnipResize, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "write" " method", (Scheme_Method_Prim *)os_wxImageSnipWrite, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "match?" " method", (Scheme_Method_Prim *)os_wxImageSnipMatch, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "can-do-edit-operation?" " method", (Scheme_Method_Prim *)os_wxImageSnipCanEdit, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "do-edit-operation" " method", (Scheme_Method_Prim *)os_wxImageSnipDoEdit, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "blink-caret" " method", (Scheme_Method_Prim *)os_wxImageSnipBlinkCaret, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "own-caret" " method", (Scheme_Method_Prim *)os_wxImageSnipOwnCaret, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "adjust-cursor" " method", (Scheme_Method_Prim *)os_wxImageSnipAdjustCursor, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "on-char" " method", (Scheme_Method_Prim *)os_wxImageSnipOnChar, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "on-event" " method", (Scheme_Method_Prim *)os_wxImageSnipOnEvent, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "size-cache-invalid" " method", (Scheme_Method_Prim *)os_wxImageSnipSizeCacheInvalid, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "copy" " method", (Scheme_Method_Prim *)os_wxImageSnipCopy, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-text!" " method", (Scheme_Method_Prim *)os_wxImageSnipGetTextBang, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-text" " method", (Scheme_Method_Prim *)os_wxImageSnipGetText, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "merge-with" " method", (Scheme_Method_Prim *)os_wxImageSnipMergeWith, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "split" " method", (Scheme_Method_Prim *)os_wxImageSnipSplit, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "draw" " method", (Scheme_Method_Prim *)os_wxImageSnipDraw, 10, 10)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "partial-offset" " method", (Scheme_Method_Prim *)os_wxImageSnipPartialOffset, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxImageSnip_class, "get-extent" " method", (Scheme_Method_Prim *)os_wxImageSnipGetExtent, 3, 9)); - - - WITH_VAR_STACK(scheme_made_class(os_wxImageSnip_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxImageSnip, wxTYPE_IMAGE_SNIP)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxImageSnip(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxImageSnip_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "image-snip% object or " XC_NULL_STR: "image-snip% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxImageSnip(class wxImageSnip *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_IMAGE_SNIP) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxImageSnip_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxImageSnip *objscheme_unbundle_wxImageSnip(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxImageSnip(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxImageSnip *)o->primdata; - else - return (wxImageSnip *)o->primdata; -} - - -static bool EqualTo(wxImageSnip* bm, wxImageSnip* bm2, void *recur) -{ - /* Might redirect to Scheme. - We're relying on the cast succeeding because the method is - not virtual, but I doubt that this is guaranteed to work by the C++ - spec if wxImageSnip is instantiated instead of os_wxImageSnip */ - return ((os_wxImageSnip *)bm2)->OtherEqualTo_method(bm, recur); -} - - - - - - - - - - - - - - - - - - - - - -class os_wxMediaSnip : public wxMediaSnip { - public: - - os_wxMediaSnip CONSTRUCTOR_ARGS((class wxMediaBuffer* x0 = NULL, Bool x1 = TRUE, nnint x2 = wxMSNIPBOX_XMARGIN, nnint x3 = wxMSNIPBOX_YMARGIN, nnint x4 = wxMSNIPBOX_XMARGIN, nnint x5 = wxMSNIPBOX_YMARGIN, nnint x6 = wxMSNIPBOX_XINSET, nnint x7 = wxMSNIPBOX_YINSET, nnint x8 = wxMSNIPBOX_XINSET, nnint x9 = wxMSNIPBOX_YINSET, double x10 = -1, double x11 = -1, double x12 = -1, double x13 = -1)); - ~os_wxMediaSnip(); - void SetUnmodified(); - nndouble GetScrollStepOffset(nnlong x0); - nnlong FindScrollStep(double x0); - nnlong GetNumScrollSteps(); - void SetAdmin(class wxSnipAdmin* x0); - Bool Resize(nndouble x0, nndouble x1); - void Write(class wxMediaStreamOut* x0); - Bool Match(class wxSnip* x0); - Bool CanEdit(int x0, Bool x1 = TRUE); - void DoEdit(int x0, Bool x1 = TRUE, long x2 = 0); - void BlinkCaret(class wxDC* x0, double x1, double x2); - void OwnCaret(Bool x0); - class wxCursor* AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5); - void OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5); - void SizeCacheInvalid(); - class wxSnip* Copy(); - void GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3); - mzstring GetText(nnlong x0, nnlong x1, Bool x2 = FALSE, long* x3 = NULL); - class wxSnip* MergeWith(class wxSnip* x0); - void Split(nnlong x0, class wxSnip** x1, class wxSnip** x2); - void Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9); - double PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3); - void GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3 = NULL, nndouble* x4 = NULL, nndouble* x5 = NULL, nndouble* x6 = NULL, nndouble* x7 = NULL, nndouble* x8 = NULL); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMediaSnip::gcMark() { - wxMediaSnip::gcMark(); -} -void os_wxMediaSnip::gcFixup() { - wxMediaSnip::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMediaSnip_class; - -os_wxMediaSnip::os_wxMediaSnip CONSTRUCTOR_ARGS((class wxMediaBuffer* x0, Bool x1, nnint x2, nnint x3, nnint x4, nnint x5, nnint x6, nnint x7, nnint x8, nnint x9, double x10, double x11, double x12, double x13)) -CONSTRUCTOR_INIT(: wxMediaSnip(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)) -{ -} - -os_wxMediaSnip::~os_wxMediaSnip() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMediaSnipSetUnmodified(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::SetUnmodified() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "set-unmodified", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipSetUnmodified)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::SetUnmodified(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipGetScrollStepOffset(int n, Scheme_Object *p[]); - -nndouble os_wxMediaSnip::GetScrollStepOffset(nnlong x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "get-scroll-step-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipGetScrollStepOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::GetScrollStepOffset(x0); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nndouble resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(v, "get-scroll-step-offset in editor-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipFindScrollStep(int n, Scheme_Object *p[]); - -nnlong os_wxMediaSnip::FindScrollStep(double x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "find-scroll-step", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipFindScrollStep)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::FindScrollStep(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "find-scroll-step in editor-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipGetNumScrollSteps(int n, Scheme_Object *p[]); - -nnlong os_wxMediaSnip::GetNumScrollSteps() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "get-num-scroll-steps", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipGetNumScrollSteps)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::GetNumScrollSteps(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - nnlong resval; - resval = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(v, "get-num-scroll-steps in editor-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipSetAdmin(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::SetAdmin(class wxSnipAdmin* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "set-admin", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipSetAdmin)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::SetAdmin(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnipAdmin(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipResize(int n, Scheme_Object *p[]); - -Bool os_wxMediaSnip::Resize(nndouble x0, nndouble x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "resize", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipResize)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::Resize(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_double(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "resize in editor-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipWrite(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::Write(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "write", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipWrite)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::Write(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipMatch(int n, Scheme_Object *p[]); - -Bool os_wxMediaSnip::Match(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "match?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipMatch)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::Match(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "match? in editor-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipCanEdit(int n, Scheme_Object *p[]); - -Bool os_wxMediaSnip::CanEdit(int x0, Bool x1) -{ - Scheme_Object *p[POFFSET+2] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "can-do-edit-operation?", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipCanEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::CanEdit(x0, x1); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+2, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "can-do-edit-operation? in editor-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipDoEdit(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::DoEdit(int x0, Bool x1, long x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "do-edit-operation", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipDoEdit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::DoEdit(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(bundle_symset_editOp(x0)); - p[POFFSET+1] = (x1 ? scheme_true : scheme_false); - p[POFFSET+2] = scheme_make_integer(x2); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipBlinkCaret(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::BlinkCaret(class wxDC* x0, double x1, double x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "blink-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipBlinkCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::BlinkCaret(x0, x1, x2); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipOwnCaret(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::OwnCaret(Bool x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "own-caret", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipOwnCaret)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::OwnCaret(x0); - } else { - - p[POFFSET+0] = (x0 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipAdjustCursor(int n, Scheme_Object *p[]); - -class wxCursor* os_wxMediaSnip::AdjustCursor(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "adjust-cursor", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipAdjustCursor)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::AdjustCursor(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - { - class wxCursor* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxCursor(v, "adjust-cursor in editor-snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipOnChar(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::OnChar(class wxDC* x0, double x1, double x2, double x3, double x4, class wxKeyEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "on-char", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipOnChar)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::OnChar(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxKeyEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipOnEvent(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::OnEvent(class wxDC* x0, double x1, double x2, double x3, double x4, class wxMouseEvent* x5) -{ - Scheme_Object *p[POFFSET+6] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+6); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x5); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "on-event", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipOnEvent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::OnEvent(x0, x1, x2, x3, x4, x5); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(objscheme_bundle_wxMouseEvent(x5)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+6, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipSizeCacheInvalid(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::SizeCacheInvalid() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "size-cache-invalid", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipSizeCacheInvalid)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::SizeCacheInvalid(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipCopy(int n, Scheme_Object *p[]); - -class wxSnip* os_wxMediaSnip::Copy() -{ - Scheme_Object *p[POFFSET+0] INIT_NULLED_ARRAY({ NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "copy", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipCopy)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::Copy(); - } else { - - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+0, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "copy in editor-snip%"", extracting return value", 0)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipGetTextBang(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::GetTextBang(wmzstring x0, nnlong x1, nnlong x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "get-text!", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipGetTextBang)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::GetTextBang(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(scheme_make_sized_char_string(x0, x2+x3, 0)); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = scheme_make_integer(x2); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipGetText(int n, Scheme_Object *p[]); - -mzstring os_wxMediaSnip::GetText(nnlong x0, nnlong x1, Bool x2, long* x3) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(5); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "get-text", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipGetText)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::GetText(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = scheme_make_integer(x1); - p[POFFSET+2] = (x2 ? scheme_true : scheme_false); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - - { - mzstring resval; - resval = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(v, "get-text in editor-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipMergeWith(int n, Scheme_Object *p[]); - -class wxSnip* os_wxMediaSnip::MergeWith(class wxSnip* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "merge-with", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipMergeWith)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::MergeWith(x0); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxSnip(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxSnip* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxSnip(v, "merge-with in editor-snip%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipSplit(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::Split(nnlong x0, class wxSnip** x1, class wxSnip** x2) -{ - Scheme_Object *p[POFFSET+3] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(7); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+3); - VAR_STACK_PUSH(5, x1); - VAR_STACK_PUSH(6, x2); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "split", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipSplit)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::Split(x0, x1, x2); - } else { - - p[POFFSET+0] = scheme_make_integer(x0); - p[POFFSET+1] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x1))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - p[POFFSET+2] = (sbox_tmp = WITH_VAR_STACK(objscheme_bundle_wxSnip((*x2))), WITH_VAR_STACK(objscheme_box(sbox_tmp))); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+3, p)); - - if (x1) *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in editor-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in editor-snip%"", extracting return value via box"", extracting boxed argument", 0))); - if (x2) *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in editor-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in editor-snip%"", extracting return value via box"", extracting boxed argument", 0))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipDraw(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::Draw(class wxDC* x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, int x9) -{ - Scheme_Object *p[POFFSET+10] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+10); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "draw", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipDraw)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = WITH_VAR_STACK(scheme_make_double(x3)); - p[POFFSET+4] = WITH_VAR_STACK(scheme_make_double(x4)); - p[POFFSET+5] = WITH_VAR_STACK(scheme_make_double(x5)); - p[POFFSET+6] = WITH_VAR_STACK(scheme_make_double(x6)); - p[POFFSET+7] = WITH_VAR_STACK(scheme_make_double(x7)); - p[POFFSET+8] = WITH_VAR_STACK(scheme_make_double(x8)); - p[POFFSET+9] = WITH_VAR_STACK(bundle_symset_caret(x9)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+10, p)); - - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipPartialOffset(int n, Scheme_Object *p[]); - -double os_wxMediaSnip::PartialOffset(class wxDC* x0, double x1, double x2, nnlong x3) -{ - Scheme_Object *p[POFFSET+4] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+4); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "partial-offset", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipPartialOffset)) { - SET_VAR_STACK(); - READY_TO_RETURN; return ASSELF wxMediaSnip::PartialOffset(x0, x1, x2, x3); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = scheme_make_integer(x3); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+4, p)); - - - { - double resval; - resval = WITH_VAR_STACK(objscheme_unbundle_double(v, "partial-offset in editor-snip%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxMediaSnipGetExtent(int n, Scheme_Object *p[]); - -void os_wxMediaSnip::GetExtent(class wxDC* x0, double x1, double x2, nndouble* x3, nndouble* x4, nndouble* x5, nndouble* x6, nndouble* x7, nndouble* x8) -{ - Scheme_Object *p[POFFSET+9] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxMediaSnip *sElF = this; -#endif - static void *mcache = 0; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK(12); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+9); - VAR_STACK_PUSH(5, x0); - VAR_STACK_PUSH(6, x3); - VAR_STACK_PUSH(7, x4); - VAR_STACK_PUSH(8, x5); - VAR_STACK_PUSH(9, x6); - VAR_STACK_PUSH(10, x7); - VAR_STACK_PUSH(11, x8); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxMediaSnip_class, "get-extent", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxMediaSnipGetExtent)) { - SET_VAR_STACK(); - READY_TO_RETURN; ASSELF wxMediaSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8); - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxDC(x0)); - p[POFFSET+1] = WITH_VAR_STACK(scheme_make_double(x1)); - p[POFFSET+2] = WITH_VAR_STACK(scheme_make_double(x2)); - p[POFFSET+3] = ((x3) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x3))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+4] = ((x4) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x4))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+5] = ((x5) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x5))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+6] = ((x6) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x6))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+7] = ((x7) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x7))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - p[POFFSET+8] = ((x8) ? (sbox_tmp = WITH_VAR_STACK(scheme_make_double((*x8))), WITH_VAR_STACK(objscheme_box(sbox_tmp))) : XC_SCHEME_NULL); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+9, p)); - - if (x3) *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in editor-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x4) *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in editor-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x5) *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in editor-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x6) *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in editor-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x7) *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in editor-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting return value via box"", extracting boxed argument"))); - if (x8) *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in editor-snip%"", extracting return value via box")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting return value via box"", extracting boxed argument"))); - - READY_TO_RETURN; - } -} - -static Scheme_Object *os_wxMediaSnipGetInset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "get-inset in editor-snip%", n, p); - nnint _x0; - nnint* x0 = &_x0; - nnint _x1; - nnint* x1 = &_x1; - nnint _x2; - nnint* x2 = &_x2; - nnint _x3; - nnint* x3 = &_x3; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get-inset in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-inset in editor-snip%"", extracting boxed argument"))); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get-inset in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-inset in editor-snip%"", extracting boxed argument"))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "get-inset in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-inset in editor-snip%"", extracting boxed argument"))); - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+3], "get-inset in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-inset in editor-snip%"", extracting boxed argument"))); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetInset(x0, x1, x2, x3)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = scheme_make_integer(_x2); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3)) - { Scheme_Object *sbv_ = scheme_make_integer(_x3); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipSetInset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-inset in editor-snip%", n, p); - nnint x0; - nnint x1; - nnint x2; - nnint x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-inset in editor-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "set-inset in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "set-inset in editor-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "set-inset in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetInset(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipGetMargin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "get-margin in editor-snip%", n, p); - nnint _x0; - nnint* x0 = &_x0; - nnint _x1; - nnint* x1 = &_x1; - nnint _x2; - nnint* x2 = &_x2; - nnint _x3; - nnint* x3 = &_x3; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get-margin in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-margin in editor-snip%"", extracting boxed argument"))); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get-margin in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-margin in editor-snip%"", extracting boxed argument"))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "get-margin in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-margin in editor-snip%"", extracting boxed argument"))); - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+3], "get-margin in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(sbox_tmp, "get-margin in editor-snip%"", extracting boxed argument"))); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetMargin(x0, x1, x2, x3)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = scheme_make_integer(_x2); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - if (n > (POFFSET+3)) - { Scheme_Object *sbv_ = scheme_make_integer(_x3); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipSetMargin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-margin in editor-snip%", n, p); - nnint x0; - nnint x1; - nnint x2; - nnint x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "set-margin in editor-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "set-margin in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "set-margin in editor-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "set-margin in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetMargin(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipStyleBGUsed(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaSnip_class, "style-background-used? in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->StyleBGUsed()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaSnipUseStyleBG(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "use-style-background in editor-snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "use-style-background in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->UseStyleBG(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipBorderVisible(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaSnip_class, "border-visible? in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->BorderVisible()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaSnipShowBorder(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "show-border in editor-snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "show-border in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->ShowBorder(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipSetAlignTopLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-align-top-line in editor-snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-align-top-line in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetAlignTopLine(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipGetAlignTopLine(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaSnip_class, "get-align-top-line in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetAlignTopLine()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaSnipSetTightTextFit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-tight-text-fit in editor-snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "set-tight-text-fit in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetTightTextFit(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipGetTightTextFit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaSnip_class, "get-tight-text-fit in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetTightTextFit()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaSnipGetMinHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaSnip_class, "get-min-height in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetMinHeight()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_nonnegative_symbol_double(r, "none")); -} - -static Scheme_Object *os_wxMediaSnipGetMinWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaSnip_class, "get-min-width in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetMinWidth()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_nonnegative_symbol_double(r, "none")); -} - -static Scheme_Object *os_wxMediaSnipSetMinHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-min-height in editor-snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+0], "none", "set-min-height in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetMinHeight(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipSetMinWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-min-width in editor-snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+0], "none", "set-min-width in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetMinWidth(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipGetMaxHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaSnip_class, "get-max-height in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetMaxHeight()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_nonnegative_symbol_double(r, "none")); -} - -static Scheme_Object *os_wxMediaSnipGetMaxWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaSnip_class, "get-max-width in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetMaxWidth()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_nonnegative_symbol_double(r, "none")); -} - -static Scheme_Object *os_wxMediaSnipSetMaxHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-max-height in editor-snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+0], "none", "set-max-height in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetMaxHeight(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipSetMaxWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-max-width in editor-snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+0], "none", "set-max-width in editor-snip%")); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetMaxWidth(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipSetUnmodified(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-unmodified in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::SetUnmodified()); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetUnmodified()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipGetScrollStepOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nndouble r; - objscheme_check_valid(os_wxMediaSnip_class, "get-scroll-step-offset in editor-snip%", n, p); - nnlong x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-scroll-step-offset in editor-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::GetScrollStepOffset(x0)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetScrollStepOffset(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaSnipFindScrollStep(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxMediaSnip_class, "find-scroll-step in editor-snip%", n, p); - double x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "find-scroll-step in editor-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::FindScrollStep(x0)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->FindScrollStep(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaSnipGetNumScrollSteps(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nnlong r; - objscheme_check_valid(os_wxMediaSnip_class, "get-num-scroll-steps in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::GetNumScrollSteps()); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetNumScrollSteps()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxMediaSnipSetAdmin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-admin in editor-snip%", n, p); - class wxSnipAdmin* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnipAdmin(p[POFFSET+0], "set-admin in editor-snip%", 1)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::SetAdmin(x0)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetAdmin(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipResize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaSnip_class, "resize in editor-snip%", n, p); - nndouble x0; - nndouble x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "resize in editor-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "resize in editor-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::Resize(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->Resize(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaSnipWrite(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "write in editor-snip%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write in editor-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::Write(x0)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->Write(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipMatch(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaSnip_class, "match? in editor-snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "match? in editor-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::Match(x0)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->Match(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaSnipCanEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxMediaSnip_class, "can-do-edit-operation? in editor-snip%", n, p); - int x0; - Bool x1; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "can-do-edit-operation? in editor-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "can-do-edit-operation? in editor-snip%")); - } else - x1 = TRUE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::CanEdit(x0, x1)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->CanEdit(x0, x1)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxMediaSnipDoEdit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "do-edit-operation in editor-snip%", n, p); - int x0; - Bool x1; - long x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(unbundle_symset_editOp(p[POFFSET+0], "do-edit-operation in editor-snip%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "do-edit-operation in editor-snip%")); - } else - x1 = TRUE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_integer(p[POFFSET+2], "do-edit-operation in editor-snip%")); - } else - x2 = 0; - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::DoEdit(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->DoEdit(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipBlinkCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "blink-caret in editor-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "blink-caret in editor-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "blink-caret in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "blink-caret in editor-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::BlinkCaret(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->BlinkCaret(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipOwnCaret(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "own-caret in editor-snip%", n, p); - Bool x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "own-caret in editor-snip%")); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::OwnCaret(x0)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->OwnCaret(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipAdjustCursor(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxCursor* r; - objscheme_check_valid(os_wxMediaSnip_class, "adjust-cursor in editor-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "adjust-cursor in editor-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "adjust-cursor in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "adjust-cursor in editor-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "adjust-cursor in editor-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "adjust-cursor in editor-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "adjust-cursor in editor-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","adjust-cursor"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::AdjustCursor(x0, x1, x2, x3, x4, x5)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->AdjustCursor(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxCursor(r)); -} - -static Scheme_Object *os_wxMediaSnipOnChar(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "on-char in editor-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxKeyEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-char in editor-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-char in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-char in editor-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-char in editor-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-char in editor-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxKeyEvent(p[POFFSET+5], "on-char in editor-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-char"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::OnChar(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnChar(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipOnEvent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "on-event in editor-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - class wxMouseEvent* x5 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x5); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "on-event in editor-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "on-event in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "on-event in editor-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "on-event in editor-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "on-event in editor-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_wxMouseEvent(p[POFFSET+5], "on-event in editor-snip%", 0)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","on-event"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::OnEvent(x0, x1, x2, x3, x4, x5)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->OnEvent(x0, x1, x2, x3, x4, x5)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipSizeCacheInvalid(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "size-cache-invalid in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::SizeCacheInvalid()); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SizeCacheInvalid()); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaSnip_class, "copy in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::Copy()); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->Copy()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaSnipGetTextBang(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "get-text! in editor-snip%", n, p); - wmzstring x0 INIT_NULLED_OUT; - nnlong x1; - nnlong x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (wmzstring)WITH_VAR_STACK(objscheme_unbundle_mutable_mzstring(p[POFFSET+0], "get-text! in editor-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text! in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "get-text! in editor-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "get-text! in editor-snip%")); - - if (SCHEME_CHAR_STRTAG_VAL(p[0+POFFSET]) < (x2 + x3)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-text!"), "string too short: ", p[0+POFFSET])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::GetTextBang(x0, x1, x2, x3)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetTextBang(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipGetText(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - mzstring r; - objscheme_check_valid(os_wxMediaSnip_class, "get-text in editor-snip%", n, p); - nnlong x0; - nnlong x1; - Bool x2; - long _x3; - long* x3 = &_x3; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "get-text in editor-snip%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+1], "get-text in editor-snip%")); - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-text in editor-snip%")); - } else - x2 = FALSE; - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::GetText(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetText(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_VAR_STACK(scheme_make_sized_char_string(r, _x3, 0)); -} - -static Scheme_Object *os_wxMediaSnipMergeWith(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxSnip* r; - objscheme_check_valid(os_wxMediaSnip_class, "merge-with in editor-snip%", n, p); - class wxSnip* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxSnip(p[POFFSET+0], "merge-with in editor-snip%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::MergeWith(x0)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->MergeWith(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxSnip(r)); -} - -static Scheme_Object *os_wxMediaSnipSplit(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "split in editor-snip%", n, p); - nnlong x0; - class wxSnip* _x1; - class wxSnip** x1 = &_x1; - class wxSnip* _x2; - class wxSnip** x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "split in editor-snip%")); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "split in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in editor-snip%"", extracting boxed argument", 0))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "split in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_wxSnip(sbox_tmp, "split in editor-snip%"", extracting boxed argument", 0))); - - - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::Split(x0, x1, x2)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->Split(x0, x1, x2)); - - - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(objscheme_bundle_wxSnip(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipDraw(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "draw in editor-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - double x3; - double x4; - double x5; - double x6; - double x7; - double x8; - int x9; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "draw in editor-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw in editor-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "draw in editor-snip%")); - x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw in editor-snip%")); - x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw in editor-snip%")); - x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+6], "draw in editor-snip%")); - x7 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+7], "draw in editor-snip%")); - x8 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+8], "draw in editor-snip%")); - x9 = WITH_VAR_STACK(unbundle_symset_caret(p[POFFSET+9], "draw in editor-snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","draw"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->Draw(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipPartialOffset(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxMediaSnip_class, "partial-offset in editor-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nnlong x3; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "partial-offset in editor-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "partial-offset in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "partial-offset in editor-snip%")); - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "partial-offset in editor-snip%")); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","partial-offset"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - r = WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::PartialOffset(x0, x1, x2, x3)); - else - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->PartialOffset(x0, x1, x2, x3)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxMediaSnipGetExtent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "get-extent in editor-snip%", n, p); - class wxDC* x0 INIT_NULLED_OUT; - double x1; - double x2; - nndouble _x3; - nndouble* x3 = &_x3; - nndouble _x4; - nndouble* x4 = &_x4; - nndouble _x5; - nndouble* x5 = &_x5; - nndouble _x6; - nndouble* x6 = &_x6; - nndouble _x7; - nndouble* x7 = &_x7; - nndouble _x8; - nndouble* x8 = &_x8; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-extent in editor-snip%", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "get-extent in editor-snip%")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "get-extent in editor-snip%")); - if (n > (POFFSET+3)) { - if (XC_SCHEME_NULLP(p[POFFSET+3])) - x3 = NULL; - else - *x3 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+3], "get-extent in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting boxed argument"))); - } else - x3 = NULL; - if (n > (POFFSET+4)) { - if (XC_SCHEME_NULLP(p[POFFSET+4])) - x4 = NULL; - else - *x4 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+4], "get-extent in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting boxed argument"))); - } else - x4 = NULL; - if (n > (POFFSET+5)) { - if (XC_SCHEME_NULLP(p[POFFSET+5])) - x5 = NULL; - else - *x5 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+5], "get-extent in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting boxed argument"))); - } else - x5 = NULL; - if (n > (POFFSET+6)) { - if (XC_SCHEME_NULLP(p[POFFSET+6])) - x6 = NULL; - else - *x6 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+6], "get-extent in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting boxed argument"))); - } else - x6 = NULL; - if (n > (POFFSET+7)) { - if (XC_SCHEME_NULLP(p[POFFSET+7])) - x7 = NULL; - else - *x7 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+7], "get-extent in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting boxed argument"))); - } else - x7 = NULL; - if (n > (POFFSET+8)) { - if (XC_SCHEME_NULLP(p[POFFSET+8])) - x8 = NULL; - else - *x8 = (sbox_tmp = WITH_VAR_STACK(objscheme_nullable_unbox(p[POFFSET+8], "get-extent in editor-snip%")), WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(sbox_tmp, "get-extent in editor-snip%"", extracting boxed argument"))); - } else - x8 = NULL; - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("snip%","get-extent"), "bad device context: ", p[POFFSET+0])); - if (((Scheme_Class_Object *)p[0])->primflag) - WITH_VAR_STACK(((os_wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->wxMediaSnip::GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - else - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetExtent(x0, x1, x2, x3, x4, x5, x6, x7, x8)); - - - if (n > (POFFSET+3) && !XC_SCHEME_NULLP(p[POFFSET+3])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x3)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+3], sbv_)); } - if (n > (POFFSET+4) && !XC_SCHEME_NULLP(p[POFFSET+4])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x4)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+4], sbv_)); } - if (n > (POFFSET+5) && !XC_SCHEME_NULLP(p[POFFSET+5])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x5)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+5], sbv_)); } - if (n > (POFFSET+6) && !XC_SCHEME_NULLP(p[POFFSET+6])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x6)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+6], sbv_)); } - if (n > (POFFSET+7) && !XC_SCHEME_NULLP(p[POFFSET+7])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x7)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+7], sbv_)); } - if (n > (POFFSET+8) && !XC_SCHEME_NULLP(p[POFFSET+8])) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x8)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+8], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipSetMedia(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMediaSnip_class, "set-editor in editor-snip%", n, p); - class wxMediaBuffer* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(p[POFFSET+0], "set-editor in editor-snip%", 1)); - - - WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->SetMedia(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMediaSnipGetThisMedia(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxMediaBuffer* r; - objscheme_check_valid(os_wxMediaSnip_class, "get-editor in editor-snip%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxMediaSnip *)((Scheme_Class_Object *)p[0])->primdata)->GetThisMedia()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMediaBuffer(r)); -} - -static Scheme_Object *os_wxMediaSnip_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxMediaSnip *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - class wxMediaBuffer* x0 INIT_NULLED_OUT; - Bool x1; - nnint x2; - nnint x3; - nnint x4; - nnint x5; - nnint x6; - nnint x7; - nnint x8; - nnint x9; - double x10; - double x11; - double x12; - double x13; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - VAR_STACK_PUSH(2, x0); - - - if ((n > (POFFSET+14))) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-snip%", POFFSET+POFFSET, POFFSET+14, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaBuffer(p[POFFSET+0], "initialization in editor-snip%", 1)); - } else - x0 = NULL; - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "initialization in editor-snip%")); - } else - x1 = TRUE; - if (n > (POFFSET+2)) { - x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+2], "initialization in editor-snip%")); - } else - x2 = wxMSNIPBOX_XMARGIN; - if (n > (POFFSET+3)) { - x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "initialization in editor-snip%")); - } else - x3 = wxMSNIPBOX_YMARGIN; - if (n > (POFFSET+4)) { - x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+4], "initialization in editor-snip%")); - } else - x4 = wxMSNIPBOX_XMARGIN; - if (n > (POFFSET+5)) { - x5 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+5], "initialization in editor-snip%")); - } else - x5 = wxMSNIPBOX_YMARGIN; - if (n > (POFFSET+6)) { - x6 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+6], "initialization in editor-snip%")); - } else - x6 = wxMSNIPBOX_XINSET; - if (n > (POFFSET+7)) { - x7 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+7], "initialization in editor-snip%")); - } else - x7 = wxMSNIPBOX_YINSET; - if (n > (POFFSET+8)) { - x8 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+8], "initialization in editor-snip%")); - } else - x8 = wxMSNIPBOX_XINSET; - if (n > (POFFSET+9)) { - x9 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+9], "initialization in editor-snip%")); - } else - x9 = wxMSNIPBOX_YINSET; - if (n > (POFFSET+10)) { - x10 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+10], "none", "initialization in editor-snip%")); - } else - x10 = -1; - if (n > (POFFSET+11)) { - x11 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+11], "none", "initialization in editor-snip%")); - } else - x11 = -1; - if (n > (POFFSET+12)) { - x12 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+12], "none", "initialization in editor-snip%")); - } else - x12 = -1; - if (n > (POFFSET+13)) { - x13 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_symbol_double(p[POFFSET+13], "none", "initialization in editor-snip%")); - } else - x13 = -1; - - - realobj = WITH_VAR_STACK(new os_wxMediaSnip CONSTRUCTOR_ARGS((x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxMediaSnip(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxMediaSnip(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMediaSnip_class); - - os_wxMediaSnip_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-snip%", "snip%", (Scheme_Method_Prim *)os_wxMediaSnip_ConstructScheme, 46)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-inset" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetInset, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-inset" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetInset, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-margin" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetMargin, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-margin" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetMargin, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "style-background-used?" " method", (Scheme_Method_Prim *)os_wxMediaSnipStyleBGUsed, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "use-style-background" " method", (Scheme_Method_Prim *)os_wxMediaSnipUseStyleBG, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "border-visible?" " method", (Scheme_Method_Prim *)os_wxMediaSnipBorderVisible, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "show-border" " method", (Scheme_Method_Prim *)os_wxMediaSnipShowBorder, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-align-top-line" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetAlignTopLine, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-align-top-line" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetAlignTopLine, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-tight-text-fit" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetTightTextFit, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-tight-text-fit" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetTightTextFit, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-min-height" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetMinHeight, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-min-width" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetMinWidth, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-min-height" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetMinHeight, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-min-width" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetMinWidth, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-max-height" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetMaxHeight, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-max-width" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetMaxWidth, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-max-height" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetMaxHeight, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-max-width" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetMaxWidth, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-unmodified" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetUnmodified, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-scroll-step-offset" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetScrollStepOffset, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "find-scroll-step" " method", (Scheme_Method_Prim *)os_wxMediaSnipFindScrollStep, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-num-scroll-steps" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetNumScrollSteps, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-admin" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetAdmin, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "resize" " method", (Scheme_Method_Prim *)os_wxMediaSnipResize, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "write" " method", (Scheme_Method_Prim *)os_wxMediaSnipWrite, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "match?" " method", (Scheme_Method_Prim *)os_wxMediaSnipMatch, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "can-do-edit-operation?" " method", (Scheme_Method_Prim *)os_wxMediaSnipCanEdit, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "do-edit-operation" " method", (Scheme_Method_Prim *)os_wxMediaSnipDoEdit, 1, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "blink-caret" " method", (Scheme_Method_Prim *)os_wxMediaSnipBlinkCaret, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "own-caret" " method", (Scheme_Method_Prim *)os_wxMediaSnipOwnCaret, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "adjust-cursor" " method", (Scheme_Method_Prim *)os_wxMediaSnipAdjustCursor, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "on-char" " method", (Scheme_Method_Prim *)os_wxMediaSnipOnChar, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "on-event" " method", (Scheme_Method_Prim *)os_wxMediaSnipOnEvent, 6, 6)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "size-cache-invalid" " method", (Scheme_Method_Prim *)os_wxMediaSnipSizeCacheInvalid, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "copy" " method", (Scheme_Method_Prim *)os_wxMediaSnipCopy, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-text!" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetTextBang, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-text" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetText, 2, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "merge-with" " method", (Scheme_Method_Prim *)os_wxMediaSnipMergeWith, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "split" " method", (Scheme_Method_Prim *)os_wxMediaSnipSplit, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "draw" " method", (Scheme_Method_Prim *)os_wxMediaSnipDraw, 10, 10)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "partial-offset" " method", (Scheme_Method_Prim *)os_wxMediaSnipPartialOffset, 4, 4)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-extent" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetExtent, 3, 9)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "set-editor" " method", (Scheme_Method_Prim *)os_wxMediaSnipSetMedia, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMediaSnip_class, "get-editor" " method", (Scheme_Method_Prim *)os_wxMediaSnipGetThisMedia, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxMediaSnip_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMediaSnip, wxTYPE_MEDIA_SNIP)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMediaSnip(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMediaSnip_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-snip% object or " XC_NULL_STR: "editor-snip% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMediaSnip(class wxMediaSnip *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_MEDIA_SNIP) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMediaSnip_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMediaSnip *objscheme_unbundle_wxMediaSnip(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMediaSnip(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMediaSnip *)o->primdata; - else - return (wxMediaSnip *)o->primdata; -} - - - - - - - - -class os_wxBufferDataClass : public wxBufferDataClass { - public: - - os_wxBufferDataClass CONSTRUCTOR_ARGS(()); - ~os_wxBufferDataClass(); - class wxBufferData* Read(class wxMediaStreamIn* x0); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxBufferDataClass::gcMark() { - wxBufferDataClass::gcMark(); -} -void os_wxBufferDataClass::gcFixup() { - wxBufferDataClass::gcFixup(); -} -#endif - -static Scheme_Object *os_wxBufferDataClass_class; - -os_wxBufferDataClass::os_wxBufferDataClass CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxBufferDataClass()) -{ -} - -os_wxBufferDataClass::~os_wxBufferDataClass() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxBufferDataClassRead(int n, Scheme_Object *p[]); - -class wxBufferData* os_wxBufferDataClass::Read(class wxMediaStreamIn* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxBufferDataClass *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxBufferDataClass_class, "read", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxBufferDataClassRead)) { - SET_VAR_STACK(); - return NULL; - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamIn(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - class wxBufferData* resval; - resval = WITH_VAR_STACK(objscheme_unbundle_wxBufferData(v, "read in editor-data-class%"", extracting return value", 1)); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxBufferDataClassRead(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBufferData* r; - objscheme_check_valid(os_wxBufferDataClass_class, "read in editor-data-class%", n, p); - class wxMediaStreamIn* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamIn(p[POFFSET+0], "read in editor-data-class%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = NULL; - else - r = WITH_VAR_STACK(((wxBufferDataClass *)((Scheme_Class_Object *)p[0])->primdata)->Read(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferData(r)); -} - -static Scheme_Object *objscheme_wxBufferDataClass_Getclassname(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - string v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxBufferDataClass_class, "get-classname in editor-data-class%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-classname in editor-data-class%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxBufferDataClass *)cobj->primdata)->wxBufferDataClass::classname; - else - v = ((wxBufferDataClass *)cobj->primdata)->classname; - - return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)v)); -} - -static Scheme_Object *objscheme_wxBufferDataClass_Setclassname(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - string v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxBufferDataClass_class, "set-classname in editor-data-class%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-classname in editor-data-class%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET], "set-classname in editor-data-class%")); - ((wxBufferDataClass *)cobj->primdata)->classname = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxBufferDataClass_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxBufferDataClass *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-data-class%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxBufferDataClass CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxBufferDataClass()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxBufferDataClass(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxBufferDataClass_class); - - os_wxBufferDataClass_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-data-class%", "object%", (Scheme_Method_Prim *)os_wxBufferDataClass_ConstructScheme, 3)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferDataClass_class, "read" " method", (Scheme_Method_Prim *)os_wxBufferDataClassRead, 1, 1)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferDataClass_class,"get-classname" " method", (Scheme_Method_Prim *)objscheme_wxBufferDataClass_Getclassname, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferDataClass_class,"set-classname" " method", (Scheme_Method_Prim *)objscheme_wxBufferDataClass_Setclassname, 1, 1)); - - WITH_VAR_STACK(scheme_made_class(os_wxBufferDataClass_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxBufferDataClass, wxTYPE_BUFFER_DATA_CLASS)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxBufferDataClass(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxBufferDataClass_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-data-class% object or " XC_NULL_STR: "editor-data-class% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxBufferDataClass(class wxBufferDataClass *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_BUFFER_DATA_CLASS) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxBufferDataClass_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxBufferDataClass *objscheme_unbundle_wxBufferDataClass(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxBufferDataClass(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxBufferDataClass *)o->primdata; - else - return (wxBufferDataClass *)o->primdata; -} - - - - - -class os_wxBufferDataClassList : public wxBufferDataClassList { - public: - - ~os_wxBufferDataClassList(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxBufferDataClassList::gcMark() { - wxBufferDataClassList::gcMark(); -} -void os_wxBufferDataClassList::gcFixup() { - wxBufferDataClassList::gcFixup(); -} -#endif - -static Scheme_Object *os_wxBufferDataClassList_class; -static Scheme_Object *os_wxBufferDataClassList_interface; - -os_wxBufferDataClassList::~os_wxBufferDataClassList() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxBufferDataClassListNth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBufferDataClass* r; - objscheme_check_valid(os_wxBufferDataClassList_class, "nth in editor-data-class-list<%>", n, p); - nnint x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "nth in editor-data-class-list<%>")); - - - r = WITH_VAR_STACK(((wxBufferDataClassList *)((Scheme_Class_Object *)p[0])->primdata)->Nth(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferDataClass(r)); -} - -static Scheme_Object *os_wxBufferDataClassListNumber(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxBufferDataClassList_class, "number in editor-data-class-list<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxBufferDataClassList *)((Scheme_Class_Object *)p[0])->primdata)->Number()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxBufferDataClassListAdd(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxBufferDataClassList_class, "add in editor-data-class-list<%>", n, p); - class wxBufferDataClass* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxBufferDataClass(p[POFFSET+0], "add in editor-data-class-list<%>", 0)); - - - WITH_VAR_STACK(((wxBufferDataClassList *)((Scheme_Class_Object *)p[0])->primdata)->Add(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxBufferDataClassListFindPosition(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - short r; - objscheme_check_valid(os_wxBufferDataClassList_class, "find-position in editor-data-class-list<%>", n, p); - class wxBufferDataClass* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxBufferDataClass(p[POFFSET+0], "find-position in editor-data-class-list<%>", 0)); - - - r = WITH_VAR_STACK(((wxBufferDataClassList *)((Scheme_Class_Object *)p[0])->primdata)->FindPosition(x0)); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxBufferDataClassListFind(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxBufferDataClass* r; - objscheme_check_valid(os_wxBufferDataClassList_class, "find in editor-data-class-list<%>", n, p); - string x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "find in editor-data-class-list<%>")); - - - r = WITH_VAR_STACK(((wxBufferDataClassList *)((Scheme_Class_Object *)p[0])->primdata)->Find(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferDataClass(r)); -} - -void objscheme_setup_wxBufferDataClassList(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxBufferDataClassList_class); - wxREGGLOB(os_wxBufferDataClassList_interface); - - os_wxBufferDataClassList_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-data-class-list%", "object%", NULL, 5)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferDataClassList_class, "nth" " method", (Scheme_Method_Prim *)os_wxBufferDataClassListNth, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferDataClassList_class, "number" " method", (Scheme_Method_Prim *)os_wxBufferDataClassListNumber, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferDataClassList_class, "add" " method", (Scheme_Method_Prim *)os_wxBufferDataClassListAdd, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferDataClassList_class, "find-position" " method", (Scheme_Method_Prim *)os_wxBufferDataClassListFindPosition, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferDataClassList_class, "find" " method", (Scheme_Method_Prim *)os_wxBufferDataClassListFind, 1, 1)); - - - WITH_VAR_STACK(scheme_made_class(os_wxBufferDataClassList_class)); - - os_wxBufferDataClassList_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxBufferDataClassList_class, "editor-data-class-list" "<%>")); - - WITH_VAR_STACK(objscheme_add_global_interface(os_wxBufferDataClassList_interface, "editor-data-class-list" "<%>", env)); - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxBufferDataClassList, wxTYPE_BUFFER_DATA_CLASS_LIST)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxBufferDataClassList(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxBufferDataClassList_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-data-class-list% object or " XC_NULL_STR: "editor-data-class-list% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxBufferDataClassList(class wxBufferDataClassList *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_BUFFER_DATA_CLASS_LIST) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxBufferDataClassList_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxBufferDataClassList *objscheme_unbundle_wxBufferDataClassList(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxBufferDataClassList(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxBufferDataClassList *)o->primdata; - else - return (wxBufferDataClassList *)o->primdata; -} - - -static void SetNextNoCycle(wxBufferData *dest, wxBufferData *naya) -{ - wxBufferData *d; - for (d = naya; d; d = d->next) { - if (d == dest) { - /* Don't allow it because it would create a cycle. */ - return; - } - } - - dest->next = naya; -} - - - - - - -class os_wxBufferData : public wxBufferData { - public: - - os_wxBufferData CONSTRUCTOR_ARGS(()); - ~os_wxBufferData(); - Bool Write(class wxMediaStreamOut* x0); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxBufferData::gcMark() { - wxBufferData::gcMark(); -} -void os_wxBufferData::gcFixup() { - wxBufferData::gcFixup(); -} -#endif - -static Scheme_Object *os_wxBufferData_class; - -os_wxBufferData::os_wxBufferData CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxBufferData()) -{ -} - -os_wxBufferData::~os_wxBufferData() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxBufferDataWrite(int n, Scheme_Object *p[]); - -Bool os_wxBufferData::Write(class wxMediaStreamOut* x0) -{ - Scheme_Object *p[POFFSET+1] INIT_NULLED_ARRAY({ NULLED_OUT INA_comma NULLED_OUT }); - Scheme_Object *v; - Scheme_Object *method INIT_NULLED_OUT; -#ifdef MZ_PRECISE_GC - os_wxBufferData *sElF = this; -#endif - static void *mcache = 0; - - SETUP_VAR_STACK(6); - VAR_STACK_PUSH(0, method); - VAR_STACK_PUSH(1, sElF); - VAR_STACK_PUSH_ARRAY(2, p, POFFSET+1); - VAR_STACK_PUSH(5, x0); - SET_VAR_STACK(); - - method = objscheme_find_method((Scheme_Object *) ASSELF __gc_external, os_wxBufferData_class, "write", &mcache); - if (!method || OBJSCHEME_PRIM_METHOD(method, os_wxBufferDataWrite)) { - SET_VAR_STACK(); - return 0; - } else { - - p[POFFSET+0] = WITH_VAR_STACK(objscheme_bundle_wxMediaStreamOut(x0)); - - p[0] = (Scheme_Object *) ASSELF __gc_external; - - v = WITH_VAR_STACK(scheme_apply(method, POFFSET+1, p)); - - - { - Bool resval; - resval = WITH_VAR_STACK(objscheme_unbundle_bool(v, "write in editor-data%"", extracting return value")); - READY_TO_RETURN; - return resval; - } - } -} - -static Scheme_Object *os_wxBufferDataSetNextNoCycle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxBufferData_class, "set-next in editor-data%", n, p); - class wxBufferData* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxBufferData(p[POFFSET+0], "set-next in editor-data%", 1)); - - - WITH_VAR_STACK(SetNextNoCycle(((wxBufferData *)((Scheme_Class_Object *)p[0])->primdata), x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxBufferDataWrite(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxBufferData_class, "write in editor-data%", n, p); - class wxMediaStreamOut* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxMediaStreamOut(p[POFFSET+0], "write in editor-data%", 0)); - - - if (((Scheme_Class_Object *)p[0])->primflag) - r = 0; - else - r = WITH_VAR_STACK(((wxBufferData *)((Scheme_Class_Object *)p[0])->primdata)->Write(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *objscheme_wxBufferData_Getdataclass(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - class wxBufferDataClass* v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxBufferData_class, "get-dataclass in editor-data%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-dataclass in editor-data%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxBufferData *)cobj->primdata)->wxBufferData::dataclass; - else - v = ((wxBufferData *)cobj->primdata)->dataclass; - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferDataClass(v)); -} - -static Scheme_Object *objscheme_wxBufferData_Setdataclass(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - class wxBufferDataClass* v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxBufferData_class, "set-dataclass in editor-data%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-dataclass in editor-data%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_wxBufferDataClass(p[POFFSET], "set-dataclass in editor-data%", 1)); - ((wxBufferData *)cobj->primdata)->dataclass = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxBufferData_Getnext(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - class wxBufferData* v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxBufferData_class, "get-next in editor-data%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-next in editor-data%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxBufferData *)cobj->primdata)->wxBufferData::next; - else - v = ((wxBufferData *)cobj->primdata)->next; - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxBufferData(v)); -} - -static Scheme_Object *os_wxBufferData_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxBufferData *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in editor-data%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxBufferData CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxBufferData()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata)); - return scheme_void; -} - -void objscheme_setup_wxBufferData(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxBufferData_class); - - os_wxBufferData_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "editor-data%", "object%", (Scheme_Method_Prim *)os_wxBufferData_ConstructScheme, 5)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferData_class, "set-next" " method", (Scheme_Method_Prim *)os_wxBufferDataSetNextNoCycle, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferData_class, "write" " method", (Scheme_Method_Prim *)os_wxBufferDataWrite, 1, 1)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferData_class,"get-dataclass" " method", (Scheme_Method_Prim *)objscheme_wxBufferData_Getdataclass, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferData_class,"set-dataclass" " method", (Scheme_Method_Prim *)objscheme_wxBufferData_Setdataclass, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBufferData_class,"get-next" " method", (Scheme_Method_Prim *)objscheme_wxBufferData_Getnext, 0, 0)); - - WITH_VAR_STACK(scheme_made_class(os_wxBufferData_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxBufferData, wxTYPE_BUFFER_DATA)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxBufferData(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxBufferData_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "editor-data% object or " XC_NULL_STR: "editor-data% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_BUFFER_DATA) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxBufferData_class)); - - obj->primdata = realobj; - WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata)); - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxBufferData(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxBufferData *)o->primdata; - else - return (wxBufferData *)o->primdata; -} - - diff --git a/src/mred/wxs/wxs_snip.h b/src/mred/wxs/wxs_snip.h deleted file mode 100644 index ae9b8f8391..0000000000 --- a/src/mred/wxs/wxs_snip.h +++ /dev/null @@ -1,296 +0,0 @@ -#ifndef WXS_SETUP_ONLY -extern Scheme_Object *objscheme_bundle_wxSnipAdmin(class wxSnipAdmin *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnipAdmin *objscheme_unbundle_wxSnipAdmin(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxCursor(class wxCursor *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnipAdmin(class wxSnipAdmin *); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern Scheme_Object *objscheme_bundle_wxSnipClass(class wxSnipClass *); -extern class wxSnipClass *objscheme_unbundle_wxSnipClass(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxSnip(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxSnip(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *realobj); -class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxSnipAdmin(class wxSnipAdmin *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern class wxSnipAdmin *objscheme_unbundle_wxSnipAdmin(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxCursor(class wxCursor *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxTextSnip(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxTextSnip(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxTextSnip(class wxTextSnip *realobj); -class wxTextSnip *objscheme_unbundle_wxTextSnip(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxSnipAdmin(class wxSnipAdmin *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern class wxSnipAdmin *objscheme_unbundle_wxSnipAdmin(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxCursor(class wxCursor *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxTabSnip(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxTabSnip(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxTabSnip(class wxTabSnip *realobj); -class wxTabSnip *objscheme_unbundle_wxTabSnip(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxImageSnip(class wxImageSnip *); -extern Scheme_Object *objscheme_bundle_wxImageSnip(class wxImageSnip *); -extern Scheme_Object *objscheme_bundle_wxSnipAdmin(class wxSnipAdmin *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern class wxImageSnip *objscheme_unbundle_wxImageSnip(Scheme_Object *, const char *, int); -extern class wxImageSnip *objscheme_unbundle_wxImageSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBitmap(class wxBitmap *); -extern Scheme_Object *objscheme_bundle_wxBitmap(class wxBitmap *); -extern class wxBitmap *objscheme_unbundle_wxBitmap(Scheme_Object *, const char *, int); -extern class wxBitmap *objscheme_unbundle_wxBitmap(Scheme_Object *, const char *, int); -extern class wxSnipAdmin *objscheme_unbundle_wxSnipAdmin(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxCursor(class wxCursor *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern int objscheme_istype_wxBitmap(Scheme_Object *, const char *, int); -extern class wxBitmap *objscheme_unbundle_wxBitmap(Scheme_Object *, const char *, int); -extern class wxBitmap *objscheme_unbundle_wxBitmap(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxImageSnip(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxImageSnip(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxImageSnip(class wxImageSnip *realobj); -class wxImageSnip *objscheme_unbundle_wxImageSnip(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxSnipAdmin(class wxSnipAdmin *); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxCursor *objscheme_unbundle_wxCursor(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxKeyEvent(class wxKeyEvent *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxMouseEvent(class wxMouseEvent *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern Scheme_Object *objscheme_bundle_wxDC(class wxDC *); -extern class wxSnipAdmin *objscheme_unbundle_wxSnipAdmin(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxCursor(class wxCursor *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxKeyEvent *objscheme_unbundle_wxKeyEvent(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMouseEvent *objscheme_unbundle_wxMouseEvent(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern class wxSnip *objscheme_unbundle_wxSnip(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern Scheme_Object *objscheme_bundle_wxSnip(class wxSnip *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxMediaBuffer(class wxMediaBuffer *); -extern class wxMediaBuffer *objscheme_unbundle_wxMediaBuffer(Scheme_Object *, const char *, int); -#endif -void objscheme_setup_wxMediaSnip(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMediaSnip(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMediaSnip(class wxMediaSnip *realobj); -class wxMediaSnip *objscheme_unbundle_wxMediaSnip(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxMediaStreamIn(class wxMediaStreamIn *); -extern class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *, const char *, int); -extern class wxMediaStreamIn *objscheme_unbundle_wxMediaStreamIn(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *); -#endif -void objscheme_setup_wxBufferDataClass(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxBufferDataClass(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxBufferDataClass(class wxBufferDataClass *realobj); -class wxBufferDataClass *objscheme_unbundle_wxBufferDataClass(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxBufferDataClass(class wxBufferDataClass *); -extern class wxBufferDataClass *objscheme_unbundle_wxBufferDataClass(Scheme_Object *, const char *, int); -extern class wxBufferDataClass *objscheme_unbundle_wxBufferDataClass(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBufferDataClass(class wxBufferDataClass *); -#endif -void objscheme_setup_wxBufferDataClassList(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxBufferDataClassList(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxBufferDataClassList(class wxBufferDataClassList *realobj); -class wxBufferDataClassList *objscheme_unbundle_wxBufferDataClassList(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxMediaStreamOut(class wxMediaStreamOut *); -extern class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *, const char *, int); -extern class wxMediaStreamOut *objscheme_unbundle_wxMediaStreamOut(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBufferDataClass(class wxBufferDataClass *); -extern class wxBufferDataClass *objscheme_unbundle_wxBufferDataClass(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *); -#endif -void objscheme_setup_wxBufferData(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxBufferData(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxBufferData(class wxBufferData *realobj); -class wxBufferData *objscheme_unbundle_wxBufferData(Scheme_Object *obj, const char *where, int nullOK); -#endif diff --git a/src/mred/wxs/wxs_snip.xc b/src/mred/wxs/wxs_snip.xc deleted file mode 100644 index b186aa3560..0000000000 --- a/src/mred/wxs/wxs_snip.xc +++ /dev/null @@ -1,312 +0,0 @@ - -@INCLUDE prefix.xci - -#include "wx_media.h" - -@INCLUDE wxs.xci - -@HEADER - -@INCLUDE wxs_cret.xci - -@BEGINSYMBOLS flags > > PRED -@SYM "can-append" : wxSNIP_CAN_APPEND -@SYM "newline" : wxSNIP_NEWLINE -@SYM "hard-newline" : wxSNIP_HARD_NEWLINE -@SYM "is-text" : wxSNIP_IS_TEXT -@SYM "invisible" : wxSNIP_INVISIBLE -@SYM "handles-events" : wxSNIP_HANDLES_EVENTS -@SYM "width-depends-on-x" : wxSNIP_WIDTH_DEPENDS_ON_X -@SYM "height-depends-on-x" : wxSNIP_HEIGHT_DEPENDS_ON_X -@SYM "width-depends-on-y" : wxSNIP_WIDTH_DEPENDS_ON_Y -@SYM "height-depends-on-y" : wxSNIP_HEIGHT_DEPENDS_ON_Y -@SYM "uses-buffer-path" : wxSNIP_USES_BUFFER_PATH -@ENDSYMBOLS - -@INCLUDE wxs_eop.xci - -@CLASSBASE wxSnip "snip":"object" / nofnl - -@CREATOR (); - -@CLASSID wxTYPE_SNIP - -@IVAR r "count" : long count -@IVAR r "flags" : SYM[flags] flags -@IVAR r "style" : wxStyle! style -@IVAR "snipclass" : wxSnipClass^ snipclass - -@ "get-admin" : wxSnipAdmin! GetAdmin(); - -@ "set-count" : void SetCount(rint[1|100000]); -@ "set-flags" : void SetFlags(SYM[flags]); - -@ "set-style" : void SetStyle(wxStyle!) - -@ "is-owned?" : bool IsOwned(); -@ "release-from-owner" : bool ReleaseFromOwner(); - -@SETMARK s = v -@INCLUDE wxs_snip.xci - -@ "next" : wxSnip^ Next(); -@ "previous" : wxSnip^ Previous(); - -@END - -@MACRO SetLength = x1 = SCHEME_CHAR_STRLEN_VAL(p[POFFSET]); - -@CLASSBASE wxTextSnip "string-snip":"snip" / nofnl - -@CREATOR (nnlong=0); <> initial size -@CREATOR (mzstring,-long); : : /SetLength <> initial string - -@CLASSID wxTYPE_TEXT_SNIP - -@SETMARK s = d -@INCLUDE wxs_snip.xci - -@ "insert" : void Insert(mzstring,nnlong,nnlong=0); -@ "read" : void Read(nnlong,wxMediaStreamIn!); - -@END - - -@CLASSBASE wxTabSnip "tab-snip":"string-snip" / nofnl - -@CREATOR (); - -@CLASSID wxTYPE_TAB_SNIP - -@SETMARK s = d -@INCLUDE wxs_snip.xci - -@END - -@MACRO CheckBW[p.who] = if (x

&& (x

->GetDepth() != 1)) WITH_VAR_STACK(scheme_arg_mismatch(, "mask bitmap is not monochrome: ", p[POFFSET+

])); -@MACRO CheckSizes[p.m.who] = if (x && ((x

->GetWidth() != x->GetWidth()) || (x

->GetHeight() != x->GetHeight()))) WITH_VAR_STACK(scheme_arg_mismatch(, "mask bitmap size does not match bitmap to draw: ", p[POFFSET+

])); - -@INCLUDE wxs_bmt.xci - -extern void wxGetARGBPixels(wxBitmap *bm, double x, double y, int w, int h, char *s, Bool get_alpha); -static bool EqualTo(wxImageSnip* bm, wxImageSnip* bm2, void *recur); - -#ifdef MZ_PRECISE_GC -END_XFORM_SKIP; -#endif -static bool OtherEqualTo(wxImageSnip* snip, wxImageSnip* snip2, void *recur) -{ - int w, h; - char *s1, *s2; - wxBitmap *bm, *bm2, *mask; - - bm = snip->GetSnipBitmap(); - bm2 = snip2->GetSnipBitmap(); - - if (!bm || !bm->Ok()) return FALSE; - if (!bm2 || !bm2->Ok()) return FALSE; - if (bm->GetDepth() != bm2->GetDepth()) return FALSE; - w = bm->GetWidth(); - h = bm->GetHeight(); - if (w != bm2->GetWidth()) return FALSE; - if (h != bm2->GetHeight()) return FALSE; - - s1 = (char *)scheme_malloc_atomic(w * h * 4); - s2 = (char *)scheme_malloc_atomic(w * h * 4); - - memset(s1, 255, w * h * 4); - memset(s2, 255, w * h * 4); - - wxGetARGBPixels(bm, 0, 0, w, h, s1, 0); - wxGetARGBPixels(bm2, 0, 0, w, h, s2, 0); - - mask = snip->GetSnipBitmapMask(); - if (mask && mask->Ok() && (mask->GetWidth() == w) && (mask->GetHeight() == h)) { - wxGetARGBPixels(mask, 0, 0, w, h, s1, 1); - } - mask = snip2->GetSnipBitmapMask(); - if (mask && mask->Ok() && (mask->GetWidth() == w) && (mask->GetHeight() == h)) { - wxGetARGBPixels(mask, 0, 0, w, h, s2, 1); - } - - return !memcmp(s1, s2, w * h * 4); -} - -static long HashCodeOf(wxImageSnip *snip, void *recur) -{ - int w, h, i; - long hk = 0; - char *s1; - wxBitmap *bm; - - bm = snip->GetSnipBitmap(); - if (!bm) return 0; - - if (!bm->Ok()) return 0; - w = bm->GetWidth(); - h = bm->GetHeight(); - - s1 = (char *)scheme_malloc_atomic(w * h * 4); - - wxGetARGBPixels(bm, 0, 0, w, h, s1, 0); - - for (i = w * h * 4; i; i -= 4) { - hk += s1[i - 4] + s1[i - 3] + s1[i - 2]; - hk = (hk << 1) + hk; - } - - return hk; -} - -static long SecondaryHashCodeOf(wxImageSnip *snip, void *recur) -{ - wxBitmap *bm; - - bm = snip->GetSnipBitmap(); - if (!bm) return 0; - - return bm->GetWidth() + bm->GetHeight(); -} -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - -#define UNKNOWN_OBJ void* -@MACRO bundleAny = ((Scheme_Object *){x}) -@MACRO unbundleAny = ((void *){x}) - -@CLASSBASE wxImageSnip "image-snip":"snip" / nofnl - -@IMPLEMENTS equal<%> - -@CREATOR (nxpathname=NULL,SYM[bitmapType]=0,bool=FALSE,bool=TRUE); : : //USEALLFUEL[x0] <> filename -@CREATOR (wxBitmap!,wxBitmap^=NULL) : : /CheckBW[1.METHODNAME("image-snip%","initialization")]|CHECKOK[0.METHODNAME("image-snip%","initialization")]|CHECKOK[1.METHODNAME("image-snip%","initialization")]|CheckSizes[0.1.METHODNAME("image-snip%","initialization")] <> bitmap - -@CLASSID wxTYPE_IMAGE_SNIP - -@SETMARK s = d -@INCLUDE wxs_snip.xci - -// This isn't `pathname' because it expands internally -@ "load-file" : void LoadFile(nxpathname,SYM[bitmapType]=0,bool=FALSE,bool=TRUE); : : //USEALLFUEL[x0] - -@ "get-filename" : npathname GetFilename(bool?=NULL); -@ "get-filetype" : SYM[bitmapType] GetFiletype(); - -@ "set-bitmap" : void SetBitmap(wxBitmap!,wxBitmap^=NULL); : : /CheckBW[1.METHODNAME("image-snip%","set-bitmap")]|CHECKOK[0.METHODNAME("image-snip%","set-bitmap")]|CHECKOK[1.METHODNAME("image-snip%","set-bitmap")]|CheckSizes[0.1.METHODNAME("image-snip%","set-bitmap")] - -@ "get-bitmap" : wxBitmap^ GetSnipBitmap(); -@ "get-bitmap-mask" : wxBitmap^ GetSnipBitmapMask(); - -@ "set-offset" : void SetOffset(double, double); - -@ M "equal-to?" : bool EqualTo(wxImageSnip^,UNKNOWN_OBJ/bundleAny/unbundleAny////push); -@ M "other-equal-to?" : bool OtherEqualTo(wxImageSnip^,UNKNOWN_OBJ/bundleAny/unbundleAny////push); -@ m "equal-hash-code-of" : long HashCodeOf(UNKNOWN_OBJ/bundleAny/unbundleAny////push); -@ m "equal-secondary-hash-code-of" : long SecondaryHashCodeOf(UNKNOWN_OBJ/bundleAny/unbundleAny////push); - -@END - -static bool EqualTo(wxImageSnip* bm, wxImageSnip* bm2, void *recur) -{ - /* Might redirect to Scheme. - We're relying on the cast succeeding because the method is - not virtual, but I doubt that this is guaranteed to work by the C++ - spec if wxImageSnip is instantiated instead of os_wxImageSnip */ - return ((os_wxImageSnip *)bm2)->OtherEqualTo_method(bm, recur); -} - -@CLASSBASE wxMediaSnip "editor-snip" : "snip" / nofnl - -@CREATOR (wxMediaBuffer^=NULL,bool=TRUE,nnint=wxMSNIPBOX_XMARGIN,nnint=wxMSNIPBOX_YMARGIN,nnint=wxMSNIPBOX_XMARGIN,nnint=wxMSNIPBOX_YMARGIN,nnint=wxMSNIPBOX_XINSET,nnint=wxMSNIPBOX_YINSET,nnint=wxMSNIPBOX_XINSET,nnint=wxMSNIPBOX_YINSET,nnfs[none]=-1,nnfs[none]=-1,nnfs[none]=-1,nnfs[none]=-1); - -@CLASSID wxTYPE_MEDIA_SNIP - -@ "get-editor" : wxMediaBuffer^ GetThisMedia(); -@ "set-editor" : void SetMedia(wxMediaBuffer^); - -@SETMARK s = d -@INCLUDE wxs_snip.xci - -@ "set-max-width" : void SetMaxWidth(nnfs[none]); -@ "set-max-height" : void SetMaxHeight(nnfs[none]); -@ "get-max-width" : nnfs[none] GetMaxWidth(); -@ "get-max-height" : nnfs[none] GetMaxHeight(); -@ "set-min-width" : void SetMinWidth(nnfs[none]); -@ "set-min-height" : void SetMinHeight(nnfs[none]); -@ "get-min-width" : nnfs[none] GetMinWidth(); -@ "get-min-height" : nnfs[none] GetMinHeight(); - -@ "get-tight-text-fit" : bool GetTightTextFit(); -@ "set-tight-text-fit" : void SetTightTextFit(bool); -@ "get-align-top-line" : bool GetAlignTopLine(); -@ "set-align-top-line" : void SetAlignTopLine(bool); - -@ "show-border" : void ShowBorder(bool); -@ "border-visible?" : bool BorderVisible(); - -@ "use-style-background" : void UseStyleBG(bool); -@ "style-background-used?" : bool StyleBGUsed(); - -@ "set-margin" : void SetMargin(nnint,nnint,nnint,nnint); -@ "get-margin" :void GetMargin(nnint*,nnint*,nnint*,nnint*); -@ "set-inset" :void SetInset(nnint,nnint,nnint,nnint); -@ "get-inset" :void GetInset(nnint*,nnint*,nnint*,nnint*); - -@END - -@MACRO rZERO = return 0; -@MACRO rNULL = return NULL; - -@CLASSBASE wxBufferDataClass "editor-data-class" : "object" - -@CREATOR () - -@CLASSID wxTYPE_BUFFER_DATA_CLASS - -@IVAR "classname" : string classname - -@ V "read" : wxBufferData^ Read(wxMediaStreamIn!); : : : : rNULL - -@END - -@CLASSBASE wxBufferDataClassList "editor-data-class-list" : "object" -@INTERFACE "editor-data-class-list" - -@CLASSID wxTYPE_BUFFER_DATA_CLASS_LIST - -@ "find" : wxBufferDataClass^ Find(string); -@ "find-position" : short FindPosition(wxBufferDataClass!); -@ "add" : void Add(wxBufferDataClass!); -@ "number" : int Number(); -@ "nth" : wxBufferDataClass^ Nth(nnint); - -@END - -static void SetNextNoCycle(wxBufferData *dest, wxBufferData *naya) -{ - wxBufferData *d; - for (d = naya; d; d = d->next) { - if (d == dest) { - /* Don't allow it because it would create a cycle. */ - return; - } - } - - dest->next = naya; -} - -@CLASSBASE wxBufferData "editor-data" : "object" - -@CREATOR () - -@CLASSID wxTYPE_BUFFER_DATA - -@IVAR "dataclass" : wxBufferDataClass^ dataclass -@IVAR r "next" : wxBufferData^ next - -@ V "write" : bool Write(wxMediaStreamOut!); : : : : rZERO -@ m "set-next" : void SetNextNoCycle(wxBufferData^) - -@END - diff --git a/src/mred/wxs/wxs_snip.xci b/src/mred/wxs/wxs_snip.xci deleted file mode 100644 index b8ef843d3a..0000000000 --- a/src/mred/wxs/wxs_snip.xci +++ /dev/null @@ -1,36 +0,0 @@ - -@MACRO makeNoCopyString[str.len] = WITH_VAR_STACK(scheme_make_sized_char_string(, , 0)) - -@MACRO gtSTRINGENOUGH[who] = if (SCHEME_CHAR_STRTAG_VAL(p[0+POFFSET]) < (x2 + x3)) WITH_VAR_STACK(scheme_arg_mismatch(, "string too short: ", p[0+POFFSET])); - -@ s "get-extent" : void GetExtent(wxDC!,double,double,nndouble?=NULL,nndouble?=NULL,nndouble?=NULL,nndouble?=NULL,nndouble?=NULL,nndouble?=NULL); : : /CHECKDCOK[0.METHODNAME("snip%","get-extent")] -@ s "partial-offset" : double PartialOffset(wxDC!,double,double,nnlong); : : /CHECKDCOK[0.METHODNAME("snip%","partial-offset")] -@ s "draw" : void Draw(wxDC!,double,double,double,double,double,double,double,double,SYM[caret]); : : /CHECKDCOK[0.METHODNAME("snip%","draw")] -@ s "split" : void Split(nnlong,wxSnip!*,wxSnip!*); -@ s "merge-with" : wxSnip^ MergeWith(wxSnip!); -@ s "get-text" : mzstring/makeNoCopyString[r._x3] GetText(nnlong,nnlong,bool=FALSE,-long*=NULL); -@ s "get-text!" : void GetTextBang(wmzstring/makeNoCopyString[x0.x2+x3],nnlong,nnlong,nnlong); : : /gtSTRINGENOUGH[METHODNAME("snip%","get-text!")] -@ s "copy" : wxSnip! Copy(); -@ s "size-cache-invalid" : void SizeCacheInvalid(); - -@ s "on-event" : void OnEvent(wxDC!,double,double,double,double,wxMouseEvent!); : : /CHECKDCOK[0.METHODNAME("snip%","on-event")] -@ s "on-char" : void OnChar(wxDC!,double,double,double,double,wxKeyEvent!); : : /CHECKDCOK[0.METHODNAME("snip%","on-char")] -@ s "adjust-cursor" : wxCursor^ AdjustCursor(wxDC!,double,double,double,double,wxMouseEvent!); : : /CHECKDCOK[0.METHODNAME("snip%","adjust-cursor")] -@ s "own-caret" : void OwnCaret(bool); -@ s "blink-caret" : void BlinkCaret(wxDC!,double,double); - -@ s "do-edit-operation" : void DoEdit(SYM[editOp],bool=TRUE,long=0); -@ s "can-do-edit-operation?" : bool CanEdit(SYM[editOp],bool=TRUE); -@ s "match?" : bool Match(wxSnip!); - -@ s "write" : void Write(wxMediaStreamOut!); - -@ s "resize" : bool Resize(nndouble, nndouble); - -@ s "set-admin" : void SetAdmin(wxSnipAdmin^); - -@ s "get-num-scroll-steps" : nnlong GetNumScrollSteps() -@ s "find-scroll-step" : nnlong FindScrollStep(double) -@ s "get-scroll-step-offset" : nndouble GetScrollStepOffset(nnlong) - -@ s "set-unmodified" : void SetUnmodified() diff --git a/src/mred/wxs/wxs_styl.cxx b/src/mred/wxs/wxs_styl.cxx deleted file mode 100644 index 48a628d13b..0000000000 --- a/src/mred/wxs/wxs_styl.cxx +++ /dev/null @@ -1,3832 +0,0 @@ -/* DO NOT EDIT THIS FILE. */ -/* This file was generated by xctocc from "wxs_styl.xc". */ - - -#if defined(_MSC_VER) -# include "wx.h" -#endif -#if defined(OS_X) -# include "common.h" -#endif - -#include "wx_style.h" -#include "wx_mtype.h" - - - - -#ifdef wx_x -# define BM_SELECTED(map) ((map)->selectedTo) -#endif -#if defined(wx_mac) || defined(wx_msw) -# define BM_SELECTED(map) ((map)->selectedInto) -#endif -# define BM_IN_USE(map) ((map)->selectedIntoDC) - - - - -#define ESCAPE_NO_RET_VAL /*empty*/ - - -#include "wxscheme.h" -#include "wxs_styl.h" - -#ifdef MZ_PRECISE_GC -START_XFORM_SKIP; -#endif - - - - -class os_wxMultColour : public wxMultColour { - public: - - ~os_wxMultColour(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxMultColour::gcMark() { - wxMultColour::gcMark(); -} -void os_wxMultColour::gcFixup() { - wxMultColour::gcFixup(); -} -#endif - -static Scheme_Object *os_wxMultColour_class; -static Scheme_Object *os_wxMultColour_interface; - -os_wxMultColour::~os_wxMultColour() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxMultColourSet(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMultColour_class, "set in mult-color<%>", n, p); - double x0; - double x1; - double x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "set in mult-color<%>")); - x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set in mult-color<%>")); - x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "set in mult-color<%>")); - - - WITH_VAR_STACK(((wxMultColour *)((Scheme_Class_Object *)p[0])->primdata)->Set(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxMultColourGet(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxMultColour_class, "get in mult-color<%>", n, p); - double _x0; - double* x0 = &_x0; - double _x1; - double* x1 = &_x1; - double _x2; - double* x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get in mult-color<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get in mult-color<%>"", extracting boxed argument"))); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get in mult-color<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get in mult-color<%>"", extracting boxed argument"))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "get in mult-color<%>")), WITH_VAR_STACK(objscheme_unbundle_double(sbox_tmp, "get in mult-color<%>"", extracting boxed argument"))); - - - WITH_VAR_STACK(((wxMultColour *)((Scheme_Class_Object *)p[0])->primdata)->Get(x0, x1, x2)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x0)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x1)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = WITH_VAR_STACK(scheme_make_double(_x2)); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxMultColour_Getr(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - double v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxMultColour_class, "get-r in mult-color%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-r in mult-color%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxMultColour *)cobj->primdata)->wxMultColour::r; - else - v = ((wxMultColour *)cobj->primdata)->r; - - return WITH_REMEMBERED_STACK(scheme_make_double(v)); -} - -static Scheme_Object *objscheme_wxMultColour_Setr(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - double v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxMultColour_class, "set-r in mult-color%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-r in mult-color%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET], "set-r in mult-color%")); - ((wxMultColour *)cobj->primdata)->r = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxMultColour_Getg(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - double v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxMultColour_class, "get-g in mult-color%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-g in mult-color%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxMultColour *)cobj->primdata)->wxMultColour::g; - else - v = ((wxMultColour *)cobj->primdata)->g; - - return WITH_REMEMBERED_STACK(scheme_make_double(v)); -} - -static Scheme_Object *objscheme_wxMultColour_Setg(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - double v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxMultColour_class, "set-g in mult-color%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-g in mult-color%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET], "set-g in mult-color%")); - ((wxMultColour *)cobj->primdata)->g = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxMultColour_Getb(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - double v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxMultColour_class, "get-b in mult-color%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-b in mult-color%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxMultColour *)cobj->primdata)->wxMultColour::b; - else - v = ((wxMultColour *)cobj->primdata)->b; - - return WITH_REMEMBERED_STACK(scheme_make_double(v)); -} - -static Scheme_Object *objscheme_wxMultColour_Setb(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - double v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxMultColour_class, "set-b in mult-color%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-b in mult-color%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET], "set-b in mult-color%")); - ((wxMultColour *)cobj->primdata)->b = v; - - READY_TO_RETURN; - return scheme_void; -} - -void objscheme_setup_wxMultColour(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxMultColour_class); - wxREGGLOB(os_wxMultColour_interface); - - os_wxMultColour_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "mult-color%", "object%", NULL, 8)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMultColour_class, "set" " method", (Scheme_Method_Prim *)os_wxMultColourSet, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMultColour_class, "get" " method", (Scheme_Method_Prim *)os_wxMultColourGet, 3, 3)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMultColour_class,"get-r" " method", (Scheme_Method_Prim *)objscheme_wxMultColour_Getr, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMultColour_class,"set-r" " method", (Scheme_Method_Prim *)objscheme_wxMultColour_Setr, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMultColour_class,"get-g" " method", (Scheme_Method_Prim *)objscheme_wxMultColour_Getg, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMultColour_class,"set-g" " method", (Scheme_Method_Prim *)objscheme_wxMultColour_Setg, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMultColour_class,"get-b" " method", (Scheme_Method_Prim *)objscheme_wxMultColour_Getb, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMultColour_class,"set-b" " method", (Scheme_Method_Prim *)objscheme_wxMultColour_Setb, 1, 1)); - - WITH_VAR_STACK(scheme_made_class(os_wxMultColour_class)); - - os_wxMultColour_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxMultColour_class, "mult-color" "<%>")); - - WITH_VAR_STACK(objscheme_add_global_interface(os_wxMultColour_interface, "mult-color" "<%>", env)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxMultColour(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxMultColour_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "mult-color% object or " XC_NULL_STR: "mult-color% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxMultColour(class wxMultColour *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMultColour_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxMultColour *objscheme_unbundle_wxMultColour(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxMultColour(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxMultColour *)o->primdata; - else - return (wxMultColour *)o->primdata; -} - - - - -// short* should really be rshort[-1000|1000]*: - -class os_wxAddColour : public wxAddColour { - public: - - ~os_wxAddColour(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxAddColour::gcMark() { - wxAddColour::gcMark(); -} -void os_wxAddColour::gcFixup() { - wxAddColour::gcFixup(); -} -#endif - -static Scheme_Object *os_wxAddColour_class; -static Scheme_Object *os_wxAddColour_interface; - -os_wxAddColour::~os_wxAddColour() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxAddColourSet(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxAddColour_class, "set in add-color<%>", n, p); - int x0; - int x1; - int x2; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+0], -1000, 1000, "set in add-color<%>")); - x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+1], -1000, 1000, "set in add-color<%>")); - x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+2], -1000, 1000, "set in add-color<%>")); - - - WITH_VAR_STACK(((wxAddColour *)((Scheme_Class_Object *)p[0])->primdata)->Set(x0, x1, x2)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxAddColourGet(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxAddColour_class, "get in add-color<%>", n, p); - short _x0; - short* x0 = &_x0; - short _x1; - short* x1 = &_x1; - short _x2; - short* x2 = &_x2; - Scheme_Object *sbox_tmp; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - *x0 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+0], "get in add-color<%>")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "get in add-color<%>"", extracting boxed argument"))); - *x1 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+1], "get in add-color<%>")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "get in add-color<%>"", extracting boxed argument"))); - *x2 = (sbox_tmp = WITH_VAR_STACK(objscheme_unbox(p[POFFSET+2], "get in add-color<%>")), WITH_VAR_STACK(objscheme_unbundle_integer(sbox_tmp, "get in add-color<%>"", extracting boxed argument"))); - - - WITH_VAR_STACK(((wxAddColour *)((Scheme_Class_Object *)p[0])->primdata)->Get(x0, x1, x2)); - - - if (n > (POFFSET+0)) - { Scheme_Object *sbv_ = scheme_make_integer(_x0); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+0], sbv_)); } - if (n > (POFFSET+1)) - { Scheme_Object *sbv_ = scheme_make_integer(_x1); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+1], sbv_)); } - if (n > (POFFSET+2)) - { Scheme_Object *sbv_ = scheme_make_integer(_x2); WITH_VAR_STACK(objscheme_set_box(p[POFFSET+2], sbv_)); } - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxAddColour_Getr(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxAddColour_class, "get-r in add-color%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-r in add-color%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxAddColour *)cobj->primdata)->wxAddColour::r; - else - v = ((wxAddColour *)cobj->primdata)->r; - - return scheme_make_integer(v); -} - -static Scheme_Object *objscheme_wxAddColour_Setr(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxAddColour_class, "set-r in add-color%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-r in add-color%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], -1000, 1000, "set-r in add-color%")); - ((wxAddColour *)cobj->primdata)->r = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxAddColour_Getg(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxAddColour_class, "get-g in add-color%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-g in add-color%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxAddColour *)cobj->primdata)->wxAddColour::g; - else - v = ((wxAddColour *)cobj->primdata)->g; - - return scheme_make_integer(v); -} - -static Scheme_Object *objscheme_wxAddColour_Setg(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxAddColour_class, "set-g in add-color%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-g in add-color%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], -1000, 1000, "set-g in add-color%")); - ((wxAddColour *)cobj->primdata)->g = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxAddColour_Getb(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxAddColour_class, "get-b in add-color%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-b in add-color%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxAddColour *)cobj->primdata)->wxAddColour::b; - else - v = ((wxAddColour *)cobj->primdata)->b; - - return scheme_make_integer(v); -} - -static Scheme_Object *objscheme_wxAddColour_Setb(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxAddColour_class, "set-b in add-color%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-b in add-color%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], -1000, 1000, "set-b in add-color%")); - ((wxAddColour *)cobj->primdata)->b = v; - - READY_TO_RETURN; - return scheme_void; -} - -void objscheme_setup_wxAddColour(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxAddColour_class); - wxREGGLOB(os_wxAddColour_interface); - - os_wxAddColour_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "add-color%", "object%", NULL, 8)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxAddColour_class, "set" " method", (Scheme_Method_Prim *)os_wxAddColourSet, 3, 3)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxAddColour_class, "get" " method", (Scheme_Method_Prim *)os_wxAddColourGet, 3, 3)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxAddColour_class,"get-r" " method", (Scheme_Method_Prim *)objscheme_wxAddColour_Getr, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxAddColour_class,"set-r" " method", (Scheme_Method_Prim *)objscheme_wxAddColour_Setr, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxAddColour_class,"get-g" " method", (Scheme_Method_Prim *)objscheme_wxAddColour_Getg, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxAddColour_class,"set-g" " method", (Scheme_Method_Prim *)objscheme_wxAddColour_Setg, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxAddColour_class,"get-b" " method", (Scheme_Method_Prim *)objscheme_wxAddColour_Getb, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxAddColour_class,"set-b" " method", (Scheme_Method_Prim *)objscheme_wxAddColour_Setb, 1, 1)); - - WITH_VAR_STACK(scheme_made_class(os_wxAddColour_class)); - - os_wxAddColour_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxAddColour_class, "add-color" "<%>")); - - WITH_VAR_STACK(objscheme_add_global_interface(os_wxAddColour_interface, "add-color" "<%>", env)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxAddColour(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxAddColour_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "add-color% object or " XC_NULL_STR: "add-color% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxAddColour(class wxAddColour *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxAddColour_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxAddColour *objscheme_unbundle_wxAddColour(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxAddColour(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxAddColour *)o->primdata; - else - return (wxAddColour *)o->primdata; -} - - -static Scheme_Object *family_wxBASE_sym = NULL; -static Scheme_Object *family_wxDEFAULT_sym = NULL; -static Scheme_Object *family_wxDECORATIVE_sym = NULL; -static Scheme_Object *family_wxROMAN_sym = NULL; -static Scheme_Object *family_wxSCRIPT_sym = NULL; -static Scheme_Object *family_wxSWISS_sym = NULL; -static Scheme_Object *family_wxMODERN_sym = NULL; -static Scheme_Object *family_wxSYSTEM_sym = NULL; -static Scheme_Object *family_wxSYMBOL_sym = NULL; - -static void init_symset_family(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(family_wxBASE_sym); - family_wxBASE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("base")); - wxREGGLOB(family_wxDEFAULT_sym); - family_wxDEFAULT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("default")); - wxREGGLOB(family_wxDECORATIVE_sym); - family_wxDECORATIVE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("decorative")); - wxREGGLOB(family_wxROMAN_sym); - family_wxROMAN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("roman")); - wxREGGLOB(family_wxSCRIPT_sym); - family_wxSCRIPT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("script")); - wxREGGLOB(family_wxSWISS_sym); - family_wxSWISS_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("swiss")); - wxREGGLOB(family_wxMODERN_sym); - family_wxMODERN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("modern")); - wxREGGLOB(family_wxSYSTEM_sym); - family_wxSYSTEM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("system")); - wxREGGLOB(family_wxSYMBOL_sym); - family_wxSYMBOL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("symbol")); -} - -static int unbundle_symset_family(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!family_wxSYMBOL_sym) WITH_VAR_STACK(init_symset_family()); - if (0) { } - else if (v == family_wxBASE_sym) { READY_TO_RETURN; return wxBASE; } - else if (v == family_wxDEFAULT_sym) { READY_TO_RETURN; return wxDEFAULT; } - else if (v == family_wxDECORATIVE_sym) { READY_TO_RETURN; return wxDECORATIVE; } - else if (v == family_wxROMAN_sym) { READY_TO_RETURN; return wxROMAN; } - else if (v == family_wxSCRIPT_sym) { READY_TO_RETURN; return wxSCRIPT; } - else if (v == family_wxSWISS_sym) { READY_TO_RETURN; return wxSWISS; } - else if (v == family_wxMODERN_sym) { READY_TO_RETURN; return wxMODERN; } - else if (v == family_wxSYSTEM_sym) { READY_TO_RETURN; return wxSYSTEM; } - else if (v == family_wxSYMBOL_sym) { READY_TO_RETURN; return wxSYMBOL; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "family symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_family(int v) { - if (!family_wxSYMBOL_sym) init_symset_family(); - switch (v) { - case wxBASE: return family_wxBASE_sym; - case wxDEFAULT: return family_wxDEFAULT_sym; - case wxDECORATIVE: return family_wxDECORATIVE_sym; - case wxROMAN: return family_wxROMAN_sym; - case wxSCRIPT: return family_wxSCRIPT_sym; - case wxSWISS: return family_wxSWISS_sym; - case wxMODERN: return family_wxMODERN_sym; - case wxSYSTEM: return family_wxSYSTEM_sym; - case wxSYMBOL: return family_wxSYMBOL_sym; - default: return NULL; - } -} - - -static Scheme_Object *weight_wxBASE_sym = NULL; -static Scheme_Object *weight_wxNORMAL_sym = NULL; -static Scheme_Object *weight_wxLIGHT_sym = NULL; -static Scheme_Object *weight_wxBOLD_sym = NULL; - -static void init_symset_weight(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(weight_wxBASE_sym); - weight_wxBASE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("base")); - wxREGGLOB(weight_wxNORMAL_sym); - weight_wxNORMAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("normal")); - wxREGGLOB(weight_wxLIGHT_sym); - weight_wxLIGHT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("light")); - wxREGGLOB(weight_wxBOLD_sym); - weight_wxBOLD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bold")); -} - -static int unbundle_symset_weight(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!weight_wxBOLD_sym) WITH_VAR_STACK(init_symset_weight()); - if (0) { } - else if (v == weight_wxBASE_sym) { READY_TO_RETURN; return wxBASE; } - else if (v == weight_wxNORMAL_sym) { READY_TO_RETURN; return wxNORMAL; } - else if (v == weight_wxLIGHT_sym) { READY_TO_RETURN; return wxLIGHT; } - else if (v == weight_wxBOLD_sym) { READY_TO_RETURN; return wxBOLD; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "weight symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_weight(int v) { - if (!weight_wxBOLD_sym) init_symset_weight(); - switch (v) { - case wxBASE: return weight_wxBASE_sym; - case wxNORMAL: return weight_wxNORMAL_sym; - case wxLIGHT: return weight_wxLIGHT_sym; - case wxBOLD: return weight_wxBOLD_sym; - default: return NULL; - } -} - - -static Scheme_Object *style_wxBASE_sym = NULL; -static Scheme_Object *style_wxNORMAL_sym = NULL; -static Scheme_Object *style_wxITALIC_sym = NULL; -static Scheme_Object *style_wxSLANT_sym = NULL; - -static void init_symset_style(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(style_wxBASE_sym); - style_wxBASE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("base")); - wxREGGLOB(style_wxNORMAL_sym); - style_wxNORMAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("normal")); - wxREGGLOB(style_wxITALIC_sym); - style_wxITALIC_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("italic")); - wxREGGLOB(style_wxSLANT_sym); - style_wxSLANT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("slant")); -} - -static int unbundle_symset_style(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!style_wxSLANT_sym) WITH_VAR_STACK(init_symset_style()); - if (0) { } - else if (v == style_wxBASE_sym) { READY_TO_RETURN; return wxBASE; } - else if (v == style_wxNORMAL_sym) { READY_TO_RETURN; return wxNORMAL; } - else if (v == style_wxITALIC_sym) { READY_TO_RETURN; return wxITALIC; } - else if (v == style_wxSLANT_sym) { READY_TO_RETURN; return wxSLANT; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "style symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_style(int v) { - if (!style_wxSLANT_sym) init_symset_style(); - switch (v) { - case wxBASE: return style_wxBASE_sym; - case wxNORMAL: return style_wxNORMAL_sym; - case wxITALIC: return style_wxITALIC_sym; - case wxSLANT: return style_wxSLANT_sym; - default: return NULL; - } -} - - -static Scheme_Object *smoothing_wxBASE_sym = NULL; -static Scheme_Object *smoothing_wxSMOOTHING_DEFAULT_sym = NULL; -static Scheme_Object *smoothing_wxSMOOTHING_PARTIAL_sym = NULL; -static Scheme_Object *smoothing_wxSMOOTHING_ON_sym = NULL; -static Scheme_Object *smoothing_wxSMOOTHING_OFF_sym = NULL; - -static void init_symset_smoothing(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(smoothing_wxBASE_sym); - smoothing_wxBASE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("base")); - wxREGGLOB(smoothing_wxSMOOTHING_DEFAULT_sym); - smoothing_wxSMOOTHING_DEFAULT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("default")); - wxREGGLOB(smoothing_wxSMOOTHING_PARTIAL_sym); - smoothing_wxSMOOTHING_PARTIAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("partly-smoothed")); - wxREGGLOB(smoothing_wxSMOOTHING_ON_sym); - smoothing_wxSMOOTHING_ON_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("smoothed")); - wxREGGLOB(smoothing_wxSMOOTHING_OFF_sym); - smoothing_wxSMOOTHING_OFF_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unsmoothed")); -} - -static int unbundle_symset_smoothing(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!smoothing_wxSMOOTHING_OFF_sym) WITH_VAR_STACK(init_symset_smoothing()); - if (0) { } - else if (v == smoothing_wxBASE_sym) { READY_TO_RETURN; return wxBASE; } - else if (v == smoothing_wxSMOOTHING_DEFAULT_sym) { READY_TO_RETURN; return wxSMOOTHING_DEFAULT; } - else if (v == smoothing_wxSMOOTHING_PARTIAL_sym) { READY_TO_RETURN; return wxSMOOTHING_PARTIAL; } - else if (v == smoothing_wxSMOOTHING_ON_sym) { READY_TO_RETURN; return wxSMOOTHING_ON; } - else if (v == smoothing_wxSMOOTHING_OFF_sym) { READY_TO_RETURN; return wxSMOOTHING_OFF; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "smoothing symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_smoothing(int v) { - if (!smoothing_wxSMOOTHING_OFF_sym) init_symset_smoothing(); - switch (v) { - case wxBASE: return smoothing_wxBASE_sym; - case wxSMOOTHING_DEFAULT: return smoothing_wxSMOOTHING_DEFAULT_sym; - case wxSMOOTHING_PARTIAL: return smoothing_wxSMOOTHING_PARTIAL_sym; - case wxSMOOTHING_ON: return smoothing_wxSMOOTHING_ON_sym; - case wxSMOOTHING_OFF: return smoothing_wxSMOOTHING_OFF_sym; - default: return NULL; - } -} - - -static Scheme_Object *align_wxBASE_sym = NULL; -static Scheme_Object *align_wxALIGN_TOP_sym = NULL; -static Scheme_Object *align_wxALIGN_BOTTOM_sym = NULL; -static Scheme_Object *align_wxALIGN_CENTER_sym = NULL; - -static void init_symset_align(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(align_wxBASE_sym); - align_wxBASE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("base")); - wxREGGLOB(align_wxALIGN_TOP_sym); - align_wxALIGN_TOP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("top")); - wxREGGLOB(align_wxALIGN_BOTTOM_sym); - align_wxALIGN_BOTTOM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bottom")); - wxREGGLOB(align_wxALIGN_CENTER_sym); - align_wxALIGN_CENTER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("center")); -} - -static int unbundle_symset_align(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!align_wxALIGN_CENTER_sym) WITH_VAR_STACK(init_symset_align()); - if (0) { } - else if (v == align_wxBASE_sym) { READY_TO_RETURN; return wxBASE; } - else if (v == align_wxALIGN_TOP_sym) { READY_TO_RETURN; return wxALIGN_TOP; } - else if (v == align_wxALIGN_BOTTOM_sym) { READY_TO_RETURN; return wxALIGN_BOTTOM; } - else if (v == align_wxALIGN_CENTER_sym) { READY_TO_RETURN; return wxALIGN_CENTER; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "align symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *bundle_symset_align(int v) { - if (!align_wxALIGN_CENTER_sym) init_symset_align(); - switch (v) { - case wxBASE: return align_wxBASE_sym; - case wxALIGN_TOP: return align_wxALIGN_TOP_sym; - case wxALIGN_BOTTOM: return align_wxALIGN_BOTTOM_sym; - case wxALIGN_CENTER: return align_wxALIGN_CENTER_sym; - default: return NULL; - } -} - - -static Scheme_Object *changeNoArg_wxCHANGE_NOTHING_sym = NULL; -static Scheme_Object *changeNoArg_wxCHANGE_NORMAL_sym = NULL; -static Scheme_Object *changeNoArg_wxCHANGE_BOLD_sym = NULL; -static Scheme_Object *changeNoArg_wxCHANGE_ITALIC_sym = NULL; -static Scheme_Object *changeNoArg_wxCHANGE_TOGGLE_UNDERLINE_sym = NULL; -static Scheme_Object *changeNoArg_wxCHANGE_TOGGLE_SIP_sym = NULL; -static Scheme_Object *changeNoArg_wxCHANGE_NORMAL_COLOUR_sym = NULL; - -static void init_symset_changeNoArg(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeNoArg_wxCHANGE_NOTHING_sym); - changeNoArg_wxCHANGE_NOTHING_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-nothing")); - wxREGGLOB(changeNoArg_wxCHANGE_NORMAL_sym); - changeNoArg_wxCHANGE_NORMAL_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-normal")); - wxREGGLOB(changeNoArg_wxCHANGE_BOLD_sym); - changeNoArg_wxCHANGE_BOLD_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-bold")); - wxREGGLOB(changeNoArg_wxCHANGE_ITALIC_sym); - changeNoArg_wxCHANGE_ITALIC_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-italic")); - wxREGGLOB(changeNoArg_wxCHANGE_TOGGLE_UNDERLINE_sym); - changeNoArg_wxCHANGE_TOGGLE_UNDERLINE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-toggle-underline")); - wxREGGLOB(changeNoArg_wxCHANGE_TOGGLE_SIP_sym); - changeNoArg_wxCHANGE_TOGGLE_SIP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-toggle-size-in-pixels")); - wxREGGLOB(changeNoArg_wxCHANGE_NORMAL_COLOUR_sym); - changeNoArg_wxCHANGE_NORMAL_COLOUR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-normal-color")); -} - -static int unbundle_symset_changeNoArg(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeNoArg_wxCHANGE_NORMAL_COLOUR_sym) WITH_VAR_STACK(init_symset_changeNoArg()); - if (0) { } - else if (v == changeNoArg_wxCHANGE_NOTHING_sym) { READY_TO_RETURN; return wxCHANGE_NOTHING; } - else if (v == changeNoArg_wxCHANGE_NORMAL_sym) { READY_TO_RETURN; return wxCHANGE_NORMAL; } - else if (v == changeNoArg_wxCHANGE_BOLD_sym) { READY_TO_RETURN; return wxCHANGE_BOLD; } - else if (v == changeNoArg_wxCHANGE_ITALIC_sym) { READY_TO_RETURN; return wxCHANGE_ITALIC; } - else if (v == changeNoArg_wxCHANGE_TOGGLE_UNDERLINE_sym) { READY_TO_RETURN; return wxCHANGE_TOGGLE_UNDERLINE; } - else if (v == changeNoArg_wxCHANGE_TOGGLE_SIP_sym) { READY_TO_RETURN; return wxCHANGE_TOGGLE_SIP; } - else if (v == changeNoArg_wxCHANGE_NORMAL_COLOUR_sym) { READY_TO_RETURN; return wxCHANGE_NORMAL_COLOUR; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeNoArg symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *changeFam_wxCHANGE_FAMILY_sym = NULL; - -static void init_symset_changeFam(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeFam_wxCHANGE_FAMILY_sym); - changeFam_wxCHANGE_FAMILY_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-family")); -} - -static int unbundle_symset_changeFam(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeFam_wxCHANGE_FAMILY_sym) WITH_VAR_STACK(init_symset_changeFam()); - if (0) { } - else if (v == changeFam_wxCHANGE_FAMILY_sym) { READY_TO_RETURN; return wxCHANGE_FAMILY; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeFam symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static int istype_symset_changeFam(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeFam_wxCHANGE_FAMILY_sym) WITH_VAR_STACK(init_symset_changeFam()); - if (0) { } - else if (v == changeFam_wxCHANGE_FAMILY_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeFam symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *changeStyle_wxCHANGE_STYLE_sym = NULL; -static Scheme_Object *changeStyle_wxCHANGE_TOGGLE_STYLE_sym = NULL; - -static void init_symset_changeStyle(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeStyle_wxCHANGE_STYLE_sym); - changeStyle_wxCHANGE_STYLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-style")); - wxREGGLOB(changeStyle_wxCHANGE_TOGGLE_STYLE_sym); - changeStyle_wxCHANGE_TOGGLE_STYLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-toggle-style")); -} - -static int unbundle_symset_changeStyle(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeStyle_wxCHANGE_TOGGLE_STYLE_sym) WITH_VAR_STACK(init_symset_changeStyle()); - if (0) { } - else if (v == changeStyle_wxCHANGE_STYLE_sym) { READY_TO_RETURN; return wxCHANGE_STYLE; } - else if (v == changeStyle_wxCHANGE_TOGGLE_STYLE_sym) { READY_TO_RETURN; return wxCHANGE_TOGGLE_STYLE; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeStyle symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static int istype_symset_changeStyle(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeStyle_wxCHANGE_TOGGLE_STYLE_sym) WITH_VAR_STACK(init_symset_changeStyle()); - if (0) { } - else if (v == changeStyle_wxCHANGE_STYLE_sym) { READY_TO_RETURN; return 1; } - else if (v == changeStyle_wxCHANGE_TOGGLE_STYLE_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeStyle symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *changeWeight_wxCHANGE_WEIGHT_sym = NULL; -static Scheme_Object *changeWeight_wxCHANGE_TOGGLE_WEIGHT_sym = NULL; - -static void init_symset_changeWeight(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeWeight_wxCHANGE_WEIGHT_sym); - changeWeight_wxCHANGE_WEIGHT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-weight")); - wxREGGLOB(changeWeight_wxCHANGE_TOGGLE_WEIGHT_sym); - changeWeight_wxCHANGE_TOGGLE_WEIGHT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-toggle-weight")); -} - -static int unbundle_symset_changeWeight(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeWeight_wxCHANGE_TOGGLE_WEIGHT_sym) WITH_VAR_STACK(init_symset_changeWeight()); - if (0) { } - else if (v == changeWeight_wxCHANGE_WEIGHT_sym) { READY_TO_RETURN; return wxCHANGE_WEIGHT; } - else if (v == changeWeight_wxCHANGE_TOGGLE_WEIGHT_sym) { READY_TO_RETURN; return wxCHANGE_TOGGLE_WEIGHT; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeWeight symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static int istype_symset_changeWeight(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeWeight_wxCHANGE_TOGGLE_WEIGHT_sym) WITH_VAR_STACK(init_symset_changeWeight()); - if (0) { } - else if (v == changeWeight_wxCHANGE_WEIGHT_sym) { READY_TO_RETURN; return 1; } - else if (v == changeWeight_wxCHANGE_TOGGLE_WEIGHT_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeWeight symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *changeSmoothing_wxCHANGE_SMOOTHING_sym = NULL; -static Scheme_Object *changeSmoothing_wxCHANGE_TOGGLE_SMOOTHING_sym = NULL; - -static void init_symset_changeSmoothing(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeSmoothing_wxCHANGE_SMOOTHING_sym); - changeSmoothing_wxCHANGE_SMOOTHING_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-smoothing")); - wxREGGLOB(changeSmoothing_wxCHANGE_TOGGLE_SMOOTHING_sym); - changeSmoothing_wxCHANGE_TOGGLE_SMOOTHING_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-toggle-smoothing")); -} - -static int unbundle_symset_changeSmoothing(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeSmoothing_wxCHANGE_TOGGLE_SMOOTHING_sym) WITH_VAR_STACK(init_symset_changeSmoothing()); - if (0) { } - else if (v == changeSmoothing_wxCHANGE_SMOOTHING_sym) { READY_TO_RETURN; return wxCHANGE_SMOOTHING; } - else if (v == changeSmoothing_wxCHANGE_TOGGLE_SMOOTHING_sym) { READY_TO_RETURN; return wxCHANGE_TOGGLE_SMOOTHING; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeSmoothing symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static int istype_symset_changeSmoothing(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeSmoothing_wxCHANGE_TOGGLE_SMOOTHING_sym) WITH_VAR_STACK(init_symset_changeSmoothing()); - if (0) { } - else if (v == changeSmoothing_wxCHANGE_SMOOTHING_sym) { READY_TO_RETURN; return 1; } - else if (v == changeSmoothing_wxCHANGE_TOGGLE_SMOOTHING_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeSmoothing symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *changeUnderline_wxCHANGE_UNDERLINE_sym = NULL; - -static void init_symset_changeUnderline(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeUnderline_wxCHANGE_UNDERLINE_sym); - changeUnderline_wxCHANGE_UNDERLINE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-underline")); -} - -static int unbundle_symset_changeUnderline(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeUnderline_wxCHANGE_UNDERLINE_sym) WITH_VAR_STACK(init_symset_changeUnderline()); - if (0) { } - else if (v == changeUnderline_wxCHANGE_UNDERLINE_sym) { READY_TO_RETURN; return wxCHANGE_UNDERLINE; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeUnderline symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static int istype_symset_changeUnderline(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeUnderline_wxCHANGE_UNDERLINE_sym) WITH_VAR_STACK(init_symset_changeUnderline()); - if (0) { } - else if (v == changeUnderline_wxCHANGE_UNDERLINE_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeUnderline symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *changeSizeInPixels_wxCHANGE_SIP_sym = NULL; - -static void init_symset_changeSizeInPixels(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeSizeInPixels_wxCHANGE_SIP_sym); - changeSizeInPixels_wxCHANGE_SIP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-size-in-pixels")); -} - -static int unbundle_symset_changeSizeInPixels(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeSizeInPixels_wxCHANGE_SIP_sym) WITH_VAR_STACK(init_symset_changeSizeInPixels()); - if (0) { } - else if (v == changeSizeInPixels_wxCHANGE_SIP_sym) { READY_TO_RETURN; return wxCHANGE_SIP; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeSizeInPixels symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static int istype_symset_changeSizeInPixels(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeSizeInPixels_wxCHANGE_SIP_sym) WITH_VAR_STACK(init_symset_changeSizeInPixels()); - if (0) { } - else if (v == changeSizeInPixels_wxCHANGE_SIP_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeSizeInPixels symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *changeSize_wxCHANGE_SIZE_sym = NULL; -static Scheme_Object *changeSize_wxCHANGE_BIGGER_sym = NULL; -static Scheme_Object *changeSize_wxCHANGE_SMALLER_sym = NULL; - -static void init_symset_changeSize(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeSize_wxCHANGE_SIZE_sym); - changeSize_wxCHANGE_SIZE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-size")); - wxREGGLOB(changeSize_wxCHANGE_BIGGER_sym); - changeSize_wxCHANGE_BIGGER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-bigger")); - wxREGGLOB(changeSize_wxCHANGE_SMALLER_sym); - changeSize_wxCHANGE_SMALLER_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-smaller")); -} - -static int unbundle_symset_changeSize(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeSize_wxCHANGE_SMALLER_sym) WITH_VAR_STACK(init_symset_changeSize()); - if (0) { } - else if (v == changeSize_wxCHANGE_SIZE_sym) { READY_TO_RETURN; return wxCHANGE_SIZE; } - else if (v == changeSize_wxCHANGE_BIGGER_sym) { READY_TO_RETURN; return wxCHANGE_BIGGER; } - else if (v == changeSize_wxCHANGE_SMALLER_sym) { READY_TO_RETURN; return wxCHANGE_SMALLER; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeSize symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static int istype_symset_changeSize(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeSize_wxCHANGE_SMALLER_sym) WITH_VAR_STACK(init_symset_changeSize()); - if (0) { } - else if (v == changeSize_wxCHANGE_SIZE_sym) { READY_TO_RETURN; return 1; } - else if (v == changeSize_wxCHANGE_BIGGER_sym) { READY_TO_RETURN; return 1; } - else if (v == changeSize_wxCHANGE_SMALLER_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeSize symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static Scheme_Object *changeAlign_wxCHANGE_ALIGNMENT_sym = NULL; - -static void init_symset_changeAlign(void) { - REMEMBER_VAR_STACK(); - wxREGGLOB(changeAlign_wxCHANGE_ALIGNMENT_sym); - changeAlign_wxCHANGE_ALIGNMENT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("change-alignment")); -} - -static int unbundle_symset_changeAlign(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeAlign_wxCHANGE_ALIGNMENT_sym) WITH_VAR_STACK(init_symset_changeAlign()); - if (0) { } - else if (v == changeAlign_wxCHANGE_ALIGNMENT_sym) { READY_TO_RETURN; return wxCHANGE_ALIGNMENT; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeAlign symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - -static int istype_symset_changeAlign(Scheme_Object *v, const char *where) { - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, v); - if (!changeAlign_wxCHANGE_ALIGNMENT_sym) WITH_VAR_STACK(init_symset_changeAlign()); - if (0) { } - else if (v == changeAlign_wxCHANGE_ALIGNMENT_sym) { READY_TO_RETURN; return 1; } - if (where) WITH_VAR_STACK(scheme_wrong_type(where, "changeAlign symbol", -1, 0, &v)); - READY_TO_RETURN; - return 0; -} - - - - - - - - - - -class os_wxStyleDelta : public wxStyleDelta { - public: - - os_wxStyleDelta CONSTRUCTOR_ARGS((int x0 = wxCHANGE_NOTHING, int x1 = 0)); - ~os_wxStyleDelta(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxStyleDelta::gcMark() { - wxStyleDelta::gcMark(); -} -void os_wxStyleDelta::gcFixup() { - wxStyleDelta::gcFixup(); -} -#endif - -static Scheme_Object *os_wxStyleDelta_class; - -os_wxStyleDelta::os_wxStyleDelta CONSTRUCTOR_ARGS((int x0, int x1)) -CONSTRUCTOR_INIT(: wxStyleDelta(x0, x1)) -{ -} - -os_wxStyleDelta::~os_wxStyleDelta() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxStyleDeltaCopy(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxStyleDelta_class, "copy in style-delta%", n, p); - class wxStyleDelta* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "copy in style-delta%", 0)); - - - WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->Copy(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxStyleDeltaCollapse(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxStyleDelta_class, "collapse in style-delta%", n, p); - class wxStyleDelta* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "collapse in style-delta%", 0)); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->Collapse(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxStyleDeltaEqual(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxStyleDelta_class, "equal? in style-delta%", n, p); - class wxStyleDelta* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "equal? in style-delta%", 0)); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->Equal(x0)); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxStyleDeltaSetDeltaForeground(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - class wxStyleDelta* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxStyleDelta_class, "set-delta-foreground in style-delta%", n, p); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[POFFSET+0], NULL))) { - string x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - VAR_STACK_PUSH(2, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta-foreground in style-delta% (color name case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "set-delta-foreground in style-delta% (color name case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDeltaForeground(x0)); - - - - READY_TO_PRE_RETURN; - } else { - class wxColour* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - VAR_STACK_PUSH(2, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta-foreground in style-delta% (colour% case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "set-delta-foreground in style-delta% (colour% case)", 0)); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDeltaForeground(x0)); - - - - READY_TO_PRE_RETURN; - } - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyleDelta(r)); -} - -static Scheme_Object *os_wxStyleDeltaSetDeltaBackground(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - class wxStyleDelta* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxStyleDelta_class, "set-delta-background in style-delta%", n, p); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_string(p[POFFSET+0], NULL))) { - string x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - VAR_STACK_PUSH(2, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta-background in style-delta% (color name case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "set-delta-background in style-delta% (color name case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDeltaBackground(x0)); - - - - READY_TO_PRE_RETURN; - } else { - class wxColour* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_PRE_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - VAR_STACK_PUSH(2, x0); - - - if (n != (POFFSET+1)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta-background in style-delta% (colour% case)", POFFSET+1, POFFSET+1, n, p, 1)); - x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "set-delta-background in style-delta% (colour% case)", 0)); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDeltaBackground(x0)); - - - - READY_TO_PRE_RETURN; - } - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyleDelta(r)); -} - -static Scheme_Object *os_wxStyleDeltaSetDeltaFace(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyleDelta* r; - objscheme_check_valid(os_wxStyleDelta_class, "set-delta-face in style-delta%", n, p); - string x0 INIT_NULLED_OUT; - int x1; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "set-delta-face in style-delta%")); - if (n > (POFFSET+1)) { - x1 = WITH_VAR_STACK(unbundle_symset_family(p[POFFSET+1], "set-delta-face in style-delta%")); - } else - x1 = wxDEFAULT; - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDeltaFace(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyleDelta(r)); -} - -static Scheme_Object *os_wxStyleDeltaSetDelta(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - REMEMBER_VAR_STACK(); - class wxStyleDelta* r INIT_NULLED_OUT; - objscheme_check_valid(os_wxStyleDelta_class, "set-delta in style-delta%", n, p); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeFam(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (family case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeFam(p[POFFSET+0], "set-delta in style-delta% (family case)")); - x1 = WITH_VAR_STACK(unbundle_symset_family(p[POFFSET+1], "set-delta in style-delta% (family case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeStyle(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (style case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeStyle(p[POFFSET+0], "set-delta in style-delta% (style case)")); - x1 = WITH_VAR_STACK(unbundle_symset_style(p[POFFSET+1], "set-delta in style-delta% (style case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeWeight(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (weight case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeWeight(p[POFFSET+0], "set-delta in style-delta% (weight case)")); - x1 = WITH_VAR_STACK(unbundle_symset_weight(p[POFFSET+1], "set-delta in style-delta% (weight case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeSmoothing(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (smoothing case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeSmoothing(p[POFFSET+0], "set-delta in style-delta% (smoothing case)")); - x1 = WITH_VAR_STACK(unbundle_symset_smoothing(p[POFFSET+1], "set-delta in style-delta% (smoothing case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeUnderline(p[POFFSET+0], NULL))) { - int x0; - Bool x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (underline case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeUnderline(p[POFFSET+0], "set-delta in style-delta% (underline case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "set-delta in style-delta% (underline case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeSizeInPixels(p[POFFSET+0], NULL))) { - int x0; - Bool x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (size in pixels case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeSizeInPixels(p[POFFSET+0], "set-delta in style-delta% (size in pixels case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "set-delta in style-delta% (size in pixels case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeSize(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (size case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeSize(p[POFFSET+0], "set-delta in style-delta% (size case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+1], 0, 255, "set-delta in style-delta% (size case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeAlign(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (size case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeAlign(p[POFFSET+0], "set-delta in style-delta% (size case)")); - x1 = WITH_VAR_STACK(unbundle_symset_align(p[POFFSET+1], "set-delta in style-delta% (size case)")); - - - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } else { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, r); - - - if ((n > (POFFSET+1))) - WITH_VAR_STACK(scheme_wrong_count_m("set-delta in style-delta% (no change argument case)", POFFSET+POFFSET, POFFSET+1, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(unbundle_symset_changeNoArg(p[POFFSET+0], "set-delta in style-delta% (no change argument case)")); - } else - x0 = wxCHANGE_NOTHING; - - x1 = 0; - r = WITH_VAR_STACK(((wxStyleDelta *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0, x1)); - - - - READY_TO_PRE_RETURN; - } - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyleDelta(r)); -} - -static Scheme_Object *objscheme_wxStyleDelta_Getfamily(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-family in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-family in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::family; - else - v = ((wxStyleDelta *)cobj->primdata)->family; - - return WITH_REMEMBERED_STACK(bundle_symset_family(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_Setfamily(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-family in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-family in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_family(p[POFFSET], "set-family in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->family = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_Getface(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - nstring v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-face in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-face in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::face; - else - v = ((wxStyleDelta *)cobj->primdata)->face; - - return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_Setface(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - nstring v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-face in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-face in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = (nstring)WITH_VAR_STACK(objscheme_unbundle_nullable_string(p[POFFSET], "set-face in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->face = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetsizeMult(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - double v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-size-mult in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-size-mult in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::sizeMult; - else - v = ((wxStyleDelta *)cobj->primdata)->sizeMult; - - return WITH_REMEMBERED_STACK(scheme_make_double(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetsizeMult(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - double v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-size-mult in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-size-mult in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET], "set-size-mult in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->sizeMult = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetsizeAdd(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-size-add in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-size-add in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::sizeAdd; - else - v = ((wxStyleDelta *)cobj->primdata)->sizeAdd; - - return scheme_make_integer(v); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetsizeAdd(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-size-add in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-size-add in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], 0, 255, "set-size-add in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->sizeAdd = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetweightOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-weight-on in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-weight-on in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::weightOn; - else - v = ((wxStyleDelta *)cobj->primdata)->weightOn; - - return WITH_REMEMBERED_STACK(bundle_symset_weight(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetweightOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-weight-on in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-weight-on in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_weight(p[POFFSET], "set-weight-on in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->weightOn = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetweightOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-weight-off in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-weight-off in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::weightOff; - else - v = ((wxStyleDelta *)cobj->primdata)->weightOff; - - return WITH_REMEMBERED_STACK(bundle_symset_weight(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetweightOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-weight-off in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-weight-off in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_weight(p[POFFSET], "set-weight-off in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->weightOff = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetsmoothingOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-smoothing-on in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-smoothing-on in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::smoothingOn; - else - v = ((wxStyleDelta *)cobj->primdata)->smoothingOn; - - return WITH_REMEMBERED_STACK(bundle_symset_smoothing(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetsmoothingOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-smoothing-on in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-smoothing-on in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_smoothing(p[POFFSET], "set-smoothing-on in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->smoothingOn = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetsmoothingOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-smoothing-off in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-smoothing-off in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::smoothingOff; - else - v = ((wxStyleDelta *)cobj->primdata)->smoothingOff; - - return WITH_REMEMBERED_STACK(bundle_symset_smoothing(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetsmoothingOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-smoothing-off in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-smoothing-off in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_smoothing(p[POFFSET], "set-smoothing-off in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->smoothingOff = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetstyleOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-style-on in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-style-on in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::styleOn; - else - v = ((wxStyleDelta *)cobj->primdata)->styleOn; - - return WITH_REMEMBERED_STACK(bundle_symset_style(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetstyleOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-style-on in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-style-on in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_style(p[POFFSET], "set-style-on in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->styleOn = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetstyleOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-style-off in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-style-off in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::styleOff; - else - v = ((wxStyleDelta *)cobj->primdata)->styleOff; - - return WITH_REMEMBERED_STACK(bundle_symset_style(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetstyleOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-style-off in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-style-off in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_style(p[POFFSET], "set-style-off in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->styleOff = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetunderlinedOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - Bool v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-underlined-on in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-underlined-on in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::underlinedOn; - else - v = ((wxStyleDelta *)cobj->primdata)->underlinedOn; - - return (v ? scheme_true : scheme_false); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetunderlinedOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - Bool v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-underlined-on in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-underlined-on in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-underlined-on in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->underlinedOn = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetunderlinedOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - Bool v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-underlined-off in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-underlined-off in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::underlinedOff; - else - v = ((wxStyleDelta *)cobj->primdata)->underlinedOff; - - return (v ? scheme_true : scheme_false); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetunderlinedOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - Bool v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-underlined-off in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-underlined-off in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-underlined-off in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->underlinedOff = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetsipOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - Bool v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-size-in-pixels-on in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-size-in-pixels-on in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::sipOn; - else - v = ((wxStyleDelta *)cobj->primdata)->sipOn; - - return (v ? scheme_true : scheme_false); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetsipOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - Bool v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-size-in-pixels-on in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-size-in-pixels-on in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-size-in-pixels-on in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->sipOn = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetsipOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - Bool v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-size-in-pixels-off in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-size-in-pixels-off in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::sipOff; - else - v = ((wxStyleDelta *)cobj->primdata)->sipOff; - - return (v ? scheme_true : scheme_false); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetsipOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - Bool v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-size-in-pixels-off in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-size-in-pixels-off in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-size-in-pixels-off in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->sipOff = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GettransparentTextBackingOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - Bool v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-transparent-text-backing-on in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-transparent-text-backing-on in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::transparentTextBackingOn; - else - v = ((wxStyleDelta *)cobj->primdata)->transparentTextBackingOn; - - return (v ? scheme_true : scheme_false); -} - -static Scheme_Object *objscheme_wxStyleDelta_SettransparentTextBackingOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - Bool v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-transparent-text-backing-on in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-transparent-text-backing-on in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-transparent-text-backing-on in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->transparentTextBackingOn = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GettransparentTextBackingOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - Bool v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-transparent-text-backing-off in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-transparent-text-backing-off in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::transparentTextBackingOff; - else - v = ((wxStyleDelta *)cobj->primdata)->transparentTextBackingOff; - - return (v ? scheme_true : scheme_false); -} - -static Scheme_Object *objscheme_wxStyleDelta_SettransparentTextBackingOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - Bool v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-transparent-text-backing-off in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-transparent-text-backing-off in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-transparent-text-backing-off in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->transparentTextBackingOff = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetforegroundMult(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - class wxMultColour* v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-foreground-mult in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-foreground-mult in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::foregroundMult; - else - v = ((wxStyleDelta *)cobj->primdata)->foregroundMult; - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMultColour(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_GetbackgroundMult(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - class wxMultColour* v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-background-mult in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-background-mult in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::backgroundMult; - else - v = ((wxStyleDelta *)cobj->primdata)->backgroundMult; - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxMultColour(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_GetforegroundAdd(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - class wxAddColour* v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-foreground-add in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-foreground-add in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::foregroundAdd; - else - v = ((wxStyleDelta *)cobj->primdata)->foregroundAdd; - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxAddColour(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_GetbackgroundAdd(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - class wxAddColour* v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-background-add in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-background-add in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::backgroundAdd; - else - v = ((wxStyleDelta *)cobj->primdata)->backgroundAdd; - - return WITH_REMEMBERED_STACK(objscheme_bundle_wxAddColour(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_GetalignmentOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-alignment-on in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-alignment-on in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::alignmentOn; - else - v = ((wxStyleDelta *)cobj->primdata)->alignmentOn; - - return WITH_REMEMBERED_STACK(bundle_symset_align(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetalignmentOn(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-alignment-on in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-alignment-on in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_align(p[POFFSET], "set-alignment-on in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->alignmentOn = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *objscheme_wxStyleDelta_GetalignmentOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj INIT_NULLED_OUT; - int v; - REMEMBER_VAR_STACK(); - - objscheme_check_valid(os_wxStyleDelta_class, "get-alignment-off in style-delta%", n, p); - if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-alignment-off in style-delta%", POFFSET, POFFSET, n, p, 1)); - cobj = (Scheme_Class_Object *)p[0]; - if (cobj->primflag) - v = ((os_wxStyleDelta *)cobj->primdata)->wxStyleDelta::alignmentOff; - else - v = ((wxStyleDelta *)cobj->primdata)->alignmentOff; - - return WITH_REMEMBERED_STACK(bundle_symset_align(v)); -} - -static Scheme_Object *objscheme_wxStyleDelta_SetalignmentOff(int n, Scheme_Object *p[]) -{ - Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0]; - int v; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, cobj); - - WITH_VAR_STACK(objscheme_check_valid(os_wxStyleDelta_class, "set-alignment-off in style-delta%", n, p)); - if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-alignment-off in style-delta%", POFFSET+1, POFFSET+1, n, p, 1)); - - v = WITH_VAR_STACK(unbundle_symset_align(p[POFFSET], "set-alignment-off in style-delta%")); - ((wxStyleDelta *)cobj->primdata)->alignmentOff = v; - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxStyleDelta_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxStyleDelta *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeAlign(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (size case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeAlign(p[POFFSET+0], "initialization in style-delta% (size case)")); - x1 = WITH_VAR_STACK(unbundle_symset_align(p[POFFSET+1], "initialization in style-delta% (size case)")); - - - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeSize(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (size case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeSize(p[POFFSET+0], "initialization in style-delta% (size case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+1], 0, 255, "initialization in style-delta% (size case)")); - - - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeSizeInPixels(p[POFFSET+0], NULL))) { - int x0; - Bool x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (size in pixels case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeSizeInPixels(p[POFFSET+0], "initialization in style-delta% (size in pixels case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "initialization in style-delta% (size in pixels case)")); - - - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeUnderline(p[POFFSET+0], NULL))) { - int x0; - Bool x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (underline case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeUnderline(p[POFFSET+0], "initialization in style-delta% (underline case)")); - x1 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+1], "initialization in style-delta% (underline case)")); - - - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeSmoothing(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (smoothing case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeSmoothing(p[POFFSET+0], "initialization in style-delta% (smoothing case)")); - x1 = WITH_VAR_STACK(unbundle_symset_smoothing(p[POFFSET+1], "initialization in style-delta% (smoothing case)")); - - - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeWeight(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (weight case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeWeight(p[POFFSET+0], "initialization in style-delta% (weight case)")); - x1 = WITH_VAR_STACK(unbundle_symset_weight(p[POFFSET+1], "initialization in style-delta% (weight case)")); - - - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeStyle(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (style case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeStyle(p[POFFSET+0], "initialization in style-delta% (style case)")); - x1 = WITH_VAR_STACK(unbundle_symset_style(p[POFFSET+1], "initialization in style-delta% (style case)")); - - - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(istype_symset_changeFam(p[POFFSET+0], NULL))) { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+2)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (family case)", POFFSET+2, POFFSET+2, n, p, 1)); - x0 = WITH_VAR_STACK(unbundle_symset_changeFam(p[POFFSET+0], "initialization in style-delta% (family case)")); - x1 = WITH_VAR_STACK(unbundle_symset_family(p[POFFSET+1], "initialization in style-delta% (family case)")); - - - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } else { - int x0; - int x1; - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if ((n > (POFFSET+1))) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-delta% (no change argument case)", POFFSET+POFFSET, POFFSET+1, n, p, 1)); - if (n > (POFFSET+0)) { - x0 = WITH_VAR_STACK(unbundle_symset_changeNoArg(p[POFFSET+0], "initialization in style-delta% (no change argument case)")); - } else - x0 = wxCHANGE_NOTHING; - - x1 = 0; - realobj = WITH_VAR_STACK(new os_wxStyleDelta CONSTRUCTOR_ARGS((x0, x1))); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleDelta(x0, x1)); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_PRE_RETURN; - } - - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxStyleDelta(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxStyleDelta_class); - - os_wxStyleDelta_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "style-delta%", "object%", (Scheme_Method_Prim *)os_wxStyleDelta_ConstructScheme, 47)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class, "copy" " method", (Scheme_Method_Prim *)os_wxStyleDeltaCopy, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class, "collapse" " method", (Scheme_Method_Prim *)os_wxStyleDeltaCollapse, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class, "equal?" " method", (Scheme_Method_Prim *)os_wxStyleDeltaEqual, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class, "set-delta-foreground" " method", (Scheme_Method_Prim *)os_wxStyleDeltaSetDeltaForeground, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class, "set-delta-background" " method", (Scheme_Method_Prim *)os_wxStyleDeltaSetDeltaBackground, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class, "set-delta-face" " method", (Scheme_Method_Prim *)os_wxStyleDeltaSetDeltaFace, 1, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class, "set-delta" " method", (Scheme_Method_Prim *)os_wxStyleDeltaSetDelta, 0, 2)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-family" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_Getfamily, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-family" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_Setfamily, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-face" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_Getface, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-face" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_Setface, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-size-mult" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetsizeMult, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-size-mult" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetsizeMult, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-size-add" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetsizeAdd, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-size-add" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetsizeAdd, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-weight-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetweightOn, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-weight-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetweightOn, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-weight-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetweightOff, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-weight-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetweightOff, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-smoothing-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetsmoothingOn, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-smoothing-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetsmoothingOn, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-smoothing-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetsmoothingOff, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-smoothing-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetsmoothingOff, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-style-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetstyleOn, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-style-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetstyleOn, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-style-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetstyleOff, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-style-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetstyleOff, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-underlined-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetunderlinedOn, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-underlined-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetunderlinedOn, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-underlined-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetunderlinedOff, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-underlined-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetunderlinedOff, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-size-in-pixels-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetsipOn, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-size-in-pixels-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetsipOn, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-size-in-pixels-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetsipOff, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-size-in-pixels-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetsipOff, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-transparent-text-backing-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GettransparentTextBackingOn, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-transparent-text-backing-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SettransparentTextBackingOn, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-transparent-text-backing-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GettransparentTextBackingOff, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-transparent-text-backing-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SettransparentTextBackingOff, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-foreground-mult" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetforegroundMult, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-background-mult" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetbackgroundMult, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-foreground-add" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetforegroundAdd, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-background-add" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetbackgroundAdd, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-alignment-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetalignmentOn, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-alignment-on" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetalignmentOn, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"get-alignment-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_GetalignmentOff, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleDelta_class,"set-alignment-off" " method", (Scheme_Method_Prim *)objscheme_wxStyleDelta_SetalignmentOff, 1, 1)); - - WITH_VAR_STACK(scheme_made_class(os_wxStyleDelta_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxStyleDelta, wxTYPE_STYLE_DELTA)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxStyleDelta(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxStyleDelta_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "style-delta% object or " XC_NULL_STR: "style-delta% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxStyleDelta(class wxStyleDelta *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_STYLE_DELTA) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxStyleDelta_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxStyleDelta(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxStyleDelta *)o->primdata; - else - return (wxStyleDelta *)o->primdata; -} - - - - - - - - - - - - -class os_wxStyle : public wxStyle { - public: - - ~os_wxStyle(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxStyle::gcMark() { - wxStyle::gcMark(); -} -void os_wxStyle::gcFixup() { - wxStyle::gcFixup(); -} -#endif - -static Scheme_Object *os_wxStyle_class; -static Scheme_Object *os_wxStyle_interface; - -os_wxStyle::~os_wxStyle() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxStyleSwitchTo(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxStyle_class, "switch-to in style<%>", n, p); - class wxDC* x0 INIT_NULLED_OUT; - class wxStyle* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "switch-to in style<%>", 0)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+1], "switch-to in style<%>", 1)); - - if (x0 && !x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("style%","switch-to"), "bad device context: ", p[POFFSET+0])); - WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->SwitchTo(x0, x1)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxStyleSetShiftStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxStyle_class, "set-shift-style in style<%>", n, p); - class wxStyle* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "set-shift-style in style<%>", 0)); - - - WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->SetShiftStyle(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxStyleGetShiftStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyle_class, "get-shift-style in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetShiftStyle()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleIsJoin(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxStyle_class, "is-join? in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->IsJoin()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxStyleSetDelta(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxStyle_class, "set-delta in style<%>", n, p); - class wxStyleDelta* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "set-delta in style<%>", 0)); - - - WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->SetDelta(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxStyleGetDelta(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxStyle_class, "get-delta in style<%>", n, p); - class wxStyleDelta* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+0], "get-delta in style<%>", 0)); - - - WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetDelta(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxStyleSetBaseStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxStyle_class, "set-base-style in style<%>", n, p); - class wxStyle* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "set-base-style in style<%>", 0)); - - - WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->SetBaseStyle(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxStyleGetBaseStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyle_class, "get-base-style in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetBaseStyle()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleGetTextWidth(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxStyle_class, "get-text-width in style<%>", n, p); - class wxDC* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-text-width in style<%>", 0)); - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetTextWidth(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxStyleGetTextSpace(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxStyle_class, "get-text-space in style<%>", n, p); - class wxDC* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-text-space in style<%>", 0)); - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetTextSpace(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxStyleGetTextDescent(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxStyle_class, "get-text-descent in style<%>", n, p); - class wxDC* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-text-descent in style<%>", 0)); - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetTextDescent(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxStyleGetTextHeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - double r; - objscheme_check_valid(os_wxStyle_class, "get-text-height in style<%>", n, p); - class wxDC* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[POFFSET+0], "get-text-height in style<%>", 0)); - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetTextHeight(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(scheme_make_double(r)); -} - -static Scheme_Object *os_wxStyleGetTransparentTextBacking(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxStyle_class, "get-transparent-text-backing in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetTransparentTextBacking()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxStyleGetAlignment(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxStyle_class, "get-alignment in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetAlignment()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_align(r)); -} - -static Scheme_Object *os_wxStyleGetBackground(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxColour* r; - objscheme_check_valid(os_wxStyle_class, "get-background in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetBackground()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r)); -} - -static Scheme_Object *os_wxStyleGetForeground(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxColour* r; - objscheme_check_valid(os_wxStyle_class, "get-foreground in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetForeground()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r)); -} - -static Scheme_Object *os_wxStyleGetFont(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxFont* r; - objscheme_check_valid(os_wxStyle_class, "get-font in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetFont()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxFont(r)); -} - -static Scheme_Object *os_wxStyleGetSizeInPixels(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxStyle_class, "get-size-in-pixels in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetSizeInPixels()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxStyleGetUnderlined(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - Bool r; - objscheme_check_valid(os_wxStyle_class, "get-underlined in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetUnderlined()); - - - - READY_TO_RETURN; - return (r ? scheme_true : scheme_false); -} - -static Scheme_Object *os_wxStyleGetSmoothing(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxStyle_class, "get-smoothing in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetSmoothing()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_smoothing(r)); -} - -static Scheme_Object *os_wxStyleGetStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxStyle_class, "get-style in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetStyle()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_style(r)); -} - -static Scheme_Object *os_wxStyleGetWeight(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxStyle_class, "get-weight in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetWeight()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_weight(r)); -} - -static Scheme_Object *os_wxStyleGetSize(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxStyle_class, "get-size in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetSize()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxStyleGetFace(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - nstring r; - objscheme_check_valid(os_wxStyle_class, "get-face in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetFace()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r)); -} - -static Scheme_Object *os_wxStyleGetFamily(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxStyle_class, "get-family in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetFamily()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(bundle_symset_family(r)); -} - -static Scheme_Object *os_wxStyleGetName(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - string r; - objscheme_check_valid(os_wxStyle_class, "get-name in style<%>", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyle *)((Scheme_Class_Object *)p[0])->primdata)->GetName()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_string((char *)r)); -} - -void objscheme_setup_wxStyle(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxStyle_class); - wxREGGLOB(os_wxStyle_interface); - - os_wxStyle_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "style%", "object%", NULL, 26)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "switch-to" " method", (Scheme_Method_Prim *)os_wxStyleSwitchTo, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "set-shift-style" " method", (Scheme_Method_Prim *)os_wxStyleSetShiftStyle, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-shift-style" " method", (Scheme_Method_Prim *)os_wxStyleGetShiftStyle, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "is-join?" " method", (Scheme_Method_Prim *)os_wxStyleIsJoin, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "set-delta" " method", (Scheme_Method_Prim *)os_wxStyleSetDelta, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-delta" " method", (Scheme_Method_Prim *)os_wxStyleGetDelta, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "set-base-style" " method", (Scheme_Method_Prim *)os_wxStyleSetBaseStyle, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-base-style" " method", (Scheme_Method_Prim *)os_wxStyleGetBaseStyle, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-text-width" " method", (Scheme_Method_Prim *)os_wxStyleGetTextWidth, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-text-space" " method", (Scheme_Method_Prim *)os_wxStyleGetTextSpace, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-text-descent" " method", (Scheme_Method_Prim *)os_wxStyleGetTextDescent, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-text-height" " method", (Scheme_Method_Prim *)os_wxStyleGetTextHeight, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-transparent-text-backing" " method", (Scheme_Method_Prim *)os_wxStyleGetTransparentTextBacking, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-alignment" " method", (Scheme_Method_Prim *)os_wxStyleGetAlignment, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-background" " method", (Scheme_Method_Prim *)os_wxStyleGetBackground, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-foreground" " method", (Scheme_Method_Prim *)os_wxStyleGetForeground, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-font" " method", (Scheme_Method_Prim *)os_wxStyleGetFont, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-size-in-pixels" " method", (Scheme_Method_Prim *)os_wxStyleGetSizeInPixels, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-underlined" " method", (Scheme_Method_Prim *)os_wxStyleGetUnderlined, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-smoothing" " method", (Scheme_Method_Prim *)os_wxStyleGetSmoothing, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-style" " method", (Scheme_Method_Prim *)os_wxStyleGetStyle, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-weight" " method", (Scheme_Method_Prim *)os_wxStyleGetWeight, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-size" " method", (Scheme_Method_Prim *)os_wxStyleGetSize, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-face" " method", (Scheme_Method_Prim *)os_wxStyleGetFace, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-family" " method", (Scheme_Method_Prim *)os_wxStyleGetFamily, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyle_class, "get-name" " method", (Scheme_Method_Prim *)os_wxStyleGetName, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxStyle_class)); - - os_wxStyle_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxStyle_class, "style" "<%>")); - - WITH_VAR_STACK(objscheme_add_global_interface(os_wxStyle_interface, "style" "<%>", env)); - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxStyle, wxTYPE_STYLE)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxStyle(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxStyle_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "style% object or " XC_NULL_STR: "style% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_STYLE) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxStyle_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxStyle(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxStyle *)o->primdata; - else - return (wxStyle *)o->primdata; -} - - - - - - -// @ "clear" : void Clear(); -// @ "copy" : void Copy(wxStyleList!); - - - - - - - -static void NotifyCallbackToScheme(wxStyle *, Scheme_Object *f); - - - - -class os_wxStyleList : public wxStyleList { - public: - - os_wxStyleList CONSTRUCTOR_ARGS(()); - ~os_wxStyleList(); -#ifdef MZ_PRECISE_GC - void gcMark(); - void gcFixup(); -#endif -}; - -#ifdef MZ_PRECISE_GC -void os_wxStyleList::gcMark() { - wxStyleList::gcMark(); -} -void os_wxStyleList::gcFixup() { - wxStyleList::gcFixup(); -} -#endif - -static Scheme_Object *os_wxStyleList_class; - -os_wxStyleList::os_wxStyleList CONSTRUCTOR_ARGS(()) -CONSTRUCTOR_INIT(: wxStyleList()) -{ -} - -os_wxStyleList::~os_wxStyleList() -{ - objscheme_destroy(this, (Scheme_Object *) __gc_external); -} - -static Scheme_Object *os_wxStyleListForgetNotification(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - objscheme_check_valid(os_wxStyleList_class, "forget-notification in style-list%", n, p); - void* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = ((void *)p[POFFSET+0]); - - - WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->ForgetNotification(x0)); - - - - READY_TO_RETURN; - return scheme_void; -} - -static Scheme_Object *os_wxStyleListNotifyOnChange(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - void* r; - objscheme_check_valid(os_wxStyleList_class, "notify-on-change in style-list%", n, p); - wxStyleNotifyFunc x0; - void* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x1); - - - x0 = (wxStyleNotifyFunc)NotifyCallbackToScheme; - x1 = (scheme_check_proc_arity(METHODNAME("style-list%","notify-on-change"), 1, POFFSET, 0, p), p[POFFSET]); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->NotifyOnChange(x0, x1)); - - - - READY_TO_RETURN; - return ((Scheme_Object *)r); -} - -static Scheme_Object *os_wxStyleListStyleToIndex(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxStyleList_class, "style-to-index in style-list%", n, p); - class wxStyle* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "style-to-index in style-list%", 0)); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->StyleToIndex(x0)); - - - - READY_TO_RETURN; - return ((r < 0) ? scheme_false : scheme_make_integer(r)); -} - -static Scheme_Object *os_wxStyleListIndexToStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyleList_class, "index-to-style in style-list%", n, p); - nnint x0; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+0], "index-to-style in style-list%")); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->IndexToStyle(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleListConvert(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyleList_class, "convert in style-list%", n, p); - class wxStyle* x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "convert in style-list%", 0)); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->Convert(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleListReplaceNamedStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyleList_class, "replace-named-style in style-list%", n, p); - string x0 INIT_NULLED_OUT; - class wxStyle* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "replace-named-style in style-list%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+1], "replace-named-style in style-list%", 0)); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->ReplaceNamedStyle(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleListNewNamedStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyleList_class, "new-named-style in style-list%", n, p); - string x0 INIT_NULLED_OUT; - class wxStyle* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "new-named-style in style-list%")); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+1], "new-named-style in style-list%", 0)); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->NewNamedStyle(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleListFindNamedStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyleList_class, "find-named-style in style-list%", n, p); - string x0 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - - - x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "find-named-style in style-list%")); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->FindNamedStyle(x0)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleListFindOrCreateJoinStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyleList_class, "find-or-create-join-style in style-list%", n, p); - class wxStyle* x0 INIT_NULLED_OUT; - class wxStyle* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "find-or-create-join-style in style-list%", 1)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+1], "find-or-create-join-style in style-list%", 0)); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreateJoinStyle(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleListFindOrCreateStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyleList_class, "find-or-create-style in style-list%", n, p); - class wxStyle* x0 INIT_NULLED_OUT; - class wxStyleDelta* x1 INIT_NULLED_OUT; - - SETUP_VAR_STACK_REMEMBERED(3); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, x0); - VAR_STACK_PUSH(2, x1); - - - x0 = WITH_VAR_STACK(objscheme_unbundle_wxStyle(p[POFFSET+0], "find-or-create-style in style-list%", 1)); - x1 = WITH_VAR_STACK(objscheme_unbundle_wxStyleDelta(p[POFFSET+1], "find-or-create-style in style-list%", 0)); - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->FindOrCreateStyle(x0, x1)); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleListNumber(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - int r; - objscheme_check_valid(os_wxStyleList_class, "number in style-list%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->Number()); - - - - READY_TO_RETURN; - return scheme_make_integer(r); -} - -static Scheme_Object *os_wxStyleListBasicStyle(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyle* r; - objscheme_check_valid(os_wxStyleList_class, "basic-style in style-list%", n, p); - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(((wxStyleList *)((Scheme_Class_Object *)p[0])->primdata)->BasicStyle()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyle(r)); -} - -static Scheme_Object *os_wxStyleList_ConstructScheme(int n, Scheme_Object *p[]) -{ - SETUP_PRE_VAR_STACK(1); - PRE_VAR_STACK_PUSH(0, p); - os_wxStyleList *realobj INIT_NULLED_OUT; - REMEMBER_VAR_STACK(); - - SETUP_VAR_STACK_PRE_REMEMBERED(2); - VAR_STACK_PUSH(0, p); - VAR_STACK_PUSH(1, realobj); - - - if (n != (POFFSET+0)) - WITH_VAR_STACK(scheme_wrong_count_m("initialization in style-list%", POFFSET+0, POFFSET+0, n, p, 1)); - - - realobj = WITH_VAR_STACK(new os_wxStyleList CONSTRUCTOR_ARGS(())); -#ifdef MZ_PRECISE_GC - WITH_VAR_STACK(realobj->gcInit_wxStyleList()); -#endif - realobj->__gc_external = (void *)p[0]; - - - READY_TO_RETURN; - ((Scheme_Class_Object *)p[0])->primdata = realobj; - ((Scheme_Class_Object *)p[0])->primflag = 1; - return scheme_void; -} - -void objscheme_setup_wxStyleList(Scheme_Env *env) -{ - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - - wxREGGLOB(os_wxStyleList_class); - - os_wxStyleList_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "style-list%", "object%", (Scheme_Method_Prim *)os_wxStyleList_ConstructScheme, 12)); - - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "forget-notification" " method", (Scheme_Method_Prim *)os_wxStyleListForgetNotification, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "notify-on-change" " method", (Scheme_Method_Prim *)os_wxStyleListNotifyOnChange, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "style-to-index" " method", (Scheme_Method_Prim *)os_wxStyleListStyleToIndex, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "index-to-style" " method", (Scheme_Method_Prim *)os_wxStyleListIndexToStyle, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "convert" " method", (Scheme_Method_Prim *)os_wxStyleListConvert, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "replace-named-style" " method", (Scheme_Method_Prim *)os_wxStyleListReplaceNamedStyle, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "new-named-style" " method", (Scheme_Method_Prim *)os_wxStyleListNewNamedStyle, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "find-named-style" " method", (Scheme_Method_Prim *)os_wxStyleListFindNamedStyle, 1, 1)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "find-or-create-join-style" " method", (Scheme_Method_Prim *)os_wxStyleListFindOrCreateJoinStyle, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "find-or-create-style" " method", (Scheme_Method_Prim *)os_wxStyleListFindOrCreateStyle, 2, 2)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "number" " method", (Scheme_Method_Prim *)os_wxStyleListNumber, 0, 0)); - WITH_VAR_STACK(scheme_add_method_w_arity(os_wxStyleList_class, "basic-style" " method", (Scheme_Method_Prim *)os_wxStyleListBasicStyle, 0, 0)); - - - WITH_VAR_STACK(scheme_made_class(os_wxStyleList_class)); - - WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxStyleList, wxTYPE_STYLE_LIST)); - - READY_TO_RETURN; -} - -int objscheme_istype_wxStyleList(Scheme_Object *obj, const char *stop, int nullOK) -{ - REMEMBER_VAR_STACK(); - if (nullOK && XC_SCHEME_NULLP(obj)) return 1; - if (objscheme_is_a(obj, os_wxStyleList_class)) - return 1; - else { - if (!stop) - return 0; - WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "style-list% object or " XC_NULL_STR: "style-list% object", -1, 0, &obj)); - return 0; - } -} - -Scheme_Object *objscheme_bundle_wxStyleList(class wxStyleList *realobj) -{ - Scheme_Class_Object *obj INIT_NULLED_OUT; - Scheme_Object *sobj INIT_NULLED_OUT; - - if (!realobj) return XC_SCHEME_NULL; - - if (realobj->__gc_external) - return (Scheme_Object *)realobj->__gc_external; - - SETUP_VAR_STACK(2); - VAR_STACK_PUSH(0, obj); - VAR_STACK_PUSH(1, realobj); - - if ((realobj->__type != wxTYPE_STYLE_LIST) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type)))) - { READY_TO_RETURN; return sobj; } - obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxStyleList_class)); - - obj->primdata = realobj; - obj->primflag = 0; - - realobj->__gc_external = (void *)obj; - READY_TO_RETURN; - return (Scheme_Object *)obj; -} - -class wxStyleList *objscheme_unbundle_wxStyleList(Scheme_Object *obj, const char *where, int nullOK) -{ - if (nullOK && XC_SCHEME_NULLP(obj)) return NULL; - - REMEMBER_VAR_STACK(); - - (void)objscheme_istype_wxStyleList(obj, where, nullOK); - Scheme_Class_Object *o = (Scheme_Class_Object *)obj; - WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj)); - if (o->primflag) - return (os_wxStyleList *)o->primdata; - else - return (wxStyleList *)o->primdata; -} - - -static void NotifyCallbackToScheme(wxStyle *s, Scheme_Object *f) -{ - Scheme_Object *p[1]; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, f); - - p[0] = NULL; - - p[0] = s ? WITH_VAR_STACK(objscheme_bundle_wxStyle(s)) : scheme_false; - - WITH_VAR_STACK(scheme_apply_multi(f, 1, p)); - - READY_TO_RETURN; -} - -static wxStyleList* wxGetTheStyleList() -{ - return wxTheStyleList; -} - -static Scheme_Object *wxGlobalStyleListwxGetTheStyleList(int n, Scheme_Object *p[]) -{ - WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p) - REMEMBER_VAR_STACK(); - class wxStyleList* r; - - SETUP_VAR_STACK_REMEMBERED(1); - VAR_STACK_PUSH(0, p); - - - - - r = WITH_VAR_STACK(wxGetTheStyleList()); - - - - READY_TO_RETURN; - return WITH_REMEMBERED_STACK(objscheme_bundle_wxStyleList(r)); -} - -void objscheme_setup_wxGlobalStyleList(Scheme_Env *env) -{ - Scheme_Object *functmp INIT_NULLED_OUT; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, env); - functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxGlobalStyleListwxGetTheStyleList, "get-the-style-list", 0, 0)); - WITH_VAR_STACK(scheme_install_xc_global("get-the-style-list", functmp, env)); - READY_TO_RETURN; -} - diff --git a/src/mred/wxs/wxs_styl.h b/src/mred/wxs/wxs_styl.h deleted file mode 100644 index 3d28d635a9..0000000000 --- a/src/mred/wxs/wxs_styl.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef WXS_SETUP_ONLY -#endif -void objscheme_setup_wxMultColour(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxMultColour(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxMultColour(class wxMultColour *realobj); -class wxMultColour *objscheme_unbundle_wxMultColour(Scheme_Object *obj, const char *where, int nullOK); -#endif -void objscheme_setup_wxAddColour(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxAddColour(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxAddColour(class wxAddColour *realobj); -class wxAddColour *objscheme_unbundle_wxAddColour(Scheme_Object *obj, const char *where, int nullOK); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxColour *objscheme_unbundle_wxColour(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyleDelta(class wxStyleDelta *); -extern class wxColour *objscheme_unbundle_wxColour(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyleDelta(class wxStyleDelta *); -extern Scheme_Object *objscheme_bundle_wxStyleDelta(class wxStyleDelta *); -extern Scheme_Object *objscheme_bundle_wxStyleDelta(class wxStyleDelta *); -extern Scheme_Object *objscheme_bundle_wxMultColour(class wxMultColour *); -extern Scheme_Object *objscheme_bundle_wxMultColour(class wxMultColour *); -extern Scheme_Object *objscheme_bundle_wxAddColour(class wxAddColour *); -extern Scheme_Object *objscheme_bundle_wxAddColour(class wxAddColour *); -#endif -void objscheme_setup_wxStyleDelta(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxStyleDelta(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxStyleDelta(class wxStyleDelta *realobj); -class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *obj, const char *where, int nullOK); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern class wxDC *objscheme_unbundle_wxDC(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxColour(class wxColour *); -extern Scheme_Object *objscheme_bundle_wxColour(class wxColour *); -extern Scheme_Object *objscheme_bundle_wxFont(class wxFont *); -#endif -void objscheme_setup_wxStyle(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxStyle(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *realobj); -class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *obj, const char *where, int nullOK); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern class wxStyle *objscheme_unbundle_wxStyle(Scheme_Object *, const char *, int); -extern class wxStyleDelta *objscheme_unbundle_wxStyleDelta(Scheme_Object *, const char *, int); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -extern Scheme_Object *objscheme_bundle_wxStyle(class wxStyle *); -#endif -void objscheme_setup_wxStyleList(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -int objscheme_istype_wxStyleList(Scheme_Object *obj, const char *stop, int nullOK); -Scheme_Object *objscheme_bundle_wxStyleList(class wxStyleList *realobj); -class wxStyleList *objscheme_unbundle_wxStyleList(Scheme_Object *obj, const char *where, int nullOK); -extern Scheme_Object *objscheme_bundle_wxStyleList(class wxStyleList *); -#endif -void objscheme_setup_wxGlobalStyleList(Scheme_Env *env); -#ifndef WXS_SETUP_ONLY -#endif diff --git a/src/mred/wxs/wxs_styl.xc b/src/mred/wxs/wxs_styl.xc deleted file mode 100644 index b86dbc8105..0000000000 --- a/src/mred/wxs/wxs_styl.xc +++ /dev/null @@ -1,282 +0,0 @@ - -@INCLUDE prefix.xci - -#include "wx_style.h" -#include "wx_mtype.h" - -@INCLUDE wxs.xci - -@HEADER - -@CLASSBASE wxMultColour "mult-color" : "object" / nofnl -@INTERFACE "mult-color" - -@IVAR "r" : double r -@IVAR "g" : double g -@IVAR "b" : double b - -@ "get" : void Get(double*,double*,double*); -@ "set" : void Set(double,double,double); - -@END - -@CLASSBASE wxAddColour "add-color" : "object" / nofnl -@INTERFACE "add-color" - -@IVAR "r" : rint[-1000|1000] r -@IVAR "g" : rint[-1000|1000] g -@IVAR "b" : rint[-1000|1000] b - -// short* should really be rshort[-1000|1000]*: -@ "get" : void Get(short*,short*,short*); -@ "set" : void Set(rint[-1000|1000],rint[-1000|1000],rint[-1000|1000]); - -@END - -@BEGINSYMBOLS family > ONE > PRED -@SYM "base" : wxBASE -@SYM "default" : wxDEFAULT -@SYM "decorative" : wxDECORATIVE -@SYM "roman" : wxROMAN -@SYM "script" : wxSCRIPT -@SYM "swiss" : wxSWISS -@SYM "modern" : wxMODERN -@SYM "system" : wxSYSTEM -@SYM "symbol" : wxSYMBOL -@ENDSYMBOLS - -@BEGINSYMBOLS weight > ONE > PRED -@SYM "base" : wxBASE -@SYM "normal" : wxNORMAL -@SYM "light" : wxLIGHT -@SYM "bold" : wxBOLD -@ENDSYMBOLS - -@BEGINSYMBOLS style > ONE > PRED -@SYM "base" : wxBASE -@SYM "normal" : wxNORMAL -@SYM "italic" : wxITALIC -@SYM "slant" : wxSLANT -@ENDSYMBOLS - -@BEGINSYMBOLS smoothing > ONE > PRED -@SYM "base" : wxBASE -@SYM "default" : wxSMOOTHING_DEFAULT -@SYM "partly-smoothed" : wxSMOOTHING_PARTIAL -@SYM "smoothed" : wxSMOOTHING_ON -@SYM "unsmoothed" : wxSMOOTHING_OFF -@ENDSYMBOLS - -@BEGINSYMBOLS align > ONE > PRED -@SYM "base" : wxBASE -@SYM "top" : wxALIGN_TOP -@SYM "bottom" : wxALIGN_BOTTOM -@SYM "center" : wxALIGN_CENTER -@ENDSYMBOLS - -@BEGINSYMBOLS changeNoArg > ONE > PRED BUNDLE -@SYM "change-nothing" : wxCHANGE_NOTHING -@SYM "change-normal" : wxCHANGE_NORMAL -@SYM "change-bold" : wxCHANGE_BOLD -@SYM "change-italic" : wxCHANGE_ITALIC -@SYM "change-toggle-underline" : wxCHANGE_TOGGLE_UNDERLINE -@SYM "change-toggle-size-in-pixels" : wxCHANGE_TOGGLE_SIP -@SYM "change-normal-color" : wxCHANGE_NORMAL_COLOUR -@ENDSYMBOLS -@BEGINSYMBOLS changeFam > ONE > BUNDLE -@SYM "change-family" : wxCHANGE_FAMILY -@ENDSYMBOLS -@BEGINSYMBOLS changeStyle > ONE > BUNDLE -@SYM "change-style" : wxCHANGE_STYLE -@SYM "change-toggle-style" : wxCHANGE_TOGGLE_STYLE -@ENDSYMBOLS -@BEGINSYMBOLS changeWeight > ONE > BUNDLE -@SYM "change-weight" : wxCHANGE_WEIGHT -@SYM "change-toggle-weight" : wxCHANGE_TOGGLE_WEIGHT -@ENDSYMBOLS -@BEGINSYMBOLS changeSmoothing > ONE > BUNDLE -@SYM "change-smoothing" : wxCHANGE_SMOOTHING -@SYM "change-toggle-smoothing" : wxCHANGE_TOGGLE_SMOOTHING -@ENDSYMBOLS -@BEGINSYMBOLS changeUnderline > ONE > BUNDLE -@SYM "change-underline" : wxCHANGE_UNDERLINE -@ENDSYMBOLS -@BEGINSYMBOLS changeSizeInPixels > ONE > BUNDLE -@SYM "change-size-in-pixels" : wxCHANGE_SIP -@ENDSYMBOLS -@BEGINSYMBOLS changeSize > ONE > BUNDLE -@SYM "change-size" : wxCHANGE_SIZE -@SYM "change-bigger" : wxCHANGE_BIGGER -@SYM "change-smaller" : wxCHANGE_SMALLER -@ENDSYMBOLS -@BEGINSYMBOLS changeAlign > ONE > BUNDLE -@SYM "change-alignment" : wxCHANGE_ALIGNMENT -@ENDSYMBOLS - -@CLASSBASE wxStyleDelta "style-delta" : "object" / nofnl - -@IVAR "family" : SYM[family] family -@IVAR "face" : nstring face -@IVAR "size-mult" : double sizeMult -@IVAR "size-add" : rint[0|255] sizeAdd -@IVAR "weight-on" : SYM[weight] weightOn -@IVAR "weight-off" : SYM[weight] weightOff -@IVAR "smoothing-on" : SYM[smoothing] smoothingOn -@IVAR "smoothing-off" : SYM[smoothing] smoothingOff -@IVAR "style-on" : SYM[style] styleOn -@IVAR "style-off" : SYM[style] styleOff -@IVAR "underlined-on" : bool underlinedOn -@IVAR "underlined-off" : bool underlinedOff -@IVAR "size-in-pixels-on" : bool sipOn -@IVAR "size-in-pixels-off" : bool sipOff -@IVAR "transparent-text-backing-on" : bool transparentTextBackingOn -@IVAR "transparent-text-backing-off" : bool transparentTextBackingOff -@IVAR r "foreground-mult" : wxMultColour! foregroundMult -@IVAR r "background-mult" : wxMultColour! backgroundMult -@IVAR r "foreground-add" : wxAddColour! foregroundAdd -@IVAR r "background-add" : wxAddColour! backgroundAdd -@IVAR "alignment-on" : SYM[align] alignmentOn -@IVAR "alignment-off" : SYM[align] alignmentOff - -@CREATOR (SYM[changeNoArg]=wxCHANGE_NOTHING,-int=0); : : /setX1Zero <> no change argument -@CREATORX (SYM[changeFam],SYM[family]); <> family -@CREATORX (SYM[changeStyle],SYM[style]); <> style -@CREATORX (SYM[changeWeight],SYM[weight]); <> weight -@CREATORX (SYM[changeSmoothing],SYM[smoothing]); <> smoothing -@CREATORX (SYM[changeUnderline],bool); <> underline -@CREATORX (SYM[changeSizeInPixels],bool); <> size in pixels -@CREATORX (SYM[changeSize],rint[0|255]); <> size -@CREATORX (SYM[changeAlign],SYM[align]); <> size - -@CLASSID wxTYPE_STYLE_DELTA - -@MACRO setX1Zero = x1 = 0; - -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeNoArg]=wxCHANGE_NOTHING,-int=0); : : /setX1Zero <> no change argument -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeFam],SYM[family]); <> family -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeStyle],SYM[style]); <> style -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeWeight],SYM[weight]); <> weight -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeSmoothing],SYM[smoothing]); <> smoothing -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeUnderline],bool); <> underline -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeSizeInPixels],bool); <> size in pixels -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeSize],rint[0|255]); <> size -@ "set-delta" : wxStyleDelta! SetDelta(SYM[changeAlign],SYM[align]); <> size - -@ "set-delta-face" : wxStyleDelta! SetDeltaFace(string,SYM[family]=wxDEFAULT); -@ "set-delta-background" : wxStyleDelta! SetDeltaBackground(string); <> color name -@ "set-delta-background" : wxStyleDelta! SetDeltaBackground(wxColour!); <> colour% -@ "set-delta-foreground" : wxStyleDelta! SetDeltaForeground(string); <> color name -@ "set-delta-foreground" : wxStyleDelta! SetDeltaForeground(wxColour!); <> colour% - -@ "equal?" : bool Equal(wxStyleDelta!); -@ "collapse" : bool Collapse(wxStyleDelta!); -@ "copy" : void Copy(wxStyleDelta!); - -@END - - -@CLASSBASE wxStyle "style" : "object" / nofnl -@INTERFACE "style" - -@CLASSID wxTYPE_STYLE - -@ "get-name" : string GetName(); -@ "get-family" : SYM[family] GetFamily(); -@ "get-face" : nstring GetFace(); -@ "get-size" : int GetSize(); -@ "get-weight" : SYM[weight] GetWeight(); -@ "get-style" : SYM[style] GetStyle(); -@ "get-smoothing" : SYM[smoothing] GetSmoothing(); -@ "get-underlined" : bool GetUnderlined(); -@ "get-size-in-pixels" : bool GetSizeInPixels(); -@ "get-font" : wxFont! GetFont(); -@ "get-foreground" : wxColour! GetForeground(); -@ "get-background" : wxColour! GetBackground(); -@ "get-alignment" : SYM[align] GetAlignment(); -@ "get-transparent-text-backing" : bool GetTransparentTextBacking(); - -@ "get-text-height" : double GetTextHeight(wxDC!); -@ "get-text-descent" : double GetTextDescent(wxDC!); -@ "get-text-space" : double GetTextSpace(wxDC!); -@ "get-text-width" : double GetTextWidth(wxDC!); - -@ "get-base-style" : wxStyle^ GetBaseStyle(); -@ "set-base-style" : void SetBaseStyle(wxStyle!); - -@ "get-delta" : void GetDelta(wxStyleDelta!); -@ "set-delta" : void SetDelta(wxStyleDelta!); - -@ "is-join?" : bool IsJoin(); - -@ "get-shift-style" : wxStyle^ GetShiftStyle(); -@ "set-shift-style" : void SetShiftStyle(wxStyle!); - -@ "switch-to" : void SwitchTo(wxDC!, wxStyle^); : : /CHECKDCOK[0.METHODNAME("style%","switch-to")] - -@END - - -@CLASSBASE wxStyleList "style-list" : "object" / nofnl - -@CREATOR (); - -@CLASSID wxTYPE_STYLE_LIST - -// @ "clear" : void Clear(); -// @ "copy" : void Copy(wxStyleList!); - -@ "basic-style" : wxStyle! BasicStyle(); - -@ "number" : int Number(); - -@ "find-or-create-style" : wxStyle! FindOrCreateStyle(wxStyle^,wxStyleDelta!); -@ "find-or-create-join-style" : wxStyle! FindOrCreateJoinStyle(wxStyle^,wxStyle!); -@ "find-named-style" : wxStyle^ FindNamedStyle(string); -@ "new-named-style" : wxStyle! NewNamedStyle(string,wxStyle!); -@ "replace-named-style" : wxStyle! ReplaceNamedStyle(string,wxStyle!); - -@ "convert" : wxStyle! Convert(wxStyle!); - -@MACRO bNegAsFalse = (({x} < 0) ? scheme_false : scheme_make_integer({x})) - -@ "index-to-style" : wxStyle^ IndexToStyle(nnint); -@ "style-to-index" : int/bNegAsFalse StyleToIndex(wxStyle!); - -static void NotifyCallbackToScheme(wxStyle *, Scheme_Object *f); - -@MACRO ubCallback = (wxStyleNotifyFunc)NotifyCallbackToScheme -@MACRO ubData = (scheme_check_proc_arity(METHODNAME("style-list%","notify-on-change"), 1, POFFSET, 0, p), p[POFFSET]) -@MACRO spCallback = (wxStyle-object-or-#f -> void) - -@MACRO bAnythingFromLong = ((Scheme_Object *){x}) -@MACRO ubAnythingToLong = ((void *){x}) -@MACRO cAnything = 1 - -@ "notify-on-change" : void[]/bAnythingFromLong NotifyOnChange(wxStyleNotifyFunc//ubCallback///spCallback/nopush,-unknown#void*//ubData) -@ "forget-notification" : void ForgetNotification(void[]//ubAnythingToLong/cAnything///push) - -@END - -static void NotifyCallbackToScheme(wxStyle *s, Scheme_Object *f) -{ - Scheme_Object *p[1]; - SETUP_VAR_STACK(1); - VAR_STACK_PUSH(0, f); - - p[0] = NULL; - - p[0] = s ? WITH_VAR_STACK(objscheme_bundle_wxStyle(s)) : scheme_false; - - WITH_VAR_STACK(scheme_apply_multi(f, 1, p)); - - READY_TO_RETURN; -} - -static wxStyleList* wxGetTheStyleList() -{ - return wxTheStyleList; -} - -@GLOBAL wxGlobalStyleList -@ "get-the-style-list" : wxStyleList! wxGetTheStyleList() -@END diff --git a/src/mred/wxs/wxscheme.cxx b/src/mred/wxs/wxscheme.cxx index 4168f8f063..3ff2404a1f 100644 --- a/src/mred/wxs/wxscheme.cxx +++ b/src/mred/wxs/wxscheme.cxx @@ -8,12 +8,14 @@ #define Uses_XLib // Xt #include "common.h" // wxWindows -#include "wx_media.h" #include "wx_win.h" #include "wxscheme.h" #include "wx_main.h" #include "wx_dcps.h" +#include "wx_canvs.h" #include "wx_clipb.h" +#include "wx_print.h" +#include "wx_dcmem.h" #include "mrdispatch.h" #include "wxsmred.h" @@ -27,9 +29,6 @@ #include "wxs_chce.h" #include "wxs_evnt.h" #include "wxs_panl.h" -#include "wxs_madm.h" -#include "wxs_mio.h" -#include "wxs_styl.h" #include "wxs_menu.h" #include "wxs_bmap.h" #include "wxs_misc.h" @@ -46,10 +45,6 @@ #include "wxs_dc.h" #include "wxs_cnvs.h" #include "wxs_misc.h" -#include "wxs_medi.h" -#include "wxs_mede.h" -#include "wxs_mpb.h" -#include "wxs_snip.h" #ifdef wx_msw # include "wx_pdf.h" @@ -124,8 +119,6 @@ static Scheme_Object *get_file, *put_file, *get_ps_setup_from_user, *message_box static Scheme_Object *executer; -static Scheme_Object *make_media_edit, *make_media_pasteboard, *make_media_snip, *none_symbol; - static Scheme_Object *wait_symbol; static Scheme_Object *mono_symbol, *all_symbol; @@ -1669,82 +1662,6 @@ static Scheme_Object *wxPlaySound(int argc, Scheme_Object **argv) /* constructor hooks */ /***********************************************************************/ -wxMediaSnip *wxsMakeMediaSnip(wxMediaBuffer *useme, - Bool border, - int lm, int tm, int rm, int bm, - int li, int ti, int ri, int bi, - double w, double W, double h, double H) -{ - if (make_media_snip) { - Scheme_Object *a[20], *r; - - a[0] = (useme ? objscheme_bundle_wxMediaBuffer(useme) : scheme_false); - a[1] = (border ? scheme_true : scheme_false); - a[2] = scheme_make_integer(lm); - a[3] = scheme_make_integer(tm); - a[4] = scheme_make_integer(rm); - a[5] = scheme_make_integer(bm); - a[6] = scheme_make_integer(li); - a[7] = scheme_make_integer(ti); - a[8] = scheme_make_integer(ri); - a[9] = scheme_make_integer(bi); - a[10] = ((w > 0) ? scheme_make_double(w) : none_symbol); - a[11] = ((W > 0) ? scheme_make_double(W) : none_symbol); - a[12] = ((h > 0) ? scheme_make_double(h) : none_symbol); - a[13] = ((H > 0) ? scheme_make_double(H) : none_symbol); - - r = scheme_apply(make_media_snip, 14, a); - - return objscheme_unbundle_wxMediaSnip(r, NULL, 0); - } else { - return new WXGC_PTRS wxMediaSnip(useme, border, - lm, tm, rm, bm, - li, ti, ri, bi, - w, W, h, H); - } -} - -wxMediaEdit *wxsMakeMediaEdit() -{ - if (make_media_edit) { - return objscheme_unbundle_wxMediaEdit(scheme_apply(make_media_edit, 0, NULL), - NULL, 0); - } else - return new WXGC_PTRS wxMediaEdit(); -} - -wxMediaPasteboard *wxsMakeMediaPasteboard() -{ - if (make_media_pasteboard) { - return objscheme_unbundle_wxMediaPasteboard(scheme_apply(make_media_pasteboard, 0, NULL), - NULL, 0); - } else - return new WXGC_PTRS wxMediaPasteboard(); -} - -static Scheme_Object *SetMediaSnipMaker(int, Scheme_Object *a[]) -{ - wxREGGLOB(make_media_snip); - wxREGGLOB(none_symbol); - make_media_snip = a[0]; - none_symbol = scheme_intern_symbol("none"); - return scheme_void; -} - -static Scheme_Object *SetMediaEditMaker(int, Scheme_Object *a[]) -{ - wxREGGLOB(make_media_edit); - make_media_edit = a[0]; - return scheme_void; -} - -static Scheme_Object *SetMediaPasteboardMaker(int, Scheme_Object *a[]) -{ - wxREGGLOB(make_media_pasteboard); - make_media_pasteboard = a[0]; - return scheme_void; -} - static Scheme_Object *is_menu; Bool wxsCheckIsPopupMenu(void *m) @@ -1772,44 +1689,6 @@ static Scheme_Object *SetDialogs(int, Scheme_Object *a[]) return scheme_void; } -static Scheme_Object *snip_class_getter, *editor_data_class_getter; - -static Scheme_Object *SetSnipClassGetter(int, Scheme_Object *a[]) -{ - wxREGGLOB(snip_class_getter); - snip_class_getter = a[0]; - return scheme_void; -} - -static Scheme_Object *SetEditorDataClassGetter(int, Scheme_Object *a[]) -{ - wxREGGLOB(editor_data_class_getter); - editor_data_class_getter = a[0]; - return scheme_void; -} - -wxSnipClass *wxGetSnipClass(const char *name) -{ - if (!snip_class_getter) - return NULL; - else { - Scheme_Object *a[1]; - a[0] = scheme_make_utf8_string(name); - return objscheme_unbundle_wxSnipClass(_scheme_apply(snip_class_getter, 1, a), NULL, 1); - } -} - -wxBufferDataClass *wxGetEditorDataClass(const char *name) -{ - if (!editor_data_class_getter) - return NULL; - else { - Scheme_Object *a[1]; - a[0] = scheme_make_utf8_string(name); - return objscheme_unbundle_wxBufferDataClass(_scheme_apply(editor_data_class_getter, 1, a), NULL, 1); - } -} - /***********************************************************************/ /* interapp hooks */ /***********************************************************************/ @@ -1872,30 +1751,6 @@ static Scheme_Object *SpecialOptionKey(int c, Scheme_Object *SCK_ARG[]) #endif } -#ifdef wx_mac -extern int wxMapCommandAsMeta; -#endif - -static Scheme_Object *MapCommandAsMetaKey(int c, Scheme_Object *SCK_ARG[]) -{ -#ifdef wx_mac - if (c) { - wxMapCommandAsMeta = SCHEME_TRUEP(p[0]); - return scheme_void; - } else { - return (wxMapCommandAsMeta - ? scheme_true - : scheme_false); - } -#else - if (c) - return scheme_void; - else - return scheme_false; -#endif -} - - static Scheme_Object *DefaultAppFileProc(int n, Scheme_Object *p[]) { if (!SCHEME_PATH_STRINGP(p[0])) @@ -2107,6 +1962,27 @@ static Scheme_Object *file_type_and_creator(int argc, Scheme_Object **argv) return NULL; } + +#ifdef wx_mac +extern void wxStartRefreshSequence(void); +extern void wxEndRefreshSequence(void); +#else +# define wxStartRefreshSequence() /* empty */ +# define wxEndRefreshSequence() /* empty */ +#endif + +static Scheme_Object *BeginRefreshSeq(int, Scheme_Object **) +{ + wxStartRefreshSequence(); + return scheme_void; +} + +static Scheme_Object *EndRefreshSeq(int, Scheme_Object **) +{ + wxEndRefreshSequence(); + return scheme_void; +} + /***********************************************************************/ /* ps-setup */ /***********************************************************************/ @@ -2142,6 +2018,130 @@ static Scheme_Object *wxSchemeCurrentPSSetup(int argc, Scheme_Object **argv) -1, CAST_SP PS_Setup_p, "ps-setup% instance", 0); } +/***********************************************************************/ +/* platform-printing */ +/***********************************************************************/ + +#ifndef wx_xt + +class wxMediaPrintout : public wxPrintout +{ +private: + void *data; + + Bool fitToPage; + + Scheme_Object *begin_doc; + Scheme_Object *has_page; + Scheme_Object *print_page; + Scheme_Object *end_doc; + +public: + wxMediaPrintout(Bool fit, + Scheme_Object *_begin_doc, + Scheme_Object *_has_page, + Scheme_Object *_print_page, + Scheme_Object *_end_doc); + + Bool HasPage(int page); + Bool OnPrintPage(int page); + Bool OnBeginDocument(int startPage, int endPage); + void OnEndDocument(); +}; + +wxMediaPrintout::wxMediaPrintout(Bool fit, + Scheme_Object *_begin_doc, + Scheme_Object *_has_page, + Scheme_Object *_print_page, + Scheme_Object *_end_doc) +: wxPrintout() +{ + fitToPage = fit; + begin_doc = _begin_doc; + has_page = _has_page; + print_page = _print_page; + end_doc = _end_doc; +} + +Bool wxMediaPrintout::HasPage(int page) +{ + Scheme_Object *v, *a[2]; + basePrinterDC *dc; + + dc = (basePrinterDC*)GetDC(); + a[0] = objscheme_bundle_basePrinterDC(dc); + a[1] = scheme_make_integer(page); + + v = scheme_apply(has_page, 2, a); + + return SCHEME_TRUEP(v); +} + +Bool wxMediaPrintout::OnPrintPage(int page) +{ + Scheme_Object *a[2]; + basePrinterDC *dc; + + dc = (basePrinterDC*)GetDC(); + + a[0] = objscheme_bundle_basePrinterDC(dc); + a[1] = scheme_make_integer(page); + + scheme_apply(print_page, 2, a); + + return TRUE; +} + +Bool wxMediaPrintout::OnBeginDocument(int startPage, int endPage) +{ + if (wxPrintout::OnBeginDocument(startPage, endPage)) { + basePrinterDC *dc; + Scheme_Object *a[1]; + dc = (basePrinterDC*)GetDC(); + a[0] = objscheme_bundle_basePrinterDC(dc); + data = scheme_apply(begin_doc, 1, a); + return TRUE; + } else + return FALSE; +} + +void wxMediaPrintout::OnEndDocument() +{ + scheme_apply(end_doc, 0, NULL); +} + +#endif + +static Scheme_Object *run_printout(int argc, Scheme_Object **argv) +{ +#ifndef wx_xt + wxWindow *parent; + wxPrinter *p; + wxPrintout *o; + int interactive, fitToPage; + + parent = (SCHEME_TRUEP(argv[0]) + ? objscheme_unbundle_wxWindow(argv[0], "run-printout", 1) + : NULL); + interactive = SCHEME_TRUEP(argv[1]); + fitToPage = SCHEME_TRUEP(argv[2]); + + p = new WXGC_PTRS wxPrinter(); + o = new WXGC_PTRS wxMediaPrintout(fitToPage, + argv[3], + argv[4], + argv[5], + argv[6]); + + p->Print(parent, o, interactive); + + DELETE_OBJ o; + DELETE_OBJ p; +#endif + + return scheme_void; +} + /***********************************************************************/ /* eventspaces */ /***********************************************************************/ @@ -2981,6 +2981,13 @@ int wxGetBoolPreference(const char *name, int *res) return 0; } +extern int wxMrEdGetDoubleTime(void); +static Scheme_Object *get_double_time(int, Scheme_Object **) { + int t; + t = wxMrEdGetDoubleTime(); + return scheme_make_integer(t); +} + /***********************************************************************/ /* strip menu codes */ /***********************************************************************/ @@ -3083,11 +3090,6 @@ static void wxScheme_Install(Scheme_Env *global_env) "special-option-key", 0, 1), global_env); - scheme_install_xc_global("map-command-as-meta-key", - scheme_make_prim_w_arity(CAST_SP MapCommandAsMetaKey, - "map-command-as-meta-key", - 0, 1), - global_env); scheme_install_xc_global("application-file-handler", scheme_make_prim_w_arity(CAST_SP ApplicationFileProc, @@ -3245,40 +3247,11 @@ static void wxScheme_Install(Scheme_Env *global_env) "set-executer", 1, 1), global_env); - - scheme_install_xc_global("set-editor-snip-maker", - scheme_make_prim_w_arity(CAST_SP SetMediaSnipMaker, - "set-editor-snip-maker", - 1, 1), - global_env); - - scheme_install_xc_global("set-text-editor-maker", - scheme_make_prim_w_arity(CAST_SP SetMediaEditMaker, - "set-text-editor-maker", - 1, 1), - global_env); - - scheme_install_xc_global("set-pasteboard-editor-maker", - scheme_make_prim_w_arity(CAST_SP SetMediaPasteboardMaker, - "set-pasteboard-editor-maker", - 1, 1), - global_env); scheme_install_xc_global("set-menu-tester", scheme_make_prim_w_arity(CAST_SP SetIsMenu, "set-menu-tester", 1, 1), global_env); - - scheme_install_xc_global("set-snip-class-getter", - scheme_make_prim_w_arity(CAST_SP SetSnipClassGetter, - "set-snip-class-getter", - 1, 1), - global_env); - scheme_install_xc_global("set-editor-data-class-getter", - scheme_make_prim_w_arity(CAST_SP SetEditorDataClassGetter, - "set-editor-data-class-getter", - 1, 1), - global_env); scheme_install_xc_global("location->window", scheme_make_prim_w_arity(CAST_SP wxsLocationToWindow, @@ -3310,6 +3283,26 @@ static void wxScheme_Install(Scheme_Env *global_env) 6, 6), global_env); + scheme_install_xc_global("begin-refresh-sequence", + scheme_make_prim_w_arity(CAST_SP BeginRefreshSeq, + "begin-refresh-sequence", + 0, 0), + global_env); + scheme_install_xc_global("end-refresh-sequence", + scheme_make_prim_w_arity(CAST_SP EndRefreshSeq, + "end-refresh-sequence", + 0, 0), + global_env); + scheme_install_xc_global("run-printout", + scheme_make_prim_w_arity(CAST_SP run_printout, + "run-printout", + 7, 7), + global_env); + scheme_install_xc_global("get-double-click-time", + scheme_make_prim_w_arity(CAST_SP get_double_time, + "get-double-click-time", + 0, 0), + global_env); #ifdef USE_GL init_gl_mgr(); @@ -3366,40 +3359,6 @@ static void wxScheme_Install(Scheme_Env *global_env) objscheme_setup_wxCanvas(global_env); objscheme_setup_wxPanel(global_env); objscheme_setup_wxDialogBox(global_env); - objscheme_setup_wxMediaGlobal(global_env); - objscheme_setup_wxMediaCanvas(global_env); - objscheme_setup_wxMediaBuffer(global_env); - objscheme_setup_wxMediaEdit(global_env); - objscheme_setup_wxMediaPasteboard(global_env); - objscheme_setup_wxSnipClass(global_env); - objscheme_setup_wxSnipClassList(global_env); - objscheme_setup_wxSnip(global_env); - objscheme_setup_wxTextSnip(global_env); - objscheme_setup_wxTabSnip(global_env); - objscheme_setup_wxImageSnip(global_env); - objscheme_setup_wxMediaSnip(global_env); - objscheme_setup_wxSnipAdmin(global_env); - objscheme_setup_wxMediaAdmin(global_env); - // objscheme_setup_wxCanvasMediaAdmin(global_env); - objscheme_setup_wxMediaSnipMediaAdmin(global_env); - objscheme_setup_wxBufferData(global_env); - objscheme_setup_wxBufferDataClass(global_env); - objscheme_setup_wxBufferDataClassList(global_env); - objscheme_setup_wxKeymap(global_env); - objscheme_setup_wxMediaStreamInBase(global_env); - objscheme_setup_wxMediaStreamOutBase(global_env); - objscheme_setup_wxMediaStreamInStringBase(global_env); - objscheme_setup_wxMediaStreamOutStringBase(global_env); - objscheme_setup_wxMediaStreamIn(global_env); - objscheme_setup_wxMediaStreamOut(global_env); - objscheme_setup_wxMediaWordbreakMap(global_env); - objscheme_setup_wxGlobalMediaWordbreakMap(global_env); - objscheme_setup_wxAddColour(global_env); - objscheme_setup_wxMultColour(global_env); - objscheme_setup_wxStyleDelta(global_env); - objscheme_setup_wxStyle(global_env); - objscheme_setup_wxStyleList(global_env); - objscheme_setup_wxGlobalStyleList(global_env); #if 0 objscheme_setup_baseMetaFile(global_env); objscheme_setup_baseMetaFileDC(global_env); diff --git a/src/mzscheme/configure.ac b/src/mzscheme/configure.ac index 87af1f2b53..c4983db75e 100644 --- a/src/mzscheme/configure.ac +++ b/src/mzscheme/configure.ac @@ -1452,7 +1452,7 @@ if test "${enable_mred}" = "yes" ; then makefiles="$makefiles mred/Makefile - mred/wxs/Makefile mred/wxme/Makefile + mred/wxs/Makefile mred/gc2/Makefile" if test "${enable_libpng}" != "yes" ; then diff --git a/src/mzscheme/src/env.c b/src/mzscheme/src/env.c index 42999c5960..cb9819e962 100644 --- a/src/mzscheme/src/env.c +++ b/src/mzscheme/src/env.c @@ -721,7 +721,7 @@ Scheme_Env *make_empty_inited_env(int toplevel_size) env = make_env(NULL, toplevel_size); - vector = scheme_make_vector(3, scheme_false); + vector = scheme_make_vector(5, scheme_false); hash_table = scheme_make_hash_table(SCHEME_hash_ptr); SCHEME_VEC_ELS(vector)[0] = (Scheme_Object *)hash_table; env->modchain = vector; @@ -793,11 +793,17 @@ scheme_new_module_env(Scheme_Env *env, Scheme_Module *m, int new_exp_module_tree Scheme_Hash_Table *modules; modules = scheme_make_hash_table(SCHEME_hash_ptr); - p = scheme_make_vector(3, scheme_false); + p = scheme_make_vector(5, scheme_false); SCHEME_VEC_ELS(p)[0] = (Scheme_Object *)modules; menv->modchain = p; } + if (SAME_OBJ(env, env->exp_env)) { + /* label phase */ + menv->exp_env = menv; + menv->template_env = menv; + } + return menv; } @@ -823,7 +829,7 @@ void scheme_prepare_exp_env(Scheme_Env *env) Scheme_Hash_Table *next_modules; next_modules = scheme_make_hash_table(SCHEME_hash_ptr); - modchain = scheme_make_vector(3, scheme_false); + modchain = scheme_make_vector(5, scheme_false); SCHEME_VEC_ELS(modchain)[0] = (Scheme_Object *)next_modules; SCHEME_VEC_ELS(env->modchain)[1] = modchain; SCHEME_VEC_ELS(modchain)[2] = env->modchain; @@ -864,7 +870,7 @@ void scheme_prepare_template_env(Scheme_Env *env) Scheme_Hash_Table *prev_modules; prev_modules = scheme_make_hash_table(SCHEME_hash_ptr); - modchain = scheme_make_vector(3, scheme_false); + modchain = scheme_make_vector(5, scheme_false); SCHEME_VEC_ELS(modchain)[0] = (Scheme_Object *)prev_modules; SCHEME_VEC_ELS(env->modchain)[2] = modchain; SCHEME_VEC_ELS(modchain)[1] = env->modchain; @@ -899,7 +905,7 @@ void scheme_prepare_label_env(Scheme_Env *env) lenv->export_registry = env->export_registry; lenv->insp = env->insp; - modchain = scheme_make_vector(3, scheme_false); + modchain = scheme_make_vector(5, scheme_false); prev_modules = scheme_make_hash_table(SCHEME_hash_ptr); SCHEME_VEC_ELS(modchain)[0] = (Scheme_Object *)prev_modules; SCHEME_VEC_ELS(modchain)[2] = modchain; @@ -914,11 +920,12 @@ void scheme_prepare_label_env(Scheme_Env *env) } } -Scheme_Env *scheme_clone_module_env(Scheme_Env *menv, Scheme_Env *ns, Scheme_Object *modchain) +Scheme_Env *scheme_copy_module_env(Scheme_Env *menv, Scheme_Env *ns, Scheme_Object *modchain, int clone_phase) { /* New env should have the same syntax and globals table, but it lives in a different namespace. */ Scheme_Env *menv2; + Scheme_Bucket_Table *bucket_table; scheme_prepare_label_env(ns); @@ -930,43 +937,62 @@ Scheme_Env *scheme_clone_module_env(Scheme_Env *menv, Scheme_Env *ns, Scheme_Obj menv2->export_registry = ns->export_registry; menv2->insp = menv->insp; - menv2->syntax = menv->syntax; + if (menv->phase < clone_phase) + menv2->syntax = menv->syntax; + else { + bucket_table = scheme_make_bucket_table(7, SCHEME_hash_ptr); + menv2->syntax = bucket_table; + } menv2->phase = menv->phase; menv2->mod_phase = menv->mod_phase; menv2->link_midx = menv->link_midx; - menv2->running = menv->running; - menv2->et_running = menv->et_running; - menv2->et_ran = menv->et_ran; - menv2->ran = menv->ran; + if (menv->phase <= clone_phase) { + menv2->running = menv->running; + menv2->ran = menv->ran; + } + if (menv->phase < clone_phase) + menv2->et_running = menv->et_running; menv2->require_names = menv->require_names; menv2->et_require_names = menv->et_require_names; - menv2->toplevel = menv->toplevel; + if (menv->phase <= clone_phase) { + menv2->toplevel = menv->toplevel; + } else { + bucket_table = scheme_make_bucket_table(7, SCHEME_hash_ptr); + menv2->toplevel = bucket_table; + menv2->toplevel->with_home = 1; + } menv2->modchain = modchain; - if (!SCHEME_NULLP(menv2->module->et_requires)) { - /* We'll need the next link in the modchain: */ - modchain = SCHEME_VEC_ELS(modchain)[1]; - if (SCHEME_FALSEP(modchain)) { - Scheme_Hash_Table *next_modules; + if (SAME_OBJ(menv->exp_env, menv)) { + /* label phase */ + menv2->exp_env = menv2; + menv2->template_env = menv2; + } else if (menv->phase < clone_phase) { + if (!SCHEME_NULLP(menv2->module->et_requires)) { + /* We'll need the next link in the modchain: */ + modchain = SCHEME_VEC_ELS(modchain)[1]; + if (SCHEME_FALSEP(modchain)) { + Scheme_Hash_Table *next_modules; - next_modules = scheme_make_hash_table(SCHEME_hash_ptr); - modchain = scheme_make_vector(3, scheme_false); - SCHEME_VEC_ELS(modchain)[0] = (Scheme_Object *)next_modules; - SCHEME_VEC_ELS(menv2->modchain)[1] = modchain; - SCHEME_VEC_ELS(modchain)[2] = menv2->modchain; + next_modules = scheme_make_hash_table(SCHEME_hash_ptr); + modchain = scheme_make_vector(5, scheme_false); + SCHEME_VEC_ELS(modchain)[0] = (Scheme_Object *)next_modules; + SCHEME_VEC_ELS(menv2->modchain)[1] = modchain; + SCHEME_VEC_ELS(modchain)[2] = menv2->modchain; + } + } + + if (menv->exp_env) { + /* Share for-syntax bindings, too: */ + scheme_prepare_exp_env(menv2); + menv2->exp_env->toplevel = menv->exp_env->toplevel; } } - - if (menv->exp_env) { - /* Share for-syntax bindings, too: */ - scheme_prepare_exp_env(menv2); - menv2->exp_env->toplevel = menv->exp_env->toplevel; - } - + scheme_prepare_label_env(ns); menv2->label_env = ns->label_env; @@ -3930,6 +3956,7 @@ namespace_variable_value(int argc, Scheme_Object *argv[]) Scheme_Full_Comp_Env inlined_e; scheme_prepare_env_renames(genv, mzMOD_RENAME_TOPLEVEL); + scheme_prepare_compile_env(genv); id = scheme_make_renamed_stx(argv[0], genv->rename_set); diff --git a/src/mzscheme/src/error.c b/src/mzscheme/src/error.c index e74d9ad92b..1450a85917 100644 --- a/src/mzscheme/src/error.c +++ b/src/mzscheme/src/error.c @@ -1899,17 +1899,25 @@ void scheme_unbound_global(Scheme_Bucket *b) if (((Scheme_Bucket_With_Home *)b)->home->module) { const char *errmsg; + char *phase, phase_buf[20]; if (SCHEME_TRUEP(scheme_get_param(scheme_current_config(), MZCONFIG_ERROR_PRINT_SRCLOC))) - errmsg = "reference to an identifier before its definition: %S in module: %D"; + errmsg = "reference to an identifier before its definition: %S in module: %D%s"; else - errmsg = "reference to an identifier before its definition: %S"; + errmsg = "reference to an identifier before its definition: %S%s"; + + if (SCHEME_INT_VAL(((Scheme_Bucket_With_Home *)b)->home->phase)) { + sprintf(phase_buf, " phase: %ld", SCHEME_INT_VAL(((Scheme_Bucket_With_Home *)b)->home->phase)); + phase = phase_buf; + } else + phase = ""; scheme_raise_exn(MZEXN_FAIL_CONTRACT_VARIABLE, name, errmsg, name, - ((Scheme_Bucket_With_Home *)b)->home->module->modname); + ((Scheme_Bucket_With_Home *)b)->home->module->modname, + phase); } else { scheme_raise_exn(MZEXN_FAIL_CONTRACT_VARIABLE, name, diff --git a/src/mzscheme/src/eval.c b/src/mzscheme/src/eval.c index 9efc9e879a..d007463d37 100644 --- a/src/mzscheme/src/eval.c +++ b/src/mzscheme/src/eval.c @@ -4976,6 +4976,8 @@ static void *compile_k(void) } while (1) { + scheme_prepare_compile_env(genv); + rec.comp = 1; rec.dont_mark_local_use = 0; rec.resolve_module_ids = !writeable && !genv->module; @@ -6548,6 +6550,7 @@ scheme_compile_expand_block(Scheme_Object *forms, Scheme_Comp_Env *env, if (!is_val) { /* Evaluate and bind syntaxes */ scheme_prepare_exp_env(new_env->genv); + scheme_prepare_compile_env(new_env->genv->exp_env); pos = 0; expr = scheme_add_rename_rib(expr, rib); scheme_bind_syntaxes("local syntax definition", @@ -8949,6 +8952,8 @@ static void *expand_k(void) } else ip = NULL; + scheme_prepare_compile_env(env->genv); + /* Loop for lifted expressions: */ while (1) { erec1.comp = 0; @@ -9289,6 +9294,7 @@ do_local_expand(const char *name, int for_stx, int catch_lifts, int for_expr, in env = scheme_new_comp_env(env->genv->exp_env, env->insp, 0); scheme_propagate_require_lift_capture(orig_env, env); } + scheme_prepare_compile_env(env->genv); if (for_expr) kind = 0; /* expression */ @@ -9848,6 +9854,7 @@ local_eval(int argc, Scheme_Object **argv) expr = scheme_add_remove_mark(expr, scheme_current_thread->current_local_mark); scheme_prepare_exp_env(stx_env->genv); + scheme_prepare_compile_env(stx_env->genv->exp_env); pos = 0; expr = scheme_add_rename_rib(expr, rib); scheme_bind_syntaxes("local syntax definition", names, expr, diff --git a/src/mzscheme/src/module.c b/src/mzscheme/src/module.c index 9b8a595c3c..2dc67e932c 100644 --- a/src/mzscheme/src/module.c +++ b/src/mzscheme/src/module.c @@ -111,6 +111,9 @@ static Scheme_Object *read_module(Scheme_Object *obj); static Scheme_Module *module_load(Scheme_Object *modname, Scheme_Env *env, const char *who); +static void run_module(Scheme_Env *menv, int set_ns); +static void run_module_exptime(Scheme_Env *menv, int set_ns); + static void eval_exptime(Scheme_Object *names, int count, Scheme_Object *expr, Scheme_Env *genv, Scheme_Comp_Env *env, @@ -192,6 +195,8 @@ static Scheme_Bucket_Table *initial_toplevel; static Scheme_Object *empty_self_modidx; static Scheme_Object *empty_self_modname; +static Scheme_Bucket_Table *starts_table; + static THREAD_LOCAL Scheme_Modidx *modidx_caching_chain; static THREAD_LOCAL Scheme_Object *global_shift_cache; #define GLOBAL_SHIFT_CACHE_SIZE 40 @@ -220,7 +225,8 @@ static void parse_requires(Scheme_Object *form, Scheme_Object *rns, Scheme_Object *post_ex_rns, Check_Func ck, void *data, Scheme_Object *redef_modname, - int unpack_kern, int copy_vars, int can_save_marshal, int always_run, + int unpack_kern, int copy_vars, int can_save_marshal, + int eval_exp, int eval_run, int *all_simple); static void parse_provides(Scheme_Object *form, Scheme_Object *fst, Scheme_Object *e, Scheme_Hash_Table *all_provided, @@ -254,10 +260,7 @@ static Scheme_Object **compute_indirects(Scheme_Env *genv, int vars); static void start_module(Scheme_Module *m, Scheme_Env *env, int restart, Scheme_Object *syntax_idx, int eval_exp, int eval_run, long base_phase, Scheme_Object *cycle_list); -static void finish_expstart_module(Scheme_Env *menv); -static void finish_expstart_module_in_namespace(Scheme_Env *menv, Scheme_Env *env); -static void finish_start_module_in_namespace(Scheme_Env *menv, Scheme_Env *env, int eval_run); -static void eval_module_body(Scheme_Env *menv); +static void eval_module_body(Scheme_Env *menv, Scheme_Env *env); static Scheme_Object *do_namespace_require(Scheme_Env *env, int argc, Scheme_Object *argv[], int copy, int etonly); @@ -269,6 +272,7 @@ static void qsort_provides(Scheme_Object **exs, Scheme_Object **exsns, Scheme_Ob int start, int count, int do_uninterned); #define MODCHAIN_TABLE(p) ((Scheme_Hash_Table *)(SCHEME_VEC_ELS(p)[0])) +#define MODCHAIN_AVAIL(p, n) (SCHEME_VEC_ELS(p)[3+n]) /**********************************************************************/ /* initialization */ @@ -367,6 +371,9 @@ void scheme_init_module(Scheme_Env *env) GLOBAL_PRIM_W_ARITY("module->namespace", module_to_namespace, 1, 1, env); GLOBAL_PRIM_W_ARITY("module->language-info", module_to_lang_info, 1, 1, env); GLOBAL_PRIM_W_ARITY("module-path?", is_module_path, 1, 1, env); + + REGISTER_SO(starts_table); + starts_table = scheme_make_weak_equal_table(); } void scheme_init_module_resolver(void) @@ -449,9 +456,6 @@ void scheme_finish_kernel(Scheme_Env *env) } } - kernel->functional = 1; - kernel->et_functional = 1; - kernel->tt_functional = 1; kernel->no_cert = 1; { @@ -844,11 +848,10 @@ static Scheme_Object *_dynamic_require(int argc, Scheme_Object *argv[], lookup_env = env->exp_env; else env = env->exp_env; - } else if (phase == -1) { - scheme_prepare_template_env(env); - env = env->template_env; } + scheme_prepare_compile_env(env); + m = module_load(modname, env, errname); srcm = m; @@ -1014,7 +1017,7 @@ static Scheme_Object *_dynamic_require(int argc, Scheme_Object *argv[], else { if (!b->val) { if (!menv->ran) - scheme_run_module(menv, 1); + run_module(menv, 1); } if (!b->val && fail_with_error) { if (fail_thunk) @@ -1062,7 +1065,8 @@ static Scheme_Object *do_namespace_require(Scheme_Env *env, int argc, Scheme_Obj rns, NULL, NULL /* ck */, NULL /* data */, NULL, - 1, copy, 0, !etonly, + 1, copy, 0, + etonly ? 1 : -1, !etonly, NULL); scheme_append_rename_set_to_env(rns, env); @@ -1154,6 +1158,36 @@ static void set_at_depth(Scheme_Object *l, Scheme_Object *n, Scheme_Object *v) SCHEME_CAR(l) = v; } +#if 0 +static void check_phase(Scheme_Env *menv, Scheme_Env *env, int phase) +{ + if (env && (env->exp_env == env)) { + /* label phase */ + return; + } + + if (!menv->module->primitive + && ((env && (menv->phase != env->phase)) + || (!env && (menv->phase != phase)))) { + fprintf(stderr, "phase mismatch\n"); + } +} + +static void check_modchain_consistency(Scheme_Hash_Table *ht, int phase) +{ + int i; + + for (i = ht->size; i--; ) { + if (ht->vals[i]) { + check_phase((Scheme_Env *)ht->vals[i], NULL, phase); + } + } +} +#else +static void check_phase(Scheme_Env *menv, Scheme_Env *env, int phase) { } +static void check_modchain_consistency(Scheme_Hash_Table *ht, int phase) { } +#endif + #if 0 # define LOG_ATTACH(x) (x, fflush(stdout)) #else @@ -1169,7 +1203,7 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) Scheme_Hash_Table *checked, *next_checked, *prev_checked; Scheme_Object *past_checkeds, *future_checkeds, *future_todos, *past_to_modchains, *past_todos; Scheme_Module *m2; - int same_namespace, set_env_for_notify = 0, phase, max_phase, first_iteration; + int same_namespace, set_env_for_notify = 0, phase, orig_phase, max_phase, first_iteration; int just_declare; Scheme_Object *nophase_todo; Scheme_Hash_Table *nophase_checked; @@ -1204,6 +1238,7 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) from_modchain = from_env->modchain; to_modchain = to_env->modchain; phase = from_env->phase; + orig_phase = phase; checked = NULL; next_checked = NULL; @@ -1271,14 +1306,7 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) name); } - if (first_iteration) { - /* Run everything */ - first_iteration = 0; - finish_start_module_in_namespace(menv, from_env, 1); - } - - - /* If to_modchain goes to #f, then our source check has gone + /* If to_modchain goes to #f, then our source check has gone deeper in phases (for-syntax levels) than the target namespace has ever gone, so there's definitely no conflict at this level in that case. */ @@ -1294,6 +1322,11 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) if (m2 && SAME_OBJ(m2, menv->module)) m2 = NULL; } + + if (m2 && (phase > orig_phase) && SAME_OBJ(menv->module, m2)) { + /* different instance of same module is ok at higher phases */ + m2 = NULL; + } if (m2) { char *phase, buf[32], *kind; @@ -1335,17 +1368,7 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) l = SCHEME_CDR(l); } - /* Have to force laziness in source to ensure sharing. This - should be redundant, since we called start_module() for the - inital module, but we keep it just in case... */ - if (phase >= 0) { - if (!menv->ran) - scheme_run_module(menv, 1); - if (menv->lazy_syntax) - finish_expstart_module_in_namespace(menv, from_env); - if (!menv->et_ran) - scheme_run_module_exptime(menv, 1); - } + /* was here */ l = menv->et_require_names; while (!SCHEME_NULLP(l)) { @@ -1602,7 +1625,8 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) scheme_hash_set(to_env->module_registry, name, (Scheme_Object *)m2); menv = (Scheme_Env *)scheme_hash_get(MODCHAIN_TABLE(from_env->label_env->modchain), name); - menv2 = scheme_clone_module_env(menv, to_env->label_env, to_env->label_env->modchain); + menv2 = scheme_copy_module_env(menv, to_env->label_env, to_env->label_env->modchain, menv->phase + 1); + check_phase(menv2, to_env->label_env, 0); scheme_hash_set(MODCHAIN_TABLE(to_env->label_env->modchain), name, (Scheme_Object *)menv2); if (menv->attached) @@ -1641,6 +1665,9 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) LOG_ATTACH(printf("Copying %d (%p)\n", phase, checked)); + if (phase >= 0) + check_modchain_consistency(MODCHAIN_TABLE(to_modchain), phase); + for (i = checked->size; i--; ) { if (checked->vals[i]) { name = checked->keys[i]; @@ -1653,12 +1680,13 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) menv2 = (Scheme_Env *)scheme_hash_get(MODCHAIN_TABLE(to_modchain), name); if (!menv2) { - /* Clone menv for the new namespace: */ + /* Clone/copy menv for the new namespace: */ if ((phase >= 0) && !just_declare) { - menv2 = scheme_clone_module_env(menv, to_env, to_modchain); + menv2 = scheme_copy_module_env(menv, to_env, to_modchain, orig_phase); if (menv->attached) menv2->attached = 1; + check_phase(menv2, NULL, phase); scheme_hash_set(MODCHAIN_TABLE(to_modchain), name, (Scheme_Object *)menv2); } scheme_hash_set(to_env->module_registry, name, (Scheme_Object *)menv->module); @@ -1675,7 +1703,7 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[]) past_checkeds = SCHEME_CDR(past_checkeds); from_modchain = SCHEME_VEC_ELS(from_modchain)[2]; if (phase > 0) - to_modchain = SCHEME_VEC_ELS(to_modchain)[2]; + to_modchain = SCHEME_VEC_ELS(to_modchain)[2]; --phase; } @@ -2337,10 +2365,6 @@ static int add_simple_require_renames(Scheme_Object *orig_src, void scheme_prep_namespace_rename(Scheme_Env *menv) { - if (menv->lazy_syntax) - finish_expstart_module_in_namespace(menv, menv /* was just env... */); - if (!menv->et_ran) - scheme_run_module_exptime(menv, 1); scheme_prepare_exp_env(menv); if (!menv->rename_set_ready) { @@ -3494,11 +3518,6 @@ Scheme_Object *scheme_module_syntax(Scheme_Object *modname, Scheme_Env *env, Sch if (!menv) return NULL; - if (menv->lazy_syntax) - finish_expstart_module_in_namespace(menv, env); - if (!menv->et_ran) - scheme_run_module_exptime(menv, 1); - name = scheme_tl_id_sym(menv, name, NULL, 0, NULL, NULL); val = scheme_lookup_in_table(menv->syntax, (char *)name); @@ -3509,54 +3528,74 @@ Scheme_Object *scheme_module_syntax(Scheme_Object *modname, Scheme_Env *env, Sch void scheme_module_force_lazy(Scheme_Env *env, int previous) { - Scheme_Object *modchain; - Scheme_Hash_Table *mht; - int mi; + /* not anymore */ +} - modchain = env->modchain; +XFORM_NONGCING static long make_key(int base_phase, int eval_exp, int eval_run) +{ + return ((base_phase << 3) + | (eval_exp ? ((eval_exp > 0) ? 2 : 4) : 0) + | (eval_run ? 1 : 0)); +} - if (previous) - modchain = SCHEME_VEC_ELS(modchain)[2]; - - mht = MODCHAIN_TABLE(modchain); +static int did_start(Scheme_Object *v, int base_phase, int eval_exp, int eval_run) +{ + long key; + + key = make_key(base_phase, eval_exp, eval_run); + + if (!v) + return 0; + + if (scheme_hash_tree_get((Scheme_Hash_Tree *)v, scheme_make_integer(key))) + return 1; + + return 0; +} + +static Scheme_Object *add_start(Scheme_Object *v, int base_phase, int eval_exp, int eval_run) +{ + long key; + Scheme_Hash_Tree *ht = (Scheme_Hash_Tree *)v; + Scheme_Bucket *b; + + if (!ht) + ht = scheme_make_hash_tree(0); + + key = make_key(base_phase, eval_exp, eval_run); + + ht = scheme_hash_tree_set(ht, scheme_make_integer(key), scheme_true); - for (mi = mht->size; mi--; ) { - if (mht->vals[mi]) { - /* Check this module for lazy syntax. */ - Scheme_Env *menv = (Scheme_Env *)mht->vals[mi]; - - if (menv->lazy_syntax) - finish_expstart_module_in_namespace(menv, NULL); - if (!menv->et_ran) - scheme_run_module_exptime(menv, 1); - } - } + b = scheme_bucket_from_table(starts_table, (const char *)ht); + if (!b->val) + b->val = scheme_true; + return (Scheme_Object *)HT_EXTRACT_WEAK(b->key); } #if 0 static int indent = 0; -static void show(const char *what, Scheme_Env *menv, int v1, int v2) +# define show_indent(d) (indent += d) +static void show(const char *what, Scheme_Env *menv, int v1, int v2, int base_phase) { + if (menv->phase > 3) return; if (1 || SCHEME_SYMBOLP(SCHEME_PTR_VAL(menv->module->modname))) if (1 || SCHEME_SYM_VAL(SCHEME_PTR_VAL(menv->module->modname))[0] != '#') { int i; for (i = 0; i < indent; i++) { fprintf(stderr, " "); } - fprintf(stderr, "%s \t%s @%ld [%d/%d] %p\n", + fprintf(stderr, "%s \t%s @%ld/%d [%d/%d] %p\n", what, scheme_write_to_string(menv->module->modname, NULL), - menv->phase, v1, v2, menv->modchain); - indent++; + menv->phase, base_phase, v1, v2, menv->modchain); } } -static void show_done(const char *what, Scheme_Env *menv, int v1, int v2){ - --indent; - show(what, menv, v1, v2); - --indent; +static void show_done(const char *what, Scheme_Env *menv, int v1, int v2, int base_phase){ + show(what, menv, v1, v2, base_phase); } #else -# define show(w, m, v1, v2) /* nothing */ -# define show_done(w, m, v1, v2) /* nothing */ +# define show_indent(d) /* nothing */ +# define show(w, m, v1, v2, bp) /* nothing */ +# define show_done(w, m, v1, v2, bp) /* nothing */ #endif static void compute_require_names(Scheme_Env *menv, Scheme_Object *phase, @@ -3632,18 +3671,6 @@ static void chain_start_module(Scheme_Env *menv, Scheme_Env *env, int eval_exp, Scheme_Object *new_cycle_list, *midx, *l; Scheme_Module *im; - if ((menv->did_eval_exp >= eval_exp + 1) - && (menv->did_eval_run >= eval_run + 1) - && menv->did_compute) - return; - - if (menv->did_eval_exp < eval_exp + 1) - menv->did_eval_exp = eval_exp + 1; - if (menv->did_eval_run < eval_run + 1) - menv->did_eval_run = eval_run + 1; - if (!menv->did_compute) - menv->did_compute = 1; - new_cycle_list = scheme_make_pair(menv->module->modname, cycle_list); if (!SCHEME_NULLP(menv->module->dt_requires)) { @@ -3774,6 +3801,7 @@ static Scheme_Env *instantiate_module(Scheme_Module *m, Scheme_Env *env, int res if (!restart) { menv = (Scheme_Env *)scheme_hash_get(MODCHAIN_TABLE(env->modchain), m->modname); if (menv) { + check_phase(menv, env, 0); return menv; } } @@ -3815,7 +3843,6 @@ static Scheme_Env *instantiate_module(Scheme_Module *m, Scheme_Env *env, int res menv->module = m; menv->running = 0; menv->et_running = 0; - menv->et_ran = 0; menv->ran = 0; } @@ -3848,54 +3875,26 @@ static Scheme_Env *instantiate_module(Scheme_Module *m, Scheme_Env *env, int res return menv; } -static void expstart_module(Scheme_Env *menv, Scheme_Env *env, int restart, - int eval_exp, int eval_run, long base_phase) +static void expstart_module(Scheme_Env *menv, Scheme_Env *env, int restart) { - int delay_run = ((!eval_exp && (menv->phase >= base_phase)) - || (!eval_run && (menv->phase < base_phase))); - if (!restart) { - if (menv && menv->et_running) { - /* show("chck", menv, with_tt); */ - if (menv->lazy_syntax && !delay_run) - finish_expstart_module(menv); + if (menv && menv->et_running) return; - } } - if (menv->module->primitive) { + if (menv->module->primitive) return; - } - - show("exps", menv, eval_exp, eval_run); menv->et_running = 1; if (scheme_starting_up) menv->attached = 1; /* protect initial modules from redefinition, etc. */ - if (delay_run) - menv->lazy_syntax = 1; - else - finish_expstart_module(menv); - - show_done("exp!", menv, eval_exp, eval_run); + run_module_exptime(menv, 0); return; } -static void finish_expstart_module(Scheme_Env *menv) -{ - show("fins", menv, 1, 1); - - menv->lazy_syntax = 0; - - menv->et_running = 1; - scheme_run_module_exptime(menv, 0); - - show_done("fin!", menv, 1, 1); -} - -void scheme_run_module_exptime(Scheme_Env *menv, int set_ns) +static void run_module_exptime(Scheme_Env *menv, int set_ns) { int let_depth, for_stx; Scheme_Object *names, *e; @@ -3907,8 +3906,6 @@ void scheme_run_module_exptime(Scheme_Env *menv, int set_ns) Scheme_Cont_Frame_Data cframe; Scheme_Config *config; - menv->et_ran = 1; - if (menv->module->primitive) return; @@ -3922,8 +3919,6 @@ void scheme_run_module_exptime(Scheme_Env *menv, int set_ns) if (!exp_env) return; - show("rnes", menv, 1, 1); - for_stx_globals = exp_env->toplevel; if (set_ns) { @@ -3958,33 +3953,44 @@ void scheme_run_module_exptime(Scheme_Env *menv, int set_ns) if (set_ns) { scheme_pop_continuation_frame(&cframe); } - - show_done("rne!", menv, 1, 1); } -static void finish_start_module_in_namespace(Scheme_Env *menv, Scheme_Env *from_env, int eval_run) +static void do_start_module(Scheme_Module *m, Scheme_Env *menv, Scheme_Env *env, int restart) { - Scheme_Cont_Frame_Data cframe; - Scheme_Config *config; - - if (from_env) { - config = scheme_extend_config(scheme_current_config(), - MZCONFIG_ENV, - (Scheme_Object *)from_env); - - scheme_push_continuation_frame(&cframe); - scheme_set_cont_mark(scheme_parameterization_key, (Scheme_Object *)config); + if (m->primitive) { + menv->running = 1; + menv->ran = 1; + return; } - start_module(menv->module, menv, 0, NULL, 1, eval_run, menv->phase, scheme_null); + if (restart) + menv->running = 0; - if (from_env) - scheme_pop_continuation_frame(&cframe); + if (menv->running > 0) { + return; + } + + menv->running = 1; + + if (menv->module->prim_body) { + Scheme_Invoke_Proc ivk = menv->module->prim_body; + menv->ran = 1; + ivk(menv, menv->phase, menv->link_midx, m->body); + } else { + eval_module_body(menv, env); + } } -static void finish_expstart_module_in_namespace(Scheme_Env *menv, Scheme_Env *from_env) +static void should_run_for_compile(Scheme_Env *menv) { - finish_start_module_in_namespace(menv, from_env, 0); + if (!menv->available_next[0]) { + menv->available_next[0] = MODCHAIN_AVAIL(menv->modchain, 0); + MODCHAIN_AVAIL(menv->modchain, 0) = (Scheme_Object *)menv; + } + if (!menv->available_next[1]) { + menv->available_next[1] = MODCHAIN_AVAIL(menv->modchain, 1); + MODCHAIN_AVAIL(menv->modchain, 1) = (Scheme_Object *)menv; + } } static void start_module(Scheme_Module *m, Scheme_Env *env, int restart, @@ -4009,9 +4015,10 @@ static void start_module(Scheme_Module *m, Scheme_Env *env, int restart, menv = instantiate_module(m, env, restart, syntax_idx); + check_phase(menv, env, 0); + if (restart) { - menv->did_eval_run = 0; - menv->did_eval_exp = 0; + menv->did_starts = NULL; menv->require_names = NULL; menv->et_require_names = NULL; menv->tt_require_names = NULL; @@ -4019,71 +4026,103 @@ static void start_module(Scheme_Module *m, Scheme_Env *env, int restart, menv->other_require_names = NULL; } - show("strt", menv, eval_exp, eval_run); + show("chck", menv, eval_exp, eval_run, base_phase); + + if (did_start(menv->did_starts, base_phase, eval_exp, eval_run)) + return; + + show("strt", menv, eval_exp, eval_run, base_phase); + show_indent(+1); + + { + Scheme_Object *v; + v = add_start(menv->did_starts, base_phase, eval_exp, eval_run); + menv->did_starts = v; + } chain_start_module(menv, env, eval_exp, eval_run, base_phase, cycle_list, syntax_idx); if (env->phase == base_phase) { - if (!eval_run) { - expstart_module(menv, env, restart, eval_exp, eval_run, base_phase); - show_done("nrn0", menv, eval_exp, eval_run); - return; + if (eval_exp) { + if (eval_exp > 0) { + show("exp=", menv, eval_exp, eval_run, base_phase); + expstart_module(menv, env, restart); + } else { + should_run_for_compile(menv); + } + } + if (eval_run) { + show("run=", menv, eval_exp, eval_run, base_phase); + do_start_module(m, menv, env, restart); } } else if (env->phase < base_phase) { if (env->phase == base_phase - 1) { - expstart_module(menv, env, restart, eval_exp, eval_run, base_phase); + if (eval_run) { + show("run-", menv, eval_exp, eval_run, base_phase); + expstart_module(menv, env, restart); + } } - show_done("nrn-", menv, eval_exp, eval_run); - return; } else { - if (!eval_exp) { - show_done("nrn+", menv, eval_exp, eval_run); - return; + /* env->phase > base_phase */ + if (eval_exp) { + should_run_for_compile(menv); + } + if (eval_exp > 0) { + if (env->phase == base_phase + 1) { + show("run+", menv, eval_exp, eval_run, base_phase); + do_start_module(m, menv, env, restart); + } } } - expstart_module(menv, env, restart, eval_exp, eval_run, base_phase); + show_indent(-1); + show_done("done", menv, eval_exp, eval_run, base_phase); +} - if (m->primitive) { - menv->running = 1; - menv->ran = 1; - show_done("nrnp", menv, eval_exp, eval_run); - return; +static void do_prepare_compile_env(Scheme_Env *env, int base_phase, int pos) +{ + Scheme_Object *v; + Scheme_Env *menv; + + v = MODCHAIN_AVAIL(env->modchain, pos); + if (!SCHEME_FALSEP(v)) { + MODCHAIN_AVAIL(env->modchain, pos) = scheme_false; + while (SCHEME_NAMESPACEP(v)) { + menv = (Scheme_Env *)v; + v = menv->available_next[pos]; + menv->available_next[pos] = NULL; + start_module(menv->module, env, 0, + NULL, 1, 0, base_phase, + scheme_null); + } } +} - if (restart) - menv->running = 0; +void scheme_prepare_compile_env(Scheme_Env *env) +/* We're going to compile expressions at env->phase, so make sure + that env->phase is visited. */ +{ + do_prepare_compile_env(env, env->phase, 0); - if (menv->running > 0) { - show_done("nrn!", menv, eval_exp, eval_run); - return; + /* A top-level `require' can introduce in any phase with a + `for-syntax' import whose visit triggers an instantiation. + So, also check for instances at the next phase. */ + if (env->exp_env) { + do_prepare_compile_env(env->exp_env, env->phase, 1); } - - menv->running = 1; - - if (menv->module->prim_body) { - Scheme_Invoke_Proc ivk = menv->module->prim_body; - menv->ran = 1; - ivk(menv, menv->phase, menv->link_midx, m->body); - } else { - /* Could delay based on menv->module->functional, except that - the interpreter (and JIT) is not set up to force lazily filled - globals. */ - eval_module_body(menv); - } - - show_done("ran!", menv, eval_exp, eval_run); } static void *eval_module_body_k(void) { Scheme_Thread *p = scheme_current_thread; - Scheme_Env *menv; + Scheme_Env *menv, *env; menv = (Scheme_Env *)p->ku.k.p1; + env = (Scheme_Env *)p->ku.k.p2; p->ku.k.p1 = NULL; + p->ku.k.p2 = NULL; - eval_module_body(menv); + eval_module_body(menv, env); return NULL; } @@ -4100,13 +4139,15 @@ static void *eval_module_body_k(void) # define LOG_END_RUN(mod) /* empty */ #endif -static void eval_module_body(Scheme_Env *menv) +static void eval_module_body(Scheme_Env *menv, Scheme_Env *env) { Scheme_Thread *p; Scheme_Module *m = menv->module; Scheme_Object *body, **save_runstack; int depth; int i, cnt; + Scheme_Cont_Frame_Data cframe; + Scheme_Config *config; int volatile save_phase_shift; mz_jmp_buf newbuf, * volatile savebuf; LOG_RUN_DECLS; @@ -4118,6 +4159,7 @@ static void eval_module_body(Scheme_Env *menv) if (!scheme_check_runstack(depth)) { p = scheme_current_thread; p->ku.k.p1 = menv; + p->ku.k.p2 = env; (void)scheme_enlarge_runstack(depth, eval_module_body_k); return; } @@ -4141,6 +4183,15 @@ static void eval_module_body(Scheme_Env *menv) p2->current_phase_shift = save_phase_shift; scheme_longjmp(*savebuf, 1); } else { + if (env && menv->phase) { + config = scheme_extend_config(scheme_current_config(), + MZCONFIG_ENV, + (Scheme_Object *)env); + + scheme_push_continuation_frame(&cframe); + scheme_set_cont_mark(scheme_parameterization_key, (Scheme_Object *)config); + } + cnt = SCHEME_VEC_SIZE(m->body); for (i = 0; i < cnt; i++) { body = SCHEME_VEC_ELS(m->body)[i]; @@ -4163,6 +4214,10 @@ static void eval_module_body(Scheme_Env *menv) } } + if (env && menv->phase) { + scheme_pop_continuation_frame(&cframe); + } + p = scheme_current_thread; p->error_buf = savebuf; p->current_phase_shift = save_phase_shift; @@ -4173,7 +4228,7 @@ static void eval_module_body(Scheme_Env *menv) LOG_END_RUN(menv->module); } -void scheme_run_module(Scheme_Env *menv, int set_ns) +static void run_module(Scheme_Env *menv, int set_ns) { Scheme_Cont_Frame_Data cframe; Scheme_Config *config; @@ -4187,7 +4242,7 @@ void scheme_run_module(Scheme_Env *menv, int set_ns) scheme_set_cont_mark(scheme_parameterization_key, (Scheme_Object *)config); } - eval_module_body(menv); + eval_module_body(menv, NULL); if (set_ns) { scheme_pop_continuation_frame(&cframe); @@ -4267,10 +4322,6 @@ void scheme_finish_primitive_module(Scheme_Env *env) exs[count++] = (Scheme_Object *)b->key; } - m->functional = 1; - m->et_functional = 1; - m->tt_functional = 1; - m->me->rt->provides = exs; m->me->rt->provide_srcs = NULL; m->me->rt->provide_src_names = exs; @@ -5042,124 +5093,6 @@ module_optimize(Scheme_Object *data, Optimize_Info *info) return scheme_make_syntax_compiled(MODULE_EXPD, data); } -#define EXPLAIN_WHY_NOT 0 -static int is_functional_defn(Scheme_Object *e, int fuel); - -static int is_functional(Scheme_Object *e, int len, int fuel) -{ - Scheme_Type t; - - if (fuel < 0) - return 0; - - top: - - t = SCHEME_TYPE(e); - - if (scheme_omittable_expr(e, len, fuel, 1, NULL)) - return 1; - - if (t == scheme_sequence_type) { - int i, cnt; - cnt = ((Scheme_Sequence *)e)->count; - if (cnt) { - --cnt; - for (i = 0; i < cnt; i++) { - if (!is_functional_defn(((Scheme_Sequence *)e)->array[i], fuel - 1)) - return 0; - } - e = ((Scheme_Sequence *)e)->array[i]; - goto top; - } - } - -#if EXPLAIN_WHY_NOT - if (t == scheme_sequence_type) { - int i; - printf("No %d (%d)\n", t, len); - for (i = 0; i < ((Scheme_Sequence *)e)->count; i++) { - t = SCHEME_TYPE(((Scheme_Sequence *)e)->array[i]); - if (t == scheme_syntax_type) - printf(" %d %d\n", t, SCHEME_PINT_VAL(((Scheme_Sequence *)e)->array[i])); - else - printf(" %d\n", t); - } - } else if (t == scheme_syntax_type) - printf("No %d %d (%d)\n", t, SCHEME_PINT_VAL(e), len); - else - printf("No %d (%d)\n", t, len); -#endif - - return 0; -} - - static int is_functional_defn(Scheme_Object *e, int fuel) -{ - if (SAME_TYPE(SCHEME_TYPE(e), scheme_syntax_type) - && (SCHEME_PINT_VAL(e) == DEFINE_VALUES_EXPD)) { - e = SCHEME_IPTR_VAL(e); - return is_functional(SCHEME_VEC_ELS(e)[0], SCHEME_VEC_SIZE(e) - 1, fuel); - } else - return is_functional(e, 1, fuel); -} - -static void set_is_functional(Scheme_Module *m) -{ - Scheme_Object *e, *names; - int i, cnt; - - if (scheme_starting_up) { - m->functional = 1; - m->et_functional = 1; - return; - } - - if (m->functional) { - /* Compute whether the module is obviously functional: */ - cnt = SCHEME_VEC_SIZE(m->body); - for (i = 0; i < cnt; i++) { - if (!is_functional_defn(SCHEME_VEC_ELS(m->body)[i], 10)) { - m->functional = 0; - break; - } - } - } else { -#if EXPLAIN_WHY_NOT - printf("import non-functional\n"); -#endif - } - - if (m->et_functional) { - cnt = SCHEME_VEC_SIZE(m->et_body); - for (i = 0; i < cnt; i++) { - e = SCHEME_VEC_ELS(m->et_body)[i]; - - if (SCHEME_TRUEP(SCHEME_VEC_ELS(e)[4])) { - /* Direct access possible, so pretend it's non-functional. */ - m->et_functional = 0; - break; - } else { - names = SCHEME_VEC_ELS(e)[0]; - e = SCHEME_VEC_ELS(e)[1]; - - if (!is_functional(e, scheme_list_length(names), 10)) { - m->et_functional = 0; - break; - } - } - } - } else { -#if EXPLAIN_WHY_NOT - printf("exptime import non-functional\n"); -#endif - } - -#if EXPLAIN_WHY_NOT - printf("%s %d %d\n", - scheme_write_to_string(m->modname, NULL), m->functional, m->et_functional); -#endif -} - static Scheme_Object * module_resolve(Scheme_Object *data, Resolve_Info *old_rslv) { @@ -5203,8 +5136,6 @@ module_resolve(Scheme_Object *data, Resolve_Info *old_rslv) /* Exp-time body was resolved during compilation */ - set_is_functional(m); - return scheme_make_syntax_resolved(MODULE_EXPD, data); } @@ -5298,9 +5229,6 @@ static Scheme_Object *do_module(Scheme_Object *form, Scheme_Comp_Env *env, m = MALLOC_ONE_TAGGED(Scheme_Module); m->so.type = scheme_module_type; - m->functional = 1; - m->et_functional = 1; - /* must set before calling new_module_env: */ rmp = SCHEME_STX_VAL(nm); rmp = scheme_intern_resolved_module_path(rmp); @@ -5808,7 +5736,8 @@ Scheme_Object *scheme_parse_lifted_require(Scheme_Object *module_path, rns, post_ex_rns, check_require_name, tables, redef_modname, - 0, 0, 1, 0, + 0, 0, 1, + 1, 0, all_simple); return e; @@ -6205,6 +6134,7 @@ static Scheme_Object *do_module_begin(Scheme_Object *form, Scheme_Comp_Env *env, boundname = scheme_false; scheme_prepare_exp_env(env->genv); + scheme_prepare_compile_env(env->genv->exp_env); eenv = scheme_new_comp_env(env->genv->exp_env, env->insp, 0); scheme_frame_captures_lifts(eenv, NULL, NULL, scheme_false, scheme_false, req_data); @@ -6351,7 +6281,8 @@ static Scheme_Object *do_module_begin(Scheme_Object *form, Scheme_Comp_Env *env, rn_set, post_ex_rn_set, check_require_name, tables, redef_modname, - 0, 0, 1, 0, + 0, 0, 1, + 1, 0, all_simple_renames); if (rec[drec].comp) @@ -8713,7 +8644,8 @@ void parse_requires(Scheme_Object *form, Scheme_Object *rn_set, Scheme_Object *post_ex_rn_set, Check_Func ck, void *data, Scheme_Object *redef_modname, - int unpack_kern, int copy_vars, int can_save_marshal, int always_run, + int unpack_kern, int copy_vars, int can_save_marshal, + int eval_exp, int eval_run, int *all_simple) { Scheme_Object *ll = form, *mode = scheme_make_integer(0), *just_mode = NULL, *x_mode, *x_just_mode; @@ -9011,10 +8943,9 @@ void parse_requires(Scheme_Object *form, m = module_load(name, env, NULL); - if (start) - start_module(m, env, 0, idx, 1, always_run ? 1 : 0, main_env->phase, scheme_null); - else - start_module(m, env, 0, idx, 0, 0, main_env->phase, scheme_null); + start_module(m, env, 0, idx, + start ? eval_exp : 0, start ? eval_run : 0, + main_env->phase, scheme_null); /* Add name to require list, if it's not there: */ if (main_env->module) { @@ -9161,7 +9092,8 @@ top_level_require_execute(Scheme_Object *data) rn_set, rn_set, check_dup_require, ht, NULL, - !env->module, 0, 0, 1, + !env->module, 0, 0, + -1, 1, NULL); scheme_append_rename_set_to_env(rn_set, env); @@ -9235,7 +9167,8 @@ static Scheme_Object *do_require(Scheme_Object *form, Scheme_Comp_Env *env, rn_set, rn_set, check_dup_require, ht, NULL, - 0, 0, 0, 0, + 0, 0, 0, + 1, 0, NULL); if (rec && rec[drec].comp) { @@ -9469,8 +9402,9 @@ static Scheme_Object *write_module(Scheme_Object *obj) l = cons(wrap_mod_stx(m->rn_stx), l); - l = cons(m->et_functional ? scheme_true : scheme_false, l); - l = cons(m->functional ? scheme_true : scheme_false, l); + /* previously recorded "functional?" info: */ + l = cons(scheme_false, l); + l = cons(scheme_false, l); if (m->lang_info) l = cons(m->lang_info, l); @@ -9541,11 +9475,11 @@ static Scheme_Object *read_module(Scheme_Object *obj) obj = SCHEME_CDR(obj); if (!SCHEME_PAIRP(obj)) return_NULL(); - m->functional = SCHEME_TRUEP(SCHEME_CAR(obj)); + /* "functional?" info ignored */ obj = SCHEME_CDR(obj); if (!SCHEME_PAIRP(obj)) return_NULL(); - m->et_functional = SCHEME_TRUEP(SCHEME_CAR(obj)); + /* "functional?" info ignored */ obj = SCHEME_CDR(obj); if (!SCHEME_PAIRP(obj)) return_NULL(); diff --git a/src/mzscheme/src/mzmark.c b/src/mzscheme/src/mzmark.c index 53565447b8..277bcb6bda 100644 --- a/src/mzscheme/src/mzmark.c +++ b/src/mzscheme/src/mzmark.c @@ -1677,6 +1677,7 @@ static int thread_val_MARK(void *p) { gcMARK(pr->private_kill_next); gcMARK(pr->user_tls); + gcMARK(pr->gmp_tls_data); gcMARK(pr->mr_hop); gcMARK(pr->mref); @@ -1788,6 +1789,7 @@ static int thread_val_FIXUP(void *p) { gcFIXUP(pr->private_kill_next); gcFIXUP(pr->user_tls); + gcFIXUP(pr->gmp_tls_data); gcFIXUP(pr->mr_hop); gcFIXUP(pr->mref); @@ -2102,6 +2104,9 @@ static int namespace_val_MARK(void *p) { gcMARK(e->tt_require_names); gcMARK(e->dt_require_names); gcMARK(e->other_require_names); + gcMARK(e->did_starts); + gcMARK(e->available_next[0]); + gcMARK(e->available_next[1]); gcMARK(e->toplevel); gcMARK(e->modchain); @@ -2137,6 +2142,9 @@ static int namespace_val_FIXUP(void *p) { gcFIXUP(e->tt_require_names); gcFIXUP(e->dt_require_names); gcFIXUP(e->other_require_names); + gcFIXUP(e->did_starts); + gcFIXUP(e->available_next[0]); + gcFIXUP(e->available_next[1]); gcFIXUP(e->toplevel); gcFIXUP(e->modchain); diff --git a/src/mzscheme/src/mzmarksrc.c b/src/mzscheme/src/mzmarksrc.c index f8f0dd3a37..d19fb7c89c 100644 --- a/src/mzscheme/src/mzmarksrc.c +++ b/src/mzscheme/src/mzmarksrc.c @@ -847,6 +847,9 @@ namespace_val { gcMARK(e->tt_require_names); gcMARK(e->dt_require_names); gcMARK(e->other_require_names); + gcMARK(e->did_starts); + gcMARK(e->available_next[0]); + gcMARK(e->available_next[1]); gcMARK(e->toplevel); gcMARK(e->modchain); diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index d99feaebc9..3cf8d558b9 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -2560,7 +2560,9 @@ struct Scheme_Env { Scheme_Object *link_midx; Scheme_Object *require_names, *et_require_names, *tt_require_names, *dt_require_names; /* resolved */ Scheme_Hash_Table *other_require_names; - char running, et_running, did_eval_exp, did_eval_run, did_compute, lazy_syntax, attached, ran, et_ran; + char running, et_running, attached, ran; + Scheme_Object *did_starts; + Scheme_Object *available_next[2]; Scheme_Bucket_Table *toplevel; Scheme_Object *modchain; /* Vector of: @@ -2599,7 +2601,7 @@ typedef struct Scheme_Module Scheme_Object *body; /* or data, if prim_body */ Scheme_Object *et_body; /* list of (vector list-of-names expr depth-int resolve-prefix) */ - char functional, et_functional, tt_functional, no_cert; + char no_cert; struct Scheme_Module_Exports *me; @@ -2751,7 +2753,7 @@ int scheme_is_kernel_env(); void scheme_install_initial_module_set(Scheme_Env *env); Scheme_Bucket_Table *scheme_clone_toplevel(Scheme_Bucket_Table *ht, Scheme_Env *home); -Scheme_Env *scheme_clone_module_env(Scheme_Env *menv, Scheme_Env *ns, Scheme_Object *modchain); +Scheme_Env *scheme_copy_module_env(Scheme_Env *menv, Scheme_Env *ns, Scheme_Object *modchain, int clone); void scheme_clean_dead_env(Scheme_Env *env); @@ -2767,8 +2769,7 @@ Scheme_Object *scheme_module_imported_list(Scheme_Env *genv, Scheme_Object *bind Scheme_Object *mode); Scheme_Object *scheme_module_exported_list(Scheme_Object *modpath, Scheme_Env *genv); -void scheme_run_module(Scheme_Env *menv, int set_ns); -void scheme_run_module_exptime(Scheme_Env *menv, int set_ns); +void scheme_prepare_compile_env(Scheme_Env *env); Scheme_Object *scheme_module_to_namespace(Scheme_Object *name, Scheme_Env *env); void scheme_prep_namespace_rename(Scheme_Env *menv); diff --git a/src/mzscheme/src/schvers.h b/src/mzscheme/src/schvers.h index 3b6a3749fc..a58c15b25f 100644 --- a/src/mzscheme/src/schvers.h +++ b/src/mzscheme/src/schvers.h @@ -13,12 +13,12 @@ consistently.) */ -#define MZSCHEME_VERSION "4.1.5.3" +#define MZSCHEME_VERSION "4.1.5.4" #define MZSCHEME_VERSION_X 4 #define MZSCHEME_VERSION_Y 1 #define MZSCHEME_VERSION_Z 5 -#define MZSCHEME_VERSION_W 3 +#define MZSCHEME_VERSION_W 4 #define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y) #define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W) diff --git a/src/mzscheme/src/syntax.c b/src/mzscheme/src/syntax.c index 407abd05d4..a22f31b344 100644 --- a/src/mzscheme/src/syntax.c +++ b/src/mzscheme/src/syntax.c @@ -5558,6 +5558,7 @@ do_define_syntaxes_syntax(Scheme_Object *form, Scheme_Comp_Env *env, scheme_define_parse(form, &names, &code, 1, env, 0); scheme_prepare_exp_env(env->genv); + scheme_prepare_compile_env(env->genv->exp_env); if (!for_stx) names = scheme_named_map_1(NULL, stx_val, names, (Scheme_Object *)env->genv); @@ -5613,6 +5614,7 @@ define_syntaxes_expand(Scheme_Object *form, Scheme_Comp_Env *env, Scheme_Expand_ SCHEME_EXPAND_OBSERVE_PRIM_DEFINE_SYNTAXES(erec[drec].observer); scheme_prepare_exp_env(env->genv); + scheme_prepare_compile_env(env->genv->exp_env); scheme_define_parse(form, &names, &code, 1, env, 0); @@ -5691,7 +5693,8 @@ static Scheme_Object *eval_letmacro_rhs(Scheme_Object *a, Scheme_Comp_Env *rhs_e Scheme_Dynamic_State dyn_state; scheme_prepare_exp_env(rhs_env->genv); - + scheme_prepare_compile_env(rhs_env->genv->exp_env); + config = scheme_extend_config(scheme_current_config(), MZCONFIG_ENV, (Scheme_Object *)rhs_env->genv->exp_env); @@ -6020,6 +6023,7 @@ do_letrec_syntaxes(const char *where, SCHEME_EXPAND_OBSERVE_LETREC_SYNTAXES_RENAMES(rec[drec].observer, bindings, var_bindings, body); scheme_prepare_exp_env(stx_env->genv); + scheme_prepare_compile_env(stx_env->genv->exp_env); if (!env_already) { i = 0; diff --git a/src/worksp/gc2/make.ss b/src/worksp/gc2/make.ss index f7c8abe7e3..24cf69158d 100644 --- a/src/worksp/gc2/make.ss +++ b/src/worksp/gc2/make.ss @@ -417,19 +417,12 @@ "wxs_glob" "wxs_item" "wxs_lbox" - "wxs_madm" - "wxs_mede" - "wxs_medi" "wxs_menu" - "wxs_mio" "wxs_misc" - "wxs_mpb" "wxs_obj" "wxs_panl" "wxs_rado" "wxs_slid" - "wxs_snip" - "wxs_styl" "wxs_tabc" "wxs_win" "wxscheme")) @@ -438,24 +431,6 @@ (wx-try "mred/wxs" "wxs" x #t "cxx" #f)) wxs-srcs) -(define wxme-srcs - '("wx_cgrec" - "wx_keym" - "wx_mbuf" - "wx_medad" - "wx_media" - "wx_medio" - "wx_mline" - "wx_mpbrd" - "wx_mpriv" - "wx_msnip" - "wx_snip" - "wx_style")) - -(for-each (lambda (x) - (wx-try "mred/wxme" "wxme" x #t "cxx" #f)) - wxme-srcs) - (define mred-srcs '("mred" "mredmsw")) @@ -482,7 +457,6 @@ (append wxwin-base-srcs wxwin-msw-srcs wxs-srcs - wxme-srcs mred-srcs)))] [libs (list "../../../lib/msvc/libmzsch3mxxxxxxx.lib" diff --git a/src/worksp/libmred/libmred.vcproj b/src/worksp/libmred/libmred.vcproj index 8911952070..5c98e95cd9 100644 --- a/src/worksp/libmred/libmred.vcproj +++ b/src/worksp/libmred/libmred.vcproj @@ -41,7 +41,7 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/worksp/wxme/wxme.vcproj b/src/worksp/wxme/wxme.vcproj index 9e53b58935..1472bf8088 100644 --- a/src/worksp/wxme/wxme.vcproj +++ b/src/worksp/wxme/wxme.vcproj @@ -161,54 +161,6 @@ Name="Source Files" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" > - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/worksp/wxs/wxs.vcproj b/src/worksp/wxs/wxs.vcproj index 28e66f883e..892f9488c4 100644 --- a/src/worksp/wxs/wxs.vcproj +++ b/src/worksp/wxs/wxs.vcproj @@ -40,7 +40,7 @@ - - - - - - - - - - @@ -257,14 +237,6 @@ RelativePath="..\..\mred\Wxs\WXS_SLID.cxx" > - - - - @@ -334,34 +306,10 @@ RelativePath="..\..\mred\Wxs\wxs_lbox.h" > - - - - - - - - - - - - @@ -378,14 +326,6 @@ RelativePath="..\..\mred\Wxs\wxs_slid.h" > - - - -