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

cuteview.h

00001 /***************************************************************************
00002                           cuteview.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 __CUTEVIEW_H__
00019 #define __CUTEVIEW_H__
00020 
00021 // include files for QextMDI
00022 #include <qextmdichildview.h>
00023 
00024 #include <qextscintillamacro.h>
00025 #include <qcolor.h>
00026 #include <qfile.h>
00027 #include <qaction.h>
00028 #include <qmap.h>
00029 #include <qprocess.h>
00030 #include <qvaluelist.h>
00031 #include <list>
00032 
00033 #include "cutescintilla.h"
00034 
00035 namespace Config{ class Lexer; }
00036 
00038 class ScintillaAction
00039 {
00040 public:
00041     ScintillaAction(unsigned int msg, unsigned long wParam, long lParam);
00042     ScintillaAction(const ScintillaAction& a);
00043     ~ScintillaAction(){
00044         delete[] lParam;
00045     }
00046     unsigned int msg;
00047     unsigned long wParam;
00048     char *lParam;
00049     ScintillaAction &operator=(const ScintillaAction& a);
00050 };
00051 
00055 class CUTEView : public QextMdiChildView
00056 {
00057   Q_OBJECT
00058 public:
00059     enum { CUTE_MARGIN = 0, CUTE_LINENUMBER_MARGIN = 1, CUTE_FOLD_MARGIN = 2 };
00060     CUTEView(QWidget *parent=0, QString title = "Document", tagFile *tags=0);
00061     ~CUTEView();
00063     void configure();
00065     void sendEditor(unsigned int msg, unsigned long wParam=0, long lParam=0);
00067     bool loadFile(const char *file);
00069     bool reloadFile();
00071     bool saveFile(const char *file=0, bool force=false);
00073     void toggleBookmark(int line);
00075     void addError(int line );
00077     int addBookmark(int line );
00079     void deleteAllErrors();
00081     void findNextBookmark();
00083     void findPrevBookmark();
00085     void insertCommand(QString);
00087     void filter(QString);
00089     void startMacroRecording();
00091     void stopMacroRecording();
00093     void runMacro();
00095     void loadMacro(QString &file);
00097     void saveMacro(QString &file);
00099     bool setMacro(QString);
00101     QString macroString();
00103     bool findFirst(const QString &expr, bool re=false, bool cs=false, bool wo=false, bool wrap=true, bool forward=TRUE, int line=-1, int index=-1);
00105     bool findNext();
00107     bool findPrev();
00109     QString line(int);
00111     void setupLexer(const QString&);
00113     void replaceAll(const QString &expr, const QString &replaceStr, bool re, bool cs, bool wo, bool wrap, bool forward=TRUE, bool confirm=false);
00115     bool edited();
00117     bool canUndo();
00119     bool canRedo();
00121     void undo();
00123     void redo();
00125     CUTEScintilla* scintilla();
00127     void setActions(QMap<int, QAction*>);
00129     char *fileName() { return filename; }
00131     Config::Lexer *lexer() { return _lexer; }
00133     void setLexer( Config::Lexer *l ) { _lexer = l; }
00135     void getCursorPosition( int &line, int &index );
00137     void getSelection(int &lineFrom,int &indexFrom, int &lineTo,int &indexTo);
00139     void clear();
00141     QValueList<int> bookmarks();
00143     void removeAllBookmarks();
00145     QString langName();
00146 protected:
00148     void closeEvent(QCloseEvent *e);
00149 protected slots:
00151     void slotDocumentChanged();
00153     void slotMarginClicked(int margin, int line, Qt::ButtonState state);
00155     void insertStdout();
00157     void processExited();
00159     void recordMacro(unsigned int, unsigned long, long);
00161     void slotCharAdded(int);
00163     void slotModificationChanged(bool);
00164 signals: 
00165     void save();
00166     void closed(CUTEView *view=0);
00167 private:
00168     CUTEScintilla *view;
00169     Config::Lexer *_lexer;
00171     QProcess *proc;
00172     char *filename;
00173     int bookmark, error;
00174     bool recording;
00175     std::list<ScintillaAction> macro;
00176     QString searchString;
00177     bool searchRegExp;
00178     bool searchCaseSensitive;
00179     bool searchWholeWord;
00180     bool searchLineWrap;
00181     bool searchDirection;
00182     bool searching;
00183     QValueList<int> handles;
00184 };
00185 
00186 #endif

Generated on Sat Mar 6 16:21:56 2004 by doxygen 1.3.2