FileApplicationNoteBook.st
changeset 14799 9931a2248312
parent 14660 39afddf6eea3
child 14801 3706d48d3c1b
--- a/FileApplicationNoteBook.st	Thu Oct 23 13:17:14 2014 +0200
+++ b/FileApplicationNoteBook.st	Sat Oct 25 13:54:35 2014 +0200
@@ -377,9 +377,8 @@
 !FileApplicationNoteBook methodsFor:'actions-app-common'!
 
 changeItem:anItem for:anAppl
-    | applIndex string isDirectory |
-
-    applIndex := self getIndexFor:anAppl.
+    | applIndex string isDirectory iconOrNil tabItem|
+
     anItem notNil ifTrue:[
         isDirectory := anItem isDirectory or:[anItem linkTargetIsDirectory ].
 
@@ -390,17 +389,21 @@
         ].
     ].
     string := anAppl getTabString.
-    self privateTabList at:applIndex put:(Text fromString:string).
+    tabItem := Text fromString:string.
+
+    iconOrNil := anAppl getTabIcon.
+    iconOrNil notNil ifTrue:[
+        tabItem := LabelAndIcon icon:iconOrNil string:tabItem.
+    ].
+    applIndex := self getIndexFor:anAppl.
+    self privateTabList at:applIndex put:tabItem.
     "/ self doSelect:anAppl.
 !
 
-changeModified:aSymbol for:aAppl
-
-    | index text stream|
-
-    index := self getIndexFor:aAppl.
-    index isNil ifTrue:[ ^ self].
-    stream := WriteStream with:aAppl getTabString.
+changeModified:aSymbol for:anAppl
+    |text stream|
+
+    stream := WriteStream with:anAppl getTabString.
     aSymbol ~~ #unchanged ifTrue:[
         stream space.
         stream nextPut:$[.
@@ -411,10 +414,8 @@
     ] ifFalse:[
         text := stream contents asText.
     ].
-    self privateTabList at:index put:text.
-    self selectedEditorPage value == index ifTrue:[
-        self changeFileBrowserTitleTo:text.
-    ].
+
+    self tabStringChangeTo:text for:anAppl.
 !
 
 closeSubCanvas:aApplication
@@ -663,7 +664,7 @@
 startApplication:anApplication
     "start a subapplication in the lower panel (terminal, finder, archive viewer or text editor)"
 
-    | window|
+    | window tabItem iconOrNil|
 
     anApplication window isNil ifTrue:[
         window := ApplicationSubView new.
@@ -671,7 +672,13 @@
         window client:anApplication.
     ].
     self listOfApplications add:anApplication.
-    self privateTabList add:(Text fromString:(anApplication getTabString)).
+
+    tabItem := Text fromString:(anApplication getTabString).
+    iconOrNil := anApplication getTabIcon.
+    iconOrNil notNil ifTrue:[
+        tabItem := LabelAndIcon icon:iconOrNil string:tabItem.
+    ].
+    self privateTabList add:tabItem.
     self viewNoteBookApplicationHolder value:true.
     self enableViewNoteBookApplication value:true.
     self withWaitCursorDo:[
@@ -695,13 +702,21 @@
     stream close.
 !
 
-tabStringChangeTo:aString for:aAppl
-
-    | index|
-
-    index := self getIndexFor:aAppl.
+tabStringChangeTo:aString for:anAppl
+
+    | index text tabItem |
+
+    index := self getIndexFor:anAppl.
     index isNil ifTrue:[ ^ self].
-    self privateTabList at:index put:(Text fromString:aString).
+
+    text := Text fromString:aString.
+
+    tabItem := self privateTabList at:index.
+    tabItem class == LabelAndIcon ifTrue:[
+        text := LabelAndIcon icon:(tabItem icon) string:text.
+    ].
+
+    self privateTabList at:index put:text.
     self selectedEditorPage value == index ifTrue:[
         self changeFileBrowserTitleTo:aString.
     ].
@@ -4396,6 +4411,80 @@
 )
 ! !
 
+!FileApplicationNoteBook::Terminal class methodsFor:'image specs'!
+
+clearConsoleIcon
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self clearConsoleIcon inspect
+     ImageEditor openOnClass:self andSelector:#clearConsoleIcon
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'Tools::Inspector2 clearConsoleIcon'
+        ifAbsentPut:[(Depth8Image new) width:19; height:18; bits:(ByteArray fromPackedString:'
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@PDA@PDA@PD@@@@@@@@@@@@@@@DB@ HB@ HC@P@@@@@@@@@@@@@D@ HB@ HBAPLD@@@@@@@@@@@@A \HBP(KC@4EC <@
+@@@@@@@@@A@QDQDQDQDQDQDP@@@@@@@@@@@RD1PUE  IB ,WF@@@@@@@@@@@FQ(ZF1(ZF!!(ZF!!0@@@@@@@@@@A4^EATVB@$UG0H @@@@@@@@@@@!!H"H"H"H"
+DRL$IP@#I"L@@@@@I2 TEQXHBR$*J2T@IR0*@@@@@B4.K"8.K"8LH2<+J#@/H0@@@@@1K!!XHBP(KF#H3IBL$M@@@@@@@MSX6M#X6M!!(#@C\8M3$#@@@@@C(:
+N#(:N#,<NC4#@BL7N@@@@@@@@@@@@@@@@BL>IP@?NC<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[84 82 80 200 182 110 248 250 250 212 178 110 196 180 120 220 190 120 192 178 120 244 248 250 156 172 200 148 166 200 140 160 190 136 154 190 248 248 250 224 200 140 212 178 100 196 178 120 188 176 120 244 246 250 184 172 120 240 246 250 172 188 210 168 184 210 164 180 210 240 244 250 184 174 120 180 170 130 236 242 250 240 242 250 200 192 160 176 166 130 236 240 250 216 224 230 236 234 230 172 164 130 232 238 250 116 114 110 100 100 100 116 116 120 92 94 90 168 162 140 228 236 250 192 202 220 96 94 90 136 136 140 136 134 130 164 158 140 224 234 250 88 90 90 128 126 130 156 156 140 224 224 230 84 86 90 84 84 80 156 154 140 220 232 250 112 110 110 80 80 80 80 82 80 152 152 150 180 178 170 224 224 220 112 112 110 80 78 80 112 114 110]; mask:((ImageMask new) width:19; height:18; bits:(ByteArray fromPackedString:'@@@_O<@_O>@_O?@_O? _O? _O? _O? _O? _O?._O?._O?>_O?<_O?>_O?._@C._@@@_@@@_') ; yourself); yourself]
+!
+
+console13x13Icon
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self console13x13Icon inspect
+     ImageEditor openOnClass:self andSelector:#console13x13Icon
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'FileApplicationNoteBook::Terminal console13x13Icon'
+        ifAbsentPut:[(Depth8Image new) width:13; height:13; bits:(ByteArray fromPackedString:'
+@PHB@ HB@ HB@ HB@PLDA@PDA@PDA@PDA@LCAPXFA XFA XFA TC@0\FB@ HB@ HB@ G@0$JA ,LCP8ODA@PB $QB XPDAHPDA@PD (QD1PFB0,UE!!\XC1HT
+D1LYA!!(ZF!!(ZF!!(ZF1L\GPXZF!!(ZF!!(ZF!!4\G!!<_G1<_G1<_G1<_G"@@@@@@@@@@@@@@@B@@@@@@H@@@@B@@@@@@@B@!!HRD!!HRD!!HRD @@@a') ; colorMapFromArray:#[47 88 144 95 128 176 47 112 200 47 104 184 80 96 128 95 104 128 208 232 248 95 104 136 255 248 248 47 104 176 96 112 136 111 128 176 95 112 168 80 96 144 64 88 136 63 72 128 240 240 248 47 96 176 239 240 248 47 96 168 111 120 144 96 120 168 95 104 160 79 96 144 64 80 136 112 128 144 224 232 248 112 120 144 47 96 160 112 128 160 47 88 160 127 136 160 79 112 168 47 88 136]; mask:((Depth1Image new) width:13; height:13; bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8??#?>@>@_?@b') ; yourself); yourself]
+!
+
+console22x22Icon
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self console22x22Icon inspect
+     ImageEditor openOnClass:self andSelector:#console22x22Icon
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'FileApplicationNoteBook::Terminal console22x22Icon'
+        ifAbsentPut:[(Depth8Image new) width:22; height:22; bits:(ByteArray fromPackedString:'
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@DB@ HB@ HB@ HB@ D@@@@@@@@@@@@CA@PDA@PDA@PDA@PC@@@@@@@@@@@@@0TFA XFA XFA XE@0@@@@@@@@@@
+@@LGA  HB@ HB@ HA0L@@@@@@@@@@@@IB XKC@4NC1@PD@(I@@@@@@@@@@@@DP(FDA@RDA@PDAHJDP@@@@@@@@@@@ALTA ,KEQXWF@<REAL@@@@@@@@@@@@S
+FPXZF!!(ZF!!(ZF!!,S@@@@@@@@@@@@GA4FF!!(ZF!!(ZF!!(]G@@@@@@@@@@@@A8_G1<_G1<_G1<_G18@@@@@@@@@@@@ @@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@
+@B@@@@@ @@@@@@@@@@@@@@@@@@@ HRD!!HRD!!HRD!!H@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[47 88 144 95 128 176 47 112 200 47 104 184 80 96 128 95 104 128 208 232 248 95 104 136 255 248 248 47 104 176 96 112 136 111 128 176 95 112 168 80 96 144 64 88 136 63 72 128 240 240 248 47 96 176 239 240 248 47 96 168 111 120 144 96 120 168 95 104 160 79 96 144 64 80 136 112 128 144 224 232 248 112 120 144 47 96 160 112 128 160 47 88 160 127 136 160 79 112 168 47 88 136]; mask:((ImageMask new) width:22; height:22; bits:(ByteArray fromPackedString:'@@@C@@@C@@@C@@@C@@@CA??CA??CA??CA??CA??CA??CA??CA??CA??CA??CA??C@G0C@?>C@@@C@@@C@@@C@@@C') ; yourself); yourself]
+! !
+
 !FileApplicationNoteBook::Terminal class methodsFor:'interface specs'!
 
 windowSpec
@@ -4422,7 +4511,7 @@
           name: 'Terminal'
           min: (Point 10 10)
           bounds: (Rectangle 0 0 692 537)
-          menu: mainMenu
+          "/ menu: mainMenu
         )
         component: 
        (SpecCollection
@@ -4431,7 +4520,7 @@
               name: 'MenuTerminal'
               layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0)
               level: 0
-              menu: menu
+              menu: toolbarMenu
               textDefault: true
             )
            (ArbitraryComponentSpec
@@ -4453,7 +4542,7 @@
 
 !FileApplicationNoteBook::Terminal class methodsFor:'menu specs'!
 
-menu
+toolbarMenu
     "This resource specification was automatically generated
      by the MenuEditor of ST/X."
 
@@ -4462,8 +4551,8 @@
 
 
     "
-     MenuEditor new openOnClass:FileApplicationNoteBook::Terminal andSelector:#menu
-     (Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::Terminal menu)) startUp
+     MenuEditor new openOnClass:FileApplicationNoteBook::Terminal andSelector:#toolbarMenu
+     (Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::Terminal toolbarMenu)) startUp
     "
 
     <resource: #menu>
@@ -4475,7 +4564,6 @@
             label: 'Save As...'
             itemValue: saveAs
             nameKey: Save
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary saveToFileAsIcon)
           )
@@ -4483,13 +4571,19 @@
             activeHelpKey: closeTabButton
             label: 'Close'
             itemValue: doClose
-            translateLabel: true
             isButton: true
             startGroup: right
             isVisible: closeButtonShown
             hideMenuOnActivated: false
             labelImage: (ResourceRetriever ToolbarIconLibrary removeTabIcon)
           )
+         (MenuItem
+            label: 'Clear Console Output'
+            itemValue: menuClearConsole
+            isButton: true
+            startGroup: right
+            labelImage: (ResourceRetriever #'FileApplicationNoteBook::Terminal' clearConsoleIcon)
+          )
          )
         nil
         nil
@@ -4524,7 +4618,12 @@
 
 !FileApplicationNoteBook::Terminal methodsFor:'actions'!
 
+menuClearConsole
+    terminalView clear.
+!
+
 saveAs
+    "open a save-as dialog"
 
     self terminalView save.
 ! !
@@ -4569,6 +4668,12 @@
 
 !FileApplicationNoteBook::Terminal methodsFor:'queries'!
 
+getTabIcon
+    "the item shown in a tab"
+
+    ^ self class console13x13Icon
+!
+
 getTabValueString
     "the item shown in a tab (not language translated)"
 
@@ -5343,18 +5448,17 @@
 
 changeInformation 
 
-    | stream win|
-
-    stream := WriteStream with:(self getTabString).
+    |string win|
+
+    string := self getTabString.
     masterApplication isNil ifTrue:[
         win := self window.
         win notNil ifTrue:[
-            self window label:stream contents.
+            self window label:string asString string.
         ].
     ] ifFalse:[
-        masterApplication tabStringChangeTo:stream contents for:self.
-    ].
-    stream close.
+        masterApplication tabStringChangeTo:string for:self.
+    ].
 !
 
 changeInformationForModified:aSymbol 
@@ -7392,10 +7496,10 @@
 !FileApplicationNoteBook class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.300 2014-07-15 10:05:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.301 2014-10-25 11:54:35 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.300 2014-07-15 10:05:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.301 2014-10-25 11:54:35 cg Exp $'
 ! !