00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __CUTE_H__
00019 #define __CUTE_H__
00020
00021
00022 #include <qfeatures.h>
00023 #include <qstring.h>
00024 #include <qdir.h>
00025 #include <qpopupmenu.h>
00026 #include <qmainwindow.h>
00027 #include <qaccel.h>
00028 #include <qmenubar.h>
00029 #include <qtoolbar.h>
00030 #include <qpixmap.h>
00031 #include <qtoolbutton.h>
00032 #include <qapplication.h>
00033 #include <qstatusbar.h>
00034 #include <qwhatsthis.h>
00035 #include <qmessagebox.h>
00036 #include <qfiledialog.h>
00037 #include <qprinter.h>
00038 #include <qpainter.h>
00039 #include <qaction.h>
00040 #include <qregexp.h>
00041 #include <qcombobox.h>
00042 #include <qmap.h>
00043 #include <qtextbrowser.h>
00044 #include <qptrlist.h>
00045 #include <qprocess.h>
00046 #include <qvaluelist.h>
00047
00048 #include <qextmdimainfrm.h>
00049 #include <kdockwidget.h>
00050
00051 #include <map>
00052 #include <list>
00053 #include <string>
00054
00055
00056 #include "resource.h"
00057 #include "readtags.h"
00058 #include "icons/pixmaps.h"
00059 #include "cuteview.h"
00060 #include "python_api.h"
00061 #include "shortcuts.h"
00062
00063 class Project;
00064 class ProjectFile;
00065 class ProjectDlg;
00066 class OutputView;
00067 class GrepOutputView;
00068 class DirectoryView;
00069 class TagsView;
00070 class ProjectView;
00071 class TagsDlg;
00072 class QCommandBox;
00073 class CmdInterpreter;
00074 class SettingsDlg;
00075 class FindDlg;
00076 class ReplaceDlg;
00077 class FindInFilesDlg;
00078 class ShortcutsDlg;
00079 class CUTEScintilla;
00080 class CUTEShell;
00081 class HelpViewer;
00082
00083
00085 class CUTEAction : public QAction
00086 {
00087 Q_OBJECT
00088 public:
00090 CUTEAction(QString command, QObject *parent, const char *name=0);
00091 protected slots:
00093 void execCmd();
00094 private:
00096 QString cmd;
00097 };
00098
00099 extern std::list<std::string> recentFilesList;
00100 extern QValueList<QString> recentProjectList;
00101
00108 class CUTE : public QextMdiMainFrm
00109 {
00110 Q_OBJECT
00111 struct TagPosition;
00112 friend class CUTEScintilla;
00113 friend class CmdInterpreter;
00114 friend class Shortcuts;
00115 friend void API::initcute();
00116 friend PyObject *API::activateView(PyObject*, PyObject*);
00117 friend PyObject *API::viewList(PyObject*, PyObject*);
00118 public:
00120 CUTE();
00122 ~CUTE();
00124 void initLangMenu();
00126 void initActions();
00128 void initEditActions();
00130 void initMenuBar();
00133 void initToolBar();
00135 void initStatusBar();
00137 void initDoc();
00139 void initView();
00141 bool loadFile(const QString&, bool recentFile=false, bool showDialogs=true);
00143 bool queryExit();
00145 void printOutput(std::string str);
00147 void clearOutput();
00149 void setSession(const char *str) {
00150 session = new char[strlen(str)+1]; strcpy(session, str); }
00152 void saveSession();
00154 void loadSession(QString file);
00156 void filter(QString cmd);
00158 void insertCommand(QString cmd);
00159 public slots:
00161 void statusCallback(int id_);
00163 void slotFileNew();
00165 void slotFileOpen();
00167 void slotFileReopen();
00169 void slotFileChangeWorkingDir();
00171 void slotFileSave();
00173 void slotFileSaveAs();
00175 void slotFileSaveAll();
00177 void slotFileClose();
00179 void slotFileLoadTagsFile();
00181 void slotFileUnloadTagsFile();
00183 void slotFilePrint();
00185 void slotFileQuit();
00187 void slotEditGotoMatchingBrace();
00189 void slotEditSelectToMatchingBrace();
00191 void slotEditUndo();
00193 void slotEditRedo();
00196 void slotEditCut();
00198 void slotEditCopy();
00200 void slotEditPaste();
00202 void slotEditDelete();
00204 void slotEditIndent();
00206 void slotEditUnindent();
00208 void slotEditSelectAll();
00210 void slotEditInsertCommand();
00212 void slotEditFilter();
00214 void slotEditBlockComment();
00216 void slotEditStreamComment();
00218 void slotSearchFind();
00220 void slotSearchFindNext();
00222 void slotSearchFindPrevious();
00224 void slotSearchFindInFiles();
00226 void slotSearchReplace();
00228 void slotSearchGoto();
00230 void slotSearchFindTag();
00232 void slotSearchFindNextTag();
00234 void slotSearchFindPreviousTag();
00236 void slotSearchToggleBookmark();
00238 void slotSearchNextBookmark();
00240 void slotSearchPrevBookmark();
00242 void slotSearchRenameBookmark();
00244 void slotViewToggleCurrentFold();
00246 void slotViewToggleAllFolds();
00248 void slotViewWrapLines();
00250 void slotViewBraceMatch();
00252 void slotViewToolBar();
00254 void slotViewCmdToolBar();
00256 void slotViewStatusBar();
00258 void slotViewTaskBar();
00260 void slotViewShowDirView();
00262 void slotViewShowMessages();
00264 void slotViewShowStdout();
00266 void slotViewShowStderr();
00268 void slotViewShowShell();
00270 void slotViewShowSearch();
00272 void slotViewShowTags();
00274 void slotViewShowProject();
00276 void slotViewSearch();
00278 void slotViewFullScreen();
00280 void slotViewLineNumbers();
00282 void slotViewWhiteSpaces();
00284 void slotViewMargin();
00286 void slotViewFoldMargin();
00288 void slotViewZoomIn();
00290 void slotViewZoomOut();
00292 void slotViewShowMessagePanel();
00294 void slotViewShowSidePanel();
00296 void slotToolsCompile();
00298 void slotToolsBuild();
00300 void slotToolsGo();
00302 void slotToolsKill();
00304 void slotToolsNextMessage();
00306 void slotToolsPrevMessage();
00308 void slotProjectNew();
00310 void slotProjectCreate();
00312 void slotProjectOpen(QString file=QString::null, bool recentProject = true);
00314 void slotProjectClose();
00316 void slotProjectOptions();
00318 void slotOptSettings();
00320 void slotOptShortcuts();
00322 void slotOptAutoIndent();
00324 void slotOptEditPreConfigFile();
00326 void slotOptEditPostConfigFile();
00328 void slotOptShowCutercFile();
00330 void slotOptQtConfig();
00332 void slotExtraRunScript();
00334 void slotExtraRunCurrentFile();
00336 void slotExtraRunPythonString();
00338 void slotExtraEvalSelection();
00340 void slotExtraSaveSession();
00342 void slotExtraLoadSession();
00344 void slotExtraCloseSession();
00346 void slotExtraStartMacroRecording();
00348 void slotExtraStopMacroRecording();
00350 void slotExtraRunMacro();
00352 void slotExtraLoadMacro();
00354 void slotExtraSaveMacro();
00356 void slotExtraBuildTagsFile();
00358 void slotWindowsDialog();
00360 void slotHelpHandbook();
00362 void slotHelpAbout();
00364 void slotHelpLicense();
00366 void slotHelpAboutQt();
00368 void slotStatusHelpMsg(const QString &text);
00370 virtual void switchToToplevelMode();
00372 virtual void switchToChildframeMode();
00374 void switchStyle(int item);
00376 void switchLineFeed(int item);
00378 void switchTab(int item);
00380 void switchLang(int item);
00382 void updateViews();
00384 void execCmd(QString cmd = QString::null);
00386 void evalCmdParameter();
00388 void slotCursorPositionChanged(int line, int pos);
00390 void slotEscapePressed();
00392 void slotUpdateBookmarksMenu();
00394 void slotGotoBookmark(int id);
00396 void addRecentFile(QString file);
00398 void addRecentProject(QString file);
00400 void configure();
00402 void slotClearAllOutputViews();
00404 void addTool(char *name, char *cute_command);
00406 void addPythonTool(QAction *action);
00408 void updateEditActions();
00410 void findTag(QString file, QString pattern);
00412 void closeAllViews();
00413 protected slots:
00414 void activateView(QextMdiChildView *pWnd);
00415 void readyReadGrepStdout();
00417 void readStdout();
00419 void readStderr();
00421 void slotProcessExited();
00423 void slotProcessKilled();
00425 void slotJump(QString fileName, unsigned int lineno, bool mark=true);
00426 void updateRecentFilesMenu();
00427 void openRecentFile( int item );
00428 void updateRecentProjectsMenu();
00429 void openRecentProject( int item );
00430 void slotLoadFile(const QString&);
00431 void slotLastChildViewClosed();
00432 void autoComplete();
00433 void findSelection();
00434 void enterSelection();
00435 void findTag(TagPosition tag);
00436 void slotLangConfigFileMenu(int item);
00438 void updateViewMenu();
00440 void updateActions();
00442 void loadFileFromDir(const QString &);
00444 void loadTags( QString file = QString::null );
00446 void loadProjectFile(ProjectFile*);
00448 void loadProjectFile(QString);
00450 void setupEnvironment(QString oldConfig=QString::null);
00452 void addProjectFile( QString fileName );
00454 void switchLang(QString name);
00456 void updateProject(CUTEView *);
00457 signals:
00458 void killProcess();
00459 protected:
00461 void addQExtMDIFrame(QWidget* pNewView, int flags);
00463 void resizeEvent ( QResizeEvent * );
00465 void showEvent( QShowEvent *e );
00467 void closeEvent( QCloseEvent *e );
00469 QPopupMenu *createLangConfigFileMenu();
00471 void setMessagePanelVisibility(bool);
00473 void setSidePanelVisibility(bool);
00475 bool isToolViewVisible(QWidget* pToolView);
00477 bool isMessagePanelVisible();
00479 bool isSidePanelVisible();
00480 private:
00482 struct TagPosition
00483 {
00484 TagPosition(QString f, int l) : file(f), line(l) {}
00485 TagPosition(QString f, QString p) : file(f), pattern(p), line(-1) {}
00486 QString file;
00487 QString pattern;
00488 int line;
00489 };
00491 Project *project;
00493 QDir projectDir;
00495 QPopupMenu *fileMenu;
00497 QPopupMenu *editMenu;
00499 QPopupMenu *viewMenu;
00501 QPopupMenu *langMenu;
00503 QPopupMenu *helpMenu;
00505 QPopupMenu *themes;
00507 QPopupMenu *tabMenu;
00509 QPopupMenu *lineFeed;
00511 QPopupMenu *projectMenu;
00513 QPopupMenu *toolsMenu;
00515 QPopupMenu *recentFilesMenu;
00517 QPopupMenu *recentProjectsMenu;
00519 QPopupMenu *langConfigFileMenu;
00520
00521 QToolBar *toolbar;
00522 QToolBar *cmdToolbar;
00523 QCommandBox *cmdLine;
00524 int m_currentNumber;
00525
00526 QAction *fileNew, *fileOpen, *fileReopen, *fileChangeWorkingDir, *fileClose, *fileSave, *fileSaveAll,
00527 *fileSaveAs, *filePrint, *fileLoadTagsFile, *fileUnloadTagsFile, *fileExit;
00528 QAction *editGotoMatchingBrace, *editSelectToMatchingBrace, *editUndo, *editRedo, *editCut, *editCopy,
00529 *editPaste, *editDelete, *editSelectAll, *editIndent, *editUnindent, *editInsertCommand, *editFilter,
00530 *editAutoComplete, *editStreamComment, *editBlockComment;
00531 QAction *searchFind, *searchFindNext, *searchFindPrevious, *searchFindInFiles, *searchReplace,
00532 *searchGoTo, *searchToggleBookmark, *searchClearAllBookarks, *searchRenameBookmark,
00533 *searchFindNextBookmark, *searchFindPrevBookmark, *searchFindSelection, *searchEnterSelection,
00534 *searchFindTag, *searchFindNextTag, *searchFindPreviousTag;
00535 QAction *viewFullscreen, *viewToolbar, *viewStatusbar, *viewWhitespaces, *viewEndOfLines,
00536 *viewLineNumbers, *viewMargin, *viewFoldMargin, *viewZoomIn, *viewZoomOut, *viewToggleCurrentFold,
00537 *viewToggleAllFolds, *viewWrapLines, *viewBraceMatch, *viewCmdToolbar, *viewShowDirView,
00538 *viewShowMessages, *viewShowStdout, *viewShowStderr, *viewShowShell, *viewShowSearch,
00539 *viewShowMessagePanel, *viewShowSidePanel, *viewShowTags, *viewShowProject;
00540 QAction *toolsCompile, *toolsBuild, *toolsGo, *toolsStop, *toolsNextMessage, *toolsPrevMessage;
00541 QAction *projectNew, *projectOpen, *projectClose, *projectOptions, *projectCreate;
00542 QAction *optionsPreferences, *optionsShortcuts, *optionsEditPreConfigFile, *optionsEditPostConfigFile,
00543 *optionsQtConfig, *optionsAutoIndent, *optionsShowCutercFile;
00544 QAction *extraRunScript, *extraRunCurrentFile, *extraSaveSession, *extraLoadSession, *extraAddTool,
00545 *extraRunCmd, *extraRunPyCmd, *extraEvalSelection, *extraCloseSession, *extraStartMacroRecording,
00546 *extraStopMacroRecording, *extraRunMacro, *extraLoadMacro, *extraSaveMacro, *extraBuildTagsFile;
00547 QAction *windowsNext, *windowsPrevious, *windowsTile, *windowsCascade, *windowsShowWindows;
00548 QAction *helpHandbook, *helpAbout, *helpLicense, *helpAboutQt;
00549
00551 QAction *charLeft, *charRight, *lineUp, *lineDown, *wordPartLeft, *wordPartRight, *wordLeft,
00552 *wordRight, *VCHome, *homeDisplay, *lineEnd, *lineScrollDown, *lineScrollUp, *paraUp,
00553 *paraDown, *pageUp, *pageDown, *documentStart, *documentEnd, *tab, *backTab, *selectAll,
00554 *charLeftExtend, *charRightExtend, *lineUpExtend, *lineDownExtend, *wordPartLeftExtend,
00555 *wordPartRightExtend, *wordLeftExtend, *wordRightExtend, *VCHomeExtend, *homeDisplayExtend,
00556 *lineEndExtend, *paraUpExtend, *paraDownExtend, *pageUpExtend, *pageDownExtend,
00557 *documentStartExtend, *documentEndExtend, *deleteBack, *deleteBackNotLine, *clear,
00558 *delWordLeft, *delWordRight, *delLineLeft, *delLineRight, *newLine, *lineDelete,
00559 *lineDuplicate, *lineTranspose, *lineCut, *cut, *lineCopy, *copy, *paste, *redo, *undo,
00560 *cancel, *editToggleOvertype, *lowerCase, *upperCase, *zoomIn, *zoomOut;
00561
00562 #ifndef QT_NO_STYLE_MOTIF
00563 int motif_style;
00564 #endif
00565 #ifndef QT_NO_STYLE_CDE
00566 int cde_style;
00567 #endif
00568 #ifndef QT_NO_STYLE_INTERLACE
00569 int interlace_style;
00570 #endif
00571 #ifndef QT_NO_STYLE_MOTIFPLUS
00572 int motifplus_style;
00573 #endif
00574 #ifndef QT_NO_STYLE_SGI
00575 int sgi_style;
00576 #endif
00577 #ifndef QT_NO_STYLE_WINDOWS
00578 int windows_style;
00579 #endif
00580 #ifndef QT_NO_STYLE_PLATINUM
00581 int platinum_style;
00582 #endif
00583 int default_style;
00584 int metal_style, step_style;
00585 int unix_line_feed, win_line_feed, mac_line_feed;
00587 ProjectDlg *projectDlg;
00589 ReplaceDlg *replaceDlg;
00591 FindDlg *findDlg;
00593 FindInFilesDlg *findInFilesDlg;
00595 SettingsDlg *settingsDlg;
00597 ShortcutsDlg *shortcutsDlg;
00599 KDockWidget *dockStdout, *dockStderr, *dockOutput, *dockGrepout, *dockDirview, *dockShell,
00600 *dockTagsview, *dockProjectview;
00602 OutputView *stdout, *stderr, *output;
00604 TagsDlg *tagsDlg;
00605 GrepOutputView *grepout;
00607 CUTEShell *cuteShell;
00609 DirectoryView *dirView;
00611 TagsView *tagsView;
00613 ProjectView *projectView;
00615 HelpViewer *helpViewer;
00617 char *session;
00619 CmdInterpreter *cmdInterpreter;
00621 tagFile *tags;
00623 QString tagsFile;
00625 QPtrList<TagPosition> tagStack;
00627 QString lastDir;
00629 QMap<int, QAction*> editActions;
00631 QProcess *proc;
00633 bool view_actions_updated;
00634 };
00635
00636 #endif
00637