Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Metaxal/MrEd-Designer
Browse files Browse the repository at this point in the history
  • Loading branch information
khardy committed Aug 24, 2012
2 parents 75c44e7 + 6149d9e commit 2b3dcb5
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 313 deletions.
8 changes: 7 additions & 1 deletion Changelog
@@ -1,3 +1,10 @@
Version 3.9
Laurent Orseau, Kieron Hardy, 2012-??-??
- added: editor-canvas widget (Kieron Hardy)
- changed: Scheme->racket
- changed: output to frame instead of to console
- fix: tab-panel crash and removed need for single-panel

Version 3.8
Laurent Orseau, 2012-02-04
- added: can now take projects as command line arguments
Expand All @@ -8,7 +15,6 @@ Version 3.8
- fixed: tooltip.ss was not always removing tooltip on windows
- fixed: mreddesigner.bat : small DOS issues


Version 3.7
Laurent Orseau, 2010-07-26
- changed: images (files) are *always* relative to project base directory,
Expand Down
2 changes: 1 addition & 1 deletion code-generation.ss
Expand Up @@ -59,7 +59,7 @@

(define (module-header)
(string-append "\
#lang scheme/gui
#lang racket/gui
;;==========================================================================
;;=== Code generated with MrEd Designer " application-version
Expand Down
39 changes: 32 additions & 7 deletions controller.ss
Expand Up @@ -357,10 +357,9 @@
parent-frame
base-path
dft-name
"*.ss"
"*.rkt"
'()
'(("Scheme (.ss)" "*.ss")
("Scheme (.scm)" "*.scm")
'(("Racket (.rkt)" "*.rkt")
("Any" "*.*")))])
(and file
(path->string file)
Expand All @@ -378,18 +377,44 @@
; (path->string file))
)))

(define/provide (controller-generate-code-to-console [mid (get-current-mred-id)])
;; Like frame:text% but without exiting the app when closing the window
(define no-exit-frame:text%
(class frame:text%
(super-new)
(define/override (on-exit)
;(printf "on-exit\n")
(void))
(define/override (can-exit?)
;(printf "can-exit?\n")
#f)
(define/augment (on-close)
;(printf "on-close\n")
(void))
(define/augment (can-close?)
;(printf "can-close?\n")
(send this show #f)
#f)
))

(define/provide (controller-generate-code-to-frame [mid (get-current-mred-id)])
(when mid
(let ([project-mid (send mid get-top-mred-parent)])
(generate-module project-mid))))
(define project-mid (send mid get-top-mred-parent))
(define f (new no-exit-frame:text%
[min-height 500]))
(send f set-label (->string (send project-mid get-id)))
(define txt (send f get-editor))
(send txt insert
(with-output-to-string (λ _ (generate-module project-mid))))
(send f show #t)
))

(define/provide (controller-generate-code [mid (get-current-mred-id)]
#:ask [ask-user? #t])
(when mid
(let* ([project-mid (send mid get-top-mred-parent)]
;[proj-file (send project-mid get-property-value 'file)]
[base-dir (send project-mid get-project-dir)]; (and proj-file (path-only (string->path proj-file)))]
[dft-file (string-append (->string (send project-mid get-id)) ".ss")]
[dft-file (string-append (->string (send project-mid get-id)) ".rkt")]
[file (if ask-user?
(choose-code-file dft-file base-dir toolbox-frame)
dft-file)]
Expand Down
2 changes: 1 addition & 1 deletion main.ss
Expand Up @@ -95,7 +95,7 @@
#:exit-application-callback controller-exit-application
#:plugin-button-callback controller-create-mred-id
#:generate-code-callback controller-generate-code
#:generate-code-to-console-callback controller-generate-code-to-console
#:generate-code-to-console-callback controller-generate-code-to-frame
#:new-project-callback controller-new-project
#:load-project-callback controller-load-project
#:save-project-callback controller-save-project
Expand Down
2 changes: 1 addition & 1 deletion mreddesigner-misc.ss
Expand Up @@ -43,7 +43,7 @@

;; Current version of MrEd Designer
(define/provide application-version-maj 3)
(define/provide application-version-min 8)
(define/provide application-version-min 9)
(define/provide application-version (format "~a.~a" application-version-maj application-version-min))
(define/provide application-name "MrEd Designer")
(define/provide application-name-version
Expand Down

0 comments on commit 2b3dcb5

Please sign in to comment.