diff --git a/collects/framework/framework.ss b/collects/framework/framework.ss index 89096b48..e1ca90b8 100644 --- a/collects/framework/framework.ss +++ b/collects/framework/framework.ss @@ -657,6 +657,15 @@ "" "See section \\ref{selecting-a-filename} for more information.") + (frame:setup-size-pref + (symbol? number? number? . -> . void) + (size-pref-sym width height) + "Initializes a preference for the" + "@mixin-link frame:size-pref" + "mixin." + "" + "The first argument should be the preferences symbol, and the second an third" + "should be the default width and height, respectively.") (frame:add-snip-menu-items ((is-a?/c menu%) (subclass?/c menu-item%) . -> . void?) (menu menu-item%) diff --git a/collects/framework/private/frame.ss b/collects/framework/private/frame.ss index c33efdba..9ea832ed 100644 --- a/collects/framework/private/frame.ss +++ b/collects/framework/private/frame.ss @@ -222,6 +222,16 @@ (let ([lst (preferences:get size-preferences-key)]) (super-new [width (car lst)] [height (cadr lst)])))) + (define (setup-size-pref size-preferences-key w h) + (preferences:set-default size-preferences-key + (list w h) + (lambda (x) + (and (pair? x) + (pair? (cdr x)) + (null? (cddr x)) + (number? (car x)) + (number? (cadr x)))))) + (define register-group<%> (interface ())) (define register-group-mixin (mixin (basic<%>) (register-group<%>) diff --git a/collects/framework/private/sig.ss b/collects/framework/private/sig.ss index 56892119..31be22ec 100644 --- a/collects/framework/private/sig.ss +++ b/collects/framework/private/sig.ss @@ -412,7 +412,8 @@ pasteboard-info-mixin)) (define-signature framework:frame-fun^ (reorder-menus - add-snip-menu-items)) + add-snip-menu-items + setup-size-pref)) (define-signature framework:frame^ ((open framework:frame-class^) (open framework:frame-fun^)))