/// <summary> /// A form to display and change element and argument properties /// </summary> /// <param name="tv">Tree view connected to the argument</param> /// <param name="ami">Argument interface object</param> public FormProperties(TreeView tv, ArgMapInterface ami) { // // Required for Windows Form Designer support // InitializeComponent(); if (tv.SelectedNode != null) { currentNode = tv.SelectedNode; Node n; bool dateEnabled; n = (Node)currentNode.Tag; this.textBoxComment.Text = n.getComment(); // get current text this.labelElementTextDisplay.Text = n.EditorText; // set up date field dateEnabled = ami.CurrentArg.CreationDateDefined; this.dateTimePickerCreated.Checked = dateEnabled; if (dateEnabled) { this.dateTimePickerCreated.Value = ami.CurrentArg.CreationDate; } // Created & Modified time & date this.labelCreatedDateTime.Text = n.Created.ToShortDateString() + " " + n.Created.ToShortTimeString(); this.labelModifiedDateTime.Text = n.Modified.ToShortDateString() + " " + n.Modified.ToShortTimeString(); } this.tv = tv; this.ami = ami; this.textBoxAuthor.Text = ami.CurrentArg.Author; commentChanged = false; FormProperties.isActive = true; }
/// <summary> /// A constructor for the FormFullStops dialog box. /// </summary> /// <param name="ami"></param> public FormFullStops(ArgMapInterface ami) { // // Required for Windows Form Designer support // InitializeComponent(); this.head = ami.CurrentArg.findHead();; this.tv = ami.getTreeView(); this.ami = ami; }
// ************ Paste from Clipboard ************ private TreeNode addNode(TreeNode tn, string text) { Node n, nn; TreeNode ntn; ntn = new TreeNode(text); n = new Node(text); ntn.Tag = n; // add node to payload ArgMapInterface.setImageIndex(ntn, n); tn.Nodes.Add(ntn); // add tree node to tree nn = (Node)tn.Tag; nn.addKid(n); return(ntn); }
/// <summary> /// Prints a text view of the current map. /// </summary> /// <param name="dummy"></param> /// <param name="a"></param> /// <param name="rangeStart"></param> /// <param name="rangeFinish"></param> /// <param name="showPageNumber"></param> public PrintTree(bool dummy, ArgMapInterface a, int rangeStart, int rangeFinish, bool showPageNumber) { index = 0; a.CurrentArg.referenceTree(); pd = a.Pd; // set print document/setup pageNumber = 1; flatTree = new ArrayList(); flattenTree(a.getTreeView().Nodes[0]); printFont = new Font("Arial", 10); this.printevent = new PrintPageEventHandler(pd_PrintPage); pd.PrintPage += printevent; this.rangeStart = rangeStart; this.rangeFinish = rangeFinish; this.firstPage = true; this.showPageNumber = showPageNumber; }
/// <summary> /// Prints the graphical view of the current map /// </summary> /// <param name="a"></param> /// <param name="rangeStart">First page</param> /// <param name="rangeFinish">Last page</param> /// <param name="showPageNumber">Displays the word Page and the page number.</param> /// <param name="scaleToPage">Scale the map to the current page size.</param> public PrintTree(ArgMapInterface a, int rangeStart, int rangeFinish, bool showPageNumber, bool scaleToPage) { this.a = a; pd = a.Pd; pagesHigh = 0; pagesWide = 0; cpx = cpy = 0; pageNumber = 1; printevent = new PrintPageEventHandler(pd_PrintPageGraphic); pd.PrintPage += printevent; this.rangeStart = rangeStart; this.rangeFinish = rangeFinish; this.firstPage = true; this.showPageNumber = showPageNumber; this.scaleToPage = scaleToPage; }
/// <summary> /// Transformation (using XSLT) dialog box /// </summary> /// <param name="a"></param> public TransformDlg(ArgMapInterface a) { // // Required for Windows Form Designer support // InitializeComponent(); ami = a; textBox1.Text = a.CurrentFilename; System.IO.Directory.GetCurrentDirectory(); Options.OptionsData od = Options.OptionsData.Instance; this.textBoxXslFile.Text = od.getlastXSL(); this.textBoxXslOut.Text = od.getlastXSLoutput(); correctOutputFile(); }
/// <summary> /// Paints the graphical view on a Windows form /// </summary> /// <param name="e">Standard PaintEventArgs</param> /// <param name="a">Full context of the current argument</param> public void drawTree(System.Windows.Forms.PaintEventArgs e, ArgMapInterface a) { Options.OptionsData d = Options.OptionsData.Instance; if (!d.ShowGraphicalView) { e.Graphics.Clear(Color.White); return; } try { e.Graphics.PageScale = 1.0F; drawTree(e.Graphics, a.CurrentArg.findHead()); } catch (Exception ex) { MessageBox.Show("drawTree error: " + ex.StackTrace); } }
/// <summary> /// Open an argument file with a standard open file dialog box. /// </summary> /// <returns></returns> public ArgMapInterface openArgument() { System.Windows.Forms.OpenFileDialog openFileDialog1; ArgMapInterface ai; // if this object needs to be re-created DialogResult r; string fn; openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); openFileDialog1.Filter = "Argumentative files (*.axl)|*.axl|Reasonable files (*.re3)|*.re3" + "|Araucaria (*.aml;*.scm)|*.aml;*.scm|All Argument files (.axl;.re3;.rtnl)|*.axl;*.re3;*.rtnl"; openFileDialog1.FilterIndex = 4; try { r = openFileDialog1.ShowDialog(); } catch { r = DialogResult.Cancel; } if (r == DialogResult.OK) { fn = openFileDialog1.FileName; if (fn.ToLower().EndsWith(".axl") || fn.ToLower().EndsWith(".re3")) { ai = new ArgMapInterface(false, theTV, editArea); ai.loadAXLorRE3(fn); currentfilename = fn; return(ai); } else if (fn.ToLower().EndsWith(".aml")) // Araucaria file { Araucaria ara = new Araucaria(); ara.load(fn); CurrentArg.setArg(ara.A.findHead()); loadTree(); currentfilename = fn; return(this); } else if (fn.ToLower().EndsWith(".scm")) // Read scheme set { Araucaria ara = new Araucaria(); MessageBox.Show("Araucaria Scheme Sets are read but are not yet supported."); ara.load(fn); // TODO What to do with the scheme set } else if (fn.ToLower().EndsWith(".rtnl")) // Read scheme set { Rationale rat = new Rationale(); Argument arat = rat.importFromRationale(fn); if (arat == null) { return(null); } CurrentArg.setArg(arat.findHead()); loadTree(); currentfilename = fn; return(this); } else { MessageBox.Show(String.Format("Do not know how to open file type {0}", System.IO.Path.GetExtension(fn))); } } return(null); }
/// <summary> /// Delete command constructor /// </summary> /// <param name="a"></param> public deleteCommand(ArgMapInterface a) { instance = a; oldNode = null; }