Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 3, 2024
1 parent 3155d0b commit d81f0de
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 24 deletions.
8 changes: 4 additions & 4 deletions repository/OpenPonk-Core/OPDiagramController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -868,15 +868,15 @@ OPDiagramController >> visibleElements: aCollection [
]

{ #category : 'accessing' }
OPDiagramController >> when: anEvent do: aBlock [
OPDiagramController >> when: anEvent do: aBlock for: aSubscriber [

^ self announcer when: anEvent do: aBlock for: aBlock receiver
^ self announcer when: anEvent do: aBlock for: aSubscriber
]

{ #category : 'protocol-events' }
OPDiagramController >> whenAllDeselectedDo: aBlock [
OPDiagramController >> whenAllDeselectedDo: aBlock for: aSubscriber [

self when: OPAllFiguresDeselected do: aBlock
self when: OPAllFiguresDeselected do: aBlock for: aSubscriber
]

{ #category : 'protocol-events' }
Expand Down
5 changes: 3 additions & 2 deletions repository/OpenPonk-Core/OPTestContainerModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ OPTestContainerModel >> uuid: anObject [
]

{ #category : 'accessing' }
OPTestContainerModel >> when: anAnnouncement do: aBlock [
^ self announcer when: anAnnouncement do: aBlock
OPTestContainerModel >> when: anAnnouncement do: aBlock for: aSubscriber [

^ self announcer when: anAnnouncement do: aBlock for: aSubscriber
]
5 changes: 4 additions & 1 deletion repository/OpenPonk-Roassal/OPRSAnchorConstraint.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ OPRSAnchorConstraint >> build [
^ shape isInACanvas
ifTrue: [ self addAnchorAndGuideLine ]
ifFalse: [
shape when: RSShapeAddedEvent do: [ self addAnchorAndGuideLine ] ] ]
shape
when: RSShapeAddedEvent
do: [ self addAnchorAndGuideLine ]
for: self ] ]
ifFalse: [
shape
when: RSMouseLeftDragStart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,3 @@ OPRSDraggableControlPoints >> showMidpointHandles [
midpointHandles last beNearEnd.
midpointHandles do: #render
]

{ #category : 'initialization' }
OPRSDraggableControlPoints >> showOnShape: aLine [

line := aLine.
line when: RSMouseLeftClick do: [ self showHandles ].
line when: RSShapeRemovedEvent do: [ self removeHandles ].
self connectWithCanvas
]
5 changes: 4 additions & 1 deletion repository/OpenPonk-Roassal/OPRSResizable.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ OPRSResizable >> onShape: aShape [
shape isInACanvas
ifTrue: [ self connectWithCanvas ]
ifFalse: [
shape when: RSShapeAddedEvent do: [ self connectWithCanvas ] ].
shape
when: RSShapeAddedEvent
do: [ self connectWithCanvas ]
for: self ].
shape
when: RSMouseDragStart send: #disableHandles: to: self;
when: RSMouseDragEnd send: #enableHandles: to: self;
Expand Down
1 change: 1 addition & 0 deletions repository/OpenPonk-Roassal/OPRSResize.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ OPRSResize >> stickSameSize [
self fixedShape
when: RSExtentChangedEvent
do: [ :event | block value ]
for: self
]
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ OPRSSelectionDraggableBorder >> createDragBoxes [
renderDragBoxes := [ shape canvas addAll: dragBoxes ].
shape isInACanvas
ifTrue: renderDragBoxes
ifFalse: [ shape when: RSShapeAddedEvent do: renderDragBoxes ].
ifFalse: [
shape when: RSShapeAddedEvent do: renderDragBoxes for: self ].
shape
when: RSShapeRemovedEvent
do: [ dragBoxes do: #remove ]
Expand Down
13 changes: 8 additions & 5 deletions repository/OpenPonk-Spec/OPModelTreeWidget.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,14 @@ OPModelTreeWidget >> openCommand: aDiagram [
{ #category : 'accessing' }
OPModelTreeWidget >> openOn: aProject [

self workbench announcer when: OPEditorFocused do: [ :event |
project ifNotNil: [ project unsubscribe: self ].
project := event diagramController model.
project ifNotNil: [ project whenChanged: [ self refresh ] ].
self refresh ].
self workbench
when: OPEditorFocused
do: [ :event |
project ifNotNil: [ project unsubscribe: self ].
project := event diagramController model.
project ifNotNil: [ project whenChanged: [ self refresh ] ].
self refresh ]
for: self.
tree expandRoots
]

Expand Down
2 changes: 1 addition & 1 deletion repository/OpenPonk-Spec/OPPalette.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ OPPalette >> createPaletteFor: aDiagramController [
addAllToPalette: self
forController: diagramController.
self selectSelectionTool.
diagramController whenAllDeselectedDo: [ self selectSelectionTool ]
diagramController whenAllDeselectedDo: [ self selectSelectionTool ] for: self
]

{ #category : 'building widgets' }
Expand Down
6 changes: 6 additions & 0 deletions repository/OpenPonk-Spec/OPWorkbench.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@ OPWorkbench >> updateTitle [
^ self withWindowDo: [ :window | window title: self title ]
]

{ #category : 'protocol' }
OPWorkbench >> when: anEvent do: aBlock for: aSubscriber [

^ self announcer when: anEvent do: aBlock for: aSubscriber
]

{ #category : 'accessing - spec' }
OPWorkbench >> workbench [
^ self
Expand Down

0 comments on commit d81f0de

Please sign in to comment.