make right-click in the space between the definitions and
interactions window pop up a menu to let you change from vertical to horizontal orientation
This commit is contained in:
parent
902ea5f7a5
commit
9b3f2427d7
|
@ -1100,7 +1100,8 @@ module browser threading seems wrong.
|
|||
(define dragable/def-int-mixin
|
||||
(mixin (panel:dragable<%>) ()
|
||||
(init-field unit-frame)
|
||||
(inherit get-percentages)
|
||||
(inherit get-percentages popup-menu
|
||||
set-orientation get-vertical?)
|
||||
(define/augment (after-percentage-change)
|
||||
(let ([percentages (get-percentages)])
|
||||
(when (and (= 1
|
||||
|
@ -1109,6 +1110,21 @@ module browser threading seems wrong.
|
|||
(= 2 (length percentages)))
|
||||
(preferences:set 'drracket:unit-window-size-percentage (car percentages))))
|
||||
(inner (void) after-percentage-change))
|
||||
(define/override (right-click-in-gap evt before after)
|
||||
(define menu (new popup-menu%))
|
||||
(define vertical? (get-vertical?))
|
||||
(new menu-item%
|
||||
[parent menu]
|
||||
[label
|
||||
;; something seems to be wrong with the get-vertical? method...
|
||||
(if vertical?
|
||||
(string-constant change-to-vertical-alignment)
|
||||
(string-constant change-to-horizontal-alignment))]
|
||||
[callback
|
||||
(λ (a b)
|
||||
(preferences:set 'drracket:defs/ints-horizontal vertical?)
|
||||
(set-orientation vertical?))])
|
||||
(popup-menu menu (send evt get-x) (send evt get-y)))
|
||||
(super-new)))
|
||||
|
||||
(define vertical-dragable/def-int% (dragable/def-int-mixin panel:vertical-dragable%))
|
||||
|
@ -4112,8 +4128,6 @@ module browser threading seems wrong.
|
|||
vertical-dragable/def-int%)
|
||||
(unit-frame this)
|
||||
(parent panel-with-tabs))]
|
||||
[define orientation-callback (λ (p v) (send resizable-panel set-orientation v))]
|
||||
(preferences:add-callback 'drracket:defs/ints-horizontal orientation-callback #t)
|
||||
|
||||
[define definitions-canvas #f]
|
||||
(initialize-definitions-canvas)
|
||||
|
|
|
@ -171,7 +171,9 @@
|
|||
set-percentages
|
||||
get-percentages
|
||||
get-vertical?
|
||||
get-default-percentages))
|
||||
get-default-percentages
|
||||
right-click-in-gap
|
||||
set-orientation))
|
||||
|
||||
(define vertical-dragable<%>
|
||||
(interface (dragable<%>)))
|
||||
|
@ -184,7 +186,6 @@
|
|||
(init parent)
|
||||
|
||||
(init-field vertical?)
|
||||
|
||||
(define/public-final (get-vertical?) vertical?)
|
||||
(define/public-final (set-orientation h?)
|
||||
(define v? (not h?))
|
||||
|
@ -205,6 +206,8 @@
|
|||
(icon:get-up/down-cursor)
|
||||
(icon:get-left/right-cursor)))
|
||||
|
||||
(define/public (right-click-in-gap evt before after) (void))
|
||||
|
||||
(inherit get-client-size container-flow-modified)
|
||||
|
||||
(init-field [bar-thickness 5])
|
||||
|
@ -285,6 +288,8 @@
|
|||
(and (send c ok?)
|
||||
c))))
|
||||
(cond
|
||||
[(and gap (send evt button-down? 'right))
|
||||
(right-click-in-gap evt (gap-before gap) (gap-after gap))]
|
||||
[(and gap (send evt button-down? 'left))
|
||||
(set! resizing-dim (event-get-dim evt))
|
||||
(set! resizing-gap gap)]
|
||||
|
|
|
@ -81,6 +81,16 @@
|
|||
The numbers in the result list must sum to @racket[1].
|
||||
}
|
||||
|
||||
@defmethod[(right-click-in-gap [evt (is-a?/c mouse-event%)]
|
||||
[before (is-a?/c subarea<%>)]
|
||||
[after (is-a?/c subarea<%>)])
|
||||
void?]{
|
||||
This method is called when the user right-clicks in the space
|
||||
between two children. It receives the mouse event and the
|
||||
child before and after the gap where the user clicked.
|
||||
}
|
||||
|
||||
|
||||
@defmethod*[(((set-percentages (new-percentages (listof number?))) void?))]{
|
||||
Call this method to set the percentages that each window takes up of the
|
||||
panel.
|
||||
|
|
|
@ -807,6 +807,11 @@ please adhere to these guidelines:
|
|||
"Would you like to create a new window, or clear out the current one?")
|
||||
(clear-current "Clear Current")
|
||||
(new-window "New Window")
|
||||
|
||||
;; popup menu when right-clicking in the gap between
|
||||
;; the definitions and interactions window
|
||||
(change-to-vertical-alignment "Change to vertical")
|
||||
(change-to-horizontal-alignment "Change to horizontal")
|
||||
|
||||
;;; exiting and quitting ``are you sure'' dialog
|
||||
;;; exit is used on windows, quit on macos, in English. Other
|
||||
|
|
Loading…
Reference in New Issue
Block a user