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