The Trunk: Tools-kb.192.mcz

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

The Trunk: Tools-kb.192.mcz

commits-2
A new version of Tools was added to project The Trunk:
http://source.squeak.org/trunk/Tools-kb.192.mcz

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

Name: Tools-kb.192
Author: kb
Time: 23 February 2010, 12:51:59.946 am
UUID: 6a66e69d-f0f8-48c3-bf48-0ef28b2adace
Ancestors: Tools-kb.191, Tools-ul.191

 - Added shout styling to Workspace. Code adapted from SHWorkspace.
 - Added a preference to enable/disable styling in workspaces.
 - Added a menu item to the yellowButtonMenu of workspaces to toggle styling.

=============== Diff against Tools-kb.191 ===============

Item was changed:
  ----- Method: FileList2 class>>morphicViewFileSelectorForSuffixes: (in category 'morphic ui') -----
  morphicViewFileSelectorForSuffixes: aList
  "Answer a morphic file-selector tool for the given suffix list."
+
+ ^self morphicViewFileSelectorForSuffixes: aList directory: self lastSelDir!
- ^ self morphicViewFileSelectorForSuffixes: aList directory: self modalFolderSelector!

Item was added:
+ ----- Method: Workspace>>toggleStylingLabel (in category 'code pane menu') -----
+ toggleStylingLabel
+
+ ^self shouldStyle
+ ifTrue: [ 'Disable shout styling' ]
+ ifFalse: [ 'Enable shout styling' ]!

Item was added:
+ ----- Method: Workspace class>>shouldStyle: (in category 'preferences') -----
+ shouldStyle: aBoolean
+
+ ShouldStyle := aBoolean!

Item was added:
+ ----- Method: Workspace>>toggleStyling (in category 'code pane menu') -----
+ toggleStyling
+
+ shouldStyle := self shouldStyle not.
+ " Ugly hack, to restyle our contents. "
+ self codeTextMorph in: [ :codeTextMorph |
+ codeTextMorph setText:
+ codeTextMorph textMorph text asString asText ]!

Item was changed:
  ----- Method: FileList2>>okHit (in category 'private') -----
  okHit
+
  ok := true.
  currentDirectorySelected
+ ifNil: [ Beeper beep ]
+ ifNotNil: [
+ self class lastSelDir: directory.
+ modalView delete ]!
- ifNil: [Beeper beep]
- ifNotNil: [modalView delete]!

Item was changed:
  ----- Method: FileList2 class>>lastSelDir (in category 'accessing') -----
  lastSelDir
+ "Return the last selected directory or the default directory if no directory was selected so far."
+
+ ^lastSelDir ifNil: [ lastSelDir := FileDirectory default ]!
- ^ lastSelDir!

Item was changed:
  ----- Method: FileList2 class>>modalFolderSelector (in category 'modal dialogs') -----
  modalFolderSelector
+
+ ^self modalFolderSelector: self lastSelDir
- self lastSelDir  ifNil: [^self modalFolderSelector: FileDirectory default]
- ifNotNil:[^self modalFolderSelector: self lastSelDir ]
  !

Item was added:
+ ----- Method: Workspace>>addToggleStylingMenuItemTo: (in category 'code pane menu') -----
+ addToggleStylingMenuItemTo: aMenu
+
+ aMenu
+ addUpdating: #toggleStylingLabel
+ target: self
+ action: #toggleStyling!

Item was added:
+ ----- Method: Workspace>>shouldStyle (in category 'code pane menu') -----
+ shouldStyle
+
+ ^shouldStyle ifNil: [ self class shouldStyle ]!

Item was added:
+ ----- Method: Workspace>>codePaneMenu:shifted: (in category 'code pane menu') -----
+ codePaneMenu: aMenu shifted: shifted
+
+ shifted ifFalse: [
+ self addToggleStylingMenuItemTo: aMenu ].
+ super codePaneMenu: aMenu shifted: shifted.
+ ^aMenu!

Item was added:
+ ----- Method: Workspace class>>shouldStyle (in category 'preferences') -----
+ shouldStyle
+
+ <preference: 'Shout styling in Workspace'
+ category: 'browsing'
+ description: 'After enabled, new workspaces use shout to style their contents.'
+ type: #Boolean>
+ ^ShouldStyle ifNil: [ ^true ]!

Item was changed:
  ----- Method: FileList2 class>>modalFolderSelector: (in category 'modal dialogs') -----
  modalFolderSelector: aDir
 
  | window fileModel |
  window _ self morphicViewFolderSelector: aDir.
  fileModel _ window model.
  window openInWorld: self currentWorld extent: 300@400.
  self modalLoopOn: window.
+ ^fileModel getSelectedDirectory withoutListWrapper!
- ^self lastSelDir: fileModel getSelectedDirectory withoutListWrapper!

Item was changed:
  StringHolder subclass: #Workspace
+ instanceVariableNames: 'bindings acceptDroppedMorphs acceptAction mustDeclareVariables shouldStyle'
+ classVariableNames: 'ShouldStyle'
- instanceVariableNames: 'bindings acceptDroppedMorphs acceptAction mustDeclareVariables'
- classVariableNames: ''
  poolDictionaries: ''
  category: 'Tools-Base'!
 
  !Workspace commentStamp: 'ls 10/14/2003 12:13' prior: 0!
  A Workspace is a text area plus a lot of support for executable code.  It is a great place to execute top-level commands to compute something useful, and it is a great place to develop bits of a program before those bits get put into class methods.
 
  To open a new workspace, execute:
 
  Workspace open
 
 
  A workspace can have its own variables, called "workspace variables", to hold intermediate results.  For example, if you type into a workspace "x := 5" and do-it, then later you could type in "y := x * 2" and y would become 10.
 
  Additionally, in Morphic, a workspace can gain access to morphs that are on the screen.  If acceptDroppedMorphss is turned on, then whenever a morph is dropped on the workspace, a variable will be created which references that morph.  This functionality is toggled with the window-wide menu of a workspace.
 
 
  The instance variables of this class are:
 
  bindings  -  holds the workspace variables for this workspace
 
  acceptDroppedMorphss - whether dropped morphs should create new variables!

Item was changed:
  ----- Method: FileList2 class>>lastSelDir: (in category 'accessing') -----
+ lastSelDir: aFileDirectory
+ "Store the last selected directory. This will be selected as default in newly opened file or folder selectors"
+
+ ^lastSelDir := aFileDirectory!
- lastSelDir: aDir
- ^ lastSelDir := aDir!

Item was changed:
  ----- Method: Workspace>>aboutToStyle: (in category 'code pane') -----
  aboutToStyle: aStyler
 
+ self shouldStyle ifFalse: [ ^false ].
  aStyler
  classOrMetaClass: nil;
  workspace: self.
  ^true!