From f5227e9a29e89843c42acb2a5e89a7c70219f947 Mon Sep 17 00:00:00 2001 From: SullyMLT Date: Tue, 12 Aug 2025 14:53:06 +0200 Subject: [PATCH 1/2] Add new feature Toplo theme --- .../PyramidChangeTextCommand.class.st | 6 +- .../PyramidDrawOrderIcons.class.st | 8 +- .../PyramidLibraryDefault.class.st | 2 +- .../PyramidSelectionMakerExtension.class.st | 6 +- .../PyramidVisualPystonForCly.class.st | 4 +- .../PyramidAddStampPresenter.class.st | 85 ++++++ ...dContainsValidSelectorInterpreter.class.st | 2 +- ...amidElementThemeSelectorPresenter.class.st | 14 +- .../PyramidSelectorPossibleStamps.class.st | 2 +- ...yramidSpaceThemeSelectorPresenter.class.st | 25 +- .../PyramidStampCommand.class.st | 2 +- .../PyramidStampManagerPresenter.class.st | 242 ++++++++++++++++++ .../PyramidStyleSheetEditorPresenter.class.st | 2 +- .../PyramidThemeCommand.class.st | 2 +- .../PyramidThemeFromSpaceExtension.class.st | 2 +- .../PyramidThemePresenter.class.st | 33 ++- .../PyramidThemePropertyStrategy.class.st | 35 ++- .../PyramidThemeSelectorPresenter.class.st | 5 +- .../PyramidToploThemePlugin.class.st | 33 ++- 19 files changed, 464 insertions(+), 46 deletions(-) create mode 100644 src/Pyramid-Toplo/PyramidAddStampPresenter.class.st create mode 100644 src/Pyramid-Toplo/PyramidStampManagerPresenter.class.st diff --git a/src/Pyramid-Bloc/PyramidChangeTextCommand.class.st b/src/Pyramid-Bloc/PyramidChangeTextCommand.class.st index 181b72af..93a2bbda 100644 --- a/src/Pyramid-Bloc/PyramidChangeTextCommand.class.st +++ b/src/Pyramid-Bloc/PyramidChangeTextCommand.class.st @@ -18,5 +18,9 @@ PyramidChangeTextCommand >> setValueFor: aBlTextElement with: aString [ rope := aString asRopedText. attributes do: [ :a | rope attribute: a ]. - aBlTextElement text: rope + aBlTextElement text: rope. + "Fix label color on theme change when label is create during the session without copy or open from save" + aBlTextElement parent ifNil: [ ^ self ]. + (((aBlTextElement parent)class) name) = (#ToLabel) + ifTrue: [ aBlTextElement parent text: aString asRopedText ] ] diff --git a/src/Pyramid-Bloc/PyramidDrawOrderIcons.class.st b/src/Pyramid-Bloc/PyramidDrawOrderIcons.class.st index f28afcd5..b75223a1 100644 --- a/src/Pyramid-Bloc/PyramidDrawOrderIcons.class.st +++ b/src/Pyramid-Bloc/PyramidDrawOrderIcons.class.st @@ -224,7 +224,7 @@ blpaintbackground2 := BlPaintBackground new. PyramidDrawOrderIcons class >> formMoveBackward [ ^ (BlElement new - size: 16 @ 16; + extent: 16 @ 16; addChildren: self blocMoveBackward materializeAsBlElement) exportAsForm ] @@ -233,7 +233,7 @@ PyramidDrawOrderIcons class >> formMoveBackward [ PyramidDrawOrderIcons class >> formMoveForward [ ^ (BlElement new - size: 16 @ 16; + extent: 16 @ 16; addChildren: self blocMoveForward materializeAsBlElement) exportAsForm ] @@ -242,7 +242,7 @@ PyramidDrawOrderIcons class >> formMoveForward [ PyramidDrawOrderIcons class >> formOnBackground [ ^ (BlElement new - size: 16 @ 16; + extent: 16 @ 16; addChildren: self blocOnBackground materializeAsBlElement) exportAsForm ] @@ -251,7 +251,7 @@ PyramidDrawOrderIcons class >> formOnBackground [ PyramidDrawOrderIcons class >> formOnForeground [ ^ (BlElement new - size: 16 @ 16; + extent: 16 @ 16; addChildren: self blocOnForeground materializeAsBlElement) exportAsForm ] diff --git a/src/Pyramid-Bloc/PyramidLibraryDefault.class.st b/src/Pyramid-Bloc/PyramidLibraryDefault.class.st index 21f089a6..bf869e6a 100644 --- a/src/Pyramid-Bloc/PyramidLibraryDefault.class.st +++ b/src/Pyramid-Bloc/PyramidLibraryDefault.class.st @@ -87,7 +87,7 @@ PyramidLibraryDefault >> smalltalkIconsCategory [ name: each key; block: [ { (BlElement new - size: each value extent; + extent: each value extent; background: (BlImageBackground image: (PyramidExternalRessourceProxy fromSource: diff --git a/src/Pyramid-Bloc/PyramidSelectionMakerExtension.class.st b/src/Pyramid-Bloc/PyramidSelectionMakerExtension.class.st index f7620e6d..45d83347 100644 --- a/src/Pyramid-Bloc/PyramidSelectionMakerExtension.class.st +++ b/src/Pyramid-Bloc/PyramidSelectionMakerExtension.class.st @@ -75,10 +75,10 @@ PyramidSelectionMakerExtension >> dragEvent: anEvent [ xmin := self dragOrigin x min: anEvent position x. ymin := self dragOrigin y min: anEvent position y. - + self selectionGhost position: xmin @ ymin; - size: (anEvent position - self dragOrigin) abs + extent: (anEvent position - self dragOrigin) abs ] { #category : #accessing } @@ -100,7 +100,7 @@ PyramidSelectionMakerExtension >> dragStart: anEvent [ self dragOrigin: anEvent position. self selectionGhost - size: 0 @ 0; + extent: 0 @ 0; position: self dragOrigin; visibility: BlVisibility visible ] diff --git a/src/Pyramid-Bloc/PyramidVisualPystonForCly.class.st b/src/Pyramid-Bloc/PyramidVisualPystonForCly.class.st index 9097fd6b..bd92ec7f 100644 --- a/src/Pyramid-Bloc/PyramidVisualPystonForCly.class.st +++ b/src/Pyramid-Bloc/PyramidVisualPystonForCly.class.st @@ -89,7 +89,7 @@ PyramidVisualPystonForCly >> build [ blElement isCollection ifTrue: [ blElement := BlElement new addChildren: blElement; - size: 1500 @ 1500; + extent: 1500 @ 1500; yourself ]. imageMorph := ImageMorph withForm: blElement exportAsForm. self addMorph: imageMorph fullFrame: LayoutFrame identity. @@ -242,7 +242,7 @@ PyramidVisualPystonForCly >> update [ blElement isCollection ifTrue: [ blElement := BlElement new addChildren: blElement; - size: 1500 @ 1500; + extent: 1500 @ 1500; yourself ]. imageMorph form: blElement exportAsForm diff --git a/src/Pyramid-Toplo/PyramidAddStampPresenter.class.st b/src/Pyramid-Toplo/PyramidAddStampPresenter.class.st new file mode 100644 index 00000000..fa18fd7d --- /dev/null +++ b/src/Pyramid-Toplo/PyramidAddStampPresenter.class.st @@ -0,0 +1,85 @@ +Class { + #name : #PyramidAddStampPresenter, + #superclass : #SpPresenter, + #instVars : [ + 'stampManagerPresenter', + 'treeTableAddStamp', + 'selectedStampToAdd', + 'addStampButton' + ], + #category : #'Pyramid-Toplo-plugin-theme-management' +} + +{ #category : #adding } +PyramidAddStampPresenter >> addSelectedStampToElement [ + + selectedStampToAdd ifNil: [ ^ self ]. + + selectedStampToAdd command + setValueFor: self stampManagerPresenter currentSelectedElement + with: true. + + self refreshStampTreeTable. +] + +{ #category : #accessing } +PyramidAddStampPresenter >> addStampButton [ + + ^ addStampButton +] + +{ #category : #layout } +PyramidAddStampPresenter >> defaultLayout [ + + | defaultLayout stampToolBarAddButton | + + defaultLayout := SpBoxLayout newVertical spacing: 6; yourself. + + stampToolBarAddButton := SpBoxLayout newHorizontal hAlignStart; yourself. + stampToolBarAddButton add: addStampButton width: 380. + + defaultLayout add: treeTableAddStamp expand: true. + defaultLayout add: stampToolBarAddButton expand: false. + + ^ defaultLayout +] + +{ #category : #'initialization - deprecated' } +PyramidAddStampPresenter >> initializePresenter [ + + addStampButton := SpButtonPresenter new + label: 'Add Stamp'; + icon: (Smalltalk ui icons iconNamed: #add); + whenActivatedDo: [ self addSelectedStampToElement ]. + + treeTableAddStamp := SpTreeTablePresenter new. + treeTableAddStamp whenSelectedItemChangedDo: [ :aStampSelected | selectedStampToAdd := aStampSelected ]. + treeTableAddStamp addColumn: (SpCompositeTableColumn new + title: 'List of stamps'; + addColumn: (SpStringTableColumn evaluated: #name); + yourself). +] + +{ #category : #adding } +PyramidAddStampPresenter >> refreshStampTreeTable [ + + self stampManagerPresenter refreshStampTreeTable +] + +{ #category : #accessing } +PyramidAddStampPresenter >> stampManagerPresenter [ + + ^ stampManagerPresenter +] + +{ #category : #accessing } +PyramidAddStampPresenter >> stampManagerPresenter: aPyramidStampManagerPresenter [ + + stampManagerPresenter := aPyramidStampManagerPresenter +] + +{ #category : #accessing } +PyramidAddStampPresenter >> treeTableAddStamp [ + + ^ treeTableAddStamp +] diff --git a/src/Pyramid-Toplo/PyramidContainsValidSelectorInterpreter.class.st b/src/Pyramid-Toplo/PyramidContainsValidSelectorInterpreter.class.st index ac8141fd..5148858e 100644 --- a/src/Pyramid-Toplo/PyramidContainsValidSelectorInterpreter.class.st +++ b/src/Pyramid-Toplo/PyramidContainsValidSelectorInterpreter.class.st @@ -7,7 +7,7 @@ Class { 'invalidSelectors', 'ignoredSelectors' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #operating } diff --git a/src/Pyramid-Toplo/PyramidElementThemeSelectorPresenter.class.st b/src/Pyramid-Toplo/PyramidElementThemeSelectorPresenter.class.st index 326543f5..d1d8468e 100644 --- a/src/Pyramid-Toplo/PyramidElementThemeSelectorPresenter.class.st +++ b/src/Pyramid-Toplo/PyramidElementThemeSelectorPresenter.class.st @@ -3,12 +3,13 @@ Class { #superclass : #PyramidThemeSelectorPresenter, #instVars : [ 'projectModel', + 'themePropertyManager', 'inheritSelector', 'labelPresenter', 'commandExecutor', 'themeCommand' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #'as yet unclassified' } @@ -67,7 +68,7 @@ PyramidElementThemeSelectorPresenter >> elementsOrSelectionChanged: anEvent [ self triggerThemeChangement: false. self updatePresenterFor: anEvent selection. - self triggerThemeChangement: true + self triggerThemeChangement: true. ] { #category : #accessing } @@ -83,7 +84,7 @@ PyramidElementThemeSelectorPresenter >> initializePresenters [ themeCommand := PyramidThemeCommand new. inheritSelector := SpCheckBoxPresenter new label: 'Inherits from parents'; - whenChangedDo: [ :aBoolean | self applyTheme ]; + whenChangedDo: [ :aBoolean | self applyTheme. self themeSelector enabled: (aBoolean not) ]; yourself. labelPresenter := SpLabelPresenter new label: 'Element Theme (empty select)'; @@ -110,11 +111,11 @@ PyramidElementThemeSelectorPresenter >> projectModel [ PyramidElementThemeSelectorPresenter >> projectModel: aPyramidProjectModel [ projectModel := aPyramidProjectModel. - projectModel + projectModel announcer when: PyramidElementsChangedEvent do: [ :evt | self elementsOrSelectionChanged: evt ] for: self. - projectModel + projectModel announcer when: PyramidSelectionChangedEvent do: [ :evt | self elementsOrSelectionChanged: evt ] for: self. @@ -160,6 +161,7 @@ PyramidElementThemeSelectorPresenter >> updatePresenterFor: aCollectionOfElement collectionOfLocalThemes := (aCollectionOfElement asArray collect: [ :each | each localTheme ]) asSet asArray. collectionOfLocalThemes size > 1 ifTrue: [ + self inform: 'here'. self labelPresenter label: 'Elements Theme (differents)'. ^ self ]. @@ -172,5 +174,5 @@ PyramidElementThemeSelectorPresenter >> updatePresenterFor: aCollectionOfElement self themeSelector enabled: true. self selectTheme: collectionOfLocalThemes first ]. - self layout: self defaultLayout + "self layout: self defaultLayout" ] diff --git a/src/Pyramid-Toplo/PyramidSelectorPossibleStamps.class.st b/src/Pyramid-Toplo/PyramidSelectorPossibleStamps.class.st index db4cdaf0..0cf44247 100644 --- a/src/Pyramid-Toplo/PyramidSelectorPossibleStamps.class.st +++ b/src/Pyramid-Toplo/PyramidSelectorPossibleStamps.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'theme' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #'as yet unclassified' } diff --git a/src/Pyramid-Toplo/PyramidSpaceThemeSelectorPresenter.class.st b/src/Pyramid-Toplo/PyramidSpaceThemeSelectorPresenter.class.st index 2895affd..218da56f 100644 --- a/src/Pyramid-Toplo/PyramidSpaceThemeSelectorPresenter.class.st +++ b/src/Pyramid-Toplo/PyramidSpaceThemeSelectorPresenter.class.st @@ -6,7 +6,7 @@ Class { #instVars : [ 'projectModel' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #'as yet unclassified' } @@ -16,6 +16,29 @@ PyramidSpaceThemeSelectorPresenter >> applyTheme [ self projectModel informElementsChanged ] +{ #category : #accessing } +PyramidSpaceThemeSelectorPresenter >> builder [ + + ^ builder +] + +{ #category : #accessing } +PyramidSpaceThemeSelectorPresenter >> builder: anObject [ + + builder:= anObject. +] + +{ #category : #accessing } +PyramidSpaceThemeSelectorPresenter >> editor: aPyramidEditor [ +] + +{ #category : #displaying } +PyramidSpaceThemeSelectorPresenter >> installOn: aBuilder [ + + self builder: aBuilder. + +] + { #category : #initialization } PyramidSpaceThemeSelectorPresenter >> labelPresenter [ diff --git a/src/Pyramid-Toplo/PyramidStampCommand.class.st b/src/Pyramid-Toplo/PyramidStampCommand.class.st index 5bee137e..2ec2f0c1 100644 --- a/src/Pyramid-Toplo/PyramidStampCommand.class.st +++ b/src/Pyramid-Toplo/PyramidStampCommand.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'stamp' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #'as yet unclassified' } diff --git a/src/Pyramid-Toplo/PyramidStampManagerPresenter.class.st b/src/Pyramid-Toplo/PyramidStampManagerPresenter.class.st new file mode 100644 index 00000000..6a0c4b6b --- /dev/null +++ b/src/Pyramid-Toplo/PyramidStampManagerPresenter.class.st @@ -0,0 +1,242 @@ +Class { + #name : #PyramidStampManagerPresenter, + #superclass : #SpPresenter, + #instVars : [ + 'projectModel', + 'styleSheetEditor', + 'treeTableStamp', + 'pyramidPropertiesStrategy', + 'stampPresenterLabel', + 'selectedStamp', + 'removeStampButton', + 'currentSelectedElement', + 'treeTableAddStampPresenter', + 'selectedStampEquipped', + 'selectedStampToAdd', + 'addStampButton' + ], + #category : #'Pyramid-Toplo-plugin-theme-management' +} + +{ #category : #adding } +PyramidStampManagerPresenter >> addRootsStampAddTreeTable: aElement [ + + | collectionOfStamps | + + collectionOfStamps := pyramidPropertiesStrategy newPropertiesFor: aElement. + + ^ collectionOfStamps. +] + +{ #category : #'as yet unclassified' } +PyramidStampManagerPresenter >> allStampFromElement: aElement [ + + | stampsCollection collectionOfStamps classStampToRemove | + stampsCollection := OrderedCollection new. + collectionOfStamps := OrderedCollection new. + + aElement allStamps do: [ :aStamp | + stampsCollection add: (PyramidProperty new + name: aStamp; + command: (PyramidStampCommand new + stamp: aStamp; + yourself)) ]. + + stampsCollection isEmpty ifTrue: [ + treeTableStamp roots: { }. + ^ self ]. + + "classStampToRemove := (aElement class asString withoutPrefix: 'To') + asLowercase. + + stampsCollection do: [ :aPyramidProperty | + aPyramidProperty name = classStampToRemove asSymbol ifFalse: [ + collectionOfStamps add: aPyramidProperty ] ]." + + "treeTableStamp roots: collectionOfStamps asArray" + treeTableStamp roots: stampsCollection asArray +] + +{ #category : #accessing } +PyramidStampManagerPresenter >> currentSelectedElement [ + + ^ currentSelectedElement +] + +{ #category : #layout } +PyramidStampManagerPresenter >> defaultLayout [ + + | defaultLayout stampPresenterTree stampPresenterLabelLine stampToolBarButton addStampButtonToolBar removeStampButtonToolBar | + + defaultLayout := SpBoxLayout newVertical + spacing: 6; + yourself. + + stampPresenterLabelLine := SpBoxLayout newHorizontal + hAlignStart; + yourself. + stampPresenterLabelLine add: stampPresenterLabel. + + stampToolBarButton := SpBoxLayout newHorizontal + hAlign; + yourself. + + addStampButtonToolBar := SpBoxLayout newHorizontal + hAlignStart; + yourself. + + removeStampButtonToolBar := SpBoxLayout newHorizontal + hAlignEnd; + yourself. + + addStampButtonToolBar add: addStampButton width: 125. + removeStampButtonToolBar add: removeStampButton width: 125. + + stampToolBarButton add: addStampButtonToolBar. + stampToolBarButton add: removeStampButtonToolBar. + + stampPresenterTree := SpBoxLayout newVertical. + stampPresenterTree add: treeTableStamp. + + defaultLayout add: stampPresenterLabelLine expand: false. + defaultLayout add: stampToolBarButton expand: false. + defaultLayout add: stampPresenterTree expand: true. + + ^ defaultLayout +] + +{ #category : #'as yet unclassified' } +PyramidStampManagerPresenter >> elementsOrSelectionChanged: anEvent [ + + anEvent selection isEmpty + ifTrue: [ treeTableStamp roots: { }. addStampButton disable. ^ self ]. + anEvent selection size > 1 + ifTrue: [ treeTableStamp roots: { }. addStampButton disable. ^ self ]. + + currentSelectedElement := anEvent selection first. + "currentSelectedElement allStamps inspect. + currentSelectedElement inspect." + self allStampFromElement: currentSelectedElement. + addStampButton enable. +] + +{ #category : #'initialization - deprecated' } +PyramidStampManagerPresenter >> initializePresenter [ + + stampPresenterLabel := SpLabelPresenter new + displayBold: [ true ]; + label: 'Selected element stamp :'; + yourself. + + addStampButton := SpButtonPresenter new + label: 'Add Stamp'; + icon: (Smalltalk ui icons iconNamed: #add); + whenActivatedDo: [ self openModalAddStampTreeTable ]; + disable. + + removeStampButton := SpButtonPresenter new + label: 'Remove Stamp'; + icon: (Smalltalk ui icons iconNamed: #cancel); + whenActivatedDo: [ self removeSelectedStamp: selectedStampEquipped ]; + disable. + + treeTableStamp := SpTreeTablePresenter new. + treeTableStamp whenSelectedItemChangedDo: [ :aStampSelected | selectedStampEquipped := aStampSelected. + selectedStampEquipped + ifNil: [ removeStampButton disable ] + ifNotNil: [ removeStampButton enable ] ]. + treeTableStamp addColumn: (SpCompositeTableColumn new + title: 'Stamp'; + addColumn: (SpStringTableColumn evaluated: #name); + yourself). + + treeTableAddStampPresenter := PyramidAddStampPresenter new + stampManagerPresenter: self. + +] + +{ #category : #'as yet unclassified' } +PyramidStampManagerPresenter >> openModalAddStampTreeTable [ + + | dialog window | + + projectModel selection isEmpty + ifTrue: [ ^ self ]. + projectModel selection size > 1 + ifTrue: [ ^ self ]. + + window := treeTableAddStampPresenter asModalWindow. + treeTableAddStampPresenter treeTableAddStamp roots: (self addRootsStampAddTreeTable: currentSelectedElement). + window title: 'Add stamp to the selected element'. + "To center the window when open" + "window centered." + dialog := window open. +] + +{ #category : #accessing } +PyramidStampManagerPresenter >> projectModel [ + + ^ projectModel +] + +{ #category : #accessing } +PyramidStampManagerPresenter >> projectModel: aPyramidProjectModel [ + + projectModel := aPyramidProjectModel. + projectModel announcer + when: PyramidElementsChangedEvent + do: [ :evt | self elementsOrSelectionChanged: evt ] + for: self. + projectModel announcer + when: PyramidSelectionChangedEvent + do: [ :evt | self elementsOrSelectionChanged: evt ] + for: self. +] + +{ #category : #accessing } +PyramidStampManagerPresenter >> pyramidPropertiesStrategy [ + + ^ pyramidPropertiesStrategy +] + +{ #category : #accessing } +PyramidStampManagerPresenter >> pyramidPropertiesStrategy: aPyramidPropertiesStrategy [ + + pyramidPropertiesStrategy := aPyramidPropertiesStrategy +] + +{ #category : #adding } +PyramidStampManagerPresenter >> refreshStampTreeTable [ + + self allStampFromElement: currentSelectedElement. +] + +{ #category : #removing } +PyramidStampManagerPresenter >> removeSelectedStamp: aSelectedStamp [ + + selectedStampEquipped ifNil: [ ^ self ]. + + selectedStampEquipped command + setValueFor: currentSelectedElement + with: false. + + self refreshStampTreeTable. +] + +{ #category : #accessing } +PyramidStampManagerPresenter >> styleSheetEditor [ + + ^ styleSheetEditor +] + +{ #category : #accessing } +PyramidStampManagerPresenter >> styleSheetEditor: aStyleSheetEditor [ + + styleSheetEditor := aStyleSheetEditor +] + +{ #category : #accessing } +PyramidStampManagerPresenter >> treeTableStamp [ + + ^ treeTableStamp +] diff --git a/src/Pyramid-Toplo/PyramidStyleSheetEditorPresenter.class.st b/src/Pyramid-Toplo/PyramidStyleSheetEditorPresenter.class.st index b4e494ef..8a92a1e5 100644 --- a/src/Pyramid-Toplo/PyramidStyleSheetEditorPresenter.class.st +++ b/src/Pyramid-Toplo/PyramidStyleSheetEditorPresenter.class.st @@ -6,7 +6,7 @@ Class { 'styleSheetEditor', 'stampPresenter' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #accessing } diff --git a/src/Pyramid-Toplo/PyramidThemeCommand.class.st b/src/Pyramid-Toplo/PyramidThemeCommand.class.st index 9bcd10fc..66c4f825 100644 --- a/src/Pyramid-Toplo/PyramidThemeCommand.class.st +++ b/src/Pyramid-Toplo/PyramidThemeCommand.class.st @@ -1,7 +1,7 @@ Class { #name : #PyramidThemeCommand, #superclass : #PyramidAbstractBlocCommand, - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #'as yet unclassified' } diff --git a/src/Pyramid-Toplo/PyramidThemeFromSpaceExtension.class.st b/src/Pyramid-Toplo/PyramidThemeFromSpaceExtension.class.st index a6aea11b..0be9f984 100644 --- a/src/Pyramid-Toplo/PyramidThemeFromSpaceExtension.class.st +++ b/src/Pyramid-Toplo/PyramidThemeFromSpaceExtension.class.st @@ -8,7 +8,7 @@ Class { 'themeSpaceSelector', 'spaceIsReady' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #asserting } diff --git a/src/Pyramid-Toplo/PyramidThemePresenter.class.st b/src/Pyramid-Toplo/PyramidThemePresenter.class.st index 0cf8089b..559161e1 100644 --- a/src/Pyramid-Toplo/PyramidThemePresenter.class.st +++ b/src/Pyramid-Toplo/PyramidThemePresenter.class.st @@ -2,11 +2,13 @@ Class { #name : #PyramidThemePresenter, #superclass : #SpPresenter, #instVars : [ + 'projectModel', 'styleSheetEditor', 'themeSpaceSelector', - 'themeElementSelector' + 'themeElementSelector', + 'treeTableStampPresenter' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #layout } @@ -15,8 +17,9 @@ PyramidThemePresenter >> defaultLayout [ ^ SpBoxLayout newVertical spacing: 4; add: self themeSpaceSelector expand: false; - add: self themeElementSelector expand: false; - add: self styleSheetEditor expand: true; + add: self themeElementSelector expand: false; + add: self treeTableStampPresenter; + "add: self styleSheetEditor expand: true;" yourself ] @@ -34,7 +37,21 @@ PyramidThemePresenter >> initializePresenters [ themeSpaceSelector := PyramidSpaceThemeSelectorPresenter new. themeElementSelector := PyramidElementThemeSelectorPresenter new. - styleSheetEditor := PyramidStyleSheetEditorPresenter new + styleSheetEditor := PyramidStyleSheetEditorPresenter new. + + treeTableStampPresenter := PyramidStampManagerPresenter new. +] + +{ #category : #accessing } +PyramidThemePresenter >> projectModel [ + + ^ projectModel +] + +{ #category : #accessing } +PyramidThemePresenter >> projectModel: aProjectModel [ + + projectModel := aProjectModel ] { #category : #'as yet unclassified' } @@ -60,3 +77,9 @@ PyramidThemePresenter >> themeSpaceSelector [ ^ themeSpaceSelector ] + +{ #category : #accessing } +PyramidThemePresenter >> treeTableStampPresenter [ + + ^ treeTableStampPresenter +] diff --git a/src/Pyramid-Toplo/PyramidThemePropertyStrategy.class.st b/src/Pyramid-Toplo/PyramidThemePropertyStrategy.class.st index 32bf4fbc..401a5929 100644 --- a/src/Pyramid-Toplo/PyramidThemePropertyStrategy.class.st +++ b/src/Pyramid-Toplo/PyramidThemePropertyStrategy.class.st @@ -1,7 +1,7 @@ Class { #name : #PyramidThemePropertyStrategy, #superclass : #PyramidHideEmptyPropertyStrategy, - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #'as yet unclassified' } @@ -12,6 +12,35 @@ PyramidThemePropertyStrategy >> buildPresenterFromCollection: aCollection andMan ^ super buildPresenterFromCollection: aCollection andManager: aManager ] +{ #category : #'as yet unclassified' } +PyramidThemePropertyStrategy >> newPropertiesFor: aCollectionOfElements [ + + | elementsWithStyleSheetTheme allPossibleStamps allCommonStamps | + elementsWithStyleSheetTheme := aCollectionOfElements + asOrderedCollection select: [ + :element | + element isAttachedToSceneGraph and: [ + element lookupTheme isKindOf: + ToStyleSheetTheme ] ]. + elementsWithStyleSheetTheme ifEmpty: [ ^ { } ]. + allPossibleStamps := elementsWithStyleSheetTheme collect: [ :each | + PyramidSelectorPossibleStamps new + theme: each lookupTheme; + findAllStampsFor: each ]. + allCommonStamps := allPossibleStamps first. + allPossibleStamps do: [ :each | + allCommonStamps := allCommonStamps & each ]. + ^ allCommonStamps collect: [ :each | self newPropertyForStamp: each ]. +] + +{ #category : #'as yet unclassified' } +PyramidThemePropertyStrategy >> newPropertyForStamp: aStamp [ + + | property | + property := PyramidProperty new name: aStamp; command: (PyramidStampCommand new stamp: aStamp; yourself). + ^ property +] + { #category : #'as yet unclassified' } PyramidThemePropertyStrategy >> propertiesFor: aCollectionOfElements [ @@ -20,12 +49,12 @@ PyramidThemePropertyStrategy >> propertiesFor: aCollectionOfElements [ asOrderedCollection select: [ :element | element isAttachedToSceneGraph and: [ - element toTheme isKindOf: + element lookupTheme isKindOf: ToStyleSheetTheme ] ]. elementsWithStyleSheetTheme ifEmpty: [ ^ { } ]. allPossibleStamps := elementsWithStyleSheetTheme collect: [ :each | PyramidSelectorPossibleStamps new - theme: each toTheme; + theme: each lookupTheme; findAllStampsFor: each ]. allCommonStamps := allPossibleStamps first. allPossibleStamps do: [ :each | diff --git a/src/Pyramid-Toplo/PyramidThemeSelectorPresenter.class.st b/src/Pyramid-Toplo/PyramidThemeSelectorPresenter.class.st index a270e734..dc730d88 100644 --- a/src/Pyramid-Toplo/PyramidThemeSelectorPresenter.class.st +++ b/src/Pyramid-Toplo/PyramidThemeSelectorPresenter.class.st @@ -6,7 +6,7 @@ Class { 'buttonRefreshTheme', 'triggerThemeChangement' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } { #category : #'as yet unclassified' } @@ -96,7 +96,8 @@ PyramidThemeSelectorPresenter >> labelPresenter [ PyramidThemeSelectorPresenter >> selectTheme: aToTheme [ self triggerThemeChangement: false. - self themeSelector selectItem: aToTheme. + self themeSelector items do: [:theme | (theme class) = (aToTheme class) ifTrue: [ self themeSelector selectItem: (theme) ]]. + "self themeSelector selectItem: aToTheme." self triggerThemeChangement: true. ] diff --git a/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st b/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st index 7a30f73e..a228259b 100644 --- a/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st +++ b/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st @@ -7,15 +7,9 @@ Class { 'themePresenter', 'themePropertyManager' ], - #category : #'Pyramid-Toplo-EXPERIMENTAL-plugin-theme-management' + #category : #'Pyramid-Toplo-plugin-theme-management' } -{ #category : #asserting } -PyramidToploThemePlugin class >> shouldInstall [ - - ^ false -] - { #category : #adding } PyramidToploThemePlugin class >> toploAntIconCategory [ @@ -128,14 +122,20 @@ PyramidToploThemePlugin >> addPanelsOn: aPyramidSimpleWindow [ makeTab: self themePresenter label: 'Toplo-Theme' icon: (Smalltalk ui icons iconNamed: #smallPushpin) - order: 1 ] + order: 6 ] ] { #category : #actions } PyramidToploThemePlugin >> configureBuilder: aPyramidEditorBuilder [ - | spacePlugin | - spacePlugin := aPyramidEditorBuilder findPlugin: #PyramidSpacePlugin. + | spacePlugin listOfPlugins pluginSorted | + + listOfPlugins := aPyramidEditorBuilder plugins. + pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidSpacePlugin ]. + pluginSorted size = 1 + ifFalse: [^ self]. + spacePlugin := pluginSorted asArray first. + self themePresenter pyramidSpaceBuilderConfigurationOn: spacePlugin builder ] @@ -143,7 +143,14 @@ PyramidToploThemePlugin >> configureBuilder: aPyramidEditorBuilder [ PyramidToploThemePlugin >> connectOn: aPyramidEditor [ self themePresenter editor: aPyramidEditor. - self themePropertyManager projectModel: aPyramidEditor projectModel + + self themePropertyManager projectModel: aPyramidEditor projectModel. + + self themePresenter projectModel: aPyramidEditor projectModel. + + self themePresenter treeTableStampPresenter projectModel: aPyramidEditor projectModel. + + self themePresenter treeTableStampPresenter styleSheetEditor: self themePresenter styleSheetEditor. ] { #category : #initialization } @@ -154,7 +161,9 @@ PyramidToploThemePlugin >> initialize [ presenterStrategy: PyramidThemePropertyStrategy new; yourself. - themePresenter styleSheetEditor stampPresenter: themePropertyManager mainPresenter + themePresenter styleSheetEditor stampPresenter: themePropertyManager mainPresenter. + + themePresenter treeTableStampPresenter pyramidPropertiesStrategy: PyramidThemePropertyStrategy new. ] { #category : #accessing } From 1abf83ce4ec0bc27528ce374d71177d414eb60cd Mon Sep 17 00:00:00 2001 From: SullyMLT Date: Wed, 13 Aug 2025 16:03:26 +0200 Subject: [PATCH 2/2] Remove comment and unused class --- ...amidElementThemeSelectorPresenter.class.st | 5 +-- .../PyramidStampManagerPresenter.class.st | 16 +------ .../PyramidStyleSheetEditorPresenter.class.st | 41 ------------------ .../PyramidThemePresenter.class.st | 2 - .../PyramidThemePropertyStrategy.class.st | 42 +------------------ .../PyramidThemeSelectorPresenter.class.st | 1 - .../PyramidToploThemePlugin.class.st | 1 - 7 files changed, 4 insertions(+), 104 deletions(-) delete mode 100644 src/Pyramid-Toplo/PyramidStyleSheetEditorPresenter.class.st diff --git a/src/Pyramid-Toplo/PyramidElementThemeSelectorPresenter.class.st b/src/Pyramid-Toplo/PyramidElementThemeSelectorPresenter.class.st index d1d8468e..b9ff7dfb 100644 --- a/src/Pyramid-Toplo/PyramidElementThemeSelectorPresenter.class.st +++ b/src/Pyramid-Toplo/PyramidElementThemeSelectorPresenter.class.st @@ -161,7 +161,6 @@ PyramidElementThemeSelectorPresenter >> updatePresenterFor: aCollectionOfElement collectionOfLocalThemes := (aCollectionOfElement asArray collect: [ :each | each localTheme ]) asSet asArray. collectionOfLocalThemes size > 1 ifTrue: [ - self inform: 'here'. self labelPresenter label: 'Elements Theme (differents)'. ^ self ]. @@ -172,7 +171,5 @@ PyramidElementThemeSelectorPresenter >> updatePresenterFor: aCollectionOfElement collectionOfLocalThemes first ifNotNil: [ self inheritSelector state: false. self themeSelector enabled: true. - self selectTheme: collectionOfLocalThemes first ]. - - "self layout: self defaultLayout" + self selectTheme: collectionOfLocalThemes first ] ] diff --git a/src/Pyramid-Toplo/PyramidStampManagerPresenter.class.st b/src/Pyramid-Toplo/PyramidStampManagerPresenter.class.st index 6a0c4b6b..28368742 100644 --- a/src/Pyramid-Toplo/PyramidStampManagerPresenter.class.st +++ b/src/Pyramid-Toplo/PyramidStampManagerPresenter.class.st @@ -23,7 +23,7 @@ PyramidStampManagerPresenter >> addRootsStampAddTreeTable: aElement [ | collectionOfStamps | - collectionOfStamps := pyramidPropertiesStrategy newPropertiesFor: aElement. + collectionOfStamps := pyramidPropertiesStrategy propertiesFor: aElement. ^ collectionOfStamps. ] @@ -46,14 +46,6 @@ PyramidStampManagerPresenter >> allStampFromElement: aElement [ treeTableStamp roots: { }. ^ self ]. - "classStampToRemove := (aElement class asString withoutPrefix: 'To') - asLowercase. - - stampsCollection do: [ :aPyramidProperty | - aPyramidProperty name = classStampToRemove asSymbol ifFalse: [ - collectionOfStamps add: aPyramidProperty ] ]." - - "treeTableStamp roots: collectionOfStamps asArray" treeTableStamp roots: stampsCollection asArray ] @@ -108,14 +100,10 @@ PyramidStampManagerPresenter >> defaultLayout [ { #category : #'as yet unclassified' } PyramidStampManagerPresenter >> elementsOrSelectionChanged: anEvent [ - anEvent selection isEmpty - ifTrue: [ treeTableStamp roots: { }. addStampButton disable. ^ self ]. - anEvent selection size > 1 + (anEvent selection isEmpty or:[ anEvent selection size > 1 ]) ifTrue: [ treeTableStamp roots: { }. addStampButton disable. ^ self ]. currentSelectedElement := anEvent selection first. - "currentSelectedElement allStamps inspect. - currentSelectedElement inspect." self allStampFromElement: currentSelectedElement. addStampButton enable. ] diff --git a/src/Pyramid-Toplo/PyramidStyleSheetEditorPresenter.class.st b/src/Pyramid-Toplo/PyramidStyleSheetEditorPresenter.class.st deleted file mode 100644 index 8a92a1e5..00000000 --- a/src/Pyramid-Toplo/PyramidStyleSheetEditorPresenter.class.st +++ /dev/null @@ -1,41 +0,0 @@ -Class { - #name : #PyramidStyleSheetEditorPresenter, - #superclass : #SpPresenter, - #instVars : [ - 'themeSelector', - 'styleSheetEditor', - 'stampPresenter' - ], - #category : #'Pyramid-Toplo-plugin-theme-management' -} - -{ #category : #accessing } -PyramidStyleSheetEditorPresenter >> defaultLayout [ - - ^ SpBoxLayout new - spacing: 4; - add: (SpLabelPresenter new - label: 'Stamps edition'; - displayBold: [ :t | true ]; - yourself) expand: false; - add: self stampPresenter expand: true; - yourself -] - -{ #category : #initialization } -PyramidStyleSheetEditorPresenter >> initializePresenters [ - - stampPresenter := SpNullPresenter new -] - -{ #category : #accessing } -PyramidStyleSheetEditorPresenter >> stampPresenter [ - - ^ stampPresenter -] - -{ #category : #accessing } -PyramidStyleSheetEditorPresenter >> stampPresenter: anObject [ - - stampPresenter := anObject -] diff --git a/src/Pyramid-Toplo/PyramidThemePresenter.class.st b/src/Pyramid-Toplo/PyramidThemePresenter.class.st index 559161e1..761f071f 100644 --- a/src/Pyramid-Toplo/PyramidThemePresenter.class.st +++ b/src/Pyramid-Toplo/PyramidThemePresenter.class.st @@ -19,7 +19,6 @@ PyramidThemePresenter >> defaultLayout [ add: self themeSpaceSelector expand: false; add: self themeElementSelector expand: false; add: self treeTableStampPresenter; - "add: self styleSheetEditor expand: true;" yourself ] @@ -37,7 +36,6 @@ PyramidThemePresenter >> initializePresenters [ themeSpaceSelector := PyramidSpaceThemeSelectorPresenter new. themeElementSelector := PyramidElementThemeSelectorPresenter new. - styleSheetEditor := PyramidStyleSheetEditorPresenter new. treeTableStampPresenter := PyramidStampManagerPresenter new. ] diff --git a/src/Pyramid-Toplo/PyramidThemePropertyStrategy.class.st b/src/Pyramid-Toplo/PyramidThemePropertyStrategy.class.st index 401a5929..2f853a2d 100644 --- a/src/Pyramid-Toplo/PyramidThemePropertyStrategy.class.st +++ b/src/Pyramid-Toplo/PyramidThemePropertyStrategy.class.st @@ -4,43 +4,6 @@ Class { #category : #'Pyramid-Toplo-plugin-theme-management' } -{ #category : #'as yet unclassified' } -PyramidThemePropertyStrategy >> buildPresenterFromCollection: aCollection andManager: aManager [ - - aManager removeAllProperties. - aManager addAllProperties: (self propertiesFor: aCollection). - ^ super buildPresenterFromCollection: aCollection andManager: aManager -] - -{ #category : #'as yet unclassified' } -PyramidThemePropertyStrategy >> newPropertiesFor: aCollectionOfElements [ - - | elementsWithStyleSheetTheme allPossibleStamps allCommonStamps | - elementsWithStyleSheetTheme := aCollectionOfElements - asOrderedCollection select: [ - :element | - element isAttachedToSceneGraph and: [ - element lookupTheme isKindOf: - ToStyleSheetTheme ] ]. - elementsWithStyleSheetTheme ifEmpty: [ ^ { } ]. - allPossibleStamps := elementsWithStyleSheetTheme collect: [ :each | - PyramidSelectorPossibleStamps new - theme: each lookupTheme; - findAllStampsFor: each ]. - allCommonStamps := allPossibleStamps first. - allPossibleStamps do: [ :each | - allCommonStamps := allCommonStamps & each ]. - ^ allCommonStamps collect: [ :each | self newPropertyForStamp: each ]. -] - -{ #category : #'as yet unclassified' } -PyramidThemePropertyStrategy >> newPropertyForStamp: aStamp [ - - | property | - property := PyramidProperty new name: aStamp; command: (PyramidStampCommand new stamp: aStamp; yourself). - ^ property -] - { #category : #'as yet unclassified' } PyramidThemePropertyStrategy >> propertiesFor: aCollectionOfElements [ @@ -66,9 +29,6 @@ PyramidThemePropertyStrategy >> propertiesFor: aCollectionOfElements [ PyramidThemePropertyStrategy >> propertyForStamp: aStamp [ | property | - property := PyramidProperty new name: aStamp; command: (PyramidStampCommand new stamp: aStamp; yourself); inputPresenterClass: PyramidSwitchInputPresenter ; yourself. - property inputPresenterModel onLabel: 'Has stamp'. - property inputPresenterModel offLabel: 'Has not stamp'. - property inputPresenterModel uncertainLabel: 'Uncertain'. + property := PyramidProperty new name: aStamp; command: (PyramidStampCommand new stamp: aStamp; yourself). ^ property ] diff --git a/src/Pyramid-Toplo/PyramidThemeSelectorPresenter.class.st b/src/Pyramid-Toplo/PyramidThemeSelectorPresenter.class.st index dc730d88..61c6a357 100644 --- a/src/Pyramid-Toplo/PyramidThemeSelectorPresenter.class.st +++ b/src/Pyramid-Toplo/PyramidThemeSelectorPresenter.class.st @@ -97,7 +97,6 @@ PyramidThemeSelectorPresenter >> selectTheme: aToTheme [ self triggerThemeChangement: false. self themeSelector items do: [:theme | (theme class) = (aToTheme class) ifTrue: [ self themeSelector selectItem: (theme) ]]. - "self themeSelector selectItem: aToTheme." self triggerThemeChangement: true. ] diff --git a/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st b/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st index a228259b..6744aa1a 100644 --- a/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st +++ b/src/Pyramid-Toplo/PyramidToploThemePlugin.class.st @@ -161,7 +161,6 @@ PyramidToploThemePlugin >> initialize [ presenterStrategy: PyramidThemePropertyStrategy new; yourself. - themePresenter styleSheetEditor stampPresenter: themePropertyManager mainPresenter. themePresenter treeTableStampPresenter pyramidPropertiesStrategy: PyramidThemePropertyStrategy new. ]