diff --git a/repository/OpenPonk-Roassal3/OPRSKeyNavigationCanvasInteraction.class.st b/repository/OpenPonk-Roassal3/OPRSKeyNavigationCanvasInteraction.class.st new file mode 100644 index 00000000..ac846322 --- /dev/null +++ b/repository/OpenPonk-Roassal3/OPRSKeyNavigationCanvasInteraction.class.st @@ -0,0 +1,19 @@ +Class { + #name : #OPRSKeyNavigationCanvasInteraction, + #superclass : #RSKeyNavigationCanvasInteraction, + #category : #'OpenPonk-Roassal3-Interactions' +} + +{ #category : #events } +OPRSKeyNavigationCanvasInteraction >> processKeyDown: evt [ + + | keyName | + keyName := evt keyName. + keyName = #I ifTrue: [ ^ self ]. + keyName = #O ifTrue: [ ^ self ]. + (#( #+ #PLUS #KP_ADD ) includes: keyName) ifTrue: [ + ^ self zoomIn: evt canvas ]. + (#( #- #MINUS #KP_SUBTRACT ) includes: keyName) ifTrue: [ + ^ self zoomOut: evt canvas ]. + ^ super processKeyDown: evt +] diff --git a/repository/OpenPonk-Spec/OPCanvasPresenter.class.st b/repository/OpenPonk-Spec/OPCanvasPresenter.class.st index 2e12d413..87d796de 100644 --- a/repository/OpenPonk-Spec/OPCanvasPresenter.class.st +++ b/repository/OpenPonk-Spec/OPCanvasPresenter.class.st @@ -26,6 +26,16 @@ OPCanvasPresenter >> canvas [ ^ currentCanvas ] +{ #category : #initialization } +OPCanvasPresenter >> connectPresenters [ + + super connectPresenters. + onZoomChange := [ :event | ]. + onExtentChange := [ :event | ]. + self whenBuiltDo: [ :adptr | + CmdKMDispatcher attachedTo: adptr widget withCommandsFrom: self ] +] + { #category : #'private-focus' } OPCanvasPresenter >> createCommandContext [ "Subclases should override it if they provide any selection" @@ -50,14 +60,6 @@ OPCanvasPresenter >> editor [ ^ self owner ] -{ #category : #'private-focus' } -OPCanvasPresenter >> ensureKeyBindingsFor: aWidget [ - - self flag: 'Does not work in P11'. - super ensureKeyBindingsFor: aWidget. - ^ self enableCommanderShortcutsIn: aWidget -] - { #category : #toolbar } OPCanvasPresenter >> exportAsPng [ @@ -170,8 +172,6 @@ OPCanvasPresenter >> exportCanvasToSvg: aFileReference silently: aSilentlyBoolea OPCanvasPresenter >> initialize [ super initialize. - onZoomChange := [ :event | ]. - onExtentChange := [ :event | ]. self script: [ :canvas | self initializeCanvas: canvas ] ] @@ -184,9 +184,9 @@ OPCanvasPresenter >> initializeCanvas: aCanvas [ (RSDraggableCanvasInteraction right hasDraggableAnimation: false; yourself). - RSKeyNavigationCanvasInteraction new. + OPRSKeyNavigationCanvasInteraction new. OPRSZoomableCanvasInteraction new. - OPRSRemoveable new. + "OPRSRemoveable new." RSScrollBarsCanvasInteraction new }; configuration: (OPRSControlConfiguration new noLegend; diff --git a/repository/OpenPonk-Spec/OPDiagramRemoveFigureCommand.class.st b/repository/OpenPonk-Spec/OPDiagramRemoveFigureCommand.class.st index 3a10c3d1..e8dd0c81 100644 --- a/repository/OpenPonk-Spec/OPDiagramRemoveFigureCommand.class.st +++ b/repository/OpenPonk-Spec/OPDiagramRemoveFigureCommand.class.st @@ -13,8 +13,13 @@ OPDiagramRemoveFigureCommand class >> canBeExecutedInContext: aToolContext [ { #category : #testing } OPDiagramRemoveFigureCommand class >> canvasShortcutActivation [ + - ^ CmdShortcutActivation by: Character delete meta for: OPCanvasPresenter + ^ CmdShortcutActivation + by: ((KMSingleKeyCombination new key: + (KeyboardKey new withValue: 16rffff andName: #delete)) + modifiedBy: KMModifier meta) + for: OPCanvasPresenter ] { #category : #accessing } @@ -35,8 +40,8 @@ OPDiagramRemoveFigureCommand >> defaultMenuItemName [ OPDiagramRemoveFigureCommand >> execute [ diagramController deselectAll. - figures do: [ :each | - (diagramController hasControllerForFigure: each) ifTrue: [ + figures do: [ :each | + (diagramController hasControllerForFigure: each) ifTrue: [ diagramController removeFromCanvas: each ] ]. "diagramController selectedElements do: [ :each | diagramController removeFromCanvas: each]." canvas signalUpdate diff --git a/repository/OpenPonk-Spec/OPEditor.class.st b/repository/OpenPonk-Spec/OPEditor.class.st index a460731e..f85ed4e4 100644 --- a/repository/OpenPonk-Spec/OPEditor.class.st +++ b/repository/OpenPonk-Spec/OPEditor.class.st @@ -129,18 +129,6 @@ OPEditor >> canvasPresenter [ ^ canvasPresenter ] -{ #category : #shortcuts } -OPEditor >> collectShortcuts [ - ^ ((PragmaCollector - filter: [ :prg | - prg selector = #opEditorShortcut: - and: [ prg arguments first = self plugin class name ] ]) - reset; - collect: - [ :prg | prg methodClass theNonMetaClass perform: prg methodSelector with: self ]) - flattened -] - { #category : #'as yet unclassified' } OPEditor >> connectPresenters [ @@ -162,14 +150,6 @@ OPEditor >> diagramController [ ^ diagramController ] -{ #category : #'private-focus' } -OPEditor >> ensureKeyBindingsFor: aWidget [ - - self flag: 'Does not work in P11'. - super ensureKeyBindingsFor: aWidget. - ^ self enableCommanderShortcutsIn: aWidget -] - { #category : #'accessing - spec' } OPEditor >> form [ ^ form @@ -259,12 +239,6 @@ OPEditor >> rebuildWidget [ self update ] -{ #category : #shortcuts } -OPEditor >> registerShortcutsOn: aPresenter [ - shortcuts := self collectShortcuts. - shortcuts do: [ :each | aPresenter bindKeyCombination: each key toAction: each value ] -] - { #category : #initialization } OPEditor >> setModelBeforeInitialization: aPlugin [ self plugin: aPlugin @@ -308,8 +282,8 @@ OPEditor >> workbench [ { #category : #'accessing - spec' } OPEditor >> workbench: aWorkbench [ - workbench := aWorkbench. - self registerShortcutsOn: workbench + + workbench := aWorkbench ] { #category : #'accessing - spec' }