310 ! ! |
318 ! ! |
311 |
319 |
312 !WorkspaceApplication class methodsFor:'special startup'! |
320 !WorkspaceApplication class methodsFor:'special startup'! |
313 |
321 |
314 openSystemWorkspace |
322 openSystemWorkspace |
315 |wsApp readMeWs sysWs licenceView| |
323 |wsApp licenceView| |
316 |
324 |
317 wsApp := self new. |
325 wsApp := self new. |
318 wsApp allButOpen. |
326 wsApp allButOpen. |
319 wsApp window extent:500@400. |
327 wsApp window extent:500@400. |
320 |
328 |
321 wsApp addWindow:(licenceView := HVScrollableView for:HTMLDocumentView) named:'License'. |
329 wsApp addWindow:(HVScrollableView for:Workspace) named:'README' asFirst:false. |
|
330 wsApp loadFile:'../../README'. |
|
331 |
|
332 wsApp removeWorkspace:1. "/ the original Workspace |
|
333 |
|
334 wsApp addWindow:(licenceView := HVScrollableView for:HTMLDocumentView) named:'License' asFirst:false. |
322 licenceView homeDocument:'../../doc/online/english/LICENCE_STX.html'. |
335 licenceView homeDocument:'../../doc/online/english/LICENCE_STX.html'. |
323 licenceView updateLabelFlag:false. |
336 licenceView updateLabelFlag:false. |
324 |
337 |
325 wsApp addWindow:(readMeWs := HVScrollableView for:Workspace) named:'README'. |
338 wsApp addWindow:(HVScrollableView for:Workspace) named:'KeyboardInfo' asFirst:false. |
326 wsApp loadFile:'../../README'. |
339 wsApp loadFile:'KeyboardInfo.wsp'. |
327 |
340 |
328 wsApp addWindow:(sysWs := HVScrollableView for:Workspace) named:'Welcome'. |
341 wsApp addWindow:(HVScrollableView for:Workspace) named:'Welcome' asFirst:false. |
329 wsApp loadFile:'Hello.wsp'. |
342 wsApp loadFile:'Hello.wsp'. |
330 |
|
331 wsApp workspaceSelectionChanged. |
|
332 |
343 |
333 wsApp openWindow |
344 wsApp openWindow |
334 |
345 |
335 " |
346 " |
336 self openSystemWorkspace |
347 self openSystemWorkspace |
435 ! ! |
446 ! ! |
436 |
447 |
437 !WorkspaceApplication methodsFor:'menu actions'! |
448 !WorkspaceApplication methodsFor:'menu actions'! |
438 |
449 |
439 addWindow:aWindow named:name |
450 addWindow:aWindow named:name |
440 |tabList wsIndex| |
451 self addWindow:aWindow named:name asFirst:false |
|
452 ! |
|
453 |
|
454 addWindow:aWindow named:name asFirst:asFirst |
|
455 |tabList wsIndex newSelectedIndex| |
441 |
456 |
442 tabList := self tabList. |
457 tabList := self tabList. |
443 wsIndex := tabList size + 1. |
458 wsIndex := tabList size + 1. |
444 wsIndex == 1 ifTrue:[ |
459 wsIndex == 1 ifTrue:[ |
445 "/ first - add a name for the first tab |
460 "/ first - add a name for the first tab |
446 tabList add:(self window label). "/ 'Workspace'. |
461 tabList add:(self window label). "/ 'Workspace'. |
447 wsIndex := wsIndex + 1. |
462 wsIndex := wsIndex + 1. |
448 ]. |
463 ]. |
449 |
464 |
450 tabList add:(name bindWith:wsIndex). |
|
451 workspaces grow:wsIndex. |
465 workspaces grow:wsIndex. |
452 workspaces at:wsIndex put:aWindow. |
466 asFirst ifTrue:[ |
453 self selectedWorkspaceIndexHolder value:wsIndex |
467 tabList addFirst:(name bindWith:wsIndex). |
|
468 workspaces replaceFrom:2 to:wsIndex with:workspaces startingAt:1. |
|
469 newSelectedIndex := 1. |
|
470 ] ifFalse:[ |
|
471 tabList addLast:(name bindWith:wsIndex). |
|
472 newSelectedIndex := wsIndex. |
|
473 ]. |
|
474 workspaces at:newSelectedIndex put:aWindow. |
|
475 self selectedWorkspaceIndexHolder value:newSelectedIndex. |
|
476 "/ workspaceHolder value:aWindow. |
454 ! |
477 ! |
455 |
478 |
456 addWorkspace |
479 addWorkspace |
457 self addWindow:(HVScrollableView for:Workspace) named:'Workspace%1' |
480 self addWindow:(HVScrollableView for:Workspace) named:'Workspace%1' |
458 ! |
481 ! |
588 tabList size == 1 ifTrue:[ |
615 tabList size == 1 ifTrue:[ |
589 self window label:(tabList at:1). |
616 self window label:(tabList at:1). |
590 tabList removeIndex:1 |
617 tabList removeIndex:1 |
591 ]. |
618 ]. |
592 |
619 |
|
620 workspaceHolder value:(workspaces at:newWsIndex). |
593 self selectedWorkspaceIndexHolder value:newWsIndex. |
621 self selectedWorkspaceIndexHolder value:newWsIndex. |
594 "/ to force change (update workspaceHolder - even if same index) |
622 "/ to force change (update workspaceHolder - even if same index) |
595 self selectedWorkspaceIndexHolder changed:#value. |
623 self selectedWorkspaceIndexHolder changed:#value. |
596 ! |
624 ! |
597 |
625 |
664 ]. |
692 ]. |
665 ^ textView workspace |
693 ^ textView workspace |
666 ! |
694 ! |
667 |
695 |
668 workspaceSelectionChanged |
696 workspaceSelectionChanged |
669 |wsIndex windowLabel| |
697 |wsIndex windowLabel v| |
670 |
698 |
671 "/ self selected |
699 "/ self selected |
672 self workspaceHolder value:(self selectedWorkspace). |
700 self workspaceHolder value:(v := self selectedWorkspace). |
673 wsIndex := self selectedWorkspaceIndexHolder value. |
701 wsIndex := self selectedWorkspaceIndexHolder value. |
674 |
702 |
675 wsIndex ~~ 0 ifTrue:[ |
703 wsIndex ~~ 0 ifTrue:[ |
676 windowLabel := tabList at:wsIndex ifAbsent:nil. |
704 windowLabel := tabList at:wsIndex ifAbsent:nil. |
677 windowLabel notNil ifTrue:[self window label:windowLabel]. |
705 windowLabel notNil ifTrue:[self window label:windowLabel]. |