-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateview.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp index 8f3a25e..6453458 100644 --- a/noncore/apps/tinykate/libkate/view/kateview.cpp +++ b/noncore/apps/tinykate/libkate/view/kateview.cpp @@ -1,40 +1,40 @@ /*************************************************************************** kateview.cpp - description ------------------- begin : Mon Jan 15 2001 copyright : (C) 2001 by Christoph "Crossfire" Cullmann - (C) 2002 by Joseph Wenninger + (C) 2002 by Joseph Wenninger email : crossfire@babylon2k.de - jowenn@kde.org + 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. */ @@ -1744,65 +1744,65 @@ QString KateView::word(int x, int y) { void KateView::setText(const QString &s) { myDoc->setText(s); myDoc->updateViews(); } void KateView::insertText(const QString &s, bool /*mark*/) { VConfig c; myViewInternal->getVConfig(c); myDoc->insert(c, s); myDoc->updateViews(); } bool KateView::hasMarkedText() { return myDoc->hasMarkedText(); } QString KateView::markedText() { return myDoc->markedText(configFlags); } bool KateView::canDiscard() { int query; if (isModified()) { query = KMessageBox::warningYesNoCancel(this, i18n("The current Document has been modified.\nWould you like to save it?")); switch (query) { case KMessageBox::Yes: //yes if (save() == CANCEL) return false; if (isModified()) { query = KMessageBox::warningContinueCancel(this, i18n("Could not save the document.\nDiscard it and continue?"), - QString::null, i18n("&Discard")); + QString::null, i18n("&Discard")); if (query == KMessageBox::Cancel) return false; } break; case KMessageBox::Cancel: //cancel return false; } } return true; } void KateView::flush() { if (canDiscard()) myDoc->flush(); } KateView::fileResult KateView::save() { int query = KMessageBox::Yes; if (isModified()) { return saveAs(); } return OK; } KateView::fileResult KateView::saveAs() { return OK; } void KateView::doCursorCommand(int cmdNum) { VConfig c; myViewInternal->getVConfig(c); if (cmdNum & selectFlag) c.flags |= KateView::cfMark; if (cmdNum & multiSelectFlag) c.flags |= KateView::cfMark | KateView::cfKeepSelection; @@ -2168,65 +2168,65 @@ void KateView::exposeFound(PointStruc &cursor, int slen, int flags, bool replace if (y1 < yPos || y2 > yPos + myViewInternal->height()) { xPos = x2 - myViewInternal->width(); yPos = myDoc->fontHeight*cursor.y - height()/3; } myViewInternal->setPos(xPos, yPos); myViewInternal->updateView(flags);// | ufPos,xPos,yPos); myDoc->updateViews(this); } void KateView::deleteReplacePrompt() { myDoc->setPseudoModal(0L); } bool KateView::askReplaceEnd() { QString str; int query; myDoc->updateViews(); if (s.flags & KateView::sfFinished) { // replace finished str = i18n("%1 replacement(s) made").arg(replaces); KMessageBox::information(this, str, i18n("Replace")); return true; } // ask for continue if (!(s.flags & KateView::sfBackward)) { // forward search str = i18n("%1 replacement(s) made.\n" "End of document reached.\n" "Continue from the beginning?").arg(replaces); query = KMessageBox::questionYesNo(this, str, i18n("Replace"), - i18n("Continue"), i18n("Stop")); + i18n("Continue"), i18n("Stop")); } else { // backward search str = i18n("%1 replacement(s) made.\n" "Beginning of document reached.\n" "Continue from the end?").arg(replaces); query = KMessageBox::questionYesNo(this, str, i18n("Replace"), i18n("Continue"), i18n("Stop")); } replaces = 0; continueSearch(s); return (query == KMessageBox::No); } void KateView::replaceSlot() { doReplaceAction(replacePrompt->result(),true); } void KateView::installPopup(QPopupMenu *rmb_Menu) { rmbMenu = rmb_Menu; } void KateView::readConfig() { KConfig *config = KGlobal::config(); config->setGroup("Kate View"); searchFlags = config->readNumEntry("SearchFlags", KateView::sfPrompt); configFlags = config->readNumEntry("ConfigFlags", configFlags) & ~KateView::cfMark; config->sync(); } @@ -2298,65 +2298,65 @@ void KateView::configDialog() // select options page=kd->addPage(i18n("Select")); (new QVBoxLayout(page))->setAutoAdd(true); SelectConfigTab *selectConfig = new SelectConfigTab(page, this); // edit options page=kd->addPage(i18n("Edit")); (new QVBoxLayout(page))->setAutoAdd(true); EditConfigTab *editConfig = new EditConfigTab(page, this); HighlightDialogPage *hlPage; HlManager *hlManager; HlDataList hlDataList; ItemStyleList defaultStyleList; hlManager = HlManager::self(); defaultStyleList.setAutoDelete(true); hlManager->getDefaults(defaultStyleList); hlDataList.setAutoDelete(true); //this gets the data from the KConfig object hlManager->getHlDataList(hlDataList); page=kd->addPage(i18n("Highlighting")); (new QVBoxLayout(page))->setAutoAdd(true); hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); - + kd->showMaximized(); if (kd->exec()) { // color options colorConfig->getColors(colors); myDoc->setFont (fontConfig->getFont()); applyColors(); // indent options indentConfig->getData(this); // select options selectConfig->getData(this); // edit options editConfig->getData(this); // spell checker hlManager->setHlDataList(hlDataList); hlManager->setDefaults(defaultStyleList); hlPage->saveData(); } delete kd; #endif } int KateView::getHl() { return myDoc->highlightNum(); } void KateView::setDontChangeHlOnSave() { myDoc->setDontChangeHlOnSave(); } @@ -2808,65 +2808,65 @@ void KateIconBorder::paintLine(int i) TextLine *line = myView->doc()->getTextLine(i); if (!line) return; if (line->mark()&KateDocument::Bookmark) p.drawPixmap(2, y, QPixmap(bookmark_xpm)); /* if (line && (line->breakpointId() != -1)) { if (!line->breakpointEnabled()) p.drawPixmap(2, y, QPixmap(breakpoint_gr_xpm)); else if (line->breakpointPending()) p.drawPixmap(2, y, QPixmap(breakpoint_bl_xpm)); else p.drawPixmap(2, y, QPixmap(breakpoint_xpm)); } if (line->isExecutionPoint()) p.drawPixmap(2, y, QPixmap(ddd_xpm)); */ } void KateIconBorder::paintEvent(QPaintEvent* e) { if (!myView->myIconBorder) return; int lineStart = 0; int lineEnd = 0; QRect updateR = e->rect(); KateDocument *doc = myView->doc(); int h = doc->fontHeight; int yPos = myInternalView->yPos; if (h) { - lineStart = (yPos + updateR.y()) / h; + lineStart = (yPos + updateR.y()) / h; lineEnd = QMAX((yPos + updateR.y() + updateR.height()) / h, (int)doc->numLines()); } for(int i = lineStart; i <= lineEnd; ++i) paintLine(i); } void KateIconBorder::mousePressEvent(QMouseEvent* e) { myInternalView->placeCursor( 0, e->y(), 0 ); KateDocument *doc = myView->doc(); int cursorOnLine = (e->y() + myInternalView->yPos) / doc->fontHeight; TextLine *line = doc->getTextLine(cursorOnLine); switch (e->button()) { case LeftButton: if (!line) break; else { if (line->mark()&KateDocument::Bookmark) line->delMark (KateDocument::Bookmark); else line->addMark (KateDocument::Bookmark); doc->tagLines(cursorOnLine, cursorOnLine); doc->updateViews(); } break; /* case RightButton: |