| Summary: | [diagram] Support turning on/off grid in the diagram in the definition language | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Shenxue Zhou <shenxue.zhou> |
| Component: | Sapphire | Assignee: | Shenxue Zhou <shenxue.zhou> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | gregory.amerson, konstantin, ram.venkataswamy |
| Version: | unspecified | Keywords: | usability |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Shenxue Zhou
In sdef, let's have an implied element property for grid definition, with a single visible boolean inside it. In the future, we will likely want to add settings for spacing, color, etc. This will gives us place to do so. <grid> <visible>true</visible> </grid> I am fine with defaulting visible to false. Make sure that when grid is not visible, that there is no snap-to-grid either. Once we have support for actions, I'd like to see a grid visibility toggle in the editor context menu. The grid definition settings in sdef should be treated as initial values that user can change. The grid property has been added to the diagram page definition. This feature works as the following: 1. In diagram page def, user can specify whether grid is shown using <grid> <visible>true</visible> </grid> under <diagram-page> element. Its default value is "false". 2. A Grid toggle action has been added to the diagram context menu. 3. When user toggles the grid using the above action, the diagram editor is marked "dirty" and the grid visibility is saved in diagram layout file. 4. When a diagram is created, the grid visibility is controlled by the grid visible element as described in 1. 5. When a diagram is opened, the grid visibility is controlled by what's persisted in the diagram layout file. Verified this with the latest build. One question I had. Should we add a "View > Show Grid" checkbox option in the global menu bar that is only visible when the diagram editor is focused? (In reply to comment #3) > Verified this with the latest build. One question I had. Should we add a > "View > Show Grid" checkbox option in the global menu bar that is only visible > when the diagram editor is focused? Yes we should. Graphiti's DiagramEditorInternal class actually registers the grid action to the view menu. I didn't override that. But in the multipage sapphire diagram editor, I don't see the "view" menu. Need further investigation inside the action registry... verified with build 0.3.0.201105261624 1. The menu item should be labeled "Show Grid" rather than just "Grid". 2. Looking at the action definition, I see the type specified as "push" rather than "toggle", yet the menu action is clearly behaving like a toggle. That tells me that there is something questionable in the implementation. 3. Let's change action id from "Sapphire.Diagram.ToggleGrid" to "Sapphire.Diagram.Grid.Toggle". We may have more grid-related actions in the future, so it seems prudent to set a side a namespace. The grid action handler has been reworked so that it doesn't require SapphireDiagramEditor to be passed in. As a result, in SapphireDiagramEditorContextMenuProvider class, no special code is required for grid action handler. Found two problems during verification. 1. Item #3 from Comment #6 was not done. I took care of it. 2. There was still a reference to the toggle action remaining in the SapphireDiagramEditorContextMenuProvider. There didn't appear to be a reason for this dependency, so I removed it. Verified functionality of the toggle and saving of the toggle state after making the above changes. Closing. |