Diffstat (limited to 'noncore/apps/tinykate/libkate/document') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedocument.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.h b/noncore/apps/tinykate/libkate/document/katedocument.h index 9d8ec6a..969be87 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.h +++ b/noncore/apps/tinykate/libkate/document/katedocument.h @@ -1,127 +1,127 @@ /*************************************************************************** katedocument.h - description ------------------- begin : Mon Jan 15 2001 copyright : (C) 2001 by Christoph "Crossfire" Cullmann (C) 2002 by Joseph Wenninger email : crossfire@babylon2k.de jowenn@kde.org - + ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ /* Copyright (C) 1998, 1999 Jochen Wilhelmy digisnap@cs.tu-berlin.de This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef kate_document_h #define kate_document_h #include <qobject.h> #include <qlist.h> #include <qcolor.h> #include <qfont.h> #include <qfontmetrics.h> #include <qdatetime.h> #include <qfileinfo.h> #include "../view/kateview.h" #include "katehighlight.h" #include "katebuffer.h" #include "katetextline.h" #include <qptrdict.h> class KateCmd; class CachedFontMetrics : public QFontMetrics { private: short *warray[256]; public: CachedFontMetrics(const QFont& f) : QFontMetrics(f) { for (int i=0; i<256; i++) warray[i]=0; } ~CachedFontMetrics() { for (int i=0; i<256; i++) if (warray[i]) delete[] warray[i]; } int width(QChar c) { uchar cell=c.cell(); uchar row=c.row(); short *wa=warray[row]; if (!wa) { - // qDebug("create row: %d",row); + // odebug << "create row: " << row << oendl; wa=warray[row]=new short[256]; for (int i=0; i<256; i++) wa[i]=-1; } if (wa[cell]<0) wa[cell]=(short) QFontMetrics::width(c); return (int)wa[cell]; } int width(QString s) { return QFontMetrics::width(s); } }; class Attribute { public: Attribute() { ; }; QColor col; QColor selCol; bool bold; bool italic; }; class KateAction { public: enum Action {replace, wordWrap, wordUnWrap, newLine, delLine, insLine, killLine};//, doubleLine, removeLine}; KateAction(Action, PointStruc &cursor, int len = 0, const QString &text = QString::null); Action action; PointStruc cursor; int len; QString text; KateAction *next; }; class KateActionGroup { public: // the undo group types enum { ugNone, // ugPaste, // paste ugDelBlock, // delete/replace selected text ugIndent, // indent ugUnindent, // unindent ugComment, // comment ugUncomment, // uncomment ugReplace, // text search/replace ugSpell, // spell check ugInsChar, // char type/deleting ugDelChar, // '' '' @@ -134,97 +134,97 @@ class KateActionGroup { void insertAction(KateAction *); static const char * typeName(int type); PointStruc start; PointStruc end; KateAction *action; int undoType; }; /** The text document. It contains the textlines, controls the document changing operations and does undo/redo. WARNING: do not change the text contents directly in methods where this is not explicitly permitted. All changes have to be made with some basic operations, which are recorded by the undo/redo system. @see TextLine @author Jochen Wilhelmy */ class KateDocument: public Kate::Document { Q_OBJECT friend class KateViewInternal; friend class KateView; friend class KateIconBorder; public: KateDocument(bool bSingleViewMode=false, bool bBrowserView=false, QWidget *parentWidget = 0, const char *widgetName = 0, QObject * = 0, const char * = 0); ~KateDocument(); protected: QFont myFont, myFontBold, myFontItalic, myFontBI; CachedFontMetrics myFontMetrics, myFontMetricsBold, myFontMetricsItalic, myFontMetricsBI; public: void setFont (QFont font); QFont getFont () { return myFont; }; CachedFontMetrics getFontMetrics () { return myFontMetrics; }; virtual bool saveFile(); virtual KTextEditor::View *createView( QWidget *parent, const char *name ); virtual QString textLine( int line ) const; virtual void insertLine( const QString &s, int line = -1 ); void insert_Line(const QString& s,int line=-1, bool update=true); void remove_Line(int line,bool update=true); - void replaceLine(const QString& s,int line=-1); + void replaceLine(const QString& s,int line=-1); virtual void insertAt( const QString &s, int line, int col, bool mark = FALSE ); virtual void removeLine( int line ); virtual int length() const; virtual void setSelection( int row_from, int col_from, int row_to, int col_t ); virtual bool hasSelection() const; virtual QString selection() const; // only to make part work, don't change it ! bool m_bSingleViewMode; // public interface /** * gets the number of lines */ virtual int numLines() const; /** * gets the last line number (numLines() -1) */ int lastLine() const {return numLines()-1;} /** gets the given line @return the TextLine object at the given line @see TextLine */ TextLine::Ptr getTextLine(int line) const; /** get the length in pixels of the given line */ int textLength(int line); void setTabWidth(int); int tabWidth() {return tabChars;} void setReadOnly(bool); bool isReadOnly() const; void setNewDoc( bool ); bool isNewDoc() const; virtual void setReadWrite( bool ){}; virtual bool isReadWrite() const {return true;} virtual void setModified(bool); virtual bool isModified() const; void setSingleSelection(bool ss) {m_singleSelection = ss;} bool singleSelection() {return m_singleSelection;} void readConfig(); @@ -489,82 +489,82 @@ class KateDocument: public Kate::Document QString encoding() { return myEncoding; }; void setWordWrap (bool on); bool wordWrap () { return myWordWrap; }; void setWordWrapAt (uint col); uint wordWrapAt () { return myWordWrapAt; }; signals: void modStateChanged (KateDocument *doc); void nameChanged (KateDocument *doc); public: QList<Kate::Mark> marks (); public slots: // clear buffer/filename - update the views void flush (); signals: /** The file has been saved (perhaps the name has changed). The main window can use this to change its caption */ void fileNameChanged (); public: //end of line settings enum Eol_settings {eolUnix=0,eolDos=1,eolMacintosh=2}; // for the DCOP interface public: void open (const QString &name=0); public: // wrap the text of the document at the column col void wrapText (uint col); public slots: void applyWordWrap (); private: class KateDocPrivate { public: bool hlSetByUser; }; - - + + // BCI: Add a real d-pointer in the next BIC release static QPtrDict<KateDocPrivate>* d_ptr; static void cleanup_d_ptr() { delete d_ptr; } - + KateDocPrivate* d( const KateDocument* foo ) { if ( !d_ptr ) { d_ptr = new QPtrDict<KateDocPrivate>; //qAddPostRoutine( cleanup_d_ptr ); } KateDocPrivate* ret = d_ptr->find( (void*) foo ); if ( ! ret ) { ret = new KateDocPrivate; d_ptr->replace( (void*) foo, ret ); } return ret; } - + void delete_d( const KateDocument* foo ) { if ( d_ptr ) d_ptr->remove( (void*) foo ); } }; #endif |