diff --git a/src/Pyramid-Bloc/BlElementGeometry.extension.st b/src/Pyramid-Bloc/BlElementGeometry.extension.st index 0fb38d9a..71914e81 100644 --- a/src/Pyramid-Bloc/BlElementGeometry.extension.st +++ b/src/Pyramid-Bloc/BlElementGeometry.extension.st @@ -5,7 +5,7 @@ BlElementGeometry class >> asIcon [ | element | element := BlElement new - size: 16 @ 12; + extent: 16 @ 12; background: (Color gray: 0.75); border: (BlBorder paint: Color black width: 1); geometry: self pyramidDefaultValueForIcon; diff --git a/src/Pyramid-Bloc/PyramidGeometryInputPresenter.class.st b/src/Pyramid-Bloc/PyramidGeometryInputPresenter.class.st index f09754ca..de562fa2 100644 --- a/src/Pyramid-Bloc/PyramidGeometryInputPresenter.class.st +++ b/src/Pyramid-Bloc/PyramidGeometryInputPresenter.class.st @@ -52,7 +52,7 @@ PyramidGeometryInputPresenter >> initializeGeometryButtons [ help: 'Change the geometry to a rectangle.'; defaultGeometry: BlRectangleGeometry new; blocIcon: (BlElement new - size: 16 asPoint; + extent: 16 asPoint; geometry: BlRectangleGeometry new; yourself); yourself). @@ -64,11 +64,11 @@ PyramidGeometryInputPresenter >> initializeGeometryButtons [ help: 'Change the geometry to an ellipse.'; defaultGeometry: BlEllipseGeometry new; blocIcon: (BlElement new - size: 16 asPoint; + extent: 16 asPoint; geometry: BlEllipseGeometry new; yourself); yourself). - + geometryDictionary at: BlRoundedRectangleGeometry put: (PyramidGeometryInputModel new @@ -76,11 +76,11 @@ PyramidGeometryInputPresenter >> initializeGeometryButtons [ help: 'Change the geometry to an ellipse.'; defaultGeometry: (BlRoundedRectangleGeometry cornerRadius: 12); blocIcon: (BlElement new - size: 16 asPoint; + extent: 16 asPoint; geometry: (BlRoundedRectangleGeometry cornerRadius: 5); yourself); yourself). - + geometryDictionary at: BlPolygonGeometry put: (PyramidGeometryInputModel new @@ -93,7 +93,7 @@ PyramidGeometryInputPresenter >> initializeGeometryButtons [ (16 @ 6). (3 @ 16) } * 3); blocIcon: (BlElement new - size: 16 asPoint; + extent: 16 asPoint; geometry: (BlPolygonGeometry vertices: { (8 @ 0). (13 @ 16). diff --git a/src/Pyramid-Bloc/PyramidLibraryElement.class.st b/src/Pyramid-Bloc/PyramidLibraryElement.class.st index 188b0954..08385a16 100644 --- a/src/Pyramid-Bloc/PyramidLibraryElement.class.st +++ b/src/Pyramid-Bloc/PyramidLibraryElement.class.st @@ -24,7 +24,7 @@ PyramidLibraryElement >> asForm [ formElement := BlElement new clipChildren: false; - size: 800 @ 600; + extent: 800 @ 600; addChildren: self asArray; background: Color white; yourself. @@ -39,13 +39,13 @@ PyramidLibraryElement >> asForm [ bottom: 0. formElement childrenDo: [ :each | bound merge: (each localBoundsToParent: - (BlBounds fromRectangle: each invalidationBounds)) ]. + (BlBounds fromRectangle: each invalidationBounds)) ]. extent := bound extent. possibleSizes := { (50 @ 50). (240 @ 240). (480 @ 480) } select: [ :each | each >= extent ]. - possibleSizes ifNotEmpty: [ formElement size: possibleSizes first ]. + possibleSizes ifNotEmpty: [ formElement extent: possibleSizes first ]. ^ formElement exportAsForm ] diff --git a/src/Pyramid-Bloc/PyramidMainExtension.class.st b/src/Pyramid-Bloc/PyramidMainExtension.class.st index 48c3e302..9a9942a5 100644 --- a/src/Pyramid-Bloc/PyramidMainExtension.class.st +++ b/src/Pyramid-Bloc/PyramidMainExtension.class.st @@ -243,20 +243,23 @@ PyramidMainExtension >> initialize [ workplacePropertiesView := PyramidWorkplacePropertiesPresenter new workplaceSizeValue: self defaultExtent; whenWorkplaceValuesChangedDo: [ :point | - self extent: point ]; + self extent: point ]; whenVisibilityChangedDo: [ - self switchGridvisibility. - self createGrid ]; + self switchGridvisibility. + self createGrid ]; spacingTextValue: self defaultGridSpacing; - whenSpacingTextChangedDo: [ :value | - (self checkZeroOrSubZeroGridSpacingValue: value) - ifTrue: [ gridSpacing := self defaultGridSpacing ] - ifFalse: [ gridSpacing := value ]. - self createGrid ]; + whenSpacingTextChangedDo: [ :value | + (self + checkZeroOrSubZeroGridSpacingValue: + value) + ifTrue: [ + gridSpacing := self defaultGridSpacing ] + ifFalse: [ gridSpacing := value ]. + self createGrid ]; gridColorValue: self defaultGridColor; whenColorValuesChangedDo: [ :color | - gridColor := color. - self createGrid ]; + gridColor := color. + self createGrid ]; yourself. "Button of the pop-up windows properties who call the creation of the pop-up" @@ -310,7 +313,7 @@ PyramidMainExtension >> initialize [ sizeElement := BlElement new id: #MainExtension_sizeElement; - size: self defaultExtent; + extent: self defaultExtent; clipChildren: false; addChildren: { containerElement. @@ -327,7 +330,7 @@ PyramidMainExtension >> installOn: aBuilder [ self elementAtTransforms transformDo: [ :t | t translateBy: self offsetTranslation ]. self builder signalTransformationChanged. - self elementAtWidgets size: self defaultExtent + self elementAtWidgets extent: self defaultExtent ] { #category : #'as yet unclassified' } diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutCopyPasteCut.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutCopyPasteCut.class.st deleted file mode 100644 index 5ecf5122..00000000 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutCopyPasteCut.class.st +++ /dev/null @@ -1,147 +0,0 @@ -" -This class is used to create the shortcut for copy and paste -> use the plugin-copy-paste from this package. - -It use the editor to get the collection of selected object from project model in Pyramid space. -" -Class { - #name : #PyramidSpaceShortcutCopyPasteCut, - #superclass : #PyramidSpaceShortcutManagerPlugin, - #instVars : [ - 'copyPastePlugin', - 'navigationPlugin', - 'shortcutCopy', - 'shortcutPaste', - 'keyCombinationCopy', - 'keyCombinationPaste', - 'elementCollectionSelected', - 'keyCombinationCut', - 'shortcutCut' - ], - #category : #'Pyramid-Bloc-plugin-shortcut-manager' -} - -{ #category : #'accessing - classes' } -PyramidSpaceShortcutCopyPasteCut >> copyPasteCutPluginFromPyramid: aPyramidEditor [ - - "Connect selection array" - self elementCollectionSelected: aPyramidEditor. - "get copyPastePlugin" - copyPastePlugin := aPyramidEditor findPlugin: PyramidCopyPastePlugin. - "Get navigationPlugin" - navigationPlugin := aPyramidEditor findPlugin: PyramidNavigationPlugin. -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> copyPastePlugin: aPlugin [ - - copyPastePlugin := aPlugin -] - -{ #category : #action } -PyramidSpaceShortcutCopyPasteCut >> copySelectedElementInSpace [ - - elementCollectionSelected isEmpty - ifTrue: [ ^ self ]. - elementCollectionSelected size = 1 - ifTrue: [ copyPastePlugin copyAsStonInClipboard: (elementCollectionSelected first). ^ 1 ] - ifFalse: [ self inform: 'Can not copy multiple element' ] - - - -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> defaultKeyCombinationCopy [ - "CTRL + C to activate this shortcut" - keyCombinationCopy := ((BlKeyCombination builder primary key: KeyboardKey C) build) -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> defaultKeyCombinationCut [ - "CTRL + X to activate this shortcut" - keyCombinationCut := ((BlKeyCombination builder primary key: KeyboardKey X) build) -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> defaultKeyCombinationPaste [ - "CTRL + V to activate this shortcut" - keyCombinationPaste := ((BlKeyCombination builder primary key: KeyboardKey V) build) -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> elementCollectionSelected: aPyramidEditor [ - - elementCollectionSelected := (aPyramidEditor projectModel selection) collection. -] - -{ #category : #initialization } -PyramidSpaceShortcutCopyPasteCut >> initialize [ - - self defaultKeyCombinationCopy. - self defaultKeyCombinationPaste. - self defaultKeyCombinationCut. -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> keyCombinationCopy: aKeyCombination [ - - ^ keyCombinationCopy := aKeyCombination -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> keyCombinationCut: aKeyCombination [ - - ^ keyCombinationCut := aKeyCombination -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> keyCombinationPaste: aKeyCombination [ - - ^ keyCombinationPaste := aKeyCombination -] - -{ #category : #action } -PyramidSpaceShortcutCopyPasteCut >> pasteElement [ - - elementCollectionSelected isEmpty - ifTrue: [ copyPastePlugin pasteFromClipboardOnFirstLevelElements ]. - elementCollectionSelected size = 1 - ifTrue: [ copyPastePlugin pasteFromClipboardOnSelection: (elementCollectionSelected first) ] - - - -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> shortcutActionCopy [ - - ^ shortcutCopy := BlShortcutWithAction new - name: 'Pyramid edition shortcut copy'; - combination: keyCombinationCopy; - action: [ :event | copyPastePlugin - ifNil: [ self inform: 'Plugin Copy/Paste is not installed' ] - ifNotNil: [ self copySelectedElementInSpace ] ] -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> shortcutActionCut [ - - ^ shortcutCut := BlShortcutWithAction new - name: 'Pyramid edition shortcut cut'; - combination: keyCombinationCut; - action: [ :event | copyPastePlugin - ifNil: [ self inform: 'Plugin Copy/Paste is not installed' ] - ifNotNil: [ self copySelectedElementInSpace = 1 - ifTrue: [ navigationPlugin removeSelectedElements ] ] ] -] - -{ #category : #accessing } -PyramidSpaceShortcutCopyPasteCut >> shortcutActionPaste [ - - ^ shortcutPaste := BlShortcutWithAction new - name: 'Pyramid edition shortcut paste'; - combination: keyCombinationPaste; - action: [ :event | copyPastePlugin - ifNil: [ self inform: 'Plugin Copy/Paste is not installed' ] - ifNotNil: [ self pasteElement ] ] -] diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutGrid.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutGrid.class.st deleted file mode 100644 index 8acf0ca1..00000000 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutGrid.class.st +++ /dev/null @@ -1,60 +0,0 @@ -" -This class define the shortcut to show or hide the grid on the space. - -the grid is define in the plugin-space-extension -> PyramidMainExtension -" -Class { - #name : #PyramidSpaceShortcutGrid, - #superclass : #PyramidSpaceShortcutManagerPlugin, - #instVars : [ - 'gridFeature', - 'shortcutGridVisibility', - 'keyCombinationGridVisibility', - 'keyCombinationTest', - 'shortcutTest' - ], - #category : #'Pyramid-Bloc-plugin-shortcut-manager' -} - -{ #category : #accessing } -PyramidSpaceShortcutGrid >> defaultKeyCombinationGridVisibility [ - "CTRL + G to activate this shortcut" - keyCombinationGridVisibility := ((BlKeyCombination builder primary key: KeyboardKey G) build) -] - -{ #category : #'accessing - classes' } -PyramidSpaceShortcutGrid >> gridFeatureFromSpacePlugin: aPyramidEditor [ - - | spacePlugin listOfSpaceExtension pyramidMainExtensionSet | - - spacePlugin := aPyramidEditor findPlugin: PyramidSpacePlugin. - - listOfSpaceExtension := spacePlugin builder extensions. - - pyramidMainExtensionSet := listOfSpaceExtension select: [ :extensions | extensions isKindOf: PyramidMainExtension ]. - pyramidMainExtensionSet size = 1 - ifFalse: [^ self]. - gridFeature := pyramidMainExtensionSet asArray first - -] - -{ #category : #initialization } -PyramidSpaceShortcutGrid >> initialize [ - - self defaultKeyCombinationGridVisibility. -] - -{ #category : #accessing } -PyramidSpaceShortcutGrid >> keyCombinationGridVisibility: aKeyCombination [ - - keyCombinationGridVisibility := aKeyCombination -] - -{ #category : #accessing } -PyramidSpaceShortcutGrid >> shortcutActionGridVisibility [ - - ^ shortcutGridVisibility := BlShortcutWithAction new - name: 'Pyramid edition shortcut grid visibility'; - combination: keyCombinationGridVisibility; - action: [ :event | gridFeature workplacePropertiesView visibilityButton toggleState ]. -] diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutInspectSelectedElement.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutInspectSelectedElement.class.st deleted file mode 100644 index efd1cf7d..00000000 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutInspectSelectedElement.class.st +++ /dev/null @@ -1,48 +0,0 @@ -" -This class is use to inspect the current selected element -" -Class { - #name : #PyramidSpaceShortcutInspectSelectedElement, - #superclass : #PyramidSpaceShortcutManagerPlugin, - #instVars : [ - 'projectModel', - 'keyCombinationInspect', - 'shortcutInspect' - ], - #category : #'Pyramid-Bloc-plugin-shortcut-manager' -} - -{ #category : #accessing } -PyramidSpaceShortcutInspectSelectedElement >> defaultKeyCombinationInspect [ - "CTRL + S to activate this shortcut" - keyCombinationInspect := ((BlKeyCombination builder primary key: KeyboardKey I) build) -] - -{ #category : #initialization } -PyramidSpaceShortcutInspectSelectedElement >> initialize [ - - self defaultKeyCombinationInspect. -] - -{ #category : #accessing } -PyramidSpaceShortcutInspectSelectedElement >> keyCombinationInspect: aKeyCombination [ - - ^ keyCombinationInspect := aKeyCombination -] - -{ #category : #'accessing - classes' } -PyramidSpaceShortcutInspectSelectedElement >> projectModelFromPyramid: aPyramidEditor [ - - projectModel := aPyramidEditor projectModel -] - -{ #category : #accessing } -PyramidSpaceShortcutInspectSelectedElement >> shortcutActionInspect [ - - ^ shortcutInspect := BlShortcutWithAction new - name: 'Pyramid edition shortcut save'; - combination: keyCombinationInspect; - action: [ :event | projectModel selection size = 1 - ifTrue: [ (projectModel selection first) inspect ] - ifFalse: [ self inform: 'Cannot inspect zero or multiple selected element' ] ] -] diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutManagerPlugin.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutManagerPlugin.class.st index b6453106..7ab399b4 100644 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutManagerPlugin.class.st +++ b/src/Pyramid-Bloc/PyramidSpaceShortcutManagerPlugin.class.st @@ -1,21 +1,10 @@ " -This class is use to add shortcut to the space in pyramid to use feature, you can check the PyramidShortcutUndoRedo as exemple. +This class is use to add shortcut to the space in pyramid to use feature, you can check the PyramidSpaceShortcutUndoRedo as exemple. Shortcut only works when the space of Pyramid have the focus. List of current active shortcut (default value) : - Save -> ctrl + S -- Undo -> ctrl + Z -- Redo -> ctrl + Y -- Copy -> ctrl + C -- Paste -> ctrl + V -- Cut -> ctrl + X -- Grid visibility switch -> ctrl + G -- Select all element -> ctrl + A -- Delete selected element -> delete or suppr -- Inspect one selected element -> ctrl + I -- Move up child (ctrl + Arrow Up) -- Move down child (ctrl + Arrow Down) " Class { #name : #PyramidSpaceShortcutManagerPlugin, @@ -23,120 +12,60 @@ Class { #traits : 'TPyramidPlugin', #classTraits : 'TPyramidPlugin classTrait', #instVars : [ - 'shortcutCollection', - 'shortcutUndoRedo', - 'shortcutCopyPaste', - 'shortcutSaveAction', - 'shortcutGrid', - 'shortcutRemoveElement', - 'shortcutSelectAllElement', - 'shortcutInspectSelectedElement', - 'shortcutMoveChildInParent' + 'collectionOfSpaceShortcutClass', + 'shortcutCollection' ], #category : #'Pyramid-Bloc-plugin-shortcut-manager' } +{ #category : #asserting } +PyramidSpaceShortcutManagerPlugin class >> shouldInstall [ + + ^ false +] + { #category : #adding } PyramidSpaceShortcutManagerPlugin >> addAllShortcutInCollection [ "Default values of the different shortcut" - - "Shortcut Undo (ctrl + Z) / Redo (ctrl + Y) " - shortcutCollection add: shortcutUndoRedo shortcutActionUndo. - shortcutCollection add: shortcutUndoRedo shortcutActionRedo. - - "Shortcut Copy (ctrl + C) / Paste (ctrl + V)" - shortcutCollection add: shortcutCopyPaste shortcutActionCopy. - shortcutCollection add: shortcutCopyPaste shortcutActionPaste. - shortcutCollection add: shortcutCopyPaste shortcutActionCut. - - "Shortcut Save (ctrl + S)" - shortcutCollection add: shortcutSaveAction shortcutActionSave. - - "Shortcut grid" - "Grid visibility (ctrl + G)" - shortcutCollection add: shortcutGrid shortcutActionGridVisibility. - - "Shortcut Remove Element (suppr / del)" - shortcutCollection add: shortcutRemoveElement shortcutActionRemoveElement. - - "Shortcut Select all element in space (ctrl + A)" - shortcutCollection add: shortcutSelectAllElement shortcutActionSelectAll. - - "Shortcut inspect selected element (ctrl + I)" - shortcutCollection add: shortcutInspectSelectedElement shortcutActionInspect. - - "Shortcut Move child in parent" - "Move up (ctrl + Arrow up)" - shortcutCollection add: shortcutMoveChildInParent shortcutActionMoveUp. - "Move down (ctrl + Arrow down)" - shortcutCollection add: shortcutMoveChildInParent shortcutActionMoveDown. - + + collectionOfSpaceShortcutClass do: [ :shortcutClass | + shortcutCollection add: shortcutClass shortcutAction ] + "New shortcut to add under this comment, keep the same patern as before" - ] { #category : #accessing } PyramidSpaceShortcutManagerPlugin >> addAllShortcutInSpace: aSpace [ - - self addAllShortcutInCollection. - shortcutCollection do: [ :shortcut | aSpace root addShortcut: shortcut ]. - + self addAllShortcutInCollection. + shortcutCollection do: [ :shortcut | + aSpace root addShortcut: shortcut ] ] { #category : #connecting } PyramidSpaceShortcutManagerPlugin >> connectOn: aPyramidEditor [ - | spacePlugin spacePluginSet | - + | spacePlugin | "Get the space plugin to adding shortcut" - spacePluginSet := aPyramidEditor plugins select: [ :plugin | plugin isKindOf: PyramidSpacePlugin ]. - spacePluginSet size = 1 - ifFalse: [self inform: 'Space plugin is not installed -> impossible to install shortcut to the space'. - ^ self]. - spacePlugin := spacePluginSet asArray first. - - "Get History plugin for Undo / Redo shortcut" - shortcutUndoRedo historyPluginFromPyramid: aPyramidEditor. - - "Get Copy Paste plugin" - shortcutCopyPaste copyPasteCutPluginFromPyramid: aPyramidEditor. - - "Get Save plugin" - shortcutSaveAction savePluginFromPyramid: aPyramidEditor. - - "Get space MainExtension" - shortcutGrid gridFeatureFromSpacePlugin: aPyramidEditor. - - "Get Navigation Plugin for shortcut remove element" - shortcutRemoveElement navigationPluginFromPyramid: aPyramidEditor. - - shortcutSelectAllElement projectModelFromPyramid: aPyramidEditor. - - "Get projectModelFromPyramid for Inspect selected element" - shortcutInspectSelectedElement projectModelFromPyramid: aPyramidEditor. - - "Get navigation plugin for MoveChildInParentPlugin" - shortcutMoveChildInParent moveChildInParentPluginFromPyramid: aPyramidEditor. - + spacePlugin := aPyramidEditor findPlugin: PyramidSpacePlugin. + spacePlugin ifNil: [ + self inform: + 'Space plugin is not installed -> impossible to install shortcut to the space'. + ^ self ]. + + self setupPluginOfShortcuts: aPyramidEditor. + "Adding shortcut to Pyramid" - spacePlugin resetShortcutBlock: [ :aSpace | self refreshAllShortcutInSpace: aSpace ]. - spacePlugin resetSpace. + spacePlugin resetShortcutBlock: [ :aSpace | + self refreshAllShortcutInSpace: aSpace ]. + spacePlugin resetSpace ] { #category : #initialization } -PyramidSpaceShortcutManagerPlugin >> initialize [ +PyramidSpaceShortcutManagerPlugin >> initialize [ shortcutCollection := OrderedCollection new. - - shortcutUndoRedo := PyramidSpaceShortcutUndoRedo new. - shortcutCopyPaste := PyramidSpaceShortcutCopyPasteCut new. - shortcutSaveAction := PyramidSpaceShortcutSave new. - shortcutGrid := PyramidSpaceShortcutGrid new. - shortcutRemoveElement := PyramidSpaceShortcutRemoveElement new. - shortcutSelectAllElement := PyramidSpaceShortcutSelectAllElement new. - shortcutInspectSelectedElement := PyramidSpaceShortcutInspectSelectedElement new. - shortcutMoveChildInParent := PyramidSpaceShortcutMoveChildInParent new. + collectionOfSpaceShortcutClass := self class allSubclasses collect: [ :class | class new ]. ] { #category : #action } @@ -154,3 +83,10 @@ PyramidSpaceShortcutManagerPlugin >> removeAllShortcutInSpace: aSpace [ shortcutCollection do: [ :shortcut | aSpace root removeShortcut: shortcut ]. shortcutCollection removeAll. ] + +{ #category : #accessing } +PyramidSpaceShortcutManagerPlugin >> setupPluginOfShortcuts: aPyramidEditor [ + + collectionOfSpaceShortcutClass do: [ :shortcutClass | + shortcutClass pluginFromPyramid: aPyramidEditor ]. +] diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutMoveChildInParent.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutMoveChildInParent.class.st deleted file mode 100644 index c23c50f5..00000000 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutMoveChildInParent.class.st +++ /dev/null @@ -1,76 +0,0 @@ -" -This class add the shortcut : - - Move up child (ctrl + Arrow Up) - - Move down child (ctrl + Arrow Down) -" -Class { - #name : #PyramidSpaceShortcutMoveChildInParent, - #superclass : #PyramidSpaceShortcutManagerPlugin, - #instVars : [ - 'moveChildInParentPlugin', - 'shortcutMoveUp', - 'keyCombinationMoveUp', - 'shortcutMoveDown', - 'keyCombinationMoveDown' - ], - #category : #'Pyramid-Bloc-plugin-shortcut-manager' -} - -{ #category : #accessing } -PyramidSpaceShortcutMoveChildInParent >> defaultKeyCombinationMoveDown [ - "CTRL + Arrow Down to activate this shortcut" - keyCombinationMoveDown := ((BlKeyCombination builder primary key: KeyboardKey down) build) -] - -{ #category : #accessing } -PyramidSpaceShortcutMoveChildInParent >> defaultKeyCombinationMoveUp [ - "CTRL + Arrow up to activate this shortcut" - keyCombinationMoveUp := ((BlKeyCombination builder primary key: KeyboardKey up) build) -] - -{ #category : #initialization } -PyramidSpaceShortcutMoveChildInParent >> initialize [ - - self defaultKeyCombinationMoveUp. - self defaultKeyCombinationMoveDown. -] - -{ #category : #accessing } -PyramidSpaceShortcutMoveChildInParent >> keyCombinationMoveDown: aKeyCombination [ - - keyCombinationMoveDown := aKeyCombination -] - -{ #category : #accessing } -PyramidSpaceShortcutMoveChildInParent >> keyCombinationMoveUp: aKeyCombination [ - - keyCombinationMoveUp := aKeyCombination -] - -{ #category : #accessing } -PyramidSpaceShortcutMoveChildInParent >> moveChildInParentPluginFromPyramid: aPyramidEditor [ - - moveChildInParentPlugin := aPyramidEditor findPlugin: PyramidMoveChildInParentPlugin. -] - -{ #category : #accessing } -PyramidSpaceShortcutMoveChildInParent >> shortcutActionMoveDown [ - - ^ shortcutMoveDown := BlShortcutWithAction new - name: 'Pyramid edition shortcut MoveDown'; - combination: keyCombinationMoveDown; - action: [ :event | moveChildInParentPlugin - ifNil: [ self inform: 'Plugin MoveChildInParentPlugin is not installed' ] - ifNotNil: [ moveChildInParentPlugin moveChildIndexDownInParent ] ] -] - -{ #category : #accessing } -PyramidSpaceShortcutMoveChildInParent >> shortcutActionMoveUp [ - - ^ shortcutMoveUp := BlShortcutWithAction new - name: 'Pyramid edition shortcut MoveUp'; - combination: keyCombinationMoveUp; - action: [ :event | moveChildInParentPlugin - ifNil: [ self inform: 'Plugin MoveChildInParentPlugin is not installed' ] - ifNotNil: [ moveChildInParentPlugin moveChildIndexUpInParent ] ] -] diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutRemoveElement.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutRemoveElement.class.st deleted file mode 100644 index e90b4a44..00000000 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutRemoveElement.class.st +++ /dev/null @@ -1,49 +0,0 @@ -" -This class define the shortcut to delete a selected element in the space. - -it use the plugin-navigation in this package. -" -Class { - #name : #PyramidSpaceShortcutRemoveElement, - #superclass : #PyramidSpaceShortcutManagerPlugin, - #instVars : [ - 'navigationPlugin', - 'shortcutActionRemoveElement', - 'keyCombinationRemoveElement' - ], - #category : #'Pyramid-Bloc-plugin-shortcut-manager' -} - -{ #category : #accessing } -PyramidSpaceShortcutRemoveElement >> defaultKeyCombinationRemoveElement [ - "suppr / del to activate this shortcut" - keyCombinationRemoveElement := ((BlKeyCombination builder key: KeyboardKey delete) build) -] - -{ #category : #initialization } -PyramidSpaceShortcutRemoveElement >> initialize [ - - self defaultKeyCombinationRemoveElement -] - -{ #category : #accessing } -PyramidSpaceShortcutRemoveElement >> keyCombinationRemoveElement: aKeyCombination [ - - keyCombinationRemoveElement := aKeyCombination -] - -{ #category : #'accessing - classes' } -PyramidSpaceShortcutRemoveElement >> navigationPluginFromPyramid: aPyramidEditor [ - - navigationPlugin := aPyramidEditor findPlugin: PyramidNavigationPlugin. -] - -{ #category : #accessing } -PyramidSpaceShortcutRemoveElement >> shortcutActionRemoveElement [ - - ^ shortcutActionRemoveElement := BlShortcutWithAction new - name: 'Pyramid edition shortcut remove selected element'; - combination: keyCombinationRemoveElement; - action: [ :event | navigationPlugin ifNil: [ self inform: 'Plugin navigation is not installed' ] - ifNotNil: [ navigationPlugin removeSelectedElements ] ] -] diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutSave.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutSave.class.st index 5ab40a75..9b4158e9 100644 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutSave.class.st +++ b/src/Pyramid-Bloc/PyramidSpaceShortcutSave.class.st @@ -6,45 +6,43 @@ Used the plugin-save in this package. Class { #name : #PyramidSpaceShortcutSave, #superclass : #PyramidSpaceShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpace', + #classTraits : 'TPyramidShortcutSpace classTrait', #instVars : [ - 'savePlugin', - 'shortcutSave', - 'keyCombinationSave' + 'plugin', + 'shortcut', + 'keyCombination' ], #category : #'Pyramid-Bloc-plugin-shortcut-manager' } { #category : #accessing } -PyramidSpaceShortcutSave >> defaultKeyCombinationSave [ +PyramidSpaceShortcutSave >> defaultKeyCombination [ "CTRL + S to activate this shortcut" - keyCombinationSave := ((BlKeyCombination builder primary key: KeyboardKey S) build) -] -{ #category : #initialization } -PyramidSpaceShortcutSave >> initialize [ - - self defaultKeyCombinationSave -] - -{ #category : #accessing } -PyramidSpaceShortcutSave >> keyCombinationSave: aKeyCombination [ - - ^ keyCombinationSave := aKeyCombination + keyCombination := (BlKeyCombination builder primary key: + KeyboardKey S) build ] { #category : #'accessing - classes' } -PyramidSpaceShortcutSave >> savePluginFromPyramid: aPyramidEditor [ +PyramidSpaceShortcutSave >> pluginFromPyramid: aPyramidEditor [ - savePlugin := aPyramidEditor findPlugin: PyramidSavePlugin. + | listOfPlugins pluginSorted | + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidSavePlugin ]. + pluginSorted size = 1 ifFalse: [ ^ self ]. + plugin := pluginSorted asArray first ] { #category : #accessing } -PyramidSpaceShortcutSave >> shortcutActionSave [ - - ^ shortcutSave := BlShortcutWithAction new - name: 'Pyramid edition shortcut save'; - combination: keyCombinationSave; - action: [ :event | savePlugin - ifNil: [ self inform: 'Plugin save is not installed' ] - ifNotNil: [ savePlugin saveAction ] ] +PyramidSpaceShortcutSave >> shortcutAction [ + + ^ shortcutAction := BlShortcutWithAction new + name: 'Pyramid edition shortcut save'; + combination: keyCombination; + action: [ :event | + plugin + ifNil: [ + self inform: 'Plugin save is not installed' ] + ifNotNil: [ plugin saveAction ] ] ] diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutSelectAllElement.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutSelectAllElement.class.st deleted file mode 100644 index 359da9c2..00000000 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutSelectAllElement.class.st +++ /dev/null @@ -1,65 +0,0 @@ -" -This class used to create shortcut for select all element or all children from one selected element in Pyramid space. -" -Class { - #name : #PyramidSpaceShortcutSelectAllElement, - #superclass : #PyramidSpaceShortcutManagerPlugin, - #instVars : [ - 'keyCombinationSelectAll', - 'shortcutSelectAll', - 'projectModel' - ], - #category : #'Pyramid-Bloc-plugin-shortcut-manager' -} - -{ #category : #accessing } -PyramidSpaceShortcutSelectAllElement >> defaultKeyCombinationSelectAll [ - "CTRL + A to activate this shortcut" - keyCombinationSelectAll := ((BlKeyCombination builder primary key: KeyboardKey A) build) -] - -{ #category : #initialization } -PyramidSpaceShortcutSelectAllElement >> initialize [ - - self defaultKeyCombinationSelectAll -] - -{ #category : #'accessing - classes' } -PyramidSpaceShortcutSelectAllElement >> projectModelFromPyramid: aPyramidEditor [ - - projectModel := aPyramidEditor projectModel. -] - -{ #category : #action } -PyramidSpaceShortcutSelectAllElement >> selectAll [ - - projectModel selection asArray isEmpty - ifTrue: [ self selectAllElementInSpace ]. - projectModel selection asArray size = 1 - ifTrue: [ self selectAllChildrenOfSelectedElement ]. -] - -{ #category : #action } -PyramidSpaceShortcutSelectAllElement >> selectAllChildrenOfSelectedElement [ - - (projectModel selection collection asArray first) children isEmpty - ifTrue: [ self inform: 'No children to select in the selected element' ] - ifFalse: [ projectModel setSelection: (projectModel selection collection asArray first) children ] - -] - -{ #category : #action } -PyramidSpaceShortcutSelectAllElement >> selectAllElementInSpace [ - - projectModel setSelection: projectModel firstLevelElements collection -] - -{ #category : #accessing } -PyramidSpaceShortcutSelectAllElement >> shortcutActionSelectAll [ - - ^ shortcutSelectAll := BlShortcutWithAction new - name: 'Pyramid edition shortcut to select all element in space'; - combination: keyCombinationSelectAll; - action: [ :event | projectModel ifNil: [ self inform: 'problem with the project model' ] - ifNotNil: [ self selectAll ] ] -] diff --git a/src/Pyramid-Bloc/PyramidSpaceShortcutUndoRedo.class.st b/src/Pyramid-Bloc/PyramidSpaceShortcutUndoRedo.class.st deleted file mode 100644 index bd6c39e3..00000000 --- a/src/Pyramid-Bloc/PyramidSpaceShortcutUndoRedo.class.st +++ /dev/null @@ -1,78 +0,0 @@ -" -Class use to create the shortcut undo / redo. - -Use the history feature from the package Pyramid. -" -Class { - #name : #PyramidSpaceShortcutUndoRedo, - #superclass : #PyramidSpaceShortcutManagerPlugin, - #instVars : [ - 'historyPlugin', - 'shortcutUndo', - 'keyCombinationUndo', - 'shortcutRedo', - 'keyCombinationRedo' - ], - #category : #'Pyramid-Bloc-plugin-shortcut-manager' -} - -{ #category : #accessing } -PyramidSpaceShortcutUndoRedo >> defaultKeyCombinationRedo [ - "CTRL + Y to activate this shortcut" - keyCombinationRedo := ((BlKeyCombination builder primary key: KeyboardKey Y) build) -] - -{ #category : #accessing } -PyramidSpaceShortcutUndoRedo >> defaultKeyCombinationUndo [ - "CTRL + Z to activate this shortcut" - keyCombinationUndo := ((BlKeyCombination builder primary key: KeyboardKey Z) build) -] - -{ #category : #'accessing - classes' } -PyramidSpaceShortcutUndoRedo >> historyPluginFromPyramid: aPyramidEditor [ - - historyPlugin := aPyramidEditor findPlugin: PyramidHistoryPlugin. -] - -{ #category : #initialization } -PyramidSpaceShortcutUndoRedo >> initialize [ - - self defaultKeyCombinationRedo. - self defaultKeyCombinationUndo. -] - -{ #category : #accessing } -PyramidSpaceShortcutUndoRedo >> keyCombinationRedo: aNewKeyCombination [ - - ^ keyCombinationRedo := aNewKeyCombination -] - -{ #category : #accessing } -PyramidSpaceShortcutUndoRedo >> keyCombinationUndo: aNewKeyCombination [ - - ^ keyCombinationUndo := aNewKeyCombination -] - -{ #category : #accessing } -PyramidSpaceShortcutUndoRedo >> shortcutActionRedo [ - - ^ shortcutRedo := BlShortcutWithAction new - name: 'Pyramid edition shortcut redo'; - combination: keyCombinationRedo; - action: [ :event | historyPlugin - ifNil: [ self inform: 'Plugin undo/redo is not installed' ] - ifNotNil: [ historyPlugin history redo. - historyPlugin projectModel informElementsChanged ] ] -] - -{ #category : #accessing } -PyramidSpaceShortcutUndoRedo >> shortcutActionUndo [ - - ^ shortcutUndo := BlShortcutWithAction new - name: 'Pyramid edition shortcut undo'; - combination: keyCombinationUndo; - action: [ :event | historyPlugin - ifNil: [ self inform: 'Plugin undo/redo is not installed' ] - ifNotNil: [ historyPlugin history undo. - historyPlugin projectModel informElementsChanged ] ] -] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutActionObject.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutActionObject.class.st new file mode 100644 index 00000000..44649c80 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutActionObject.class.st @@ -0,0 +1,42 @@ +" +This class is used to simplify the mass shortcut to add in Spec. +" +Class { + #name : #PyramidSpecShortcutActionObject, + #superclass : #Object, + #instVars : [ + 'shortcut', + 'action' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutActionObject >> action [ + + ^ action +] + +{ #category : #accessing } +PyramidSpecShortcutActionObject >> action: aBlock [ + + action := aBlock +] + +{ #category : #initialization } +PyramidSpecShortcutActionObject >> initialize [ + + "Do nothing" +] + +{ #category : #accessing } +PyramidSpecShortcutActionObject >> shortcut [ + + ^ shortcut +] + +{ #category : #accessing } +PyramidSpecShortcutActionObject >> shortcut: aShortcut [ + + shortcut := aShortcut +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutCopy.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutCopy.class.st new file mode 100644 index 00000000..d5a49612 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutCopy.class.st @@ -0,0 +1,81 @@ +" +This class is used to create the shortcut for copy and paste -> use the plugin-copy-paste from this package. + +It use the editor to get the collection of selected object from project model in Pyramid space. +" +Class { + #name : #PyramidSpecShortcutCopy, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction', + 'navigationPlugin', + 'elementCollectionSelected' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #'as yet unclassified' } +PyramidSpecShortcutCopy >> copySelectedElementInSpace [ + + elementCollectionSelected isEmpty ifTrue: [ ^ self ]. + elementCollectionSelected size = 1 + ifTrue: [ + plugin copyAsStonInClipboard: elementCollectionSelected first. + ^ 1 ] + ifFalse: [ self inform: 'Can not copy multiple element' ] +] + +{ #category : #accessing } +PyramidSpecShortcutCopy >> defaultKeyCombination [ + "CTRL + C to activate this shortcut" + + keyCombination := $c command mac | $c control unix | $c control win +] + +{ #category : #accessing } +PyramidSpecShortcutCopy >> elementCollectionSelected: aPyramidEditor [ + + elementCollectionSelected := aPyramidEditor projectModel selection + collection +] + +{ #category : #initialization } +PyramidSpecShortcutCopy >> initialize [ + + self defaultKeyCombination. +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutCopy >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + self elementCollectionSelected: aPyramidEditor. + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidCopyPastePlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first. + + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidNavigationPlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + navigationPlugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutCopy >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'Plugin Copy/Paste is not installed' ] + ifNotNil: [ self copySelectedElementInSpace ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutCut.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutCut.class.st new file mode 100644 index 00000000..6835c6c4 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutCut.class.st @@ -0,0 +1,84 @@ +" +This class is used to create the shortcut for copy and paste -> use the plugin-copy-paste from this package. + +It use the editor to get the collection of selected object from project model in Pyramid space. +" +Class { + #name : #PyramidSpecShortcutCut, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction', + 'navigationPlugin', + 'elementCollectionSelected' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #'as yet unclassified' } +PyramidSpecShortcutCut >> copySelectedElementInSpace [ + + elementCollectionSelected isEmpty ifTrue: [ ^ self ]. + elementCollectionSelected size = 1 + ifTrue: [ + plugin copyAsStonInClipboard: + elementCollectionSelected first. + ^ 1 ] + ifFalse: [ self inform: 'Can not copy multiple element' ] +] + +{ #category : #accessing } +PyramidSpecShortcutCut >> defaultKeyCombination [ + "CTRL + X to activate this shortcut" + + keyCombination := $x command mac | $x control unix | $x control win +] + +{ #category : #accessing } +PyramidSpecShortcutCut >> elementCollectionSelected: aPyramidEditor [ + + elementCollectionSelected := aPyramidEditor projectModel selection + collection +] + +{ #category : #initialization } +PyramidSpecShortcutCut >> initialize [ + + self defaultKeyCombination. +] + +{ #category : #'as yet unclassified' } +PyramidSpecShortcutCut >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + self elementCollectionSelected: aPyramidEditor. + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidCopyPastePlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first. + + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidNavigationPlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + navigationPlugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutCut >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'Plugin Copy/Paste is not installed' ] + ifNotNil: [ + self copySelectedElementInSpace = 1 ifTrue: [ + navigationPlugin removeSelectedElements ] ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutDefaultViewPosition.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutDefaultViewPosition.class.st new file mode 100644 index 00000000..a7d8926d --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutDefaultViewPosition.class.st @@ -0,0 +1,43 @@ +Class { + #name : #PyramidSpecShortcutDefaultViewPosition, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutDefaultViewPosition >> defaultKeyCombination [ + "CTRL + N to activate this shortcut" + + keyCombination := $n command mac | $n control unix | $n control win +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutDefaultViewPosition >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + "listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidSpaceMovePlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first" +] + +{ #category : #accessing } +PyramidSpecShortcutDefaultViewPosition >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'problem with the plugin' ] + ifNotNil: [ "plugin defaultViewPosition" ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutElementToPositionZero.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutElementToPositionZero.class.st new file mode 100644 index 00000000..99060fc6 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutElementToPositionZero.class.st @@ -0,0 +1,52 @@ +Class { + #name : #PyramidSpecShortcutElementToPositionZero, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutElementToPositionZero >> defaultKeyCombination [ + "CTRL + Space to activate this shortcut" + + keyCombination := Character space command mac | Character space control unix | Character space control win +] + +{ #category : #actions } +PyramidSpecShortcutElementToPositionZero >> elementPositionZeroAction [ + + | element | + plugin projectModel selection size = 1 + ifFalse: [ ^ self ]. + + element := plugin projectModel selection first. + + plugin commandExecutor + use: PyramidPositionCommand new + on: { element } + with: 0@0. +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutElementToPositionZero >> pluginFromPyramid: aPyramidEditor [ + + plugin := aPyramidEditor +] + +{ #category : #accessing } +PyramidSpecShortcutElementToPositionZero >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'problem with the projectModel shortcut ElementToPositionZero' ] + ifNotNil: [ self elementPositionZeroAction ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutGrid.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutGrid.class.st new file mode 100644 index 00000000..59bff4d9 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutGrid.class.st @@ -0,0 +1,59 @@ +" +This class define the shortcut to show or hide the grid on the space. + +the grid is define in the plugin-space-extension -> PyramidMainExtension +" +Class { + #name : #PyramidSpecShortcutGrid, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutGrid >> defaultKeyCombination [ + "CTRL + G to activate this shortcut" + + keyCombination := $g command mac | $g control unix | $g control win +] + +{ #category : #initialization } +PyramidSpecShortcutGrid >> initialize [ + + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutGrid >> pluginFromPyramid: aPyramidEditor [ + + | spacePlugin extensionList extensionSorted listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidSpacePlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + spacePlugin := pluginSorted asArray first. + + extensionList := spacePlugin builder extensions. + + extensionSorted := extensionList select: [ :extensions | + extensions isKindOf: PyramidMainExtension ]. + extensionSorted size = 1 ifFalse: [ ^ self ]. + plugin := extensionSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutGrid >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin workplacePropertiesView visibilityButton toggleState ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutInspectSelectedElement.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutInspectSelectedElement.class.st new file mode 100644 index 00000000..52bd1c8a --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutInspectSelectedElement.class.st @@ -0,0 +1,49 @@ +" +This class is used to define the shortcut for inspect an selected element. +" +Class { + #name : #PyramidSpecShortcutInspectSelectedElement, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutInspectSelectedElement >> defaultKeyCombination [ + "CTRL + I to activate this shortcut" + + keyCombination := $i command mac | $i control unix | $i control win +] + +{ #category : #initialization } +PyramidSpecShortcutInspectSelectedElement >> initialize [ + + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutInspectSelectedElement >> pluginFromPyramid: aPyramidEditor [ + + plugin := aPyramidEditor projectModel +] + +{ #category : #accessing } +PyramidSpecShortcutInspectSelectedElement >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin selection size = 1 + ifTrue: [ + plugin selection first inspect. + plugin updateSelection ] + ifFalse: [ + self inform: 'Cannot inspect zero or multiple selected element' ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutManagerPlugin.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutManagerPlugin.class.st new file mode 100644 index 00000000..1dc56f7f --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutManagerPlugin.class.st @@ -0,0 +1,69 @@ +" +This class is use to add shortcut to the spec in pyramid to use different feature. + +To add new shortcut you just need to put the shortcut class to the subclasses of this current class with the trait (TPyramidShortcutSpec) and fill the different message. + +You can take the PyramidSpecShortcutSave as example to do a new shortcut. + +List of current active shortcut (default value) : +- Save -> ctrl + S +- Undo -> ctrl + Z +- Redo -> ctrl + Y +- Copy -> ctrl + C +- Paste -> ctrl + V +- Cut -> ctrl + X +- Grid visibility switch -> ctrl + G +- Select all element -> ctrl + A +- Unselect all element -> Escape +- Delete selected element -> ctrl + D +- Inspect one selected element -> ctrl + I +- Move child index Up -> ctrl + Arrow Up +- Move child index Down -> ctrl + Arrow Down +- Move element to position zero -> ctrl + Space +" +Class { + #name : #PyramidSpecShortcutManagerPlugin, + #superclass : #Object, + #traits : 'TPyramidPlugin', + #classTraits : 'TPyramidPlugin classTrait', + #instVars : [ + 'pyramidWindow', + 'collectionOfShortcutClass' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #adding } +PyramidSpecShortcutManagerPlugin >> addAllShortcutToSpecWindow [ + + collectionOfShortcutClass do: [ :shortcutClass | + pyramidWindow + bindKeyCombination: shortcutClass shortcutAction shortcut + toAction: shortcutClass shortcutAction action ] +] + +{ #category : #initialization } +PyramidSpecShortcutManagerPlugin >> initialize [ + + collectionOfShortcutClass := self class allSubclasses collect: [ :class | class new ]. +] + +{ #category : #accessing } +PyramidSpecShortcutManagerPlugin >> setupPluginOfShortcuts: aPyramidEditor [ + + collectionOfShortcutClass do: [ :shortcutClass | + shortcutClass pluginFromPyramid: aPyramidEditor ] +] + +{ #category : #connecting } +PyramidSpecShortcutManagerPlugin >> windowOpenBy: aPyramidEditor [ + + "The window to apply the shortcuts" + pyramidWindow := aPyramidEditor window spec. + + "Apply the plugin in all shortcuts" + self setupPluginOfShortcuts: aPyramidEditor. + + "Apply the shortcut in the spec window with the iteration of the collection" + self addAllShortcutToSpecWindow +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutMoveChildDownInParent.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutMoveChildDownInParent.class.st new file mode 100644 index 00000000..9bbb52cd --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutMoveChildDownInParent.class.st @@ -0,0 +1,54 @@ +" +This class is used to define for moving child position in his parent between each child. +" +Class { + #name : #PyramidSpecShortcutMoveChildDownInParent, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutMoveChildDownInParent >> defaultKeyCombination [ + "CTRL + Arrow Down to activate this shortcut" + + keyCombination := Character arrowDown command mac | Character arrowDown control unix | Character arrowDown control win +] + +{ #category : #initialization } +PyramidSpecShortcutMoveChildDownInParent >> initialize [ + + self defaultKeyCombination. + self defaultKeyCombination +] + +{ #category : #'as yet unclassified' } +PyramidSpecShortcutMoveChildDownInParent >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidMoveChildInParentPlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutMoveChildDownInParent >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ + self inform: 'Plugin MoveChildInParentPlugin is not installed' ] + ifNotNil: [ plugin moveChildIndexDownInParent ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutMoveChildUpInParent.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutMoveChildUpInParent.class.st new file mode 100644 index 00000000..bac2b310 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutMoveChildUpInParent.class.st @@ -0,0 +1,56 @@ +" +This class is used to define for moving child position in his parent between each child. +" +Class { + #name : #PyramidSpecShortcutMoveChildUpInParent, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutMoveChildUpInParent >> defaultKeyCombination [ + "CTRL + Arrow up to activate this shortcut" + + keyCombination := Character arrowUp command mac + | Character arrowUp control unix + | Character arrowUp control win +] + +{ #category : #initialization } +PyramidSpecShortcutMoveChildUpInParent >> initialize [ + + self defaultKeyCombination. + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutMoveChildUpInParent >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidMoveChildInParentPlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutMoveChildUpInParent >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ + self inform: 'Plugin MoveChildInParentPlugin is not installed' ] + ifNotNil: [ plugin moveChildIndexUpInParent ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutPaste.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutPaste.class.st new file mode 100644 index 00000000..1998dd34 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutPaste.class.st @@ -0,0 +1,80 @@ +" +This class is used to create the shortcut for copy and paste -> use the plugin-copy-paste from this package. + +It use the editor to get the collection of selected object from project model in Pyramid space. +" +Class { + #name : #PyramidSpecShortcutPaste, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction', + 'navigationPlugin', + 'elementCollectionSelected' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutPaste >> defaultKeyCombination [ + "CTRL + V to activate this shortcut" + + keyCombination := $v command mac | $v control unix | $v control win +] + +{ #category : #accessing } +PyramidSpecShortcutPaste >> elementCollectionSelected: aPyramidEditor [ + + elementCollectionSelected := aPyramidEditor projectModel selection + collection +] + +{ #category : #initialization } +PyramidSpecShortcutPaste >> initialize [ + + self defaultKeyCombination. +] + +{ #category : #action } +PyramidSpecShortcutPaste >> pasteElement [ + + elementCollectionSelected isEmpty ifTrue: [ + plugin pasteFromClipboardOnFirstLevelElements ]. + elementCollectionSelected size = 1 ifTrue: [ + plugin pasteFromClipboardOnSelection: + elementCollectionSelected first ] +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutPaste >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + self elementCollectionSelected: aPyramidEditor. + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidCopyPastePlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first. + + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidNavigationPlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + navigationPlugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutPaste >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'Plugin Copy/Paste is not installed' ] + ifNotNil: [ self pasteElement ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutRedo.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutRedo.class.st new file mode 100644 index 00000000..0c181487 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutRedo.class.st @@ -0,0 +1,57 @@ +" +Class use to create the shortcut undo / redo. + +Use the history feature from the package Pyramid. +" +Class { + #name : #PyramidSpecShortcutRedo, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutRedo >> defaultKeyCombination [ + "CTRL + Y to activate this shortcut" + + keyCombination := $y command mac | $y control unix | $y control win +] + +{ #category : #initialization } +PyramidSpecShortcutRedo >> initialize [ + + self defaultKeyCombination. + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutRedo >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidHistoryPlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutRedo >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'Plugin undo/redo is not installed' ] + ifNotNil: [ + plugin history redo. + plugin projectModel informElementsChanged ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutRemoveElement.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutRemoveElement.class.st new file mode 100644 index 00000000..e39a0809 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutRemoveElement.class.st @@ -0,0 +1,54 @@ +" +This class define the shortcut to delete a selected element in the space. + +it use the plugin-navigation in this package. +" +Class { + #name : #PyramidSpecShortcutRemoveElement, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutRemoveElement >> defaultKeyCombination [ + "CTRL + R to activate this shortcut" + + keyCombination := $d command mac | $d control unix | $d control win +] + +{ #category : #initialization } +PyramidSpecShortcutRemoveElement >> initialize [ + + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutRemoveElement >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidNavigationPlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutRemoveElement >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'Plugin navigation is not installed' ] + ifNotNil: [ plugin removeSelectedElements ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutSave.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutSave.class.st new file mode 100644 index 00000000..8a5432ad --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutSave.class.st @@ -0,0 +1,54 @@ +" +This class used to create shortcut for saving in Pyramid space. + +Used the plugin-save in this package. +" +Class { + #name : #PyramidSpecShortcutSave, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutSave >> defaultKeyCombination [ + "CTRL + S to activate this shortcut" + + keyCombination := $s command mac | $s control unix | $s control win +] + +{ #category : #initialization } +PyramidSpecShortcutSave >> initialize [ + + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutSave >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidSavePlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutSave >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'Plugin save is not installed' ] + ifNotNil: [ plugin saveAction ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutSelectAllElement.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutSelectAllElement.class.st new file mode 100644 index 00000000..0c07dc93 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutSelectAllElement.class.st @@ -0,0 +1,72 @@ +" +This class used to create shortcut for select all element or all children from one selected element in Pyramid space. +" +Class { + #name : #PyramidSpecShortcutSelectAllElement, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutSelectAllElement >> defaultKeyCombination [ + "CTRL + A to activate this shortcut" + + keyCombination := $a command mac | $a control unix | $a control win +] + +{ #category : #initialization } +PyramidSpecShortcutSelectAllElement >> initialize [ + + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutSelectAllElement >> pluginFromPyramid: aPyramidEditor [ + + plugin := aPyramidEditor projectModel +] + +{ #category : #'api - selection' } +PyramidSpecShortcutSelectAllElement >> selectAll [ + + plugin selection asArray isEmpty ifTrue: [ + self selectAllElementInSpace ]. + plugin selection asArray size = 1 ifTrue: [ + self selectAllChildrenOfSelectedElement ] +] + +{ #category : #action } +PyramidSpecShortcutSelectAllElement >> selectAllChildrenOfSelectedElement [ + + plugin selection collection asArray first children isEmpty + ifTrue: [ + self inform: 'No children to select in the selected element' ] + ifFalse: [ + plugin setSelection: + plugin selection collection asArray first children ] +] + +{ #category : #action } +PyramidSpecShortcutSelectAllElement >> selectAllElementInSpace [ + + plugin setSelection: plugin firstLevelElements collection +] + +{ #category : #accessing } +PyramidSpecShortcutSelectAllElement >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'problem with the project model' ] + ifNotNil: [ self selectAll ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutUndo.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutUndo.class.st new file mode 100644 index 00000000..a9db4c6c --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutUndo.class.st @@ -0,0 +1,56 @@ +" +Class use to create the shortcut undo / redo. + +Use the history feature from the package Pyramid. +" +Class { + #name : #PyramidSpecShortcutUndo, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutUndo >> defaultKeyCombination [ + "CTRL + Z to activate this shortcut" + + keyCombination := $z command mac | $z control unix | $z control win +] + +{ #category : #initialization } +PyramidSpecShortcutUndo >> initialize [ + + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutUndo >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidHistoryPlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first +] + +{ #category : #accessing } +PyramidSpecShortcutUndo >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'Plugin undo/redo is not installed' ] + ifNotNil: [ + plugin history undo. + plugin projectModel informElementsChanged ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSpecShortcutUnselectedElement.class.st b/src/Pyramid-Bloc/PyramidSpecShortcutUnselectedElement.class.st new file mode 100644 index 00000000..21a29bb3 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidSpecShortcutUnselectedElement.class.st @@ -0,0 +1,46 @@ +" +Class use to create the shortcut unselect all selected elements. +" +Class { + #name : #PyramidSpecShortcutUnselectedElement, + #superclass : #PyramidSpecShortcutManagerPlugin, + #traits : 'TPyramidShortcutSpec', + #classTraits : 'TPyramidShortcutSpec classTrait', + #instVars : [ + 'plugin', + 'keyCombination', + 'shortcutAction' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +PyramidSpecShortcutUnselectedElement >> defaultKeyCombination [ + "Escape to activate this shortcut" + + keyCombination := Character escape +] + +{ #category : #initialization } +PyramidSpecShortcutUnselectedElement >> initialize [ + + self defaultKeyCombination +] + +{ #category : #'accessing - classes' } +PyramidSpecShortcutUnselectedElement >> pluginFromPyramid: aPyramidEditor [ + + plugin := aPyramidEditor projectModel +] + +{ #category : #accessing } +PyramidSpecShortcutUnselectedElement >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'problem with the project model' ] + ifNotNil: [ plugin updateSelection ] ] +] diff --git a/src/Pyramid-Bloc/PyramidSwitchInputPresenter.class.st b/src/Pyramid-Bloc/PyramidSwitchInputPresenter.class.st index d0d9f35c..c105bcb6 100644 --- a/src/Pyramid-Bloc/PyramidSwitchInputPresenter.class.st +++ b/src/Pyramid-Bloc/PyramidSwitchInputPresenter.class.st @@ -140,7 +140,7 @@ PyramidSwitchInputPresenter class >> blocToggleUncertain [ PyramidSwitchInputPresenter class >> formToggleOff [ ^ (BlElement new - size: 40 @ 16; + extent: 40 @ 16; addChildren: self blocToggleOff materializeAsBlElement) exportAsForm ] @@ -149,7 +149,7 @@ PyramidSwitchInputPresenter class >> formToggleOff [ PyramidSwitchInputPresenter class >> formToggleOn [ ^ (BlElement new - size: 40 @ 16; + extent: 40 @ 16; addChildren: self blocToggleOn materializeAsBlElement) exportAsForm ] @@ -158,7 +158,7 @@ PyramidSwitchInputPresenter class >> formToggleOn [ PyramidSwitchInputPresenter class >> formToggleUncertain [ ^ (BlElement new - size: 40 @ 16; + extent: 40 @ 16; addChildren: self blocToggleUncertain materializeAsBlElement) exportAsForm ] diff --git a/src/Pyramid-Bloc/TPyramidShortcutSpace.trait.st b/src/Pyramid-Bloc/TPyramidShortcutSpace.trait.st new file mode 100644 index 00000000..249b6a06 --- /dev/null +++ b/src/Pyramid-Bloc/TPyramidShortcutSpace.trait.st @@ -0,0 +1,54 @@ +Trait { + #name : #TPyramidShortcutSpace, + #instVars : [ + 'shortcutAction', + 'keyCombination', + 'plugin' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +TPyramidShortcutSpace >> defaultKeyCombination [ + + "CTRL + S as example" + keyCombination := "(BlKeyCombination builder primary key: + KeyboardKey S) build" nil +] + +{ #category : #initialization } +TPyramidShortcutSpace >> initialize [ + + self defaultKeyCombination +] + +{ #category : #accessing } +TPyramidShortcutSpace >> keyCombination: aKeyCombination [ + + ^ keyCombination := aKeyCombination +] + +{ #category : #'accessing - classes' } +TPyramidShortcutSpace >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | "extensions isKindOf: PyramidHistoryPlugin" ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first +] + +{ #category : #accessing } +TPyramidShortcutSpace >> shortcutAction [ + + ^ shortcutAction := BlShortcutWithAction new + name: 'Pyramid edition shortcut save'; + combination: keyCombination; + action: [ :event | + plugin + ifNil: [ + self inform: 'Plugin' , ' is not installed' "name of the plugin" ] + ifNotNil: [ "Action here" ] ] +] diff --git a/src/Pyramid-Bloc/TPyramidShortcutSpec.trait.st b/src/Pyramid-Bloc/TPyramidShortcutSpec.trait.st new file mode 100644 index 00000000..f94ff5e1 --- /dev/null +++ b/src/Pyramid-Bloc/TPyramidShortcutSpec.trait.st @@ -0,0 +1,49 @@ +Trait { + #name : #TPyramidShortcutSpec, + #instVars : [ + 'shortcutAction', + 'keyCombination', + 'plugin' + ], + #category : #'Pyramid-Bloc-plugin-shortcut-manager' +} + +{ #category : #accessing } +TPyramidShortcutSpec >> defaultKeyCombination [ +] + +{ #category : #initialization } +TPyramidShortcutSpec >> initialize [ + + self defaultKeyCombination +] + +{ #category : #accessing } +TPyramidShortcutSpec >> keyCombination: aKeyCombination [ + + ^ keyCombination := aKeyCombination +] + +{ #category : #'accessing - classes' } +TPyramidShortcutSpec >> pluginFromPyramid: aPyramidEditor [ + + | listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditor plugins. + pluginSorted := listOfPlugins select: [ :extensions | "extensions isKindOf: PyramidHistoryPlugin" ]. + pluginSorted size = 1 + ifFalse: [^ self]. + plugin := pluginSorted asArray first +] + +{ #category : #accessing } +TPyramidShortcutSpec >> shortcutAction [ + + shortcutAction := PyramidSpecShortcutActionObject new. + ^ shortcutAction + shortcut: keyCombination; + action: [ + plugin + ifNil: [ self inform: 'problem with the plugin' ] + ifNotNil: [ "Action here" ] ] +] diff --git a/src/Pyramid/PyramidEditor.class.st b/src/Pyramid/PyramidEditor.class.st index 3a36da61..e236287b 100644 --- a/src/Pyramid/PyramidEditor.class.st +++ b/src/Pyramid/PyramidEditor.class.st @@ -72,7 +72,8 @@ PyramidEditor >> open [ self window ifNil: [ ^ self ]. self window isOpen ifTrue:[ ^ self ]. - self window open + self window open. + self plugins do: [ :plugin | plugin windowOpenBy: self ] ] { #category : #plugins } diff --git a/src/Pyramid/TPyramidPlugin.trait.st b/src/Pyramid/TPyramidPlugin.trait.st index 20e56c9a..57bf405a 100644 --- a/src/Pyramid/TPyramidPlugin.trait.st +++ b/src/Pyramid/TPyramidPlugin.trait.st @@ -48,3 +48,7 @@ TPyramidPlugin >> configureBuilder: aPyramidEditorBuilder [ { #category : #connecting } TPyramidPlugin >> connectOn: aPyramidEditor [ ] + +{ #category : #connecting } +TPyramidPlugin >> windowOpenBy: aPyramidEditor [ +]