FlyByHelp.st
changeset 4290 41b4ee0f8937
parent 4281 1629dc18017e
child 4307 1b0e3ba1d905
equal deleted inserted replaced
4289:802ab7b31479 4290:41b4ee0f8937
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 2001 by eXept Software AG
     2  COPYRIGHT (c) 2001 by eXept Software AG
     5               All Rights Reserved
     3               All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
   122     
   120     
   123     app := aView topView application.
   121     app := aView topView application.
   124     app enqueueDelayedAction:[
   122     app enqueueDelayedAction:[
   125         |editor m canDefineTranslationForLabel canDefineTranslationForHelpText|
   123         |editor m canDefineTranslationForLabel canDefineTranslationForHelpText|
   126 
   124 
       
   125         canDefineTranslationForHelpText := lastHelpText notEmptyOrNil.
       
   126         canDefineTranslationForHelpText := canDefineTranslationForHelpText or:[ (helpText := aView helpTextAt:aPoint) notEmptyOrNil].
       
   127         canDefineTranslationForHelpText := canDefineTranslationForHelpText or:[ (helpText := aView helpText) notEmptyOrNil].
       
   128         canDefineTranslationForHelpText := canDefineTranslationForHelpText or:[ (helpKey := aView helpKey) notNil].
       
   129         canDefineTranslationForHelpText := canDefineTranslationForHelpText or:[ (helpText := app helpTextFor:aView) notEmptyOrNil ].
       
   130 
   127         m := Menu new.
   131         m := Menu new.
       
   132         m addItem:(MenuItem 
       
   133             label: 'Copy Helptext'
       
   134             itemValue:[
       
   135                 |package key |
       
   136 
       
   137                 key := (lastHelpText ? helpText ? helpKey) asString string.
       
   138                 aView topView setClipboardText:key.
       
   139             ]
       
   140             enabled:canDefineTranslationForHelpText).
       
   141         m addSeparator.
       
   142 
   128         m addItem:(MenuItem 
   143         m addItem:(MenuItem 
   129             label: 'Edit Resources'
   144             label: 'Edit Resources'
   130             itemValue:[ 
   145             itemValue:[ 
   131                 app enqueueDelayedAction:[
   146                 app enqueueDelayedAction:[
   132                     app withWaitCursorDo:[
   147                     app withWaitCursorDo:[
   153         canDefineTranslationForLabel := 
   168         canDefineTranslationForLabel := 
   154             [
   169             [
   155                 (aView isKindOf:Label) or:[aView respondsTo:#label]
   170                 (aView isKindOf:Label) or:[aView respondsTo:#label]
   156             ].    
   171             ].    
   157 
   172 
   158         canDefineTranslationForHelpText := 
       
   159             [
       
   160                 |ok|
       
   161 
       
   162                 ok := lastHelpText notEmptyOrNil.
       
   163                 ok := ok or:[ (helpText := aView helpTextAt:aPoint) notEmptyOrNil].
       
   164                 ok := ok or:[ (helpText := aView helpText) notEmptyOrNil].
       
   165                 ok := ok or:[ (helpKey := aView helpKey) notNil].
       
   166                 ok := ok or:[ (helpText := app helpTextFor:aView) notEmptyOrNil ].
       
   167                 ok
       
   168             ].
       
   169 
       
   170         m addItem:(MenuItem 
   173         m addItem:(MenuItem 
   171             label: 'Define Translation for Label...'
   174             label: 'Define Translation for Label...'
   172             itemValue:[
   175             itemValue:[
   173                 |package key |
   176                 |package key |
   174 
   177 
   276         ('%1: KeyPress view:%2' 
   279         ('%1: KeyPress view:%2' 
   277                 bindWith:self className 
   280                 bindWith:self className 
   278                 with:aView) infoPrintCR.
   281                 with:aView) infoPrintCR.
   279     ].
   282     ].
   280     currentHelpView notNil ifTrue:[
   283     currentHelpView notNil ifTrue:[
   281         key == $§ ifTrue:[
   284         key == $§ ifTrue:[
   282             "/ generate a line suitable for the resources file (a null translation)
   285             "/ generate a line suitable for the resources file (a null translation)
   283             "/ into the clipboard; makes it easy to add missing translations to a .rs file,
   286             "/ into the clipboard; makes it easy to add missing translations to a .rs file,
   284             "/ by pressing paragraph whenever you see an untranslated helptext
   287             "/ by pressing paragraph whenever you see an untranslated helptext
   285             text := (lastHelpText storeString withoutCRs, '    ' , lastHelpText storeString withoutCRs).
   288             text := (lastHelpText storeString withoutCRs, '    ' , lastHelpText storeString withoutCRs).
   286             aView setClipboardText:text.
   289             aView setClipboardText:text.