wiki:APP_BASIC_MENUS_R0
Last modified 16 years ago Last modified on 08/26/09 16:58:58

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=APP_BASIC_MENUS_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

Define what menus are needed for Sophie. Try to keep the menus as clean and understandable as possible.

Refactor the menus for Sophie to use the new base menu library developed in BASE_MENUS_R0. The current menus are found in org.sophie2.main.view.menus. This code should be changed to use the new extension point.

Task requirements

  • Define the base application menus
  • Create a convention of menu items, where should they be put, what should be underlined, where to put "...", how to align text.
  • Put the convention in a wiki page and discuss it with the whole team
  • Apply the new menu design.
  • Define where extensions should put their menu items - for Export As menu, Insert menu, Skins menu
  • Make inactive menu items grey - marked in implementation idea.

Task result

The result of this task is code and menu design

Implementation idea

  • File
    • New Book... Ctrl+N
    • Open Book... Ctrl+O
    • Close Book Ctrl+W
    • Separator
    • Save Book Ctrl+S
    • Save Book As... Ctrl+Shift+S
    • Save As Template
    • Export Book As >
      • PDF...
      • HTML...
    • Separator
    • Print
    • Print to file
    • Separator
    • Book Properties...
    • Separator
    • Quit Sophie2 Ctrl+W
  • Edit
    • Undo Ctrl+Z
    • Redo Ctrl+Y
    • Separator
    • Cut Ctrl+X
    • Copy Ctrl+C
    • Paste Ctrl+V
    • Delete Delete
    • Separator
    • Book Title (no need for "set" as it is implied by being in the Edit menu)
    • Page Dimensions
  • Insert
    • Text Ctrl+Alt+T
    • Image... Ctrl+Alt+I
    • Video... Ctrl+Alt+V
    • Audio Record... Ctrl+Alt+R
    • Audio... Ctrl+Alt+A
    • PDF... Ctrl+Alt+P
    • Browser Ctrl+Alt+B

  • View
    • Normal Mode
    • Full Screen Mode F11
  • Skins
    • Default Skin
    • Alternative Skin
  • Window
    • Cascade
    • Tile
    • Separator
    • <List Open Books>
  • Help
    • Help Contents F1
    • Send an Error Report...
    • About Sophie
  • In Skins currently selected skin should be inactive.
  • In View current view should be inactive.

BASE_MENUS_R0

How to demo

  • Show convention. It must be part of the documentation
  • Show the refactored menus.

Design

Basic Menu Items order/style will be defined by a convention (which will be put for a public discussion – wiki page).

  • In every class that extends AppMenuItem class will be introduced method called defineSkin which specifies values to certain properties (like title, tooltips, shortcuts, mnemonics, etc.) of the skin's element - the item. It will get ElementSkinPart object as an argument, and will use it to define properties needed. Example implementation of the method for ExportToPDFItem:
@SkinPartDef
private static void defineSkin(ElementSkinPart part) {
	part.add(TITLE_PROP_ID, "PDF..."); //title property defined as "PDF"
 	part.add(TOOL_TIP_PROP_ID, "Exports current book to pdf file"); //Tool tip property defined
	part.add(MNEMONIC_PROP_ID, KeyEvent.VK_P); //Mnemonic - i.e. when P is pressed, combined with Alt.
}
  • Classes that will be affected by this change are as follow:
    • FileMenu
      • NewBookItem
      • OpenBookItem
      • CloseBookItem
      • BookPropertiesItem
      • SaveBookAsItem
      • SaveBookItem
      • CloseBookItem
    • EditMenu
      • RedoItem
      • UndoItem
      • SetBookTitleItem
      • SetPageSizeItem
      • ShowConnectionItem
    • InsertMenu
      • InsertPDFItem
      • InsertImageItem
      • InsertAudioItem
      • InsertAudioRecordItem
      • InsertVideoItem
      • InsertRtfItem
      • InsertBookItem
      • InsertPlainTextItem
      • InsertHtmlItem
    • ViewMenu
      • NormalModeItem
      • FullScreenItem
    • Skins
      • DefaultSkinItem
      • AlternativeSkinItem
    • WindowMenu
      • CascadeItem
      • TileItem
    • HelpMenu
      • HelpContentsItem
      • BugReportItem
      • AboutItem
      • InspecturMenuItem

  • A refactoniring will be needed, so every Item has the definition of its properties in itself, not in its Module class. (optional)
  • Items will be extracted in a specific module (one that has same functionality as the item itself), if such exists and register them accordinaly:
    • ExportToPDFItem to extra.func.print.pdf.export module
    • InsertPDFItem to extra.func.pdf.view module
    • InsertImageItem to extra.func.image.view module
    • InsertAudioItem to extra.func.media.view module
    • InsertAudioRecordItem to extra.func.media.view.controls module
    • InsertVideoItem to extra.func.media.view module
    • InsertRtfItem to extra.func.rtf.view module
    • InsertBookItem to extra.func.embedded.view module
    • InsertPlainTextItem to extra.func.plain.view module
    • InsertHtmlItem to extra.func.html.view module
    • ExportAsHtmlItem to extra.func.html module
    • InsertBrowserItem to extra.func.browser.view module
    • InsertScriptItem to extra.func.scripting.view module
    • InsertScriptFileItem to extra.func.scripting.view module
  • Specific (logical and intuitive) order of the Menus will be implemented:
    • File
    • Edit
    • Insert
    • View
    • Skins
    • Window
    • Help
  • Following shortcuts will be introduced using property ACCELERATOR_PROP_ID of ElementSkinPart argument of the defineSkin method:
    • Ctrl+N - New Book
    • Ctrl+O - Open Book
    • Ctrl+W - Close Book
    • Ctrl+S - Save Book
    • Ctrl+Shift+S - Save Book As
    • Ctrl+Z - Undo
    • Ctrl+Y - Redo
    • Ctrl+X - Cut
    • Ctrl+C - Copy
    • Ctrl+V - Paste
    • Ctrl+Alt+T - Insert Text
    • Ctrl+Alt+I - Insert Image
    • Ctrl+Alt+V - Insert Video
    • Ctrl+Alt+R - Insert Audio Record
    • Ctrl+Alt+A - Insert Audio
    • Ctrl+Alt+P - Insert PDF
    • Ctrl+Alt+B - Insert Browser
    • F11 - Full Screen Mode
    • F1 - Help

Example for defining CTRL + P shortcut:

@SkinPartDef
private static void defineSkin(ElementSkinPart part) {
	part.add(ACCELERATOR_PROP_ID, KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK)); //Shortcut is added CTRL+P
}
  • Will be added "..." suffix of Item's property TITLE_PROP_ID for Items that, when clicked, open a Dialog.

Implementation

Working branch http://www.sophie2.org/trac/browser/branches/private/stefan/sophie2-platform. Code:

Merged to the trunk in [5691].

Testing

Comments

(Write comments for this or later revisions here.)