Polymorph (was UI Enhancements)
Last updated at 5:41 pm UTC on 10 February 2009
Polymorph provides support for selectable user interface themes in Morphic, extra widgets to support a consistent look-and-feel and a framework for easily creating UIs in code. See here for some screenshots: http://www.flickr.com/photos/12018791@N06/sets/72157601659393251/
Where to find the Polymorph packages
Installation
- Via Package Universes (Development universe) is easiest. Choose "User Interface > ToolBuilder Integration" from the left-hand pane. Press the "select package" button then "Install Selections" (at the bottom). Then you might want to use Monticello (see below) to get the latest updates.
- Manually via Monticello.
- Open a Monticello browser, click the "+Repository" button and choose HTTP from the menu.
- Change the location to http://www.squeaksource.com/UIEnhancements and leave the user and password as squeak ('squeak').
- Accept that then click the "Open" button.
- In the new window (repository inspector), select "Polymorph-Widgets" in the left-hand pane then the topmost entry (the version) in the right-hand pane. –Click the "Load" button and wait until loaded.
- Repeat, back in the repository inspector, selecting "Polymorph-ToolBuilder" in the left-hand pane and, again, the topmost version in the right-hand pane. –Click the "Load" button and wait. Optionally you may also load "Polymorph-TaskbarIcons" to associate different icons with various tools. That's it... move on to the next section for how to use it.
- Having trouble loading? Since the ui enhancements modify many existing methods, and the fact that Monticello doesn't do atomic loading, it is best to close any windows you can and make the remainder clear of the central area where the progress indicator appears. For guaranteed (as much as it can be) load you'll need to modify the MCPackageLoader>>basicLoad method, to read [[additions do: [:ea | self tryToLoad: ea]. instead of [[additions do: [:ea | self tryToLoad: ea] displayingProgress: 'Loading...'.
- Now includes Diff Tools for comparing code in the method versions browser and Monticello. A manual install from SqueakSource in the UI Enhancements project. Load Polymorph-Geometry, Polymorph-EventEnhancements and Polymorph-Tools-Diff, in addition to the aforementioned Polymorph-Widgets and Polymorph-ToolBuilder.
Using the Polymorph package
- Select your preferred theme by using the Squeak Preference Browser (Left-click on your desktop and choose "open..." then select "Preference Browser" from the popup menu. Select the "windows" category to the left then, in the right-hand preferences pane, scroll down and select one of the uiTheme options.
- (Alt or Ctrl) with Left/Right arrow buttons will popup a task switcher,
- Under MS Windows: releasing the cmd key will remove the popup and switch to the selected window.
- Under Linux: you need to move the mouse to generate another event.
- Tab/shift-tabs will move focus to next submorph within System Window applications (except for text editors only shift-tab.)
- The mouse wheel is now handled separately from keyboard input and can be used with whatever is under the mouse pointer without disturbing the current keyboard focus (as long as the mouseOverForKeyboardFocus preference is disabled).
- Dialog style windows will generally respond to the escape key for cancel and the return key for the default button.
- Modal dialogs are generally only modal to the window that created them rather than locking you out of the whole World. For global modality, open them via the World. (in code: "someMorph openModal: aSystemWindow" will make the window modal to someMorph).
- There are a number of new options in the preferences browser. The description for each should help you.
- externalFocusForPluggableText provides keyboard focus indication around the whole pane rather than the actual text
- mouseClickForKeyboardFocus requires you to click in a morph for it to take keyboard focus, rather than moving the mouse over it (best if mouseOverForKeyboardFocus is disabled)
- windowsActiveOnFirstClick means that when you click an inactive window your mouse click will be passed on to the morph under the mouse cursor as if the window were active at that moment
- fadedBackgroundWindows means that inactive windows will appear more "washed out" than the current active window
- windowAnimation when enabled shows an animation of the window frame when minimising, maximizing, restoring and closing
- noWindowAnimationForClosing overrides the previous setting for closing of windows
- windowAnimationDelay is the time, in milliseconds, between each frame of the animation
- windowAnimationSteps is the number of animation steps to take (the frame positions are non-linear!).
- useThemeSounds enables or disables theme sounds for window events (closing, minimise etc.) currently no sounds are installed for any theme (advanced users only)
- showWorldTaskbar hides or shows the "task bar" at the bottom of the screen. Currently, for new/embedded projects, this must be selected on a per-project basis (local mode not functional).
- generalizedYellowButtonMenu though an existing preference, should be disabled if you want the right-click (yellow button) menu for tasks in the taskbar
Examples:
Use the Preference Browser to change themes or evaluate the following:
- Dialog examples
- UITheme exampleDialogs
- UITheme exampleBasicControls
- UITheme exampleColorControls
- UITheme exampleOtherControls
- UITheme exampleGroups
- UITheme closeExampleDialogs
- Theme examples:
- UIThemeVistary beCurrent.
- UIThemeSoftSqueak beCurrent.
- UIThemeStandardSqueak beCurrent.
- UIThemeWatery beCurrent.
Things to try
- Find a class, say "test". The dialog for the entry of the classname fragment is a new dialog (escape to cancel, or 'n' on the keyboard. Return to accept). The list of classes with "test" in the name is extensive, but now fits neatly on the screen.
- Place some .jpg files in your Squeak directory with names matching the theme names (case sensitive). When a theme is selected the image will be used as a "desktop" background. E.g. "Vistary.jpg".
- If you have the "diff tools" loaded then try using the versions browser on a method that has a few versions. Select an older version and click the "compare to current" button.
- Again, with "diff tools" loaded. Have a play around with Monticello's changes and merge tools (now using the "diff tools").
Comments, defects and possible improvements:
- Task bar does not work in a Project (see above and below "the UITheme preference must be toggled to see the SystemWindow bar in a new project")
- Task bar continually eats up desk space as more and more applications are started (changed to shrink things a bit as more "tasks" accumulate")
- Under Linux need to generate another event for Task Switcher to work. (Although, Brad hasn't seen the Task Switcher work on Linux)
- User text focus follows the mouse cursor. There are now extra options in the current Polymorph. Two extra preferences added:
- mouseClickForKeyboardFocus: changes for making the #mouseEnter behaviour (i.e take keyboard focus) optional for most basic morphs.
- windowsActiveOnFirstClick: allows the first click on an inactive window to properly propagate to the clicked morph after activating its containing window.
- Should the UIThemes be available as selections in the usually places: e.g. the Squeak Tab on the left or the Theme... button in the Preference Browser and Preferences window? (In recent versions the Preference Browser "theme.." button has been renamed to "presets..." to avoid some confusion, providing access to the existing colour presets).
- A dotted border indicates the current keyboard focus... Currently in an empty text pane a dotted line (to indicate current keyboard focus) appears around a single line instead of the entire text pane (can be changed via externalFocusForPluggableText preference).
- When opening a new morphic project, the UITheme preference must be toggled to see the SystemWindow bar in a new project. - "Has van der Krieken" (should now work in latest versions)
- Suggest a preference to turn on/off the taskbar option. showWorldTaskbar only hides the task bar, it doesn't restore windows to their traditional position on the desktop (although new windows work.) (fixed in current version).
- When right clicking on a window in the task bar, the menu of the task bar appears rather than a "maximize, min, close" dialog of the window, as one would expect (when generalizedYellowButtonMenu is enabled).
- Version 254 onwards includes edge grips for window resizing (by popular demand!). Corner grips to be themed via factory methods in the future. Double-click in titlebar now performs maximize/restore.
- From version 254, on SqueakSource - work-in-progress for a "Watery" theme - Mac Aqua basis, only fair given Squeak's roots!
- Milestone (at least numerically) version 300 on SqueakSource. Mostly nicer filtering behaviour with PopupChoiceDialogWindow (used by ToolBuilder integration for showing sender/implementors etc).
- SystemWindows have a new menu option (Widgets version 308 onwards) for "about". Shows the window's model class comment, if present. Thanks to Michael Davies for the suggestion.
- UI Enhancements has now been renamed to Polymorph in preparation for integration into the Pharo base image.
- Watery2 theme now using composited forms for buttons.