1793 WorkspaceApplication openOnFile:'Makefile' |
1793 WorkspaceApplication openOnFile:'Makefile' |
1794 " |
1794 " |
1795 ! |
1795 ! |
1796 |
1796 |
1797 openSystemWorkspace |
1797 openSystemWorkspace |
1798 |wsApp path needRemove font| |
1798 ^ self new openSystemWorkspace. |
1799 |
|
1800 needRemove := true. |
|
1801 |
|
1802 wsApp := self new. |
|
1803 wsApp allButOpen. |
|
1804 |
|
1805 (wsApp builder componentAt:'NoteBook') |
|
1806 destroyTabAction:[:tabIndex| wsApp removeWorkspace:tabIndex]. |
|
1807 |
|
1808 wsApp window extent:640@400. |
|
1809 |
|
1810 path := (Smalltalk getSystemFileName:'README') ? '../../README'. |
|
1811 path := path asFilename. |
|
1812 path isReadable ifTrue:[ |
|
1813 wsApp addWindow:(self createWorkspaceView) named:'README' asFirst:false. |
|
1814 wsApp loadFile:path. |
|
1815 wsApp removeWorkspace:1. "/ the original Workspace |
|
1816 wsApp renameWorkspace:1 to:'LICENCE README'. |
|
1817 needRemove := false. |
|
1818 ]. |
|
1819 |
|
1820 "/ path := (Smalltalk getSystemFileName:'doc/online/english/LICENCE_STX.html') ? '../../doc/online/english/LICENCE_STX.html'. |
|
1821 "/ path asFilename exists ifTrue:[ |
|
1822 "/ wsApp addWindow:(licenceView := HVScrollableView for:HTMLDocumentView) named:'License' asFirst:false. |
|
1823 "/ licenceView homeDocument:'../../doc/online/english/LICENCE_STX.html'. |
|
1824 "/ licenceView updateLabelFlag:false. |
|
1825 "/ needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
1826 "/ needRemove := false. |
|
1827 "/ ]. |
|
1828 |
|
1829 wsApp graphicsDevice platformName = 'X11' ifTrue:[ |
|
1830 font := Font family:'unifont' face:'medium' style:'roman' size:16 encoding:'iso10646-1'. |
|
1831 font := font onDevice:wsApp graphicsDevice ifAbsent:nil. |
|
1832 font isNil ifTrue:[ |
|
1833 font := Font family:'arial' face:'medium' style:'roman' size:12 encoding:'iso10646-1'. |
|
1834 font := font onDevice:wsApp graphicsDevice ifAbsent:nil. |
|
1835 ]. |
|
1836 ] ifFalse:[ |
|
1837 "/ font := Font family:'Arial Unicode MS' face:'medium' style:'roman' size:10 encoding:'ms-ansi'. |
|
1838 font := Font family:'arial' face:'medium' style:'roman' size:10 encoding:'ms-ansi'. |
|
1839 font := font onDevice:wsApp graphicsDevice ifAbsent:nil. |
|
1840 ]. |
|
1841 |
|
1842 #( "/ file resourceKey title forcedEncoding type |
|
1843 ('Hello_utf8.wsp' HELLO_UTF_FILE 'Hello' #'utf8' #text) |
|
1844 ('Welcome.wsp' WELCOME_FILE 'This Release' nil #text) |
|
1845 "/ ('Setup.wsp' SETUP_FILE 'Setup' nil #text) |
|
1846 ('Keyboard.wsp' KEYBOARD_FILE 'Keyboard' nil #text) |
|
1847 "/ ('GettingStarted.wsp' GETTING_STARTED_FILE 'Getting Started' nil #text) |
|
1848 ('../../doc/online/english/GettingStarted.html' GETTING_STARTED_TML_FILE 'Getting Started' nil #html) |
|
1849 ('../../doc/books/JoyOfST/IntroToST.html' INTRO_TO_ST_FILE 'Smalltalk Introduction' nil #html) |
|
1850 "/ if these are present, show them. |
|
1851 ('Private.wsp' PRIVATE_FILE 'Private Workspace' nil #text) |
|
1852 ('MyWorkspace.wsp' MYWORKSPACE_FILE 'My Workspace' nil #text) |
|
1853 ('PackageLoading.wsp' PACKAGELOADING_FILE 'Packages' nil #text) |
|
1854 ) do:[:tuple | |
|
1855 |file resKey title forcedEncoding type pane encoding htmlView| |
|
1856 |
|
1857 file := tuple at:1. |
|
1858 resKey := tuple at:2. |
|
1859 file := self classResources string:resKey default:file. |
|
1860 |
|
1861 title := tuple at:3. |
|
1862 forcedEncoding := tuple at:4. |
|
1863 type := tuple at:5. |
|
1864 |
|
1865 path := Smalltalk getSystemFileName:file. |
|
1866 (path notNil and:[path asFilename isReadable]) ifTrue:[ |
|
1867 type == #html ifTrue:[ |
|
1868 wsApp addWindow:(htmlView := HVScrollableView for:HTMLDocumentView) named:title asFirst:false. |
|
1869 htmlView homeDocument:path. |
|
1870 htmlView infoHolder:wsApp infoLabelHolder. |
|
1871 htmlView updateTopViewsTitleFlag:false. |
|
1872 ] ifFalse:[ |
|
1873 wsApp addWindow:(pane := self createWorkspaceView) named:title asFirst:false. |
|
1874 forcedEncoding notNil ifTrue:[ |
|
1875 encoding := forcedEncoding. |
|
1876 font notNil ifTrue:[ |
|
1877 pane font:font. |
|
1878 ] |
|
1879 ] ifFalse:[ |
|
1880 encoding := CharacterEncoder guessEncodingOfFile:path. |
|
1881 (encoding == #'iso8859-1' or:[encoding == #'ascii']) ifTrue:[ |
|
1882 encoding := nil |
|
1883 ]. |
|
1884 ]. |
|
1885 wsApp loadFile:path encoding:encoding label:title. |
|
1886 ]. |
|
1887 needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
1888 needRemove := false. |
|
1889 ]. |
|
1890 ]. |
|
1891 wsApp openWindow. |
|
1892 wsApp selectedWorkspaceIndexHolder value:2. |
|
1893 ^ wsApp |
|
1894 |
1799 |
1895 " |
1800 " |
1896 |ws b| |
1801 |ws b| |
1897 ws := self openSystemWorkspace. |
1802 ws := self openSystemWorkspace. |
1898 ws addMyWorkspace. |
1803 ws addMyWorkspace. |
4267 self toolBarView |
4172 self toolBarView |
4268 client: self spec: #toolBarSpec builder: builder. |
4173 client: self spec: #toolBarSpec builder: builder. |
4269 ] |
4174 ] |
4270 ! ! |
4175 ! ! |
4271 |
4176 |
|
4177 !WorkspaceApplication methodsFor:'special startup'! |
|
4178 |
|
4179 openSystemWorkspace |
|
4180 |path needRemove font| |
|
4181 |
|
4182 needRemove := true. |
|
4183 |
|
4184 self allButOpen. |
|
4185 |
|
4186 (self builder componentAt:'NoteBook') |
|
4187 destroyTabAction:[:tabIndex| self removeWorkspace:tabIndex]. |
|
4188 |
|
4189 self window extent:640@400. |
|
4190 |
|
4191 path := (Smalltalk getSystemFileName:'README') ? '../../README'. |
|
4192 path := path asFilename. |
|
4193 path isReadable ifTrue:[ |
|
4194 self addWindow:(self createWorkspaceView) named:'README' asFirst:false. |
|
4195 self loadFile:path. |
|
4196 self removeWorkspace:1. "/ the original Workspace |
|
4197 self renameWorkspace:1 to:'LICENCE README'. |
|
4198 needRemove := false. |
|
4199 ]. |
|
4200 |
|
4201 "/ path := (Smalltalk getSystemFileName:'doc/online/english/LICENCE_STX.html') ? '../../doc/online/english/LICENCE_STX.html'. |
|
4202 "/ path asFilename exists ifTrue:[ |
|
4203 "/ self addWindow:(licenceView := HVScrollableView for:HTMLDocumentView) named:'License' asFirst:false. |
|
4204 "/ licenceView homeDocument:'../../doc/online/english/LICENCE_STX.html'. |
|
4205 "/ licenceView updateLabelFlag:false. |
|
4206 "/ needRemove ifTrue:[self removeWorkspace:1]. "/ the original Workspace |
|
4207 "/ needRemove := false. |
|
4208 "/ ]. |
|
4209 |
|
4210 self graphicsDevice platformName = 'X11' ifTrue:[ |
|
4211 font := Font family:'unifont' face:'medium' style:'roman' size:16 encoding:'iso10646-1'. |
|
4212 font := font onDevice:self graphicsDevice ifAbsent:nil. |
|
4213 font isNil ifTrue:[ |
|
4214 font := Font family:'arial' face:'medium' style:'roman' size:12 encoding:'iso10646-1'. |
|
4215 font := font onDevice:self graphicsDevice ifAbsent:nil. |
|
4216 ]. |
|
4217 ] ifFalse:[ |
|
4218 "/ font := Font family:'Arial Unicode MS' face:'medium' style:'roman' size:10 encoding:'ms-ansi'. |
|
4219 font := Font family:'arial' face:'medium' style:'roman' size:10 encoding:'ms-ansi'. |
|
4220 font := font onDevice:self graphicsDevice ifAbsent:nil. |
|
4221 ]. |
|
4222 |
|
4223 #( "/ file resourceKey title forcedEncoding type |
|
4224 ('Hello_utf8.wsp' HELLO_UTF_FILE 'Hello' #'utf8' #text) |
|
4225 ('Welcome.wsp' WELCOME_FILE 'This Release' nil #text) |
|
4226 "/ ('Setup.wsp' SETUP_FILE 'Setup' nil #text) |
|
4227 ('Keyboard.wsp' KEYBOARD_FILE 'Keyboard' nil #text) |
|
4228 "/ ('GettingStarted.wsp' GETTING_STARTED_FILE 'Getting Started' nil #text) |
|
4229 ('../../doc/online/english/GettingStarted.html' GETTING_STARTED_TML_FILE 'Getting Started' nil #html) |
|
4230 ('../../doc/books/JoyOfST/IntroToST.html' INTRO_TO_ST_FILE 'Smalltalk Introduction' nil #html) |
|
4231 "/ if these are present, show them. |
|
4232 ('Private.wsp' PRIVATE_FILE 'Private Workspace' nil #text) |
|
4233 ('MyWorkspace.wsp' MYWORKSPACE_FILE 'My Workspace' nil #text) |
|
4234 ('PackageLoading.wsp' PACKAGELOADING_FILE 'Packages' nil #text) |
|
4235 ) do:[:tuple | |
|
4236 |file resKey title forcedEncoding type pane encoding htmlView| |
|
4237 |
|
4238 file := tuple at:1. |
|
4239 resKey := tuple at:2. |
|
4240 file := self resources string:resKey default:file. |
|
4241 |
|
4242 title := tuple at:3. |
|
4243 forcedEncoding := tuple at:4. |
|
4244 type := tuple at:5. |
|
4245 |
|
4246 path := Smalltalk getSystemFileName:file. |
|
4247 (path notNil and:[path asFilename isReadable]) ifTrue:[ |
|
4248 type == #html ifTrue:[ |
|
4249 self addWindow:(htmlView := HVScrollableView for:HTMLDocumentView) named:title asFirst:false. |
|
4250 htmlView homeDocument:path. |
|
4251 htmlView infoHolder:self infoLabelHolder. |
|
4252 htmlView updateTopViewsTitleFlag:false. |
|
4253 ] ifFalse:[ |
|
4254 self addWindow:(pane := self createWorkspaceView) named:title asFirst:false. |
|
4255 forcedEncoding notNil ifTrue:[ |
|
4256 encoding := forcedEncoding. |
|
4257 font notNil ifTrue:[ |
|
4258 pane font:font. |
|
4259 ] |
|
4260 ] ifFalse:[ |
|
4261 encoding := CharacterEncoder guessEncodingOfFile:path. |
|
4262 (encoding == #'iso8859-1' or:[encoding == #'ascii']) ifTrue:[ |
|
4263 encoding := nil |
|
4264 ]. |
|
4265 ]. |
|
4266 self loadFile:path encoding:encoding label:title. |
|
4267 ]. |
|
4268 needRemove ifTrue:[self removeWorkspace:1]. "/ the original Workspace |
|
4269 needRemove := false. |
|
4270 ]. |
|
4271 ]. |
|
4272 self openWindow. |
|
4273 self selectedWorkspaceIndexHolder value:2. |
|
4274 |
|
4275 " |
|
4276 |ws b| |
|
4277 ws := self openSystemWorkspace. |
|
4278 ws addMyWorkspace. |
|
4279 ws selectedWorkspaceIndexHolder value:(ws workspaces size). |
|
4280 ws selectedWorkspace contents:'Tools::NewSystemBrowser open'; selectAll. |
|
4281 ws selectedWorkspace |
|
4282 add:(b := Button label:'DoIt' action:[ws doIt. b destroy]) |
|
4283 " |
|
4284 " |
|
4285 |ws b| |
|
4286 ws := self new. |
|
4287 ws open. |
|
4288 ws selectedWorkspace contents:'Tools::NewSystemBrowser open'; selectAll. |
|
4289 " |
|
4290 |
|
4291 "Modified: / 14-02-2010 / 23:02:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4292 "Modified: / 05-07-2011 / 15:34:40 / cg" |
|
4293 ! ! |
|
4294 |
4272 !WorkspaceApplication methodsFor:'user actions'! |
4295 !WorkspaceApplication methodsFor:'user actions'! |
4273 |
4296 |
4274 infoVisibilityChanged |
4297 infoVisibilityChanged |
4275 super infoVisibilityChanged. |
4298 super infoVisibilityChanged. |
4276 UserPreferences current infoVisibleInWorkspace:(self infoVisibleHolder value) |
4299 UserPreferences current infoVisibleInWorkspace:(self infoVisibleHolder value) |