00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "kateview.h"
00025 #include "kateview.moc"
00026
00027 #include "kateviewinternal.h"
00028 #include "kateviewhelpers.h"
00029 #include "katerenderer.h"
00030 #include "katedocument.h"
00031 #include "katedocumenthelpers.h"
00032 #include "katefactory.h"
00033 #include "katehighlight.h"
00034 #include "katedialogs.h"
00035 #include "katetextline.h"
00036 #include "katecodefoldinghelpers.h"
00037 #include "katecodecompletion.h"
00038 #include "katesearch.h"
00039 #include "kateschema.h"
00040 #include "katebookmarks.h"
00041 #include "katesearch.h"
00042 #include "kateconfig.h"
00043 #include "katefiletype.h"
00044
00045 #include <ktexteditor/plugin.h>
00046
00047 #include <kparts/event.h>
00048
00049 #include <kconfig.h>
00050 #include <kurldrag.h>
00051 #include <kdebug.h>
00052 #include <kapplication.h>
00053 #include <kcursor.h>
00054 #include <klocale.h>
00055 #include <kglobal.h>
00056 #include <kcharsets.h>
00057 #include <kmessagebox.h>
00058 #include <kaction.h>
00059 #include <kstdaction.h>
00060 #include <kxmlguifactory.h>
00061 #include <kaccel.h>
00062 #include <klibloader.h>
00063 #include <kencodingfiledialog.h>
00064
00065 #include <qfont.h>
00066 #include <qfileinfo.h>
00067 #include <qstyle.h>
00068 #include <qevent.h>
00069 #include <qpopupmenu.h>
00070 #include <qlayout.h>
00071 #include <qclipboard.h>
00072
00073
00074 KateView::KateView( KateDocument *doc, QWidget *parent, const char * name )
00075 : Kate::View( doc, parent, name )
00076 , m_doc( doc )
00077 , m_search( new KateSearch( this ) )
00078 , m_bookmarks( new KateBookmarks( this ) )
00079 , m_cmdLine (0)
00080 , m_cmdLineOn (false)
00081 , m_active( false )
00082 , m_hasWrap( false )
00083 , m_startingUp (true)
00084 , m_updatingDocumentConfig (false)
00085 {
00086 KateFactory::self()->registerView( this );
00087 m_config = new KateViewConfig (this);
00088
00089 m_renderer = new KateRenderer(doc, this);
00090
00091 m_grid = new QGridLayout (this, 3, 3);
00092
00093 m_grid->setRowStretch ( 0, 10 );
00094 m_grid->setRowStretch ( 1, 0 );
00095 m_grid->setColStretch ( 0, 0 );
00096 m_grid->setColStretch ( 1, 10 );
00097 m_grid->setColStretch ( 2, 0 );
00098
00099 m_viewInternal = new KateViewInternal( this, doc );
00100 m_grid->addWidget (m_viewInternal, 0, 1);
00101
00102 setClipboardInterfaceDCOPSuffix (viewDCOPSuffix());
00103 setCodeCompletionInterfaceDCOPSuffix (viewDCOPSuffix());
00104 setDynWordWrapInterfaceDCOPSuffix (viewDCOPSuffix());
00105 setPopupMenuInterfaceDCOPSuffix (viewDCOPSuffix());
00106 setSessionConfigInterfaceDCOPSuffix (viewDCOPSuffix());
00107 setViewCursorInterfaceDCOPSuffix (viewDCOPSuffix());
00108 setViewStatusMsgInterfaceDCOPSuffix (viewDCOPSuffix());
00109
00110 setInstance( KateFactory::self()->instance() );
00111 doc->addView( this );
00112
00113 setFocusProxy( m_viewInternal );
00114 setFocusPolicy( StrongFocus );
00115
00116 if (!doc->singleViewMode()) {
00117 setXMLFile( "katepartui.rc" );
00118 } else {
00119 if( doc->readOnly() )
00120 setXMLFile( "katepartreadonlyui.rc" );
00121 else
00122 setXMLFile( "katepartui.rc" );
00123 }
00124
00125 setupConnections();
00126 setupActions();
00127 setupEditActions();
00128 setupCodeFolding();
00129 setupCodeCompletion();
00130
00131
00132 m_doc->enableAllPluginsGUI (this);
00133
00134
00135 slotNewUndo();
00136
00137 m_startingUp = false;
00138 updateConfig ();
00139
00140 m_viewInternal->show ();
00141 slotHlChanged();
00142
00143
00144
00145
00146
00147 }
00148
00149 KateView::~KateView()
00150 {
00151 if (!m_doc->singleViewMode())
00152 m_doc->disableAllPluginsGUI (this);
00153
00154 m_doc->removeView( this );
00155
00156 delete m_viewInternal;
00157 delete m_codeCompletion;
00158
00159 delete m_renderer;
00160
00161 delete m_config;
00162 KateFactory::self()->deregisterView (this);
00163 }
00164
00165 void KateView::setupConnections()
00166 {
00167 connect( m_doc, SIGNAL(undoChanged()),
00168 this, SLOT(slotNewUndo()) );
00169 connect( m_doc, SIGNAL(hlChanged()),
00170 this, SLOT(slotHlChanged()) );
00171 connect( m_doc, SIGNAL(canceled(const QString&)),
00172 this, SLOT(slotSaveCanceled(const QString&)) );
00173 connect( m_viewInternal, SIGNAL(dropEventPass(QDropEvent*)),
00174 this, SIGNAL(dropEventPass(QDropEvent*)) );
00175 connect(this,SIGNAL(cursorPositionChanged()),this,SLOT(slotStatusMsg()));
00176 connect(this,SIGNAL(newStatus()),this,SLOT(slotStatusMsg()));
00177 connect(m_doc, SIGNAL(undoChanged()), this, SLOT(slotStatusMsg()));
00178
00179 if ( m_doc->browserView() )
00180 {
00181 connect( this, SIGNAL(dropEventPass(QDropEvent*)),
00182 this, SLOT(slotDropEventPass(QDropEvent*)) );
00183 }
00184 }
00185
00186 void KateView::setupActions()
00187 {
00188 KActionCollection *ac = this->actionCollection ();
00189 KAction *a;
00190
00191 m_toggleWriteLock = 0;
00192
00193 m_cut = a=KStdAction::cut(this, SLOT(cut()), ac);
00194 a->setWhatsThis(i18n("Cut the selected text and move it to the clipboard"));
00195
00196 m_paste = a=KStdAction::pasteText(this, SLOT(paste()), ac);
00197 a->setWhatsThis(i18n("Paste previously copied or cut clipboard contents"));
00198
00199 m_copy = a=KStdAction::copy(this, SLOT(copy()), ac);
00200 a->setWhatsThis(i18n( "Use this command to copy the currently selected text to the system clipboard."));
00201
00202
00203 if (!m_doc->readOnly())
00204 {
00205 KStdAction::spelling( m_doc, SLOT(spellcheck()), ac );
00206
00207 a=KStdAction::save(this, SLOT(save()), ac);
00208 a->setWhatsThis(i18n("Save the current document"));
00209
00210 a=m_editUndo = KStdAction::undo(m_doc, SLOT(undo()), ac);
00211 a->setWhatsThis(i18n("Revert the most recent editing actions"));
00212
00213 a=m_editRedo = KStdAction::redo(m_doc, SLOT(redo()), ac);
00214 a->setWhatsThis(i18n("Revert the most recent undo operation"));
00215
00216 (new KAction(i18n("&Word Wrap Document"), "", 0, m_doc, SLOT(applyWordWrap()), ac, "tools_apply_wordwrap"))->setWhatsThis(
00217 i18n("Use this command to wrap all lines of the current document which are longer than the width of the"
00218 " current view, to fit into this view.<br><br> This is a static word wrap, meaning it is not updated"
00219 " when the view is resized."));
00220
00221
00222 a=new KAction(i18n("&Indent"), "indent", Qt::CTRL+Qt::Key_I, this, SLOT(indent()), ac, "tools_indent");
00223 a->setWhatsThis(i18n("Use this to indent a selected block of text.<br><br>"
00224 "You can configure whether tabs should be honored and used or replaced with spaces, in the configuration dialog."));
00225 a=new KAction(i18n("&Unindent"), "unindent", Qt::CTRL+Qt::SHIFT+Qt::Key_I, this, SLOT(unIndent()), ac, "tools_unindent");
00226 a->setWhatsThis(i18n("Use this to unindent a selected block of text."));
00227
00228 a=new KAction(i18n("&Clean Indentation"), 0, this, SLOT(cleanIndent()), ac, "tools_cleanIndent");
00229 a->setWhatsThis(i18n("Use this to clean the indentation of a selected block of text (only tabs/only spaces)<br><br>"
00230 "You can configure whether tabs should be honored and used or replaced with spaces, in the configuration dialog."));
00231
00232 a=new KAction(i18n("&Align"), CTRL+Qt::Key_Tab, this, SLOT(align()), ac, "tools_align");
00233 a->setWhatsThis(i18n("Use this to align the current line or block of text to its proper indent level."));
00234
00235 a=new KAction(i18n("C&omment"), CTRL+Qt::Key_D, this, SLOT(comment()),
00236 ac, "tools_comment");
00237 a->setWhatsThis(i18n("This command comments out the current line or a selected block of text.<BR><BR>"
00238 "The characters for single/multiple line comments are defined within the language's highlighting."));
00239
00240 a=new KAction(i18n("Unco&mment"), CTRL+SHIFT+Qt::Key_D, this, SLOT(uncomment()),
00241 ac, "tools_uncomment");
00242 a->setWhatsThis(i18n("This command removes comments from the current line or a selected block of text.<BR><BR>"
00243 "The characters for single/multiple line comments are defined within the language's highlighting."));
00244 a = m_toggleWriteLock = new KToggleAction(
00245 i18n("&Read Only Mode"), 0, 0,
00246 this, SLOT( toggleWriteLock() ),
00247 ac, "tools_toggle_write_lock" );
00248 a->setWhatsThis( i18n("Lock/unlock the document for writing") );
00249
00250 a = new KAction( i18n("Uppercase"), CTRL + Qt::Key_U, this,
00251 SLOT(uppercase()), ac, "tools_uppercase" );
00252 a->setWhatsThis( i18n("Convert the selection to uppercase, or the character to the "
00253 "right of the cursor if no text is selected.") );
00254
00255 a = new KAction( i18n("Lowercase"), CTRL + SHIFT + Qt::Key_U, this,
00256 SLOT(lowercase()), ac, "tools_lowercase" );
00257 a->setWhatsThis( i18n("Convert the selection to lowercase, or the character to the "
00258 "right of the cursor if no text is selected.") );
00259
00260 a = new KAction( i18n("Capitalize"), CTRL + ALT + Qt::Key_U, this,
00261 SLOT(capitalize()), ac, "tools_capitalize" );
00262 a->setWhatsThis( i18n("Capitalize the selection, or the word under the "
00263 "cursor if no text is selected.") );
00264
00265 a = new KAction( i18n("Join Lines"), CTRL + Qt::Key_J, this,
00266 SLOT( joinLines() ), ac, "tools_join_lines" );
00267 }
00268 else
00269 {
00270 m_cut->setEnabled (false);
00271 m_paste->setEnabled (false);
00272 m_editUndo = 0;
00273 m_editRedo = 0;
00274 }
00275
00276 a=KStdAction::print( m_doc, SLOT(print()), ac );
00277 a->setWhatsThis(i18n("Print the current document."));
00278
00279 a=new KAction(i18n("Reloa&d"), "reload", KStdAccel::reload(), this, SLOT(reloadFile()), ac, "file_reload");
00280 a->setWhatsThis(i18n("Reload the current document from disk."));
00281
00282 a=KStdAction::saveAs(this, SLOT(saveAs()), ac);
00283 a->setWhatsThis(i18n("Save the current document to disk, with a name of your choice."));
00284
00285 a=KStdAction::gotoLine(this, SLOT(gotoLine()), ac);
00286 a->setWhatsThis(i18n("This command opens a dialog and lets you choose a line that you want the cursor to move to."));
00287
00288 a=new KAction(i18n("&Configure Editor..."), 0, m_doc, SLOT(configDialog()),ac, "set_confdlg");
00289 a->setWhatsThis(i18n("Configure various aspects of this editor."));
00290
00291 m_setHighlight = m_doc->hlActionMenu (i18n("&Highlight Mode"),ac,"set_highlight");
00292
00293 m_setFileType = new KateViewFileTypeAction (i18n("&Filetype Mode"),ac,"set_filetype");
00294 m_setFileType->updateMenu (m_doc);
00295
00296 m_schemaMenu = new KateViewSchemaAction (i18n("&Schema"),ac,"view_schemas");
00297 m_schemaMenu->updateMenu (this);
00298
00299 m_doc->exportActionMenu (i18n("E&xport"),ac,"file_export");
00300
00301 m_selectAll = a=KStdAction::selectAll(m_doc, SLOT(selectAll()), ac);
00302 a->setWhatsThis(i18n("Select the entire text of the current document."));
00303
00304 m_deSelect = a=KStdAction::deselect(m_doc, SLOT(clearSelection()), ac);
00305 a->setWhatsThis(i18n("If you have selected something within the current document, this will no longer be selected."));
00306
00307 a=new KAction(i18n("Increase Font Sizes"), "viewmag+", 0, m_viewInternal, SLOT(slotIncFontSizes()), ac, "incFontSizes");
00308 a->setWhatsThis(i18n("This increases the display font size."));
00309
00310 a=new KAction(i18n("Decrease Font Sizes"), "viewmag-", 0, m_viewInternal, SLOT(slotDecFontSizes()), ac, "decFontSizes");
00311 a->setWhatsThis(i18n("This decreases the display font size."));
00312
00313 a= m_toggleBlockSelection = new KToggleAction(
00314 i18n("Bl&ock Selection Mode"), CTRL + SHIFT + Key_B,
00315 this, SLOT(toggleBlockSelectionMode()),
00316 ac, "set_verticalSelect");
00317 a->setWhatsThis(i18n("This command allows switching between the normal (line based) selection mode and the block selection mode."));
00318
00319 a= m_toggleInsert = new KToggleAction(
00320 i18n("Overwr&ite Mode"), Key_Insert,
00321 this, SLOT(toggleInsert()),
00322 ac, "set_insert" );
00323 a->setWhatsThis(i18n("Choose whether you want the text you type to be inserted or to overwrite existing text."));
00324
00325 KToggleAction *toggleAction;
00326 a= m_toggleDynWrap = toggleAction = new KToggleAction(
00327 i18n("&Dynamic Word Wrap"), Key_F10,
00328 this, SLOT(toggleDynWordWrap()),
00329 ac, "view_dynamic_word_wrap" );
00330 a->setWhatsThis(i18n("If this option is checked, the text lines will be wrapped at the view border on the screen."));
00331
00332 a= m_setDynWrapIndicators = new KSelectAction(i18n("Dynamic Word Wrap Indicators"), 0, ac, "dynamic_word_wrap_indicators");
00333 a->setWhatsThis(i18n("Choose when the Dynamic Word Wrap Indicators should be displayed"));
00334
00335 connect(m_setDynWrapIndicators, SIGNAL(activated(int)), this, SLOT(setDynWrapIndicators(int)));
00336 QStringList list2;
00337 list2.append(i18n("&Off"));
00338 list2.append(i18n("Follow &Line Numbers"));
00339 list2.append(i18n("&Always On"));
00340 m_setDynWrapIndicators->setItems(list2);
00341
00342 a= toggleAction=m_toggleFoldingMarkers = new KToggleAction(
00343 i18n("Show Folding &Markers"), Key_F9,
00344 this, SLOT(toggleFoldingMarkers()),
00345 ac, "view_folding_markers" );
00346 a->setWhatsThis(i18n("You can choose if the codefolding marks should be shown, if codefolding is possible."));
00347 toggleAction->setCheckedState(i18n("Hide Folding &Markers"));
00348
00349 a= m_toggleIconBar = toggleAction = new KToggleAction(
00350 i18n("Show &Icon Border"), Key_F6,
00351 this, SLOT(toggleIconBorder()),
00352 ac, "view_border");
00353 a=toggleAction;
00354 a->setWhatsThis(i18n("Show/hide the icon border.<BR><BR> The icon border shows bookmark symbols, for instance."));
00355 toggleAction->setCheckedState(i18n("Hide &Icon Border"));
00356
00357 a= toggleAction=m_toggleLineNumbers = new KToggleAction(
00358 i18n("Show &Line Numbers"), Key_F11,
00359 this, SLOT(toggleLineNumbersOn()),
00360 ac, "view_line_numbers" );
00361 a->setWhatsThis(i18n("Show/hide the line numbers on the left hand side of the view."));
00362 toggleAction->setCheckedState(i18n("Hide &Line Numbers"));
00363
00364 a= m_toggleScrollBarMarks = toggleAction = new KToggleAction(
00365 i18n("Show Scroll&bar Marks"), 0,
00366 this, SLOT(toggleScrollBarMarks()),
00367 ac, "view_scrollbar_marks");
00368 a->setWhatsThis(i18n("Show/hide the marks on the vertical scrollbar.<BR><BR>The marks, for instance, show bookmarks."));
00369 toggleAction->setCheckedState(i18n("Hide Scroll&bar Marks"));
00370
00371 a = toggleAction = m_toggleWWMarker = new KToggleAction(
00372 i18n("Show Static &Word Wrap Marker"), 0,
00373 this, SLOT( toggleWWMarker() ),
00374 ac, "view_word_wrap_marker" );
00375 a->setWhatsThis( i18n(
00376 "Show/hide the Word Wrap Marker, a vertical line drawn at the word "
00377 "wrap column as defined in the editing properties" ));
00378 toggleAction->setCheckedState(i18n("Hide Static &Word Wrap Marker"));
00379
00380 a= m_switchCmdLine = new KAction(
00381 i18n("Switch to Command Line"), Key_F7,
00382 this, SLOT(switchToCmdLine()),
00383 ac, "switch_to_cmd_line" );
00384 a->setWhatsThis(i18n("Show/hide the command line on the bottom of the view."));
00385
00386 a=m_setEndOfLine = new KSelectAction(i18n("&End of Line"), 0, ac, "set_eol");
00387 a->setWhatsThis(i18n("Choose which line endings should be used, when you save the document"));
00388 QStringList list;
00389 list.append("&UNIX");
00390 list.append("&Windows/DOS");
00391 list.append("&Macintosh");
00392 m_setEndOfLine->setItems(list);
00393 m_setEndOfLine->setCurrentItem (m_doc->config()->eol());
00394 connect(m_setEndOfLine, SIGNAL(activated(int)), this, SLOT(setEol(int)));
00395
00396
00397 m_setEncoding = new KSelectAction(i18n("Set &Encoding"), 0, ac, "set_encoding");
00398 list = KGlobal::charsets()->descriptiveEncodingNames();
00399 list.prepend( i18n( "Auto" ) );
00400 m_setEncoding->setItems(list);
00401 m_setEncoding->setCurrentItem (0);
00402 connect(m_setEncoding, SIGNAL(activated(const QString&)), this, SLOT(slotSetEncoding(const QString&)));
00403
00404 m_search->createActions( ac );
00405 m_bookmarks->createActions( ac );
00406
00407 selectionChanged ();
00408
00409 connect (m_doc, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
00410 }
00411
00412 void KateView::setupEditActions()
00413 {
00414 m_editActions = new KActionCollection( m_viewInternal, this, "edit_actions" );
00415 KActionCollection* ac = m_editActions;
00416
00417 new KAction(
00418 i18n("Move Word Left"), CTRL + Key_Left,
00419 this,SLOT(wordLeft()),
00420 ac, "word_left" );
00421 new KAction(
00422 i18n("Select Character Left"), SHIFT + Key_Left,
00423 this,SLOT(shiftCursorLeft()),
00424 ac, "select_char_left" );
00425 new KAction(
00426 i18n("Select Word Left"), SHIFT + CTRL + Key_Left,
00427 this, SLOT(shiftWordLeft()),
00428 ac, "select_word_left" );
00429
00430 new KAction(
00431 i18n("Move Word Right"), CTRL + Key_Right,
00432 this, SLOT(wordRight()),
00433 ac, "word_right" );
00434 new KAction(
00435 i18n("Select Character Right"), SHIFT + Key_Right,
00436 this, SLOT(shiftCursorRight()),
00437 ac, "select_char_right" );
00438 new KAction(
00439 i18n("Select Word Right"), SHIFT + CTRL + Key_Right,
00440 this,SLOT(shiftWordRight()),
00441 ac, "select_word_right" );
00442
00443 new KAction(
00444 i18n("Move to Beginning of Line"), Key_Home,
00445 this, SLOT(home()),
00446 ac, "beginning_of_line" );
00447 new KAction(
00448 i18n("Move to Beginning of Document"), CTRL + Key_Home,
00449 this, SLOT(top()),
00450 ac, "beginning_of_document" );
00451 new KAction(
00452 i18n("Select to Beginning of Line"), SHIFT + Key_Home,
00453 this, SLOT(shiftHome()),
00454 ac, "select_beginning_of_line" );
00455 new KAction(
00456 i18n("Select to Beginning of Document"), SHIFT + CTRL + Key_Home,
00457 this, SLOT(shiftTop()),
00458 ac, "select_beginning_of_document" );
00459
00460 new KAction(
00461 i18n("Move to End of Line"), Key_End,
00462 this, SLOT(end()),
00463 ac, "end_of_line" );
00464 new KAction(
00465 i18n("Move to End of Document"), CTRL + Key_End,
00466 this, SLOT(bottom()),
00467 ac, "end_of_document" );
00468 new KAction(
00469 i18n("Select to End of Line"), SHIFT + Key_End,
00470 this, SLOT(shiftEnd()),
00471 ac, "select_end_of_line" );
00472 new KAction(
00473 i18n("Select to End of Document"), SHIFT + CTRL + Key_End,
00474 this, SLOT(shiftBottom()),
00475 ac, "select_end_of_document" );
00476
00477 new KAction(
00478 i18n("Select to Previous Line"), SHIFT + Key_Up,
00479 this, SLOT(shiftUp()),
00480 ac, "select_line_up" );
00481 new KAction(
00482 i18n("Scroll Line Up"),"", CTRL + Key_Up,
00483 this, SLOT(scrollUp()),
00484 ac, "scroll_line_up" );
00485
00486 new KAction(
00487 i18n("Select to Next Line"), SHIFT + Key_Down,
00488 this, SLOT(shiftDown()),
00489 ac, "select_line_down" );
00490 new KAction(
00491 i18n("Scroll Line Down"), CTRL + Key_Down,
00492 this, SLOT(scrollDown()),
00493 ac, "scroll_line_down" );
00494
00495 new KAction(
00496 i18n("Scroll Page Up"), Key_PageUp,
00497 this, SLOT(pageUp()),
00498 ac, "scroll_page_up" );
00499 new KAction(
00500 i18n("Select Page Up"), SHIFT + Key_PageUp,
00501 this, SLOT(shiftPageUp()),
00502 ac, "select_page_up" );
00503 new KAction(
00504 i18n("Move to Top of View"), CTRL + Key_PageUp,
00505 this, SLOT(topOfView()),
00506 ac, "move_top_of_view" );
00507 new KAction(
00508 i18n("Select to Top of View"), CTRL + SHIFT + Key_PageUp,
00509 this, SLOT(shiftTopOfView()),
00510 ac, "select_top_of_view" );
00511
00512 new KAction(
00513 i18n("Scroll Page Down"), Key_PageDown,
00514 this, SLOT(pageDown()),
00515 ac, "scroll_page_down" );
00516 new KAction(
00517 i18n("Select Page Down"), SHIFT + Key_PageDown,
00518 this, SLOT(shiftPageDown()),
00519 ac, "select_page_down" );
00520 new KAction(
00521 i18n("Move to Bottom of View"), CTRL + Key_PageDown,
00522 this, SLOT(bottomOfView()),
00523 ac, "move_bottom_of_view" );
00524 new KAction(
00525 i18n("Select to Bottom of View"), CTRL + SHIFT + Key_PageDown,
00526 this, SLOT(shiftBottomOfView()),
00527 ac, "select_bottom_of_view" );
00528 new KAction(
00529 i18n("Move to Matching Bracket"), CTRL + Key_6,
00530 this, SLOT(toMatchingBracket()),
00531 ac, "to_matching_bracket" );
00532 new KAction(
00533 i18n("Select to Matching Bracket"), SHIFT + CTRL + Key_6,
00534 this, SLOT(shiftToMatchingBracket()),
00535 ac, "select_matching_bracket" );
00536
00537
00538
00539
00540
00541
00542
00543
00544 if ( !m_doc->readOnly() )
00545 {
00546 new KAction(
00547 i18n("Transpose Characters"), CTRL + Key_T,
00548 this, SLOT(transpose()),
00549 ac, "transpose_char" );
00550
00551 new KAction(
00552 i18n("Delete Line"), CTRL + Key_K,
00553 this, SLOT(killLine()),
00554 ac, "delete_line" );
00555
00556 new KAction(
00557 i18n("Delete Word Left"), CTRL + Key_Backspace,
00558 this, SLOT(deleteWordLeft()),
00559 ac, "delete_word_left" );
00560
00561 new KAction(
00562 i18n("Delete Word Right"), CTRL + Key_Delete,
00563 this, SLOT(deleteWordRight()),
00564 ac, "delete_word_right" );
00565 }
00566
00567 connect( this, SIGNAL(gotFocus(Kate::View*)),
00568 this, SLOT(slotGotFocus()) );
00569 connect( this, SIGNAL(lostFocus(Kate::View*)),
00570 this, SLOT(slotLostFocus()) );
00571
00572 m_editActions->readShortcutSettings( "Katepart Shortcuts" );
00573
00574 if( hasFocus() )
00575 slotGotFocus();
00576 else
00577 slotLostFocus();
00578
00579
00580 }
00581
00582 void KateView::setupCodeFolding()
00583 {
00584 KActionCollection *ac=this->actionCollection();
00585 new KAction( i18n("Collapse Toplevel"), CTRL+SHIFT+Key_Minus,
00586 m_doc->foldingTree(),SLOT(collapseToplevelNodes()),ac,"folding_toplevel");
00587 new KAction( i18n("Expand Toplevel"), CTRL+SHIFT+Key_Plus,
00588 this,SLOT(slotExpandToplevel()),ac,"folding_expandtoplevel");
00589 new KAction( i18n("Collapse One Local Level"), CTRL+Key_Minus,
00590 this,SLOT(slotCollapseLocal()),ac,"folding_collapselocal");
00591 new KAction( i18n("Expand One Local Level"), CTRL+Key_Plus,
00592 this,SLOT(slotExpandLocal()),ac,"folding_expandlocal");
00593
00594 KAccel* debugAccels = new KAccel(this,this);
00595 debugAccels->insert("KATE_DUMP_REGION_TREE",i18n("Show the code folding region tree"),"","Ctrl+Shift+Alt+D",m_doc,SLOT(dumpRegionTree()));
00596 debugAccels->setEnabled(true);
00597 }
00598
00599 void KateView::slotExpandToplevel()
00600 {
00601 m_doc->foldingTree()->expandToplevelNodes(m_doc->numLines());
00602 }
00603
00604 void KateView::slotCollapseLocal()
00605 {
00606 int realLine = m_doc->foldingTree()->collapseOne(cursorLine());
00607 if (realLine != -1)
00608
00609
00610 setCursorPositionInternal(realLine, cursorColumn(), tabWidth(), false);
00611 }
00612
00613 void KateView::slotExpandLocal()
00614 {
00615 m_doc->foldingTree()->expandOne(cursorLine(), m_doc->numLines());
00616 }
00617
00618 void KateView::setupCodeCompletion()
00619 {
00620 m_codeCompletion = new KateCodeCompletion(this);
00621 connect( m_codeCompletion, SIGNAL(completionAborted()),
00622 this, SIGNAL(completionAborted()));
00623 connect( m_codeCompletion, SIGNAL(completionDone()),
00624 this, SIGNAL(completionDone()));
00625 connect( m_codeCompletion, SIGNAL(argHintHidden()),
00626 this, SIGNAL(argHintHidden()));
00627 connect( m_codeCompletion, SIGNAL(completionDone(KTextEditor::CompletionEntry)),
00628 this, SIGNAL(completionDone(KTextEditor::CompletionEntry)));
00629 connect( m_codeCompletion, SIGNAL(filterInsertString(KTextEditor::CompletionEntry*,QString*)),
00630 this, SIGNAL(filterInsertString(KTextEditor::CompletionEntry*,QString*)));
00631 }
00632
00633 void KateView::slotGotFocus()
00634 {
00635 m_editActions->accel()->setEnabled( true );
00636
00637 slotStatusMsg ();
00638 }
00639
00640 void KateView::slotLostFocus()
00641 {
00642 m_editActions->accel()->setEnabled( false );
00643 }
00644
00645 void KateView::setDynWrapIndicators(int mode)
00646 {
00647 config()->setDynWordWrapIndicators (mode);
00648 }
00649
00650 void KateView::slotStatusMsg ()
00651 {
00652 QString ovrstr;
00653 if (m_doc->isReadWrite())
00654 {
00655 if (m_doc->config()->configFlags() & KateDocument::cfOvr)
00656 ovrstr = i18n(" OVR ");
00657 else
00658 ovrstr = i18n(" INS ");
00659 }
00660 else
00661 ovrstr = i18n(" R/O ");
00662
00663 uint r = cursorLine() + 1;
00664 uint c = cursorColumn() + 1;
00665
00666 QString s1 = i18n(" Line: %1").arg(KGlobal::locale()->formatNumber(r, 0));
00667 QString s2 = i18n(" Col: %1").arg(KGlobal::locale()->formatNumber(c, 0));
00668
00669 QString modstr = m_doc->isModified() ? QString (" * ") : QString (" ");
00670 QString blockstr = m_doc->blockSelectionMode() ? i18n(" BLK ") : i18n(" NORM ");
00671
00672 emit viewStatusMsg (s1 + s2 + " " + ovrstr + blockstr + modstr);
00673 }
00674
00675 void KateView::slotSelectionTypeChanged()
00676 {
00677 m_toggleBlockSelection->setChecked( m_doc->blockSelectionMode() );
00678
00679 emit newStatus();
00680 }
00681
00682 bool KateView::isOverwriteMode() const
00683 {
00684 return m_doc->config()->configFlags() & KateDocument::cfOvr;
00685 }
00686
00687 void KateView::reloadFile()
00688 {
00689
00690 uint cl = cursorLine();
00691 uint cc = cursorColumn();
00692
00693
00694 m_doc->reloadFile();
00695
00696 if (m_doc->numLines() >= cl)
00697
00698 setCursorPositionInternal( cl, cc, tabWidth(), false );
00699
00700 emit newStatus();
00701 }
00702
00703 void KateView::slotUpdate()
00704 {
00705 emit newStatus();
00706
00707 slotNewUndo();
00708 }
00709
00710 void KateView::slotReadWriteChanged ()
00711 {
00712 if ( m_toggleWriteLock )
00713 m_toggleWriteLock->setChecked( ! m_doc->isReadWrite() );
00714
00715 m_cut->setEnabled (m_doc->isReadWrite());
00716 m_paste->setEnabled (m_doc->isReadWrite());
00717
00718 QStringList l;
00719
00720 l << "edit_replace" << "set_insert" << "tools_spelling" << "tools_indent"
00721 << "tools_unindent" << "tools_cleanIndent" << "tools_align" << "tools_comment"
00722 << "tools_uncomment" << "tools_uppercase" << "tools_lowercase"
00723 << "tools_capitalize" << "tools_join_lines" << "tools_apply_wordwrap"
00724 << "edit_undo" << "edit_redo";
00725
00726 KAction *a = 0;
00727 for (uint z = 0; z < l.size(); z++)
00728 if ((a = actionCollection()->action( l[z].ascii() )))
00729 a->setEnabled (m_doc->isReadWrite());
00730 }
00731
00732 void KateView::slotNewUndo()
00733 {
00734 if (m_doc->readOnly())
00735 return;
00736
00737 if ((m_doc->undoCount() > 0) != m_editUndo->isEnabled())
00738 m_editUndo->setEnabled(m_doc->undoCount() > 0);
00739
00740 if ((m_doc->redoCount() > 0) != m_editRedo->isEnabled())
00741 m_editRedo->setEnabled(m_doc->redoCount() > 0);
00742 }
00743
00744 void KateView::slotDropEventPass( QDropEvent * ev )
00745 {
00746 KURL::List lstDragURLs;
00747 bool ok = KURLDrag::decode( ev, lstDragURLs );
00748
00749 KParts::BrowserExtension * ext = KParts::BrowserExtension::childObject( doc() );
00750 if ( ok && ext )
00751 emit ext->openURLRequest( lstDragURLs.first() );
00752 }
00753
00754 void KateView::contextMenuEvent( QContextMenuEvent *ev )
00755 {
00756 if ( !m_doc || !m_doc->browserExtension() )
00757 return;
00758
00759 emit m_doc->browserExtension()->popupMenu( ev->globalPos(), m_doc->url(),
00760 QString::fromLatin1( "text/plain" ) );
00761 ev->accept();
00762 }
00763
00764 bool KateView::setCursorPositionInternal( uint line, uint col, uint tabwidth, bool calledExternally )
00765 {
00766 KateTextLine::Ptr l = m_doc->kateTextLine( line );
00767
00768 if (!l)
00769 return false;
00770
00771 QString line_str = m_doc->textLine( line );
00772
00773 uint z;
00774 uint x = 0;
00775 for (z = 0; z < line_str.length() && z < col; z++) {
00776 if (line_str[z] == QChar('\t')) x += tabwidth - (x % tabwidth); else x++;
00777 }
00778
00779 m_viewInternal->updateCursor( KateTextCursor( line, x ), false, true, calledExternally );
00780
00781 return true;
00782 }
00783
00784 void KateView::toggleBlockSelectionMode()
00785 {
00786 m_doc->toggleBlockSelectionMode();
00787 m_toggleBlockSelection->setChecked (m_doc->blockSelectionMode());
00788 }
00789
00790 void KateView::setOverwriteMode( bool b )
00791 {
00792 if ( isOverwriteMode() && !b )
00793 m_doc->setConfigFlags( m_doc->config()->configFlags() ^ KateDocument::cfOvr );
00794 else
00795 m_doc->setConfigFlags( m_doc->config()->configFlags() | KateDocument::cfOvr );
00796
00797 m_toggleInsert->setChecked (isOverwriteMode ());
00798 }
00799
00800 void KateView::toggleInsert()
00801 {
00802 m_doc->setConfigFlags(m_doc->config()->configFlags() ^ KateDocument::cfOvr);
00803 m_toggleInsert->setChecked (isOverwriteMode ());
00804
00805 emit newStatus();
00806 }
00807
00808 bool KateView::canDiscard()
00809 {
00810 return m_doc->closeURL();
00811 }
00812
00813 void KateView::flush()
00814 {
00815 m_doc->closeURL();
00816 }
00817
00818 KateView::saveResult KateView::save()
00819 {
00820 if( !m_doc->url().isValid() || !doc()->isReadWrite() )
00821 return saveAs();
00822
00823 if( m_doc->save() )
00824 return SAVE_OK;
00825
00826 return SAVE_ERROR;
00827 }
00828
00829 KateView::saveResult KateView::saveAs()
00830 {
00831
00832 KEncodingFileDialog::Result res=KEncodingFileDialog::getSaveURLAndEncoding(doc()->config()->encoding(),
00833 m_doc->url().url(),QString::null,this,i18n("Save File"));
00834
00835 kdDebug()<<"urllist is emtpy?"<<res.URLs.isEmpty()<<endl;
00836 kdDebug()<<"url is:"<<res.URLs.first()<<endl;
00837 if( res.URLs.isEmpty() || !checkOverwrite( res.URLs.first() ) )
00838 return SAVE_CANCEL;
00839
00840 m_doc->setEncoding( res.encoding );
00841
00842 if( m_doc->saveAs( res.URLs.first() ) )
00843 return SAVE_OK;
00844
00845 return SAVE_ERROR;
00846 }
00847
00848 bool KateView::checkOverwrite( KURL u )
00849 {
00850 if( !u.isLocalFile() )
00851 return true;
00852
00853 QFileInfo info( u.path() );
00854 if( !info.exists() )
00855 return true;
00856
00857 return KMessageBox::Yes == KMessageBox::warningYesNo( this,
00858 i18n( "A file named \"%1\" already exists. "
00859 "Are you sure you want to overwrite it?" ).arg( info.fileName() ),
00860 i18n( "Overwrite File?" ),
00861 KGuiItem( i18n( "&Overwrite" ), "filesave" ) );
00862 }
00863
00864 void KateView::slotSaveCanceled( const QString& error )
00865 {
00866 if ( !error.isEmpty() )
00867 KMessageBox::error( this, error );
00868 }
00869
00870 void KateView::gotoLine()
00871 {
00872 KateGotoLineDialog *dlg = new KateGotoLineDialog (this, m_viewInternal->getCursor().line() + 1, m_doc->numLines());
00873
00874 if (dlg->exec() == QDialog::Accepted)
00875 gotoLineNumber( dlg->getLine() - 1 );
00876
00877 delete dlg;
00878 }
00879
00880 void KateView::gotoLineNumber( int line )
00881 {
00882
00883 if ( ! (m_doc->config()->configFlags() & KateDocumentConfig::cfPersistent) )
00884 m_doc->clearSelection();
00885
00886 setCursorPositionInternal ( line, 0, 1 );
00887 }
00888
00889 void KateView::joinLines()
00890 {
00891 int first = m_doc->selStartLine();
00892 int last = m_doc->selEndLine();
00893
00894 if ( first == last )
00895 {
00896 first = cursorLine();
00897 last = first + 1;
00898 }
00899 m_doc->joinLines( first, last );
00900 }
00901
00902 void KateView::readSessionConfig(KConfig *config)
00903 {
00904 setCursorPositionInternal (config->readNumEntry("CursorLine"), config->readNumEntry("CursorColumn"), 1);
00905 }
00906
00907 void KateView::writeSessionConfig(KConfig *config)
00908 {
00909 config->writeEntry("CursorLine",m_viewInternal->cursor.line());
00910 config->writeEntry("CursorColumn",m_viewInternal->cursor.col());
00911 }
00912
00913 int KateView::getEol()
00914 {
00915 return m_doc->config()->eol();
00916 }
00917
00918 void KateView::setEol(int eol)
00919 {
00920 if (!doc()->isReadWrite())
00921 return;
00922
00923 if (m_updatingDocumentConfig)
00924 return;
00925
00926 m_doc->config()->setEol (eol);
00927 }
00928
00929 void KateView::slotSetEncoding( const QString& descriptiveName )
00930 {
00931 setEncoding( KGlobal::charsets()->encodingForName( descriptiveName ) );
00932 reloadFile();
00933 }
00934
00935 void KateView::setIconBorder( bool enable )
00936 {
00937 config()->setIconBar (enable);
00938 }
00939
00940 void KateView::toggleIconBorder()
00941 {
00942 config()->setIconBar (!config()->iconBar());
00943 }
00944
00945 void KateView::setLineNumbersOn( bool enable )
00946 {
00947 config()->setLineNumbers (enable);
00948 }
00949
00950 void KateView::toggleLineNumbersOn()
00951 {
00952 config()->setLineNumbers (!config()->lineNumbers());
00953 }
00954
00955 void KateView::setScrollBarMarks( bool enable )
00956 {
00957 config()->setScrollBarMarks (enable);
00958 }
00959
00960 void KateView::toggleScrollBarMarks()
00961 {
00962 config()->setScrollBarMarks (!config()->scrollBarMarks());
00963 }
00964
00965 void KateView::toggleDynWordWrap()
00966 {
00967 config()->setDynWordWrap( !config()->dynWordWrap() );
00968 }
00969
00970 void KateView::setDynWordWrap( bool b )
00971 {
00972 config()->setDynWordWrap( b );
00973 }
00974
00975 void KateView::toggleWWMarker()
00976 {
00977 m_renderer->config()->setWordWrapMarker (!m_renderer->config()->wordWrapMarker());
00978 }
00979
00980 void KateView::setFoldingMarkersOn( bool enable )
00981 {
00982 config()->setFoldingBar ( enable );
00983 }
00984
00985 void KateView::toggleFoldingMarkers()
00986 {
00987 config()->setFoldingBar ( !config()->foldingBar() );
00988 }
00989
00990 bool KateView::iconBorder() {
00991 return m_viewInternal->leftBorder->iconBorderOn();
00992 }
00993
00994 bool KateView::lineNumbersOn() {
00995 return m_viewInternal->leftBorder->lineNumbersOn();
00996 }
00997
00998 bool KateView::scrollBarMarks() {
00999 return m_viewInternal->m_lineScroll->showMarks();
01000 }
01001
01002 int KateView::dynWrapIndicators() {
01003 return m_viewInternal->leftBorder->dynWrapIndicators();
01004 }
01005
01006 bool KateView::foldingMarkersOn() {
01007 return m_viewInternal->leftBorder->foldingMarkersOn();
01008 }
01009
01010 void KateView::showCmdLine ( bool enabled )
01011 {
01012 if (enabled == m_cmdLineOn)
01013 return;
01014
01015 if (enabled)
01016 {
01017 if (!m_cmdLine)
01018 {
01019 m_cmdLine = new KateCmdLine (this);
01020 m_grid->addMultiCellWidget (m_cmdLine, 2, 2, 0, 2);
01021 }
01022
01023 m_cmdLine->show ();
01024 m_cmdLine->setFocus();
01025 }
01026 else {
01027 m_cmdLine->hide ();
01028
01029 }
01030
01031 m_cmdLineOn = enabled;
01032 }
01033
01034 void KateView::toggleCmdLine ()
01035 {
01036 m_config->setCmdLine (!m_config->cmdLine ());
01037 }
01038
01039 void KateView::toggleWriteLock()
01040 {
01041 m_doc->setReadWrite( ! m_doc->isReadWrite() );
01042 }
01043
01044 void KateView::enableTextHints(int timeout)
01045 {
01046 m_viewInternal->enableTextHints(timeout);
01047 }
01048
01049 void KateView::disableTextHints()
01050 {
01051 m_viewInternal->disableTextHints();
01052 }
01053
01054 void KateView::slotNeedTextHint(int line, int col, QString &text)
01055 {
01056 text=QString("test %1 %2").arg(line).arg(col);
01057 }
01058
01059 void KateView::find()
01060 {
01061 m_search->find();
01062 }
01063
01064 void KateView::replace()
01065 {
01066 m_search->replace();
01067 }
01068
01069 void KateView::findAgain( bool back )
01070 {
01071 m_search->findAgain( back );
01072 }
01073
01074 void KateView::selectionChanged ()
01075 {
01076 if (m_doc->hasSelection())
01077 {
01078 m_copy->setEnabled (true);
01079 m_deSelect->setEnabled (true);
01080 }
01081 else
01082 {
01083 m_copy->setEnabled (false);
01084 m_deSelect->setEnabled (false);
01085 }
01086
01087 if (m_doc->readOnly())
01088 return;
01089
01090 if (m_doc->hasSelection())
01091 m_cut->setEnabled (true);
01092 else
01093 m_cut->setEnabled (false);
01094 }
01095
01096 void KateView::switchToCmdLine ()
01097 {
01098 if (!m_cmdLineOn)
01099 m_config->setCmdLine (true);
01100 else {
01101 if (m_cmdLine->hasFocus()) {
01102 this->setFocus();
01103 return;
01104 }
01105 }
01106 m_cmdLine->setFocus ();
01107 }
01108
01109 void KateView::showArgHint( QStringList arg1, const QString& arg2, const QString& arg3 )
01110 {
01111 m_codeCompletion->showArgHint( arg1, arg2, arg3 );
01112 }
01113
01114 void KateView::showCompletionBox( QValueList<KTextEditor::CompletionEntry> arg1, int offset, bool cs )
01115 {
01116 emit aboutToShowCompletionBox();
01117 m_codeCompletion->showCompletionBox( arg1, offset, cs );
01118 }
01119
01120 KateRenderer *KateView::renderer ()
01121 {
01122 return m_renderer;
01123 }
01124
01125 void KateView::updateConfig ()
01126 {
01127 if (m_startingUp)
01128 return;
01129
01130 m_editActions->readShortcutSettings( "Katepart Shortcuts" );
01131
01132
01133 if (m_hasWrap != config()->dynWordWrap()) {
01134 m_viewInternal->prepareForDynWrapChange();
01135
01136 m_hasWrap = config()->dynWordWrap();
01137
01138 m_viewInternal->dynWrapChanged();
01139
01140 m_setDynWrapIndicators->setEnabled(config()->dynWordWrap());
01141 m_toggleDynWrap->setChecked( config()->dynWordWrap() );
01142 }
01143
01144 m_viewInternal->leftBorder->setDynWrapIndicators( config()->dynWordWrapIndicators() );
01145 m_setDynWrapIndicators->setCurrentItem( config()->dynWordWrapIndicators() );
01146
01147
01148 m_viewInternal->leftBorder->setLineNumbersOn( config()->lineNumbers() );
01149 m_toggleLineNumbers->setChecked( config()->lineNumbers() );
01150
01151
01152 m_viewInternal->leftBorder->setIconBorderOn( config()->iconBar() );
01153 m_toggleIconBar->setChecked( config()->iconBar() );
01154
01155
01156 m_viewInternal->m_lineScroll->setShowMarks( config()->scrollBarMarks() );
01157 m_toggleScrollBarMarks->setChecked( config()->scrollBarMarks() );
01158
01159
01160 showCmdLine (config()->cmdLine());
01161
01162
01163
01164 m_toggleBlockSelection->setChecked( m_doc->blockSelectionMode() );
01165 m_toggleInsert->setChecked( isOverwriteMode() );
01166
01167 updateFoldingConfig ();
01168
01169
01170 m_bookmarks->setSorting( (KateBookmarks::Sorting) config()->bookmarkSort() );
01171
01172 m_viewInternal->setAutoCenterLines(config()->autoCenterLines ());
01173 }
01174
01175 void KateView::updateDocumentConfig()
01176 {
01177 if (m_startingUp)
01178 return;
01179
01180 m_updatingDocumentConfig = true;
01181
01182 m_setEndOfLine->setCurrentItem (m_doc->config()->eol());
01183
01184 m_updatingDocumentConfig = false;
01185
01186 m_viewInternal->updateView (true);
01187
01188 m_renderer->setTabWidth (m_doc->config()->tabWidth());
01189 }
01190
01191 void KateView::updateRendererConfig()
01192 {
01193 if (m_startingUp)
01194 return;
01195
01196 m_toggleWWMarker->setChecked( m_renderer->config()->wordWrapMarker() );
01197
01198
01199 m_viewInternal->updateView (true);
01200 m_viewInternal->repaint ();
01201
01202
01203 m_viewInternal->leftBorder->updateFont();
01204 m_viewInternal->leftBorder->repaint ();
01205 }
01206
01207 void KateView::updateFoldingConfig ()
01208 {
01209
01210 bool doit = config()->foldingBar() && m_doc->highlight() && m_doc->highlight()->allowsFolding();
01211 m_viewInternal->leftBorder->setFoldingMarkersOn(doit);
01212 m_toggleFoldingMarkers->setChecked( doit );
01213 m_toggleFoldingMarkers->setEnabled( m_doc->highlight() && m_doc->highlight()->allowsFolding() );
01214
01215 QStringList l;
01216
01217 l << "folding_toplevel" << "folding_expandtoplevel"
01218 << "folding_collapselocal" << "folding_expandlocal";
01219
01220 KAction *a = 0;
01221 for (uint z = 0; z < l.size(); z++)
01222 if ((a = actionCollection()->action( l[z].ascii() )))
01223 a->setEnabled (m_doc->highlight() && m_doc->highlight()->allowsFolding());
01224 }
01225
01226
01227 void KateView::editStart ()
01228 {
01229 m_viewInternal->editStart ();
01230 }
01231
01232 void KateView::editEnd (int editTagLineStart, int editTagLineEnd, bool tagFrom)
01233 {
01234 m_viewInternal->editEnd (editTagLineStart, editTagLineEnd, tagFrom);
01235 }
01236
01237 void KateView::editSetCursor (const KateTextCursor &cursor)
01238 {
01239 m_viewInternal->editSetCursor (cursor);
01240 }
01241
01242
01243
01244 bool KateView::tagLine (const KateTextCursor& virtualCursor)
01245 {
01246 return m_viewInternal->tagLine (virtualCursor);
01247 }
01248
01249 bool KateView::tagLines (int start, int end, bool realLines)
01250 {
01251 return m_viewInternal->tagLines (start, end, realLines);
01252 }
01253
01254 bool KateView::tagLines (KateTextCursor start, KateTextCursor end, bool realCursors)
01255 {
01256 return m_viewInternal->tagLines (start, end, realCursors);
01257 }
01258
01259 void KateView::tagAll ()
01260 {
01261 m_viewInternal->tagAll ();
01262 }
01263
01264 void KateView::clear ()
01265 {
01266 m_viewInternal->clear ();
01267 }
01268
01269 void KateView::repaintText (bool paintOnlyDirty)
01270 {
01271 m_viewInternal->paintText(0,0,m_viewInternal->width(),m_viewInternal->height(), paintOnlyDirty);
01272 }
01273
01274 void KateView::updateView (bool changed)
01275 {
01276 m_viewInternal->updateView (changed);
01277 m_viewInternal->leftBorder->update();
01278 }
01279
01280
01281
01282 void KateView::slotHlChanged()
01283 {
01284 KateHighlighting *hl = m_doc->highlight();
01285 bool ok ( !hl->getCommentStart(0).isEmpty() || !hl->getCommentSingleLineStart(0).isEmpty() );
01286
01287 if (actionCollection()->action("tools_comment"))
01288 actionCollection()->action("tools_comment")->setEnabled( ok );
01289
01290 if (actionCollection()->action("tools_uncomment"))
01291 actionCollection()->action("tools_uncomment")->setEnabled( ok );
01292
01293
01294 updateFoldingConfig ();
01295 }
01296
01297 uint KateView::cursorColumn()
01298 {
01299 uint r = m_doc->currentColumn(m_viewInternal->getCursor());
01300 if ( !( m_doc->config()->configFlags() & KateDocumentConfig::cfWrapCursor ) &&
01301 (uint)m_viewInternal->getCursor().col() > m_doc->textLine( m_viewInternal->getCursor().line() ).length() )
01302 r += m_viewInternal->getCursor().col() - m_doc->textLine( m_viewInternal->getCursor().line() ).length();
01303
01304 return r;
01305 }
01306
01307