Beispiel #1
0
 private void Props_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
 {
     if (rule != null)
     {
         grammarRuleDisplay gDisplay = (grammarRuleDisplay)graphControl.FindForm();
         rule.updateGraphControl(gDisplay.graphControlLHS, gDisplay.graphControlRHS,
                                 gDisplay.globalLabelsLText, gDisplay.globalLabelsRText);
     }
     else
     {
         graphDisplay gDisplay = (graphDisplay)graphControl.FindForm();
         graph.updateGraphControl(graphControl, gDisplay.globalLabelsText);
     }
 }
Beispiel #2
0
        public void saveCurrentItem_Click(object sender, EventArgs e)
        {
            string filename;
            string name;

            if (this.ActiveMdiChild.GetType() == typeof(graphDisplay))
            {
                graphDisplay saveDisplay = (graphDisplay)this.ActiveMdiChild;
                saveDisplay.graphDisplay_Enter(sender, e);
                name = saveDisplay.graph1.name;
                try { filename = getSaveFilename("graph", name, Program.settings.workingDirectory); }
                catch { filename = ""; }
                if (filename != "" && filename != null)
                {
                    designGraph.saveGraphToXml(filename, saveDisplay.graphControl1, saveDisplay.graph1);
                }
            }
            else if (this.ActiveMdiChild.GetType() == typeof(grammarRuleDisplay))
            {
                grammarRuleDisplay saveDisplay = (grammarRuleDisplay)this.ActiveMdiChild;
                name = saveDisplay.rule.name;
                try { filename = getSaveFilename("grammar rule", name, Program.settings.rulesDirectory); }
                catch { filename = ""; }
                if (filename != "" && filename != null)
                {
                    grammarRule.saveRuleToXml(filename, saveDisplay.rule, saveDisplay.graphControlLHS,
                                              saveDisplay.graphControlRHS, saveDisplay.globalLabelsLText, saveDisplay.globalLabelsRText);
                }
            }
            else if (this.ActiveMdiChild.GetType() == typeof(ruleSetDisplay))
            {
                ruleSetDisplay saveDisplay = (ruleSetDisplay)this.ActiveMdiChild;
                name = saveDisplay.ruleset.name;
                try { filename = getSaveFilename("rule set", name, Program.settings.rulesDirectory); }
                catch { filename = ""; }
                if (filename != "" && filename != null)
                {
                    ruleSet.saveRuleSetToXml(filename, saveDisplay.ruleset);
                }
            }
            else
            {
                MessageBox.Show("Please select an window that contains a graph, rule, or rule set.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #3
0
 private void setSeedMenuItem_Click(object sender, EventArgs e)
 {
     if ((this.ActiveMdiChild == null) || (this.ActiveMdiChild.GetType() != typeof(graphDisplay)))
     {
         MessageBox.Show("The active window is not a graph.",
                         "Seed must be a graph.",
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else if ((Program.seed == null) ||
              (DialogResult.Yes == MessageBox.Show("The graph " +
                                                   Program.seed.name + " is already loaded as the seed."
                                                   + " Replace it with the active graph?", "Seed already defined.",
                                                   MessageBoxButtons.YesNo, MessageBoxIcon.Information)))
     {
         graphDisplay activeGD = (graphDisplay)this.ActiveMdiChild;
         Program.seed = activeGD.graph1;
     }
 }
Beispiel #4
0
 private void printPreviewMenuItem_Click_1(object sender, EventArgs e)
 {
     if ((this.ActiveMdiChild.GetType()) == (typeof(graphDisplay)))
     {
         graphDisplay  g = this.ActiveMdiChild as graphDisplay;
         PrintDocument p = new PrintDocument();
         p.PrintPage += new PrintPageEventHandler(g.graphControl1.PrintCanvas);
         PrintPreviewDialog prev = new PrintPreviewDialog();
         prev.Document = p;
         p.DefaultPageSettings.Color          = true;
         p.DefaultPageSettings.Landscape      = true;
         p.DefaultPageSettings.Margins.Left   = 100;
         p.DefaultPageSettings.Margins.Right  = 100;
         p.DefaultPageSettings.Margins.Top    = 100;
         p.DefaultPageSettings.Margins.Bottom = 100;
         prev.ShowDialog(g);
     }
     else
     {
         MessageBox.Show("Error", "Please select a graph", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }