The Inbox: Tools-ct.853.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tools-ct.853.mcz

commits-2
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.853.mcz

==================== Summary ====================

Name: Tools-ct.853
Author: ct
Time: 7 July 2019, 7:58:37.726178 pm
UUID: a11f70d4-3f36-894a-89e7-78011f6ab2e2
Ancestors: Tools-ct.852

Refine styling in Inspector & Debugger

This commit is based on ToolBuilder-Morphic-ct.228 (#aboutToStyle:forMorph:).
- Introduce a state for Inspector (shouldStyleValuePane) that indicates whether to style the value pane
- Name the value pane to identify it
- Allow styling in every inspector window
- Refactor the debugger toolbuilding and refer to inspector's building methods (they shared many common properties)
Also see the following thread: http://forum.world.st/The-Inbox-Tools-ct-852-mcz-td5100784.html

=============== Diff against Tools-ct.852 ===============

Item was changed:
  ----- Method: Debugger>>buildFullWith: (in category 'toolbuilder') -----
  buildFullWith: builder
  | windowSpec listSpec textSpec |
  windowSpec := builder pluggableWindowSpec new
  model: self;
  label: 'Debugger';
  children: OrderedCollection new.
 
  listSpec := builder pluggableListSpec new.
  listSpec
  model: self;
  list: #contextStackList;
  getIndex: #contextStackIndex;
  setIndex: #toggleContextStackIndex:;
  menu: #contextStackMenu:shifted:;
  icon: #messageIconAt:;
  helpItem: #messageHelpAt:;
  keyPress: #contextStackKey:from:;
  frame: (0@0 corner: 1@0.22).
  windowSpec children add: listSpec.
 
 
  textSpec := self buildCodePaneWith: builder.
  textSpec frame: (0@0.22corner: 1@0.8).
  windowSpec children add: textSpec.
 
+ listSpec := self receiverInspector buildFieldListWith: builder.
- listSpec := builder pluggableListSpec new.
  listSpec
- model: self receiverInspector;
- list: #fieldList;
- getIndex: #selectionIndex;
- setIndex: #toggleIndex:;
- menu: #fieldListMenu:;
- keyPress: #inspectorKey:from:;
  frame: (0@0.8 corner: 0.2@1);
  help: 'Receiver''s\Instance\Variables' withCRs.
  windowSpec children add: listSpec.
 
+ textSpec := self receiverInspector buildValuePaneWith: builder.
- textSpec := builder pluggableCodePaneSpec new.
  textSpec
- model: self receiverInspector;
- getText: #contents;
- setText: #accept:;
  help: '<- Select receiver''s field' translated;
- selection: #contentsSelection;
- menu: #codePaneMenu:shifted:;
  frame: (0.2@0.8 corner: 0.5@1).
  windowSpec children add: textSpec.
 
+ listSpec := self contextVariablesInspector buildFieldListWith: builder.
- listSpec := builder pluggableListSpec new.
  listSpec
- model: self contextVariablesInspector;
- list: #fieldList;
- getIndex: #selectionIndex;
- setIndex: #toggleIndex:;
- menu: #fieldListMenu:;
- keyPress: #inspectorKey:from:;
  frame: (0.5@0.8 corner: 0.7@1);
  help: 'Other\Context\Bindings' withCRs.
  windowSpec children add: listSpec.
 
+ textSpec := self contextVariablesInspector buildValuePaneWith: builder.
- textSpec := builder pluggableCodePaneSpec new.
  textSpec
- model: self contextVariablesInspector;
- getText: #contents;
- setText: #accept:;
  help: '<- Select context''s field' translated;
- selection: #contentsSelection;
- menu: #codePaneMenu:shifted:;
  frame: (0.7@0.8 corner: 1@1).
  windowSpec children add: textSpec.
 
  ^builder build: windowSpec!

Item was changed:
  StringHolder subclass: #Inspector
+ instanceVariableNames: 'object selectionIndex timeOfLastListUpdate selectionUpdateTime context expression shouldStyleValuePane'
- instanceVariableNames: 'object selectionIndex timeOfLastListUpdate selectionUpdateTime context expression'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Tools-Inspector'!
 
  !Inspector commentStamp: '<historical>' prior: 0!
  I represent a query path into the internal representation of an object. As a StringHolder, the string I represent is the value of the currently selected variable of the observed object.!

Item was removed:
- ----- Method: Inspector>>aboutToStyle: (in category 'styling') -----
- aboutToStyle: aStyler
-
- aStyler
- classOrMetaClass: object class;
- parseAMethod: false.
- ^true!

Item was added:
+ ----- Method: Inspector>>aboutToStyle:forMorph: (in category 'styling') -----
+ aboutToStyle: aStyler forMorph: aMorph
+
+ (aMorph knownName = #valuePane and: [shouldStyleValuePane not])
+ ifTrue: [^ false].
+
+ aStyler
+ classOrMetaClass: object class;
+ parseAMethod: false.
+ ^true!

Item was changed:
  ----- Method: Inspector>>buildValuePaneWith: (in category 'toolbuilder') -----
  buildValuePaneWith: builder
  | textSpec |
+ textSpec := builder pluggableCodePaneSpec new.
- textSpec := builder pluggableTextSpec new.
  textSpec
  model: self;
+ name: #valuePane;
  getText: #contents;
  setText: #accept:;
+ editText: #typeValue:;
  help: 'Selection details.';
  selection: #contentsSelection;
  menu: #codePaneMenu:shifted:.
  ^textSpec!

Item was changed:
  ----- Method: Inspector>>initialize (in category 'initialize-release') -----
  initialize
 
  selectionIndex := 0.
+ shouldStyleValuePane := true.
  super initialize!

Item was changed:
  ----- Method: Inspector>>toggleIndex: (in category 'selecting') -----
  toggleIndex: anInteger
  "The receiver has a list of variables of its inspected object. One of these
  is selected. If anInteger is the index of this variable, then deselect it.
  Otherwise, make the variable whose index is anInteger be the selected
  item."
 
  selectionUpdateTime := 0.
  selectionIndex = anInteger
  ifTrue:
  ["same index, turn off selection"
  selectionIndex := 0.
  contents := '']
  ifFalse:
  ["different index, new selection"
+ shouldStyleValuePane := false.
  selectionIndex := anInteger.
  self contentsIsString
  ifTrue: [contents := self selection]
  ifFalse: [contents := self selectionPrintString]].
  self changed: #selection.
  self changed: #contents.
  self changed: #selectionIndex.!

Item was added:
+ ----- Method: Inspector>>typeValue: (in category 'selecting') -----
+ typeValue: aTextOrString
+
+ shouldStyleValuePane := true.
+ self changed: #style!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-ct.853.mcz

marcel.taeumel
Hi, there.

It looks like you do double styling via #editText: and "self changed: #style". Why not just calling that refreshing in #toggleIndex:? The PluggableTextMorph will re-style on its own during typing.

Best,
Marcel

Am 07.07.2019 19:58:50 schrieb [hidden email] <[hidden email]>:

A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.853.mcz

==================== Summary ====================

Name: Tools-ct.853
Author: ct
Time: 7 July 2019, 7:58:37.726178 pm
UUID: a11f70d4-3f36-894a-89e7-78011f6ab2e2
Ancestors: Tools-ct.852

Refine styling in Inspector & Debugger

This commit is based on ToolBuilder-Morphic-ct.228 (#aboutToStyle:forMorph:).
- Introduce a state for Inspector (shouldStyleValuePane) that indicates whether to style the value pane
- Name the value pane to identify it
- Allow styling in every inspector window
- Refactor the debugger toolbuilding and refer to inspector's building methods (they shared many common properties)
Also see the following thread: http://forum.world.st/The-Inbox-Tools-ct-852-mcz-td5100784.html

=============== Diff against Tools-ct.852 ===============

Item was changed:
----- Method: Debugger>>buildFullWith: (in category 'toolbuilder') -----
buildFullWith: builder
| windowSpec listSpec textSpec |
windowSpec := builder pluggableWindowSpec new
model: self;
label: 'Debugger';
children: OrderedCollection new.

listSpec := builder pluggableListSpec new.
listSpec
model: self;
list: #contextStackList;
getIndex: #contextStackIndex;
setIndex: #toggleContextStackIndex:;
menu: #contextStackMenu:shifted:;
icon: #messageIconAt:;
helpItem: #messageHelpAt:;
keyPress: #contextStackKey:from:;
frame: (0@0 corner: 1@0.22).
windowSpec children add: listSpec.


textSpec := self buildCodePaneWith: builder.
textSpec frame: (0@0.22corner: 1@0.8).
windowSpec children add: textSpec.

+ listSpec := self receiverInspector buildFieldListWith: builder.
- listSpec := builder pluggableListSpec new.
listSpec
- model: self receiverInspector;
- list: #fieldList;
- getIndex: #selectionIndex;
- setIndex: #toggleIndex:;
- menu: #fieldListMenu:;
- keyPress: #inspectorKey:from:;
frame: (0@0.8 corner: 0.2@1);
help: 'Receiver''s\Instance\Variables' withCRs.
windowSpec children add: listSpec.

+ textSpec := self receiverInspector buildValuePaneWith: builder.
- textSpec := builder pluggableCodePaneSpec new.
textSpec
- model: self receiverInspector;
- getText: #contents;
- setText: #accept:;
help: '<- select="" receiver''s="" field'="">
- selection: #contentsSelection;
- menu: #codePaneMenu:shifted:;
frame: (0.2@0.8 corner: 0.5@1).
windowSpec children add: textSpec.

+ listSpec := self contextVariablesInspector buildFieldListWith: builder.
- listSpec := builder pluggableListSpec new.
listSpec
- model: self contextVariablesInspector;
- list: #fieldList;
- getIndex: #selectionIndex;
- setIndex: #toggleIndex:;
- menu: #fieldListMenu:;
- keyPress: #inspectorKey:from:;
frame: (0.5@0.8 corner: 0.7@1);
help: 'Other\Context\Bindings' withCRs.
windowSpec children add: listSpec.

+ textSpec := self contextVariablesInspector buildValuePaneWith: builder.
- textSpec := builder pluggableCodePaneSpec new.
textSpec
- model: self contextVariablesInspector;
- getText: #contents;
- setText: #accept:;
help: '<- select="" context''s="" field'="">
- selection: #contentsSelection;
- menu: #codePaneMenu:shifted:;
frame: (0.7@0.8 corner: 1@1).
windowSpec children add: textSpec.

^builder build: windowSpec!

Item was changed:
StringHolder subclass: #Inspector
+ instanceVariableNames: 'object selectionIndex timeOfLastListUpdate selectionUpdateTime context expression shouldStyleValuePane'
- instanceVariableNames: 'object selectionIndex timeOfLastListUpdate selectionUpdateTime context expression'
classVariableNames: ''
poolDictionaries: ''
category: 'Tools-Inspector'!

!Inspector commentStamp: '' prior: 0!
I represent a query path into the internal representation of an object. As a StringHolder, the string I represent is the value of the currently selected variable of the observed object.!

Item was removed:
- ----- Method: Inspector>>aboutToStyle: (in category 'styling') -----
- aboutToStyle: aStyler
-
- aStyler
- classOrMetaClass: object class;
- parseAMethod: false.
- ^true!

Item was added:
+ ----- Method: Inspector>>aboutToStyle:forMorph: (in category 'styling') -----
+ aboutToStyle: aStyler forMorph: aMorph
+
+ (aMorph knownName = #valuePane and: [shouldStyleValuePane not])
+ ifTrue: [^ false].
+
+ aStyler
+ classOrMetaClass: object class;
+ parseAMethod: false.
+ ^true!

Item was changed:
----- Method: Inspector>>buildValuePaneWith: (in category 'toolbuilder') -----
buildValuePaneWith: builder
| textSpec |
+ textSpec := builder pluggableCodePaneSpec new.
- textSpec := builder pluggableTextSpec new.
textSpec
model: self;
+ name: #valuePane;
getText: #contents;
setText: #accept:;
+ editText: #typeValue:;
help: 'Selection details.';
selection: #contentsSelection;
menu: #codePaneMenu:shifted:.
^textSpec!

Item was changed:
----- Method: Inspector>>initialize (in category 'initialize-release') -----
initialize

selectionIndex := 0.
+ shouldStyleValuePane := true.
super initialize!

Item was changed:
----- Method: Inspector>>toggleIndex: (in category 'selecting') -----
toggleIndex: anInteger
"The receiver has a list of variables of its inspected object. One of these
is selected. If anInteger is the index of this variable, then deselect it.
Otherwise, make the variable whose index is anInteger be the selected
item."

selectionUpdateTime := 0.
selectionIndex = anInteger
ifTrue:
["same index, turn off selection"
selectionIndex := 0.
contents := '']
ifFalse:
["different index, new selection"
+ shouldStyleValuePane := false.
selectionIndex := anInteger.
self contentsIsString
ifTrue: [contents := self selection]
ifFalse: [contents := self selectionPrintString]].
self changed: #selection.
self changed: #contents.
self changed: #selectionIndex.!

Item was added:
+ ----- Method: Inspector>>typeValue: (in category 'selecting') -----
+ typeValue: aTextOrString
+
+ shouldStyleValuePane := true.
+ self changed: #style!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-ct.853.mcz

Christoph Thiede
Hi Marcel,

I think there is the following edge case: Inspect an object, select an
instvar, select all text in the value pane and type a single character (e.
g. a digit). At least in my image, this digit is not styled unless I enter
any other character. This seems to occur as #userHasEdited which triggers
the styling is called before #textEdited: so that shouldStyleValuePane is
not always up to date.

Otherwise, why should you update style in #toggleIndex, where /self changed:
#contents/ already resets the text?

Best,
Christoph



--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

Carpe Squeak!