ShowMeHowItWorks.st
changeset 3862 bbe57509fc55
parent 3861 11efde58092f
equal deleted inserted replaced
3861:11efde58092f 3862:bbe57509fc55
   277 
   277 
   278 application:anApplication
   278 application:anApplication
   279     "if set, only that application is presented (widget search is limited to that one)"
   279     "if set, only that application is presented (widget search is limited to that one)"
   280 
   280 
   281     application := anApplication.
   281     application := anApplication.
       
   282     anApplication window raiseDeiconified.
   282 !
   283 !
   283 
   284 
   284 setLanguage:lang
   285 setLanguage:lang
   285     voice := OperatingSystem bestVoiceForLanguage:lang.
   286     voice := OperatingSystem bestVoiceForLanguage:lang.
   286     language := lang.
   287     language := lang.
   355     IntroShownCount := IntroShownCount + 1.
   356     IntroShownCount := IntroShownCount + 1.
   356 
   357 
   357     language isNil ifTrue:[
   358     language isNil ifTrue:[
   358         self setLanguage:(Smalltalk language). 
   359         self setLanguage:(Smalltalk language). 
   359     ].
   360     ].
   360     self tell:(self class classResources 
   361     "/ self tell:(self class classResources 
   361            string:'You can stop this show, by pressing the SHIFT key').
   362     "/        string:'You can stop this show, by pressing the SHIFT key').
       
   363     self show:'You can stop this show, by pressing the SHIFT key'.
   362 
   364 
   363     "Created: / 19-07-2019 / 15:49:19 / Claus Gittinger"
   365     "Created: / 19-07-2019 / 15:49:19 / Claus Gittinger"
   364     "Modified: / 23-07-2019 / 11:06:13 / Claus Gittinger"
   366     "Modified: / 23-07-2019 / 11:06:13 / Claus Gittinger"
   365 !
   367 !
   366 
   368 
   692 useApplication:classNameOrWindowTitle 
   694 useApplication:classNameOrWindowTitle 
   693     <action>
   695     <action>
   694 
   696 
   695     "find an application by name and return it (useful as arg to application)"
   697     "find an application by name and return it (useful as arg to application)"
   696 
   698 
   697     application := 
   699     self application:(
   698         self 
   700         self 
   699             findApplication:classNameOrWindowTitle 
   701             findApplication:classNameOrWindowTitle 
   700             ifMultiple:[
   702             ifMultiple:[
   701                 self error:('multiple applications named "%1"' bindWith:classNameOrWindowTitle).
   703                 self error:('multiple applications named "%1"' bindWith:classNameOrWindowTitle).
   702                 nil
   704                 nil
   703         ]
   705         ])
   704 ! !
   706 ! !
   705 
   707 
   706 !ShowMeHowItWorks methodsFor:'commands - checking'!
   708 !ShowMeHowItWorks methodsFor:'commands - checking'!
   707 
   709 
   708 isEmpty:componentName
   710 isEmpty:componentName
  2666     streamStack isNil ifTrue:[ streamStack := OrderedCollection new ].
  2668     streamStack isNil ifTrue:[ streamStack := OrderedCollection new ].
  2667     streamStack add:opStream.
  2669     streamStack add:opStream.
  2668 
  2670 
  2669     previousStream := opStream.
  2671     previousStream := opStream.
  2670     [
  2672     [
  2671         |nextCommand|
  2673         |nextCommand savedLanguage|
  2672 
  2674 
  2673         opStream := specStream.
  2675         opStream := specStream.
  2674         startLabelOrNil notNil ifTrue:[
  2676         startLabelOrNil notNil ifTrue:[
  2675             self goto:startLabelOrNil
  2677             self goto:startLabelOrNil
  2676         ].
  2678         ].
  2687             ] do:[
  2689             ] do:[
  2688                 self doCommand:nextCommand.
  2690                 self doCommand:nextCommand.
  2689             ].
  2691             ].
  2690 
  2692 
  2691             Display shiftDown ifTrue:[
  2693             Display shiftDown ifTrue:[
       
  2694                 savedLanguage := language.
       
  2695                 self language:Smalltalk language.
       
  2696 
  2692                 (IntroShownCount ? 0) > 3 ifFalse:[
  2697                 (IntroShownCount ? 0) > 3 ifFalse:[
  2693                     self tell:(self translate:'You pressed the SHIFT key.').
  2698                     self tell:(self translate:'You pressed the SHIFT key.').
       
  2699                     self tell:(self translate:'Do you want to stop the show?').
  2694                 ].    
  2700                 ].    
  2695                 self tell:(self translate:'Do you want to stop the show?').
       
  2696                 (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?'))
  2701                 (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?'))
  2697                 ifTrue:[
  2702                 ifTrue:[
  2698                     self tell:(self translate:'OK,').
  2703                     self tell:(self translate:'OK,').
  2699                     self tell:(self translate:(self randomThankYou)).
  2704                     self tell:(self translate:(self randomThankYou)).
  2700                     ^ AbortOperationRequest raise
  2705                     ^ AbortOperationRequest raise
  2701                 ].    
  2706                 ].    
       
  2707                 self language:savedLanguage.
  2702             ].    
  2708             ].    
  2703         ].    
  2709         ].    
  2704     ] ensure:[
  2710     ] ensure:[
  2705         streamStack removeLast.
  2711         streamStack removeLast.
  2706         opStream := previousStream
  2712         opStream := previousStream