The Trunk: Morphic-mt.806.mcz

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

The Trunk: Morphic-mt.806.mcz

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

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

Name: Morphic-mt.806
Author: mt
Time: 2 April 2015, 9:20:54.685 am
UUID: 6a7470e3-86ed-7244-958d-35c81e309eff
Ancestors: Morphic-cmm.805

Removed hard-coded margins in scroll panes and added them to lists, text fields, and trees.

This gives tool-specific widgets more control about how to handle/draw this margins.

=============== Diff against Morphic-cmm.805 ===============

Item was changed:
  ----- Method: LazyListMorph>>display:atRow:on: (in category 'drawing') -----
  display: item atRow: row on: canvas
  "display the given item at row row"
 
  | drawBounds emphasized rowColor itemAsText |
  itemAsText := item asStringOrText.
  emphasized := itemAsText isText
  ifTrue: [font emphasized: (itemAsText emphasisAt: 1)]
  ifFalse: [font].
  rowColor := self colorForRow: row.
+ drawBounds := (self drawBoundsForRow: row) translateBy: (self hMargin @ 0).
- drawBounds := self drawBoundsForRow: row.
  drawBounds := drawBounds intersect: self bounds.
  (self icon: row) ifNotNil:
  [ :icon || top |
  top := drawBounds top + ((drawBounds height - icon height) // 2).
  canvas translucentImage: icon at: drawBounds left @ top.
  drawBounds := drawBounds left: drawBounds left + icon width + 2 ].
  canvas drawString: itemAsText in: drawBounds font: emphasized color: rowColor!

Item was added:
+ ----- Method: LazyListMorph>>hMargin (in category 'accessing') -----
+ hMargin
+
+ ^ 3!

Item was changed:
  ----- Method: MulticolumnLazyListMorph>>display:atRow:on: (in category 'drawing') -----
  display: items atRow: row on: canvas
  "display the specified item, which is on the specified row; for Multicolumn
  lists, items will be a list of strings"
  | drawBounds |
+ drawBounds :=  (self drawBoundsForRow: row) translateBy: (self hMargin @ 0).
- drawBounds := self drawBoundsForRow: row.
  drawBounds := drawBounds intersect: self bounds.
  items
  with: (1 to: items size)
  do: [:item :index |
  "move the bounds to the right at each step"
  index > 1
  ifTrue: [drawBounds := drawBounds left: drawBounds left + 6
  + (columnWidths at: index - 1)].
  item isText
  ifTrue: [canvas
  drawString: item
  in: drawBounds
  font: (font
  emphasized: (item emphasisAt: 1))
  color: (self colorForRow: row)]
  ifFalse: [canvas
  drawString: item
  in: drawBounds
  font: font
  color: (self colorForRow: row)]]!

Item was changed:
  ----- Method: PluggableTextMorph>>setText: (in category 'model access') -----
  setText: aText
  textMorph
  ifNil: [textMorph := self textMorphClass new
+ contents: aText
+ wrappedTo: self innerBounds width.
+ textMorph
+ margins: (3@0 corner: 0@0);
+ setEditView: self.
- contents: aText wrappedTo: self innerBounds width-6.
- textMorph setEditView: self.
  scroller addMorph: textMorph]
  ifNotNil: [textMorph newContents: aText].
  self hasUnacceptedEdits: false.
  self setScrollDeltas.!

Item was added:
+ ----- Method: PluggableTextMorph>>wantsBalloon (in category 'as yet unclassified') -----
+ wantsBalloon
+
+ ^ self textMorph contents notEmpty and: [super wantsBalloon]!

Item was changed:
  ----- Method: ScrollPane>>hMargin (in category 'access') -----
  hMargin
  "pixels of whitespace at to the left of the scroller when the hScrollBar offset is 0"
+ ^0
- ^3
  !

Item was changed:
  ----- Method: ScrollPane>>initializeScrollBars (in category 'initialization') -----
  initializeScrollBars
  "initialize the receiver's scrollBar"
 
  (scrollBar := ScrollBar new model: self slotName: 'vScrollBar')
  borderWidth: 1;
  borderColor: Color black.
  (hScrollBar := ScrollBar new model: self slotName: 'hScrollBar')
  borderWidth: 1;
  borderColor: Color black.
 
  ""
  scroller := TransformMorph new color: Color transparent.
+ scroller offset: 0 @ 0.
- scroller offset: -3 @ 0.
  self addMorph: scroller.
  ""
  scrollBar initializeEmbedded: retractableScrollBar not.
  hScrollBar initializeEmbedded: retractableScrollBar not.
  retractableScrollBar ifFalse:
  [self
  addMorph: scrollBar;
  addMorph: hScrollBar].
 
  Preferences alwaysShowVScrollbar ifTrue:
  [ self alwaysShowVScrollBar: true ].
 
  Preferences alwaysHideHScrollbar
  ifTrue:[self hideHScrollBarIndefinitely: true ]
  ifFalse:
  [Preferences alwaysShowHScrollbar ifTrue:
  [ self alwaysShowHScrollBar: true ]].
  !

Item was changed:
  ----- Method: ScrollPane>>innerBounds (in category 'geometry') -----
  innerBounds
  | inner |
  inner := super innerBounds.
  retractableScrollBar | (submorphs includes: scrollBar) not ifFalse:[
  inner := (scrollBarOnLeft
  ifTrue: [scrollBar right @ inner top corner: inner bottomRight]
  ifFalse: [inner topLeft corner: scrollBar left @ inner bottom])
  ].
  (retractableScrollBar | self hIsScrollbarShowing not)
  ifTrue: [^ inner]
+ ifFalse: [^ inner topLeft corner: (inner bottomRight - (0@(self scrollBarThickness - 1)))].
- ifFalse: [^ inner topLeft corner: (inner bottomRight - (0@self scrollBarThickness))].
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.806.mcz

Chris Muller-3
Thanks for all of the wonderful improvements you've been making.  I
know this seems picky, but I seem to keep noticing the unevenness of
the new margins throughout my workday.  IMO, the list margin is too
wide and the text margin too narrow.

I know everyone has different tastes, but if you need custom margins
for your app, may we keep the original margins for the default tools
in the image?



uneven-margins.png (46K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.806.mcz

marcel.taeumel (old)
This should not happen. Let me try...



Looks fine in my image. Is this an *old* tool? Try open a new Monticello browser.

Do we want a migration script for this change?

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.806.mcz

marcel.taeumel (old)
Let me clarify: This change affects initialization code in ScrollPane and PluggableTextMorph. Only in LazyListMorph, this is lazy in its drawing routine. This explains your observation.

Best,
Marcel