Exemple #1
0
        private static void CommitValuesToForm(OptionHandler handler, GraphEditorForm form)
        {
            GraphControl         gc   = form.GraphControl;
            IGraph               g    = form.Graph;
            GraphEditorInputMode geim = form.GraphEditorInputMode;

            OptionGroup controlGroup = handler.GetGroupByName(UI_DEFAULTS);

            OptionGroup graphGroup   = handler.GetGroupByName(GRAPH_SETTINGS);
            OptionGroup sharingGroup = graphGroup.GetGroupByName(SHARING_SETTINGS);
            OptionGroup miscGroup    = handler.GetGroupByName(MISC_SETTINGS);

            gc.HitTestRadius           = (double)controlGroup[HitTestRadius].Value;
            geim.AutoRemoveEmptyLabels = (bool)controlGroup[AutoRemoveEmptyLabels].Value;

            form.GridWidth    = (int)controlGroup[GridWidth].Value;
            form.GridSnapType = (GridSnapTypes)controlGroup[GridSnapeType].Value;
            form.GridVisible  = (bool)controlGroup[GridVisible].Value;

            if (g != null)
            {
                g.NodeDefaults.Labels.AutoAdjustPreferredSize = g.EdgeDefaults.Labels.AutoAdjustPreferredSize = (bool)graphGroup[AutoAdjustPreferredLabelSize].Value;
                g.NodeDefaults.Ports.AutoCleanUp = g.EdgeDefaults.Ports.AutoCleanUp = (bool)graphGroup[AutoCleanupPorts].Value;

                g.NodeDefaults.ShareStyleInstance                  = (bool)sharingGroup[ShareDefaultNodeStyleInstance].Value;
                g.EdgeDefaults.ShareStyleInstance                  = (bool)sharingGroup[ShareDefaultEdgeStyleInstance].Value;
                g.NodeDefaults.Labels.ShareStyleInstance           = (bool)sharingGroup[ShareDefaultNodeLabelStyleInstance].Value;
                g.EdgeDefaults.Labels.ShareStyleInstance           = (bool)sharingGroup[ShareDefaultEdgeLabelStyleInstance].Value;
                g.NodeDefaults.Ports.ShareStyleInstance            = g.EdgeDefaults.Ports.ShareStyleInstance = (bool)sharingGroup[ShareDefaultPortStyleInstance].Value;
                g.NodeDefaults.Labels.ShareLayoutParameterInstance = (bool)sharingGroup[ShareDefaultNodeLabelModelParameter].Value;
                g.EdgeDefaults.Labels.ShareLayoutParameterInstance = (bool)sharingGroup[ShareDefaultEdgeLabelModelParameter].Value;
            }
            UndoEngine undoEngine = form.Graph.GetUndoEngine();

            if (undoEngine != null)
            {
                undoEngine.Size = (int)miscGroup[UndoEngine_Size].Value;
            }
        }