Skip to content

Commit

Permalink
Merge pull request #1457 from MarcusDenker/use-optimixed-ifNil
Browse files Browse the repository at this point in the history
 use optimzied ifNil
  • Loading branch information
jecisc authored Sep 20, 2023
2 parents 96be3d9 + 68b11b9 commit e8de07a
Show file tree
Hide file tree
Showing 210 changed files with 2,766 additions and 2,433 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #FTAbstractSortingState }
Extension { #name : 'FTAbstractSortingState' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
FTAbstractSortingState >> isSorted [
^ true
]
4 changes: 2 additions & 2 deletions src/Spec2-Adapters-Morphic/FTBasicItem.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #FTBasicItem }
Extension { #name : 'FTBasicItem' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
FTBasicItem >> hasComputedChildren [
"I return true if I have computed children or if I don't have computed children."

Expand Down
4 changes: 2 additions & 2 deletions src/Spec2-Adapters-Morphic/FTStaticBasicItem.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #FTStaticBasicItem }
Extension { #name : 'FTStaticBasicItem' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
FTStaticBasicItem >> hasComputedChildren [
^ self hasChildren
]
6 changes: 3 additions & 3 deletions src/Spec2-Adapters-Morphic/FTTableMorph.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #FTTableMorph }
Extension { #name : 'FTTableMorph' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
FTTableMorph >> clickOnColumnHeaderAt: anIndex [
| header |
header := self container headerRow submorphs at: anIndex.
Expand All @@ -10,7 +10,7 @@ FTTableMorph >> clickOnColumnHeaderAt: anIndex [

]

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
FTTableMorph >> hasFilter [

function ifNil: [ ^ false ].
Expand Down
4 changes: 2 additions & 2 deletions src/Spec2-Adapters-Morphic/FTTreeItem.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #FTTreeItem }
Extension { #name : 'FTTreeItem' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
FTTreeItem >> hasComputedChildren [
"I return true if I have computed children or if I don't have computed children."

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #FTUnsortedSortingState }
Extension { #name : 'FTUnsortedSortingState' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
FTUnsortedSortingState >> isSorted [
^ false
]
18 changes: 10 additions & 8 deletions src/Spec2-Adapters-Morphic/ManifestSpec2AdaptersMorphic.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,34 @@ Spec is a framework in Pharo for describing user interfaces. It allows for the c
I am implementing the spec layer between presenters and the morphic widgets. I will be used when the morphic backend of Spec is selected to build the Morphic widgets during the GUI creation.
"
Class {
#name : #ManifestSpec2AdaptersMorphic,
#superclass : #PackageManifest,
#category : #'Spec2-Adapters-Morphic-Manifest'
#name : 'ManifestSpec2AdaptersMorphic',
#superclass : 'PackageManifest',
#category : 'Spec2-Adapters-Morphic-Manifest',
#package : 'Spec2-Adapters-Morphic',
#tag : 'Manifest'
}

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestSpec2AdaptersMorphic class >> ruleCollectionMessagesToExternalObjectRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#SpMorphicButtonBarAdapter #addModelTo: #false)) #'2020-11-13T23:10:31.921402+01:00') )
]

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestSpec2AdaptersMorphic class >> ruleCollectionProtocolRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#SpMorphicDialogWindowAdapter #buildButtonBar #false)) #'2020-11-13T22:08:25.752583+01:00') #(#(#RGMethodDefinition #(#SpMorphicButtonBarAdapter #addModelTo: #false)) #'2020-11-13T23:10:24.35015+01:00') )
]

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestSpec2AdaptersMorphic class >> ruleGTExampleNotDefinedRuleV1FalsePositive [
^ #(#(#(#RGClassDefinition #(#SpAbstractMorphicAdapter)) #'2016-07-01T15:56:13.367433+02:00') )
]

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestSpec2AdaptersMorphic class >> ruleRBOverridesDeprecatedMethodRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#SpMorphicMenuItemAdapter #name #false)) #'2016-07-01T15:56:13.381999+02:00') )
]

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestSpec2AdaptersMorphic class >> ruleUtilityMethodsRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#SpMorphicTextAdapter #setWrapWord:to: #false)) #'2020-11-13T22:40:20.610215+01:00') )
]
30 changes: 16 additions & 14 deletions src/Spec2-Adapters-Morphic/MillerScrollPaneMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,64 @@
A scroll pane to show a miller column list.
"
Class {
#name : #MillerScrollPaneMorph,
#superclass : #GeneralScrollPaneMorph,
#name : 'MillerScrollPaneMorph',
#superclass : 'GeneralScrollPaneMorph',
#instVars : [
'layoutChangeAction',
'updating',
'firstShowingMorph',
'keepShowingPage'
],
#category : #'Spec2-Adapters-Morphic-Layout'
#category : 'Spec2-Adapters-Morphic-Layout',
#package : 'Spec2-Adapters-Morphic',
#tag : 'Layout'
}

{ #category : #private }
{ #category : 'private' }
MillerScrollPaneMorph >> basicShowMorph: aMorph [

scroller offset: aMorph topLeft
]

{ #category : #scrollbars }
{ #category : 'scrollbars' }
MillerScrollPaneMorph >> hScrollbarShowNever [

super hScrollbarShowNever.
"Since I am showing a scroll bar, I do not need to keep the page."
self keepShowingPage: true
]

{ #category : #scrollbars }
{ #category : 'scrollbars' }
MillerScrollPaneMorph >> hScrollbarShowWhenNeeded [

super hScrollbarShowWhenNeeded.
"Since I am showing a scroll bar, I do not need to keep the page."
self keepShowingPage: false
]

{ #category : #initialization }
{ #category : 'initialization' }
MillerScrollPaneMorph >> initialize [

super initialize.
updating := false.
keepShowingPage := false
]

{ #category : #testing }
{ #category : 'testing' }
MillerScrollPaneMorph >> isUpdating [

^ updating ifNil: [ updating := false ]
]

{ #category : #private }
{ #category : 'private' }
MillerScrollPaneMorph >> keepShowingPage: aBoolean [

keepShowingPage := aBoolean.
keepShowingPage ifFalse: [
firstShowingMorph := nil ]
]

{ #category : #events }
{ #category : 'events' }
MillerScrollPaneMorph >> layoutChanged [

self isUpdating ifTrue: [ ^ self ].
Expand All @@ -68,29 +70,29 @@ MillerScrollPaneMorph >> layoutChanged [
updating := false ]
]

{ #category : #events }
{ #category : 'events' }
MillerScrollPaneMorph >> onLayoutChange: aBlock [

layoutChangeAction := aBlock
]

{ #category : #accessing }
{ #category : 'accessing' }
MillerScrollPaneMorph >> showMorph: aMorph [

keepShowingPage
ifTrue: [ firstShowingMorph := aMorph ].
self basicShowMorph: aMorph
]

{ #category : #updating }
{ #category : 'updating' }
MillerScrollPaneMorph >> updateScrollbars [

super updateScrollbars.
firstShowingMorph ifNotNil: [
scroller offset: firstShowingMorph topLeft ]
]

{ #category : #scrollbars }
{ #category : 'scrollbars' }
MillerScrollPaneMorph >> vScrollbarNeeded [
"Return whether the vertical scrollbar is needed."

Expand Down
8 changes: 4 additions & 4 deletions src/Spec2-Adapters-Morphic/Morph.extension.st
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Extension { #name : #Morph }
Extension { #name : 'Morph' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
Morph >> presenter [

^ self valueOfProperty: #presenter ifAbsent: [ nil ]
]

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
Morph >> presenter: aPresenter [

self
setProperty: #presenter
toValue: aPresenter
]

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
Morph >> spEnsureLayoutAndAddMorph: aMorph [

aMorph layoutFrame
Expand Down
10 changes: 6 additions & 4 deletions src/Spec2-Adapters-Morphic/MorphicAPartTreeTableAdapter.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #MorphicAPartTreeTableAdapter,
#superclass : #SpMorphicTreeTableAdapter,
#category : #'Spec2-Adapters-Morphic-Table'
#name : 'MorphicAPartTreeTableAdapter',
#superclass : 'SpMorphicTreeTableAdapter',
#category : 'Spec2-Adapters-Morphic-Table',
#package : 'Spec2-Adapters-Morphic',
#tag : 'Table'
}

{ #category : #accessing }
{ #category : 'accessing' }
MorphicAPartTreeTableAdapter class >> adaptingName [

^ #APartTreeTableAdapter
Expand Down
4 changes: 2 additions & 2 deletions src/Spec2-Adapters-Morphic/Object.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #Object }
Extension { #name : 'Object' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
Object >> asStyleVariable [

^ SpStyleVariable newValue: self
Expand Down
6 changes: 3 additions & 3 deletions src/Spec2-Adapters-Morphic/PharoDarkTheme.extension.st
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Extension { #name : #PharoDarkTheme }
Extension { #name : 'PharoDarkTheme' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
PharoDarkTheme >> paginatorSelectionColor [

^ self lightBaseColor alpha: 0.8
]

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
PharoDarkTheme >> popoverButtonColor [

^ self lightBaseColor
Expand Down
4 changes: 2 additions & 2 deletions src/Spec2-Adapters-Morphic/RubEditingState.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #RubEditingState }
Extension { #name : 'RubEditingState' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
RubEditingState >> undoManager: aHistoryIterator [

undoManager := aHistoryIterator
Expand Down
6 changes: 3 additions & 3 deletions src/Spec2-Adapters-Morphic/RubScrolledTextMorph.extension.st
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Extension { #name : #RubScrolledTextMorph }
Extension { #name : 'RubScrolledTextMorph' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
RubScrolledTextMorph >> registerScrollChanges: aSelector [
self scrollPane announcer when: PaneScrolling send: aSelector to: self model
]

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
RubScrolledTextMorph >> setSelectionSelector: aSelector [
setSelectionSelector := aSelector
]
6 changes: 3 additions & 3 deletions src/Spec2-Adapters-Morphic/RubTextEditor.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #RubTextEditor }
Extension { #name : 'RubTextEditor' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
RubTextEditor >> lineAtCursorPosition [
| string |

Expand All @@ -10,7 +10,7 @@ RubTextEditor >> lineAtCursorPosition [
ifNil: [ '' ]
]

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
RubTextEditor >> lineIntervalAtCursorPosition [
| string lastEnd index lastStart |

Expand Down
4 changes: 2 additions & 2 deletions src/Spec2-Adapters-Morphic/SpAbstractAdapter.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #SpAbstractAdapter }
Extension { #name : 'SpAbstractAdapter' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
SpAbstractAdapter >> isMorphicAdapter [

^ false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #SpAbstractListPresenter }
Extension { #name : 'SpAbstractListPresenter' }

{ #category : #'*Spec2-Adapters-Morphic' }
{ #category : '*Spec2-Adapters-Morphic' }
SpAbstractListPresenter >> iconFor: anItem [
"This is needed for the Morphic backend because all of them share the same datasource asking for this method. For lists without icons it will return nil."

Expand Down
Loading

0 comments on commit e8de07a

Please sign in to comment.