DeviceWorkstation.st
branchjv
changeset 8620 b4220c12f7ef
parent 8426 e2051b1553f0
child 9067 2a39221aaebb
equal deleted inserted replaced
8619:3cec55b0efa4 8620:b4220c12f7ef
   706     (   SelectFromBeginning  CtrlA                      'Select from beginning of text'     )
   706     (   SelectFromBeginning  CtrlA                      'Select from beginning of text'     )
   707     (   ExpandSelectionByLine Cmdl                                                          )
   707     (   ExpandSelectionByLine Cmdl                                                          )
   708     (   ExpandSelectionByWord CmdW                                                          )
   708     (   ExpandSelectionByWord CmdW                                                          )
   709     (   DeleteWordBeforeCursor CtrlBackSpace                                                )
   709     (   DeleteWordBeforeCursor CtrlBackSpace                                                )
   710     (   Return               KP_Enter                                                       )
   710     (   Return               KP_Enter                                                       )
   711     (   Delete               OK_Delete                                                      )
   711     (   Delete               KP_Delete                                                      )
   712 
   712 
   713 "/      Logical             Shortcut        Aliases     Description
   713 "/      Logical             Shortcut        Aliases     Description
   714 "/      ===========================================================
   714 "/      ===========================================================
   715     (   ZoomIn              #'Ctrl+'                                                        )
   715     (   ZoomIn              #'Ctrl+'                                                        )
   716     (   ZoomOut             #'Ctrl-'                                                        )
   716     (   ZoomOut             #'Ctrl-'                                                        )
   728     (   Rename              F2                          'Rename'                            )
   728     (   Rename              F2                          'Rename'                            )
   729     (   CommentSelection    F3                          'Comment selection'                 )
   729     (   CommentSelection    F3                          'Comment selection'                 )
   730     (   UncommentSelection  F4                          'Uncomment selection'               )
   730     (   UncommentSelection  F4                          'Uncomment selection'               )
   731 "/  (                       F5                                                              )
   731 "/  (                       F5                                                              )
   732     (ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst                       
   732     (ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst                       
   733     	                    F6                          'Selection to lowercase/UPPERCASE/UpperCaseFirst (toggle through)' )
   733                             F6                          'Selection to lowercase/UPPERCASE/UpperCaseFirst (toggle through)' )
   734 "/  (                       F7                                                              )
   734 "/  (                       F7                                                              )
   735     (   Again               F8                          'Again (repeat last cut/replace)'   )
   735     (   Again               F8                          'Again (repeat last cut/replace)'   )
   736     (   UndentBy4           F9                          'Undent by 4 (move block to left)'  )
   736     (   UndentBy4           F9                          'Undent by 4 (move block to left)'  )
   737     (   IndentBy4           F10                         'Indent by 4 (move block to right)' )
   737     (   IndentBy4           F10                         'Indent by 4 (move block to right)' )
   738     (   UndentBy1           F11                         'Undent by 1 (move block to left)'  )
   738     (   UndentBy1           F11                         'Undent by 1 (move block to left)'  )
   739     (   IndentBy1           F12                         'Indent by 4 (move block to right)' )
   739     (   IndentBy1           F12                         'Indent by 4 (move block to right)' )
   740 
   740 
   741     (   ParenthizeSelection #'Cmd('                     'Add parentheses around selection'  )
   741     (   ParenthizeSelection #'Cmd('                     'Add parentheses around selection'  )
   742     (   UnparenthizeSelection #'Cmd)'   	        'Remove parentheses'                )
   742     (   UnparenthizeSelection #'Cmd)'                   'Remove parentheses'                )
   743     (   LearnKeyboardMacro  CmdL  		CtrlF2  'Enter/leave learn macro mode (CmdM) to replay macro)' )
   743     (   LearnKeyboardMacro  CmdL                CtrlF2  'Enter/leave learn macro mode (CmdM) to replay macro)' )
   744     (   ExecuteKeyboardMacro CmdM               CmdF2   'Execute keyboard Macro (CMD-L to learn)' )
   744     (   ExecuteKeyboardMacro CmdM               CmdF2   'Execute keyboard Macro (CMD-L to learn)' )
   745 
   745 
   746     (   ConvertSelectionToUppercase                       
   746     (   ConvertSelectionToUppercase                       
   747     	                    CtrlF6                      'Selection to UPPERCASE'            )    
   747                             CtrlF6                      'Selection to UPPERCASE'            )    
   748     (   ExpandAbbreviation   #'Cmd '                    'Insert Abbreviation (try <ALT-SPACE> behind the string ''it'')')                                    
   748     (   ExpandAbbreviation   #'Cmd '                    'Insert Abbreviation (try <ALT-SPACE> behind the string ''it'')')                                    
   749     (   CodeCompletion       #'Ctrl '		#'Ctrlspace'				    )
   749     (   CodeCompletion       #'Ctrl '           #'Ctrlspace'                                )
   750 
   750 
   751 
   751 
   752 "/      Logical             Shortcut        Aliases     Description
   752 "/      Logical             Shortcut        Aliases     Description
   753 "/      ===========================================================
   753 "/      ===========================================================
   754 
   754 
   755 "/	Following was used only on NON-macOS systems, not sure why. In case it 
   755 "/      Following was used only on NON-macOS systems, not sure why. In case it 
   756 "/      would cause problems, refactor. I cannot test now ans would like to make
   756 "/      would cause problems, refactor. I cannot test now ans would like to make
   757 "/      the code simpler. 
   757 "/      the code simpler. 
   758 
   758 
   759     (   $[                  #'Cmd['         #'Alt['                         )
   759     (   $[                  #'Cmd['         #'Alt['                         )
   760     (   $]                  #'Cmd]'         #'Alt]'                         )
   760     (   $]                  #'Cmd]'         #'Alt]'                         )
   762     (   ${                  #'Cmd{'         #'Alt{'                         )
   762     (   ${                  #'Cmd{'         #'Alt{'                         )
   763     (   $}                  #'Cmd}'         #'Alt}'                         )
   763     (   $}                  #'Cmd}'         #'Alt}'                         )
   764     (   $\                  #'Cmd\'         #'Alt\'                         )
   764     (   $\                  #'Cmd\'         #'Alt\'                         )
   765     (   $~                  #'Cmd~'         #'Alt~'                         )
   765     (   $~                  #'Cmd~'         #'Alt~'                         )
   766     (   $@                  #'Cmd@'         #'Alt@'                         )
   766     (   $@                  #'Cmd@'         #'Alt@'                         )
   767     (   $#                  #'Cmd#'         #'Alt#'            	            )
   767     (   $#                  #'Cmd#'         #'Alt#'                         )
   768     
   768     
   769     )
   769     )
   770     "
   770     "
   771     DeviceWorkstation defaultKeyboardMapDefinition.
   771     DeviceWorkstation defaultKeyboardMapDefinition.
   772 
   772 
   777 
   777 
   778     Screen current keyboardMap. 
   778     Screen current keyboardMap. 
   779     "
   779     "
   780 
   780 
   781     "Created: / 12-05-2017 / 21:51:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   781     "Created: / 12-05-2017 / 21:51:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   782     "Modified (comment): / 14-05-2017 / 10:41:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   782     "Modified: / 25-01-2019 / 11:24:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   783 ! !
   783 ! !
   784 
   784 
   785 !DeviceWorkstation class methodsFor:'error handling'!
   785 !DeviceWorkstation class methodsFor:'error handling'!
   786 
   786 
   787 errorInterrupt:errID with:aParameter
   787 errorInterrupt:errID with:aParameter
  5531      are installed or the system-font-path changes."
  5531      are installed or the system-font-path changes."
  5532 
  5532 
  5533     "Created: / 4.8.1998 / 16:52:13 / cg"
  5533     "Created: / 4.8.1998 / 16:52:13 / cg"
  5534 !
  5534 !
  5535 
  5535 
       
  5536 fontDetailMetricsOf:fontId userInputString:aString
       
  5537     "return a average font Width and overHang for a specified character fonts metrics 
       
  5538      info object"
       
  5539 
       
  5540     |info|
       
  5541 
       
  5542     info := DeviceWorkstation::DeviceFontMetrics new.
       
  5543     info
       
  5544       avgWidth:(self widthOf:aString inFont:fontId)
       
  5545       overHang:(self overHangOf:aString inFont:fontId).
       
  5546 
       
  5547     ^ info
       
  5548 !
       
  5549 
  5536 fontFamilies
  5550 fontFamilies
  5537     "return a set of all available font families on this display"
  5551     "return a set of all available font families on this display"
  5538 
  5552 
  5539     ^ self fontFamiliesFiltering:nil
  5553     ^ self fontFamiliesFiltering:nil
  5540 
  5554 
  5580       avgWidth:(self widthOf:' ' inFont:fontId).
  5594       avgWidth:(self widthOf:' ' inFont:fontId).
  5581 
  5595 
  5582     ^ info
  5596     ^ info
  5583 !
  5597 !
  5584 
  5598 
  5585 fontDetailMetricsOf:fontId userInputString:aString
       
  5586     "return a average font Width and overHang for a specified character fonts metrics 
       
  5587      info object"
       
  5588 
       
  5589     |info|
       
  5590 
       
  5591     info := DeviceWorkstation::DeviceFontMetrics new.
       
  5592     info
       
  5593       avgWidth:(self widthOf:aString inFont:fontId)
       
  5594       overHang:(self overHangOf:aString inFont:fontId).
       
  5595 
       
  5596     ^ info
       
  5597 !
       
  5598 
       
  5599 fontResolutionOf:fontId
  5599 fontResolutionOf:fontId
  5600     "return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution,
  5600     "return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution,
  5601      but due to errors in some XServer installations, some use 75dpi fonts on higher
  5601      but due to errors in some XServer installations, some use 75dpi fonts on higher
  5602      resolution displays and vice/versa."
  5602      resolution displays and vice/versa."
  5603 
  5603 
  5781      The returned list is an array of FontDescriptions."
  5781      The returned list is an array of FontDescriptions."
  5782 
  5782 
  5783     ^ self subclassResponsibility
  5783     ^ self subclassResponsibility
  5784 !
  5784 !
  5785 
  5785 
       
  5786 overHangOf:aString from:index1 to:index2 inFont:aFontId
       
  5787     "return the overHang in pixels of a substring in a specific font"
       
  5788 
       
  5789     ^ self subclassResponsibility
       
  5790 !
       
  5791 
       
  5792 overHangOf:aString inFont:aFontId
       
  5793     "return the overHang in pixels of a string in a specific font"
       
  5794 
       
  5795     ^ self overHangOf:aString from:1 to:(aString size) inFont:aFontId
       
  5796 !
       
  5797 
  5786 pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filterBlock
  5798 pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filterBlock
  5787     "return a set of all available pixel sizes in aFamily/aFace/aStyle on this display.
  5799     "return a set of all available pixel sizes in aFamily/aFace/aStyle on this display.
  5788      But only those matching filterBlock (if notNil)."
  5800      But only those matching filterBlock (if notNil)."
  5789 
  5801 
  5790     |fonts|
  5802     |fonts|
  5908 
  5920 
  5909 widthOf:aString inFont:aFontId
  5921 widthOf:aString inFont:aFontId
  5910     "return the width in pixels of a string in a specific font"
  5922     "return the width in pixels of a string in a specific font"
  5911 
  5923 
  5912     ^ self widthOf:aString from:1 to:(aString size) inFont:aFontId
  5924     ^ self widthOf:aString from:1 to:(aString size) inFont:aFontId
  5913 !
       
  5914 
       
  5915 overHangOf:aString from:index1 to:index2 inFont:aFontId
       
  5916     "return the overHang in pixels of a substring in a specific font"
       
  5917 
       
  5918     ^ self subclassResponsibility
       
  5919 !
       
  5920 
       
  5921 overHangOf:aString inFont:aFontId
       
  5922     "return the overHang in pixels of a string in a specific font"
       
  5923 
       
  5924     ^ self overHangOf:aString from:1 to:(aString size) inFont:aFontId
       
  5925 ! !
  5925 ! !
  5926 
  5926 
  5927 !DeviceWorkstation methodsFor:'grabbing'!
  5927 !DeviceWorkstation methodsFor:'grabbing'!
  5928 
  5928 
  5929 activeKeyboardGrab
  5929 activeKeyboardGrab
  6418      Here, an empty (no-translation) keyboard map is setup initially;
  6418      Here, an empty (no-translation) keyboard map is setup initially;
  6419      this is usually filled via the keyboard.rc startup file.
  6419      this is usually filled via the keyboard.rc startup file.
  6420     "
  6420     "
  6421 
  6421 
  6422     keyboardMap isNil ifTrue:[
  6422     keyboardMap isNil ifTrue:[
  6423 	keyboardMap := KeyboardMap new.
  6423         keyboardMap := KeyboardMap new.
  6424 	self initializeDefaultKeyboardMappingsIn:keyboardMap
  6424         self initializeDefaultKeyboardMappingsIn:keyboardMap
  6425     ].
  6425     ].
  6426 
  6426 
  6427     "
  6427     "
  6428      no more setup here - moved everything out into 'display.rc' file
  6428     Screen current instVarNamed:#keyboardMap put: nil.
  6429     "
  6429     Screen current initializeKeyboardMap
       
  6430     Screen current keyboardMap
       
  6431     "
       
  6432 
       
  6433     "Modified (format): / 25-01-2019 / 11:26:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  6430 !
  6434 !
  6431 
  6435 
  6432 initializeModifierMappings
  6436 initializeModifierMappings
  6433     shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil.
  6437     shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil.
  6434 
  6438 
  8529     direction := directionArg.
  8533     direction := directionArg.
  8530     encoding := encodingArg.
  8534     encoding := encodingArg.
  8531     overHang := overHangArg.
  8535     overHang := overHangArg.
  8532 !
  8536 !
  8533 
  8537 
       
  8538 averageWidth
       
  8539     "return the averageWidth"
       
  8540 
       
  8541     ^ averageWidth
       
  8542 !
       
  8543 
  8534 descent
  8544 descent
  8535     "return the descent"
  8545     "return the descent"
  8536 
  8546 
  8537     ^ descent
  8547     ^ descent
  8538 !
  8548 !
  8539 
  8549 
       
  8550 direction
       
  8551     "return the drawing direction (think of hebrew and arabic !!)"
       
  8552 
       
  8553     ^ direction ? #LeftToRight
       
  8554 !
       
  8555 
       
  8556 encoding
       
  8557     "return the encoding"
       
  8558 
       
  8559     ^ encoding
       
  8560 !
       
  8561 
  8540 maxAscent
  8562 maxAscent
  8541     "return the maxAscent"
  8563     "return the maxAscent"
  8542 
  8564 
  8543     ^ maxAscent
  8565     ^ maxAscent
  8544 !
  8566 !
  8545 
  8567 
       
  8568 maxCode
       
  8569     ^ maxCode ? 16rFFFF
       
  8570 !
       
  8571 
  8546 maxDescent
  8572 maxDescent
  8547     "return the maxDescent"
  8573     "return the maxDescent"
  8548 
  8574 
  8549     ^ maxDescent
  8575     ^ maxDescent
  8550 !
  8576 !
  8551 
  8577 
       
  8578 maxWidth
       
  8579     "return the maxWidth"
       
  8580 
       
  8581     ^ maxWidth
       
  8582 !
       
  8583 
       
  8584 minCode
       
  8585     ^ minCode ? 0
       
  8586 !
       
  8587 
  8552 minWidth
  8588 minWidth
  8553     "return the minWidth"
  8589     "return the minWidth"
  8554 
  8590 
  8555     ^ minWidth
  8591     ^ minWidth
  8556 !
  8592 !
  8557 
  8593 
  8558 maxWidth
       
  8559     "return the maxWidth"
       
  8560 
       
  8561     ^ maxWidth
       
  8562 !
       
  8563 
       
  8564 averageWidth
       
  8565     "return the averageWidth"
       
  8566 
       
  8567     ^ averageWidth
       
  8568 !
       
  8569 
       
  8570 minCode
       
  8571     ^ minCode ? 0
       
  8572 !
       
  8573 
       
  8574 maxCode
       
  8575     ^ maxCode ? 16rFFFF
       
  8576 !
       
  8577 
       
  8578 direction
       
  8579     "return the drawing direction (think of hebrew and arabic !!)"
       
  8580 
       
  8581     ^ direction ? #LeftToRight
       
  8582 !
       
  8583 
       
  8584 encoding
       
  8585     "return the encoding"
       
  8586 
       
  8587     ^ encoding
       
  8588 !
       
  8589 
       
  8590 overHang
  8594 overHang
  8591     "return font the overHang"
  8595     "return font the overHang"
  8592 
  8596 
  8593     ^ overHang
  8597     ^ overHang
  8594 ! !
  8598 ! !