Пример #1
0
        /// <summary>
        /// If the tex code is changed, this method Reompiles it.
        /// The action taken depends upon the currently active mode:
        /// Wysiwyg Mode:
        ///     Starts asynchronous parse and compile operations.
        ///     The compilation is done on a temporary file in the current document's folder.
        /// Preview Mode:
        ///     Compilation only, done on a temporary file in the current document's folder.
        /// Production Mode:
        ///     Compilation only, done on the current document directly (not on temp file).
        /// </summary>
        /// <param name="NoParse">Skip the parsing step if true. (compile only)</param>
        public void Recompile(bool NoParse = false)
        {
            // Parse and compile, depending on current mode
            string path;

            if (FilePath != null)
            {
                path = FilePath + Helper.GetPreviewFilename() + Helper.GetPreviewFilenameExt();
            }
            else
            {
                path = "";      // use a temp file
            }
            if (MainWindow.TheVM == null || MainWindow.TheVM.EditorMode == TEMode.Wysiwyg)
            {
                if (!ProgrammaticTextChange && !NoParse)
                {
                    if (Document.Text.Trim() != "")
                    {
                        AllowEditing = false;   // overlay out of date->turn off editing
                        ParseNeeded  = true;
                    }
                    else
                    {
                        ParseTree    = null;
                        AllowEditing = true;
                    }
                }

                //compiling only must be started if there is latex code
                if (Document.Text.Trim() != "")
                {
                    TheCompiler.Instance.AddJobExclusive(Document.Text, path, true, DocumentID);
                }
                else
                {
                    PdfPath = "";
                }
            }
            else if (MainWindow.TheVM.EditorMode == TEMode.Preview)
            {
                TheCompiler.Instance.AddJobExclusive(Document.Text, path, false, DocumentID);
            }
            else
            {
                if (SaveCurFile())
                {
                    TheCompiler.Instance.AddJobExclusive(FilePath, DocumentID);
                }
                else
                {
                    PdfPath = "";
                }
            }

            TexErrors.Clear();
        }
Пример #2
0
 void clearProblemMarkers()
 {
     TexErrors.Clear();
 }