Launcher.st
changeset 88 a38a2e87687b
parent 86 11b4ce85104e
child 89 43ca5e534f5e
equal deleted inserted replaced
87:0700c19ecb55 88:a38a2e87687b
     1 'From Smalltalk/X, Version:2.10.5 on 25-mar-1995 at 6:27:29 am'!
     1 "
       
     2  COPYRIGHT (c) 1995 by Claus Gittinger
       
     3 	      All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
     2 
    12 
     3 ApplicationModel subclass:#NewLauncher
    13 ApplicationModel subclass:#NewLauncher
     4 	 instanceVariableNames:'myMenu buttonPanel transcript infoView infoProcess helpIsOn'
    14 	 instanceVariableNames:'myMenu buttonPanel transcript infoView infoProcess helpIsOn'
     5 	 classVariableNames:'CachedAboutIcon'
    15 	 classVariableNames:'CachedAboutIcon'
     6 	 poolDictionaries:''
    16 	 poolDictionaries:''
     7 	 category:'Interface-Smalltalk'
    17 	 category:'Interface-Smalltalk'
     8 !
    18 !
       
    19 
       
    20 !NewLauncher class methodsFor:'documentation'!
       
    21 
       
    22 copyright
       
    23 "
       
    24  COPYRIGHT (c) 1995 by Claus Gittinger
       
    25 	      All Rights Reserved
       
    26 
       
    27  This software is furnished under a license and may be used
       
    28  only in accordance with the terms of that license and with the
       
    29  inclusion of the above copyright notice.   This software may not
       
    30  be provided or otherwise made available to, or used by, any
       
    31  other person.  No title to or ownership of the software is
       
    32  hereby transferred.
       
    33 "
       
    34 !
       
    35 
       
    36 version
       
    37 "
       
    38 $Header: /cvs/stx/stx/libtool/Launcher.st,v 1.2 1995-03-26 17:35:27 claus Exp $
       
    39 "
       
    40 ! !
     9 
    41 
    10 !NewLauncher class methodsFor:'defaults'!
    42 !NewLauncher class methodsFor:'defaults'!
    11 
    43 
    12 aboutIcon
    44 aboutIcon
    13     |image|
    45     |image|
    89 '.
   121 '.
    90     box label:'Style selection'.
   122     box label:'Style selection'.
    91     box list:listOfStyles.
   123     box list:listOfStyles.
    92     box initialText:View defaultStyle.
   124     box initialText:View defaultStyle.
    93     box action:[:newStyle |
   125     box action:[:newStyle |
    94         transcript topView withCursor:Cursor wait do:[
   126 	transcript topView withCursor:Cursor wait do:[
    95             Transcript showCr:'change style to ' , newStyle , ' ...'.
   127 	    Transcript showCr:'change style to ' , newStyle , ' ...'.
    96             View defaultStyle:newStyle asSymbol.
   128 	    View defaultStyle:newStyle asSymbol.
    97         ]
   129 	]
    98     ].    
   130     ].    
    99     box showAtPointer
   131     box showAtPointer
   100 !
   132 !
   101 
   133 
   102 languageSetting 
   134 languageSetting 
   146     "setup the pulldown menu"
   178     "setup the pulldown menu"
   147 
   179 
   148     |l s|
   180     |l s|
   149 
   181 
   150     myMenu labels:(resources array:#(
   182     myMenu labels:(resources array:#(
   151                                      'about'
   183 				     'about'
   152                                      'file'
   184 				     'file'
   153                                      'classes'
   185 				     'classes'
   154                                      'tools'
   186 				     'tools'
   155                                      'projects'
   187 				     'projects'
   156                                      'settings'
   188 				     'settings'
   157                                      'goodies'
   189 				     'goodies'
   158                                      'demos'
   190 				     'demos'
   159                                      'help')).
   191 				     'help')).
   160     myMenu labels at:1 put:(self class aboutIcon).
   192     myMenu labels at:1 put:(self class aboutIcon).
   161 
   193 
   162     myMenu selectors:#(
   194     myMenu selectors:#(
   163                                      #about
   195 				     #about
   164                                      #file
   196 				     #file
   165                                      #classes 
   197 				     #classes 
   166                                      #tools 
   198 				     #tools 
   167                                      #projects 
   199 				     #projects 
   168                                      #settings
   200 				     #settings
   169                                      #goodies
   201 				     #goodies
   170                                      #demos
   202 				     #demos
   171                                      #help).
   203 				     #help).
   172 
   204 
   173     myMenu at:#about 
   205     myMenu at:#about 
   174            putLabels:(resources array:#(
   206 	   putLabels:(resources array:#(
   175                                         'about Smalltalk/X ...'
   207 					'about Smalltalk/X ...'
   176                                        ))
   208 				       ))
   177            selectors:#(
   209 	   selectors:#(
   178                                         #about 
   210 					#about 
   179                       )
   211 		      )
   180            receiver:self.
   212 	   receiver:self.
   181 
   213 
   182     myMenu at:#file
   214     myMenu at:#file
   183            putLabels:(resources array:#(
   215 	   putLabels:(resources array:#(
   184                                         'file browser'
   216 					'file browser'
   185                                         '-'
   217 					'-'
   186                                         'snapshot'
   218 					'snapshot'
   187                                         'snapshot & exit'
   219 					'snapshot & exit'
   188                                         'exit'
   220 					'exit'
   189                                        ))
   221 				       ))
   190            selectors:#(
   222 	   selectors:#(
   191                                         #startFileBrowser
   223 					#startFileBrowser
   192                                         nil
   224 					nil
   193                                         #snapshot
   225 					#snapshot
   194                                         #snapshotAndExit
   226 					#snapshotAndExit
   195                                         #exit
   227 					#exit
   196                       )
   228 		      )
   197            receiver:self.
   229 	   receiver:self.
   198 
   230 
   199     myMenu at:#classes 
   231     myMenu at:#classes 
   200            putLabels:(resources array:#(
   232 	   putLabels:(resources array:#(
   201                                         'system browser'
   233 					'system browser'
   202                                         'class browser'
   234 					'class browser'
   203                                         'full class browser'
   235 					'full class browser'
   204                                         'class hierarchy browser'
   236 					'class hierarchy browser'
   205                                         'class tree'
   237 					'class tree'
   206                                         '-'
   238 					'-'
   207                                         'implementors'
   239 					'implementors'
   208                                         'senders'
   240 					'senders'
   209                                         '-'
   241 					'-'
   210                                         'change browser'
   242 					'change browser'
   211                                         ))
   243 					))
   212            selectors:#(
   244 	   selectors:#(
   213                                         #startSystemBrowser 
   245 					#startSystemBrowser 
   214                                         #startClassBrowser 
   246 					#startClassBrowser 
   215                                         #startFullClassBrowser 
   247 					#startFullClassBrowser 
   216                                         #startClassHierarchyBrowser 
   248 					#startClassHierarchyBrowser 
   217                                         #startClassTreeView 
   249 					#startClassTreeView 
   218                                         nil
   250 					nil
   219                                         #browseImplementors 
   251 					#browseImplementors 
   220                                         #browseSenders 
   252 					#browseSenders 
   221                                         nil
   253 					nil
   222                                         #startChangesBrowser 
   254 					#startChangesBrowser 
   223                       )
   255 		      )
   224            receiver:self.
   256 	   receiver:self.
   225 
   257 
   226     myMenu at:#tools 
   258     myMenu at:#tools 
   227            putLabels:(resources array:#(
   259 	   putLabels:(resources array:#(
   228                                         'workspace'
   260 					'workspace'
   229                                         '-'
   261 					'-'
   230                                         'process monitor'
   262 					'process monitor'
   231                                         'memory monitor'
   263 					'memory monitor'
   232                                         '-'
   264 					'-'
   233                                         'memory usage'
   265 					'memory usage'
   234                                         '-'
   266 					'-'
   235                                         'window tree'
   267 					'window tree'
   236                                         'inspect view'
   268 					'inspect view'
   237                                         'destroy view'
   269 					'destroy view'
   238                                         ))
   270 					))
   239            selectors:#(
   271 	   selectors:#(
   240                                         #startWorkspace 
   272 					#startWorkspace 
   241                                         nil
   273 					nil
   242                                         #startProcessMonitor
   274 					#startProcessMonitor
   243                                         #startMemoryMonitor 
   275 					#startMemoryMonitor 
   244                                         nil
   276 					nil
   245                                         #startMemoryUsageView 
   277 					#startMemoryUsageView 
   246                                         nil
   278 					nil
   247                                         #startWindowTreeView 
   279 					#startWindowTreeView 
   248                                         #viewInspect 
   280 					#viewInspect 
   249                                         #viewDestroy 
   281 					#viewDestroy 
   250                       )
   282 		      )
   251            receiver:self.
   283 	   receiver:self.
   252 
   284 
   253     myMenu at:#projects 
   285     myMenu at:#projects 
   254            putLabels:(resources array:#(
   286 	   putLabels:(resources array:#(
   255                                         'new project'
   287 					'new project'
   256                                         '-'
   288 					'-'
   257                                         'select project'
   289 					'select project'
   258                                         ))
   290 					))
   259            selectors:#(
   291 	   selectors:#(
   260                                         #newProject 
   292 					#newProject 
   261                                         nil
   293 					nil
   262                                         #selectProject 
   294 					#selectProject 
   263                       )
   295 		      )
   264            receiver:self.
   296 	   receiver:self.
   265 
   297 
   266     myMenu at:#settings 
   298     myMenu at:#settings 
   267            putLabels:(resources array:#(
   299 	   putLabels:(resources array:#(
   268                                         'language'
   300 					'language'
   269                                         'view style'
   301 					'view style'
   270                                         'compilation'
   302 					'compilation'
   271                                         ))
   303 					))
   272            selectors:#(
   304 	   selectors:#(
   273                                         #languageSetting 
   305 					#languageSetting 
   274                                         #viewStyleSetting 
   306 					#viewStyleSetting 
   275                                         #compilerSetting 
   307 					#compilerSetting 
   276                       )
   308 		      )
   277            receiver:self.
   309 	   receiver:self.
   278 
   310 
   279     myMenu at:#goodies 
   311     myMenu at:#goodies 
   280            putLabels:(resources array:#(
   312 	   putLabels:(resources array:#(
   281                                         'clock'
   313 					'clock'
   282                                         'calendar'
   314 					'calendar'
   283                                         '-'
   315 					'-'
   284                                         'mail tool'
   316 					'mail tool'
   285                                         'news tool'
   317 					'news tool'
   286                                         '-'
   318 					'-'
   287                                         'draw tool'
   319 					'draw tool'
   288                                         ))
   320 					))
   289            selectors:#(
   321 	   selectors:#(
   290                                         #startClock 
   322 					#startClock 
   291                                         #startCalendar 
   323 					#startCalendar 
   292                                         nil
   324 					nil
   293                                         #startMailTool 
   325 					#startMailTool 
   294                                         #startNewsTool
   326 					#startNewsTool
   295                                         nil
   327 					nil
   296                                         #startDrawTool
   328 					#startDrawTool
   297                       )
   329 		      )
   298            receiver:self.
   330 	   receiver:self.
   299 
   331 
   300     myMenu at:#demos 
   332     myMenu at:#demos 
   301            putLabels:(resources array:#(
   333 	   putLabels:(resources array:#(
   302                                         ))
   334 					))
   303            selectors:#(
   335 	   selectors:#(
   304                       )
   336 		      )
   305            receiver:self.
   337 	   receiver:self.
   306 
   338 
   307     ActiveHelp notNil ifTrue:[
   339     ActiveHelp notNil ifTrue:[
   308         l := #(
   340 	l := #(
   309                 '\c active help'
   341 		'\c active help'
   310                 'ST/X documentation'
   342 		'ST/X documentation'
   311               ).
   343 	      ).
   312         s := #(
   344 	s := #(
   313                 #toggleActiveHelp
   345 		#toggleActiveHelp
   314                 #startDocumentationTool
   346 		#startDocumentationTool
   315               )
   347 	      )
   316     ] ifFalse:[
   348     ] ifFalse:[
   317         l := #(
   349 	l := #(
   318                 'ST/X documentation'
   350 		'ST/X documentation'
   319               ).
   351 	      ).
   320         s := #(
   352 	s := #(
   321                 #startDocumentationTool
   353 		#startDocumentationTool
   322               )
   354 	      )
   323     ].
   355     ].
   324 
   356 
   325     myMenu at:#help 
   357     myMenu at:#help 
   326            putLabels:(resources array:l)
   358 	   putLabels:(resources array:l)
   327            selectors:s
   359 	   selectors:s
   328            receiver:self.
   360 	   receiver:self.
   329 !
   361 !
   330 
   362 
   331 setupTranscriptIn:aView 
   363 setupTranscriptIn:aView 
   332     |v|
   364     |v|
   333 
   365 
   431     infoProcess notNil ifTrue:[
   463     infoProcess notNil ifTrue:[
   432 	infoProcess terminate.
   464 	infoProcess terminate.
   433 	infoProcess := nil.
   465 	infoProcess := nil.
   434     ].
   466     ].
   435     super release
   467     super release
       
   468 !
       
   469 
       
   470 focusSequence
       
   471     ^ (Array with:myMenu) , buttonPanel subViews , (Array with:Transcript)
   436 ! !
   472 ! !
   437 
   473 
   438 !NewLauncher methodsFor:'actions - classes'!
   474 !NewLauncher methodsFor:'actions - classes'!
   439 
   475 
   440 startFileBrowser
   476 startFileBrowser
   499 
   535 
   500 info
   536 info
   501     |project projectName projectDir|
   537     |project projectName projectDir|
   502 
   538 
   503     (project := Project current) isNil ifTrue:[
   539     (project := Project current) isNil ifTrue:[
   504         projectName := '* none *'.
   540 	projectName := '* none *'.
   505         projectDir := '.'.
   541 	projectDir := '.'.
   506     ] ifFalse:[
   542     ] ifFalse:[
   507         projectName := project name.
   543 	projectName := project name.
   508         projectDir := project directory.
   544 	projectDir := project directory.
   509     ].
   545     ].
   510 
   546 
   511     ^ resources
   547     ^ resources
   512         string:'project: ''%1''  fileOut to: ''%2'''
   548 	string:'project: ''%1''  fileOut to: ''%2'''
   513           with:projectName
   549 	  with:projectName
   514           with:(projectDir contractTo:30)
   550 	  with:(projectDir contractTo:30)
   515 ! !
   551 ! !
   516 
   552 
   517 !NewLauncher methodsFor:'actions - about & help'!
   553 !NewLauncher methodsFor:'actions - about & help'!
   518 
   554 
   519 about
   555 about
   524     box showAtCenter
   560     box showAtCenter
   525 !
   561 !
   526 
   562 
   527 toggleActiveHelp
   563 toggleActiveHelp
   528     ActiveHelp notNil ifTrue:[
   564     ActiveHelp notNil ifTrue:[
   529         helpIsOn isNil ifTrue:[helpIsOn := false].
   565 	helpIsOn isNil ifTrue:[helpIsOn := false].
   530         helpIsOn := helpIsOn not.
   566 	helpIsOn := helpIsOn not.
   531         helpIsOn ifTrue:[
   567 	helpIsOn ifTrue:[
   532             ActiveHelp start
   568 	    ActiveHelp start
   533         ] ifFalse:[
   569 	] ifFalse:[
   534             ActiveHelp stop
   570 	    ActiveHelp stop
   535         ]
   571 	]
   536     ].
   572     ].
   537 ! !
   573 ! !
   538 
   574 
   539 !NewLauncher methodsFor:'actions - tools'!
   575 !NewLauncher methodsFor:'actions - tools'!
   540 
   576 
   558 viewInspect
   594 viewInspect
   559     |v|
   595     |v|
   560 
   596 
   561     v := self pickAView.
   597     v := self pickAView.
   562     v notNil ifTrue:[
   598     v notNil ifTrue:[
   563         v topView inspect
   599 	v topView inspect
   564     ]
   600     ]
   565 
   601 
   566 !
   602 !
   567 
   603 
   568 viewInspector
   604 viewInspector
   569     |v|
   605     |v|
   570 
   606 
   571     v := self pickAView.
   607     v := self pickAView.
   572     v notNil ifTrue:[
   608     v notNil ifTrue:[
   573         v topView inspect
   609 	v topView inspect
   574     ]
   610     ]
   575 
   611 
   576 !
   612 !
   577 
   613 
   578 viewDestroy
   614 viewDestroy
   579     |v|
   615     |v|
   580 
   616 
   581     v := self pickAView.
   617     v := self pickAView.
   582     v notNil ifTrue:[
   618     v notNil ifTrue:[
   583         v topView destroy
   619 	v topView destroy
   584     ]
   620     ]
   585 
   621 
   586 ! !
   622 ! !
   587 
   623 
   588 !NewLauncher methodsFor:'actions - goodies'!
   624 !NewLauncher methodsFor:'actions - goodies'!
   727 	] ifFalse:[
   763 	] ifFalse:[
   728 	    aBlock value:cls  
   764 	    aBlock value:cls  
   729 	]
   765 	]
   730     ].
   766     ].
   731     enterBox showAtPointer
   767     enterBox showAtPointer
   732 
       
   733 
       
   734 !
   768 !
   735 
   769 
   736 closeDownViews
   770 closeDownViews
   737     "tell each topview that we are going to terminate and give it chance
   771     "tell each topview that we are going to terminate and give it chance
   738      to save its contents."
   772      to save its contents."
   739 
   773 
   740     ObjectMemory changed:#aboutToExit
   774     ObjectMemory changed:#aboutToExit
   741 
       
   742 
       
   743 !
   775 !
   744 
   776 
   745 pickAView
   777 pickAView
   746     |v|
   778     |v|
   747 
   779 
   748     (Delay forSeconds:1) wait.
   780     (Delay forSeconds:1) wait.
   749     v := Display viewFromUser.
   781     v := Display viewFromUser.
   750     v isNil ifTrue:[
   782     v isNil ifTrue:[
   751         self warn:'sorry, this is not a smalltalk view'.
   783 	self warn:'sorry, this is not a smalltalk view'.
   752         ^ nil
   784 	^ nil
   753     ].
   785     ].
   754     ^ v
   786     ^ v
   755 
       
   756 
       
   757 
       
   758 ! !
   787 ! !
   759 
   788 
   760 !NewLauncher methodsFor:'help'!
   789 !NewLauncher methodsFor:'help'!
   761 
   790 
   762 helpTextFor:aComponent
   791 helpTextFor:aComponent
   763     |sel|
   792     |sel|
   764 
   793 
   765     aComponent == transcript ifTrue:[
   794     aComponent == transcript ifTrue:[
   766         ^ resources string:'this is the Transcript.\It can be used to send\messages to the user.'
   795 	^ resources string:'this is the Transcript.\It is used to send\messages to the user.'
       
   796     ].
       
   797 
       
   798     aComponent == infoView ifTrue:[
       
   799 	^ resources string:'this shows the name of the current\project and the directory\where a fileOut operation writes the file.'
   767     ].
   800     ].
   768 
   801 
   769     (buttonPanel subViews includes:aComponent) ifTrue:[
   802     (buttonPanel subViews includes:aComponent) ifTrue:[
   770         "kludge: look for its change selector"
   803 	"kludge: look for its change selector"
   771         sel := aComponent changeSymbol.
   804 	sel := aComponent changeSymbol.
   772         sel == #startSystemBrowser ifTrue:[
   805 	sel == #startSystemBrowser ifTrue:[
   773             ^ resources string:'opens a\SystemBrowser'
   806 	    ^ resources string:'opens a\SystemBrowser'
   774         ].
   807 	].
   775         sel == #startFileBrowser ifTrue:[
   808 	sel == #startFileBrowser ifTrue:[
   776             ^ resources string:'opens a\FileBrowser'
   809 	    ^ resources string:'opens a\FileBrowser'
   777         ].
   810 	].
   778     ].
   811     ].
   779     ^ nil
   812     ^ nil
   780 ! !
   813 ! !
   781