Beispiel #1
0
        public SearchPanel(DiagramView diagramView)
        {
            this.diagramView = diagramView;

            InitializeComponent();
            InitializeSearchPanelComponent();
        }
        public bool editing = false; // panel je zobrazený

        #endregion Fields

        #region Constructors

        public EditLinkPanel(DiagramView diagramView)
        {
            this.diagramView = diagramView;

            InitializeComponent();

            this.Hide();
        }
Beispiel #3
0
        public void PopupAddItemsAction(Diagram.DiagramView diagramview, ToolStripMenuItem pluginsItem)
        {
            this.createDirectoryItem        = new ToolStripMenuItem();
            this.createDirectoryItem.Name   = "editItem";
            this.createDirectoryItem.Text   = "CreateDirectory";
            this.createDirectoryItem.Click += new System.EventHandler((sender, e) => this.CreateDirectoryItem_Click(sender, e, diagramview));

            pluginsItem.DropDownItems.Add(this.createDirectoryItem);
        }
Beispiel #4
0
        public Popup(System.ComponentModel.IContainer container, DiagramView diagramView)
            : base(container)
        {
            this.diagramView = diagramView;

            InitializeComponent();

            #if DEBUG
            items["consoleItem"].Visible = true;
            items["coordinatesItem"].Visible = true;
            #endif
            items["restoreWindowItem"].Checked = this.diagramView.diagram.options.restoreWindow;
            items["gridItem"].Checked = this.diagramView.diagram.options.grid;
            items["bordersItem"].Checked = this.diagramView.diagram.options.borders;
            items["coordinatesItem"].Checked = this.diagramView.diagram.options.coordinates;
            items["readonlyItem"].Checked = this.diagramView.diagram.options.readOnly;
        }
Beispiel #5
0
        public void CreateDirectoryItem_Click(object sender, EventArgs e, Diagram.DiagramView diagramview)
        {
            string DiagramPath = diagramview.diagram.FileName.Trim();

            if (DiagramPath == "" && !Os.FileExists(DiagramPath))
            {
                return;
            }

            string NewDirectoryPath = Os.Combine(Os.GetFileDirectory(DiagramPath), "test");

            Os.CreateDirectory(NewDirectoryPath);

            Node newrec = diagramview.CreateNode(diagramview.actualMousePos.Clone());

            newrec.SetName("test");
            newrec.link = NewDirectoryPath;
            diagramview.diagram.Unsave("create", newrec, diagramview.shift, diagramview.currentLayer.id);
        }
Beispiel #6
0
 /// <summary>
 /// add diagram view to list of all views</summary>
 public void addDiagramView(DiagramView view)
 {
     this.DiagramViews.Add(view);
 }
 public void firstPluginItem_Click(object sender, EventArgs e, Diagram.DiagramView diagramView)
 {
     log.Write("FirstPlugin: popup item click");
 }
        public bool doUndo(DiagramView view = null)
        {
            if (operations.Count() == 0)
            {
                return false;
            }

            int group = 0;

            bool result = false;

            do
            {
                UndoOperation operation = operations.First();

                // first restore position where change occurred
                if (view != null && !view.isOnPosition(operation.position, operation.layer))
                {
                    view.goToShift(operation.position);
                    view.goToLayer(operation.layer);
                    view.Invalidate();
                    return false;
                }

                // process all operations in same group
                if (group != 0 && operation.group != group)
                {
                    group = 0;
                    break;
                }

                group = operation.group;

                if (operation.type == "delete")
                {
                    this.doUndoDelete(operation);
                    reverseOperations.Push(operation);
                }

                if (operation.type == "create")
                {
                    this.doUndoCreate(operation);
                    reverseOperations.Push(operation);
                }

                if (operation.type == "edit" ||
                    operation.type == "move" ||
                    operation.type == "changeLineColor" ||
                    operation.type == "changeLineWidth" ||
                    operation.type == "changeNodeColor"
                )
                {
                    Nodes nodes = new Nodes();
                    foreach (Node node in operation.nodes)
                    {
                        nodes.Add(this.diagram.GetNodeByID(node.id));
                    }

                    Lines lines = new Lines();
                    foreach (Line line in operation.lines)
                    {
                        lines.Add(this.diagram.getLine(line.start, line.end));
                    }

                    UndoOperation roperation = new UndoOperation(
                        operation.type,
                        nodes,
                        lines,
                        operation.group,
                        operation.position,
                        operation.layer
                    );
                    reverseOperations.Push(roperation);
                    this.doUndoEdit(operation);
                }

                operations.Pop();
                result = true;
            } while (group != 0 && operations.Count() > 0);

            if (result)
            {
                this.saved--;
                if (!this.saveLost && this.saved == 0)
                {
                    this.diagram.restoresave();
                }
                else
                {
                    this.diagram.unsave();
                }
            }

            return result;
        }
Beispiel #9
0
        // close view
        public void CloseView(DiagramView view)
        {
            this.DiagramViews.Remove(view);
            main.removeDiagramView(view);

            foreach (DiagramView diagramView in this.DiagramViews) {
                if (diagramView.parentView == view) {
                    diagramView.parentView = null;
                }
            }

            this.CloseDiagram();
        }
Beispiel #10
0
        /// <summary>
        /// show views if last visible view is closed</summary>
        public void showIfIsLastViews(DiagramView diagramView = null)
        {
            bool someIsVisible = false;
            foreach (DiagramView view in DiagramViews)
            {
                if (view.Visible && diagramView != view)
                {
                    someIsVisible = true;
                    break;
                }
            }

            if (!someIsVisible)
            {
                showViews();
            }
        }
Beispiel #11
0
 /// <summary>
 /// Set current diagramView for context in script
 /// </summary>
 /// <param name="diagramView"></param>
 public void setDiagramView(DiagramView diagramView)
 {
     this.diagramView = diagramView;
 }
Beispiel #12
0
 public Breadcrumbs(DiagramView diagramView)
 {
     this.diagramView = diagramView;
 }
Beispiel #13
0
        private string lastEvent = ""; // remember last event in console (for remove duplicate events)

        #endif

        #region Constructors

        /*************************************************************************************************************************/
        // FORM Constructor
        public DiagramView(Main main, Diagram diagram, DiagramView parentView = null)
        {
            this.main = main;
            this.diagram = diagram;
            this.parentView = parentView;

            // initialize layer history
            this.currentLayer = this.diagram.layers.getLayer(0);
            this.layersHistory.Add(this.currentLayer);

            this.InitializeComponent();

            // initialize popup menu
            this.PopupMenu = new Popup(this.components, this);

            // initialize edit panel
            this.editPanel = new EditPanel(this);
            this.Controls.Add(this.editPanel);

            // initialize edit link panel
            this.editLinkPanel = new EditLinkPanel(this);
            this.Controls.Add(this.editLinkPanel);

            // initialize breadcrumbs
            this.breadcrumbs = new Breadcrumbs(this);

            // move timer
            this.animationTimer.Tick += new EventHandler(animationTimer_Tick);
            this.animationTimer.Interval = 10;
            this.animationTimer.Enabled = false;

            // move timer
            this.zoomTimer.Tick += new EventHandler(zoomTimer_Tick);
            this.zoomTimer.Interval = 10;
            this.zoomTimer.Enabled = false;

            // lineWidthForm
            this.lineWidthForm.trackbarStateChanged += this.resizeLineWidth;

            //colorPickerForm
            this.colorPickerForm.changeColor += this.changeColor;

            // custom diagram icon
            if (this.diagram.options.icon != "")
            {
                this.Icon = Media.StringToIcon(this.diagram.options.icon);
            }
        }
Beispiel #14
0
 // NODES DELETE SELECTION
 public void DeleteSelectedNodes(DiagramView DiagramView)
 {
     if (!this.diagram.options.readOnly)
     {
         if (DiagramView.selectedNodes.Count() > 0)
         {
             this.diagram.DeleteNodes(DiagramView.selectedNodes, this.shift, this.currentLayer.id);
         }
     }
 }
Beispiel #15
0
 /*************************************************************************************************************************/
 // UNDO
 // undo
 public void doUndo(DiagramView view = null)
 {
     this.undoOperations.doUndo(view);
 }
Beispiel #16
0
 /// <summary>
 /// hide diagram views</summary>
 public void hideViews(DiagramView diagramView = null)
 {
     foreach (DiagramView view in DiagramViews)
     {
         if (view != diagramView) {
             view.Hide();
         }
     }
 }
Beispiel #17
0
 /// <summary>
 /// remove diagram view from list of all diagram views</summary>
 public void removeDiagramView(DiagramView view)
 {
     this.DiagramViews.Remove(view);
 }
Beispiel #18
0
 public void PopupOpenAction(Diagram.DiagramView diagramview, ToolStripMenuItem pluginsItem)
 {
     this.createDirectoryItem.Enabled = !diagramview.diagram.IsReadOnly();
 }
Beispiel #19
0
        /// <summary>
        /// hide diagram views except diagramView</summary>
        public void switchViews(DiagramView diagramView = null)
        {
            bool someIsHidden = false;
            foreach (DiagramView view in DiagramViews)
            {
                if (!view.Visible)
                {
                    someIsHidden = true;
                    break;
                }
            }

            if (someIsHidden)
            {
                showViews();
            }
            else
            {
                hideViews(diagramView);
            }
        }
Beispiel #20
0
 /*************************************************************************************************************************/
 // VIEW
 // open new view on diagram
 public DiagramView openDiagramView(DiagramView parent = null, Layer layer = null)
 {
     DiagramView diagramview = new DiagramView(main, this, parent);
     diagramview.setDiagram(this);
     this.DiagramViews.Add(diagramview);
     main.addDiagramView(diagramview);
     this.SetTitle();
     diagramview.Show();
     if (layer != null)
     {
         diagramview.goToLayer(layer.id);
     }
     return diagramview;
 }