summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/document/katedocument.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katedocument.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp
index f05e21a..0c742d7 100644
--- a/noncore/apps/tinykate/libkate/document/katedocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp
@@ -75,193 +75,193 @@
#include "../view/kateview.h"
#include "katebuffer.h"
#include "katetextline.h"
#include "katecmd.h"
KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text)
: action(a), cursor(cursor), len(len), text(text) {
}
KateActionGroup::KateActionGroup(PointStruc &aStart, int type)
: start(aStart), action(0L), undoType(type) {
}
KateActionGroup::~KateActionGroup() {
KateAction *current, *next;
current = action;
while (current) {
next = current->next;
delete current;
current = next;
}
}
void KateActionGroup::insertAction(KateAction *a) {
a->next = action;
action = a;
}
const char * KateActionGroup::typeName(int type)
{
// return a short text description of the given undo group type suitable for a menu
// not the lack of i18n's, the caller is expected to handle translation
switch (type) {
case ugPaste : return "Paste Text";
case ugDelBlock : return "Selection Overwrite";
case ugIndent : return "Indent";
case ugUnindent : return "Unindent";
case ugComment : return "Comment";
case ugUncomment : return "Uncomment";
case ugReplace : return "Text Replace";
case ugSpell : return "Spell Check";
case ugInsChar : return "Typing";
case ugDelChar : return "Delete Text";
case ugInsLine : return "New Line";
case ugDelLine : return "Delete Line";
}
return "";
}
const int KateDocument::maxAttribs = 32;
QStringList KateDocument::searchForList = QStringList();
QStringList KateDocument::replaceWithList = QStringList();
uint KateDocument::uniqueID = 0;
QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0;
KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
QWidget *parentWidget, const char *widgetName,
QObject *, const char *)
: Kate::Document (),
myFont(KGlobalSettings::generalFont()), myFontBold(KGlobalSettings::generalFont()), myFontItalic(KGlobalSettings::generalFont()), myFontBI(KGlobalSettings::generalFont()),
myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI),
hlManager(HlManager::self ())
{
d(this)->hlSetByUser = false;
PreHighlightedTill=0;
RequestPreHighlightTill=0;
m_bSingleViewMode=bSingleViewMode;
m_bBrowserView = bBrowserView;
m_url = QString::null;
// NOTE: QFont::CharSet doesn't provide all the charsets KDE supports
// (esp. it doesn't distinguish between UTF-8 and iso10646-1)
myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name());
maxLength = -1;
setFont (KGlobalSettings::generalFont());
myDocID = uniqueID;
uniqueID++;
myDocName = QString ("");
fileInfo = new QFileInfo ();
myCmd = new KateCmd (this);
- connect(this,SIGNAL(modifiedChanged ()),this,SLOT(slotModChanged ()));
+ connect(this,SIGNAL(modifiedChanged()),this,SLOT(slotModChanged()));
buffer = new KWBuffer;
connect(buffer, SIGNAL(linesChanged(int)), this, SLOT(slotBufferChanged()));
// connect(buffer, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
connect(buffer, SIGNAL(needHighlight(long,long)),this,SLOT(slotBufferHighlight(long,long)));
colors[0] = KGlobalSettings::baseColor();
colors[1] = KGlobalSettings::highlightColor();
m_attribs = new Attribute[maxAttribs];
m_highlight = 0L;
tabChars = 8;
m_singleSelection = false;
newDocGeometry = false;
readOnly = false;
newDoc = false;
modified = false;
undoList.setAutoDelete(true);
undoState = 0;
undoSteps = 50;
pseudoModal = 0L;
clear();
setHighlight(0); //calls updateFontData()
// if the user changes the highlight with the dialog, notify the doc
connect(hlManager,SIGNAL(changed()),SLOT(hlChanged()));
newDocGeometry = false;
readConfig();
setReadOnly(false);
}
void KateDocument::setDontChangeHlOnSave()
{
d(this)->hlSetByUser = true;
}
void KateDocument::setFont (QFont font)
{
kdDebug()<<"Kate:: setFont"<<endl;
int oldwidth=myFontMetrics.width('W'); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
myFont = font;
myFontBold = QFont (font);
myFontBold.setBold (true);
myFontItalic = QFont (font);
myFontItalic.setItalic (true);
myFontBI = QFont (font);
myFontBI.setBold (true);
myFontBI.setItalic (true);
myFontMetrics = CachedFontMetrics (myFont);
myFontMetricsBold = CachedFontMetrics (myFontBold);
myFontMetricsItalic = CachedFontMetrics (myFontItalic);
myFontMetricsBI = CachedFontMetrics (myFontBI);
int newwidth=myFontMetrics.width('W'); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
maxLength=maxLength*(float)newwidth/(float)oldwidth; //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
updateFontData();
updateViews(); //Quick & Dirty Hack (by JoWenn) //Remove in KDE 3.0
}
long KateDocument::needPreHighlight(long till)
{
int max=numLines()-1;
if (till>max)
{
till=max;
}
if (PreHighlightedTill>=till) return -1;
long tmp=RequestPreHighlightTill;
if (RequestPreHighlightTill<till)
{
RequestPreHighlightTill=till;
if (tmp<=PreHighlightedTill) QTimer::singleShot(10,this,SLOT(doPreHighlight()));
}
return RequestPreHighlightTill;
}
void KateDocument::doPreHighlight()
{
int from = PreHighlightedTill;
int till = PreHighlightedTill+200;
int max = numLines()-1;
if (till > max)