Commit 1f4081f9 authored by Bas Lijnse's avatar Bas Lijnse

Fixed menu bug

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2394 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 01216dd8
...@@ -60,7 +60,7 @@ autoParallelLayout prompt defs ...@@ -60,7 +60,7 @@ autoParallelLayout prompt defs
where where
allPartial [] = True allPartial [] = True
allPartial [UIControlSequence {UIControlSequence|attributes}:ds] allPartial [UIControlSequence {UIControlSequence|attributes}:ds]
= if (hasContainerAttr attributes) False (allPartial ds) = if (hasPanelContainerAttr attributes) False (allPartial ds)
allPartial _ = False allPartial _ = False
additionalActions defs = scan False False defs additionalActions defs = scan False False defs
...@@ -316,7 +316,7 @@ where ...@@ -316,7 +316,7 @@ where
processDef (UIActionSet {UIActionSet|actions}) processDef (UIActionSet {UIActionSet|actions})
= (actions,[],Nothing) = (actions,[],Nothing)
processDef def processDef def
| hasWindowAttr (uiDefAttributes def) //TODO: Pass hotkeys along | hasWindowContainerAttr (uiDefAttributes def) //TODO: Pass hotkeys along
# (actions,_, window) = placeWindowActions (uiDefActions def) (defToWindow (layoutControls def)) # (actions,_, window) = placeWindowActions (uiDefActions def) (defToWindow (layoutControls def))
= ([],[window:uiDefWindows def],Nothing) = ([],[window:uiDefWindows def],Nothing)
| otherwise | otherwise
...@@ -374,11 +374,11 @@ where ...@@ -374,11 +374,11 @@ where
where where
find i bestSoFar [] = bestSoFar find i bestSoFar [] = bestSoFar
find i bestSoFar=:(_,Nothing) [d:ds] find i bestSoFar=:(_,Nothing) [d:ds]
| hasWindowAttr (uiDefAttributes d) = find (i+1) bestSoFar ds | hasWindowContainerAttr (uiDefAttributes d) = find (i+1) bestSoFar ds
= find (i+1) (i,Just d) ds = find (i+1) (i,Just d) ds
find i bestSoFar=:(_,Just best) [d:ds] find i bestSoFar=:(_,Just best) [d:ds]
| not (hasWindowAttr (uiDefAttributes d)) && later d best = find (i+1) (i,Just d) ds | not (hasWindowContainerAttr (uiDefAttributes d)) && later d best = find (i+1) (i,Just d) ds
= find (i+1) bestSoFar ds = find (i+1) bestSoFar ds
later defA defB later defA defB
# a = uiDefAttributes defA # a = uiDefAttributes defA
...@@ -406,7 +406,7 @@ where ...@@ -406,7 +406,7 @@ where
# attributes = uiDefAttributes def # attributes = uiDefAttributes def
# actions = uiDefActions def # actions = uiDefActions def
# taskId = get TASK_ATTRIBUTE attributes # taskId = get TASK_ATTRIBUTE attributes
| hasWindowAttr attributes | hasWindowContainerAttr attributes
# (actions,_,window) = placeWindowActions (uiDefActions def) (defToWindow (layoutControls def)) # (actions,_,window) = placeWindowActions (uiDefActions def) (defToWindow (layoutControls def))
= (Right window, actions) = (Right window, actions)
| otherwise | otherwise
...@@ -731,6 +731,10 @@ where ...@@ -731,6 +731,10 @@ where
= [UIMenuButton sOpts {UIMenuButtonOpts|opts & menu = addToItems item taskId action enabled opts.UIMenuButtonOpts.menu}:ms] = [UIMenuButton sOpts {UIMenuButtonOpts|opts & menu = addToItems item taskId action enabled opts.UIMenuButtonOpts.menu}:ms]
| otherwise | otherwise
= [m:addToMenus [main:item] taskId action enabled ms] = [m:addToMenus [main:item] taskId action enabled ms]
addToMenus [main:item] taskId action enabled [m:ms]
= [m:addToMenus [main:item] taskId action enabled ms]
addToMenus _ taskId action enabled menus
= menus
addToItems [item:sub] taskId action enabled [] //Create item addToItems [item:sub] taskId action enabled [] //Create item
= [createItem item sub taskId action enabled] = [createItem item sub taskId action enabled]
...@@ -795,12 +799,16 @@ actionToHotkey {taskId,action=Action actionId options,enabled=True} ...@@ -795,12 +799,16 @@ actionToHotkey {taskId,action=Action actionId options,enabled=True}
_ = Nothing _ = Nothing
actionToHotkey _ = Nothing actionToHotkey _ = Nothing
hasWindowAttr :: UIAttributes -> Bool hasWindowContainerAttr :: UIAttributes -> Bool
hasWindowAttr attributes = maybe False ((==) "window") (get CONTAINER_ATTRIBUTE attributes) hasWindowContainerAttr attributes = maybe False ((==) "window") (get CONTAINER_ATTRIBUTE attributes)
hasPanelContainerAttr :: UIAttributes -> Bool
hasPanelContainerAttr attributes = maybe False ((==) "panel") (get CONTAINER_ATTRIBUTE attributes)
hasContainerAttr :: UIAttributes -> Bool hasContainerAttr :: UIAttributes -> Bool
hasContainerAttr attributes = isJust (get CONTAINER_ATTRIBUTE attributes) hasContainerAttr attributes = isJust (get CONTAINER_ATTRIBUTE attributes)
singleControl :: UIDef -> Bool singleControl :: UIDef -> Bool
singleControl def = case uiDefControls def of singleControl def = case uiDefControls def of
[_] = True [_] = True
......
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