Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3456213
feat: adding larger extent to browser
nicolasp025 Apr 8, 2026
b714aa0
refactor: record colors
nicolasp025 Apr 8, 2026
1b4cc12
feat: displaying color referential
nicolasp025 Apr 8, 2026
ea3cb75
feat: resizable color referential
nicolasp025 Apr 9, 2026
9f4772a
test: adding test for getWindowColorFrom
nicolasp025 Apr 9, 2026
14b4dba
fix: refactoring colors in accessors
nicolasp025 Apr 9, 2026
55b456d
fix: prevent timerWindow open from generating an event
nicolasp025 Apr 9, 2026
f2a044c
fix: doc mistake
nicolasp025 Apr 9, 2026
440c396
feat: adding larger extent to browser
nicolasp025 Apr 8, 2026
1b0cf04
refactor: record colors
nicolasp025 Apr 8, 2026
15bf441
feat: displaying color referential
nicolasp025 Apr 8, 2026
4a46464
feat: resizable color referential
nicolasp025 Apr 9, 2026
fe0b442
test: adding test for getWindowColorFrom
nicolasp025 Apr 9, 2026
e1c2a96
fix: refactoring colors in accessors
nicolasp025 Apr 9, 2026
27bae49
fix: prevent timerWindow open from generating an event
nicolasp025 Apr 9, 2026
34fa194
fix: doc mistake
nicolasp025 Apr 9, 2026
8edd2a1
Merge 34fa194d8b8de112ea50f8f97f63fb666c61a359
nicolasp025 Apr 9, 2026
a138446
refactor: toolInfo and colors refactoring
nicolasp025 Apr 9, 2026
4745cfb
refactor: colors and window types by dispatch
nicolasp025 Apr 9, 2026
0a46141
feat: window color indicator on timer window + adding some tests
nicolasp025 Apr 10, 2026
05898e0
feat: adding larger extent to browser
nicolasp025 Apr 8, 2026
1237db2
refactor: record colors
nicolasp025 Apr 8, 2026
01189e0
feat: displaying color referential
nicolasp025 Apr 8, 2026
21ddf1d
feat: resizable color referential
nicolasp025 Apr 9, 2026
0facad2
test: adding test for getWindowColorFrom
nicolasp025 Apr 9, 2026
fa5972f
fix: refactoring colors in accessors
nicolasp025 Apr 9, 2026
604210f
fix: prevent timerWindow open from generating an event
nicolasp025 Apr 9, 2026
cf355d1
fix: doc mistake
nicolasp025 Apr 9, 2026
90172c4
feat: displaying color referential
nicolasp025 Apr 8, 2026
a63f01d
feat: resizable color referential
nicolasp025 Apr 9, 2026
d19e501
refactor: toolInfo and colors refactoring
nicolasp025 Apr 9, 2026
448e5c3
refactor: colors and window types by dispatch
nicolasp025 Apr 9, 2026
c98a4d7
feat: window color indicator on timer window + adding some tests
nicolasp025 Apr 10, 2026
6c10de3
fix: better colors
nicolasp025 Apr 10, 2026
1854b2d
Merge c98a4d7b03011febc5b9400da9abd11dff2ea613
nicolasp025 Apr 10, 2026
aabfffd
fix: PR changes
nicolasp025 Apr 10, 2026
f2f9fb5
refactor: getWindowType
nicolasp025 Apr 10, 2026
07ca49c
refactor: removing DSWindowRecord type and using its toolInfo instead
nicolasp025 Apr 13, 2026
82befb0
refactor: windowColor for DSWindowRecord & DSToolInfo
nicolasp025 Apr 13, 2026
111a2c4
test: DSTimerWindow >> #testBuildLayout
nicolasp025 Apr 13, 2026
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
4 changes: 2 additions & 2 deletions DebuggingSpy-Anonymizer-Tests/DSAnonymizeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ DSAnonymizeTest >> testMouseEventRecord [
| record anonymousRecord |
record := DSMouseEventRecord new
windowId: 1;
toolInfo: (DSToolInfo toolNamed: #StPlayground id: 0 windowId: 1);
toolInfo: (DSToolInfo toolClass: StPlayground id: 0 windowId: 1);
yourself.
anonymousRecord := record anonymize.

Expand Down Expand Up @@ -191,7 +191,7 @@ DSAnonymizeTest >> testWindowEventRecord [

record := DSWindowEventRecord new
windowName: 'aWindow';
toolInfo: (DSToolInfo toolNamed: #StPlayground id: 0 windowId: 1);
toolInfo: (DSToolInfo toolClass: StPlayground id: 0 windowId: 1);
yourself.

anonymousRecord := record anonymize.
Expand Down
15 changes: 6 additions & 9 deletions DebuggingSpy-Anonymizer-Tests/DSToolInfoTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,22 @@ Class {
DSToolInfoTest >> testAnonymizeWithCorrectTool [

| tool |
tool := DSToolInfo toolNamed: #StPlayground id: 0 windowId: 1.
tool := DSToolInfo toolClass: StPlayground id: 0 windowId: 1.
tool := tool anonymize.
self assert: tool toolClassName equals: #StPlayground.

self assert: tool toolClass equals: StPlayground.
self assert: tool toolIdentityHash equals: 0.
self assert: tool windowIdentityHash equals: 1.


self assert: tool windowIdentityHash equals: 1
]

{ #category : 'tests' }
DSToolInfoTest >> testAnonymizeWithIncorrectTool [

| tool |

tool := DSToolInfo toolNamed: #DSRecordDataFilter id: 0 windowId: 1.
tool := DSToolInfo toolClass: DSRecordDataFilter id: 0 windowId: 1.
tool := tool anonymize.

self assert: tool toolClassName equals: #DSRecordDataFilter identityHash.
self assert: tool toolClass equals: DSRecordDataFilter identityHash.
self assert: tool toolIdentityHash equals: 0.
self assert: tool windowIdentityHash equals: 1
]
6 changes: 3 additions & 3 deletions DebuggingSpy-Anonymizer/DSRecordDataFilter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ DSRecordDataFilter >> applyOn: aRecord [
"Applies the filter on the specified record and returns the resulting filtered record"

| newRecord |
newRecord := aRecord deepCopy.
newRecord := aRecord class new.

newRecord class allSlots do: [ :slot |
aRecord class allSlots do: [ :slot |
operations
at: slot name asSymbol
ifPresent: [ :block | slot write: (block value: (newRecord readSlotNamed: slot name)) to: newRecord ]
ifPresent: [ :block | slot write: (block value: (aRecord readSlotNamed: slot name)) to: newRecord ]
ifAbsent: [ slot write: nil to: newRecord ] ].

^ newRecord
Expand Down
8 changes: 4 additions & 4 deletions DebuggingSpy-Anonymizer/DSToolInfo.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ DSToolInfo class >> anonymousFilter [
^ DSRecordDataFilter new
with: #toolIdentityHash;
with: #windowIdentityHash;
transform: #toolClassName with: [ :tool |
(SystemBuildInfo current systemPackages includes: (self class environment at: tool) package)
ifTrue: [ tool ]
ifFalse: [ tool identityHash ] ];
transform: #toolClass with: [ :toolClass |
(SystemBuildInfo current systemPackages includes: toolClass package)
ifTrue: [ toolClass ]
ifFalse: [ toolClass identityHash ] ];
yourself
]
31 changes: 29 additions & 2 deletions DebuggingSpy-Browser-Tests/DSRecordBrowserPresenterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ DSRecordBrowserPresenterTest >> testClosingBrowser [
self deny: DSRecordBrowserPresenter uniqueInstance window isOpen
]

{ #category : 'tests' }
DSRecordBrowserPresenterTest >> testColorAssociations [

| associations |
associations := {
((Color fromHexString: '#1f48ff') -> 'Browser').
((Color fromHexString: '#ff0fef') -> 'Debug point browser').
((Color fromHexString: '#345e54') -> 'Epicea').
((Color fromHexString: '#00e5ff') -> 'Iceberg').
((Color fromHexString: '#ff8f1f') -> 'Critique browser').
((Color fromHexString: '#ff2200') -> 'Debugger').
((Color fromHexString: '#fad314') -> 'Inspector').
((Color fromHexString: '#70B77E') -> 'Playground').
((Color fromHexString: '#292929') -> 'Rewriter') }.

self assert: (associations allSatisfy: [ :asso | DSRecordBrowserPresenter colorAssociations includes: asso ])
]

{ #category : 'tests' }
DSRecordBrowserPresenterTest >> testCreatingAndOpeningBrowser [

Expand Down Expand Up @@ -197,8 +215,8 @@ DSRecordBrowserPresenterTest >> testGetRecordColorAssociationsFrom [

| windows colorAssociations |
windows := { (DSWindowRecord new
toolInfos: (DSToolInfo new
toolClassName: 'StPlaygroundPresenter';
toolInfo: (DSToolInfo new
toolClass: StPlaygroundPresenter;
yourself);
events: {
DSWindowOpenedRecord new.
Expand Down Expand Up @@ -312,6 +330,15 @@ DSRecordBrowserPresenterTest >> testUpdateRecordsTableWhenAddingFile [
self assert: self recordsTablePresenter roots last key class equals: DSInspectItRecord
]

{ #category : 'tests' }
DSRecordBrowserPresenterTest >> testWindowColorFrom [

| record |
record := DSWindowRecord new toolInfo: (DSToolInfo new toolClass: StDebugger).
self assert: (DSRecordBrowserPresenter windowColorFrom: record) equals: (Color fromHexString: '#ff2200').
self assert: (DSRecordBrowserPresenter windowColorFrom: nil) equals: (Color fromHexString: '#b3b3b3')
]

{ #category : 'helpers' }
DSRecordBrowserPresenterTest >> timelinePresenter [

Expand Down
44 changes: 42 additions & 2 deletions DebuggingSpy-Browser-Tests/DSTimerWindowTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ DSTimerWindowTest >> setUp [
timerWindow := DSTimerWindow new.
]

{ #category : 'tests' }
DSTimerWindowTest >> testBuildLayout [
"buildLayout has been already called from initialize"

| submorphs |
submorphs := timerWindow submorphs.

self assert: ({ 'timerMorph'. 'currentTimeMorph'. 'lastEventMorph'. 'windowColorIndicator' } allSatisfy: [ :slotName |
(timerWindow readSlotNamed: slotName) isNotNil ]).

self assert: submorphs size equals: 6.
self assert: (submorphs last class = StringMorph and: submorphs last contents = ' ').
self assert: ((submorphs at: 5) class = StringMorph and: (submorphs at: 5) contents = 'No last record').
self assert: ((submorphs at: 4) class = ImageMorph and: (submorphs at: 4) form = (self iconNamed: #glamorousRedCircle)).
self assert: ((submorphs at: 3) class = StringMorph and: (submorphs at: 3) contents = '00:00:00').
self assert: (submorphs second class = StringMorph and: submorphs second contents = Time current print24).
self assert: (submorphs first class = PluggableButtonMorph and: submorphs first label class = IconicListItemMorph)
]

{ #category : 'tests' }
DSTimerWindowTest >> testCurrentTimeMorph [

Expand Down Expand Up @@ -50,7 +69,7 @@ DSTimerWindowTest >> testEmptyTimerMorph [
DSTimerWindowTest >> testGetFormattedNameFrom [

| toolInfo |
toolInfo := DSToolInfo new toolClassName: 'DSTimerWindowTest'.
toolInfo := DSToolInfo new toolClass: self class.

self assert: (timerWindow getFormattedNameFrom: DSBrowseRecord new) equals: 'Browse'.
self
Expand All @@ -59,13 +78,26 @@ DSTimerWindowTest >> testGetFormattedNameFrom [
self assert: (timerWindow getFormattedNameFrom: DSBrowseRecord new) equals: 'Browse (DSTimerWindowTest)'
]

{ #category : 'tests' }
DSTimerWindowTest >> testGetRecordColorFrom [

| toolInfo |
toolInfo := DSToolInfo new toolClass: StPlayground.

self assert: (timerWindow getRecordColorFrom: DSAbstractEventRecord new) equals: (Color fromHexString: '#b3b3b3').

self
assert: (timerWindow getRecordColorFrom: (DSMouseEventRecord new toolInfo: toolInfo))
equals: (Color fromHexString: '#70B77E')
]

{ #category : 'tests' }
DSTimerWindowTest >> testGetToolInfoFor [

| toolInfo record |
self assert: (timerWindow getToolInfoFor: DSAbstractEventRecord new) isNil.

toolInfo := DSToolInfo new toolClassName: 'DSTimerWindowTest'.
toolInfo := DSToolInfo new toolClass: self class.
record := DSMouseEnterWindowRecord new
toolInfo: toolInfo;
yourself.
Expand Down Expand Up @@ -104,6 +136,14 @@ DSTimerWindowTest >> testStartTimer [
DSSpy recordingSession: false
]

{ #category : 'tests' }
DSTimerWindowTest >> testWindowColorIndicator [

timerWindow writeSlotNamed: 'windowColorIndicator' value: nil.
self assert: timerWindow windowColorIndicator isNotNil.
self assert: (timerWindow readSlotNamed: 'windowColorIndicator') isNotNil
]

{ #category : 'layout' }
DSTimerWindowTest >> timerMorph [
"Returns the window's timerMorph."
Expand Down
14 changes: 14 additions & 0 deletions DebuggingSpy-Browser/ClyFullBrowserMorph.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Extension { #name : 'ClyFullBrowserMorph' }

{ #category : '*DebuggingSpy-Browser' }
ClyFullBrowserMorph class >> windowColor [

<DSWindowColor>
^ Color fromHexString: '#1f48ff'
]

{ #category : '*DebuggingSpy-Browser' }
ClyFullBrowserMorph class >> windowType [

^ 'Browser'
]
95 changes: 67 additions & 28 deletions DebuggingSpy-Browser/DSRecordBrowserPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,30 @@ Class {
#package : 'DebuggingSpy-Browser'
}

{ #category : 'accessing' }
DSRecordBrowserPresenter class >> colorAssociations [
"Return all associations between the color and the corresponding window type."

| method methodClass |
^ (Pragma allNamed: #DSWindowColor) collect: [ :pragma |
method := pragma method.
methodClass := method methodClass.
(method valueWithReceiver: methodClass) -> (methodClass >> #windowType valueWithReceiver: methodClass) ]
]

{ #category : 'accessing' }
DSRecordBrowserPresenter class >> defaultExtent [

^ 1000 @ 600
]

{ #category : 'accessing' }
DSRecordBrowserPresenter class >> defaultWindowColor [
"Returns the default color for windows."

^ Color fromHexString: '#b3b3b3'
]

{ #category : 'world menu' }
DSRecordBrowserPresenter class >> menuCommandOn: aBuilder [
"Adds the DSSpy button on topside bar."
Expand Down Expand Up @@ -63,6 +87,14 @@ DSRecordBrowserPresenter class >> uniqueInstance [
^ uniqueInstance ifNil: [ uniqueInstance := self new ]
]

{ #category : 'accessing' }
DSRecordBrowserPresenter class >> windowColorFrom: anObject [
"If the specified object is nil, returns the default windowColor, else return its window color."

anObject ifNil: [ ^ self defaultWindowColor ].
^ anObject windowColor
]

{ #category : 'files' }
DSRecordBrowserPresenter >> addFile: aFileReference [
"Adds a file in the presenter and set is as selected, which updates the records displayed."
Expand All @@ -87,6 +119,26 @@ DSRecordBrowserPresenter >> addRecordButton [
yourself
]

{ #category : 'layout' }
DSRecordBrowserPresenter >> colorReferential [
"Instanciates a new table that displays the color referential."

^ self newTreeTable
addColumn: (SpStringTableColumn new
title: 'Color';
evaluated: [ ];
displayBackgroundColor: [ :association | association key ];
yourself);
addColumn: (SpStringTableColumn new
title: 'Window type';
evaluated: [ :association | association value ];
displayColor: [ :aRecord | Color white ];
yourself);
roots: self class colorAssociations;
beResizable;
yourself
]

{ #category : 'initialization' }
DSRecordBrowserPresenter >> connectPresenters [
"Updates the records and the timeline whenever the selected file is changed."
Expand All @@ -105,7 +157,11 @@ DSRecordBrowserPresenter >> defaultLayout [
add: toolbarPresenter expand: false;
add: (SpPanedLayout newHorizontal
positionOfSlider: 30 percent;
add: fileListPresenter;
add: (SpPanedLayout newTopToBottom
add: fileListPresenter;
add: self colorReferential;
positionOfSlider: 57 percent;
yourself);
add: (SpBoxLayout newTopToBottom
add: (SpTabLayout new
add: recordsTablePresenter label: 'Records';
Expand Down Expand Up @@ -159,7 +215,8 @@ DSRecordBrowserPresenter >> getRecordColorAssociationsFrom: aWindowRecordCollect
recordColorsAssociations := OrderedCollection new.

aWindowRecordCollection do: [ :windowRecord |
recordColorsAssociations addAll: (windowRecord events collect: [ :record | record -> (self getWindowColorFrom: windowRecord) ]) ].
recordColorsAssociations addAll:
(windowRecord events collect: [ :record | record -> windowRecord windowColor ]) ].

^ recordColorsAssociations sorted: [ :recordA :recordB | recordA key dateTime < recordB key dateTime ]
]
Expand All @@ -168,31 +225,13 @@ DSRecordBrowserPresenter >> getRecordColorAssociationsFrom: aWindowRecordCollect
DSRecordBrowserPresenter >> getTimelinePointsFrom: aHistory [
"Returns a list of plots for the timeline chart."

^ aHistory windows collectWithIndex: [ :w :index |
^ aHistory windows collectWithIndex: [ :windowRecord :index |
RSTimeLinePlot new
entries: {
w events first dateTime asNanoSeconds.
w events last dateTime asNanoSeconds }
windowRecord events first dateTime asNanoSeconds.
windowRecord events last dateTime asNanoSeconds }
at: index;
color: (self getWindowColorFrom: w) ]
]

{ #category : 'color' }
DSRecordBrowserPresenter >> getWindowColorFrom: aWindowRecord [
"Returns the window associated color, and the default color otherwise."

aWindowRecord isBrowser ifTrue: [ ^ Color fromHexString: '#2A2AB7' ].
aWindowRecord isInspector ifTrue: [ ^ Color fromHexString: '#FFC300' ].
aWindowRecord isDebugger ifTrue: [ ^ Color fromHexString: '#C41E3D' ].

aWindowRecord isPlayground ifTrue: [ ^ Color fromHexString: '#70B77E' ].
aWindowRecord isDebugPointBrowser ifTrue: [ ^ Color fromHexString: '#7C238C' ].
aWindowRecord isCritiqueBrowser ifTrue: [ ^ Color fromHexString: '#A45C15' ].
aWindowRecord isEpicea ifTrue: [ ^ Color fromHexString: '#345e54' ].
aWindowRecord isIceberg ifTrue: [ ^ Color fromHexString: '#2B5BA9' ].
aWindowRecord isRewriter ifTrue: [ ^ Color fromHexString: '#292929' ].

^ Color gray
color: windowRecord windowColor ]
]

{ #category : 'initialization' }
Expand Down Expand Up @@ -326,13 +365,13 @@ DSRecordBrowserPresenter >> startRecordButton [

{ #category : 'recording' }
DSRecordBrowserPresenter >> startRecording [
"Starts recording events and instianciates a timerWindow which displays a timer and shows that Debugging Spy is recordering."
"Starts recording events and instianciates a timerWindow which displays a timer and shows that Debugging Spy is recording."

DSSpyInstrumenter instrumentSystem.
timerWindow := DSTimerWindow new
openInWorld;
startTimer;
yourself.
DSSpyInstrumenter instrumentSystem.
timerWindow startTimer.
self updateToolbar
]

Expand Down Expand Up @@ -367,7 +406,7 @@ DSRecordBrowserPresenter >> timelineChart [
fileListPresenter selectedItem ifNil: [ ^ nil ].

history := self getHistoryFrom: fileListPresenter selectedItem.
names := history windows collect: [ :i | i getWindowType ].
names := history windows collect: [ :i | i windowType ].

data := self getTimelinePointsFrom: history.
data size < 2 ifTrue: [ ^ nil ].
Expand Down
Loading