diff --git a/src/Pyramid-Bloc/PyramidNavigationPlugin.class.st b/src/Pyramid-Bloc/PyramidNavigationPlugin.class.st index ef2b110..d2830a0 100644 --- a/src/Pyramid-Bloc/PyramidNavigationPlugin.class.st +++ b/src/Pyramid-Bloc/PyramidNavigationPlugin.class.st @@ -31,12 +31,7 @@ PyramidNavigationPlugin >> connectOn: aPyramidEditor [ editor := aPyramidEditor. self navigation editor: aPyramidEditor. self libraryController popoverOrigin: - (aPyramidEditor window services at: #tabLeft) presenter. - - aPyramidEditor - addShortcutSpecInCollection: KeyboardKey delete - action: [ self removeSelectedElements ] - name: 'Shortcut Spec removeSelectedElement'. + (aPyramidEditor window services at: #tabLeft) presenter ] { #category : #initialization } diff --git a/src/Pyramid-Bloc/PyramidNavigationTreePresenter.class.st b/src/Pyramid-Bloc/PyramidNavigationTreePresenter.class.st index f37b41c..ba37b9a 100644 --- a/src/Pyramid-Bloc/PyramidNavigationTreePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidNavigationTreePresenter.class.st @@ -11,7 +11,7 @@ Class { #category : #'Pyramid-Bloc-plugin-navigation' } -{ #category : #'as yet unclassified' } +{ #category : #actions } PyramidNavigationTreePresenter >> actionEditorMenu [ | builder | @@ -20,7 +20,7 @@ PyramidNavigationTreePresenter >> actionEditorMenu [ ^ builder menuFor: self editor projectModel selection ] -{ #category : #'as yet unclassified' } +{ #category : #actions } PyramidNavigationTreePresenter >> actionSelectionChanged: aSelection [ self editor ifNil: [ ^ self ]. @@ -106,7 +106,9 @@ PyramidNavigationTreePresenter >> initializePresenters [ whenSelectionChangedDo: [ :aSelection | self actionSelectionChanged: aSelection ]; expandAll. - self allTreeColumns do: [ :each | treeTable addColumn: each ] + self allTreeColumns do: [ :each | treeTable addColumn: each ]. + + treeTable eventHandler whenKeyUpDo:[ :event | (event key = KeyboardKey delete) ifTrue:[ self removeSelectedElements] ] ] { #category : #accessing } @@ -140,6 +142,18 @@ PyramidNavigationTreePresenter >> previousNumberOfElement: anObject [ previousNumberOfElement := anObject ] +{ #category : #actions } +PyramidNavigationTreePresenter >> removeSelectedElements [ + + self editor commandExecutor + use: PyramidRemoveSelectedElementsCommand new + on: self editor projectModel selection + with: self editor projectModel firstLevelElements. + + "Update the selection after remove" + self editor projectModel updateSelection +] + { #category : #api } PyramidNavigationTreePresenter >> roots: aCollection [ @@ -164,7 +178,7 @@ PyramidNavigationTreePresenter >> treeTable [ ^ treeTable ] -{ #category : #'as yet unclassified' } +{ #category : #updating } PyramidNavigationTreePresenter >> updateRoots [ | currentTreeRoots roots parent shouldOrder calculatedNumberOfElement | diff --git a/src/Pyramid-Bloc/PyramidSaveModelVerifier.class.st b/src/Pyramid-Bloc/PyramidSaveModelVerifier.class.st index 0848f87..b14d0b8 100644 --- a/src/Pyramid-Bloc/PyramidSaveModelVerifier.class.st +++ b/src/Pyramid-Bloc/PyramidSaveModelVerifier.class.st @@ -46,8 +46,18 @@ PyramidSaveModelVerifier class >> classPackageIsEqual [ { #category : #constructor } PyramidSaveModelVerifier class >> methodIsValid [ + (SystemVersion current major <= 12) ifTrue: [ ^self methodIsValidP12 ]. + + ^ self new verifyBlock: [ :model | OCScanner isSelector: model savingMethodName ]; + showBlock: [ :view | view showMethodIsNotValidError ]; + yourself +] + +{ #category : #constructor } +PyramidSaveModelVerifier class >> methodIsValidP12 [ + ^ self new - verifyBlock: [ :model |model savingMethodName isValidSelector]; + verifyBlock: [ :model | model savingMethodName isValidSelector ]; showBlock: [ :view | view showMethodIsNotValidError ]; yourself ] diff --git a/src/Pyramid-Bloc/PyramidSavingService.class.st b/src/Pyramid-Bloc/PyramidSavingService.class.st index 40028ee..1f45d0a 100644 --- a/src/Pyramid-Bloc/PyramidSavingService.class.st +++ b/src/Pyramid-Bloc/PyramidSavingService.class.st @@ -118,40 +118,34 @@ PyramidSavingService class >> ston [ { #category : #private } PyramidSavingService >> buildMetaDataMethod [ - | methodName windowSize gridVisibility gridSpacing gridColor icons dictContent nl tab header existingIds | + | methodName windowSize gridVisibility gridSpacing gridColor icons dictContent nl tab header rootElements| methodName := self saveModel savingMethodName , 'MetaData'. - windowSize := PyramidMainExtension currentGridWindowSize ifNil: [ - 800 @ 600 ]. - gridVisibility := PyramidMainExtension currentGridVisibility ifNil: [ - false ]. + windowSize := PyramidMainExtension currentGridWindowSize ifNil: [ 800 @ 600 ]. + gridVisibility := PyramidMainExtension currentGridVisibility ifNil: [ false ]. gridSpacing := PyramidMainExtension currentGridSpacing ifNil: [ 10 ]. - gridColor := PyramidMainExtension currentGridColor ifNil: [ - Color black ]. - existingIds := Set new. - [ - self saveModel projectModel firstLevelElements do: [ :e | - (e respondsTo: #id) ifTrue: [ - e id ifNotNil: [ :anId | existingIds add: anId asString ] ] ] ] - on: Error - do: [ :err | existingIds := Set new ]. + gridColor := PyramidMainExtension currentGridColor ifNil: [ Color black ]. + + rootElements := self saveModel projectModel firstLevelElements. icons := Dictionary new. - PyramidMainExtension currentProjectIcons keysAndValuesDo: [ - :key - :value | - | keyString suffix baseId | - keyString := key asString. - suffix := #( '_icon' '_endIcon' '_innerImage' ) - detect: [ :s | keyString endsWith: s ] - ifNone: [ nil ]. - suffix ifNotNil: [ - baseId := keyString copyFrom: 1 to: keyString size - suffix size. - (existingIds includes: baseId) ifTrue: [ - icons at: key put: value ] ] ] . + PyramidMainExtension currentProjectIcons keysAndValuesDo: [:key :value | + | keyString suffix baseId | + keyString := key asString. + suffix := #( '_icon' '_endIcon' '_innerImage' ) + detect: [ :s | keyString endsWith: s ] + ifNone: [ nil ]. + suffix ifNotNil: [ + baseId := keyString copyFrom: 1 to: keyString size - suffix size. + (rootElements anySatisfy:[:e | (e id = baseId) or:[ e allChildrenBreadthFirstDetect: [:c |c id = baseId ] ifFound:[:c | true] ifNone:[false] ]]) ifTrue:[ + icons at: key put: value + ] + ] + ]. (windowSize = (800 @ 600) and: [ - gridVisibility not and: [ - gridSpacing = 10 and: [ - gridColor = Color black and: [ icons isEmpty ] ] ] ]) ifTrue: [ - ^ nil ]. + gridVisibility not and: [ + gridSpacing = 10 and: [ + gridColor = Color black and: [ icons isEmpty ] ] ] ]) ifTrue: [ + ^ nil + ]. nl := String with: Character cr. tab := String with: Character tab. dictContent := ''. @@ -195,7 +189,7 @@ PyramidSavingService >> canSave [ ^ self verifier verify: self saveModel ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidSavingService >> errorCannotSave [ PyramidSaveError signal: 'Cannot save with given model. Check canSave method to more explenation.' @@ -207,7 +201,7 @@ PyramidSavingService >> methodBuilder [ ^ self class currentMethodBuilder ] -{ #category : #'as yet unclassified' } +{ #category : #API } PyramidSavingService >> save [ | class | self canSave ifFalse: [ self errorCannotSave ]. diff --git a/src/Pyramid-Bloc/PyramidToImageInnerImageCommand.class.st b/src/Pyramid-Bloc/PyramidToImageInnerImageCommand.class.st index 4925d79..bacf569 100644 --- a/src/Pyramid-Bloc/PyramidToImageInnerImageCommand.class.st +++ b/src/Pyramid-Bloc/PyramidToImageInnerImageCommand.class.st @@ -23,8 +23,12 @@ PyramidToImageInnerImageCommand >> getValueFor: aToImage [ { #category : #setter } PyramidToImageInnerImageCommand >> setValueFor: aToImage with: aSymbol [ - aToImage innerImage: - (PyramidIconInputPresenter innerElementFromName: aSymbol). + | innerImage | + innerImage := PyramidIconInputPresenter toImageFromName: aSymbol. + innerImage constraints horizontal matchParent. + innerImage constraints vertical matchParent. + aToImage innerImage: innerImage. + PyramidMainExtension addIconName: aSymbol forElementId: aToImage id asString, '_innerImage' diff --git a/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st b/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st index d4fbb46..ae319cb 100644 --- a/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st +++ b/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st @@ -116,6 +116,8 @@ PyramidToploThemePlugin class >> toploLibraryCategory [ ToLabel. ToImage. ToAlbum. + ToPane. + ToCheckbox. ToTextField}. knownNotUsable := #( #ToCircularMenuInnerElement #ToCircularMenuList #ToExPicsumNode diff --git a/src/Pyramid/PyramidEditor.class.st b/src/Pyramid/PyramidEditor.class.st index b20e114..264bb0e 100644 --- a/src/Pyramid/PyramidEditor.class.st +++ b/src/Pyramid/PyramidEditor.class.st @@ -66,7 +66,7 @@ PyramidEditor >> commandExecutor: anObject [ commandExecutor := anObject ] -{ #category : #'as yet unclassified' } +{ #category : #'private - default' } PyramidEditor >> defaultSpecShortcuts [ "Shortcut using only projectModel" diff --git a/src/Pyramid/PyramidIconInputPresenter.class.st b/src/Pyramid/PyramidIconInputPresenter.class.st index acfaaec..f1f5bf3 100644 --- a/src/Pyramid/PyramidIconInputPresenter.class.st +++ b/src/Pyramid/PyramidIconInputPresenter.class.st @@ -37,41 +37,17 @@ PyramidIconInputPresenter class >> findToploIconNamed: aSymbol [ ifNone: [ nil ] ] ] ] -{ #category : #private } -PyramidIconInputPresenter class >> innerElementFromName: aSymbol [ - - (self findToploIconNamed: aSymbol) ifNotNil: [ :element | - | proxy | - proxy := self toploSvgProxyFor: element. - - proxy pyramidExternalRessourceSource postConstructionBlock: [ :obj | - obj constraints horizontal matchParent. - obj constraints vertical matchParent ]. - - ^ proxy ]. - - ^ self buildProxy: Object selector: #iconNamed: args: { aSymbol } -] - { #category : #private } PyramidIconInputPresenter class >> toImageFromName: aSymbol [ - (self findToploIconNamed: aSymbol) ifNotNil: [ :element | - | proxy | - proxy := self toploSvgProxyFor: element. - - proxy pyramidExternalRessourceSource postConstructionBlock: [ :obj | - obj constraints horizontal exact: 16. - obj constraints vertical exact: 16 ]. + | proxy | + proxy := (self findToploIconNamed: aSymbol) ifNotNil: [ :element | + self buildProxy: element provider selector: element name asSymbol args: #( ) + ] ifNil:[ + self buildProxy: Object selector: #iconNamed: args: { aSymbol } + ]. - ^ ToImage new - innerImage: proxy; - yourself ]. - - ^ ToImage new - innerImage: - (self buildProxy: Object selector: #iconNamed: args: { aSymbol }); - yourself + ^ ToImage new innerImage: proxy;yourself ] { #category : #adding } @@ -96,6 +72,8 @@ PyramidIconInputPresenter class >> toploIconThemeCategoryFromClass: aClass withC elementSelectors := (aClass perform: method selector) collect: [ :suffix | prefix , '_' , suffix ]. + + elementSelectors := elementSelectors asSortedCollection. elements := elementSelectors collect: [ :selector | PyramidLibraryElement new @@ -150,23 +128,6 @@ PyramidIconInputPresenter class >> toploMaterialIconCategory [ withCategoryPrefix: 'Material Design - ' ] -{ #category : #private } -PyramidIconInputPresenter class >> toploSvgProxyFor: element [ - - | stringProxy svgProxy | - stringProxy := self - buildProxy: element provider - selector: element name asSymbol - args: #( ). - - svgProxy := self - buildProxy: BlSvgConverter - selector: #convertFromString: - args: { stringProxy }. - - ^ svgProxy -] - { #category : #private } PyramidIconInputPresenter >> buildIconPickerPresenter [ diff --git a/src/Pyramid/TPyramidFindPlugin.trait.st b/src/Pyramid/TPyramidFindPlugin.trait.st index 7994459..f2c4a46 100644 --- a/src/Pyramid/TPyramidFindPlugin.trait.st +++ b/src/Pyramid/TPyramidFindPlugin.trait.st @@ -3,7 +3,7 @@ Trait { #category : #'Pyramid-core' } -{ #category : #'as yet unclassified' } +{ #category : #accessing } TPyramidFindPlugin >> findPlugin: aSymbolOrAClass [ | allPlugins |