Пример #1
0
        public static void changeOptions()
        {
            SettingsManager mgr    = SettingsManager.getCurrent();
            OptionsDialog   dialog = new OptionsDialog();

            dialog.MiktexPath = mgr.SettingsData.miktexPath;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                mgr.SettingsData.miktexPath = dialog.MiktexPath;
                mgr.saveSettings();
            }
        }
Пример #2
0
        public bool generateEquation()
        {
            // Check paths
            SettingsManager mgr = SettingsManager.getCurrent();

            // Check font size
            string fontSize = comboBoxFontSize.Text;
            float  size     = 12;

            try
            {
                size = Convert.ToSingle(fontSize);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Font size exception: \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            // Check Dpi
            float[] systemDPI = AddinUtilities.getSystemDPI();
            float   dpiValue  = systemDPI[0];

            mgr.SettingsData.fontSize   = comboBoxFontSize.Text;
            mgr.SettingsData.font       = comboBoxFont.Text;
            mgr.SettingsData.fontSeries = comboBoxSeries.Text;
            mgr.SettingsData.fontShape  = comboBoxShape.Text;
            mgr.SettingsData.mathFont   = comboBoxMathFont.Text;
            mgr.SettingsData.textColor  = m_textColor;
            mgr.saveSettings();

            m_latexEquation = new LatexEquation(m_latexEquation.m_code, size, m_textColor, (LatexFont)comboBoxFont.SelectedItem,
                                                (LatexFontSeries)comboBoxSeries.SelectedItem,
                                                (LatexFontShape)comboBoxShape.SelectedItem,
                                                (LatexMathFont)comboBoxMathFont.SelectedItem);

            m_finishedSuccessfully = AddinUtilities.createLatexPdf(m_latexEquation);

            if (m_finishedSuccessfully)
            {
                string imageFile = Path.Combine(AddinUtilities.getAppDataLocation(), "teximport.pdf");
                Corel.Interop.VGCore.StructImportOptions impopt = new Corel.Interop.VGCore.StructImportOptions();
                impopt.MaintainLayers = true;
                Corel.Interop.VGCore.ImportFilter impflt = DockerUI.Current.CorelApp.ActiveLayer.ImportEx(imageFile, Corel.Interop.VGCore.cdrFilter.cdrPDF, impopt);
                impflt.Finish();
                m_latexEquation.m_shape = DockerUI.Current.CorelApp.ActiveShape;
                ShapeTags.setShapeTags(m_latexEquation);
            }

            return(m_finishedSuccessfully);
        }