Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard removals of morphs in layouts #1467

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions src/Spec2-Adapters-Morphic/SpMorphicBoxAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ SpMorphicBoxAdapter >> add: aPresenter [
self add: aPresenter constraints: SpBoxConstraints new
]

{ #category : 'adding' }
SpMorphicBoxAdapter >> add: aPresenter constraints: constraints [

super add: aPresenter constraints: constraints
]

{ #category : 'private' }
SpMorphicBoxAdapter >> addConstraints: constraints toChild: childMorph [
"Adds constraits by child"
Expand Down Expand Up @@ -254,12 +248,12 @@ SpMorphicBoxAdapter >> newWrapMorph [
{ #category : 'accessing' }
SpMorphicBoxAdapter >> remove: aPresenter [

| morph |
morph := aPresenter adapter widget.
startPanel removeMorph: morph.
endPanel removeMorph: morph.
self verifyBoxExtent

aPresenter adapter ifNotNil: [ :adapter |
| morph |
morph := adapter widget.
startPanel removeMorph: morph.
endPanel removeMorph: morph.
self verifyBoxExtent ]
]

{ #category : 'accessing' }
Expand Down
14 changes: 3 additions & 11 deletions src/Spec2-Adapters-Morphic/SpMorphicFrameLayoutAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ SpMorphicFrameLayoutAdapter >> add: aPresenter [
self add: aPresenter constraints: SpBoxConstraints new
]

{ #category : 'adding' }
SpMorphicFrameLayoutAdapter >> add: aPresenter constraints: constraints [

super add: aPresenter constraints: constraints
]

{ #category : 'factory' }
SpMorphicFrameLayoutAdapter >> addConstraints: constraints toChild: childMorph [

Expand Down Expand Up @@ -161,11 +155,9 @@ SpMorphicFrameLayoutAdapter >> newPanelWith: aLayout label: aLabel [
{ #category : 'accessing' }
SpMorphicFrameLayoutAdapter >> remove: aPresenter [

| morph |
morph := aPresenter adapter widget.
framePanel removeMorph: morph.
self verifyBoxExtent

aPresenter adapter ifNotNil: [ :adapter |
framePanel removeMorph: adapter widget.
self verifyBoxExtent ]
]

{ #category : 'accessing' }
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Adapters-Morphic/SpMorphicGridAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,5 @@ SpMorphicGridAdapter >> newPanel [
{ #category : 'removing' }
SpMorphicGridAdapter >> remove: aPresenter [

| morph |
morph := aPresenter adapter widget.
widget removeMorph: morph
aPresenter adapter ifNotNil: [ :adapter | widget removeMorph: adapter widget ]
]
7 changes: 3 additions & 4 deletions src/Spec2-Adapters-Morphic/SpMorphicMillerAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,9 @@ SpMorphicMillerAdapter >> recalculatePages [
{ #category : 'accessing' }
SpMorphicMillerAdapter >> remove: aPresenter [

| morph |
needRecalculatePages := true.
morph := aPresenter adapter widget.
innerWidget removeMorph: morph
aPresenter adapter ifNotNil: [ :adapter |
needRecalculatePages := true.
innerWidget removeMorph: adapter widget ]
]

{ #category : 'accessing' }
Expand Down
6 changes: 4 additions & 2 deletions src/Spec2-Adapters-Morphic/SpMorphicTabAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ SpMorphicTabAdapter >> layout: aLayout [
{ #category : 'removing' }
SpMorphicTabAdapter >> remove: aPresenter [

widget removePage: (widget pages
detect: [ :each | each actualPageMorph = aPresenter adapter widget ])
aPresenter adapter ifNotNil: [ :adapter |
| morph |
morph := adapter widget.
widget removePage: (widget pages detect: [ :each | each actualPageMorph = morph ]) ]
]
Loading