Commit ae018c1b authored by Bas Lijnse's avatar Bas Lijnse

Small optimization in top-level gui viewport

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2365 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent b64c2fa7
......@@ -6,7 +6,7 @@
Ext.define('itwc.component.edit.Editable',{
editable: true,
editBufferTime: 200,
editBufferTime: 50,
syncEditsEnabled: false,
......
Ext.define('itwc.container.Viewport',{
extend: 'Ext.container.Viewport',
layout: 'fit',
mixins: ['itwc.container.HotkeyArea'],
requires: ['itwc.layout.container.Box'],
padding: 0,
direction: 'vertical',
valign: 'middle',
halign: 'center',
initComponent: function() {
this.layout = {type:'itwc_box', direction: this.direction, halign: this.halign, valign: this.valign, padding: this.padding};
this.callParent(arguments);
},
afterRender: function() {
......@@ -25,10 +31,10 @@ Ext.define('itwc.container.Viewport',{
cmp = me,
step, i, undef;
if(path == "") {
if(path == "" || path == "0") {
return me;
}
for(i = 0; i < numSteps; i++) {
for(i = 1; i < numSteps; i++) {
step = steps[i];
if(step === "m") {
......
......@@ -214,13 +214,11 @@ Ext.define('itwc.controller.Controller', {
viewport = me.viewport;
//Update the main window title instead of the viewport panel
document.title = viewportDef.title ? viewportDef.title : 'Untitled';
delete(viewportDef.title);
document.title = viewportDef.title ? viewportDef.title : '';
//Update viewport
viewport.removeAll();
viewport.add(viewportDef);
viewport.add(viewportDef.items);
},
partialUpdate: function(updates) {
var me = this,
......
......@@ -86,22 +86,23 @@ autoFinalLayout def=:(UIControlSequence {UIControlSequence|attributes,controls,d
# panel = defToPanel (layoutControls def)
# items = [(setSize WrapSize WrapSize o setFramed True) panel]
# itemsOpts = {defaultItemsOpts items & direction = direction, halign = AlignCenter, valign= AlignMiddle}
= UIViewport itemsOpts {UIViewportOpts|title=get TITLE_ATTRIBUTE attributes, tbar = Nothing, hotkeys = Nothing}
= UIViewport itemsOpts {UIViewportOpts|title=get TITLE_ATTRIBUTE attributes, hotkeys = Nothing}
autoFinalLayout (UIActionSet actions)
= UIViewport (defaultItemsOpts []) {UIViewportOpts|title=Nothing,tbar = Nothing, hotkeys = Nothing}
= UIViewport (defaultItemsOpts []) {UIViewportOpts|title=Nothing,hotkeys = Nothing}
autoFinalLayout def=:(UIControlGroup {UIControlGroup|attributes,controls,direction,actions})
# (actions,_,panel) = placeActions actions False (defToPanel (layoutControls def))
# (menu,menukeys,_) = actionsToMenus actions
# items = [(setSize WrapSize WrapSize o setFramed True) panel]
# panel = (setSize WrapSize WrapSize o setFramed True) panel
# items = if (isEmpty menu) [panel] [setTBar menu panel]
# itemsOpts = {defaultItemsOpts items & direction = direction, halign = AlignCenter, valign= AlignMiddle}
# hotkeys = case menukeys of [] = Nothing ; keys = Just keys
= UIViewport itemsOpts {UIViewportOpts|title= get TITLE_ATTRIBUTE attributes,tbar = if (isEmpty menu) Nothing (Just menu), hotkeys = hotkeys}
= UIViewport itemsOpts {UIViewportOpts|title= get TITLE_ATTRIBUTE attributes, hotkeys = hotkeys}
autoFinalLayout def=:(UIAbstractContainer {UIAbstractContainer|attributes,controls,direction,actions,windows,hotkeys})
# (menu,menukeys,_) = actionsToMenus actions
# items = [defToPanel def]
# items = if (isEmpty menu) [defToPanel def] [setTBar menu (defToPanel def)]
# itemsOpts = {defaultItemsOpts items & direction = direction, halign = AlignCenter, valign= AlignMiddle}
# hotkeys = case hotkeys ++ menukeys of [] = Nothing ; keys = Just keys
= UIViewport itemsOpts {UIViewportOpts|title= get TITLE_ATTRIBUTE attributes,tbar = if (isEmpty menu) Nothing (Just menu), hotkeys = hotkeys}
= UIViewport itemsOpts {UIViewportOpts|title= get TITLE_ATTRIBUTE attributes, hotkeys = hotkeys}
autoFinalLayout (UIFinal final)
= final
......@@ -422,7 +423,7 @@ hideLayout =
, step = \def actions -> noControls (addActions actions def)
, parallel = \prompt defs -> noControls (foldr mergeDefs (UIControlGroup {UIControlGroup|attributes = prompt.UIControlSequence.attributes,controls = prompt.UIControlSequence.controls, direction = prompt.UIControlSequence.direction, actions = []}) defs)
, workOn = \def meta -> noControls def
, final = \def -> UIViewport (defaultItemsOpts (uiDefControls (noControls def))) {UIViewportOpts|title=Nothing,tbar=Nothing,hotkeys=Nothing}
, final = \def -> UIViewport (defaultItemsOpts (uiDefControls (noControls def))) {UIViewportOpts|title=Nothing,hotkeys=Nothing}
}
where
noControls (UIControlGroup group) = UIControlGroup {UIControlGroup|group & controls = []}
......@@ -648,6 +649,11 @@ setValign align (UIPanel sOpts iOpts opts) = UIPanel sOpts {iOpts & valign = al
setValign align (UIWindow sOpts iOpts opts) = UIWindow sOpts {iOpts & valign = align} opts
setValign align ctrl = ctrl
setTBar :: ![UIControl] !UIControl -> UIControl
setTBar tbar (UIPanel sOpts iOpts opts) = UIPanel sOpts iOpts {UIPanelOpts|opts & tbar = Just tbar}
setTBar tbar (UIWindow sOpts iOpts opts) = UIWindow sOpts iOpts {UIWindowOpts|opts & tbar = Just tbar}
setTBar tbar ctrl = ctrl
//Container coercion
toPanel :: !UIControl -> UIControl
//Panels are left untouched
......@@ -803,7 +809,6 @@ actionToHotkey {taskId,action=Action actionId options,enabled=True}
_ = Nothing
actionToHotkey _ = Nothing
hasWindowAttr :: UIAttributes -> Bool
hasWindowAttr attributes = maybe False ((==) "window") (get FLOAT_ATTRIBUTE attributes)
......
......@@ -69,7 +69,7 @@ from Map import :: Map(..)
:: UIViewportOpts =
{ title :: !Maybe String
, tbar :: !Maybe [UIControl]
// , tbar :: !Maybe [UIControl]
, hotkeys :: !Maybe [UIKeyAction]
}
......
......@@ -79,8 +79,8 @@ uiDefSetDirection direction (UIAbstractContainer cont)
uiDefSetDirection direction def = def
encodeUIDefinition :: !UIDef -> JSONNode
encodeUIDefinition (UIFinal (UIViewport iopts opts)) = enc "itwc_panel" [toJSON iopts, toJSON opts]
encodeUIDefinition def = enc "itwc_panel" [toJSON (defaultItemsOpts (uiDefControls def))]
encodeUIDefinition (UIFinal (UIViewport iopts opts)) = enc "itwc_viewport" [toJSON iopts, toJSON opts]
encodeUIDefinition def = enc "itwc_viewport" [toJSON (defaultItemsOpts (uiDefControls def))]
encodeUIControl :: !UIControl -> JSONNode
encodeUIControl (UIViewString sopts vopts) = enc "itwc_view_string" [toJSON sopts,encViewOpts vopts]
......
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