Example #1
0
        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;
        }
Example #2
0
 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());
 }
Example #3
0
 public float CalculateHeight(PrintEngine engine, Graphics graphics)
 {
     return engine.PrintFont.GetHeight(graphics);
 }
Example #4
0
 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);
 }
Example #5
0
 public float CalculateHeight(PrintEngine engine, Graphics graphics)
 {
     return 5;
 }
Example #6
0
 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);
     }
 }
Example #7
0
 public float CalculateHeight(PrintEngine engine, Graphics graphics)
 {
     float height = 0;
     foreach (IPrintPrimitive primitive in _printPrimitives)
     {
         height += primitive.CalculateHeight(engine, graphics);
     }
     return height;
 }