public LatexDialog()
        {
            InitializeComponent();

            // Be sure, there is a language.xml file
            AddinUtilities.copyLanguageFile();

            this.SuspendLayout();
            m_scintilla = new ScintillaNET.Scintilla();
            this.groupBoxLatex.Controls.Add(m_scintilla);
            m_scintilla.Dock             = DockStyle.Fill;
            m_scintilla.Margins[0].Width = 20;
            m_scintilla.ConfigurationManager.CustomLocation = AddinUtilities.getAppDataLocation() + "\\Language.xml";
            m_scintilla.ConfigurationManager.Language       = "mytex";
            m_scintilla.IsBraceMatching             = true;
            m_scintilla.TabIndex                    = 0;
            m_scintilla.AutoComplete.DropRestOfWord = true;
            this.ResumeLayout(false);
            m_scintilla.Focus();
            m_scintilla.KeyDown += new KeyEventHandler(m_scintilla_KeyDown);

            createFontEntries();

            m_finishedSuccessfully = false;
            this.FormClosing      += new FormClosingEventHandler(LatexDialog_FormClosing);
        }
Example #2
0
        private void 打开文件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog OFD = new OpenFileDialog();

            OFD.Filter = "(*.c,*.h)|*.c|(*.c,*.h)|*.h";
            if (OFD.ShowDialog() == DialogResult.OK)
            {
                //清空
                SetToDefault();

                FileInfo         SingleFileInformation = new FileInfo(OFD.FileName);
                EveryProjectInfo tempProjectInfo       = CreateInfo(SingleFileInformation); //生成INFO
                rootPath = tempProjectInfo.fileInfo.FullName;                               //保存文件地址
                CreateNode(null, tempProjectInfo);                                          //添加到Tree
                projectInfoList.RegisterProjecInfo(tempProjectInfo);
                curProjectInfo = tempProjectInfo;
                SetCodeArea(curProjectInfo.fileInfo.Name, curProjectInfo.Code);
                ChangeSourceFileNameLabel(curProjectInfo.fileInfo.Name);
                TB_CodeArea.Focus();
            }
        }
        void LatexDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
            if ((this.DialogResult == DialogResult.OK) && (!m_finishedSuccessfully))
            {
                return;
            }
            m_result = this.DialogResult;

            // Set the focus => next time we open the dialog it is correct
            m_scintilla.Focus();
            this.Hide();

            if (pictureBoxPreview.Image != null)
            {
                pictureBoxPreview.Image.Dispose();
            }
            pictureBoxPreview.Image = null;
        }