Browse Source

Port to new KatePart interface:
installPopup -> setContextMenu
setCursorPositionReal(r,c) -> setCursorPosition(KTextEditor::Cursor(r,c))
numLines -> lines
textLine -> line


git-svn-id: file:///var/svn/tigccpp/trunk@968 9552661e-59e3-4036-b4f2-dbe53926924f

kevinkofler 17 years ago
parent
commit
cd19a59f09
2 changed files with 79 additions and 79 deletions
  1. 47 47
      ktigcc/mainform.cpp
  2. 32 32
      ktigcc/srcfilewin.cpp

+ 47 - 47
ktigcc/mainform.cpp

@@ -794,7 +794,7 @@ class ErrorListItem : public K3ListViewItem {
     if (errorLine!=(unsigned)-1) {
       KTextEditor::View *kateView=lvFile?lvFile->kateView:(srcFile?srcFile->kateView
                              :static_cast<KTextEditor::View *>(NULL));
-      if (kateView && errorLine<kateView->document()->numLines()) {
+      if (kateView && errorLine<kateView->document()->lines()) {
         // Extract the main token for the error message.
         QString errMessage=text(0);
         int quotePos=errMessage.find('\'');
@@ -807,7 +807,7 @@ class ErrorListItem : public K3ListViewItem {
               // Skip whitespace up to this token. TIGCC IDE does that too. Must
               // have something to do with how source splitting works.
               unsigned i=errorColumn;
-              QString textLine=kateView->document()->textLine(errorLine);
+              QString textLine=kateView->document()->line(errorLine);
               unsigned lineLength=kateView->document()->lineLength(errorLine);
               unsigned tokenLength=token.length();
               while ((i<lineLength) && textLine[i].isSpace()
@@ -834,7 +834,7 @@ class ErrorListItem : public K3ListViewItem {
     if (cursor && kateView) {
       unsigned line,col;
       cursor->position(&line,&col);
-      kateView->setCursorPositionReal(line,col);
+      kateView->setCursorPosition(KTextEditor::Cursor(line,col));
     }
   }
   ListViewFile *lvFile;
@@ -1756,14 +1756,14 @@ void *MainForm::createView(const QString &fileName, const QString &fileText, Q3L
   connect(newView->document(),SIGNAL(undoChanged()),this,SLOT(current_view_undoChanged()));
   connect(newView->document(),SIGNAL(selectionChanged()),this,SLOT(current_view_selectionChanged()));
   connect(newView->document(),SIGNAL(charactersInteractivelyInserted(int,int,const QString&)),this,SLOT(current_view_charactersInteractivelyInserted(int,int,const QString&)));
-  newView->installPopup(te_popup);
+  newView->setContextMenu(te_popup);
   // Set text.
   SET_TEXT_SAFE(newView->document(),fileText);
   newView->document()->setModified(FALSE);
 // FIXME
 //  newView->document()->clearUndo();
 //  newView->document()->clearRedo();
-  newView->setCursorPositionReal(0,0);
+  newView->setCursorPosition(KTextEditor::Cursor(0,0));
   return newView;
 }
 
@@ -1857,7 +1857,7 @@ void MainForm::adoptSourceFile(void *srcFile)
   connect(newView->document(),SIGNAL(undoChanged()),this,SLOT(current_view_undoChanged()));
   connect(newView->document(),SIGNAL(selectionChanged()),this,SLOT(current_view_selectionChanged()));
   connect(newView->document(),SIGNAL(charactersInteractivelyInserted(int,int,const QString&)),this,SLOT(current_view_charactersInteractivelyInserted(int,int,const QString&)));
-  newView->installPopup(te_popup);
+  newView->setContextMenu(te_popup);
   // Mark project dirty.
   projectIsDirty=TRUE;
   projectNeedsRelink=TRUE;
@@ -2170,9 +2170,9 @@ void MainForm::removeTrailingSpacesFromView(void *view)
   KTextEditor::Document *doc=kateView->document();
   KTextEditor::EditInterfaceExt *editExt=KTextEditor::editInterfaceExt(doc);
   editExt->editBegin();
-  unsigned numLines=doc->numLines();
+  unsigned numLines=doc->lines();
   for (unsigned i=0; i<numLines; i++) {
-    QString line=doc->textLine(i);
+    QString line=doc->line(i);
     int whitespace=line.find(QRegExp("\\s+$"));
     if (whitespace>=0) doc->removeText(i,whitespace,i,line.length());
   }
@@ -2261,7 +2261,7 @@ void MainForm::fileSave_saveAs(Q3ListViewItem *theItem)
 //      theFile->kateView->document()->clearUndo();
 //      theFile->kateView->document()->clearRedo();
       hliface->setHighlighting(hlMode);
-      theFile->kateView->setCursorPositionReal(line,col);
+      theFile->kateView->setCursorPosition(KTextEditor::Cursor(line,col));
     }
     theFile->fileName=saveFileName;
     if (IS_EDITABLE_CATEGORY(category)) {
@@ -2339,7 +2339,7 @@ void MainForm::fileSave_loadList(Q3ListViewItem *category,void *fileListV,const
 //            theFile->kateView->document()->clearUndo();
 //            theFile->kateView->document()->clearRedo();
             hliface->setHighlighting(hlMode);
-            theFile->kateView->setCursorPositionReal(line,col);
+            theFile->kateView->setCursorPosition(KTextEditor::Cursor(line,col));
           }
           theFile->fileName=saveFileName;
           if (IS_EDITABLE_CATEGORY(category)) {
@@ -2775,10 +2775,10 @@ void MainForm::findFind_next()
         findCurrentCol=CURRENT_VIEW->cursorColumnReal();
       }
     } else {
-      findCurrentLine=findBackwards?(CURRENT_VIEW->document()->numLines()-1):0;
+      findCurrentLine=findBackwards?(CURRENT_VIEW->document()->lines()-1):0;
       findCurrentCol=-1;
     }
-    kfind->setData(CURRENT_VIEW->document()->textLine(findCurrentLine),findCurrentCol);
+    kfind->setData(CURRENT_VIEW->document()->line(findCurrentLine),findCurrentCol);
   } else findCurrentLine=0;
   skip_data:;
 
@@ -2789,7 +2789,7 @@ void MainForm::findFind_next()
   // non-editable or instantiated.
   QStringList currBuffer;
   unsigned currNumLines=0;
-  if (CURRENT_VIEW) currNumLines=CURRENT_VIEW->document()->numLines();
+  if (CURRENT_VIEW) currNumLines=CURRENT_VIEW->document()->lines();
   do {
     if (kfind->needData()) {
       if (findBackwards?!findCurrentLine:(findCurrentLine>=currNumLines)) {
@@ -2863,14 +2863,14 @@ void MainForm::findFind_next()
               // currentListItem is always either instantiated or not editable
               currView=static_cast<ListViewFile *>(currentListItem)->kateView;
               if (currView) {
-                currNumLines=currView->document()->numLines();
+                currNumLines=currView->document()->lines();
                 findCurrentLine=findBackwards?currNumLines-1:0;
                 do {
                   if (kfind->needData()) {
                     if (findBackwards?!findCurrentLine:(findCurrentLine>=currNumLines))
                       goto not_found_current;
                     if (findBackwards) findCurrentLine--; else findCurrentLine++;
-                    kfind->setData(currView->document()->textLine(findCurrentLine));
+                    kfind->setData(currView->document()->line(findCurrentLine));
                   }
                   result=kfind->find();
                 } while (result==KFind::NoMatch);
@@ -2884,7 +2884,7 @@ void MainForm::findFind_next()
           file_found:
             currView=static_cast<ListViewFile *>(findCurrentDocument)->kateView;
             if (currView) {
-              currNumLines=currView->document()->numLines();
+              currNumLines=currView->document()->lines();
             } else {
               currBuffer=QStringList::split('\n',
                 static_cast<ListViewFile *>(findCurrentDocument)->textBuffer,TRUE);
@@ -2894,7 +2894,7 @@ void MainForm::findFind_next()
         }
       } else if (findBackwards) findCurrentLine--; else findCurrentLine++;
       if (currView)
-        kfind->setData(currView->document()->textLine(findCurrentLine));
+        kfind->setData(currView->document()->line(findCurrentLine));
       else
         kfind->setData(currBuffer[findCurrentLine]);
     }
@@ -2908,7 +2908,7 @@ void MainForm::findFind_highlight(const QString &unused_text, int matchingindex,
 {
   if (currentListItem!=findCurrentDocument) fileTreeClicked(findCurrentDocument);
   if (!CURRENT_VIEW) qFatal("CURRENT_VIEW should be set here!");
-  CURRENT_VIEW->setCursorPositionReal(findCurrentLine,matchingindex+matchedlength);
+  CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(findCurrentLine,matchingindex+matchedlength));
   CURRENT_VIEW->document()->setSelection(findCurrentLine,matchingindex,
                                        findCurrentLine,matchingindex+matchedlength);
 }
@@ -2989,16 +2989,16 @@ void MainForm::findReplace()
         replaceCurrentLine=CURRENT_VIEW->cursorLine();
         replaceCurrentCol=CURRENT_VIEW->cursorColumnReal();
         // Don't prompt for restarting if we actually searched the entire document.
-        if (findBackwards?(replaceCurrentLine==(CURRENT_VIEW->document()->numLines()-1)
+        if (findBackwards?(replaceCurrentLine==(CURRENT_VIEW->document()->lines()-1)
                            && replaceCurrentCol==(CURRENT_VIEW->document()->lineLength(replaceCurrentLine)))
                          :(!replaceCurrentLine&&!replaceCurrentCol))
           kreplace->setOptions(kreplace->options()&~KFind::FromCursor);
       }
     } else {
-      replaceCurrentLine=findBackwards?(CURRENT_VIEW->document()->numLines()-1):0;
+      replaceCurrentLine=findBackwards?(CURRENT_VIEW->document()->lines()-1):0;
       replaceCurrentCol=-1;
     }
-    kreplace->setData(CURRENT_VIEW->document()->textLine(replaceCurrentLine),replaceCurrentCol);
+    kreplace->setData(CURRENT_VIEW->document()->line(replaceCurrentLine),replaceCurrentCol);
   }
   skip_data:
     // Now find the next occurrence.
@@ -3042,7 +3042,7 @@ void MainForm::findReplace_next(bool firstTime)
         replaceCurrentLine=CURRENT_VIEW->cursorLine();
         replaceCurrentCol=CURRENT_VIEW->cursorColumnReal();
       }
-      kreplace->setData(CURRENT_VIEW->document()->textLine(replaceCurrentLine),replaceCurrentCol);
+      kreplace->setData(CURRENT_VIEW->document()->line(replaceCurrentLine),replaceCurrentCol);
     } else replaceCurrentLine=0;
   }
   skip_data:;
@@ -3054,7 +3054,7 @@ void MainForm::findReplace_next(bool firstTime)
   // non-editable or instantiated.
   QStringList currBuffer;
   unsigned currNumLines=0;
-  if (CURRENT_VIEW) currNumLines=CURRENT_VIEW->document()->numLines();
+  if (CURRENT_VIEW) currNumLines=CURRENT_VIEW->document()->lines();
   do {
     if (kreplace->needData()) {
       if (global) {
@@ -3129,14 +3129,14 @@ void MainForm::findReplace_next(bool firstTime)
                 // currentListItem is always either instantiated or not editable
                 currView=static_cast<ListViewFile *>(currentListItem)->kateView;
                 if (currView) {
-                  currNumLines=currView->document()->numLines();
+                  currNumLines=currView->document()->lines();
                   replaceCurrentLine=findBackwards?currNumLines-1:0;
                   do {
                     if (kreplace->needData()) {
                       if (findBackwards?!replaceCurrentLine:(replaceCurrentLine>=currNumLines))
                         goto not_found_current;
                       if (findBackwards) replaceCurrentLine--; else replaceCurrentLine++;
-                      kreplace->setData(currView->document()->textLine(replaceCurrentLine));
+                      kreplace->setData(currView->document()->line(replaceCurrentLine));
                     }
                     result=kreplace->replace();
                   } while (result==KFind::NoMatch);
@@ -3150,7 +3150,7 @@ void MainForm::findReplace_next(bool firstTime)
             file_found:
               currView=static_cast<ListViewFile *>(replaceCurrentDocument)->kateView;
               if (currView) {
-                currNumLines=currView->document()->numLines();
+                currNumLines=currView->document()->lines();
               } else {
                 currBuffer=QStringList::split('\n',
                   static_cast<ListViewFile *>(replaceCurrentDocument)->textBuffer,TRUE);
@@ -3160,7 +3160,7 @@ void MainForm::findReplace_next(bool firstTime)
           }
         } else if (findBackwards) replaceCurrentLine--; else replaceCurrentLine++;
         if (currView)
-          kreplace->setData(currView->document()->textLine(replaceCurrentLine));
+          kreplace->setData(currView->document()->line(replaceCurrentLine));
         else
           kreplace->setData(currBuffer[replaceCurrentLine]);
       } else { // if not global
@@ -3177,8 +3177,8 @@ void MainForm::findReplace_next(bool firstTime)
                                                          |KFind::SelectedText));
               kreplace->invalidateSelection();
               // Reinitialize.
-              replaceCurrentLine=findBackwards?(CURRENT_VIEW->document()->numLines()-1):0;
-              kreplace->setData(CURRENT_VIEW->document()->textLine(replaceCurrentLine));
+              replaceCurrentLine=findBackwards?(CURRENT_VIEW->document()->lines()-1):0;
+              kreplace->setData(CURRENT_VIEW->document()->line(replaceCurrentLine));
               // Start again as if it was the first time.
               findReplace_next(TRUE);
               return;
@@ -3189,7 +3189,7 @@ void MainForm::findReplace_next(bool firstTime)
           } else goto not_found_current;
         } else if (findBackwards) replaceCurrentLine--; else replaceCurrentLine++;
         if (currView)
-          kreplace->setData(currView->document()->textLine(replaceCurrentLine));
+          kreplace->setData(currView->document()->line(replaceCurrentLine));
         else
           kreplace->setData(currBuffer[replaceCurrentLine]);
       }
@@ -3202,7 +3202,7 @@ void MainForm::findReplace_highlight(const QString &unused_text, int matchingind
 {
   if (currentListItem!=replaceCurrentDocument) fileTreeClicked(replaceCurrentDocument);
   if (!CURRENT_VIEW) qFatal("CURRENT_VIEW should be set here!");
-  CURRENT_VIEW->setCursorPositionReal(replaceCurrentLine,matchingindex+matchedlength);
+  CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(replaceCurrentLine,matchingindex+matchedlength));
   CURRENT_VIEW->document()->setSelection(replaceCurrentLine,matchingindex,
                                        replaceCurrentLine,matchingindex+matchedlength);
 }
@@ -3233,9 +3233,9 @@ void MainForm::findReplace_replace(const QString &text, int replacementIndex, in
                                      replaceCurrentLine,replacementIndex+replacedLength+matchedLength);
   editinterfaceext->editEnd();
   if (updateCursor)
-    CURRENT_VIEW->setCursorPositionReal(replaceCurrentLine,replacementIndex);
+    CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(replaceCurrentLine,replacementIndex));
   if (update) {
-    CURRENT_VIEW->setCursorPositionReal(replaceCurrentLine,replacementIndex+replacedLength);
+    CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(replaceCurrentLine,replacementIndex+replacedLength));
     CURRENT_VIEW->document()->setSelection(replaceCurrentLine,replacementIndex,
                                          replaceCurrentLine,replacementIndex+replacedLength);
     CURRENT_VIEW->repaint();
@@ -3301,7 +3301,7 @@ void MainForm::findFunctions_functionListBox_selected(int index)
     int line=sourceFileFunctions[index].implementationLine>=0
              ?sourceFileFunctions[index].implementationLine
              :sourceFileFunctions[index].prototypeLine;
-    CURRENT_VIEW->setCursorPositionReal(line,0);
+    CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line,0));
     functionDialog->accept();
   }
 }
@@ -3356,7 +3356,7 @@ void MainForm::findFunctionsPopup_activated(int id)
     int line=sourceFileFunctions[id].implementationLine>=0
              ?sourceFileFunctions[id].implementationLine
              :sourceFileFunctions[id].prototypeLine;
-    CURRENT_VIEW->setCursorPositionReal(line,0);
+    CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line,0));
   }
 }
 
@@ -3405,7 +3405,7 @@ void MainForm::findOpenFileAtCursor()
   if (CURRENT_VIEW && IS_FILE(currentListItem)) {
     int line,col,i;
     CURRENT_VIEW->cursorPosition().position(line,col);
-    QString textLine=CURRENT_VIEW->document()->textLine(line);
+    QString textLine=CURRENT_VIEW->document()->line(line);
     unsigned l=textLine.length();
     bool quotesInLine=textLine.contains("\"");
     QString fileName;
@@ -3443,16 +3443,16 @@ void MainForm::openHeader(const QString &fileName, bool systemHeader,
         if (inProject) {
           fileTreeClicked(reinterpret_cast<ListViewFile *>(sourceFile));
           if (reinterpret_cast<ListViewFile *>(sourceFile)->kateView)
-            reinterpret_cast<ListViewFile *>(sourceFile)->kateView->setCursorPositionReal(lineno,0);
+            reinterpret_cast<ListViewFile *>(sourceFile)->kateView->setCursorPosition(KTextEditor::Cursor(lineno,0));
         } else {
-          reinterpret_cast<SourceFile *>(sourceFile)->kateView->setCursorPositionReal(lineno,0);
+          reinterpret_cast<SourceFile *>(sourceFile)->kateView->setCursorPosition(KTextEditor::Cursor(lineno,0));
           KWin::activateWindow(reinterpret_cast<SourceFile *>(sourceFile)->winId());
         }
       } else {
         if (getPathType(fileNameFull)==PATH_FILE) {
           openProject(fileNameFull);
           if (findSourceFile(inProject,sourceFile,fileNameFull) && !inProject) {
-            reinterpret_cast<SourceFile *>(sourceFile)->kateView->setCursorPositionReal(lineno,0);
+            reinterpret_cast<SourceFile *>(sourceFile)->kateView->setCursorPosition(KTextEditor::Cursor(lineno,0));
             KWin::activateWindow(reinterpret_cast<SourceFile *>(sourceFile)->winId());
           }
         } else {
@@ -3481,7 +3481,7 @@ void MainForm::openHeader(const QString &fileName, bool systemHeader,
         if (QFileInfo(fileItem->fileName).fileName()==name) {
           fileTreeClicked(item);
           if (fileItem->kateView)
-            fileItem->kateView->setCursorPositionReal(lineno,0);
+            fileItem->kateView->setCursorPosition(KTextEditor::Cursor(lineno,0));
           return;
         }
       }
@@ -3522,7 +3522,7 @@ void MainForm::findFindSymbolDeclaration()
                            symbolLine,systemHeader)
           && !symbolFile.isNull()) {
         if (symbolFile==fileName)
-          CURRENT_VIEW->setCursorPositionReal(symbolLine,0);
+          CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(symbolLine,0));
         else
           openHeader(symbolFile,systemHeader,symbolLine);
       }
@@ -6044,7 +6044,7 @@ void MainForm::current_view_charactersInteractivelyInserted(int line, int col, c
       // Only for C files.
       if (category==cFilesListItem||category==qllFilesListItem
           ||(category==hFilesListItem&&(fileText.isNull()||fileText.isEmpty()||(fileText[0]!='|'&&fileText[0]!=';')))) {
-        QString indent=doc->textLine(line);
+        QString indent=doc->line(line);
         // Only if the line was all whitespace, otherwise wait for Enter to be
         // pressed (prevents annoying the user while typing a string or something).
         if (indent.contains(QRegExp("^\\s*\\{$"))) {
@@ -6055,7 +6055,7 @@ void MainForm::current_view_charactersInteractivelyInserted(int line, int col, c
           doc->insertLine(line+1,cursorLine);
           doc->insertLine(line+2,indent+"}");
           editExt->editEnd();
-          CURRENT_VIEW->setCursorPositionReal(line+1,cursorLine.length());
+          CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line+1,cursorLine.length()));
         }
       }
     }
@@ -6078,13 +6078,13 @@ void MainForm::current_view_newLineHook()
   int line,col;
   CURRENT_VIEW->cursorPosition().position(line,col);
   KTextEditor::Document *doc=CURRENT_VIEW->document();
-  if (preferences.autoBlocks && line && doc->textLine(line-1).endsWith("{")) {
+  if (preferences.autoBlocks && line && doc->line(line-1).endsWith("{")) {
     CATEGORY_OF(category,currentListItem);
     QString fileText=doc->text();
     // Only for C files.
     if (category==cFilesListItem||category==qllFilesListItem
         ||(category==hFilesListItem&&(fileText.isNull()||fileText.isEmpty()||(fileText[0]!='|'&&fileText[0]!=';')))) {
-      QString indent=doc->textLine(line-1);
+      QString indent=doc->line(line-1);
       // Remove everything starting from the first non-whitespace character.
       indent=indent.remove(QRegExp("(?!\\s).*$"));
       QString cursorLine=indent+"\t";
@@ -6094,7 +6094,7 @@ void MainForm::current_view_newLineHook()
       doc->insertLine(line,cursorLine);
       doc->insertText(line+1,0,indent+"}");
       editExt->editEnd();
-      CURRENT_VIEW->setCursorPositionReal(line,cursorLine.length());
+      CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line,cursorLine.length()));
     }
   }
 }
@@ -6221,7 +6221,7 @@ void MainForm::fileTreeItemRenamed( Q3ListViewItem *item, const QString &newName
 //        theFile->kateView->document()->clearUndo();
 //        theFile->kateView->document()->clearRedo();
         hliface->setHighlighting(hlMode);
-        theFile->kateView->setCursorPositionReal(line,col);
+        theFile->kateView->setCursorPosition(KTextEditor::Cursor(line,col));
         theFile->kateView->document()->setModified(modified);
       }
       if (IS_EDITABLE_CATEGORY(category) && newFileName[0]=='/')

+ 32 - 32
ktigcc/srcfilewin.cpp

@@ -443,14 +443,14 @@ void *SourceFileWindow::createView(const QString &fileName, const QString &fileT
   connect(newView->document(),SIGNAL(undoChanged()),this,SLOT(current_view_undoChanged()));
   connect(newView->document(),SIGNAL(selectionChanged()),this,SLOT(current_view_selectionChanged()));
   connect(newView->document(),SIGNAL(charactersInteractivelyInserted(int,int,const QString&)),this,SLOT(current_view_charactersInteractivelyInserted(int,int,const QString&)));
-  newView->installPopup(THIS->te_popup);
+  newView->setContextMenu(THIS->te_popup);
   // Set text.
   SET_TEXT_SAFE(newView->document(),fileText);
   newView->document()->setModified(FALSE);
 // FIXME
 //  newView->document()->clearUndo();
 //  newView->document()->clearRedo();
-  newView->setCursorPositionReal(0,0);
+  newView->setCursorPosition(KTextEditor::Cursor(0,0));
   return newView;
 }
 
@@ -478,9 +478,9 @@ void SourceFileWindow::removeTrailingSpacesFromView(void *view)
   KTextEditor::Document *doc=kateView->document();
   KTextEditor::EditInterfaceExt *editExt=KTextEditor::editInterfaceExt(doc);
   editExt->editBegin();
-  unsigned numLines=doc->numLines();
+  unsigned numLines=doc->lines();
   for (unsigned i=0; i<numLines; i++) {
-    QString line=doc->textLine(i);
+    QString line=doc->line(i);
     int whitespace=line.find(QRegExp("\\s+$"));
     if (whitespace>=0) doc->removeText(i,whitespace,i,line.length());
   }
@@ -533,7 +533,7 @@ void SourceFileWindow::fileSaveAs()
 //      CURRENT_VIEW->document()->clearUndo();
 //      CURRENT_VIEW->document()->clearRedo();
       hliface->setHighlighting(hlMode);
-      CURRENT_VIEW->setCursorPositionReal(line,col);
+      CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line,col));
       // Update the caption
       setCaption(caption().left(caption().find('-')+2)+saveFileName);
     }
@@ -745,28 +745,28 @@ void SourceFileWindow::findFind_next()
       findCurrentCol=CURRENT_VIEW->cursorColumnReal();
     }
   } else {
-    THIS->findCurrentLine=findBackwards?(CURRENT_VIEW->document()->numLines()-1):0;
+    THIS->findCurrentLine=findBackwards?(CURRENT_VIEW->document()->lines()-1):0;
     findCurrentCol=-1;
   }
-  kfind->setData(CURRENT_VIEW->document()->textLine(THIS->findCurrentLine),findCurrentCol);
+  kfind->setData(CURRENT_VIEW->document()->line(THIS->findCurrentLine),findCurrentCol);
   skip_data:;
 
   // Now find the next occurrence.
   KFind::Result result;
   KTextEditor::View *currView=CURRENT_VIEW;
-  unsigned currNumLines=CURRENT_VIEW->document()->numLines();
+  unsigned currNumLines=CURRENT_VIEW->document()->lines();
   do {
     if (kfind->needData()) {
       if (findBackwards?!THIS->findCurrentLine:(THIS->findCurrentLine>=currNumLines)) {
         // Try restarting the search.
-        currNumLines=currView->document()->numLines();
+        currNumLines=currView->document()->lines();
         THIS->findCurrentLine=findBackwards?currNumLines-1:0;
         do {
           if (kfind->needData()) {
             if (findBackwards?!THIS->findCurrentLine:(THIS->findCurrentLine>=currNumLines))
               goto not_found_current;
             if (findBackwards) THIS->findCurrentLine--; else THIS->findCurrentLine++;
-            kfind->setData(currView->document()->textLine(THIS->findCurrentLine));
+            kfind->setData(currView->document()->line(THIS->findCurrentLine));
           }
           result=kfind->find();
         } while (result==KFind::NoMatch);
@@ -776,7 +776,7 @@ void SourceFileWindow::findFind_next()
           delete kfind;
           return;
       } else if (findBackwards) THIS->findCurrentLine--; else THIS->findCurrentLine++;
-      kfind->setData(currView->document()->textLine(THIS->findCurrentLine));
+      kfind->setData(currView->document()->line(THIS->findCurrentLine));
     }
     result=kfind->find();
   } while (result==KFind::NoMatch);
@@ -786,7 +786,7 @@ void SourceFileWindow::findFind_next()
 #define unused_text text __attribute__((unused))
 void SourceFileWindow::findFind_highlight(const QString &unused_text, int matchingindex, int matchedlength)
 {
-  CURRENT_VIEW->setCursorPositionReal(THIS->findCurrentLine,matchingindex+matchedlength);
+  CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(THIS->findCurrentLine,matchingindex+matchedlength));
   CURRENT_VIEW->document()->setSelection(THIS->findCurrentLine,matchingindex,
                                        THIS->findCurrentLine,matchingindex+matchedlength);
 }
@@ -864,16 +864,16 @@ void SourceFileWindow::findReplace()
         THIS->kreplace->replaceCurrentLine=CURRENT_VIEW->cursorLine();
         replaceCurrentCol=CURRENT_VIEW->cursorColumnReal();
         // Don't prompt for restarting if we actually searched the entire document.
-        if (findBackwards?(THIS->kreplace->replaceCurrentLine==(CURRENT_VIEW->document()->numLines()-1)
+        if (findBackwards?(THIS->kreplace->replaceCurrentLine==(CURRENT_VIEW->document()->lines()-1)
                            && replaceCurrentCol==(CURRENT_VIEW->document()->lineLength(THIS->kreplace->replaceCurrentLine)))
                          :(!THIS->kreplace->replaceCurrentLine&&!replaceCurrentCol))
           THIS->kreplace->setOptions(THIS->kreplace->options()&~KFind::FromCursor);
       }
     } else {
-      THIS->kreplace->replaceCurrentLine=findBackwards?(CURRENT_VIEW->document()->numLines()-1):0;
+      THIS->kreplace->replaceCurrentLine=findBackwards?(CURRENT_VIEW->document()->lines()-1):0;
       replaceCurrentCol=-1;
     }
-    THIS->kreplace->setData(CURRENT_VIEW->document()->textLine(THIS->kreplace->replaceCurrentLine),replaceCurrentCol);
+    THIS->kreplace->setData(CURRENT_VIEW->document()->line(THIS->kreplace->replaceCurrentLine),replaceCurrentCol);
   }
   skip_data:
     // Now find the next occurrence.
@@ -910,7 +910,7 @@ void SourceFileWindow::findReplace_next(bool firstTime)
       THIS->kreplace->replaceCurrentLine=CURRENT_VIEW->cursorLine();
       replaceCurrentCol=CURRENT_VIEW->cursorColumnReal();
     }
-    THIS->kreplace->setData(CURRENT_VIEW->document()->textLine(THIS->kreplace->replaceCurrentLine),replaceCurrentCol);
+    THIS->kreplace->setData(CURRENT_VIEW->document()->line(THIS->kreplace->replaceCurrentLine),replaceCurrentCol);
   }
   skip_data:;
 
@@ -918,7 +918,7 @@ void SourceFileWindow::findReplace_next(bool firstTime)
   KFind::Result result;
   KTextEditor::View *currView=CURRENT_VIEW;
   unsigned currNumLines=0;
-  if (CURRENT_VIEW) currNumLines=CURRENT_VIEW->document()->numLines();
+  if (CURRENT_VIEW) currNumLines=CURRENT_VIEW->document()->lines();
   do {
     if (THIS->kreplace->needData()) {
       if (THIS->kreplace->haveSelection()
@@ -931,8 +931,8 @@ void SourceFileWindow::findReplace_next(bool firstTime)
                                                                  |KFind::SelectedText));
           THIS->kreplace->invalidateSelection();
           // Reinitialize.
-          THIS->kreplace->replaceCurrentLine=findBackwards?(CURRENT_VIEW->document()->numLines()-1):0;
-          THIS->kreplace->setData(CURRENT_VIEW->document()->textLine(THIS->kreplace->replaceCurrentLine));
+          THIS->kreplace->replaceCurrentLine=findBackwards?(CURRENT_VIEW->document()->lines()-1):0;
+          THIS->kreplace->setData(CURRENT_VIEW->document()->line(THIS->kreplace->replaceCurrentLine));
           // Start again as if it was the first time.
           findReplace_next(TRUE);
           return;
@@ -941,7 +941,7 @@ void SourceFileWindow::findReplace_next(bool firstTime)
           return;
         }
       } else if (findBackwards) THIS->kreplace->replaceCurrentLine--; else THIS->kreplace->replaceCurrentLine++;
-      THIS->kreplace->setData(currView->document()->textLine(THIS->kreplace->replaceCurrentLine));
+      THIS->kreplace->setData(currView->document()->line(THIS->kreplace->replaceCurrentLine));
     }
     result=THIS->kreplace->replace();
   } while (result==KFind::NoMatch);
@@ -949,7 +949,7 @@ void SourceFileWindow::findReplace_next(bool firstTime)
 
 void SourceFileWindow::findReplace_highlight(const QString &unused_text, int matchingindex, int matchedlength)
 {
-  CURRENT_VIEW->setCursorPositionReal(THIS->kreplace->replaceCurrentLine,matchingindex+matchedlength);
+  CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(THIS->kreplace->replaceCurrentLine,matchingindex+matchedlength));
   CURRENT_VIEW->document()->setSelection(THIS->kreplace->replaceCurrentLine,matchingindex,
                                        THIS->kreplace->replaceCurrentLine,matchingindex+matchedlength);
 }
@@ -978,9 +978,9 @@ void SourceFileWindow::findReplace_replace(const QString &text, int replacementI
                                      THIS->kreplace->replaceCurrentLine,replacementIndex+replacedLength+matchedLength);
   editinterfaceext->editEnd();
   if (updateCursor)
-    CURRENT_VIEW->setCursorPositionReal(THIS->kreplace->replaceCurrentLine,replacementIndex);
+    CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(THIS->kreplace->replaceCurrentLine,replacementIndex));
   if (update) {
-    CURRENT_VIEW->setCursorPositionReal(THIS->kreplace->replaceCurrentLine,replacementIndex+replacedLength);
+    CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(THIS->kreplace->replaceCurrentLine,replacementIndex+replacedLength));
     CURRENT_VIEW->document()->setSelection(THIS->kreplace->replaceCurrentLine,replacementIndex,
                                          THIS->kreplace->replaceCurrentLine,replacementIndex+replacedLength);
     CURRENT_VIEW->repaint();
@@ -1040,7 +1040,7 @@ void SourceFileWindow::findFunctions_functionListBox_selected(int index)
     int line=THIS->sourceFileFunctions[index].implementationLine>=0
              ?THIS->sourceFileFunctions[index].implementationLine
              :THIS->sourceFileFunctions[index].prototypeLine;
-    CURRENT_VIEW->setCursorPositionReal(line,0);
+    CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line,0));
     THIS->functionDialog->accept();
   }
 }
@@ -1091,14 +1091,14 @@ void SourceFileWindow::findFunctionsPopup_activated(int id)
   int line=THIS->sourceFileFunctions[id].implementationLine>=0
            ?THIS->sourceFileFunctions[id].implementationLine
            :THIS->sourceFileFunctions[id].prototypeLine;
-  CURRENT_VIEW->setCursorPositionReal(line,0);
+  CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line,0));
 }
 
 void SourceFileWindow::findOpenFileAtCursor()
 {
   int line,col,i;
   CURRENT_VIEW->cursorPosition().position(line,col);
-  QString textLine=CURRENT_VIEW->document()->textLine(line);
+  QString textLine=CURRENT_VIEW->document()->line(line);
   unsigned l=textLine.length();
   bool quotesInLine=textLine.contains("\"");
   QString fileName;
@@ -1149,7 +1149,7 @@ void SourceFileWindow::findFindSymbolDeclaration()
                          symbolFile,symbolLine,systemHeader)
         && !symbolFile.isNull()) {
       if (symbolFile==fileName)
-        CURRENT_VIEW->setCursorPositionReal(symbolLine,0);
+        CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(symbolLine,0));
       else {
         THIS->mainForm->openHeader(symbolFile,systemHeader,symbolLine);
         if (!systemHeader)
@@ -1249,7 +1249,7 @@ void SourceFileWindow::current_view_charactersInteractivelyInserted(int line, in
       QString fileText=doc->text();
       // Only for C files.
       if (THIS->isCFile) {
-        QString indent=doc->textLine(line);
+        QString indent=doc->line(line);
         // Only if the line was all whitespace, otherwise wait for Enter to be
         // pressed (prevents annoying the user while typing a string or something).
         if (indent.contains(QRegExp("^\\s*\\{$"))) {
@@ -1260,7 +1260,7 @@ void SourceFileWindow::current_view_charactersInteractivelyInserted(int line, in
           doc->insertLine(line+1,cursorLine);
           doc->insertLine(line+2,indent+"}");
           editExt->editEnd();
-          CURRENT_VIEW->setCursorPositionReal(line+1,cursorLine.length());
+          CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line+1,cursorLine.length()));
         }
       }
     }
@@ -1275,11 +1275,11 @@ void SourceFileWindow::current_view_newLineHook()
   int line,col;
   CURRENT_VIEW->cursorPosition().position(line,col);
   KTextEditor::Document *doc=CURRENT_VIEW->document();
-  if (preferences.autoBlocks && line && doc->textLine(line-1).endsWith("{")) {
+  if (preferences.autoBlocks && line && doc->line(line-1).endsWith("{")) {
     QString fileText=doc->text();
     // Only for C files.
     if (THIS->isCFile) {
-      QString indent=doc->textLine(line-1);
+      QString indent=doc->line(line-1);
       // Remove everything starting from the first non-whitespace character.
       indent=indent.remove(QRegExp("(?!\\s).*$"));
       QString cursorLine=indent+"\t";
@@ -1289,7 +1289,7 @@ void SourceFileWindow::current_view_newLineHook()
       doc->insertLine(line,cursorLine);
       doc->insertText(line+1,0,indent+"}");
       editExt->editEnd();
-      CURRENT_VIEW->setCursorPositionReal(line,cursorLine.length());
+      CURRENT_VIEW->setCursorPosition(KTextEditor::Cursor(line,cursorLine.length()));
     }
   }
 }