public PyjamaForm(string[] args) { InitializeComponent(); KeyDown += new KeyEventHandler(mainForm_KeyDown); _controller = new PyjamaFormController(this); _printEngine = new PrintEngine(_controller); Text = string.Format(Text, ApplicationInformation.Title(), ApplicationInformation.Version()); SetButtonsStatus(); ApplyUserSettings(ApplicationOptions.LoadUserSettings(ApplicationOptions.GetIsolatedStorage())); //this.ActiveControl = this.outputWindow.output; // Output window gets cursor int opened = 0; foreach (string filename in args) { string fullFilename = Path.GetFullPath(filename); // FIXME: if file exists, or allow create, if dir exists? OpenFile(fullFilename); opened++; } if (opened == 0) { NewFile(); } this.ActiveControl = _docManager.GetCurrentTabTextBox(); // tab text gets cursor // FIXME: make a general language changer this.languageName.Text = "Python"; this.columnNumber.Text = "" + 1; this.lineNumber.Text = "" + 1; }
public void Draw(PrintEngine engine, float yPos, Graphics graphics, Rectangle elementBounds) { graphics.DrawString(engine.ReplaceTokens(Text), engine.PrintFont, engine.PrintBrush, elementBounds.Left, yPos, new StringFormat()); }
public float CalculateHeight(PrintEngine engine, Graphics graphics) { return engine.PrintFont.GetHeight(graphics); }
public void Draw(PrintEngine engine, float yPos, Graphics graphics, Rectangle elementBounds) { Pen pen = new Pen(engine.PrintBrush, 1); graphics.DrawLine(pen, elementBounds.Left, yPos + 2, elementBounds.Right, yPos + 2); }
public float CalculateHeight(PrintEngine engine, Graphics graphics) { return 5; }
public void Draw(PrintEngine engine, float yPos, Graphics graphics, Rectangle pageBounds) { float height = CalculateHeight(engine, graphics); Rectangle elementBounds = new Rectangle(pageBounds.Left, (int)yPos, pageBounds.Right - pageBounds.Left, (int)height); foreach (IPrintPrimitive primitive in _printPrimitives) { primitive.Draw(engine, yPos, graphics, elementBounds); yPos += primitive.CalculateHeight(engine, graphics); } }
public float CalculateHeight(PrintEngine engine, Graphics graphics) { float height = 0; foreach (IPrintPrimitive primitive in _printPrimitives) { height += primitive.CalculateHeight(engine, graphics); } return height; }