Browse Source

Create SourceFileWindow as a copy of MainForm (unfinished, but compiles and links).

git-svn-id: file:///var/svn/tigccpp/trunk@581 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 18 years ago
parent
commit
814eac1a41
4 changed files with 2959 additions and 4 deletions
  1. 4 2
      ktigcc/KTIGCC.prj
  2. 3 2
      ktigcc/ktigcc.pro
  3. 1421 0
      ktigcc/srcfilewin.ui
  4. 1531 0
      ktigcc/srcfilewin.ui.h

+ 4 - 2
ktigcc/KTIGCC.prj

@@ -73,7 +73,8 @@ module.include.files=\
 	preferences.h\
 	projectoptions.ui.h\
 	programoptions.ui.h\
-	preferencesdlg.ui.h
+	preferencesdlg.ui.h\
+	srcfilewin.ui.h
 
 module.source.name=.
 module.source.type=
@@ -87,7 +88,8 @@ module.source.files=\
 	preferences.cpp\
 	tpr.cpp\
 	configure\
-	fedora/ktigcc.spec
+	fedora/ktigcc.spec\
+	srcfilewin.ui
 
 module.pixmap.name=.
 module.pixmap.type=

+ 3 - 2
ktigcc/ktigcc.pro

@@ -13,10 +13,11 @@ SOURCES	+= ktigcc.cpp \
 	preferences.cpp \
 	tpr.cpp
 
-FORMS	= mainform.ui \
+FORMS	= srcfilewin.ui \
 	projectoptions.ui \
 	programoptions.ui \
-	preferencesdlg.ui
+	preferencesdlg.ui \
+	mainform.ui
 
 IMAGES	= images/00 \
 	images/01 \

+ 1421 - 0
ktigcc/srcfilewin.ui

@@ -0,0 +1,1421 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>SourceFileWindow</class>
+<widget class="QMainWindow">
+    <property name="name">
+        <cstring>SourceFileWindow</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>794</width>
+            <height>513</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>TIGCC IDE for KDE</string>
+    </property>
+    <hbox>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <widget class="QSplitter">
+            <property name="name">
+                <cstring>splitter</cstring>
+            </property>
+            <property name="orientation">
+                <enum>Horizontal</enum>
+            </property>
+            <widget class="QWidgetStack">
+                <property name="name">
+                    <cstring>widgetStack</cstring>
+                </property>
+                <property name="sizePolicy">
+                    <sizepolicy>
+                        <hsizetype>7</hsizetype>
+                        <vsizetype>7</vsizetype>
+                        <horstretch>0</horstretch>
+                        <verstretch>0</verstretch>
+                    </sizepolicy>
+                </property>
+            </widget>
+        </widget>
+    </hbox>
+</widget>
+<menubar>
+    <property name="name">
+        <cstring>menubar</cstring>
+    </property>
+    <item text="&amp;File" name="fileMenu">
+        <actiongroup name="fileNewActionGroup"/>
+        <item text="&amp;New" name="popupMenu" accel="">
+            <action name="fileNewProjectAction"/>
+            <action name="fileNewFolderAction"/>
+            <action name="fileNewCHeaderAction"/>
+            <action name="fileNewGNUAssemblyHeaderAction"/>
+            <action name="fileNewA68kAssemblyHeaderAction"/>
+            <action name="fileNewCSourceFileAction"/>
+            <action name="fileNewGNUAssemblySourceFileAction"/>
+            <action name="fileNewA68kAssemblySourceFileAction"/>
+            <action name="fileNewQuillSourceFileAction"/>
+            <action name="fileNewTextFileAction"/>
+        </item>
+        <action name="fileOpenAction"/>
+        <action name="fileSaveAllAction"/>
+        <action name="fileSaveProjectAsAction"/>
+        <separator/>
+        <action name="filePrintAction"/>
+        <separator/>
+        <action name="filePreferencesAction"/>
+        <separator/>
+        <action name="fileExitAction"/>
+        <separator/>
+        <action name="fileRecent1Action"/>
+        <action name="fileRecent2Action"/>
+        <action name="fileRecent3Action"/>
+        <action name="fileRecent4Action"/>
+    </item>
+    <item text="&amp;Edit" name="editMenu">
+        <action name="editUndoAction"/>
+        <action name="editRedoAction"/>
+        <separator/>
+        <action name="editClearAction"/>
+        <action name="editCutAction"/>
+        <action name="editCopyAction"/>
+        <action name="editPasteAction"/>
+        <separator/>
+        <action name="editSelectAllAction"/>
+        <separator/>
+        <action name="editIncreaseIndentAction"/>
+        <action name="editDecreaseIndentAction"/>
+    </item>
+    <item text="F&amp;ind" name="PopupMenu">
+        <action name="findFindAction"/>
+        <action name="findReplaceAction"/>
+        <separator/>
+        <action name="findFunctionsAction"/>
+        <separator/>
+        <action name="findOpenFileAtCursorAction"/>
+        <action name="findFindSymbolDeclarationAction"/>
+    </item>
+    <item text="&amp;Project" name="PopupMenu_2">
+        <action name="projectAddFilesAction"/>
+        <separator/>
+        <action name="projectCompileAction"/>
+        <action name="projectMakeAction"/>
+        <action name="projectBuildAction"/>
+        <separator/>
+        <action name="projectErrorsWarningsAction"/>
+        <action name="projectProgramOutputAction"/>
+        <separator/>
+        <action name="projectOptionsAction"/>
+    </item>
+    <item text="&amp;Debug" name="PopupMenu_3">
+        <action name="debugRunAction"/>
+        <separator/>
+        <action name="debugPauseAction"/>
+        <action name="debugResetAction"/>
+    </item>
+    <item text="&amp;Tools" name="PopupMenu_4">
+        <action name="toolsConfigureAction"/>
+    </item>
+    <item text="&amp;Help" name="helpMenu">
+        <action name="helpContentsAction"/>
+        <action name="helpIndexAction"/>
+        <action name="helpSearchAction"/>
+        <separator/>
+        <action name="helpNewsAction"/>
+        <separator/>
+        <action name="helpAboutAction"/>
+    </item>
+</menubar>
+<toolbars>
+    <toolbar dock="2">
+        <property name="name">
+            <cstring>toolBar</cstring>
+        </property>
+        <property name="movingEnabled">
+            <bool>false</bool>
+        </property>
+        <property name="label">
+            <string>Tools</string>
+        </property>
+        <action name="fileNewActionGroup"/>
+        <action name="fileOpenActionGroup"/>
+        <action name="fileSaveAllAction"/>
+        <separator/>
+        <action name="filePrintQuicklyAction"/>
+        <separator/>
+        <action name="editClearAction"/>
+        <action name="editCutAction"/>
+        <action name="editCopyAction"/>
+        <action name="editPasteAction"/>
+        <separator/>
+        <action name="editUndoAction"/>
+        <action name="editRedoAction"/>
+        <separator/>
+        <action name="findFindAction"/>
+        <action name="findReplaceAction"/>
+        <action name="findFunctionsAction"/>
+        <separator/>
+        <action name="projectAddFilesAction"/>
+        <separator/>
+        <action name="projectMakeAction"/>
+        <action name="projectBuildAction"/>
+        <separator/>
+        <action name="debugRunAction"/>
+        <action name="debugPauseAction"/>
+        <separator/>
+        <action name="helpDocumentationAction"/>
+    </toolbar>
+</toolbars>
+<actions>
+    <action>
+        <property name="name">
+            <cstring>fileOpenAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>01</iconset>
+        </property>
+        <property name="text">
+            <string>Open File</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Open...</string>
+        </property>
+        <property name="statusTip">
+            <string>Open an existing project or file</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+O</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>fileSaveAllAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>02</iconset>
+        </property>
+        <property name="text">
+            <string>Save All</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Save All</string>
+        </property>
+        <property name="statusTip">
+            <string>Save all open files</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+S</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>fileSaveProjectAsAction</cstring>
+        </property>
+        <property name="text">
+            <string>Save Project As...</string>
+        </property>
+        <property name="menuText">
+            <string>Save Project &amp;As...</string>
+        </property>
+        <property name="statusTip">
+            <string>Save the current project with another name, or in another folder</string>
+        </property>
+        <property name="accel">
+            <string></string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>filePrintAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>03</iconset>
+        </property>
+        <property name="text">
+            <string>Print File</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Print...</string>
+        </property>
+        <property name="statusTip">
+            <string>Print the current source file</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+P</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>fileExitAction</cstring>
+        </property>
+        <property name="text">
+            <string>Exit</string>
+        </property>
+        <property name="menuText">
+            <string>E&amp;xit</string>
+        </property>
+        <property name="statusTip">
+            <string>Close the TIGCC IDE</string>
+        </property>
+        <property name="accel">
+            <string></string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editUndoAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>16</iconset>
+        </property>
+        <property name="text">
+            <string>Undo</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Undo</string>
+        </property>
+        <property name="statusTip">
+            <string>Undo the last operation in the editor</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+Z</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editRedoAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>17</iconset>
+        </property>
+        <property name="text">
+            <string>Redo</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Redo</string>
+        </property>
+        <property name="statusTip">
+            <string>Redo the last undone operation in the editor</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+Y</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editCutAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>05</iconset>
+        </property>
+        <property name="text">
+            <string>Cut</string>
+        </property>
+        <property name="menuText">
+            <string>Cu&amp;t</string>
+        </property>
+        <property name="statusTip">
+            <string>Copy the selected text into the clipboard and delete it</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+X</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editCopyAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>06</iconset>
+        </property>
+        <property name="text">
+            <string>Copy</string>
+        </property>
+        <property name="menuText">
+            <string>C&amp;opy</string>
+        </property>
+        <property name="statusTip">
+            <string>Copy the selected text into the clipboard without deleting it</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+C</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editPasteAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>07</iconset>
+        </property>
+        <property name="text">
+            <string>Paste</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Paste</string>
+        </property>
+        <property name="statusTip">
+            <string>Paste text from the clipboard</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+V</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>findFindAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>13</iconset>
+        </property>
+        <property name="text">
+            <string>Find</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Find...</string>
+        </property>
+        <property name="toolTip">
+            <string>Find Text</string>
+        </property>
+        <property name="statusTip">
+            <string>Find the specified text in the current source file</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+F</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>helpContentsAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>12</iconset>
+        </property>
+        <property name="text">
+            <string>Contents</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Contents...</string>
+        </property>
+        <property name="statusTip">
+            <string>Display the contents tab of the documentation</string>
+        </property>
+        <property name="accel">
+            <string></string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>helpIndexAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>15</iconset>
+        </property>
+        <property name="text">
+            <string>Index</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Index...</string>
+        </property>
+        <property name="statusTip">
+            <string>Display the index tab of the documentation</string>
+        </property>
+        <property name="accel">
+            <string></string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>helpAboutAction</cstring>
+        </property>
+        <property name="text">
+            <string>About</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;About...</string>
+        </property>
+        <property name="statusTip">
+            <string>Display information about this program</string>
+        </property>
+        <property name="accel">
+            <string></string>
+        </property>
+    </action>
+    <actiongroup>
+        <property name="name">
+            <cstring>fileNewActionGroup</cstring>
+        </property>
+        <property name="on">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>00</iconset>
+        </property>
+        <property name="text">
+            <string>New</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;New</string>
+        </property>
+        <property name="toolTip">
+            <string>New File</string>
+        </property>
+        <property name="statusTip">
+            <string>Create a new file</string>
+        </property>
+        <property name="accel">
+            <string></string>
+        </property>
+        <property name="exclusive">
+            <bool>false</bool>
+        </property>
+        <property name="usesDropDown">
+            <bool>true</bool>
+        </property>
+        <action>
+            <property name="name">
+                <cstring>fileNewProjectAction</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;Project</string>
+            </property>
+            <property name="menuText">
+                <string>&amp;Project</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new project</string>
+            </property>
+            <property name="accel">
+                <string>Ctrl+N</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewFolderAction</cstring>
+            </property>
+            <property name="enabled">
+                <bool>true</bool>
+            </property>
+            <property name="text">
+                <string>&amp;Folder</string>
+            </property>
+            <property name="menuText">
+                <string>&amp;Folder</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new virtual folder</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewCHeaderAction</cstring>
+            </property>
+            <property name="text">
+                <string>C &amp;Header File</string>
+            </property>
+            <property name="menuText">
+                <string>C &amp;Header File</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new C header file in the current project</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewGNUAssemblyHeaderAction</cstring>
+            </property>
+            <property name="text">
+                <string>G&amp;NU Assembly Header File</string>
+            </property>
+            <property name="menuText">
+                <string>G&amp;NU Assembly Header File</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new GNU assembly header file in the current project</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewA68kAssemblyHeaderAction</cstring>
+            </property>
+            <property name="text">
+                <string>A68&amp;k Assembly &amp;Header File</string>
+            </property>
+            <property name="menuText">
+                <string>A68&amp;k Assembly &amp;Header File</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new A68k assembly header file in the current project</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewCSourceFileAction</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;C Source File</string>
+            </property>
+            <property name="menuText">
+                <string>&amp;C Source File</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new C source file in the current project</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewGNUAssemblySourceFileAction</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;GNU Assembly Source File</string>
+            </property>
+            <property name="menuText">
+                <string>&amp;GNU Assembly Source File</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new GNU assembly source file in the current project</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewA68kAssemblySourceFileAction</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;A68k Assembly Source File</string>
+            </property>
+            <property name="menuText">
+                <string>&amp;A68k Assembly Source File</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new A68k assembly source file in the current project</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewQuillSourceFileAction</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;Quill Source File</string>
+            </property>
+            <property name="menuText">
+                <string>&amp;Quill Source File</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new Quill source file in the current project</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileNewTextFileAction</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;Text File</string>
+            </property>
+            <property name="menuText">
+                <string>&amp;Text File</string>
+            </property>
+            <property name="statusTip">
+                <string>Create a new text file in the current project, for general use</string>
+            </property>
+        </action>
+    </actiongroup>
+    <action>
+        <property name="name">
+            <cstring>filePreferencesAction</cstring>
+        </property>
+        <property name="text">
+            <string>Preferences</string>
+        </property>
+        <property name="menuText">
+            <string>P&amp;references...</string>
+        </property>
+        <property name="statusTip">
+            <string>Change the IDE settings</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editClearAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>04</iconset>
+        </property>
+        <property name="text">
+            <string>Clear</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Clear</string>
+        </property>
+        <property name="statusTip">
+            <string>Delete the selected text in the editor</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editSelectAllAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="text">
+            <string>Select All</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Select All</string>
+        </property>
+        <property name="statusTip">
+            <string>Select the whole text in the editor</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+A</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editIncreaseIndentAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>19</iconset>
+        </property>
+        <property name="text">
+            <string>Increase Indent</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Increase Indent</string>
+        </property>
+        <property name="statusTip">
+            <string>Insert tabs so that the text is moved to the right</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+I</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>editDecreaseIndentAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>20</iconset>
+        </property>
+        <property name="text">
+            <string>Decrease Indent</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Decrease Indent</string>
+        </property>
+        <property name="statusTip">
+            <string>Remove tabs and spaces so that the text is moved to the left</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+D</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>findReplaceAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>14</iconset>
+        </property>
+        <property name="text">
+            <string>Replace</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Replace...</string>
+        </property>
+        <property name="toolTip">
+            <string>Replace Text</string>
+        </property>
+        <property name="statusTip">
+            <string>Find the specified text in the current source file and replace it with something else</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+R</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>findFunctionsAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>18</iconset>
+        </property>
+        <property name="text">
+            <string>Functions...</string>
+        </property>
+        <property name="menuText">
+            <string>F&amp;unctions...</string>
+        </property>
+        <property name="statusTip">
+            <string>Display a list of all functions in the current file</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>findOpenFileAtCursorAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="text">
+            <string>Open File at Cursor</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Open File at Cursor</string>
+        </property>
+        <property name="statusTip">
+            <string>Open the file the cursor is on</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+Enter</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>projectAddFilesAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>08</iconset>
+        </property>
+        <property name="text">
+            <string>Add Files</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Add Files...</string>
+        </property>
+        <property name="statusTip">
+            <string>Add existing files to the current project</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>projectCompileAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>09</iconset>
+        </property>
+        <property name="text">
+            <string>Compile</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Compile</string>
+        </property>
+        <property name="statusTip">
+            <string>Compile all updated files in the current project</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+Alt+F9</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>projectMakeAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>10</iconset>
+        </property>
+        <property name="text">
+            <string>Make</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Make</string>
+        </property>
+        <property name="statusTip">
+            <string>Compile and link together all updated files in the current project, creating an executable file</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+F9</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>projectBuildAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>11</iconset>
+        </property>
+        <property name="text">
+            <string>Build</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Build</string>
+        </property>
+        <property name="statusTip">
+            <string>Recompile and link together all files in the current project, creating an executable file</string>
+        </property>
+        <property name="accel">
+            <string>Alt+F9</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>projectErrorsWarningsAction</cstring>
+        </property>
+        <property name="toggleAction">
+            <bool>true</bool>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="text">
+            <string>Errors and Warnings</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Errors and Warnings</string>
+        </property>
+        <property name="statusTip">
+            <string>Show or hide the Errors and Warnings window</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+E</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>projectProgramOutputAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="text">
+            <string>Program Output...</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Program Output...</string>
+        </property>
+        <property name="statusTip">
+            <string>Show the output of the compilation tool that was run last</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>projectOptionsAction</cstring>
+        </property>
+        <property name="text">
+            <string>Options...</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Options...</string>
+        </property>
+        <property name="statusTip">
+            <string>Change the settings of the current project</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>debugRunAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>24</iconset>
+        </property>
+        <property name="text">
+            <string>Run</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Run</string>
+        </property>
+        <property name="statusTip">
+            <string>Run the program on the target specified in the project settings</string>
+        </property>
+        <property name="accel">
+            <string>F9</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>debugPauseAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>25</iconset>
+        </property>
+        <property name="text">
+            <string>Pause</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Pause</string>
+        </property>
+        <property name="statusTip">
+            <string>Pause the execution of the program and enter the debugger</string>
+        </property>
+        <property name="accel">
+            <string>Shift+F9</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>debugResetAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>27</iconset>
+        </property>
+        <property name="text">
+            <string>Reset</string>
+        </property>
+        <property name="menuText">
+            <string>Re&amp;set</string>
+        </property>
+        <property name="statusTip">
+            <string>Reset the state of the virtual calculator to the one which was previously saved</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>toolsConfigureAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>26</iconset>
+        </property>
+        <property name="text">
+            <string>Configure</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Configure...</string>
+        </property>
+        <property name="statusTip">
+            <string>Add, edit and remove tools</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>helpSearchAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>13</iconset>
+        </property>
+        <property name="text">
+            <string>&amp;Search</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Search</string>
+        </property>
+        <property name="statusTip">
+            <string>Display the search tab of the documentation</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>helpNewsAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>23</iconset>
+        </property>
+        <property name="text">
+            <string>News</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;News...</string>
+        </property>
+        <property name="statusTip">
+            <string>Obtain the latest headlines from the official TIGCC site</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>helpDocumentationAction</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>12</iconset>
+        </property>
+        <property name="text">
+            <string>Documentation</string>
+        </property>
+        <property name="menuText">
+            <string>Documentation</string>
+        </property>
+        <property name="statusTip">
+            <string>Open the documentation of TIGCC</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>findFindSymbolDeclarationAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="text">
+            <string>F&amp;ind symbol declaration</string>
+        </property>
+        <property name="menuText">
+            <string>F&amp;ind symbol declaration</string>
+        </property>
+        <property name="statusTip">
+            <string>Find symbol declaration</string>
+        </property>
+    </action>
+    <actiongroup>
+        <property name="name">
+            <cstring>fileOpenActionGroup</cstring>
+        </property>
+        <property name="iconSet">
+            <iconset>01</iconset>
+        </property>
+        <property name="text">
+            <string>Open File</string>
+        </property>
+        <property name="menuText">
+            <string>&amp;Open...</string>
+        </property>
+        <property name="statusTip">
+            <string>Open an existing project or file</string>
+        </property>
+        <property name="exclusive">
+            <bool>false</bool>
+        </property>
+        <property name="usesDropDown">
+            <bool>true</bool>
+        </property>
+        <action>
+            <property name="name">
+                <cstring>fileOpenActionHidden</cstring>
+            </property>
+            <property name="text">
+                <string>Open File</string>
+            </property>
+            <property name="visible">
+                <bool>false</bool>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileRecent1Action</cstring>
+            </property>
+            <property name="text">
+                <string>Recent File 1</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileRecent2Action</cstring>
+            </property>
+            <property name="text">
+                <string>Recent File 2</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileRecent3Action</cstring>
+            </property>
+            <property name="text">
+                <string>Recent File 3</string>
+            </property>
+        </action>
+        <action>
+            <property name="name">
+                <cstring>fileRecent4Action</cstring>
+            </property>
+            <property name="text">
+                <string>Recent File 4</string>
+            </property>
+        </action>
+    </actiongroup>
+    <action>
+        <property name="name">
+            <cstring>filePrintQuicklyAction</cstring>
+        </property>
+        <property name="enabled">
+            <bool>false</bool>
+        </property>
+        <property name="iconSet">
+            <iconset>03</iconset>
+        </property>
+        <property name="text">
+            <string>Print File</string>
+        </property>
+    </action>
+</actions>
+<connections>
+    <connection>
+        <sender>debugPauseAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>debugPause()</slot>
+    </connection>
+    <connection>
+        <sender>debugResetAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>debugReset()</slot>
+    </connection>
+    <connection>
+        <sender>debugRunAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>debugRun()</slot>
+    </connection>
+    <connection>
+        <sender>editClearAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editClear()</slot>
+    </connection>
+    <connection>
+        <sender>editCopyAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editCopy()</slot>
+    </connection>
+    <connection>
+        <sender>editCutAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editCut()</slot>
+    </connection>
+    <connection>
+        <sender>editDecreaseIndentAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editDecreaseIndent()</slot>
+    </connection>
+    <connection>
+        <sender>editIncreaseIndentAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editIncreaseIndent()</slot>
+    </connection>
+    <connection>
+        <sender>editPasteAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editPaste()</slot>
+    </connection>
+    <connection>
+        <sender>editRedoAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editRedo()</slot>
+    </connection>
+    <connection>
+        <sender>editSelectAllAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editSelectAll()</slot>
+    </connection>
+    <connection>
+        <sender>editUndoAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>editUndo()</slot>
+    </connection>
+    <connection>
+        <sender>fileExitAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>close()</slot>
+    </connection>
+    <connection>
+        <sender>filePreferencesAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>filePreferences()</slot>
+    </connection>
+    <connection>
+        <sender>filePrintAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>filePrint()</slot>
+    </connection>
+    <connection>
+        <sender>fileSaveAllAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>fileSave()</slot>
+    </connection>
+    <connection>
+        <sender>fileSaveProjectAsAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>fileSaveAs()</slot>
+    </connection>
+    <connection>
+        <sender>findFindAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>findFind()</slot>
+    </connection>
+    <connection>
+        <sender>findFindSymbolDeclarationAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>findFindSymbolDeclaration()</slot>
+    </connection>
+    <connection>
+        <sender>findFunctionsAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>findFunctions()</slot>
+    </connection>
+    <connection>
+        <sender>findOpenFileAtCursorAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>findOpenFileAtCursor()</slot>
+    </connection>
+    <connection>
+        <sender>findReplaceAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>findReplace()</slot>
+    </connection>
+    <connection>
+        <sender>helpAboutAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>helpAbout()</slot>
+    </connection>
+    <connection>
+        <sender>helpContentsAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>helpContents()</slot>
+    </connection>
+    <connection>
+        <sender>helpDocumentationAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>helpDocumentation()</slot>
+    </connection>
+    <connection>
+        <sender>helpIndexAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>helpIndex()</slot>
+    </connection>
+    <connection>
+        <sender>helpNewsAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>helpNews()</slot>
+    </connection>
+    <connection>
+        <sender>helpSearchAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>helpSearch()</slot>
+    </connection>
+    <connection>
+        <sender>projectErrorsWarningsAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>errorsAndWarnings()</slot>
+    </connection>
+    <connection>
+        <sender>toolsConfigureAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>toolsConfigure()</slot>
+    </connection>
+    <connection>
+        <sender>filePrintQuicklyAction</sender>
+        <signal>activated()</signal>
+        <receiver>SourceFileWindow</receiver>
+        <slot>filePrintQuickly()</slot>
+    </connection>
+</connections>
+<includes>
+    <include location="local" impldecl="in implementation">srcfilewin.ui.h</include>
+</includes>
+<slots>
+    <slot>init()</slot>
+    <slot>destroy()</slot>
+    <slot>te_popup_aboutToShow()</slot>
+    <slot>te_popup_activated( int index )</slot>
+    <slot>accel_activated( int index )</slot>
+    <slot>fileSave()</slot>
+    <slot>fileSaveAs()</slot>
+    <slot>filePrint()</slot>
+    <slot>filePrintQuickly()</slot>
+    <slot>filePreferences()</slot>
+    <slot>editUndo()</slot>
+    <slot>editRedo()</slot>
+    <slot>editClear()</slot>
+    <slot>editCut()</slot>
+    <slot>editCopy()</slot>
+    <slot>editPaste()</slot>
+    <slot>editSelectAll()</slot>
+    <slot>editIncreaseIndent()</slot>
+    <slot>editDecreaseIndent()</slot>
+    <slot>findFind()</slot>
+    <slot>findFind_next()</slot>
+    <slot>findFind_highlight( const QString &amp; unused_text, int matchingindex, int matchedlength )</slot>
+    <slot>findFind_stop()</slot>
+    <slot>findReplace()</slot>
+    <slot>findReplace_next()</slot>
+    <slot>findReplace_highlight( const QString &amp; unused_text, int matchingindex, int matchedlength )</slot>
+    <slot>findReplace_replace( const QString &amp; text, int replacementIndex, int replacedLength, int matchedLength )</slot>
+    <slot>findReplace_stop()</slot>
+    <slot>findFunctions()</slot>
+    <slot>findOpenFileAtCursor()</slot>
+    <slot>findFindSymbolDeclaration()</slot>
+    <slot>errorsAndWarnings()</slot>
+    <slot>debugRun()</slot>
+    <slot>debugPause()</slot>
+    <slot>debugReset()</slot>
+    <slot>toolsConfigure()</slot>
+    <slot>helpDocumentation()</slot>
+    <slot>helpContents()</slot>
+    <slot>helpIndex()</slot>
+    <slot>helpSearch()</slot>
+    <slot>helpNews()</slot>
+    <slot>helpAbout()</slot>
+    <slot>resizeEvent( QResizeEvent * event )</slot>
+    <slot>timerEvent( QTimerEvent * event )</slot>
+    <slot>statusBar_messageChanged( const QString &amp; message )</slot>
+    <slot>current_view_cursorPositionChanged()</slot>
+    <slot>current_view_textChanged()</slot>
+    <slot>current_view_undoChanged()</slot>
+    <slot>current_view_selectionChanged()</slot>
+    <slot>current_view_charactersInteractivelyInserted( int line, int col, const QString &amp; characters )</slot>
+    <slot>clipboard_dataChanged()</slot>
+    <slot>KDirWatch_dirty( const QString &amp; fileName )</slot>
+</slots>
+<functions>
+    <function returnType="QString">SGetFileName( int mode, const QString &amp; fileFilter, const QString &amp; caption, QWidget * parent )</function>
+    <function returnType="QStringList">SGetFileName_Multiple( const QString &amp; fileFilter, const QString &amp; caption, QWidget * parent )</function>
+    <function specifier="non virtual" returnType="void *">createView( const QString &amp; fileName, const QString &amp; fileText, const QString &amp; hlModeName, unsigned tabWidth )</function>
+    <function access="private" specifier="non virtual" returnType="int">savePrompt( void )</function>
+    <function access="private" specifier="non virtual">removeTrailingSpacesFromView( void * view )</function>
+    <function access="private" specifier="non virtual">fileSave_save()</function>
+    <function access="private" specifier="non virtual">fileSave_saveAs()</function>
+    <function access="private" specifier="non virtual">findReplace_next( bool firstTime )</function>
+    <function access="private" specifier="non virtual">updateSizes()</function>
+    <function access="private" specifier="non virtual">updateRightStatusLabel()</function>
+    <function access="private" specifier="non virtual">current_view_newLineHook()</function>
+    <function access="protected">closeEvent( QCloseEvent * e )</function>
+</functions>
+<pixmapinproject/>
+<layoutdefaults spacing="0" margin="0"/>
+</UI>

+ 1531 - 0
ktigcc/srcfilewin.ui.h

@@ -0,0 +1,1531 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename slots use Qt Designer which will
+** update this file, preserving your code. Create an init() slot in place of
+** a constructor, and a destroy() slot in place of a destructor.
+*****************************************************************************/
+
+/*
+   ktigcc - TIGCC IDE for KDE
+
+   Copyright (C) 2004-2006 Kevin Kofler
+   Copyright (C) 2006 Joey Adams
+
+   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, or (at your option)
+   any later version.
+
+   This program 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+*/
+
+#include <qstring.h>
+#include <qregexp.h>
+#include <qapplication.h>
+#include <qlabel.h>
+#include <qstatusbar.h>
+#include <qtimer.h>
+#include <qdatetime.h>
+#include <qdragobject.h>
+#include <qassistantclient.h>
+#include <qdir.h>
+#include <qclipboard.h>
+#include <qaccel.h>
+#include <qeventloop.h>
+#include <kparts/factory.h>
+#include <klibloader.h>
+#include <kate/document.h>
+#include <kate/view.h>
+#include <kconfig.h>
+#include <ktexteditor/editinterfaceext.h>
+#include <ktexteditor/configinterfaceextension.h>
+#include <kaboutdata.h>
+#include <khelpmenu.h>
+#include <kfiledialog.h>
+#include <kurl.h>
+#include <kmessagebox.h>
+#include <kdirwatch.h>
+#include <kfinddialog.h>
+#include <kfind.h>
+#include <kreplacedialog.h>
+#include <kreplace.h>
+#include <kwin.h>
+#include <kglobal.h>
+#include <kicontheme.h>
+#include <kiconloader.h>
+#include <cstdio>
+#include <cstdlib>
+#include "ktigcc.h"
+#include "tpr.h"
+#include "preferences.h"
+#include "projectoptions.h"
+
+using std::puts;
+using std::exit;
+
+#define TIGCC_TPR_Filter "*.tpr|TIGCC Projects (*.tpr)\n"
+#define TIGCC_H_Filter "*.h|Header Files (*.h)\n"
+#define TIGCC_C_Filter "*.c|C Files (*.c)\n"
+#define TIGCC_S_Filter "*.s|GNU Assembly Files (*.s)\n"
+#define TIGCC_ASM_Filter "*.asm|A68k Assembly Files (*.asm)\n"
+#define TIGCC_QLL_Filter "*.qll|Quill Files (*.qll)\n"
+#define TIGCC_O_Filter "*.o|Object Files (*.o)\n"
+#define TIGCC_A_Filter "*.a|Archive Files (*.a)\n"
+#define TIGCC_TXT_Filter "*.txt|Text Files (*.txt)\n"
+#define TIGCCAllFilter "*|All Files (*)"
+
+enum {TIGCCOpenProjectFileFilter,TIGCCAddFilesFilter};
+
+#define TIGCCProjectDirectory "/usr/local/tigcc/projects"
+
+#define IS_FOLDER(item) ((item) && (item)->rtti()==0x716CC0)
+#define IS_FILE(item) ((item) && (item)->rtti()==0x716CC1)
+#define CURRENT_VIEW (static_cast<Kate::View *>(widgetStack->visibleWidget()))
+
+#define LOAD_ICON(name) (QIconSet(KGlobal::iconLoader()->loadIcon((name),KIcon::Small),KGlobal::iconLoader()->loadIcon((name),KIcon::MainToolbar)))
+#define SYSICON(sysname,name) (preferences.useSystemIcons?KGlobal::iconLoader()->loadIcon((sysname),KIcon::Small):QPixmap::fromMimeSource((name)))
+
+// For some reason, this flag is not in the public ConfigFlags enum.
+#define CF_REMOVE_TRAILING_DYN 0x4000000
+
+static QListViewItem *currentListItem;
+static QListViewItem *replaceCurrentDocument;
+static unsigned replaceCurrentLine;
+class KReplaceWithSelection : public KReplace {
+  public:
+    KReplaceWithSelection(const QString &pattern, const QString &replacement,
+                          long options, QWidget *parent=0) :
+      KReplace(pattern,replacement,options,parent), m_haveSelection(FALSE) {}
+    void setSelection(unsigned selStartLine, unsigned selStartCol,
+                      unsigned selEndLine, unsigned selEndCol)
+    {
+      m_haveSelection=TRUE;
+      m_selStartLine=selStartLine;
+      m_selStartCol=selStartCol;
+      m_selEndLine=selEndLine;
+      m_selEndCol=selEndCol;
+    }
+    void invalidateSelection() {m_haveSelection=FALSE;}
+    bool haveSelection() {
+      // If another document was put under the cursor, invalidate selection.
+      // The m_haveSelection&& is technically redundant, but necessary to avoid
+      // possible undefined behavior if replaceCurrentDocument has been deleted.
+      if (m_haveSelection&&currentListItem!=replaceCurrentDocument)
+        m_haveSelection=FALSE;
+      return m_haveSelection;
+    }
+    unsigned selStartLine() {return m_selStartLine;}
+    unsigned selStartCol() {return m_selStartCol;}
+    unsigned selEndLine() {return m_selEndLine;}
+    unsigned selEndCol() {return m_selEndCol;}
+    // Override to ask for restarting when replacing in a selection.
+    bool shouldRestart(bool forceAsking=FALSE, bool showNumMatches=TRUE)
+    {
+      return KReplace::shouldRestart(forceAsking||m_haveSelection,showNumMatches);
+    }
+  protected:
+    virtual bool validateMatch(const QString &text, int index, int matchedlength)
+    {
+      if (!KReplace::validateMatch(text,index,matchedlength)) return FALSE;
+      // If another document was put under the cursor, invalidate selection.
+      // The m_haveSelection&& is technically redundant, but necessary to avoid
+      // possible undefined behavior if replaceCurrentDocument has been deleted.
+      if (m_haveSelection&&currentListItem!=replaceCurrentDocument)
+        m_haveSelection=FALSE;
+      if (!m_haveSelection) return TRUE;
+      if (replaceCurrentLine==m_selStartLine && replaceCurrentLine==m_selEndLine)
+        return ((unsigned)index>=m_selStartCol)&&((unsigned)index+(unsigned)matchedlength<=m_selEndCol);
+      else if (replaceCurrentLine==m_selStartLine)
+        return ((unsigned)index>=m_selStartCol);
+      else if (replaceCurrentLine==m_selEndLine)
+        return ((unsigned)index+(unsigned)matchedlength<=m_selEndCol);
+      else
+        return (replaceCurrentLine>=m_selStartLine&&replaceCurrentLine<=m_selEndLine);
+    }
+  private:
+    bool m_haveSelection;
+    unsigned m_selStartLine, m_selStartCol, m_selEndLine, m_selEndCol;
+};
+static KReplaceWithSelection *kreplace;
+
+// FIXME: There may be multiple instances of SourceFileWindow, so these have no
+// business of being here.
+static QLabel *leftStatusLabel;
+static QLabel *rowStatusLabel;
+static QLabel *colStatusLabel;
+static QLabel *charsStatusLabel;
+static QLabel *rightStatusLabel;
+static KHelpMenu *khelpmenu;
+static QPopupMenu *te_popup;
+static QString fileName;
+static QString lastDirectory;
+static QClipboard *clipboard;
+static QAccel *accel;
+static KFindDialog *kfinddialog;
+static QListViewItem *findCurrentDocument;
+static unsigned findCurrentLine;
+static bool isCFile;
+
+void SourceFileWindow::init()
+{  
+  fileNewFolderAction->setEnabled(FALSE);
+  te_popup = new QPopupMenu(this);
+  te_popup->insertItem("&Open file at cursor",0);
+  te_popup->insertItem("&Find symbol declaration",1);
+  te_popup->insertSeparator();
+  te_popup->insertItem("&Undo",2);
+  te_popup->insertItem("&Redo",3);
+  te_popup->insertSeparator();
+  te_popup->insertItem("&Clear",4);
+  te_popup->insertItem("Cu&t",5);
+  te_popup->insertItem("Cop&y",6);
+  te_popup->insertItem("&Paste",7);
+  te_popup->insertSeparator();
+  te_popup->insertItem("&Select all",8);
+  te_popup->insertSeparator();
+  te_popup->insertItem("&Increase indent",9);
+  te_popup->insertItem("&Decrease indent",10);
+  connect(te_popup,SIGNAL(aboutToShow()),this,SLOT(te_popup_aboutToShow()));
+  connect(te_popup,SIGNAL(activated(int)),this,SLOT(te_popup_activated(int)));
+  QValueList<int> list;
+  list.append(150);
+  list.append(500);
+  splitter->setSizes(list);
+  leftStatusLabel=new QLabel("0 Files Total",this);
+  leftStatusLabel->setMaximumWidth(splitter->sizes().first());
+  statusBar()->addWidget(leftStatusLabel,1);
+  rowStatusLabel=new QLabel("",this);
+  rowStatusLabel->setAlignment(Qt::AlignRight);
+  statusBar()->addWidget(rowStatusLabel,1);
+  rowStatusLabel->hide();
+  colStatusLabel=new QLabel("",this);
+  colStatusLabel->setAlignment(Qt::AlignRight);
+  statusBar()->addWidget(colStatusLabel,1);
+  colStatusLabel->hide();
+  charsStatusLabel=new QLabel("",this);
+  statusBar()->addWidget(charsStatusLabel,1);
+  charsStatusLabel->hide();
+  rightStatusLabel=new QLabel("",this);
+  rightStatusLabel->setMaximumWidth(splitter->sizes().last());
+  statusBar()->addWidget(rightStatusLabel,1);
+  statusBar()->setSizeGripEnabled(FALSE);
+  connect(statusBar(),SIGNAL(messageChanged(const QString &)),this,SLOT(statusBar_messageChanged(const QString &)));
+  khelpmenu=new KHelpMenu(this,pabout);
+  assistant = new QAssistantClient("",this);
+  QStringList args(QString("-profile"));
+  args.append(QString("%1/doc/html/qt-assistant.adp").arg(tigcc_base));
+  assistant->setArguments(args);
+  lastDirectory=TIGCCProjectDirectory;
+  fileName="";
+  connect(KDirWatch::self(),SIGNAL(created(const QString &)),this,SLOT(KDirWatch_dirty(const QString &)));
+  connect(KDirWatch::self(),SIGNAL(dirty(const QString &)),this,SLOT(KDirWatch_dirty(const QString &)));
+  KDirWatch::self()->startScan();
+  clipboard=QApplication::clipboard();
+  connect(clipboard,SIGNAL(dataChanged()),this,SLOT(clipboard_dataChanged()));
+  accel=new QAccel(this);
+  accel->insertItem(ALT+Key_Backspace,0);
+  accel->setItemEnabled(0,FALSE);
+  accel->insertItem(SHIFT+ALT+Key_Backspace,1);
+  accel->setItemEnabled(1,FALSE);
+  accel->insertItem(SHIFT+Key_Delete,2);
+  accel->setItemEnabled(2,FALSE);
+  accel->insertItem(CTRL+Key_Insert,3);
+  accel->setItemEnabled(3,FALSE);
+  accel->insertItem(SHIFT+Key_Insert,4);
+  accel->setItemEnabled(4,FALSE);
+  accel->insertItem(Key_F1,5);
+  accel->setItemEnabled(5,FALSE);
+  accel->insertItem(Key_Enter,6);
+  accel->setItemEnabled(6,FALSE);
+  accel->insertItem(Key_Return,7);
+  accel->setItemEnabled(7,FALSE);
+  connect(accel,SIGNAL(activated(int)),this,SLOT(accel_activated(int)));
+  pconfig->setGroup("Recent files");
+  startTimer(100);
+  kfinddialog = static_cast<KFindDialog *>(NULL);
+  kreplace = static_cast<KReplaceWithSelection *>(NULL);
+  if (preferences.useSystemIcons) {
+    setUsesBigPixmaps(TRUE);
+    fileNewActionGroup->setIconSet(LOAD_ICON("filenew"));
+    fileMenu->changeItem(fileMenu->idAt(0),LOAD_ICON("filenew"),"&New");
+    fileOpenAction->setIconSet(LOAD_ICON("fileopen"));
+    fileOpenActionGroup->setIconSet(LOAD_ICON("fileopen"));
+    fileSaveAllAction->setIconSet(LOAD_ICON("filesave"));
+    filePrintAction->setIconSet(LOAD_ICON("fileprint"));
+    filePrintQuicklyAction->setIconSet(LOAD_ICON("fileprint"));
+    editClearAction->setIconSet(LOAD_ICON("editdelete"));
+    editCutAction->setIconSet(LOAD_ICON("editcut"));
+    editCopyAction->setIconSet(LOAD_ICON("editcopy"));
+    editPasteAction->setIconSet(LOAD_ICON("editpaste"));
+    projectAddFilesAction->setIconSet(LOAD_ICON("edit_add"));
+    projectCompileAction->setIconSet(LOAD_ICON("compfile"));
+    projectMakeAction->setIconSet(LOAD_ICON("make_kdevelop"));
+    projectBuildAction->setIconSet(LOAD_ICON("rebuild"));
+    helpContentsAction->setIconSet(LOAD_ICON("help"));
+    helpDocumentationAction->setIconSet(LOAD_ICON("help"));
+    helpSearchAction->setIconSet(LOAD_ICON("filefind"));
+    findFindAction->setIconSet(LOAD_ICON("filefind"));
+    if (KGlobal::iconLoader()->iconPath("stock-find-and-replace",KIcon::Small,TRUE).isEmpty()) {
+      QIconSet fileReplaceIconSet(QPixmap::fromMimeSource("filereplace.png"));
+      int smallSize=IconSize(KIcon::Small);
+      fileReplaceIconSet.setIconSize(QIconSet::Small,QSize(smallSize,smallSize));
+      int largeSize=IconSize(KIcon::MainToolbar);
+      fileReplaceIconSet.setIconSize(QIconSet::Large,QSize(largeSize,largeSize));
+      findReplaceAction->setIconSet(fileReplaceIconSet);
+    } else
+      findReplaceAction->setIconSet(LOAD_ICON("stock-find-and-replace"));
+    helpIndexAction->setIconSet(LOAD_ICON("contents"));
+    editUndoAction->setIconSet(LOAD_ICON("undo"));
+    editRedoAction->setIconSet(LOAD_ICON("redo"));
+    findFunctionsAction->setIconSet(LOAD_ICON("view_tree"));
+    editIncreaseIndentAction->setIconSet(LOAD_ICON("indent"));
+    editDecreaseIndentAction->setIconSet(LOAD_ICON("unindent"));
+    // stop compilation: "stop"
+    // force-quit compiler: "button_cancel"
+    helpNewsAction->setIconSet(LOAD_ICON("kontact_news"));
+    debugRunAction->setIconSet(LOAD_ICON("player_play"));
+    debugPauseAction->setIconSet(LOAD_ICON("player_pause"));
+    toolsConfigureAction->setIconSet(LOAD_ICON("configure"));
+    debugResetAction->setIconSet(LOAD_ICON("player_stop"));
+  }
+}
+
+void SourceFileWindow::destroy()
+{
+  if (kreplace) delete kreplace;
+  if (kfinddialog) delete kfinddialog;
+  delete accel;
+  delete te_popup;
+  delete leftStatusLabel;
+  delete rowStatusLabel;
+  delete colStatusLabel;
+  delete charsStatusLabel;
+  delete rightStatusLabel;
+  delete khelpmenu;
+  delete assistant;
+}
+
+void SourceFileWindow::te_popup_aboutToShow()
+{
+  te_popup->setItemEnabled(0,findOpenFileAtCursorAction->isEnabled());
+  te_popup->setItemEnabled(1,findFindSymbolDeclarationAction->isEnabled());
+  te_popup->setItemEnabled(2,editUndoAction->isEnabled());
+  te_popup->setItemEnabled(3,editRedoAction->isEnabled());
+  te_popup->setItemEnabled(4,editClearAction->isEnabled());
+  te_popup->setItemEnabled(5,editCutAction->isEnabled());
+  te_popup->setItemEnabled(6,editCopyAction->isEnabled());
+  te_popup->setItemEnabled(7,editPasteAction->isEnabled());
+  te_popup->setItemEnabled(8,editSelectAllAction->isEnabled());
+  te_popup->setItemEnabled(9,editIncreaseIndentAction->isEnabled());
+  te_popup->setItemEnabled(10,editDecreaseIndentAction->isEnabled());
+}
+
+void SourceFileWindow::te_popup_activated(int index)
+{
+  switch (index) {
+    case 0: findOpenFileAtCursor(); break;
+    case 1: findFindSymbolDeclaration(); break;
+    case 2: editUndo(); break;
+    case 3: editRedo(); break;
+    case 4: editClear(); break;
+    case 5: editCut(); break;
+    case 6: editCopy(); break;
+    case 7: editPaste(); break;
+    case 8: editSelectAll(); break;
+    case 9: editIncreaseIndent(); break;
+    case 10: editDecreaseIndent(); break;
+    default: break;
+  }
+}
+
+void SourceFileWindow::accel_activated(int index)
+{
+  if (CURRENT_VIEW && CURRENT_VIEW->hasFocus()) {
+    switch (index) {
+      case 0: editUndo(); break;
+      case 1: editRedo(); break;
+      case 2: editCut(); break;
+      case 3: editCopy(); break;
+      case 4: editPaste(); break;
+      case 5: // F1 context help
+      {
+        QString wordUnderCursor=CURRENT_VIEW->currentWord();
+        // always open at least the index
+        force_qt_assistant_page(1);
+        assistant->openAssistant();
+        if (wordUnderCursor.isEmpty()) return;
+        QString docFile=lookup_doc_keyword(wordUnderCursor);
+        if (docFile.isEmpty()) return;
+        // wait for Qt Assistant to actually open
+        while (!assistant->isOpen())
+          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput,1000);
+        assistant->showPage(QString(tigcc_base)+QString("/doc/html/")+docFile);
+        break;
+      }
+      case 6:
+      case 7:
+        CURRENT_VIEW->keyReturn();
+        current_view_newLineHook();
+        break;
+      default: break;
+    }
+  } else if (index == 6 || index == 7) {
+    QKeyEvent *keyEvent=new QKeyEvent(QEvent::KeyPress,Key_Return,'\n',0,"\n");
+    QApplication::postEvent(focusWidget(),keyEvent);
+  }
+}
+
+QString SourceFileWindow::SGetFileName(int mode,const QString &fileFilter,const QString &caption,QWidget *parent)
+{
+  QString ret;
+  if (static_cast<KFileDialog::OperationMode>(mode)==KFileDialog::Opening)
+    ret=KFileDialog::getOpenFileName(lastDirectory,fileFilter,parent,caption);
+  else
+    ret=KFileDialog::getSaveFileName(lastDirectory,fileFilter,parent,caption);
+  if (!ret.isNull())
+  {
+    KURL dir;
+    dir.setPath(ret);
+    dir.setFileName("");
+    lastDirectory=dir.path();
+  }
+  return ret;
+}
+
+//no mode, since it you can't save multiple.
+QStringList SourceFileWindow::SGetFileName_Multiple(const QString &fileFilter,const QString &caption,QWidget *parent)
+{
+  QStringList ret;
+  ret=KFileDialog::getOpenFileNames(lastDirectory,fileFilter,parent,caption);
+  if (!ret.empty())
+  {
+    KURL dir;
+    dir.setPath(ret[0]);
+    dir.setFileName("");
+    lastDirectory=dir.path();
+  }
+  return ret;
+}
+
+void *SourceFileWindow::createView(const QString &fileName, const QString &fileText, const QString &hlModeName, unsigned tabWidth)
+{
+  // Create Document object.
+  KParts::Factory *factory = (KParts::Factory *)
+    KLibLoader::self()->factory ("libkatepart");
+  if (!factory) qFatal("Failed to load KatePart");
+  Kate::Document *doc = (Kate::Document *)
+      factory->createPart( 0, "", this, "", "Kate::Document" );
+  // Set the file name for printing.
+  doc->setModified(FALSE);
+  if (doc->openStream("text/plain",fileName))
+    doc->closeStream();
+  // Create View object.
+  Kate::View *newView = (Kate::View *) doc->createView( widgetStack, 0L );
+  newView->hide();
+  newView->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored,0,0));
+  // Set highlighting mode.
+  uint cnt=newView->getDoc()->hlModeCount(), i;
+  for (i=0; i<cnt; i++) {
+    if (!newView->getDoc()->hlModeName(i).compare(hlModeName)) break;
+  }
+  if (i==cnt) i=0;
+  newView->getDoc()->setHlMode(i);
+  // Set options.
+  newView->setDynWordWrap(FALSE);
+  if (preferences.removeTrailingSpaces)
+    newView->getDoc()->setConfigFlags(newView->getDoc()->configFlags()|(Kate::Document::cfRemoveSpaces|CF_REMOVE_TRAILING_DYN));
+  else
+    newView->getDoc()->setConfigFlags(newView->getDoc()->configFlags()&~(Kate::Document::cfRemoveSpaces|CF_REMOVE_TRAILING_DYN));
+  newView->setTabWidth(tabWidth);
+  connect(newView,SIGNAL(cursorPositionChanged()),this,SLOT(current_view_cursorPositionChanged()));
+  connect(newView->getDoc(),SIGNAL(textChanged()),this,SLOT(current_view_textChanged()));
+  connect(newView->getDoc(),SIGNAL(undoChanged()),this,SLOT(current_view_undoChanged()));
+  connect(newView->getDoc(),SIGNAL(selectionChanged()),this,SLOT(current_view_selectionChanged()));
+  connect(newView->getDoc(),SIGNAL(charactersInteractivelyInserted(int,int,const QString&)),this,SLOT(current_view_charactersInteractivelyInserted(int,int,const QString&)));
+  newView->installPopup(te_popup);
+  // Set text.
+  newView->getDoc()->setText(fileText);
+  newView->getDoc()->setModified(FALSE);
+  newView->getDoc()->clearUndo();
+  newView->getDoc()->clearRedo();
+  newView->setCursorPositionReal(0,0);
+  return newView;
+}
+
+//returns 1 if the current project data should not be cleared out, 0 if it can be cleared out.
+int SourceFileWindow::savePrompt(void)
+{
+  int result;
+  if (!CURRENT_VIEW) return 0;
+  while (CURRENT_VIEW->getDoc()->isModified()) { // "while" in case saving fails!
+    result=KMessageBox::questionYesNoCancel(this,QString("The file \'%1\' has been modified.  Do you want to save the changes?").arg(fileName),QString::null,KStdGuiItem::save(),KStdGuiItem::discard());
+    if (result==KMessageBox::Yes)
+        fileSave_save();
+    else if (result==KMessageBox::No)
+      CURRENT_VIEW->getDoc()->setModified(FALSE);
+    else
+      return 1;
+  }
+  return 0;
+}
+
+void SourceFileWindow::removeTrailingSpacesFromView(void *view)
+{
+  if (!preferences.removeTrailingSpaces) return;
+  Kate::View *kateView=reinterpret_cast<Kate::View *>(view);
+  Kate::Document *doc=kateView->getDoc();
+  KTextEditor::EditInterfaceExt *editExt=KTextEditor::editInterfaceExt(doc);
+  editExt->editBegin();
+  unsigned numLines=doc->numLines();
+  for (unsigned i=0; i<numLines; i++) {
+    QString line=doc->textLine(i);
+    int whitespace=line.find(QRegExp("\\s+$"));
+    if (whitespace>=0) doc->removeText(i,whitespace,i,line.length());
+  }
+  editExt->editEnd();
+}
+
+void SourceFileWindow::fileSave_save()
+{
+  KDirWatch::self()->removeFile(fileName);
+  if (saveFileText(fileName,CURRENT_VIEW->getDoc()->text())) {
+    KMessageBox::error(this,QString("Can't save to \'%1\'").arg(fileName));
+    KDirWatch::self()->addFile(fileName);
+  } else {
+    KDirWatch::self()->addFile(fileName);
+    removeTrailingSpacesFromView(CURRENT_VIEW);
+    CURRENT_VIEW->getDoc()->setModified(FALSE);
+  }
+}
+
+void SourceFileWindow::fileSave_saveAs()
+{
+  QString saveFileName=SGetFileName(KFileDialog::Saving,
+  TIGCC_H_Filter TIGCC_C_Filter TIGCC_S_Filter TIGCC_ASM_Filter TIGCC_QLL_Filter
+  TIGCC_TXT_Filter TIGCCAllFilter,"Save Source File",this);
+  if (saveFileName.isEmpty())
+    return;
+  if (fileName[0]=='/')
+    KDirWatch::self()->removeFile(fileName);
+  if (saveFileText(saveFileName,CURRENT_VIEW->getDoc()->text())) {
+    KMessageBox::error(this,QString("Can't save to \'%1\'").arg(saveFileName));
+    if (fileName[0]=='/')
+      KDirWatch::self()->addFile(fileName);
+  } else {
+    if (saveFileName.compare(fileName)) {
+      // Update the file name for printing.
+      unsigned int line,col,hlMode;
+      QString fileText=CURRENT_VIEW->getDoc()->text();
+      hlMode=CURRENT_VIEW->getDoc()->hlMode();
+      CURRENT_VIEW->cursorPositionReal(&line,&col);
+      CURRENT_VIEW->getDoc()->setModified(FALSE);
+      if (CURRENT_VIEW->getDoc()->openStream("text/plain",saveFileName))
+        CURRENT_VIEW->getDoc()->closeStream();
+      CURRENT_VIEW->getDoc()->setText(fileText);
+      CURRENT_VIEW->getDoc()->clearUndo();
+      CURRENT_VIEW->getDoc()->clearRedo();
+      CURRENT_VIEW->getDoc()->setHlMode(hlMode);
+      CURRENT_VIEW->setCursorPositionReal(line,col);
+    }
+    fileName=saveFileName;
+    KDirWatch::self()->addFile(saveFileName);
+    removeTrailingSpacesFromView(CURRENT_VIEW);
+    CURRENT_VIEW->getDoc()->setModified(FALSE);
+    updateRightStatusLabel();
+  }
+}
+
+void SourceFileWindow::fileSave()
+{
+  fileSave_save();
+}
+
+void SourceFileWindow::fileSaveAs()
+{
+  fileSave_saveAs();
+}
+
+void SourceFileWindow::filePrint()
+{
+  if (CURRENT_VIEW) CURRENT_VIEW->getDoc()->printDialog();
+}
+
+
+void SourceFileWindow::filePrintQuickly()
+{
+  if (CURRENT_VIEW) CURRENT_VIEW->getDoc()->print();
+}
+
+void SourceFileWindow::filePreferences()
+{
+#if 0
+  if (showPreferencesDialog(this)==QDialog::Accepted) {
+    // Apply the KatePart preferences and treeview icons.
+    QListViewItem *item;
+    KParts::Factory *factory = (KParts::Factory *)
+      KLibLoader::self()->factory ("libkatepart");
+    if (!factory) qFatal("Failed to load KatePart");
+    Kate::Document *doc = (Kate::Document *)
+      factory->createPart( 0, "", this, "", "Kate::Document" );
+    KTextEditor::ConfigInterfaceExtension *confInterfaceExt = KTextEditor::configInterfaceExtension(doc);
+    unsigned numConfigPages=confInterfaceExt->configPages();
+    for (unsigned i=0; i<numConfigPages; i++) {
+      if (!confInterfaceExt->configPageName(i).compare("Fonts & Colors")) {
+        KTextEditor::ConfigPage *configPage=confInterfaceExt->configPage(i);
+        configPage->apply();
+        delete configPage;
+        break;
+      }
+    }
+    delete doc;
+    Kate::View *kateView=CURRENT_VIEW;
+    if (kateView) {
+    }
+    if (CURRENT_VIEW) {
+      Kate::View *currView=CURRENT_VIEW;
+      QString fileText=currView->getDoc()->text();
+      CATEGORY_OF(category,item);
+      if (preferences.removeTrailingSpaces)
+        currView->getDoc()->setConfigFlags(currView->getDoc()->configFlags()|(Kate::Document::cfRemoveSpaces|CF_REMOVE_TRAILING_DYN));
+      else
+        currView->getDoc()->setConfigFlags(currView->getDoc()->configFlags()&~(Kate::Document::cfRemoveSpaces|CF_REMOVE_TRAILING_DYN));
+      currView->setTabWidth(
+        (category==sFilesListItem||category==asmFilesListItem||((category==hFilesListItem&&!fileText.isNull()&&!fileText.isEmpty()&&(fileText[0]=='|'||fileText[0]==';'))))?preferences.tabWidthAsm:
+        (category==cFilesListItem||category==qllFilesListItem||category==hFilesListItem)?preferences.tabWidthC:
+        8
+      );
+      // Force redrawing to get the tab width right, repaint() is ignored for some reason.
+      currView->hide();
+      currView->show();
+    }
+    // Apply the icon preferences.
+    setUsesBigPixmaps(preferences.useSystemIcons);
+    if (preferences.useSystemIcons) {
+      fileNewActionGroup->setIconSet(LOAD_ICON("filenew"));
+      fileMenu->changeItem(fileMenu->idAt(0),LOAD_ICON("filenew"),"&New");
+      fileOpenAction->setIconSet(LOAD_ICON("fileopen"));
+      fileOpenActionGroup->setIconSet(LOAD_ICON("fileopen"));
+      fileSaveAllAction->setIconSet(LOAD_ICON("filesave"));
+      filePrintAction->setIconSet(LOAD_ICON("fileprint"));
+      filePrintQuicklyAction->setIconSet(LOAD_ICON("fileprint"));
+      editClearAction->setIconSet(LOAD_ICON("editdelete"));
+      editCutAction->setIconSet(LOAD_ICON("editcut"));
+      editCopyAction->setIconSet(LOAD_ICON("editcopy"));
+      editPasteAction->setIconSet(LOAD_ICON("editpaste"));
+      projectAddFilesAction->setIconSet(LOAD_ICON("edit_add"));
+      projectCompileAction->setIconSet(LOAD_ICON("compfile"));
+      projectMakeAction->setIconSet(LOAD_ICON("make_kdevelop"));
+      projectBuildAction->setIconSet(LOAD_ICON("rebuild"));
+      helpContentsAction->setIconSet(LOAD_ICON("help"));
+      helpDocumentationAction->setIconSet(LOAD_ICON("help"));
+      helpSearchAction->setIconSet(LOAD_ICON("filefind"));
+      findFindAction->setIconSet(LOAD_ICON("filefind"));
+      if (KGlobal::iconLoader()->iconPath("stock-find-and-replace",KIcon::Small,TRUE).isEmpty()) {
+        QIconSet fileReplaceIconSet(QPixmap::fromMimeSource("filereplace.png"));
+        int smallSize=IconSize(KIcon::Small);
+        fileReplaceIconSet.setIconSize(QIconSet::Small,QSize(smallSize,smallSize));
+        int largeSize=IconSize(KIcon::MainToolbar);
+        fileReplaceIconSet.setIconSize(QIconSet::Large,QSize(largeSize,largeSize));
+        findReplaceAction->setIconSet(fileReplaceIconSet);
+      } else
+        findReplaceAction->setIconSet(LOAD_ICON("stock-find-and-replace"));
+      helpIndexAction->setIconSet(LOAD_ICON("contents"));
+      editUndoAction->setIconSet(LOAD_ICON("undo"));
+      editRedoAction->setIconSet(LOAD_ICON("redo"));
+      findFunctionsAction->setIconSet(LOAD_ICON("view_tree"));
+      editIncreaseIndentAction->setIconSet(LOAD_ICON("indent"));
+      editDecreaseIndentAction->setIconSet(LOAD_ICON("unindent"));
+      // stop compilation: "stop"
+      // force-quit compiler: "button_cancel"
+      helpNewsAction->setIconSet(LOAD_ICON("kontact_news"));
+      debugRunAction->setIconSet(LOAD_ICON("player_play"));
+      debugPauseAction->setIconSet(LOAD_ICON("player_pause"));
+      toolsConfigureAction->setIconSet(LOAD_ICON("configure"));
+      debugResetAction->setIconSet(LOAD_ICON("player_stop"));
+    } else {
+      fileNewActionGroup->setIconSet(QIconSet(QPixmap::fromMimeSource("00")));
+      fileMenu->changeItem(fileMenu->idAt(0),QIconSet(QPixmap::fromMimeSource("00")),"&New");
+      fileOpenAction->setIconSet(QIconSet(QPixmap::fromMimeSource("01")));
+      fileOpenActionGroup->setIconSet(QIconSet(QPixmap::fromMimeSource("01")));
+      fileSaveAllAction->setIconSet(QIconSet(QPixmap::fromMimeSource("02")));
+      filePrintAction->setIconSet(QIconSet(QPixmap::fromMimeSource("03")));
+      filePrintQuicklyAction->setIconSet(QIconSet(QPixmap::fromMimeSource("03")));
+      editClearAction->setIconSet(QIconSet(QPixmap::fromMimeSource("04")));
+      editCutAction->setIconSet(QIconSet(QPixmap::fromMimeSource("05")));
+      editCopyAction->setIconSet(QIconSet(QPixmap::fromMimeSource("06")));
+      editPasteAction->setIconSet(QIconSet(QPixmap::fromMimeSource("07")));
+      projectAddFilesAction->setIconSet(QIconSet(QPixmap::fromMimeSource("08")));
+      projectCompileAction->setIconSet(QIconSet(QPixmap::fromMimeSource("09")));
+      projectMakeAction->setIconSet(QIconSet(QPixmap::fromMimeSource("10")));
+      projectBuildAction->setIconSet(QIconSet(QPixmap::fromMimeSource("11")));
+      helpContentsAction->setIconSet(QIconSet(QPixmap::fromMimeSource("12")));
+      helpDocumentationAction->setIconSet(QIconSet(QPixmap::fromMimeSource("12")));
+      helpSearchAction->setIconSet(QIconSet(QPixmap::fromMimeSource("13")));
+      findFindAction->setIconSet(QIconSet(QPixmap::fromMimeSource("13")));
+      findReplaceAction->setIconSet(QIconSet(QPixmap::fromMimeSource("14")));
+      helpIndexAction->setIconSet(QIconSet(QPixmap::fromMimeSource("15")));
+      editUndoAction->setIconSet(QIconSet(QPixmap::fromMimeSource("16")));
+      editRedoAction->setIconSet(QIconSet(QPixmap::fromMimeSource("17")));
+      findFunctionsAction->setIconSet(QIconSet(QPixmap::fromMimeSource("18")));
+      editIncreaseIndentAction->setIconSet(QIconSet(QPixmap::fromMimeSource("19")));
+      editDecreaseIndentAction->setIconSet(QIconSet(QPixmap::fromMimeSource("20")));
+      // stop compilation: "21"
+      // force-quit compiler: "22"
+      helpNewsAction->setIconSet(QIconSet(QPixmap::fromMimeSource("23")));
+      debugRunAction->setIconSet(QIconSet(QPixmap::fromMimeSource("24")));
+      debugPauseAction->setIconSet(QIconSet(QPixmap::fromMimeSource("25")));
+      toolsConfigureAction->setIconSet(QIconSet(QPixmap::fromMimeSource("26")));
+      debugResetAction->setIconSet(QIconSet(QPixmap::fromMimeSource("27")));
+    }
+  }
+#endif
+}
+
+void SourceFileWindow::editUndo()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->getDoc()->undo();
+}
+
+void SourceFileWindow::editRedo()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->getDoc()->redo();
+}
+
+void SourceFileWindow::editClear()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->getDoc()->removeSelectedText();
+}
+
+void SourceFileWindow::editCut()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->cut();
+}
+
+void SourceFileWindow::editCopy()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->copy();
+}
+
+void SourceFileWindow::editPaste()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->paste();
+}
+
+void SourceFileWindow::editSelectAll()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->getDoc()->selectAll();
+}
+
+void SourceFileWindow::editIncreaseIndent()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->indent();
+}
+
+void SourceFileWindow::editDecreaseIndent()
+{
+  if (CURRENT_VIEW)
+    CURRENT_VIEW->unIndent();
+}
+
+void SourceFileWindow::findFind()
+{
+  if (kfinddialog)
+    KWin::activateWindow(kfinddialog->winId());
+  else {
+    // Never set hasSelection because finding in selection doesn't really make
+    // sense with my non-modal find dialog setup.
+    kfinddialog=new KFindDialog(false,this,0,KFindDialog::FromCursor);
+    connect(kfinddialog, SIGNAL(okClicked()), this, SLOT(findFind_next()));
+    connect(kfinddialog, SIGNAL(cancelClicked()), this, SLOT(findFind_stop()));
+    kfinddialog->show();
+  }
+}
+
+void SourceFileWindow::findFind_next()
+{
+#if 0
+  // Use a local KFind object. The search will need to be restarted next time
+  // this function is called because of the non-modality of the find dialog.
+  KFind *kfind=new KFind(kfinddialog->pattern(),kfinddialog->options(),this,kfinddialog);
+
+  // Initialize.
+  bool findBackwards=!!(kfinddialog->options()&KFindDialog::FindBackwards);
+  int findCurrentCol;
+  kfind=new KFind(kfinddialog->pattern(),kfinddialog->options(),this,kfinddialog);
+  kfind->closeFindNextDialog(); // don't use this, a non-modal KFindDialog is used instead
+  connect(kfind,SIGNAL(highlight(const QString &,int,int)),
+          this,SLOT(findFind_highlight(const QString &,int,int)));
+  // Make sure we have a valid currentListItem.
+  if (!currentListItem) fileTreeClicked(rootListItem);
+  findCurrentDocument=currentListItem;
+  if (CURRENT_VIEW) {
+    if (kfinddialog->options()&KFindDialog::FromCursor) {
+      if (CURRENT_VIEW->getDoc()->hasSelection()) {
+        if (findBackwards) {
+          findCurrentLine=CURRENT_VIEW->getDoc()->selStartLine();
+          findCurrentCol=CURRENT_VIEW->getDoc()->selStartCol()-1;
+          if (findCurrentCol==-1) {
+            if (!findCurrentLine) goto skip_data;
+            findCurrentLine--;
+          }
+        } else {
+          findCurrentLine=CURRENT_VIEW->getDoc()->selEndLine();
+          findCurrentCol=CURRENT_VIEW->getDoc()->selEndCol();
+        }
+      } else {
+        findCurrentLine=CURRENT_VIEW->cursorLine();
+        findCurrentCol=CURRENT_VIEW->cursorColumnReal();
+      }
+    } else {
+      findCurrentLine=findBackwards?(CURRENT_VIEW->getDoc()->numLines()-1):0;
+      findCurrentCol=-1;
+    }
+    kfind->setData(CURRENT_VIEW->getDoc()->textLine(findCurrentLine),findCurrentCol);
+  } else findCurrentLine=0;
+  skip_data:;
+
+  // Now find the next occurrence.
+  KFind::Result result;
+  Kate::View *currView=CURRENT_VIEW;
+  // We never have a currBuffer here, the current list item is always either
+  // non-editable or instantiated.
+  QStringList currBuffer;
+  unsigned currNumLines=0;
+  if (CURRENT_VIEW) currNumLines=CURRENT_VIEW->getDoc()->numLines();
+  do {
+    if (kfind->needData()) {
+      if (findBackwards?!findCurrentLine:(findCurrentLine>=currNumLines)) {
+        if (findBackwards) {
+          // Traverse the file tree in order backwards, restart from the end if
+          // the first file was reached. Stop at currentListItem.
+          if (findCurrentDocument) {
+            QListViewItemIterator lvit(fileTree);
+            QPtrList<QListViewItem> lst;
+            QListViewItem *item;
+            for (item=lvit.current();item&&item!=findCurrentDocument;
+                 item=(++lvit).current()) {
+              lst.prepend(item);
+            }
+            QPtrListIterator<QListViewItem> it(lst);
+            for (findCurrentDocument=it.current();
+                 findCurrentDocument&&findCurrentDocument!=currentListItem;
+                 findCurrentDocument=++it) {
+              if (IS_FILE(findCurrentDocument)) {
+                CATEGORY_OF(category,findCurrentDocument);
+                if (IS_EDITABLE_CATEGORY(category)) goto file_found;
+              }
+            }
+            if (findCurrentDocument) goto not_found;
+          }
+          QListViewItemIterator lvit(currentListItem);
+          QPtrList<QListViewItem> lst;
+          QListViewItem *item;
+          for (item=(++lvit).current();item;item=(++lvit).current()) {
+            lst.prepend(item);
+          }
+          QPtrListIterator<QListViewItem> it(lst);
+          for (findCurrentDocument=it.current();findCurrentDocument;
+               findCurrentDocument=++it) {
+            if (IS_FILE(findCurrentDocument)) {
+              CATEGORY_OF(category,findCurrentDocument);
+              if (IS_EDITABLE_CATEGORY(category)) goto file_found;
+            }
+          }
+          goto not_found;
+        } else {
+          // Traverse the file tree in order, restart from the beginning if
+          // the last file was reached. Stop at currentListItem.
+          if (findCurrentDocument) {
+            QListViewItemIterator it(findCurrentDocument);
+            for (findCurrentDocument=(++it).current();
+                 findCurrentDocument&&findCurrentDocument!=currentListItem;
+                 findCurrentDocument=(++it).current()) {
+              if (IS_FILE(findCurrentDocument)) {
+                CATEGORY_OF(category,findCurrentDocument);
+                if (IS_EDITABLE_CATEGORY(category)) goto file_found;
+              }
+            }
+            if (findCurrentDocument) goto not_found;
+          }
+          {
+            QListViewItemIterator it(fileTree);
+            for (findCurrentDocument=it.current();
+                 findCurrentDocument&&findCurrentDocument!=currentListItem;
+                 findCurrentDocument=(++it).current()) {
+              if (IS_FILE(findCurrentDocument)) {
+                CATEGORY_OF(category,findCurrentDocument);
+                if (IS_EDITABLE_CATEGORY(category)) goto file_found;
+              }
+            }
+          }
+          not_found:
+            // No find in all files. Try currentListItem again because it hasn't
+            // been fully searched yet.
+            if (IS_FILE(currentListItem)) {
+              // currentListItem is always either instantiated or not editable
+              currView=static_cast<ListViewFile *>(currentListItem)->kateView;
+              if (currView) {
+                currNumLines=currView->getDoc()->numLines();
+                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->getDoc()->textLine(findCurrentLine));
+                  }
+                  result=kfind->find();
+                } while (result==KFind::NoMatch);
+                break;
+              }
+            }
+            not_found_current:
+              KMessageBox::error(this,QString("Text \'%1\' not found").arg(kfinddialog->pattern()));
+              delete kfind;
+              return;
+          file_found:
+            currView=static_cast<ListViewFile *>(findCurrentDocument)->kateView;
+            if (currView) {
+              currNumLines=currView->getDoc()->numLines();
+            } else {
+              currBuffer=QStringList::split('\n',
+                static_cast<ListViewFile *>(findCurrentDocument)->textBuffer,TRUE);
+              currNumLines=currBuffer.count();
+            }
+            findCurrentLine=findBackwards?currNumLines-1:0;
+        }
+      } else if (findBackwards) findCurrentLine--; else findCurrentLine++;
+      if (currView)
+        kfind->setData(currView->getDoc()->textLine(findCurrentLine));
+      else
+        kfind->setData(currBuffer[findCurrentLine]);
+    }
+    result=kfind->find();
+  } while (result==KFind::NoMatch);
+  delete kfind;
+#endif
+}
+
+#define unused_text text __attribute__((unused))
+void SourceFileWindow::findFind_highlight(const QString &unused_text, int matchingindex, int matchedlength)
+{
+#if 0
+  if (currentListItem!=findCurrentDocument) fileTreeClicked(findCurrentDocument);
+  if (!CURRENT_VIEW) qFatal("CURRENT_VIEW should be set here!");
+  CURRENT_VIEW->setCursorPositionReal(findCurrentLine,matchingindex+matchedlength);
+  CURRENT_VIEW->getDoc()->setSelection(findCurrentLine,matchingindex,
+                                       findCurrentLine,matchingindex+matchedlength);
+#endif
+}
+
+void SourceFileWindow::findFind_stop()
+{
+  if (kfinddialog) kfinddialog->deleteLater();
+  kfinddialog=static_cast<KFindDialog *>(NULL);
+}
+
+void SourceFileWindow::findReplace()
+{
+#if 0
+  if (kreplace) {
+    KDialogBase *replaceNextDialog=kreplace->replaceNextDialog();
+    if (replaceNextDialog)
+      KWin::activateWindow(replaceNextDialog->winId());
+    return;
+  }
+  KReplaceDialog kreplacedialog(this,0,((CURRENT_VIEW&&CURRENT_VIEW->getDoc()->hasSelection()
+                                        &&CURRENT_VIEW->getDoc()->selStartLine()!=CURRENT_VIEW->getDoc()->selEndLine())?
+                                        KFindDialog::SelectedText:0)|KFindDialog::FromCursor,
+                                       QStringList(),QStringList(),
+                                       CURRENT_VIEW&&CURRENT_VIEW->getDoc()->hasSelection());
+  if (kreplacedialog.exec()!=QDialog::Accepted)
+    return;
+  kreplace=new KReplaceWithSelection(kreplacedialog.pattern(),kreplacedialog.replacement(),
+                                     kreplacedialog.options(),this);
+  // Connect signals to code which handles highlighting of found text, and
+  // on-the-fly replacement.
+  connect(kreplace,SIGNAL(highlight(const QString &,int,int)),
+          this,SLOT(findReplace_highlight(const QString &,int,int)));
+  // Connect findNext signal - called when pressing the button in the dialog.
+  connect(kreplace,SIGNAL(findNext()),this,SLOT(findReplace_next()));
+  // Connect replace signal - called when doing a replacement.
+  connect(kreplace,SIGNAL(replace(const QString &,int,int,int)),
+          this,SLOT(findReplace_replace(const QString &,int,int,int)));
+  // Connect dialogClosed signal - called when closing the Replace Next dialog.
+  connect(kreplace,SIGNAL(dialogClosed()),this,SLOT(findReplace_stop()));
+  // Initialize.
+  bool findBackwards=!!(kreplace->options()&KFindDialog::FindBackwards);
+  int replaceCurrentCol;
+  // Make sure we have a valid currentListItem.
+  if (!currentListItem) fileTreeClicked(rootListItem);
+  replaceCurrentDocument=currentListItem;
+  if (CURRENT_VIEW) {
+    if (kreplace->options()&KFindDialog::SelectedText) {
+      kreplace->setSelection(CURRENT_VIEW->getDoc()->selStartLine(),
+                             CURRENT_VIEW->getDoc()->selStartCol(),
+                             CURRENT_VIEW->getDoc()->selEndLine(),
+                             CURRENT_VIEW->getDoc()->selEndCol());
+      if (findBackwards) {
+        replaceCurrentLine=kreplace->selEndLine();
+        replaceCurrentCol=kreplace->selEndCol();
+      } else {
+        replaceCurrentLine=kreplace->selStartLine();
+        replaceCurrentCol=kreplace->selStartCol();
+      }
+      kreplace->setOptions(kreplace->options()&~KFindDialog::FromCursor);
+    } else if (kreplace->options()&KFindDialog::FromCursor) {
+      if (CURRENT_VIEW->getDoc()->hasSelection()) {
+        if (findBackwards) {
+          replaceCurrentLine=CURRENT_VIEW->getDoc()->selStartLine();
+          replaceCurrentCol=CURRENT_VIEW->getDoc()->selStartCol()-1;
+          if (replaceCurrentCol==-1) {
+            if (!replaceCurrentLine) goto skip_data;
+            replaceCurrentLine--;
+          }
+        } else {
+          replaceCurrentLine=CURRENT_VIEW->getDoc()->selEndLine();
+          replaceCurrentCol=CURRENT_VIEW->getDoc()->selEndCol();
+        }
+      } else {
+        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->getDoc()->numLines()-1)
+                           && replaceCurrentCol==(CURRENT_VIEW->getDoc()->lineLength(replaceCurrentLine)))
+                         :(!replaceCurrentLine&&!replaceCurrentCol))
+          kreplace->setOptions(kreplace->options()&~KFindDialog::FromCursor);
+      }
+    } else {
+      replaceCurrentLine=findBackwards?(CURRENT_VIEW->getDoc()->numLines()-1):0;
+      replaceCurrentCol=-1;
+    }
+    kreplace->setData(CURRENT_VIEW->getDoc()->textLine(replaceCurrentLine),replaceCurrentCol);
+  }
+  skip_data:
+    // Now find the next occurrence.
+    findReplace_next(TRUE);
+#endif
+}
+
+void SourceFileWindow::findReplace_next()
+{
+  findReplace_next(FALSE);
+}
+
+
+void SourceFileWindow::findReplace_next(bool firstTime)
+{
+#if 0
+  // Replace All only works on the current file. Also, if we have a selection,
+  // we only want to work on the file containing the selection.
+  bool global=(kreplace->options()&KReplaceDialog::PromptOnReplace)&&!kreplace->haveSelection();
+  bool findBackwards=!!(kreplace->options()&KFindDialog::FindBackwards);
+
+  // Reinitialize.
+  if (!firstTime) {
+    int replaceCurrentCol;
+    // Make sure we have a valid currentListItem.
+    if (!currentListItem) fileTreeClicked(rootListItem);
+    replaceCurrentDocument=currentListItem;
+    if (CURRENT_VIEW) {
+      // Non-first-time always continues from cursor.
+      if (CURRENT_VIEW->getDoc()->hasSelection()) {
+        if (findBackwards) {
+          replaceCurrentLine=CURRENT_VIEW->getDoc()->selStartLine();
+          replaceCurrentCol=CURRENT_VIEW->getDoc()->selStartCol()-1;
+          if (replaceCurrentCol==-1) {
+            if (!replaceCurrentLine) goto skip_data;
+            replaceCurrentLine--;
+          }
+        } else {
+          replaceCurrentLine=CURRENT_VIEW->getDoc()->selEndLine();
+          replaceCurrentCol=CURRENT_VIEW->getDoc()->selEndCol();
+        }
+      } else {
+        replaceCurrentLine=CURRENT_VIEW->cursorLine();
+        replaceCurrentCol=CURRENT_VIEW->cursorColumnReal();
+      }
+      kreplace->setData(CURRENT_VIEW->getDoc()->textLine(replaceCurrentLine),replaceCurrentCol);
+    } else replaceCurrentLine=0;
+  }
+  skip_data:;
+
+  // Now find the next occurrence.
+  KFind::Result result;
+  Kate::View *currView=CURRENT_VIEW;
+  // We never have a currBuffer here, the current list item is always either
+  // non-editable or instantiated.
+  QStringList currBuffer;
+  unsigned currNumLines=0;
+  if (CURRENT_VIEW) currNumLines=CURRENT_VIEW->getDoc()->numLines();
+  do {
+    if (kreplace->needData()) {
+      if (global) {
+        if (findBackwards?!replaceCurrentLine:(replaceCurrentLine>=currNumLines)) {
+          if (findBackwards) {
+            // Traverse the file tree in order backwards, restart from the end if
+            // the first file was reached. Stop at currentListItem.
+            if (replaceCurrentDocument) {
+              QListViewItemIterator lvit(fileTree);
+              QPtrList<QListViewItem> lst;
+              QListViewItem *item;
+              for (item=lvit.current();item&&item!=replaceCurrentDocument;
+                   item=(++lvit).current()) {
+                lst.prepend(item);
+              }
+              QPtrListIterator<QListViewItem> it(lst);
+              for (replaceCurrentDocument=it.current();
+                   replaceCurrentDocument&&replaceCurrentDocument!=currentListItem;
+                   replaceCurrentDocument=++it) {
+                if (IS_FILE(replaceCurrentDocument)) {
+                  CATEGORY_OF(category,replaceCurrentDocument);
+                  if (IS_EDITABLE_CATEGORY(category)) goto file_found;
+                }
+              }
+              if (replaceCurrentDocument) goto not_found;
+            }
+            QListViewItemIterator lvit(currentListItem);
+            QPtrList<QListViewItem> lst;
+            QListViewItem *item;
+            for (item=(++lvit).current();item;item=(++lvit).current()) {
+              lst.prepend(item);
+            }
+            QPtrListIterator<QListViewItem> it(lst);
+            for (replaceCurrentDocument=it.current();replaceCurrentDocument;
+                 replaceCurrentDocument=++it) {
+              if (IS_FILE(replaceCurrentDocument)) {
+                CATEGORY_OF(category,replaceCurrentDocument);
+                if (IS_EDITABLE_CATEGORY(category)) goto file_found;
+              }
+            }
+            goto not_found;
+          } else {
+            // Traverse the file tree in order, restart from the beginning if
+            // the last file was reached. Stop at currentListItem.
+            if (replaceCurrentDocument) {
+              QListViewItemIterator it(replaceCurrentDocument);
+              for (replaceCurrentDocument=(++it).current();
+                   replaceCurrentDocument&&replaceCurrentDocument!=currentListItem;
+                   replaceCurrentDocument=(++it).current()) {
+                if (IS_FILE(replaceCurrentDocument)) {
+                  CATEGORY_OF(category,replaceCurrentDocument);
+                  if (IS_EDITABLE_CATEGORY(category)) goto file_found;
+                }
+              }
+              if (replaceCurrentDocument) goto not_found;
+            }
+            {
+              QListViewItemIterator it(fileTree);
+              for (replaceCurrentDocument=it.current();
+                   replaceCurrentDocument&&replaceCurrentDocument!=currentListItem;
+                   replaceCurrentDocument=(++it).current()) {
+                if (IS_FILE(replaceCurrentDocument)) {
+                  CATEGORY_OF(category,replaceCurrentDocument);
+                  if (IS_EDITABLE_CATEGORY(category)) goto file_found;
+                }
+              }
+            }
+            not_found:
+              // No find in all files. Try currentListItem again because it hasn't
+              // been fully searched yet.
+              if (IS_FILE(currentListItem)) {
+                // currentListItem is always either instantiated or not editable
+                currView=static_cast<ListViewFile *>(currentListItem)->kateView;
+                if (currView) {
+                  currNumLines=currView->getDoc()->numLines();
+                  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->getDoc()->textLine(replaceCurrentLine));
+                    }
+                    result=kreplace->replace();
+                  } while (result==KFind::NoMatch);
+                  break;
+                }
+              }
+              not_found_current:
+                kreplace->displayFinalDialog();
+                findReplace_stop();
+                return;
+            file_found:
+              currView=static_cast<ListViewFile *>(replaceCurrentDocument)->kateView;
+              if (currView) {
+                currNumLines=currView->getDoc()->numLines();
+              } else {
+                currBuffer=QStringList::split('\n',
+                  static_cast<ListViewFile *>(replaceCurrentDocument)->textBuffer,TRUE);
+                currNumLines=currBuffer.count();
+              }
+              replaceCurrentLine=findBackwards?currNumLines-1:0;
+          }
+        } else if (findBackwards) replaceCurrentLine--; else replaceCurrentLine++;
+        if (currView)
+          kreplace->setData(currView->getDoc()->textLine(replaceCurrentLine));
+        else
+          kreplace->setData(currBuffer[replaceCurrentLine]);
+      } else { // if not global
+        if (kreplace->haveSelection()
+            ?(findBackwards?(replaceCurrentLine<=kreplace->selStartLine())
+                           :(replaceCurrentLine>=kreplace->selEndLine()))
+            :(findBackwards?!replaceCurrentLine:(replaceCurrentLine>=currNumLines))) {
+          // It makes no sense to prompt for restarting if we aren't actually
+          // searching anywhere.
+          if (CURRENT_VIEW) {
+            if (kreplace->shouldRestart()) {
+              // Drop "From cursor" and "Selected text" options.
+              kreplace->setOptions(kreplace->options()&~(KFindDialog::FromCursor
+                                                         |KFindDialog::SelectedText));
+              kreplace->invalidateSelection();
+              // Reinitialize.
+              replaceCurrentLine=findBackwards?(CURRENT_VIEW->getDoc()->numLines()-1):0;
+              kreplace->setData(CURRENT_VIEW->getDoc()->textLine(replaceCurrentLine));
+              // Start again as if it was the first time.
+              findReplace_next(TRUE);
+              return;
+            } else {
+              findReplace_stop();
+              return;
+            }
+          } else goto not_found_current;
+        } else if (findBackwards) replaceCurrentLine--; else replaceCurrentLine++;
+        if (currView)
+          kreplace->setData(currView->getDoc()->textLine(replaceCurrentLine));
+        else
+          kreplace->setData(currBuffer[replaceCurrentLine]);
+      }
+    }
+    result=kreplace->replace();
+  } while (result==KFind::NoMatch);
+#endif
+}
+
+void SourceFileWindow::findReplace_highlight(const QString &unused_text, int matchingindex, int matchedlength)
+{
+#if 0
+  if (currentListItem!=replaceCurrentDocument) fileTreeClicked(replaceCurrentDocument);
+  if (!CURRENT_VIEW) qFatal("CURRENT_VIEW should be set here!");
+  CURRENT_VIEW->setCursorPositionReal(replaceCurrentLine,matchingindex+matchedlength);
+  CURRENT_VIEW->getDoc()->setSelection(replaceCurrentLine,matchingindex,
+                                       replaceCurrentLine,matchingindex+matchedlength);
+#endif
+}
+
+void SourceFileWindow::findReplace_replace(const QString &text, int replacementIndex, int replacedLength, int matchedLength)
+{
+#if 0
+  if (currentListItem!=replaceCurrentDocument) fileTreeClicked(replaceCurrentDocument);
+  if (!CURRENT_VIEW) qFatal("CURRENT_VIEW should be set here!");
+  bool update=!!(kreplace->options()&KReplaceDialog::PromptOnReplace);
+  bool haveSelection=kreplace->haveSelection();
+  // The initializations are redundant, but g++ doesn't understand this, and the
+  // self-initialization trick doesn't work either (-Wno-init-self is ignored).
+  unsigned selStartLine=0, selStartCol=0, selEndLine=0, selEndCol=0;
+  if (haveSelection) {
+    selStartLine=kreplace->selStartLine();
+    selStartCol=kreplace->selStartCol();
+    selEndLine=kreplace->selEndLine();
+    selEndCol=kreplace->selEndCol();
+  }
+  KTextEditor::EditInterfaceExt *editinterfaceext=KTextEditor::editInterfaceExt(CURRENT_VIEW->getDoc());
+  editinterfaceext->editBegin();
+  CURRENT_VIEW->getDoc()->insertText(replaceCurrentLine,replacementIndex,
+                                     text.mid(replacementIndex,replacedLength));
+  // We can't put the cursor back now because this breaks editBegin/editEnd.
+  bool updateCursor=(CURRENT_VIEW->cursorLine()==replaceCurrentLine
+                     && CURRENT_VIEW->cursorColumnReal()==(unsigned)replacementIndex+(unsigned)replacedLength);
+  CURRENT_VIEW->getDoc()->removeText(replaceCurrentLine,replacementIndex+replacedLength,
+                                     replaceCurrentLine,replacementIndex+replacedLength+matchedLength);
+  editinterfaceext->editEnd();
+  if (updateCursor)
+    CURRENT_VIEW->setCursorPositionReal(replaceCurrentLine,replacementIndex);
+  if (update) {
+    CURRENT_VIEW->setCursorPositionReal(replaceCurrentLine,replacementIndex+replacedLength);
+    CURRENT_VIEW->getDoc()->setSelection(replaceCurrentLine,replacementIndex,
+                                         replaceCurrentLine,replacementIndex+replacedLength);
+    CURRENT_VIEW->repaint();
+  }
+  if (haveSelection) {
+    // Restore selection, updating coordinates if necessary.
+    kreplace->setSelection(selStartLine,selStartCol,selEndLine,
+                           (replaceCurrentLine==selEndLine)
+                           ?(selEndCol+replacedLength-matchedLength)
+                           :selEndCol);
+  }
+#endif
+}
+
+void SourceFileWindow::findReplace_stop()
+{
+  if (kreplace) kreplace->deleteLater();
+  kreplace=static_cast<KReplaceWithSelection *>(NULL);
+}
+
+void SourceFileWindow::findFunctions()
+{
+  
+}
+
+void SourceFileWindow::findOpenFileAtCursor()
+{
+  
+}
+
+void SourceFileWindow::findFindSymbolDeclaration()
+{
+
+}
+
+void SourceFileWindow::errorsAndWarnings()
+{
+  
+}
+
+void SourceFileWindow::debugRun()
+{
+  
+}
+
+void SourceFileWindow::debugPause()
+{
+  
+}
+
+void SourceFileWindow::debugReset()
+{
+  
+}
+
+void SourceFileWindow::toolsConfigure()
+{
+  
+}
+
+void SourceFileWindow::helpDocumentation()
+{
+  assistant->openAssistant();
+}
+
+void SourceFileWindow::helpContents()
+{
+  force_qt_assistant_page(0);
+  assistant->openAssistant();
+}
+
+void SourceFileWindow::helpIndex()
+{
+  force_qt_assistant_page(1);
+  assistant->openAssistant();
+}
+
+void SourceFileWindow::helpSearch()
+{
+  force_qt_assistant_page(3);
+  assistant->openAssistant();
+}
+
+void SourceFileWindow::helpNews()
+{
+  
+}
+
+void SourceFileWindow::helpAbout()
+{
+  khelpmenu->aboutApplication();
+}
+
+void SourceFileWindow::updateSizes()
+{
+  int leftSize=splitter->sizes().first();
+  int rightSize=splitter->sizes().last();
+  int totalSize=leftSize+rightSize;
+  int mySize=size().width();
+  leftStatusLabel->setMaximumWidth(leftSize*mySize/totalSize);
+  rightStatusLabel->setMaximumWidth(rightSize*mySize/totalSize-10>0?
+                                    rightSize*mySize/totalSize-10:0);
+}
+
+void SourceFileWindow::resizeEvent(QResizeEvent *event)
+{
+  QMainWindow::resizeEvent(event);
+  if (event->size()==event->oldSize()) return;
+  updateSizes();
+}
+
+void SourceFileWindow::timerEvent(QTimerEvent *event)
+{
+  static int lastSplitterPos=-1;
+  QMainWindow::timerEvent(event);
+  if (lastSplitterPos==splitter->sizes().first()) return;
+  lastSplitterPos=splitter->sizes().first();
+  updateSizes();
+}
+
+void SourceFileWindow::statusBar_messageChanged(const QString & message)
+{
+  if (message.isNull())
+    // Make sure no labels which should be hidden are shown.
+    updateRightStatusLabel();
+}
+
+void SourceFileWindow::updateRightStatusLabel()
+{
+  int leftSize=splitter->sizes().first();
+  int rightSize=splitter->sizes().last();
+  int totalSize=leftSize+rightSize;
+  int mySize=size().width();
+  int rightStatusSize=rightSize*mySize/totalSize-10>0?
+                      rightSize*mySize/totalSize-10:0;
+  unsigned int line, col;
+  CURRENT_VIEW->cursorPositionReal(&line,&col);
+  rowStatusLabel->show();
+  rowStatusLabel->setMaximumWidth(30);
+  rowStatusLabel->setText(QString("%1").arg(line+1));
+  colStatusLabel->show();
+  colStatusLabel->setMaximumWidth(30);
+  colStatusLabel->setText(QString("%1").arg(col+1));
+  charsStatusLabel->show();
+  charsStatusLabel->setMaximumWidth(100);
+  charsStatusLabel->setText(QString("%1 Characters").arg(CURRENT_VIEW->getDoc()->text().length()));
+  rightStatusLabel->setMaximumWidth(rightStatusSize-160>0?rightStatusSize-160:0);
+  rightStatusLabel->setText(fileName);
+}
+
+void SourceFileWindow::current_view_cursorPositionChanged()
+{
+  if (CURRENT_VIEW) {
+    unsigned int line, col;
+    CURRENT_VIEW->cursorPositionReal(&line,&col);
+    rowStatusLabel->setText(QString("%1").arg(line+1));
+    colStatusLabel->setText(QString("%1").arg(col+1));
+  }
+}
+
+void SourceFileWindow::current_view_textChanged()
+{
+  if (CURRENT_VIEW)
+    charsStatusLabel->setText(QString("%1 Characters").arg(CURRENT_VIEW->getDoc()->text().length()));
+  if (kreplace) kreplace->invalidateSelection();
+}
+
+void SourceFileWindow::current_view_undoChanged()
+{
+  if (CURRENT_VIEW) {
+    editUndoAction->setEnabled(!!(CURRENT_VIEW->getDoc()->undoCount()));
+    editRedoAction->setEnabled(!!(CURRENT_VIEW->getDoc()->redoCount()));
+    accel->setItemEnabled(0,!!(CURRENT_VIEW->getDoc()->undoCount()));
+    accel->setItemEnabled(1,!!(CURRENT_VIEW->getDoc()->redoCount()));
+  }
+}
+
+void SourceFileWindow::current_view_selectionChanged()
+{
+  if (CURRENT_VIEW) {
+    editClearAction->setEnabled(CURRENT_VIEW->getDoc()->hasSelection());
+    editCutAction->setEnabled(CURRENT_VIEW->getDoc()->hasSelection());
+    editCopyAction->setEnabled(CURRENT_VIEW->getDoc()->hasSelection());
+    accel->setItemEnabled(2,CURRENT_VIEW->getDoc()->hasSelection());
+    accel->setItemEnabled(3,CURRENT_VIEW->getDoc()->hasSelection());
+  }
+}
+
+void SourceFileWindow::current_view_charactersInteractivelyInserted(int line, int col, const QString &characters)
+{
+  if (CURRENT_VIEW && preferences.autoBlocks && !characters.compare("{")
+      && col==CURRENT_VIEW->getDoc()->lineLength(line)-1) {
+    Kate::Document *doc=CURRENT_VIEW->getDoc();
+    QString fileText=doc->text();
+    // Only for C files.
+    if (isCFile) {
+      QString indent=doc->textLine(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*\\{$"))) {
+        indent=indent.remove('{');
+        QString cursorLine=indent+"\t";
+        KTextEditor::EditInterfaceExt *editExt=KTextEditor::editInterfaceExt(doc);
+        editExt->editBegin();
+        doc->insertLine(line+1,cursorLine);
+        doc->insertLine(line+2,indent+"}");
+        editExt->editEnd();
+        CURRENT_VIEW->setCursorPositionReal(line+1,cursorLine.length());
+      }
+    }
+  }
+}
+
+void SourceFileWindow::current_view_newLineHook()
+{
+  unsigned line,col;
+  CURRENT_VIEW->cursorPositionReal(&line,&col);
+  Kate::Document *doc=CURRENT_VIEW->getDoc();
+  if (preferences.autoBlocks && line && doc->textLine(line-1).endsWith("{")) {
+    QString fileText=doc->text();
+    // Only for C files.
+    if (isCFile) {
+      QString indent=doc->textLine(line-1);
+      // Remove everything starting from the first non-whitespace character.
+      indent=indent.remove(QRegExp("(?!\\s).*$"));
+      QString cursorLine=indent+"\t";
+      KTextEditor::EditInterfaceExt *editExt=KTextEditor::editInterfaceExt(doc);
+      editExt->editBegin();
+      doc->insertLine(line,cursorLine);
+      doc->insertText(line+1,0,indent+"}");
+      editExt->editEnd();
+      CURRENT_VIEW->setCursorPositionReal(line,cursorLine.length());
+    }
+  }
+}
+
+void SourceFileWindow::clipboard_dataChanged()
+{
+  if (CURRENT_VIEW) {
+    editPasteAction->setEnabled(!clipboard->text().isNull());
+    accel->setItemEnabled(4,!clipboard->text().isNull());
+  }
+}
+
+void SourceFileWindow::closeEvent(QCloseEvent *e)
+{
+  if (savePrompt())
+    e->ignore();
+  else
+    e->accept();
+}
+
+void SourceFileWindow::KDirWatch_dirty(const QString &fileName)
+{
+  if (KMessageBox::questionYesNo(this,
+        QString("The file \'%1\' has been changed by another program. "
+                "Do you want to reload it?").arg(fileName),"File Changed")
+        ==KMessageBox::Yes) {
+    QString fileText=loadFileText(fileName);
+    if (fileText.isNull()) {
+      KMessageBox::error(this,QString("Can't open \'%1\'").arg(fileName));
+      return;
+    }
+    CURRENT_VIEW->getDoc()->setText(fileText);
+    CURRENT_VIEW->getDoc()->setModified(FALSE);
+    CURRENT_VIEW->getDoc()->clearUndo();
+    CURRENT_VIEW->getDoc()->clearRedo();
+  }
+  return;
+}