"Fossies" - the Fresh Open Source Software Archive

Member "texstudio-3.1.1/src/texstudio.h" (21 Feb 2021, 27289 Bytes) of package /linux/misc/texstudio-3.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "texstudio.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 3.1.0_vs_3.1.1.

    1 /***************************************************************************
    2  *   copyright       : (C) 2003-2007 by Pascal Brachet                     *
    3  *   http://www.xm1math.net/texmaker/                                      *
    4  *                         2008-2009 by Benito van der Zander              *
    5  *   http://texstudio.sourceforge.net
    6  *                                                                         *
    7  *   This program is free software; you can redistribute it and/or modify  *
    8  *   it under the terms of the GNU General Public License as published by  *
    9  *   the Free Software Foundation; either version 2 of the License, or     *
   10  *   (at your option) any later version.                                   *
   11  *                                                                         *
   12  ***************************************************************************/
   13 
   14 #ifndef TEXSTUDIO_H
   15 #define TEXSTUDIO_H
   16 
   17 #include "mostQtHeaders.h"
   18 
   19 #include "bibtexparser.h"
   20 #include "buildmanager.h"
   21 #include "bookmarks.h"
   22 #include "codesnippet.h"
   23 #include "configmanager.h"
   24 #include "cursorhistory.h"
   25 #include "latexlog.h"
   26 #include "latexdocument.h"
   27 #include "latexeditorview.h"
   28 #include "latexcompleter.h"
   29 #include "xmltagslistwidget.h"
   30 #include "spellerdialog.h"
   31 #include "textanalysis.h"
   32 #include "toolwidgets.h"
   33 #include "txstabwidget.h"
   34 #include "editors.h"
   35 #include "searchresultwidget.h"
   36 #include "unicodeinsertion.h"
   37 #include "tablemanipulation.h"
   38 #include "PDFDocument.h"
   39 #include <QSplashScreen>
   40 #include "session.h"
   41 #include "sessionlist.h"
   42 #include "qformatfactory.h"
   43 #include "qlanguagefactory.h"
   44 #include "qlinemarksinfocenter.h"
   45 #include "latexstyleparser.h"
   46 #include "kpathseaParser.h"
   47 #include "diffoperations.h"
   48 #include "svn.h"
   49 #include "git.h"
   50 #include "help.h"
   51 
   52 #include <QProgressDialog>
   53 
   54 /*!
   55  * \file texstudio.h
   56  * \brief Definition for Mainwindow
   57  */
   58 
   59 class UserMenuDialog;
   60 class GrammarCheck;
   61 class FileSelector;
   62 class LatexReference;
   63 class SymbolListModel;
   64 class SymbolWidget;
   65 class StructureTreeView;
   66 
   67 Q_DECLARE_METATYPE(QSet<QString>)
   68 
   69 class Texstudio : public QMainWindow
   70 {
   71     Q_OBJECT
   72 
   73 public:
   74     Texstudio(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags(), QSplashScreen *splash = nullptr);
   75     ~Texstudio();
   76 
   77     Q_INVOKABLE QString getCurrentFileName(); ///< returns the absolute file name of the current file or "" if none is opene
   78     Q_INVOKABLE QString getAbsoluteFilePath(const QString &relName, const QString &extension = ""); ///< treats the path relative to the compiled .tex file
   79     Q_INVOKABLE QString getRelativeFileName(const QString &file, QString basepath, bool keepSuffix = false); ///< provide function for scripts
   80     QByteArray windowstate; ///< qt window state, used for state-restoring
   81     bool tobemaximized, tobefullscreen;
   82 
   83     Q_INVOKABLE void runInternalCommand(const QString &cmd, const QString &master, const QString &options);
   84 
   85 public slots:
   86     LatexEditorView *load(const QString &f , bool asProject = false, bool hidden = false, bool recheck = true, bool dontAsk = false);
   87     void executeCommandLine(const QStringList &args, bool realCmdLine);
   88     void hideSplash(); ///< hide splash screen
   89     void startupCompleted();
   90     void onOtherInstanceMessage(const QString &);  ///< For messages for the single instance
   91     void fuzzCursorHistory();
   92     void fuzzBackForward();
   93     void setBuildButtonsDisabled(bool c);
   94 
   95 
   96 protected:
   97     //these are just wrappers around configManager so we don't have to type so much (todo??? move them to configmanager.h and use a singleton design???)
   98     Q_INVOKABLE inline QMenu *newManagedMenu(const QString &id, const QString &text) { return configManager.newManagedMenu(id, text); }
   99     Q_INVOKABLE inline QMenu *newManagedMenu(QMenu *menu, const QString &id, const QString &text) { return configManager.newManagedMenu(menu, id, text); }
  100     Q_INVOKABLE QAction *newManagedAction(QWidget *menu, const QString &id, const QString &text, const char *slotName = nullptr, const QKeySequence &shortCut = 0, const QString &iconFile = "", const QList<QVariant> &args = QList<QVariant>());
  101     Q_INVOKABLE QAction *newManagedAction(QWidget *menu, const QString &id, const QString &text, const char *slotName, const QList<QKeySequence> &shortCuts, const QString &iconFile = "", const QList<QVariant> &args = QList<QVariant>());
  102     Q_INVOKABLE QAction *newManagedEditorAction(QWidget *menu, const QString &id, const QString &text, const char *slotName = nullptr, const QKeySequence &shortCut = 0, const QString &iconFile = "", const QList<QVariant> &args = QList<QVariant>());
  103     Q_INVOKABLE QAction *newManagedEditorAction(QWidget *menu, const QString &id, const QString &text, const char *slotName, const QList<QKeySequence> &shortCuts, const QString &iconFile = "", const QList<QVariant> &args = QList<QVariant>());
  104     Q_INVOKABLE inline QAction *newManagedAction(QWidget *menu, const QString &id, QAction *act) { return configManager.newManagedAction(menu, id, act); }
  105     Q_INVOKABLE inline QMenu *getManagedMenu(const QString &id) { return configManager.getManagedMenu(id); }
  106     Q_INVOKABLE inline QAction *getManagedAction(const QString &id) { return configManager.getManagedAction(id); }
  107     Q_INVOKABLE inline QList<QAction *> getManagedActions(const QStringList &ids, const QString &commonPrefix = "") { return configManager.getManagedActions(ids, commonPrefix); }
  108     Q_INVOKABLE QAction *insertManagedAction(QAction *before, const QString &id, const QString &text, const char *slotName = nullptr, const QKeySequence &shortCut = 0, const QString &iconFile = "");
  109 
  110     void addTagList(const QString &id, const QString &iconName, const QString &text, const QString &tagFile);
  111     void addMacrosAsTagList();
  112 
  113 private slots:
  114     void updateToolBarMenu(const QString &menuName);
  115     void showTestProgress(const QString &message);
  116     void leftPanelChanged(QWidget* widget);
  117 private:
  118     bool executeTests(const QStringList &args); ///< execute self-tests. Only works for debug-builds.
  119     void generateAddtionalTranslations();
  120     void setupMenus();
  121     void setupDockWidgets();
  122     void setupToolBars();
  123     void createStatusBar();
  124     bool activateEditorForFile(QString f, bool checkTemporaryNames = false, bool setFocus = true);
  125     bool saveAllFilesForClosing(); ///< checks for unsaved files and asks the user if they should be saved
  126     bool saveFilesForClosing(const QList<LatexDocument *> &documentList); ///< checks for unsaved files and asks the user if they should be saved
  127     void closeAllFiles();
  128     bool canCloseNow(bool saveSettings = true); ///< asks the user and close all files, and prepares to exit txs
  129     void closeEvent(QCloseEvent *e);
  130 
  131     void updateUserMacros(bool updateMenu = true);
  132 
  133     void updateEmphasizedRegion(QDocumentCursor c, int sid);
  134 
  135     QSplashScreen *splashscreen;  ///< only used during startup
  136     QFormatScheme *m_formats, *m_formatsOldDefault;
  137     QLanguageFactory *m_languages;
  138     LatexCompleter *completer;
  139     LatexReference *latexReference;
  140 
  141     QPointer<UnicodeInsertion> unicodeInsertionDialog;
  142 
  143     //gui
  144     Editors *editors;
  145     QSplitter *sidePanelSplitter;
  146     QSplitter *mainHSplitter;
  147     QSplitter *centralVSplitter;
  148     QFrame *centralFrame;
  149     QToolBar *centralToolBar;
  150     CustomWidgetList *leftPanel;
  151     TitledPanel *sidePanel;
  152     SymbolListModel *symbolListModel;
  153     SymbolWidget *symbolWidget;
  154     QString hiddenLeftPanelWidgets;
  155 
  156     StructureTreeView *structureTreeView;
  157     QTreeWidget *topTOCTreeWidget;
  158     LatexParser latexParser;
  159 public:
  160     LatexDocuments documents;
  161 
  162     Q_INVOKABLE bool completerIsVisible();
  163 private:
  164     OutputViewWidget *outputView; ///< contains output widgets (over OutputLayout)
  165 
  166     //menu
  167     QActionGroup *bibtexEntryActions;
  168     QActionGroup *biblatexEntryActions;
  169     QActionGroup *bibTypeActions;
  170     QActionGroup *highlightLanguageActions;
  171     QActionGroup *actgroupRootDocMode;
  172     QAction *actRootDocAutomatic;
  173     QAction *actRootDocExplicit;
  174     QAction *actRootDocSetExplicit;
  175 
  176     //toolbars
  177     QAction *actSave, *actUndo, *actRedo;
  178 
  179     QLabel *statusLabelMode, *statusLabelProcess, *statusLabelLanguageTool;
  180     QToolButton *statusTbLanguage;
  181     QToolButton *statusTbEncoding;
  182     QActionGroup *spellLanguageActions;
  183 
  184     CursorHistory *cursorHistory;
  185 
  186     //settings
  187     ConfigManager configManager;
  188 public:
  189     BuildManager buildManager;
  190 private:
  191     QStringList struct_level;
  192 
  193     qreal pdfSplitterRel;
  194 
  195     SpellerManager spellerManager;
  196     SVN svn;
  197     GIT git;
  198     Help help;
  199     SafeThread grammarCheckThread;
  200     GrammarCheck *grammarCheck;
  201     Bookmarks *bookmarks;
  202     SessionList *recentSessionList;
  203 
  204     //dialogs
  205     TextAnalysisDialog *textAnalysisDlg;
  206     SpellerDialog *spellDlg;
  207 
  208     Q_INVOKABLE LatexEditorView *currentEditorView() const;
  209     Q_INVOKABLE QEditor *currentEditor() const;
  210     void configureNewEditorView(LatexEditorView *edit);
  211     void configureNewEditorViewEnd(LatexEditorView *edit, bool asMaster = false, bool hidden = false);
  212     LatexEditorView *getEditorViewFromFileName(const QString &fileName, bool checkTemporaryNames = false);
  213     LatexEditorView *getEditorViewFromHandle(const QDocumentLineHandle *dlh);
  214 
  215     QAction *fullscreenModeAction;
  216 
  217     int runningPDFCommands, runningPDFAsyncCommands;
  218     QEditor *previewEditorPending; bool previewIsAutoCompiling;
  219 
  220     void updateUserToolMenu();
  221     void linkToEditorSlot(QAction *act, const char *slot, const QList<QVariant> &args);
  222 
  223     bool parseStruct(StructureEntry* se,QVector<QTreeWidgetItem *> &rootVector);
  224 private slots:
  225     void updateTOC();
  226     void syncExpanded(QTreeWidgetItem *item);
  227     void syncCollapsed(QTreeWidgetItem *item);
  228     void customMenuTOC(const QPoint &pos);
  229     void editSectionCopy();
  230     void editSectionCut();
  231     void editSectionPasteAfter();
  232     void editSectionPasteBefore();
  233     void editIndentSection();
  234     void editUnIndentSection();
  235 
  236     void relayToEditorSlot();
  237     void relayToOwnSlot();
  238     void autoRunScripts();
  239     void runScripts(int trigger);
  240     void runScriptsInList(int trigger, const QList<Macro> &scripts);
  241 
  242 protected slots:
  243     void fileNew(QString fileName = "");
  244     void fileNewFromTemplate();
  245     void fileMakeTemplate();
  246     void fileOpen();
  247     void fileRestoreSession(bool showProgress = true, bool warnMissing = true);
  248     void fileSave(const bool saveSilently = false);
  249     void fileSaveAll();
  250     void fileSaveAllFromTimer();
  251     void fileSaveAll(bool alsoUnnamedFiles, bool alwaysCurrentFile);
  252     void fileSaveAs(const QString &fileName = "") { fileSaveAs(fileName, false); }
  253 private slots:
  254     void fileSaveAs(const QString &fileName, const bool saveSilently);
  255     void fileNewInternal(QString fileName = "");
  256 protected slots:
  257     void fileUtilCopyMove(bool move); ///< call dialog to copy/move files
  258     void fileUtilDelete(); ///< call dialog to remove file
  259     void fileUtilRevert(); ///< reload file from disc, undoing all changes in memory
  260     void fileUtilPermissions(); ///< call dialog to set file permissions
  261     void fileUtilCopyFileName(); ///< copy file name into clipboard
  262     void fileUtilCopyMasterFileName(); ///< copy file name of master file into clipboard
  263     void fileClose(); ///< close current editor
  264     void fileCloseAll(); ///< close all open editors
  265     void fileExit(); ///< exit application
  266     void fileExitWithError(); ///< exit application with error code, used for auto-tests
  267 protected slots:
  268     void fileOpenRecent();
  269     void fileOpenAllRecent(); ///< open all files in recent file list
  270     void fileRecentList();
  271     void viewDocumentListHidden(); ///< show names of all hidden document (for debug)
  272     void fileDocumentOpenFromChoosen(const QString &doc, int duplicate, int lineNr, int column);
  273     void viewDocumentList();
  274     void viewDocumentOpenFromChoosen(const QString &doc, int duplicate, int lineNr, int column);
  275     void fileOpenFirstNonOpen();
  276     void fileOpenRecentProject();
  277     void fileLoadSession();
  278     void loadSession(const QString &fileName);
  279     void fileSaveSession();
  280 private slots:
  281     void restoreSession(const Session &s, bool showProgress = true, bool warnMissing = true);
  282     Session getCurrentSession();
  283 protected slots:
  284     void MarkCurrentFileAsRecent();
  285 private slots:
  286     void fileCheckin(QString filename = "");
  287     void fileLockPdf(QString filename = "");
  288     void fileCheckinPdf(QString filename = "");
  289     void fileUpdate(QString filename = "");
  290     void fileUpdateCWD(QString filename = "");
  291     void checkinAfterSave(QString filename, int checkIn = 0);
  292     void checkin(QString fn, QString text = "txs auto checkin", bool blocking = false);
  293     bool svnadd(QString fn, int stage = 0);
  294     void svnUndo(bool redo = false);
  295     void svnPatch(QEditor *ed, QString diff);
  296     void showOldRevisions();
  297     void changeToRevision(QString rev, QString old_rev = "");
  298     void svnDialogClosed(int);
  299     void fileDiff();
  300     void fileDiff3();
  301     bool checkSVNConflicted(bool substituteContents = true);
  302     void removeDiffMarkers(bool theirs = false);
  303     void editChangeDiff(QPoint pt);
  304     void jumpNextDiff();
  305     void jumpPrevDiff();
  306     void fileDiffMerge();
  307     void declareConflictResolved();
  308 protected slots:
  309     void openExternalFile(QString name, const QString &defaultExt = "tex", LatexDocument *doc = nullptr); // signaled by latexViewer to open specific file
  310 
  311     void editUndo(); ///< undo changes in text editor
  312     void editRedo(); ///< redo changes in text editor
  313     void editDebugUndoStack(); ///< print undo-stack content into a new text editor window
  314     void editCopy(); ///< copy text
  315     void editPaste(); ///< paste text
  316     void editPasteImage(QImage image);
  317     void editTextToLowercase();
  318     void editTextToUppercase();
  319     void editTextToTitlecase(bool smart = false);
  320     void editTextToTitlecaseSmart();
  321     void editFind(); ///< open search panel
  322     void editPasteLatex();
  323     void convertToLatex();
  324     void editHardLineBreak();
  325     void editHardLineBreakRepeat();
  326     void editDeleteLine(); ///< delete current line in current text editor
  327     void editDeleteToEndOfLine();
  328     void editDeleteFromStartOfLine();
  329     void editMoveLineUp();
  330     void editMoveLineDown();
  331     void editDuplicateLine();
  332     void editSortLines();
  333     void editAlignMirrors();
  334     void editEraseWordCmdEnv();
  335     void editGotoDefinition(QDocumentCursor c = QDocumentCursor());
  336     void editSpell();
  337     void editThesaurus(int line = -1, int col = -1);
  338     void editChangeLineEnding();
  339     void editSetupEncoding();
  340     void editInsertUnicode(); ///< open dialog to insert a unicode character
  341     void editInsertRefToNextLabel(const QString &refCmd = "\\ref", bool backward = false);
  342     void editInsertRefToPrevLabel(const QString &refCmd = "\\ref");
  343     void runSearch(SearchQuery *query);
  344     void findLabelUsages(LatexDocument *doc, const QString &labelText);
  345     SearchResultWidget *searchResultWidget();
  346 
  347     void findWordRepetions();
  348     void findNextWordRepetion();
  349 
  350     void addDocToLoad(QString filename);
  351 
  352     void LTErrorMessage(QString message);
  353 
  354     void paletteChanged(const QPalette &palette);
  355 
  356 private slots:
  357     void readSettings(bool reread = false); ///< read configured/default settings from ini
  358     void saveSettings(const QString &configName = ""); ///< save all setting to ini
  359     void restoreDefaultSettings(); ///< restore default settings, removing all changed values
  360 
  361 protected slots:
  362     void showMarkTooltipForLogMessage(QList<int> errors);
  363     void newDocumentLineEnding();
  364     void updateCaption();
  365     void updateMasterDocumentCaption();
  366     void updateUndoRedoStatus();
  367     void currentEditorChanged();
  368     void editorTabMoved(int from, int to);
  369     void editorAboutToChangeByTabClick(LatexEditorView *edFrom, LatexEditorView *edTo);
  370 
  371     void getExpandedStructureEntries(const QModelIndex &index, QSet<QString> &expandedEntryTags, QString baseTag = QString());
  372     void expandStructureEntries(const QModelIndex index, const QSet<QString> &expandedEntryTags, QString baseTag = QString());
  373     void updateStructure(bool initial = false, LatexDocument *doc = nullptr, bool hidden = false);
  374     void showStructure();
  375     void clickedOnStructureEntry(const QModelIndex &index);
  376     void structureContextMenuCloseDocument(LatexDocument *document);
  377     void structureContextMenuToggleMasterDocument(LatexDocument *document);
  378     void structureContextMenuOpenAllRelatedDocuments(LatexDocument *document);
  379     void structureContextMenuCloseAllRelatedDocuments(LatexDocument *document);
  380     void createLabelForStructureEntry(const StructureEntry *entry);
  381 
  382     void editRemovePlaceHolders();
  383     void editRemoveCurrentPlaceHolder();
  384 
  385     void normalCompletion(); ///< activate normal completion
  386     void insertEnvironmentCompletion(); ///< activate environment completion
  387     void insertTextCompletion(); ///< activate normal text completion
  388     void insertText(const QString &text);
  389     void insertTag(const QString &Entity, int dx = 0, int dy = 0);
  390     void insertCitation(const QString &text);
  391     void insertFormula(const QString &formula);
  392     void insertSymbol(const QString &text);
  393     void insertXmlTag(QListWidgetItem *item);
  394     void insertXmlTagFromToolButtonAction();
  395     void callToolButtonAction();
  396     void insertFromAction();
  397     void insertFromTagList(QListWidgetItem *item);
  398     void insertBib();
  399     void closeEnvironment();
  400 
  401     void insertBibEntryFromAction();
  402     void insertBibEntry(const QString &id = "");
  403     void setBibTypeFromAction();
  404 
  405     void insertUserTag();
  406     void execMacro(const Macro &m, const MacroExecContext &context = MacroExecContext(), bool allowWrite = false);
  407     void runScript(const QString &script, const MacroExecContext &context = MacroExecContext(), bool allowWrite = false);
  408 
  409     void editMacros(); ///< open edit macros dialog
  410     void macroDialogAccepted(); ///< macro dialog was closed with ok
  411     void macroDialogRejected(); ///< macro dialog was closed with cancel
  412 
  413     void insertRef(const QString &refCmd);
  414     void insertRef();
  415     void insertEqRef();
  416     void insertPageRef();
  417 
  418     void changeTextCodec();
  419     void updateAvailableLanguages();
  420     void updateLanguageToolStatus();
  421     void editorSpellerChanged(const QString &name);
  422     void changeEditorSpeller();
  423     void insertSpellcheckMagicComment();
  424     void updateStatusBarEncoding();
  425     void addMagicRoot();
  426     void addMagicCoding();
  427     void addMagicBibliography();
  428     void addMagicProgram();
  429 
  430     void quickTabular(); ///< start quick tabular wizard
  431     void quickArray(); ///< start quick array wizard
  432     void quickTabbing(); ///< start quick tabbing wizard
  433     void quickLetter(); ///< start quick leter wizard
  434     void quickDocument(); ///< start quick document wizard
  435     void quickBeamer(); ///< start quick beamer wizard
  436     void quickGraphics(const QString &graphicsFile = QString()); ///< start quick graphics wizard
  437     void quickMath(); ///< start quick math wizard
  438 
  439     bool checkProgramPermission(const QString &program, const QString &cmdId, LatexDocument *master);
  440     void runInternalPdfViewer(const QFileInfo &master, const QString &options);
  441     void runBibliographyIfNecessary(const QFileInfo &cmd);
  442     QDateTime GetBblLastModified(void);
  443 
  444     void showExtendedSearch();
  445 
  446     void changeIconSize(int value);
  447     void changeSecondaryIconSize(int value);
  448     void changePDFIconSize(int value);
  449     void changeSymbolGridIconSize(int value, bool changePanel = true);
  450 
  451 public slots:
  452     void connectSubCommand(ProcessX *p, bool showStdoutLocallyDefault);
  453 private slots:
  454     void runInternalCommand(const QString &cmd, const QFileInfo &master, const QString &options);
  455     void commandLineRequested(const QString &cmdId, QString *result, bool *);
  456     void beginRunningCommand(const QString &commandMain, bool latex, bool pdf, bool async);
  457     void beginRunningSubCommand(ProcessX *p, const QString &commandMain, const QString &subCommand, const RunCommandFlags &flags);
  458     void endRunningSubCommand(ProcessX *p, const QString &commandMain, const QString &subCommand, const RunCommandFlags &flags);
  459     void endRunningCommand(const QString &commandMain, bool latex, bool pdf, bool async);
  460 
  461 
  462     bool runCommand(const QString &commandline, QString *buffer = nullptr, QTextCodec *codecForBuffer = nullptr, bool saveAll=true);
  463     bool runCommandNoSpecialChars(QString commandline, QString *buffer = nullptr, QTextCodec *codecForBuffer = nullptr);
  464     void setStatusMessageProcess(const QString &message);
  465     bool runCommandAsync(const QString &commandline, const char *returnCMD);
  466 protected slots:
  467     void processNotification(const QString &message);
  468     void clearLogs();
  469     void openExternalTerminal(void); ///< open external terminal
  470     void cleanAll();
  471     void commandFromAction();  ///< calls a command given by sender.data, doesn't wait
  472 
  473     void webPublish();
  474     void webPublishSource();
  475     void analyseText();
  476     void analyseTextFormDestroyed();
  477     void generateRandomText();
  478 
  479     bool loadLog();
  480     void onCompileError();
  481     void setLogMarksVisible(bool visible);
  482     void clearLogEntriesInEditors();
  483     void updateLogEntriesInEditors();
  484     void showLog(); ///< show log viewer in bottom panel
  485     void viewLog();
  486     void viewLogOrReRun(LatexCompileResult *result);
  487     bool gotoNearLogEntry(int lt, bool backward, QString notFoundMessage);
  488     bool hasLatexErrors();
  489     bool logExists();
  490     void clearMarkers();
  491     /////
  492     void latexHelp(); ///< open latex help document
  493     void userManualHelp(); ///< open txs user manual
  494     void texdocHelp();
  495     void helpAbout(); ///< open about dialog
  496 
  497     void generalOptions(); ///< open config dialog
  498     void setAutomaticRootDetection();
  499     void setExplicitRootDocument(LatexDocument *doc);
  500     void setCurrentDocAsExplicitRoot();
  501 
  502     void gotoNextDocument();
  503     void gotoPrevDocument();
  504     void gotoOpenDocument();
  505     void updateOpenDocumentMenu(bool localChange = false);
  506     void onEditorsReordered();
  507 
  508     void focusEditor();
  509     void focusViewer();
  510     void enlargeEmbeddedPDFViewer();
  511     void shrinkEmbeddedPDFViewer(bool preserveConfig = false);
  512 
  513     void showStatusbar();
  514     void viewCloseElement();
  515     void setFullScreenMode();
  516     void viewSetHighlighting(QAction *act);
  517     void showHighlightingMenu();
  518 
  519     void viewCollapseBlock();
  520     void viewExpandBlock();
  521 
  522 #ifndef NO_POPPLER_PREVIEW
  523     QObject *newPdfPreviewer(bool embedded = false);
  524 #endif
  525     void pdfClosed();
  526 
  527     void masterDocumentChanged(LatexDocument *doc);
  528     void aboutToDeleteDocument(LatexDocument *doc);
  529 
  530     void updateCompleter(LatexEditorView *edView = nullptr);
  531     void completerNeedsUpdate();
  532     void needUpdatedCompleter();
  533 
  534     void outputPageChanged(const QString &id);
  535 
  536     void gotoLine(int line, int col = 0, LatexEditorView *edView = nullptr, QEditor::MoveFlags mflags = QEditor::Navigation, bool setFocus = true); // line is 0 based
  537     bool gotoLine(int line, const QString &fileName);  // line is 0 based, absolute file name
  538     void gotoLine(LatexDocument *doc, int line, int col=0);
  539     void gotoLine(QTreeWidgetItem * item,int col);
  540     void gotoLogEntryEditorOnly(int logEntryNumber);
  541     QDocumentCursor getLogEntryContextCursor(const QDocumentLineHandle *dlh, const LatexLogEntry &entry);
  542     bool gotoLogEntryAt(int newLineNumber);
  543     bool gotoMark(bool backward, int id = -1);
  544     QList<int> findOccurencesApproximate(QString checkLine, const QString &guessedWord);
  545     void syncFromViewer(const QString &fileName, int lineNr, bool activate, const QString &guessedWord);  //0 based, absolute file name, raise window
  546 
  547     void goBack();
  548     void goForward();
  549     void setGlobalCursor(const QDocumentCursor &c);
  550     void saveCurrentCursorToHistory();
  551     void saveEditorCursorToHistory(LatexEditorView *edView);
  552 
  553     void previewLatex();
  554     void previewAvailable(const QString &imageFile, const PreviewSource &source);
  555     void clearPreview();
  556     void showPreview(const QString &text);
  557     void showPreview(const QDocumentCursor &c);
  558     void showPreview(const QDocumentCursor &c, bool addToList);
  559     QStringList makePreviewHeader(const LatexDocument *rootDoc);
  560     void showPreviewQueue();
  561     void showImgPreview(const QString &fname);
  562     void showImgPreviewFinished(const QPixmap &pm, int page);
  563     void recompileForPreview();
  564     void recompileForPreviewNow();
  565 
  566     void templateEdit(const QString &fname);
  567 
  568     void fileReloaded();
  569     void fileInConflictShowDiff();
  570     void fileAutoReloading(QString fname);
  571 
  572     void jumpToSearchResult(QDocument *doc, int lineNumber, const SearchQuery *query);
  573 
  574     void cursorPositionChanged();
  575     void syncPDFViewer(QDocumentCursor cur, bool inForeground = true);
  576     //  void treeWidgetChanged();
  577 
  578     bool generateMirror(bool setCur = false);
  579     void generateBracketInverterMirror();
  580     void jumpToBracket();
  581     void selectBracket();
  582     void findMissingBracket();
  583     void cursorHovered();
  584     void loadProfile();
  585     void saveProfile();
  586 
  587     void addRowCB();
  588     void addColumnCB();
  589     void removeColumnCB();
  590     void removeRowCB();
  591     void cutColumnCB();
  592     void pasteColumnCB();
  593     void addHLineCB();
  594     void remHLineCB();
  595     void insertTableTemplate();
  596     void alignTableCols();
  597 
  598     void updateTexQNFA();
  599     void updateTexLikeQNFA(QString languageName, QString filename);
  600 
  601     void toggleGrammar(int type);
  602 
  603     void openInternalDocViewer(QString package, const QString command = "");
  604 
  605 private slots:
  606     void importPackage(QString name);
  607     void packageScanCompleted(QString name);
  608     void stopPackageParser();
  609     void packageParserFinished();
  610     void readinAllPackageNames();
  611     void packageListReadCompleted(QSet<QString> packages);
  612 protected:
  613     void dragEnterEvent(QDragEnterEvent *event);
  614     void dropEvent(QDropEvent *event);
  615     virtual void changeEvent(QEvent *e);
  616 #ifdef Q_OS_WIN
  617     bool eventFilter(QObject *obj, QEvent *event);
  618 #endif
  619 #if (QT_VERSION <= 0x050700) && (defined(Q_OS_MAC))
  620     bool eventFilter(QObject *obj, QEvent *event);
  621 #endif
  622 
  623     bool mCompleterNeedsUpdate;
  624 
  625     int currentLine;
  626     QBrush oldBackground;
  627     bool mDontScrollToItem;
  628 
  629     QByteArray stateFullScreen;
  630 
  631     QDialog *svndlg;
  632     UserMenuDialog *userMacroDialog;
  633     QComboBox *cmbLog;
  634 
  635     QStringList m_columnCutBuffer;
  636 
  637     QTimer autosaveTimer,previewDelayTimer,previewFullCompileDelayTimer;
  638 
  639     bool completionBaseCommandsUpdated;
  640 
  641     QSet<int> previewQueue;
  642     LatexEditorView *previewQueueOwner;
  643 
  644     QString fileFilters;
  645     QString selectedFileFilter;
  646 
  647     QPointer<FileSelector> fileSelector;
  648 
  649     bool runBibliographyIfNecessaryEntered;
  650 
  651     LatexStyleParser *latexStyleParser;
  652     PackageScanner *packageListReader;
  653 
  654     QMap<QString, QString> detectedEnvironmentsForHighlighting;
  655 
  656     LatexDocument *diffLoadDocHidden(QString f);
  657     void showDiff3(const QString file1, const QString file2);
  658 
  659     void restoreBookmarks(LatexEditorView *edView);
  660 
  661     bool completerPreview;
  662     QPixmapCache previewCache;
  663 
  664     bool recheckLabels;
  665 
  666     bool rememberFollowFromScroll,enlargedViewer;
  667 
  668     QSet<QString> latexPackageList, currentPackageList;
  669 
  670     QMap<QString, QString> *mReplacementList;
  671 
  672 public:
  673     Q_PROPERTY(QString clipboard READ clipboardText WRITE setClipboardText)
  674     Q_INVOKABLE QString clipboardText(const QClipboard::Mode &mode = QClipboard::Clipboard) const;
  675     Q_INVOKABLE void setClipboardText(const QString &text, const QClipboard::Mode &mode = QClipboard::Clipboard);
  676     Q_INVOKABLE int getVersion() const; ///< return current version number of txs (coded in hex,32 bit)
  677     Q_INVOKABLE void simulateKeyPress(const QString &shortcut);
  678 
  679     static void recoverFromCrash();
  680 
  681 public slots:
  682     void threadCrashed();
  683     void iamalive();
  684     void checkLatexInstall();
  685     void checkCWLs();
  686     void checkLanguageTool();
  687 
  688     void slowOperationStarted();
  689     void slowOperationEnded();
  690 
  691     void openBugsAndFeatures();
  692 
  693 signals:
  694     void infoNewFile(); ///< signal that a new file has been generated. Used for scritps as trigger.
  695     void infoNewFromTemplate(); ///< signal that a new file from template has been generated. Used for scritps as trigger.
  696     void infoLoadFile(const QString &filename); ///< signal that a file has been loaded. Used for scritps as trigger.
  697     void infoFileSaved(const QString &filename,const int checkin = 0); ///< signal that a file has been saved. Used for scritps as trigger.
  698     void infoFileClosed(); ///< signal that a file has been closed. Used for scritps as trigger.
  699     void infoAfterTypeset(); ///< signal that a file has been compiled. Used for scritps as trigger.
  700     void imgPreview(const QString &fn);
  701 };
  702 
  703 Q_DECLARE_METATYPE(Texstudio *)
  704 
  705 #endif
  706