/// <summary> /// change the head part of diagram text to actual values. called after options dialog accept button /// </summary> /// <returns>nothing</returns> public override void RedrawRescaled() { int startPos = 0; int endPos = 0; StringBuilder temp = new StringBuilder(); editor.Update = true; /************************************************* * * FONT * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("Font: \""); temp.Append(MSCItem.ItemFont.FontFamily.Name); temp.Append("\", \""); temp.Append(MSCItem.ItemFont.Size.ToString()); temp.Append("\", \""); if (MSCItem.ItemFont.Style == System.Drawing.FontStyle.Regular) { temp.Append("Regular"); } else { if (MSCItem.ItemFont.Bold == true) temp.Append("Bold "); if (MSCItem.ItemFont.Italic == true) temp.Append("Italic "); if (MSCItem.ItemFont.Strikeout == true) temp.Append("Strikeout "); if (MSCItem.ItemFont.Underline == true) temp.Append("Underline "); } temp.Append("\""); startPos = this.rtbMscEditor.Find("FONT:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; temp.Append("\n"); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = temp.ToString(); } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * PRINT FILENAME * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("PrintFileName: "); if (true == Worksheet.DrawFileName) temp.Append("yes"); else temp.Append("no"); startPos = this.rtbMscEditor.Find("PRINTFILENAME:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; temp.Append("\n"); } this.rtbMscEditor.Select(startPos, endPos - startPos); if (true == Worksheet.DrawFootLine) this.rtbMscEditor.SelectedText = temp.ToString(); else this.rtbMscEditor.SelectedText = ""; } else if (true == Worksheet.DrawFootLine) { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * PRINT CREATIONDATE * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("PrintCreationDate: "); if (true == Worksheet.DrawPrintDate) temp.Append("yes"); else temp.Append("no"); startPos = this.rtbMscEditor.Find("PRINTCREATIONDATE:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; temp.Append("\n"); } this.rtbMscEditor.Select(startPos, endPos - startPos); if (true == Worksheet.DrawFootLine) this.rtbMscEditor.SelectedText = temp.ToString(); else this.rtbMscEditor.SelectedText = ""; } else if (true == Worksheet.DrawFootLine) { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * PRINT DATE * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("PrintDate: "); if (true == Worksheet.DrawDate) temp.Append("yes"); else temp.Append("no"); startPos = this.rtbMscEditor.Find("PRINTDATE:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; temp.Append("\n"); } this.rtbMscEditor.Select(startPos, endPos - startPos); if (true == Worksheet.DrawFootLine) this.rtbMscEditor.SelectedText = temp.ToString(); else this.rtbMscEditor.SelectedText = ""; } else if (true == Worksheet.DrawFootLine) { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * DATE * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("Date: "); if ("" == Worksheet.Date.Trim()) temp.Append("\"\""); else temp.Append(Worksheet.Date); startPos = this.rtbMscEditor.Find("DATE:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = temp.ToString(); } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * PRINT VERSION * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("PrintVersion: "); if (true == Worksheet.DrawVersion) temp.Append("yes"); else temp.Append("no"); startPos = this.rtbMscEditor.Find("PRINTVERSION:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; temp.Append("\n"); } this.rtbMscEditor.Select(startPos, endPos - startPos); if (true == Worksheet.DrawFootLine) this.rtbMscEditor.SelectedText = temp.ToString(); else this.rtbMscEditor.SelectedText = ""; } else if (true == Worksheet.DrawFootLine) { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * VERSION * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("Version: "); if ("" == Worksheet.Version.Trim()) temp.Append("\"\""); else temp.Append(Worksheet.Version); startPos = this.rtbMscEditor.Find("VERSION:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = temp.ToString(); } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * PRINT COMPANY * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("PrintCompany: "); if (true == Worksheet.DrawCompany) temp.Append("yes"); else temp.Append("no"); startPos = this.rtbMscEditor.Find("PRINTCOMPANY:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; temp.Append("\n"); } this.rtbMscEditor.Select(startPos, endPos - startPos); if (true == Worksheet.DrawFootLine) this.rtbMscEditor.SelectedText = temp.ToString(); else this.rtbMscEditor.SelectedText = ""; } else if (true == Worksheet.DrawFootLine) { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * COMPANY * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("Company: "); if ("" == Worksheet.Company.Trim()) temp.Append("\"\""); else temp.Append(Worksheet.Company); startPos = this.rtbMscEditor.Find("COMPANY:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = temp.ToString(); } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * PRINT AUTHOR * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("PrintAuthor: "); if (true == Worksheet.DrawAuthor) temp.Append("yes"); else temp.Append("no"); startPos = this.rtbMscEditor.Find("PRINTAUTHOR:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; temp.Append("\n"); } this.rtbMscEditor.Select(startPos, endPos - startPos); if (true == Worksheet.DrawFootLine) this.rtbMscEditor.SelectedText = temp.ToString(); else this.rtbMscEditor.SelectedText = ""; } else if (true == Worksheet.DrawFootLine) { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * AUTHOR * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("Author: "); if ("" == Worksheet.Author.Trim()) temp.Append("\"\""); else temp.Append(Worksheet.Author); startPos = this.rtbMscEditor.Find("AUTHOR:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = temp.ToString(); } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * PRINT FOOTLINE * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("PrintFootLine: "); if (true == Worksheet.DrawFootLine) temp.Append("yes"); else temp.Append("no"); startPos = this.rtbMscEditor.Find("PRINTFOOTLINE:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = temp.ToString(); } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * LINEOFFSET * * ***********************************************/ /* startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("LINEOFFSET"); if (startPos>-1){ if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n',startPos)==-1){ endPos = this.rtbMscEditor.Text.Length; } else{ endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n',startPos); } this.rtbMscEditor.Select(startPos,endPos-startPos); this.rtbMscEditor.SelectedText = "LineOffset: " + MSC.VerticalOffset; } else{ this.rtbMscEditor.Select(0,0); this.rtbMscEditor.SelectedText = "LineOffset: " + MSC.VerticalOffset + "\n"; } */ /************************************************* * * BOTTOM MARGIN * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("MSCMARGINBOTTOM"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = ""; } /************************************************* * * RIGHT MARGIN * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("MSCMARGINRIGHT"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = ""; } /************************************************* * * TOP MARGIN * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("MSCMARGINTOP"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = ""; } /************************************************* * * LEFT MARGIN * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("MSCMARGINLEFT"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = ""; } /************************************************* * * PAGEMARGINS * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("PAGEMARGINS"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = "PageMargins: " + this.worksheet.LeftMargin.ToString() + ", " + this.worksheet.TopMargin.ToString() + ", " + this.worksheet.RightMargin.ToString() + ", " + this.worksheet.BottomMargin.ToString(); } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = "PageMargins: " + this.worksheet.LeftMargin.ToString() + ", " + this.worksheet.TopMargin.ToString() + ", " + this.worksheet.RightMargin.ToString() + ", " + this.worksheet.BottomMargin.ToString() + "\n"; } /************************************************* * * WIDTH * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("MSCWIDTH"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = ""; } /************************************************* * * HEIGHT * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("MSCHEIGHT"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = ""; } /************************************************* * *PAGESIZE * * ***********************************************/ temp.Remove(0, temp.Length); temp.Append("PageSize: "); if (worksheet.Size != Worksheet.WS_SIZE_USER_DEFINED) { switch (worksheet.Size) { case Worksheet.WS_SIZE_A0_ISO: temp.Append("A0, "); break; case Worksheet.WS_SIZE_A1_ISO: temp.Append("A1, "); break; case Worksheet.WS_SIZE_A2_ISO: temp.Append("A2, "); break; case Worksheet.WS_SIZE_A3_ISO: temp.Append("A3, "); break; case Worksheet.WS_SIZE_A4_ISO: temp.Append("A4, "); break; case Worksheet.WS_SIZE_A5_ISO: temp.Append("A5, "); break; } switch (worksheet.Layout) { case Worksheet.WS_LAYOUT_HORIZONTAL: temp.Append("H"); break; case Worksheet.WS_LAYOUT_VERTICAL: temp.Append("V"); break; } } else { // size user defined if (Output.AutosizeOutputWidth == true) { temp.Append("auto"); } else { temp.Append(worksheet.Width.ToString()); } if (Output.AutosizeOutputHeight == true) { temp.Append(", auto"); } else { temp.Append(", " + worksheet.Height.ToString()); } } startPos = this.rtbMscEditor.Find("PAGESIZE:", RichTextBoxFinds.WholeWord); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = temp.ToString(); } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = temp.ToString() + "\n"; } /************************************************* * * MSCSTYLE * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("MSCSTYLE"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = ""; } /************************************************* * * DIAGRAMSTYLE * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("DIAGRAMSTYLE"); string style = ""; if (MSC.Style == MscStyle.SDL) { style = "sdl"; } else if (MSC.Style == MscStyle.UML2) { style = "uml"; } if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = "DiagramStyle: " + style; } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = "DiagramStyle: " + style + "\n"; } /************************************************* * * MSCNAME * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("MSCNAME"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) + 1; } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = ""; } /************************************************* * * DIAGRAMSTYLE * * ***********************************************/ startPos = this.rtbMscEditor.Text.ToUpper().IndexOf("DIAGRAMNAME"); if (startPos > -1) { if (this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos) == -1) { endPos = this.rtbMscEditor.Text.Length; } else { endPos = this.rtbMscEditor.Text.ToUpper().IndexOf('\n', startPos); } this.rtbMscEditor.Select(startPos, endPos - startPos); this.rtbMscEditor.SelectedText = "DiagramName: " + MSC.DiagramName; } else { this.rtbMscEditor.Select(0, 0); this.rtbMscEditor.SelectedText = "DiagramName: " + MSC.DiagramName + "\n"; } editor.Update = false; editor.checkSyntaxAll(); generator.Clear(); Interpreter interpreter = new Interpreter(); InterpretException[] results = interpreter.InterpretDiagramText(this.rtbMscEditor.Text, generator, this); // interpret new .sc file this.WriteLog(results); base.RedrawRescaled(); }
/// <summary> /// change the repertory images in editor called after change of diagram style /// </summary> /// <param name="line">line has been changed</param> public void CBMscStyle(int line) { Interpreter interpreter = new Interpreter(); interpreter.InterpretDiagramTextNoWarnings(this.rtbMscEditor.Lines[line], generator, this); // interpret new .sc file }
/// <description>redraw whole image list and output image</description> protected override void DrawNew() { if (this.RedrawOutput == false) return; this.RedrawOutput = false; // dont allow the AddPreview redraw the output image generator.Clear(); Interpreter interpreter = new Interpreter(); InterpretException[] results = interpreter.InterpretDiagramText(this.rtbMscEditor.Text, generator, this); // interpret new .sc file this.WriteLog(results); this.InitDrawDestination(); generator.CalcLineHights(drawDestination, tmpWorksheet, MSCItem.ItemFont); // calculate new heights of all imageBitmap lines uint pages = this.GetPages(); //uint pages = generator.GetPages(tmpWorksheet.GetWorksheetHeight()); // calculate number of pages if (Output.AutosizeOutputWidth) { if (generator.EmptyDiagram == true) { worksheet.Width = 800; } else { try { worksheet.SetWorksheetWidth((int)generator.AutoWidth); } catch { } } } if (Output.AutosizeOutputHeight) { if (generator.EmptyDiagram == true) { worksheet.Height = 600; } else { try { worksheet.SetWorksheetHeight((int)generator.PageHeights[0]); } catch { } } } base.RedrawRescaled(); drawDestination.Clear(Color.White); // clear old picture drawDestination.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; // set quality of output picture drawDestination.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; AddPreview(); // draw all small pictures for the image list drawDestination.Dispose(); this.RedrawOutput = true; this.SetDiagramIsEmpty(generator.EmptyDiagram); if (pages == 0) return; // if nothing to do, do nothing MSCItem item = null; if ((OptionsDialog.ActiveDialog != null) && (OptionsDialog.ActiveDialog is Property)) { item = generator.GetMscItemByID(((Property)OptionsDialog.ActiveDialog).ItemID); if (item != null) { if ((this.lstPreview.SelectedIndex == ((int)item.ItemPage - 1)) || ((int)item.ItemPage == 0)) // if selected page not changed or item (process, actor) on all pages this.RedrawImage(); // then force redraw else this.lstPreview.SelectedIndex = ((int)item.ItemPage - 1); // else select page; redraw occurs on selected index change } else if (this.lstPreview.Items.Count > 0) { this.RedrawImage(); } } else if (this.lstPreview.Items.Count > 0) { this.RedrawImage(); //this.lstPreview.SelectedIndex = 0; } this.SetStatusBarSize(this.worksheet.GetWorksheetWidth(), this.worksheet.GetWorksheetHeight()); this.picOutput.Invalidate(); System.GC.Collect();// refresh the output picture }
protected override void InterpretFile(string fileName, bool showInProgram) { string s = String.Empty; generator.Clear(); generator.AddHead(Worksheet.FileName); // add filename as imageBitmap name first Interpreter interpreter = new Interpreter(); InterpretException[] results = interpreter.InterpretFile(fileName, generator, this); // interpret new .sc file this.WriteLog(results); if (showInProgram) { editor.checkSyntaxAll(); this.rtbMscEditor.Edited = false; this.rtbMscEditor.Modified = false; this.Text = "MSC-SD-Generator - " + fileName; base.RedrawRescaled(); } else { RescaleImage(); } System.GC.Collect(); }
private nGenerator.InterpretException[] LoadFile(string filename) { string name = ""; int pos = filename.LastIndexOf('/'); if (pos != -1) { name = filename.Substring (pos+1); if (name.LastIndexOf (".sc") == name.Length - 3) name = name.Substring (0, name.Length - 3); } if (name == "") name = "Diagram"; // have a default name TODO:localize generator.Clear(); generator.AddHead(name); Interpreter interpreter = new Interpreter(); return interpreter.InterpretFile(filename, generator, this); }