The Trunk: ToolBuilder-Morphic-mt.224.mcz

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

The Trunk: ToolBuilder-Morphic-mt.224.mcz

commits-2
Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-mt.224.mcz

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

Name: ToolBuilder-Morphic-mt.224
Author: mt
Time: 23 January 2019, 1:37:44.247984 pm
UUID: ff9b83dd-1f7c-844f-b104-e1b6890461a0
Ancestors: ToolBuilder-Morphic-mt.223

For (pluggable) scroll panes through the tool builder, use optional scroll bars for both dimensions now. Ignore system-wide preferences because those usually address code-editing tools, not arbitrary programs.

Note that we might want to rename those preferences (#alwaysShowVScrollbar, #alwaysHideHScrollbar, etc.) and move their usages out of ScrollPane into the #buildWith: implementations of our tools (CodeHolder, Debugger, etc.). You need to know about the specific contents of those scroll panes to make such hide/show decisions.

=============== Diff against ToolBuilder-Morphic-mt.223 ===============

Item was changed:
  ----- Method: MorphicToolBuilder>>buildPluggableScrollPane: (in category 'widgets optional') -----
  buildPluggableScrollPane: spec
 
  | widget panel |
  widget := self scrollPaneClass new.
  widget model: spec model.
  self register: widget id: spec name.
 
  spec children
  ifNotNil: [:obj |
  "Create panel morph to scroll it."
  panel := self pluggablePanelSpec new
  model: spec model;
  children: obj;
  layout: spec layout;
  horizontalResizing: (spec layout == #proportional ifTrue: [#rigid] ifFalse: [#shrinkWrap]);
  verticalResizing: (spec layout == #proportional ifTrue: [#rigid] ifFalse: [#shrinkWrap]);
  buildWith: self.
  widget morph: panel.
  ]
  ifNil: [spec morph
  ifNotNil: [:m | widget morph: m]
  ifNil: [widget morphClass: spec morphClass]].
 
  self setFrame: spec frame in: widget.
  self setLayoutHintsFor: widget spec: spec.
 
  parent ifNotNil: [self add: widget to: parent].
 
  spec borderWidth ifNotNil: [:w | widget borderWidth: w].
 
+ "Set scroll bar policies. By default, use scroll bars only when needed. Do not follow system-wide preferences here."
+ spec hScrollBarPolicy
+ caseOf: {
- "Override default scroll bar policies if needed. Widget will use preference values otherwise."
- spec hScrollBarPolicy ifNotNil: [:policy |
- policy caseOf: {
  [#always] -> [widget alwaysShowHScrollBar].
  [#never] -> [widget hideHScrollBarIndefinitely].
+ [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded] }
+ otherwise: [widget showHScrollBarOnlyWhenNeeded].
+ spec vScrollBarPolicy
+ caseOf: {
- [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded]}].
- spec vScrollBarPolicy ifNotNil: [:policy |
- policy caseOf: {
  [#always] -> [widget alwaysShowVScrollBar].
  [#never] -> [widget hideVScrollBarIndefinitely].
+ [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded] }
+ otherwise: [widget showVScrollBarOnlyWhenNeeded].
- [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded]}].
 
  ^ widget!