The Trunk: ToolBuilder-Morphic-mt.135.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.135.mcz

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

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

Name: ToolBuilder-Morphic-mt.135
Author: mt
Time: 19 April 2015, 9:05:20.374 am
UUID: 7bb11f70-871b-dd49-8d3e-f37f242ccef3
Ancestors: ToolBuilder-Morphic-mt.134

New interface for managing scrollbar visibility used.

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

Item was changed:
  ----- Method: MorphicToolBuilder>>buildPluggableList: (in category 'widgets required') -----
  buildPluggableList: aSpec
  | widget listClass getIndex setIndex |
  aSpec getSelected ifNil:[
  listClass := self listClass.
  getIndex := aSpec getIndex.
  setIndex := aSpec setIndex.
  ] ifNotNil:[
  listClass := self listByItemClass.
  getIndex := aSpec getSelected.
  setIndex := aSpec setSelected.
  ].
  widget := listClass on: aSpec model
  list: aSpec list
  selected: getIndex
  changeSelected: setIndex
  menu: aSpec menu
  keystroke: aSpec keyPress.
  self register: widget id: aSpec name.
+
+ "Override default scroll bar policies if needed. Widget will use preference values otherwise."
+ aSpec hScrollBarPolicy ifNotNil: [:policy |
+ policy caseOf: {
+ [#always] -> [widget alwaysShowHScrollBar].
+ [#never] -> [widget hideHScrollBarIndefinitely].
+ [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded]. } ].
+ aSpec vScrollBarPolicy ifNotNil: [:policy |
+ policy caseOf: {
+ [#always] -> [widget alwaysShowVScrollBar].
+ [#never] -> [widget hideVScrollBarIndefinitely].
+ [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded]. } ].
+
  widget getListElementSelector: aSpec listItem.
  widget getListSizeSelector: aSpec listSize.
  widget getIconSelector: aSpec icon.
  widget getHelpSelector: aSpec help.
  widget doubleClickSelector: aSpec doubleClick.
+
  widget dragItemSelector: aSpec dragItem.
  widget dropItemSelector: aSpec dropItem.
  widget wantsDropSelector: aSpec dropAccept.
+
  widget autoDeselect: aSpec autoDeselect.
  widget keystrokePreviewSelector: aSpec keystrokePreview.
+
+ widget
+ borderWidth: 1;
+ borderColor: Color lightGray;
+ color: (aSpec color
+ ifNil: [Color white]
+ ifNotNil: [aSpec color]).
+
- aSpec color isNil
- ifTrue: [widget
- borderWidth: 1;
- borderColor: Color lightGray;
- color: Color white]
- ifFalse: [widget color: aSpec color].
  self setFrame: aSpec frame in: widget.
  parent ifNotNil:[self add: widget to: parent].
  panes ifNotNil:[
  aSpec list ifNotNil:[panes add: aSpec list].
  ].
  ^widget!

Item was changed:
  ----- Method: MorphicToolBuilder>>buildPluggableScrollPane: (in category 'widgets optional') -----
  buildPluggableScrollPane: spec
 
  | widget |
  widget := self scrollPaneClass new.
  widget model: spec model.
  self register: widget id: spec name.
 
  spec children
  ifNotNil: [:obj |
  "Create panel morph to scroll it."
  widget morph: (self pluggablePanelSpec new
  children: obj;
  layout: spec layout;
  frame: (0@0 corner: 1@1);
  buildWith: self).
  spec layout ~~ #proportional ifTrue: [
  "Fix #spaceFill resizing because it does not make sense in scroll pane."
  widget morph
  hResizing: #shrinkWrap;
  vResizing: #shrinkWrap.
  widget morph submorphsDo: [:m |
  m
  extent: 100@100;
  flag: #refactor; "mt: Restore orginial properties?"
  hResizing: #rigid;
  vResizing: #rigid]
  ]]
  ifNil: [spec morph
  ifNotNil: [:m | widget morph: m]
  ifNil: [widget morphClass: spec morphClass]].
 
  self setFrame: spec frame in: widget.
  parent ifNotNil: [self add: widget to: parent].
 
  widget borderWidth: spec borderWidth.
 
  spec hScrollBarPolicy caseOf: {
+ [#always] -> [widget alwaysShowHScrollBar].
+ [#never] -> [widget hideHScrollBarIndefinitely].
+ [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded]}.
- [#always] -> [widget alwaysShowHScrollBar: true].
- [#never] -> [widget hideHScrollBarIndefinitely: true].
- [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded: false]}.
  spec vScrollBarPolicy caseOf: {
+ [#always] -> [widget alwaysShowVScrollBar].
+ [#never] -> [widget hideVScrollBarIndefinitely].
+ [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded]}.
- [#always] -> [widget alwaysShowVScrollBar: true].
- [#never] -> [widget hideVScrollBarIndefinitely: true].
- [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded: false]}.
 
  ^ widget!

Item was changed:
  ----- Method: MorphicToolBuilder>>buildPluggableText: (in category 'widgets required') -----
  buildPluggableText: aSpec
  | widget |
  widget := self textPaneClass new.
  aSpec stylerClass ifNotNil: [:c | widget styler: (c new view: widget)].
  widget
  on: aSpec model
  text: aSpec getText
  accept: aSpec setText
  readSelection: aSpec selection
  menu: aSpec menu.
  aSpec font ifNotNil: [:f | widget font: f].
 
  widget editTextSelector: aSpec editText.
  widget wantsFrameAdornments: aSpec indicateUnacceptedChanges.
  widget askBeforeDiscardingEdits: aSpec askBeforeDiscardingEdits.
  widget font: Preferences standardCodeFont.
 
  widget textMorph isAutoFit ifTrue: [
+ widget hideHScrollBarIndefinitely ].
- widget hideHScrollBarIndefinitely: true.].
 
  self register: widget id: aSpec name.
  widget getColorSelector: aSpec color.
  self buildHelpFor: widget spec: aSpec.
  self setFrame: aSpec frame in: widget.
  parent ifNotNil:[self add: widget to: parent].
  widget borderColor: Color lightGray.
  widget color: Color white.
  ^widget!