Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members

cute.h

00001 /***************************************************************************
00002                           cute.h  -  description
00003                              -------------------
00004     begin                : Sam Sep 28 23:53:49 CEST 2002
00005     copyright            : (C) 2002 by Heiko Köhler
00006     email                : heicom@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef __CUTE_H__
00019 #define __CUTE_H__
00020 
00021 // include files for QT
00022 #include <qfeatures.h>
00023 #include <qstring.h>
00024 #include <qdir.h>
00025 #include <qpopupmenu.h>
00026 #include <qaccel.h>
00027 #include <qmenubar.h>
00028 #include <qtoolbar.h>
00029 #include <qpixmap.h>
00030 #include <qtoolbutton.h>
00031 #include <qapplication.h>
00032 #include <qstatusbar.h>
00033 #include <qwhatsthis.h>
00034 #include <qmessagebox.h>
00035 #include <qfiledialog.h>
00036 #include <qprinter.h>
00037 #include <qpainter.h>
00038 #include <qaction.h>
00039 #include <qregexp.h>
00040 #include <qcombobox.h>
00041 #include <qmap.h>
00042 #include <qtextbrowser.h>
00043 #include <qptrlist.h>
00044 #include <qprocess.h>
00045 #include <qvaluelist.h>
00046 
00047 #include <map>
00048 #include <list>
00049 #include <string>
00050 
00051 // application specific includes
00052 #include "mdi.h"
00053 #include "resource.h"
00054 #include "readtags.h"
00055 #include "icons/pixmaps.h"
00056 #include "cuteview.h"
00057 #include "python_api.h"
00058 #include "shortcuts.h"
00059 
00060 class Project;
00061 class ProjectFile;
00062 class ProjectDlg;
00063 class OutputView;
00064 class GrepOutputView;
00065 class TagOutputView;
00066 class DirectoryView;
00067 class TagsView;
00068 class ProjectView;
00069 class TagsDlg;
00070 class QCommandBox;
00071 class CmdInterpreter;
00072 class SettingsDlg;
00073 class FindDlg;
00074 class ReplaceDlg;
00075 class FindInFilesDlg;
00076 class ShortcutsDlg;
00077 class CUTEScintilla;
00078 class CUTEShell;
00079 class HelpViewer;
00080 
00081 
00083 class CUTEAction : public QAction
00084 {
00085     Q_OBJECT
00086 public:
00088     CUTEAction(QString command, QObject *parent, const char *name=0);
00089 protected slots:
00091     void execCmd();
00092 private:
00094     QString cmd;
00095 };
00096 
00097 extern std::list<std::string> recentFilesList;
00098 extern QValueList<QString> recentProjectList;
00099 
00106 class CUTE : public MainWindow
00107 {
00108     Q_OBJECT
00109     struct TagPosition;
00110     friend class SaveDlg;
00111     friend class CUTEScintilla;
00112     friend class CmdInterpreter;
00113     friend class Shortcuts;
00114     friend void API::initcute();
00115     friend PyObject *API::activateView(PyObject*, PyObject*);
00116     friend PyObject *API::viewList(PyObject*, PyObject*);
00117 public:
00119     CUTE();
00121     ~CUTE();
00123     void initLangMenu();
00125     void initActions();
00127     void initEditActions();
00129     void initMenuBar();
00132     void initToolBar();
00134     void initStatusBar();
00136     void initDoc();
00138     void initView();
00140     bool loadFile(const QString&, bool recentFile=false, bool showDialogs=true);
00142     bool queryExit();
00144     void printOutput(std::string str);
00146     void clearOutput();
00148     void setSession(const char *str) { 
00149         session = new char[strlen(str)+1]; strcpy(session, str); }
00151     void saveSession();
00153     void loadSession(QString file);
00155     void filter(QString cmd);
00157     void insertCommand(QString cmd);
00159     void tagContext(QString filename, QString pattern);
00160     void tagContext(QString filename, int tagline);
00161     void tagOutputAppend(QString filename, QString *lines, int line);
00162 public slots:
00164     void newWindow() { slotFileNew(); }
00166     void statusCallback(int id_);
00168     void slotFileNew();
00170     void slotFileOpen();
00172     void slotFileReopen();
00174     void slotFileChangeWorkingDir();
00176     void slotFileSave();
00178     void slotFileSaveAs();
00180     void slotFileSaveAll();
00182     void slotFileCloseAll();
00184     void slotFileClose();
00186     void slotFileLoadTagsFile();
00188     void slotFileUnloadTagsFile();
00190     void slotFilePrint();
00192     void slotFileQuit();
00194     void slotEditGotoMatchingBrace();
00196     void slotEditSelectToMatchingBrace();
00198     void slotEditUndo();
00200     void slotEditRedo();
00203     void slotEditCut();
00205     void slotEditCopy();
00207     void slotEditPaste();
00209     void slotEditDelete();
00211     void slotEditIndent();
00213     void slotEditUnindent();
00215     void slotEditSelectAll();
00217     void slotEditInsertCommand();
00219     void slotEditFilter();
00221     void slotEditBlockComment();
00223     void slotEditStreamComment();
00225     void slotSearchFind();
00227     void slotSearchFindNext();
00229     void slotSearchFindPrevious();
00231     void slotSearchFindInFiles();
00233     void slotSearchReplace();
00235     void slotSearchGoto();
00237     void slotSearchFindTag();
00239     void slotTagContext();
00241     void slotSearchFindNextTag();
00243     void slotSearchFindPreviousTag();
00245     void slotSearchToggleBookmark();
00247     void slotSearchNextBookmark();
00249     void slotSearchPrevBookmark();
00251     void slotSearchRenameBookmark();
00253     void slotViewToggleCurrentFold();
00255     void slotViewToggleAllFolds();
00257     void slotViewWrapLines();
00259     void slotViewBraceMatch();
00261     void slotViewToolBar();
00263     void slotViewCmdToolBar();
00265     void slotViewSearch();
00267     void slotViewStatusBar();
00269     void slotViewFullScreen();
00271     void slotViewLineNumbers();
00273     void slotViewWhiteSpaces();
00275     void slotViewMargin();
00277     void slotViewFoldMargin();
00279     void slotViewZoomIn();
00281     void slotViewZoomOut();
00283     void slotViewShowMessagePanel();
00285     void slotViewShowSidePanel();
00286     void slotViewSwitchFocusCmdBox();
00287     void slotViewSwitchFocusDir();
00288     void slotViewSwitchFocusTagsFile();
00289     void slotViewSwitchFocusPro();
00290     void slotViewSwitchFocusMessages();
00291     void slotViewSwitchFocusStdout();
00292     void slotViewSwitchFocusStderr();
00293     void slotViewSwitchFocusShell();
00294     void slotViewSwitchFocusSearch();
00295     void slotViewSwitchFocusTags();
00296     void slotViewSwitchFocusDoc();
00298     void slotToolsCompile();
00300     void slotToolsBuild();
00302     void slotToolsGo();
00304     void slotToolsKill();
00306     void slotToolsNextMessage();
00308     void slotToolsPrevMessage();
00310     void slotProjectNew();
00312     void slotProjectOpen(QString file=QString::null, bool recentProject = true);
00314     void slotProjectClose(bool closeFiles = true);
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     void switchStyle(int item);
00372     void switchLineFeed(int item);
00374     void switchTab(int item);
00376     void switchLang(int item);
00378     void updateViews();
00380     void execCmd(QString cmd = QString::null);
00382     void evalCmdParameter();
00384     void slotCursorPositionChanged(int line, int pos);
00386     void slotUpdateBookmarksMenu();
00388     void slotGotoBookmark(int id);
00390     void addRecentFile(QString file);
00392     void addRecentProject(QString file, bool mustExists=true);
00394     void configure();
00396     void slotClearAllOutputViews();
00398     void addTool(char *name, char *cute_command);
00400     void addPythonTool(QAction *action);
00402     void updateEditActions();
00404     void findTag(QString file, QString pattern);
00406     void closeAllViews();
00407 protected slots:
00409     void activateWindow(QWidget *pWnd);
00411     void readyReadGrepStdout();
00413     void readStdout();
00415     void readStderr();
00417     void slotProcessExited();
00419     void slotProcessKilled();
00421     void slotJump(QString fileName, unsigned int lineno, bool mark=true);
00422     void updateRecentFilesMenu();
00423     void openRecentFile( int item );
00424     void updateRecentProjectsMenu();
00425     void openRecentProject( int item );
00426     void slotLoadFile(const QString&);
00427     void slotLastChildViewClosed();
00428     void autoComplete();
00429     void findSelection();
00430     void enterSelection();
00431     void findTag(TagPosition tag);
00432     void slotLangConfigFileMenu(int item);
00434     void updateViewMenu();
00436     void updateActions();
00438     void loadFileFromDir(const QString &);
00440     void loadTags( QString file = QString::null );
00442     void loadProjectFile(ProjectFile*);
00444     void loadProjectFile(QString);
00446     void setupEnvironment(QString oldConfig=QString::null);
00448     void addProjectFile( CUTEView *view );
00450     void switchLang(QString name);
00452     void updateProject(CUTEView *, bool loadFile=false);
00454     void slotModificationChanged();
00455 signals:
00456     void killProcess();
00457 protected:
00459     void showEvent( QShowEvent *e );
00461     void closeEvent( QCloseEvent *e );
00463     QPopupMenu *createLangConfigFileMenu();
00465     void setMessagePanelVisibility(bool);
00467     void setSidePanelVisibility(bool);
00469     bool isMessagePanelVisible();
00471     bool isSidePanelVisible();
00473     void updateCaption();
00474 private:
00476     struct TagPosition
00477     {
00478         TagPosition(QString f, int l) : file(f), line(l) {}
00479         TagPosition(QString f, QString p) : file(f), pattern(p), line(-1) {}
00480         QString file;
00481         QString pattern;
00482         int line;
00483     };
00485     Project *project;
00487     QDir projectDir;
00489     QPopupMenu *fileMenu;
00491     QPopupMenu *editMenu;
00493     QPopupMenu *viewMenu;
00495     QPopupMenu *langMenu;
00497     QPopupMenu *helpMenu;
00499     QPopupMenu *themes;
00501     QPopupMenu *tabMenu;
00503     QPopupMenu *lineFeed;
00505     QPopupMenu *projectMenu;
00507     QPopupMenu *toolsMenu;
00509     QPopupMenu *recentFilesMenu;
00511     QPopupMenu *recentProjectsMenu;
00513     QPopupMenu *langConfigFileMenu;
00514     
00515     QToolBar *toolbar;
00516     QToolBar *cmdToolbar;
00517     QCommandBox *cmdLine;
00518     int m_currentNumber;    // view number
00519     
00520     QAction *fileNew, *fileOpen, *fileReopen, *fileChangeWorkingDir, *fileClose, *fileCloseAll, *fileSave, *fileSaveAll, 
00521         *fileSaveAs, *filePrint, *fileLoadTagsFile, *fileUnloadTagsFile, *fileExit;
00522     QAction *editGotoMatchingBrace, *editSelectToMatchingBrace, *editUndo, *editRedo, *editCut, *editCopy, 
00523         *editPaste, *editDelete, *editSelectAll, *editIndent, *editUnindent, *editInsertCommand, *editFilter, 
00524         *editAutoComplete, *editStreamComment, *editBlockComment;
00525     QAction *searchFind, *searchFindNext, *searchFindPrevious, *searchFindInFiles, *searchReplace,
00526         *searchGoTo, *searchToggleBookmark, *searchClearAllBookarks, *searchRenameBookmark,
00527         *searchFindNextBookmark, *searchFindPrevBookmark, *searchFindSelection, *searchEnterSelection,
00528         *searchFindTag, *searchFindNextTag, *searchFindPreviousTag, *searchJumpToTag;
00529     QAction *viewFullscreen, *viewToolbar, *viewStatusbar, *viewWhitespaces, *viewEndOfLines,
00530         *viewLineNumbers, *viewMargin, *viewFoldMargin, *viewZoomIn, *viewZoomOut, *viewToggleCurrentFold,
00531         *viewToggleAllFolds, *viewWrapLines, *viewBraceMatch, *viewCmdToolbar, *viewShowDirView, 
00532         *viewShowMessages, *viewShowStdout, *viewShowStderr, *viewShowShell, *viewShowSearch,
00533         *viewShowMessagePanel, *viewShowSidePanel, *viewShowTags, *viewShowProject;
00534     QAction *viewSwitchFocusDir, *viewSwitchFocusTagsFile, *viewSwitchFocusPro, *viewSwitchFocusMessages, 
00535         *viewSwitchFocusStdout, *viewSwitchFocusStderr, *viewSwitchFocusShell, *viewSwitchFocusSearch, 
00536         *viewSwitchFocusTags, *viewSwitchFocusDoc, *viewSwitchFocusCmdBox;
00537     QAction *toolsCompile, *toolsBuild, *toolsGo, *toolsStop, *toolsNextMessage, *toolsPrevMessage;
00538     QAction *projectNew, *projectOpen, *projectClose, *projectOptions;
00539     QAction *optionsPreferences, *optionsShortcuts, *optionsEditPreConfigFile, *optionsEditPostConfigFile, 
00540         *optionsQtConfig, *optionsAutoIndent, *optionsShowCutercFile;
00541     QAction *extraRunScript, *extraRunCurrentFile, *extraSaveSession, *extraLoadSession, *extraAddTool, 
00542         *extraRunCmd, *extraRunPyCmd, *extraEvalSelection, *extraCloseSession, *extraStartMacroRecording, 
00543         *extraStopMacroRecording, *extraRunMacro, *extraLoadMacro, *extraSaveMacro, *extraBuildTagsFile;
00544     QAction *windowsNext, *windowsPrevious, *windowsTile, *windowsCascade, *windowsShowWindows;
00545     QAction *helpHandbook, *helpAbout, *helpLicense, *helpAboutQt;
00546 
00548     QAction *charLeft, *charRight, *lineUp, *lineDown, *wordPartLeft, *wordPartRight, *wordLeft, 
00549             *wordRight, *VCHome, *homeDisplay, *lineEnd, *lineScrollDown, *lineScrollUp, *paraUp, 
00550             *paraDown, *pageUp, *pageDown, *documentStart, *documentEnd, *tab, *backTab, *selectAll,
00551             *charLeftExtend, *charRightExtend, *lineUpExtend, *lineDownExtend, *wordPartLeftExtend,
00552             *wordPartRightExtend, *wordLeftExtend, *wordRightExtend, *VCHomeExtend, *homeDisplayExtend,
00553             *lineEndExtend, *paraUpExtend, *paraDownExtend, *pageUpExtend, *pageDownExtend,
00554             *documentStartExtend, *documentEndExtend, *deleteBack, *deleteBackNotLine, *clear,
00555             *delWordLeft, *delWordRight, *delLineLeft, *delLineRight, *newLine, *lineDelete,
00556             *lineDuplicate, *lineTranspose, *lineCut, *cut, *lineCopy, *copy, *paste, *redo, *undo,
00557             *cancel, *editToggleOvertype, *lowerCase, *upperCase, *zoomIn, *zoomOut;
00558 
00559 #ifndef QT_NO_STYLE_MOTIF
00560     int motif_style;
00561 #endif
00562 #ifndef QT_NO_STYLE_CDE
00563     int cde_style;
00564 #endif
00565 #ifndef QT_NO_STYLE_INTERLACE
00566     int interlace_style;
00567 #endif
00568 #ifndef QT_NO_STYLE_MOTIFPLUS
00569     int motifplus_style;
00570 #endif
00571 #ifndef QT_NO_STYLE_SGI
00572     int sgi_style;
00573 #endif
00574 #ifndef QT_NO_STYLE_WINDOWS
00575     int windows_style;
00576 #endif
00577 #ifndef QT_NO_STYLE_PLATINUM
00578     int platinum_style;
00579 #endif
00580     int default_style;
00581     int metal_style, step_style;
00582     int unix_line_feed, win_line_feed, mac_line_feed;
00584     ProjectDlg *projectDlg;
00586     ReplaceDlg *replaceDlg;
00588     FindDlg *findDlg;
00590     FindInFilesDlg *findInFilesDlg;
00592     SettingsDlg *settingsDlg;
00594     ShortcutsDlg *shortcutsDlg;
00596     DockWindow *sidePanel, *messagePanel;
00598     OutputView *stdout, *stderr, *output;
00600     TagsDlg *tagsDlg;
00601     GrepOutputView *grepout;
00602     TagOutputView *tagout;
00604     CUTEShell *cuteShell;
00606     DirectoryView *dirView;
00608     TagsView *tagsView;
00610     ProjectView *projectView;
00612     HelpViewer *helpViewer;
00614     char *session;
00616     CmdInterpreter *cmdInterpreter;
00618     tagFile *tags;
00620     QString tagsFile;
00622     QPtrList<TagPosition> tagStack;
00624     QString lastDir;
00626     QMap<int, QAction*> editActions;
00628     QProcess *proc;
00630     bool view_actions_updated;
00631 };
00632 
00633 #endif
00634 

Generated on Sun May 2 20:02:57 2004 by doxygen 1.3.2