-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,24 +1,24 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | kateview.cpp - description | 2 | kateview.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Jan 15 2001 | 4 | begin : Mon Jan 15 2001 |
5 | copyright : (C) 2001 by Christoph "Crossfire" Cullmann | 5 | copyright : (C) 2001 by Christoph "Crossfire" Cullmann |
6 | (C) 2002 by Joseph Wenninger | 6 | (C) 2002 by Joseph Wenninger |
7 | email : crossfire@babylon2k.de | 7 | email : crossfire@babylon2k.de |
8 | jowenn@kde.org | 8 | jowenn@kde.org |
9 | ***************************************************************************/ | 9 | ***************************************************************************/ |
10 | 10 | ||
11 | /*************************************************************************** | 11 | /*************************************************************************** |
12 | * * | 12 | * * |
13 | * This program is free software; you can redistribute it and/or modify * | 13 | * This program is free software; you can redistribute it and/or modify * |
14 | * it under the terms of the GNU General Public License as published by * | 14 | * it under the terms of the GNU General Public License as published by * |
15 | * the Free Software Foundation; either version 2 of the License, or * | 15 | * the Free Software Foundation; either version 2 of the License, or * |
16 | * (at your option) any later version. * | 16 | * (at your option) any later version. * |
17 | * * | 17 | * * |
18 | ***************************************************************************/ | 18 | ***************************************************************************/ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | Copyright (C) 1998, 1999 Jochen Wilhelmy | 21 | Copyright (C) 1998, 1999 Jochen Wilhelmy |
22 | digisnap@cs.tu-berlin.de | 22 | digisnap@cs.tu-berlin.de |
23 | 23 | ||
24 | This library is free software; you can redistribute it and/or | 24 | This library is free software; you can redistribute it and/or |
@@ -1760,33 +1760,33 @@ bool KateView::hasMarkedText() { | |||
1760 | QString KateView::markedText() { | 1760 | QString KateView::markedText() { |
1761 | return myDoc->markedText(configFlags); | 1761 | return myDoc->markedText(configFlags); |
1762 | } | 1762 | } |
1763 | 1763 | ||
1764 | bool KateView::canDiscard() { | 1764 | bool KateView::canDiscard() { |
1765 | int query; | 1765 | int query; |
1766 | 1766 | ||
1767 | if (isModified()) { | 1767 | if (isModified()) { |
1768 | query = KMessageBox::warningYesNoCancel(this, | 1768 | query = KMessageBox::warningYesNoCancel(this, |
1769 | i18n("The current Document has been modified.\nWould you like to save it?")); | 1769 | i18n("The current Document has been modified.\nWould you like to save it?")); |
1770 | switch (query) { | 1770 | switch (query) { |
1771 | case KMessageBox::Yes: //yes | 1771 | case KMessageBox::Yes: //yes |
1772 | if (save() == CANCEL) return false; | 1772 | if (save() == CANCEL) return false; |
1773 | if (isModified()) { | 1773 | if (isModified()) { |
1774 | query = KMessageBox::warningContinueCancel(this, | 1774 | query = KMessageBox::warningContinueCancel(this, |
1775 | i18n("Could not save the document.\nDiscard it and continue?"), | 1775 | i18n("Could not save the document.\nDiscard it and continue?"), |
1776 | QString::null, i18n("&Discard")); | 1776 | QString::null, i18n("&Discard")); |
1777 | if (query == KMessageBox::Cancel) return false; | 1777 | if (query == KMessageBox::Cancel) return false; |
1778 | } | 1778 | } |
1779 | break; | 1779 | break; |
1780 | case KMessageBox::Cancel: //cancel | 1780 | case KMessageBox::Cancel: //cancel |
1781 | return false; | 1781 | return false; |
1782 | } | 1782 | } |
1783 | } | 1783 | } |
1784 | return true; | 1784 | return true; |
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | void KateView::flush() | 1787 | void KateView::flush() |
1788 | { | 1788 | { |
1789 | if (canDiscard()) myDoc->flush(); | 1789 | if (canDiscard()) myDoc->flush(); |
1790 | } | 1790 | } |
1791 | 1791 | ||
1792 | KateView::fileResult KateView::save() { | 1792 | KateView::fileResult KateView::save() { |
@@ -2184,33 +2184,33 @@ bool KateView::askReplaceEnd() { | |||
2184 | 2184 | ||
2185 | myDoc->updateViews(); | 2185 | myDoc->updateViews(); |
2186 | if (s.flags & KateView::sfFinished) { | 2186 | if (s.flags & KateView::sfFinished) { |
2187 | // replace finished | 2187 | // replace finished |
2188 | str = i18n("%1 replacement(s) made").arg(replaces); | 2188 | str = i18n("%1 replacement(s) made").arg(replaces); |
2189 | KMessageBox::information(this, str, i18n("Replace")); | 2189 | KMessageBox::information(this, str, i18n("Replace")); |
2190 | return true; | 2190 | return true; |
2191 | } | 2191 | } |
2192 | 2192 | ||
2193 | // ask for continue | 2193 | // ask for continue |
2194 | if (!(s.flags & KateView::sfBackward)) { | 2194 | if (!(s.flags & KateView::sfBackward)) { |
2195 | // forward search | 2195 | // forward search |
2196 | str = i18n("%1 replacement(s) made.\n" | 2196 | str = i18n("%1 replacement(s) made.\n" |
2197 | "End of document reached.\n" | 2197 | "End of document reached.\n" |
2198 | "Continue from the beginning?").arg(replaces); | 2198 | "Continue from the beginning?").arg(replaces); |
2199 | query = KMessageBox::questionYesNo(this, str, i18n("Replace"), | 2199 | query = KMessageBox::questionYesNo(this, str, i18n("Replace"), |
2200 | i18n("Continue"), i18n("Stop")); | 2200 | i18n("Continue"), i18n("Stop")); |
2201 | } else { | 2201 | } else { |
2202 | // backward search | 2202 | // backward search |
2203 | str = i18n("%1 replacement(s) made.\n" | 2203 | str = i18n("%1 replacement(s) made.\n" |
2204 | "Beginning of document reached.\n" | 2204 | "Beginning of document reached.\n" |
2205 | "Continue from the end?").arg(replaces); | 2205 | "Continue from the end?").arg(replaces); |
2206 | query = KMessageBox::questionYesNo(this, str, i18n("Replace"), | 2206 | query = KMessageBox::questionYesNo(this, str, i18n("Replace"), |
2207 | i18n("Continue"), i18n("Stop")); | 2207 | i18n("Continue"), i18n("Stop")); |
2208 | } | 2208 | } |
2209 | replaces = 0; | 2209 | replaces = 0; |
2210 | continueSearch(s); | 2210 | continueSearch(s); |
2211 | return (query == KMessageBox::No); | 2211 | return (query == KMessageBox::No); |
2212 | } | 2212 | } |
2213 | 2213 | ||
2214 | void KateView::replaceSlot() { | 2214 | void KateView::replaceSlot() { |
2215 | doReplaceAction(replacePrompt->result(),true); | 2215 | doReplaceAction(replacePrompt->result(),true); |
2216 | } | 2216 | } |
@@ -2314,33 +2314,33 @@ void KateView::configDialog() | |||
2314 | HlDataList hlDataList; | 2314 | HlDataList hlDataList; |
2315 | ItemStyleList defaultStyleList; | 2315 | ItemStyleList defaultStyleList; |
2316 | 2316 | ||
2317 | hlManager = HlManager::self(); | 2317 | hlManager = HlManager::self(); |
2318 | 2318 | ||
2319 | defaultStyleList.setAutoDelete(true); | 2319 | defaultStyleList.setAutoDelete(true); |
2320 | hlManager->getDefaults(defaultStyleList); | 2320 | hlManager->getDefaults(defaultStyleList); |
2321 | 2321 | ||
2322 | hlDataList.setAutoDelete(true); | 2322 | hlDataList.setAutoDelete(true); |
2323 | //this gets the data from the KConfig object | 2323 | //this gets the data from the KConfig object |
2324 | hlManager->getHlDataList(hlDataList); | 2324 | hlManager->getHlDataList(hlDataList); |
2325 | 2325 | ||
2326 | page=kd->addPage(i18n("Highlighting")); | 2326 | page=kd->addPage(i18n("Highlighting")); |
2327 | (new QVBoxLayout(page))->setAutoAdd(true); | 2327 | (new QVBoxLayout(page))->setAutoAdd(true); |
2328 | 2328 | ||
2329 | hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); | 2329 | hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); |
2330 | 2330 | kd->showMaximized(); | |
2331 | if (kd->exec()) { | 2331 | if (kd->exec()) { |
2332 | // color options | 2332 | // color options |
2333 | colorConfig->getColors(colors); | 2333 | colorConfig->getColors(colors); |
2334 | myDoc->setFont (fontConfig->getFont()); | 2334 | myDoc->setFont (fontConfig->getFont()); |
2335 | 2335 | ||
2336 | applyColors(); | 2336 | applyColors(); |
2337 | // indent options | 2337 | // indent options |
2338 | indentConfig->getData(this); | 2338 | indentConfig->getData(this); |
2339 | // select options | 2339 | // select options |
2340 | selectConfig->getData(this); | 2340 | selectConfig->getData(this); |
2341 | // edit options | 2341 | // edit options |
2342 | editConfig->getData(this); | 2342 | editConfig->getData(this); |
2343 | // spell checker | 2343 | // spell checker |
2344 | hlManager->setHlDataList(hlDataList); | 2344 | hlManager->setHlDataList(hlDataList); |
2345 | hlManager->setDefaults(defaultStyleList); | 2345 | hlManager->setDefaults(defaultStyleList); |
2346 | hlPage->saveData(); | 2346 | hlPage->saveData(); |
@@ -2824,33 +2824,33 @@ void KateIconBorder::paintLine(int i) | |||
2824 | } | 2824 | } |
2825 | 2825 | ||
2826 | 2826 | ||
2827 | void KateIconBorder::paintEvent(QPaintEvent* e) | 2827 | void KateIconBorder::paintEvent(QPaintEvent* e) |
2828 | { | 2828 | { |
2829 | if (!myView->myIconBorder) return; | 2829 | if (!myView->myIconBorder) return; |
2830 | 2830 | ||
2831 | int lineStart = 0; | 2831 | int lineStart = 0; |
2832 | int lineEnd = 0; | 2832 | int lineEnd = 0; |
2833 | 2833 | ||
2834 | QRect updateR = e->rect(); | 2834 | QRect updateR = e->rect(); |
2835 | 2835 | ||
2836 | KateDocument *doc = myView->doc(); | 2836 | KateDocument *doc = myView->doc(); |
2837 | int h = doc->fontHeight; | 2837 | int h = doc->fontHeight; |
2838 | int yPos = myInternalView->yPos; | 2838 | int yPos = myInternalView->yPos; |
2839 | if (h) { | 2839 | if (h) { |
2840 | lineStart = (yPos + updateR.y()) / h; | 2840 | lineStart = (yPos + updateR.y()) / h; |
2841 | lineEnd = QMAX((yPos + updateR.y() + updateR.height()) / h, (int)doc->numLines()); | 2841 | lineEnd = QMAX((yPos + updateR.y() + updateR.height()) / h, (int)doc->numLines()); |
2842 | } | 2842 | } |
2843 | 2843 | ||
2844 | for(int i = lineStart; i <= lineEnd; ++i) | 2844 | for(int i = lineStart; i <= lineEnd; ++i) |
2845 | paintLine(i); | 2845 | paintLine(i); |
2846 | } | 2846 | } |
2847 | 2847 | ||
2848 | 2848 | ||
2849 | void KateIconBorder::mousePressEvent(QMouseEvent* e) | 2849 | void KateIconBorder::mousePressEvent(QMouseEvent* e) |
2850 | { | 2850 | { |
2851 | myInternalView->placeCursor( 0, e->y(), 0 ); | 2851 | myInternalView->placeCursor( 0, e->y(), 0 ); |
2852 | 2852 | ||
2853 | KateDocument *doc = myView->doc(); | 2853 | KateDocument *doc = myView->doc(); |
2854 | int cursorOnLine = (e->y() + myInternalView->yPos) / doc->fontHeight; | 2854 | int cursorOnLine = (e->y() + myInternalView->yPos) / doc->fontHeight; |
2855 | TextLine *line = doc->getTextLine(cursorOnLine); | 2855 | TextLine *line = doc->getTextLine(cursorOnLine); |
2856 | 2856 | ||