Skip to content

Commit

Permalink
replaced delete by ctrl del
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 13, 2023
1 parent 18c2f27 commit 460ab2f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -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
]
24 changes: 12 additions & 12 deletions repository/OpenPonk-Spec/OPCanvasPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 [

Expand Down Expand Up @@ -170,8 +172,6 @@ OPCanvasPresenter >> exportCanvasToSvg: aFileReference silently: aSilentlyBoolea
OPCanvasPresenter >> initialize [

super initialize.
onZoomChange := [ :event | ].
onExtentChange := [ :event | ].
self script: [ :canvas | self initializeCanvas: canvas ]
]

Expand All @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions repository/OpenPonk-Spec/OPDiagramRemoveFigureCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ OPDiagramRemoveFigureCommand class >> canBeExecutedInContext: aToolContext [

{ #category : #testing }
OPDiagramRemoveFigureCommand class >> canvasShortcutActivation [

<classAnnotation>
^ 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 }
Expand All @@ -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
Expand Down
30 changes: 2 additions & 28 deletions repository/OpenPonk-Spec/OPEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -308,8 +282,8 @@ OPEditor >> workbench [

{ #category : #'accessing - spec' }
OPEditor >> workbench: aWorkbench [
workbench := aWorkbench.
self registerShortcutsOn: workbench

workbench := aWorkbench
]

{ #category : #'accessing - spec' }
Expand Down

0 comments on commit 460ab2f

Please sign in to comment.