The Inbox: System-ct.1223.mcz

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

The Inbox: System-ct.1223.mcz

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

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

Name: System-ct.1223
Author: ct
Time: 10 March 2021, 6:19:36.587559 pm
UUID: 4d3c6ad5-a6b9-b44b-8145-87e91f5c90a2
Ancestors: System-mt.1221

Makes the extent of the annotation setup window dynamic. With the next annotation request that is added, the current space will be too small.

=============== Diff against System-mt.1221 ===============

Item was changed:
  ----- Method: Preferences class>>annotationEditingWindow (in category 'support - misc') -----
  annotationEditingWindow
  "Answer a window affording editing of annotations"
+ | info standardHeight standardWidth aPanel ins outs current aWindow aButton |
- | aPanel ins outs current aWindow aButton info standardHeight standardWidth |
- standardHeight := 200.
- standardWidth := (2 sqrt reciprocal * standardHeight) rounded.
  Smalltalk isMorphic
  ifFalse: [self error: 'annotations can be edited only in morphic'].
+
+ info := self annotationInfo.
+ standardHeight := 20 * info size min: self currentWorld height * 0.8 max: 100.
+ standardWidth := (2 sqrt reciprocal * standardHeight) rounded.
  aPanel := AlignmentMorph newRow extent: 2 * standardWidth @ standardHeight.
  ins := AlignmentMorph newColumn extent: standardWidth @ standardHeight.
  ins color: Color green muchLighter.
  ins enableDrop: true;
  beSticky.
  outs := AlignmentMorph newColumn extent: standardWidth @ standardHeight.
  outs color: Color red muchLighter.
  outs enableDrop: true;
  beSticky.
  aPanel addMorph: outs;
  addMorphFront: ins.
  outs position: ins position + (standardWidth @ 0).
  current := self defaultAnnotationRequests.
- info := self annotationInfo.
  current
  do: [:sym | | pair aMorph |
  pair := info
  detect: [:aPair | aPair first == sym].
  aMorph := StringMorph new contents: pair first.
  aMorph setBalloonText: pair last.
  aMorph enableDrag: true.
  aMorph
  on: #startDrag
  send: #startDrag:with:
  to: aMorph.
  ins addMorphBack: aMorph].
  info
  do: [:aPair | (current includes: aPair first)
  ifFalse: [| aMorph |
  aMorph := StringMorph new contents: aPair first.
  aMorph setBalloonText: aPair last.
  aMorph enableDrag: true.
  aMorph
  on: #startDrag
  send: #startDrag:with:
  to: aMorph.
  outs addMorph: aMorph]].
  aPanel layoutChanged.
  aWindow := SystemWindowWithButton new setLabel: 'Annotations'.
  aButton := SimpleButtonMorph new target: Preferences;
  actionSelector: #acceptAnnotationsFrom:;
 
  arguments: (Array with: aWindow);
  label: 'apply';
  borderWidth: 0;
  borderColor: Color transparent;
  color: Color transparent.
  aButton submorphs first color: Color blue.
  aButton setBalloonText: 'After moving all the annotations you want to the left (green) side, and all the ones you do NOT want to the right (pink) side, hit this "apply" button to have your choices take effect.'.
  aWindow buttonInTitle: aButton;
  adjustExtraButton.
  ^ aPanel wrappedInWindow: aWindow"Preferences annotationEditingWindow openInHand"!