Commit 3c0b2323 authored by Diederik van Arkel's avatar Diederik van Arkel

Dialog (de)activation and local state retrieval

SliderControl thumbsize
parent 55d7c802
......@@ -493,7 +493,7 @@ osCompoundControlHasOrigin :== True
osSetSliderControlSize parentWindow parentPos sliderPtr pos size update
sets the new size of the slider control and updates the control if update holds.
*/
osSetSliderControlThumb :: !OSWindowPtr !OSWindowPtr !Rect !Bool !(!Int,!Int,!Int) !*OSToolbox -> *OSToolbox
osSetSliderControlThumb :: !OSWindowPtr !OSWindowPtr !Rect !Bool !(!Int,!Int,!Int,!Int) !*OSToolbox -> *OSToolbox
osSetSliderControlSelect :: !OSWindowPtr !OSWindowPtr !Rect !Bool !*OSToolbox -> *OSToolbox
osSetSliderControlShow :: !OSWindowPtr !OSWindowPtr !Rect !Bool !*OSToolbox -> *OSToolbox
osSetSliderControlPos :: !OSWindowPtr !(!Int,!Int) !OSWindowPtr !(!Int,!Int) !(!Int,!Int) !Bool !*OSToolbox -> *OSToolbox
......
......@@ -1245,17 +1245,12 @@ osCompoundControlHasOrigin :== True
// On slider controls:
osSetSliderControlThumb :: !OSWindowPtr !OSWindowPtr !Rect !Bool !(!Int,!Int,!Int) !*OSToolbox -> *OSToolbox
osSetSliderControlThumb _ cPtr _ redraw (min,thumb,max) tb
= winSetScrollPos cPtr SB_CTL thumb 0 0 0 tb//redraw tb
/* PA: Diederik proposed the following to solve Maarten's bug:
osSetSliderControlThumb :: !OSWindowPtr !OSWindowPtr !Rect !Bool !(!Int,!Int,!Int,!Int) !*OSToolbox -> *OSToolbox
osSetSliderControlThumb _ cPtr _ redraw (min,thumb,max,thumbsize) tb
# tb = winSetScrollRange cPtr SB_CTL min max False tb
// # tb = winSetScrollPos sliderPtr SB_CTL thumb (x+w) (y+h) (if horizontal h w) tb
# tb = winSetScrollThumbSize cPtr SB_CTL thumbsize 0 0 0 tb
= winSetScrollPos cPtr SB_CTL thumb 0 0 0 tb//redraw tb
*/
= winSetScrollPos cPtr SB_CTL thumb 0 0 0 tb
osSetSliderControlSelect :: !OSWindowPtr !OSWindowPtr !Rect !Bool !*OSToolbox -> *OSToolbox
osSetSliderControlSelect _ cPtr _ select tb
= winEnableControl cPtr select tb
......
......@@ -473,8 +473,9 @@ filterOSEvent _ {ccMsg=CcWmACTIVATE,p1=wPtr} windows ioState
| otherwise
# (wids,wsH) = getWindowStateHandleWIDS wsH
windows = setWindowHandlesWindow wsH windows
(activeModal,windows) = getWindowHandlesActiveModalDialog windows
= (True,Nothing,if (isJust activeModal) (Just (WindowInitialise wids)) (Just (WindowActivation wids)),windows,ioState) // PA: WindowInitialise? Why? Doesn't smell well
// (activeModal,windows) = getWindowHandlesActiveModalDialog windows
// = (True,Nothing,if (isJust activeModal) (Just (WindowInitialise wids)) (Just (WindowActivation wids)),windows,ioState) // PA: WindowInitialise? Why? Doesn't smell well
= (True,Nothing,Just (WindowActivation wids),windows,ioState) // DvA: always activate/deactivate windows
filterOSEvent _ {ccMsg=CcWmCLOSE,p1=wPtr} windows ioState
# (found,wsH,windows) = getWindowHandlesWindow (toWID wPtr) windows
......@@ -497,8 +498,9 @@ filterOSEvent _ {ccMsg=CcWmDEACTIVATE,p1=wPtr} windows ioState
| otherwise
# (wids,wsH) = getWindowStateHandleWIDS wsH
windows = setWindowHandlesWindow wsH windows
(activeModal,windows) = getWindowHandlesActiveModalDialog windows
= (True,Nothing,if (isJust activeModal) Nothing (Just (WindowDeactivation wids)),windows,ioState)
// (activeModal,windows) = getWindowHandlesActiveModalDialog windows
// = (True,Nothing,if (isJust activeModal) Nothing (Just (WindowDeactivation wids)),windows,ioState)
= (True,Nothing,Just (WindowDeactivation wids),windows,ioState) // DvA: always activate/deactivate windows
filterOSEvent _ {ccMsg=CcWmKEYBOARD,p1=wPtr,p2=cPtr,p3=keycode,p4=state,p5=mods} windows ioState
# (found,wsH,windows) = getWindowHandlesWindow (toWID wPtr) windows
......
......@@ -789,9 +789,8 @@ where
(_,f) = id_f
newState = validateSliderState (f oldState)
itemH = {itemH & wItemInfo`=SliderInfo` {info & sliderInfoState`=newState}}
(tbMin,tbThumb,tbMax,_)
= toOSscrollbarRange (newState.sliderMin,newState.sliderThumb,newState.sliderMax) 0
# tb = osSetSliderControlThumb wPtr wItemPtr` clipRect (not (isEmptyRect clipRect)) (tbMin,tbThumb,tbMax) tb
thumbState = toOSscrollbarRange (newState.sliderMin,newState.sliderThumb,newState.sliderMax) 0
# tb = osSetSliderControlThumb wPtr wItemPtr` clipRect (not (isEmptyRect clipRect)) thumbState tb
= (itemH,(id_fs,tb))
setSliderState wMetrics wPtr clipRect itemH=:{wItemKind`=IsCompoundControl} (id_fs,tb)
......
......@@ -76,8 +76,9 @@ openmodalwindow wId {wlsState,wlsHandle} pState=:{io=ioState}
# (osDelayEvents,ioState) = accIOToolbox (strictSeqList (delayMouse++delayKey)) pState.io
# (osEvents,ioState) = ioStGetEvents ioState
# ioState = ioStSetEvents (osAppendEvents osDelayEvents osEvents) ioState
# (finalLS,ioState) = getFinalModalDialogLS noError (toWID wId) ioState
# (finalLS,moreLS,ioState) = getFinalModalDialogLS noError (toWID wId) ioState
| isJust modalWIDS // there still are modal dialogs
|| moreLS // DvA: or unretrieved final states...
= (errorReport,finalLS,{pState & io=ioState})
# (closed,ioState) = ioStClosed ioState
| closed // process has been requested to close; remove WindowDevice, so process can removed (scheduler)
......@@ -176,27 +177,28 @@ where
/* getFinalModalDialogLS retrieves the final local state of the modal dialog. This value has been stored in the window handles.
This MUST have been done by disposeWindow (windowdispose).
*/
getFinalModalDialogLS :: !Bool !WID !(IOSt .l) -> (!Maybe .ls,!IOSt .l)
getFinalModalDialogLS :: !Bool !WID !(IOSt .l) -> (!Maybe .ls,!Bool,!IOSt .l)
getFinalModalDialogLS noError wid ioState
| not noError
= (Nothing,ioState)
# (found,wDevice,ioState) = ioStGetDevice WindowDevice ioState
| not found
= windowcreateFatalError "getFinalModalDialogLS" "could not retrieve WindowSystemState from IOSt"
# windows = windowSystemStateGetWindowHandles wDevice
(final,more,windows) = getFinalLS wid windows
# ioState = ioStSetDevice (WindowSystemState windows) ioState
| not noError
= (Nothing,more,ioState)
| otherwise
# windows = windowSystemStateGetWindowHandles wDevice
(final,windows) = getFinalLS wid windows
# ioState = ioStSetDevice (WindowSystemState windows) ioState
= case final of
Nothing -> windowcreateFatalError "getFinalModalDialogLS" "final local modal dialog state not found"
Just final -> (getFinalModalLS wid final,ioState)
Just final -> (getFinalModalLS wid final,more,ioState)
where
getFinalLS :: !WID !(WindowHandles .pst) -> (!Maybe FinalModalLS,!WindowHandles .pst)
getFinalLS :: !WID !(WindowHandles .pst) -> (!Maybe FinalModalLS,!Bool,!WindowHandles .pst)
getFinalLS wid windows=:{whsFinalModalLS}
# (removed,finalLS,finalLSs) = uremove (\fmLS=:{fmWIDS}->(identifyWIDS wid fmWIDS,fmLS)) undef whsFinalModalLS
windows = {windows & whsFinalModalLS=finalLSs}
| not removed = (Nothing,windows)
| otherwise = (Just finalLS,windows)
more = not (isEmpty finalLSs)
| not removed = (Nothing,more,windows)
| otherwise = (Just finalLS,more,windows)
/* createModalDialogControls wPtr ioState
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment