• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • sources
  • kde-4.12
  • applications
  • kate
  • part
  • view
kateview.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2009 Michel Ludwig <michel.ludwig@kdemail.net>
3  Copyright (C) 2007 Mirko Stocker <me@misto.ch>
4  Copyright (C) 2003 Hamish Rodda <rodda@kde.org>
5  Copyright (C) 2002 John Firebaugh <jfirebaugh@kde.org>
6  Copyright (C) 2001-2004 Christoph Cullmann <cullmann@kde.org>
7  Copyright (C) 2001-2010 Joseph Wenninger <jowenn@kde.org>
8  Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Library General Public
12  License version 2 as published by the Free Software Foundation.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
24 
25 //BEGIN includes
26 #include "kateview.h"
27 #include "kateview.moc"
28 
29 #include "kateviewinternal.h"
30 #include "kateviewhelpers.h"
31 #include "katerenderer.h"
32 #include "katedocument.h"
33 #include "kateundomanager.h"
34 #include "katedocumenthelpers.h"
35 #include "kateglobal.h"
36 #include "kateviglobal.h"
37 #include "katehighlight.h"
38 #include "katehighlightmenu.h"
39 #include "katedialogs.h"
40 #include "katetextline.h"
41 #include "kateschema.h"
42 #include "katebookmarks.h"
43 #include "kateconfig.h"
44 #include "katemodemenu.h"
45 #include "kateautoindent.h"
46 #include "katecompletionwidget.h"
47 #include "katesearchbar.h"
48 #include "kateviemulatedcommandbar.h"
49 #include "katepartpluginmanager.h"
50 #include "katewordcompletion.h"
51 #include "katelayoutcache.h"
52 #include "spellcheck/spellcheck.h"
53 #include "spellcheck/spellcheckdialog.h"
54 #include "spellcheck/spellingmenu.h"
55 #include "katebuffer.h"
56 #include "script/katescriptmanager.h"
57 #include "script/katescriptaction.h"
58 #include "script/katescriptconsole.h"
59 #include "snippet/katesnippetglobal.h"
60 #include "snippet/snippetcompletionmodel.h"
61 #include "katemessagewidget.h"
62 #include "katetemplatehandler.h"
63 
64 #include <ktexteditor/messageinterface.h>
65 
66 #include <kparts/event.h>
67 
68 #include <kconfig.h>
69 #include <kdebug.h>
70 #include <kapplication.h>
71 #include <kcursor.h>
72 #include <kicon.h>
73 #include <klocale.h>
74 #include <kglobal.h>
75 #include <kcharsets.h>
76 #include <kmessagebox.h>
77 #include <kaction.h>
78 #include <kstandardaction.h>
79 #include <kxmlguifactory.h>
80 #include <kxmlguiclient.h>
81 #include <kencodingfiledialog.h>
82 #include <kstandardshortcut.h>
83 #include <kmenu.h>
84 #include <ktoggleaction.h>
85 #include <kselectaction.h>
86 #include <kactioncollection.h>
87 #include <kdeversion.h>
88 
89 #include <QtGui/QFont>
90 #include <QtCore/QFileInfo>
91 #include <QtGui/QStyle>
92 #include <QtGui/QKeyEvent>
93 #include <QtGui/QLayout>
94 #include <QtCore/QMimeData>
95 
96 //#define VIEW_RANGE_DEBUG
97 
98 //END includes
99 
100 void KateView::blockFix(KTextEditor::Range& range)
101 {
102  if (range.start().column() > range.end().column())
103  {
104  int tmp = range.start().column();
105  range.start().setColumn(range.end().column());
106  range.end().setColumn(tmp);
107  }
108 }
109 
110 KateView::KateView( KateDocument *doc, QWidget *parent )
111  : KTextEditor::View( parent )
112  , m_completionWidget(0)
113  , m_annotationModel(0)
114  , m_hasWrap( false )
115  , m_doc( doc )
116  , m_textFolding (doc->buffer())
117  , m_config( new KateViewConfig( this ) )
118  , m_renderer( new KateRenderer( doc, m_textFolding, this ) )
119  , m_viewInternal( new KateViewInternal( this ) )
120  , m_spell( new KateSpellCheckDialog( this ) )
121  , m_bookmarks( new KateBookmarks( this ) )
122  , m_startingUp (true)
123  , m_updatingDocumentConfig (false)
124  , m_selection (m_doc->buffer(), KTextEditor::Range::invalid(), Kate::TextRange::ExpandLeft, Kate::TextRange::AllowEmpty)
125  , blockSelect (false)
126  , m_bottomViewBar (0)
127  , m_topViewBar (0)
128  , m_cmdLine (0)
129  , m_console (0)
130  , m_searchBar (0)
131  , m_viModeEmulatedCommandBar(0)
132  , m_gotoBar (0)
133  , m_dictionaryBar(NULL)
134  , m_spellingMenu( new KateSpellingMenu( this ) )
135  , m_userContextMenuSet( false )
136  , m_delayedUpdateTriggered (false)
137  , m_lineToUpdateMin (-1)
138  , m_lineToUpdateMax (-1)
139  , m_floatTopMessageWidget (0)
140  , m_floatBottomMessageWidget (0)
141 {
142  // queued connect to collapse view updates for range changes, INIT THIS EARLY ENOUGH!
143  connect(this, SIGNAL(delayedUpdateOfView()), this, SLOT(slotDelayedUpdateOfView()), Qt::QueuedConnection);
144 
145  setComponentData ( KateGlobal::self()->componentData () );
146 
147  // selection if for this view only and will invalidate if becoming empty
148  m_selection.setView (this);
149 
150  // use z depth defined in moving ranges interface
151  m_selection.setZDepth (-100000.0);
152 
153  KateGlobal::self()->registerView( this );
154 
155  KTextEditor::ViewBarContainer *viewBarContainer=qobject_cast<KTextEditor::ViewBarContainer*>( KateGlobal::self()->container() );
156  QWidget *bottomBarParent=viewBarContainer?viewBarContainer->getViewBarParent(this,KTextEditor::ViewBarContainer::BottomBar):0;
157  QWidget *topBarParent=viewBarContainer?viewBarContainer->getViewBarParent(this,KTextEditor::ViewBarContainer::TopBar):0;
158 
159  m_bottomViewBar=new KateViewBar (bottomBarParent!=0,KTextEditor::ViewBarContainer::BottomBar,bottomBarParent?bottomBarParent:this,this);
160  m_topViewBar=new KateViewBar (topBarParent!=0,KTextEditor::ViewBarContainer::TopBar,topBarParent?topBarParent:this,this);
161 
162  // ugly workaround:
163  // Force the layout to be left-to-right even on RTL deskstop, as discussed
164  // on the mailing list. This will cause the lines and icons panel to be on
165  // the left, even for Arabic/Hebrew/Farsi/whatever users.
166  setLayoutDirection ( Qt::LeftToRight );
167 
168  // layouting ;)
169  m_vBox = new QVBoxLayout (this);
170  m_vBox->setMargin (0);
171  m_vBox->setSpacing (0);
172 
173  // add top viewbar...
174  if (topBarParent)
175  viewBarContainer->addViewBarToLayout(this,m_topViewBar,KTextEditor::ViewBarContainer::TopBar);
176  else
177  m_vBox->addWidget(m_topViewBar);
178 
179  m_bottomViewBar->installEventFilter(m_viewInternal);
180 
181  // add KateMessageWidget for KTE::MessageInterface immediately above view
182  m_topMessageWidget = new KateMessageWidget(this);
183  m_vBox->addWidget(m_topMessageWidget);
184  m_topMessageWidget->hide();
185 
186  // add hbox: KateIconBorder | KateViewInternal | KateScrollBar
187  QHBoxLayout *hbox = new QHBoxLayout ();
188  m_vBox->addLayout (hbox, 100);
189  hbox->setMargin (0);
190  hbox->setSpacing (0);
191 
192  QStyleOption option;
193  option.initFrom(this);
194 
195  if (style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &option, this)) {
196  QHBoxLayout *extrahbox = new QHBoxLayout ();
197  QFrame * frame = new QFrame(this);
198  extrahbox->setMargin (0);
199  extrahbox->setSpacing (0);
200  extrahbox->addWidget (m_viewInternal->m_leftBorder);
201  extrahbox->addWidget (m_viewInternal);
202  frame->setLayout (extrahbox);
203  hbox->addWidget (frame);
204  hbox->addSpacing (style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &option, this));
205  frame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
206  }
207  else {
208  hbox->addWidget (m_viewInternal->m_leftBorder);
209  hbox->addWidget (m_viewInternal);
210  }
211  hbox->addWidget (m_viewInternal->m_lineScroll);
212 
213  if (style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &option, this)) {
214  m_vBox->addSpacing (style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &option, this));
215  }
216 
217  // add hbox: ColumnsScrollBar | Dummy
218  hbox = new QHBoxLayout ();
219  m_vBox->addLayout (hbox);
220  hbox->setMargin (0);
221  hbox->setSpacing (0);
222 
223  hbox->addWidget (m_viewInternal->m_columnScroll);
224  hbox->addWidget (m_viewInternal->m_dummy);
225 
226  // add KateMessageWidget for KTE::MessageInterface immediately above view
227  m_bottomMessageWidget = new KateMessageWidget(this);
228  m_vBox->addWidget(m_bottomMessageWidget);
229  m_bottomMessageWidget->hide();
230 
231  // add bottom viewbar...
232  if (bottomBarParent)
233  viewBarContainer->addViewBarToLayout(this,m_bottomViewBar,KTextEditor::ViewBarContainer::BottomBar);
234  else
235  m_vBox->addWidget(m_bottomViewBar);
236 
237  // add layout for floating message widgets to KateViewInternal
238  m_notificationLayout = new QVBoxLayout(m_viewInternal);
239  m_notificationLayout->setContentsMargins(20, 20, 20, 20);
240  m_viewInternal->setLayout(m_notificationLayout);
241 
242  // this really is needed :)
243  m_viewInternal->updateView ();
244 
245  doc->addView( this );
246 
247  setFocusProxy( m_viewInternal );
248  setFocusPolicy( Qt::StrongFocus );
249 
250  // default ui file with all features
251  QString uifile = "katepartui.rc";
252 
253  // simple mode
254  if (doc->simpleMode ())
255  uifile = "katepartsimpleui.rc";
256 
257  setXMLFile( uifile );
258 
259  setupConnections();
260  setupActions();
261 
262  // auto word completion
263  new KateWordCompletionView (this, actionCollection ());
264 
265  // enable the plugins of this view
266  KatePartPluginManager::self()->addView(this);
267 
268  // update the enabled state of the undo/redo actions...
269  slotUpdateUndo();
270 
271  m_startingUp = false;
272  updateConfig ();
273 
274  slotHlChanged();
275  KCursor::setAutoHideCursor( m_viewInternal, true );
276 
277  if ( viInputMode() /* && FIXME: HAEHH? !config()->viInputModeHideStatusBar() */ ) {
278  deactivateEditActions();
279  }
280 
281  // user interaction (scrollling) starts notification auto-hide timer
282  connect(this, SIGNAL(displayRangeChanged(KateView*)), m_topMessageWidget, SLOT(startAutoHideTimer()));
283  connect(this, SIGNAL(displayRangeChanged(KateView*)), m_bottomMessageWidget, SLOT(startAutoHideTimer()));
284 
285  // user interaction (cursor navigation) starts notification auto-hide timer
286  connect(this, SIGNAL(cursorPositionChanged(KTextEditor::View*, const KTextEditor::Cursor&)), m_topMessageWidget, SLOT(startAutoHideTimer()));
287  connect(this, SIGNAL(cursorPositionChanged(KTextEditor::View*, const KTextEditor::Cursor&)), m_bottomMessageWidget, SLOT(startAutoHideTimer()));
288 
289  // folding restoration on reload
290  connect(m_doc, SIGNAL(aboutToReload(KTextEditor::Document*)), SLOT(saveFoldingState()));
291  connect(m_doc, SIGNAL(reloaded(KTextEditor::Document*)), SLOT(applyFoldingState()));
292 }
293 
294 KateView::~KateView()
295 {
296  // invalidate update signal
297  m_delayedUpdateTriggered = false;
298 
299  // remove from xmlgui factory, to be safe
300  if (factory())
301  factory()->removeClient (this);
302 
303  KTextEditor::ViewBarContainer *viewBarContainer=qobject_cast<KTextEditor::ViewBarContainer*>( KateGlobal::self()->container() );
304  if (viewBarContainer) {
305  viewBarContainer->deleteViewBarForView(this,KTextEditor::ViewBarContainer::BottomBar);
306  m_bottomViewBar=0;
307  viewBarContainer->deleteViewBarForView(this,KTextEditor::ViewBarContainer::TopBar);
308  m_topViewBar=0;
309  }
310 
311  KatePartPluginManager::self()->removeView(this);
312 
313  m_doc->removeView( this );
314 
315  delete m_viewInternal;
316 
317  delete m_renderer;
318 
319  delete m_config;
320 
321  KateGlobal::self()->deregisterView (this);
322 }
323 
324 void KateView::setupConnections()
325 {
326  connect( m_doc, SIGNAL(undoChanged()),
327  this, SLOT(slotUpdateUndo()) );
328  connect( m_doc, SIGNAL(highlightingModeChanged(KTextEditor::Document*)),
329  this, SLOT(slotHlChanged()) );
330  connect( m_doc, SIGNAL(canceled(QString)),
331  this, SLOT(slotSaveCanceled(QString)) );
332  connect( m_viewInternal, SIGNAL(dropEventPass(QDropEvent*)),
333  this, SIGNAL(dropEventPass(QDropEvent*)) );
334 
335  connect( m_doc, SIGNAL(annotationModelChanged(KTextEditor::AnnotationModel*,KTextEditor::AnnotationModel*)),
336  m_viewInternal->m_leftBorder, SLOT(annotationModelChanged(KTextEditor::AnnotationModel*,KTextEditor::AnnotationModel*)) );
337 
338  if ( m_doc->browserView() )
339  {
340  connect( this, SIGNAL(dropEventPass(QDropEvent*)),
341  this, SLOT(slotDropEventPass(QDropEvent*)) );
342  }
343 }
344 
345 void KateView::setupActions()
346 {
347  KActionCollection *ac = actionCollection ();
348  KAction *a;
349 
350  m_toggleWriteLock = 0;
351 
352  m_cut = a = ac->addAction(KStandardAction::Cut, this, SLOT(cut()));
353  a->setWhatsThis(i18n("Cut the selected text and move it to the clipboard"));
354 
355  m_paste = a = ac->addAction(KStandardAction::PasteText, this, SLOT(paste()));
356  a->setWhatsThis(i18n("Paste previously copied or cut clipboard contents"));
357 
358  m_copy = a = ac->addAction(KStandardAction::Copy, this, SLOT(copy()));
359  a->setWhatsThis(i18n( "Use this command to copy the currently selected text to the system clipboard."));
360 
361  m_pasteMenu = ac->addAction("edit_paste_menu", new KatePasteMenu (i18n("Clipboard &History"), this));
362  connect (KateGlobal::self(), SIGNAL(clipboardHistoryChanged()), this, SLOT(slotClipboardHistoryChanged()));
363 
364  if (!m_doc->readOnly())
365  {
366  a = ac->addAction(KStandardAction::Save, m_doc, SLOT(documentSave()));
367  a->setWhatsThis(i18n("Save the current document"));
368 
369  a = m_editUndo = ac->addAction(KStandardAction::Undo, m_doc, SLOT(undo()));
370  a->setWhatsThis(i18n("Revert the most recent editing actions"));
371 
372  a = m_editRedo = ac->addAction(KStandardAction::Redo, m_doc, SLOT(redo()));
373  a->setWhatsThis(i18n("Revert the most recent undo operation"));
374 
375  // Tools > Scripts
376  KateScriptActionMenu* scriptActionMenu = new KateScriptActionMenu(this, i18n("&Scripts"));
377  ac->addAction("tools_scripts", scriptActionMenu);
378 
379  a = ac->addAction("tools_apply_wordwrap");
380  a->setText(i18n("Apply &Word Wrap"));
381  a->setWhatsThis(i18n("Use this command to wrap all lines of the current document which are longer than the width of the"
382  " current view, to fit into this view.<br /><br /> This is a static word wrap, meaning it is not updated"
383  " when the view is resized."));
384  connect(a, SIGNAL(triggered(bool)), SLOT(applyWordWrap()));
385 
386  a = ac->addAction("tools_cleanIndent");
387  a->setText(i18n("&Clean Indentation"));
388  a->setWhatsThis(i18n("Use this to clean the indentation of a selected block of text (only tabs/only spaces).<br /><br />"
389  "You can configure whether tabs should be honored and used or replaced with spaces, in the configuration dialog."));
390  connect(a, SIGNAL(triggered(bool)), SLOT(cleanIndent()));
391 
392  a = ac->addAction("tools_align");
393  a->setText(i18n("&Align"));
394  a->setWhatsThis(i18n("Use this to align the current line or block of text to its proper indent level."));
395  connect(a, SIGNAL(triggered(bool)), SLOT(align()));
396 
397  a = ac->addAction("tools_comment");
398  a->setText(i18n("C&omment"));
399  a->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_D));
400  a->setWhatsThis(i18n("This command comments out the current line or a selected block of text.<br /><br />"
401  "The characters for single/multiple line comments are defined within the language's highlighting."));
402  connect(a, SIGNAL(triggered(bool)), SLOT(comment()));
403 
404  a = ac->addAction("tools_uncomment");
405  a->setText(i18n("Unco&mment"));
406  a->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_D));
407  a->setWhatsThis(i18n("This command removes comments from the current line or a selected block of text.<br /><br />"
408  "The characters for single/multiple line comments are defined within the language's highlighting."));
409  connect(a, SIGNAL(triggered(bool)), SLOT(uncomment()));
410 
411  a = ac->addAction("tools_toggle_comment");
412  a->setText(i18n("Toggle Comment"));
413  connect(a, SIGNAL(triggered(bool)), SLOT(toggleComment()));
414 
415  a = m_toggleWriteLock = new KToggleAction(i18n("&Read Only Mode"), this);
416  a->setWhatsThis( i18n("Lock/unlock the document for writing") );
417  a->setChecked( !m_doc->isReadWrite() );
418  connect(a, SIGNAL(triggered(bool)), SLOT(toggleWriteLock()));
419  ac->addAction("tools_toggle_write_lock", a);
420 
421  a = ac->addAction("tools_uppercase");
422  a->setText(i18n("Uppercase"));
423  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U));
424  a->setWhatsThis( i18n("Convert the selection to uppercase, or the character to the "
425  "right of the cursor if no text is selected.") );
426  connect(a, SIGNAL(triggered(bool)), SLOT(uppercase()));
427 
428  a = ac->addAction( "tools_lowercase" );
429  a->setText( i18n("Lowercase") );
430  a->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_U));
431  a->setWhatsThis( i18n("Convert the selection to lowercase, or the character to the "
432  "right of the cursor if no text is selected.") );
433  connect(a, SIGNAL(triggered(bool)), SLOT(lowercase()));
434 
435  a = ac->addAction( "tools_capitalize" );
436  a->setText( i18n("Capitalize") );
437  a->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_U));
438  a->setWhatsThis( i18n("Capitalize the selection, or the word under the "
439  "cursor if no text is selected.") );
440  connect(a, SIGNAL(triggered(bool)), SLOT(capitalize()));
441 
442  a = ac->addAction( "tools_join_lines" );
443  a->setText( i18n("Join Lines") );
444  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_J));
445  connect(a, SIGNAL(triggered(bool)), SLOT(joinLines()));
446 
447  a = ac->addAction( "tools_invoke_code_completion" );
448  a->setText( i18n("Invoke Code Completion") );
449  a->setWhatsThis(i18n("Manually invoke command completion, usually by using a shortcut bound to this action."));
450  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Space));
451  connect(a, SIGNAL(triggered(bool)), SLOT(userInvokedCompletion()));
452 
453  a = ac->addAction( "tools_create_snippet" );
454  a->setIcon (KIcon("document-new"));
455  a->setText( i18n("Create Snippet") );
456  connect(a, SIGNAL(triggered(bool)), SLOT(createSnippet()));
457 
458  a = ac->addAction( "tools_snippets" );
459  a->setText( i18n("Snippets...") );
460  connect(a, SIGNAL(triggered(bool)), SLOT(showSnippetsDialog()));
461  }
462  else
463  {
464  m_cut->setEnabled (false);
465  m_paste->setEnabled (false);
466  m_pasteMenu->setEnabled (false);
467  m_editUndo = 0;
468  m_editRedo = 0;
469  }
470 
471  a = ac->addAction( KStandardAction::Print, m_doc, SLOT(print()) );
472  a->setWhatsThis(i18n("Print the current document."));
473 
474  a = ac->addAction( "file_reload" );
475  a->setIcon(KIcon("view-refresh"));
476  a->setText(i18n("Reloa&d"));
477  a->setShortcuts(KStandardShortcut::reload());
478  a->setWhatsThis(i18n("Reload the current document from disk."));
479  connect(a, SIGNAL(triggered(bool)), SLOT(reloadFile()));
480 
481  a = ac->addAction( KStandardAction::SaveAs, m_doc, SLOT(documentSaveAs()) );
482  a->setWhatsThis(i18n("Save the current document to disk, with a name of your choice."));
483 
484  a = ac->addAction( KStandardAction::GotoLine, this, SLOT(gotoLine()) );
485  a->setWhatsThis(i18n("This command opens a dialog and lets you choose a line that you want the cursor to move to."));
486 
487  a = ac->addAction("set_confdlg");
488  a->setText(i18n("&Configure Editor..."));
489  a->setWhatsThis(i18n("Configure various aspects of this editor."));
490  connect(a, SIGNAL(triggered(bool)), SLOT(slotConfigDialog()));
491 
492  KateModeMenu *ftm = new KateModeMenu (i18n("&Mode"), this);
493  ac->addAction("tools_mode", ftm);
494  ftm->setWhatsThis(i18n("Here you can choose which mode should be used for the current document. This will influence the highlighting and folding being used, for example."));
495  ftm->updateMenu (m_doc);
496 
497  KateHighlightingMenu *menu = new KateHighlightingMenu (i18n("&Highlighting"), this);
498  ac->addAction("tools_highlighting", menu);
499  menu->setWhatsThis(i18n("Here you can choose how the current document should be highlighted."));
500  menu->updateMenu (m_doc);
501 
502  KateViewSchemaAction *schemaMenu = new KateViewSchemaAction (i18n("&Schema"), this);
503  ac->addAction("view_schemas", schemaMenu);
504  schemaMenu->updateMenu (this);
505 
506  // indentation menu
507  KateViewIndentationAction *indentMenu = new KateViewIndentationAction(m_doc, i18n("&Indentation"), this);
508  ac->addAction("tools_indentation", indentMenu);
509 
510  m_selectAll = a= ac->addAction( KStandardAction::SelectAll, this, SLOT(selectAll()) );
511  a->setWhatsThis(i18n("Select the entire text of the current document."));
512 
513  m_deSelect = a= ac->addAction( KStandardAction::Deselect, this, SLOT(clearSelection()) );
514  a->setWhatsThis(i18n("If you have selected something within the current document, this will no longer be selected."));
515 
516  a = ac->addAction("view_inc_font_sizes");
517  a->setIcon(KIcon("zoom-in"));
518  a->setText(i18n("Enlarge Font"));
519  a->setShortcut(KStandardShortcut::zoomIn());
520  a->setWhatsThis(i18n("This increases the display font size."));
521  connect(a, SIGNAL(triggered(bool)), m_viewInternal, SLOT(slotIncFontSizes()));
522 
523  a = ac->addAction("view_dec_font_sizes");
524  a->setIcon(KIcon("zoom-out"));
525  a->setText(i18n("Shrink Font"));
526  a->setShortcut(KStandardShortcut::zoomOut());
527  a->setWhatsThis(i18n("This decreases the display font size."));
528  connect(a, SIGNAL(triggered(bool)), m_viewInternal, SLOT(slotDecFontSizes()));
529 
530  a = m_toggleBlockSelection = new KToggleAction(i18n("Bl&ock Selection Mode"), this);
531  ac->addAction("set_verticalSelect", a);
532  a->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
533  a->setWhatsThis(i18n("This command allows switching between the normal (line based) selection mode and the block selection mode."));
534  connect(a, SIGNAL(triggered(bool)), SLOT(toggleBlockSelection()));
535 
536  a = m_toggleInsert = new KToggleAction(i18n("Overwr&ite Mode"), this);
537  ac->addAction("set_insert", a);
538  a->setShortcut(QKeySequence(Qt::Key_Insert));
539  a->setWhatsThis(i18n("Choose whether you want the text you type to be inserted or to overwrite existing text."));
540  connect(a, SIGNAL(triggered(bool)), SLOT(toggleInsert()));
541 
542  KToggleAction *toggleAction;
543  a = m_toggleDynWrap = toggleAction = new KToggleAction(i18n("&Dynamic Word Wrap"), this);
544  ac->addAction("view_dynamic_word_wrap", a);
545  a->setShortcut(QKeySequence(Qt::Key_F10));
546  a->setWhatsThis(i18n("If this option is checked, the text lines will be wrapped at the view border on the screen."));
547  connect(a, SIGNAL(triggered(bool)), SLOT(toggleDynWordWrap()));
548 
549  a = m_setDynWrapIndicators = new KSelectAction(i18n("Dynamic Word Wrap Indicators"), this);
550  ac->addAction("dynamic_word_wrap_indicators", a);
551  a->setWhatsThis(i18n("Choose when the Dynamic Word Wrap Indicators should be displayed"));
552 
553  connect(m_setDynWrapIndicators, SIGNAL(triggered(int)), this, SLOT(setDynWrapIndicators(int)));
554  QStringList list2;
555  list2.append(i18n("&Off"));
556  list2.append(i18n("Follow &Line Numbers"));
557  list2.append(i18n("&Always On"));
558  m_setDynWrapIndicators->setItems(list2);
559  m_setDynWrapIndicators->setEnabled(m_toggleDynWrap->isChecked()); // only synced on real change, later
560 
561  a = toggleAction = m_toggleFoldingMarkers = new KToggleAction(i18n("Show Folding &Markers"), this);
562  ac->addAction("view_folding_markers", a);
563  a->setShortcut(QKeySequence(Qt::Key_F9));
564  a->setWhatsThis(i18n("You can choose if the codefolding marks should be shown, if codefolding is possible."));
565  connect(a, SIGNAL(triggered(bool)), SLOT(toggleFoldingMarkers()));
566 
567  a = m_toggleIconBar = toggleAction = new KToggleAction(i18n("Show &Icon Border"), this);
568  ac->addAction("view_border", a);
569  a->setShortcut(QKeySequence(Qt::Key_F6));
570  a->setWhatsThis(i18n("Show/hide the icon border.<br /><br />The icon border shows bookmark symbols, for instance."));
571  connect(a, SIGNAL(triggered(bool)), SLOT(toggleIconBorder()));
572 
573  a = toggleAction = m_toggleLineNumbers = new KToggleAction(i18n("Show &Line Numbers"), this);
574  ac->addAction("view_line_numbers", a);
575  a->setShortcut(QKeySequence(Qt::Key_F11));
576  a->setWhatsThis(i18n("Show/hide the line numbers on the left hand side of the view."));
577  connect(a, SIGNAL(triggered(bool)), SLOT(toggleLineNumbersOn()));
578 
579  a = m_toggleScrollBarMarks = toggleAction = new KToggleAction(i18n("Show Scroll&bar Marks"), this);
580  ac->addAction("view_scrollbar_marks", a);
581  a->setWhatsThis(i18n("Show/hide the marks on the vertical scrollbar.<br /><br />The marks show bookmarks, for instance."));
582  connect(a, SIGNAL(triggered(bool)), SLOT(toggleScrollBarMarks()));
583 
584  a = m_toggleScrollBarMiniMap = toggleAction = new KToggleAction(i18n("Show Scrollbar Mini-Map"), this);
585  ac->addAction("view_scrollbar_minimap", a);
586  a->setWhatsThis(i18n("Show/hide the mini-map on the vertical scrollbar.<br /><br />The mini-map shows an overview of the whole document."));
587  connect(a, SIGNAL(triggered(bool)), SLOT(toggleScrollBarMiniMap()));
588 
589 // a = m_toggleScrollBarMiniMapAll = toggleAction = new KToggleAction(i18n("Show the whole document in the Mini-Map"), this);
590 // ac->addAction("view_scrollbar_minimap_all", a);
591 // a->setWhatsThis(i18n("Display the whole document in the mini-map.<br /><br />With this option set the whole document will be visible in the mini-map."));
592 // connect(a, SIGNAL(triggered(bool)), SLOT(toggleScrollBarMiniMapAll()));
593 // connect(m_toggleScrollBarMiniMap, SIGNAL(triggered(bool)), m_toggleScrollBarMiniMapAll, SLOT(setEnabled(bool)));
594 
595  a = toggleAction = m_toggleWWMarker = new KToggleAction(i18n("Show Static &Word Wrap Marker"), this);
596  ac->addAction("view_word_wrap_marker", a);
597  a->setWhatsThis( i18n(
598  "Show/hide the Word Wrap Marker, a vertical line drawn at the word "
599  "wrap column as defined in the editing properties" ));
600  connect(a, SIGNAL(triggered(bool)), SLOT(toggleWWMarker()));
601 
602  a = m_switchCmdLine = ac->addAction("switch_to_cmd_line");
603  a->setText(i18n("Switch to Command Line"));
604  a->setShortcut(QKeySequence(Qt::Key_F7));
605  a->setWhatsThis(i18n("Show/hide the command line on the bottom of the view."));
606  connect(a, SIGNAL(triggered(bool)), SLOT(switchToCmdLine()));
607 
608  a = m_switchConsole = ac->addAction("switch_to_console");
609  a->setText(i18n("Show the JavaScript Console"));
610  a->setWhatsThis(i18n("Show/hide the JavaScript Console on the bottom of the view."));
611  connect(a, SIGNAL(triggered(bool)), SLOT(switchToConsole()));
612 
613  a = m_viInputModeAction = new KToggleAction(i18n("&VI Input Mode"), this);
614  ac->addAction("view_vi_input_mode", a);
615  a->setShortcut(QKeySequence(Qt::CTRL + Qt::META + Qt::Key_V));
616  a->setWhatsThis( i18n("Activate/deactivate VI input mode" ));
617  connect(a, SIGNAL(triggered(bool)), SLOT(toggleViInputMode()));
618 
619  a = m_setEndOfLine = new KSelectAction(i18n("&End of Line"), this);
620  ac->addAction("set_eol", a);
621  a->setWhatsThis(i18n("Choose which line endings should be used, when you save the document"));
622  QStringList list;
623  list.append(i18nc("@item:inmenu End of Line", "&UNIX"));
624  list.append(i18nc("@item:inmenu End of Line", "&Windows/DOS"));
625  list.append(i18nc("@item:inmenu End of Line", "&Macintosh"));
626  m_setEndOfLine->setItems(list);
627  m_setEndOfLine->setCurrentItem (m_doc->config()->eol());
628  connect(m_setEndOfLine, SIGNAL(triggered(int)), this, SLOT(setEol(int)));
629 
630  a=m_addBom=new KToggleAction(i18n("Add &Byte Order Mark (BOM)"),this);
631  m_addBom->setChecked(m_doc->config()->bom());
632  ac->addAction("add_bom",a);
633  a->setWhatsThis(i18n("Enable/disable adding of byte order markers for UTF-8/UTF-16 encoded files while saving"));
634  connect(m_addBom,SIGNAL(triggered(bool)),this,SLOT(setAddBom(bool)));
635  // encoding menu
636  KateViewEncodingAction *encodingAction = new KateViewEncodingAction(m_doc, this, i18n("E&ncoding"), this);
637  ac->addAction("set_encoding", encodingAction);
638 
639  a = ac->addAction( KStandardAction::Find, this, SLOT(find()) );
640  a->setWhatsThis(i18n("Look up the first occurrence of a piece of text or regular expression."));
641  addAction(a);
642 
643  a = ac->addAction("edit_find_selected");
644  a->setText(i18n("Find Selected"));
645  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
646  a->setWhatsThis(i18n("Finds next occurrence of selected text."));
647  connect(a, SIGNAL(triggered(bool)), SLOT(findSelectedForwards()));
648 
649  a = ac->addAction("edit_find_selected_backwards");
650  a->setText(i18n("Find Selected Backwards"));
651  a->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_H));
652  a->setWhatsThis(i18n("Finds previous occurrence of selected text."));
653  connect(a, SIGNAL(triggered(bool)), SLOT(findSelectedBackwards()));
654 
655  a = ac->addAction( KStandardAction::FindNext, this, SLOT(findNext()) );
656  a->setWhatsThis(i18n("Look up the next occurrence of the search phrase."));
657  addAction(a);
658 
659  a = ac->addAction( KStandardAction::FindPrev, "edit_find_prev", this, SLOT(findPrevious()) );
660  a->setWhatsThis(i18n("Look up the previous occurrence of the search phrase."));
661  addAction(a);
662 
663  a = ac->addAction( KStandardAction::Replace, this, SLOT(replace()) );
664  a->setWhatsThis(i18n("Look up a piece of text or regular expression and replace the result with some given text."));
665 
666  m_spell->createActions( ac );
667  m_toggleOnTheFlySpellCheck = new KToggleAction(i18n("Automatic Spell Checking"), this);
668  m_toggleOnTheFlySpellCheck->setWhatsThis(i18n("Enable/disable automatic spell checking"));
669  m_toggleOnTheFlySpellCheck->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O));
670  connect(m_toggleOnTheFlySpellCheck, SIGNAL(triggered(bool)), SLOT(toggleOnTheFlySpellCheck(bool)));
671  ac->addAction("tools_toggle_automatic_spell_checking", m_toggleOnTheFlySpellCheck);
672 
673  a = ac->addAction("tools_change_dictionary");
674  a->setText(i18n("Change Dictionary..."));
675  a->setWhatsThis(i18n("Change the dictionary that is used for spell checking."));
676  connect(a, SIGNAL(triggered()), SLOT(changeDictionary()));
677 
678  a = ac->addAction("tools_clear_dictionary_ranges");
679  a->setText(i18n("Clear Dictionary Ranges"));
680  a->setVisible(false);
681  a->setWhatsThis(i18n("Remove all the separate dictionary ranges that were set for spell checking."));
682  connect(a, SIGNAL(triggered()), m_doc, SLOT(clearDictionaryRanges()));
683  connect(m_doc, SIGNAL(dictionaryRangesPresent(bool)), a, SLOT(setVisible(bool)));
684 
685  m_spellingMenu->createActions( ac );
686 
687  if (!m_doc->simpleMode ())
688  m_bookmarks->createActions( ac );
689 
690  slotSelectionChanged ();
691 
692  //Now setup the editing actions before adding the associated
693  //widget and setting the shortcut context
694  setupEditActions();
695  setupCodeFolding();
696  slotClipboardHistoryChanged ();
697 
698  ac->addAssociatedWidget(m_viewInternal);
699 
700  foreach (QAction* action, ac->actions())
701  action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
702 
703  connect (this, SIGNAL(selectionChanged(KTextEditor::View*)), this, SLOT(slotSelectionChanged()));
704 }
705 
706 void KateView::createSnippet ()
707 {
708  KateGlobal::self()->snippetGlobal()->createSnippet (this);
709 }
710 
711 void KateView::showSnippetsDialog ()
712 {
713  KateGlobal::self()->snippetGlobal()->showDialog (this);
714 }
715 
716 void KateView::slotConfigDialog ()
717 {
718  KateGlobal::self ()->configDialog (this);
719 
720  // write config to global settings, else simple programs don't get config saved ever
721  // like Konqueror, Dolphin, ...
722  KateGlobal::self ()->writeConfig (KGlobal::config().data());
723 }
724 
725 void KateView::setupEditActions()
726 {
727  //If you add an editing action to this
728  //function make sure to include the line
729  //m_editActions << a after creating the action
730  KActionCollection* ac = actionCollection();
731 
732  KAction* a = ac->addAction("word_left");
733  a->setText(i18n("Move Word Left"));
734  a->setShortcuts(KStandardShortcut::backwardWord());
735  connect(a, SIGNAL(triggered(bool)), SLOT(wordLeft()));
736  m_editActions << a;
737 
738  a = ac->addAction("select_char_left");
739  a->setText(i18n("Select Character Left"));
740  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Left));
741  connect(a, SIGNAL(triggered(bool)), SLOT(shiftCursorLeft()));
742  m_editActions << a;
743 
744  a = ac->addAction("select_word_left");
745  a->setText(i18n("Select Word Left"));
746  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_Left));
747  connect(a, SIGNAL(triggered(bool)), SLOT(shiftWordLeft()));
748  m_editActions << a;
749 
750  a = ac->addAction("word_right");
751  a->setText(i18n("Move Word Right"));
752  a->setShortcuts(KStandardShortcut::forwardWord());
753  connect(a, SIGNAL(triggered(bool)), SLOT(wordRight()));
754  m_editActions << a;
755 
756  a = ac->addAction("select_char_right");
757  a->setText(i18n("Select Character Right"));
758  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Right));
759  connect(a, SIGNAL(triggered(bool)), SLOT(shiftCursorRight()));
760  m_editActions << a;
761 
762  a = ac->addAction("select_word_right");
763  a->setText(i18n("Select Word Right"));
764  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_Right));
765  connect(a, SIGNAL(triggered(bool)), SLOT(shiftWordRight()));
766  m_editActions << a;
767 
768  a = ac->addAction("beginning_of_line");
769  a->setText(i18n("Move to Beginning of Line"));
770  a->setShortcuts(KStandardShortcut::beginningOfLine());
771  connect(a, SIGNAL(triggered(bool)), SLOT(home()));
772  m_editActions << a;
773 
774  a = ac->addAction("beginning_of_document");
775  a->setText(i18n("Move to Beginning of Document"));
776  a->setShortcuts(KStandardShortcut::begin());
777  connect(a, SIGNAL(triggered(bool)), SLOT(top()));
778  m_editActions << a;
779 
780  a = ac->addAction("select_beginning_of_line");
781  a->setText(i18n("Select to Beginning of Line"));
782  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Home));
783  connect(a, SIGNAL(triggered(bool)), SLOT(shiftHome()));
784  m_editActions << a;
785 
786  a = ac->addAction("select_beginning_of_document");
787  a->setText(i18n("Select to Beginning of Document"));
788  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_Home));
789  connect(a, SIGNAL(triggered(bool)), SLOT(shiftTop()));
790  m_editActions << a;
791 
792 
793  a = ac->addAction("end_of_line");
794  a->setText(i18n("Move to End of Line"));
795  a->setShortcuts(KStandardShortcut::endOfLine());
796  connect(a, SIGNAL(triggered(bool)), SLOT(end()));
797  m_editActions << a;
798 
799  a = ac->addAction("end_of_document");
800  a->setText(i18n("Move to End of Document"));
801  a->setShortcuts(KStandardShortcut::end());
802  connect(a, SIGNAL(triggered(bool)), SLOT(bottom()));
803  m_editActions << a;
804 
805  a = ac->addAction("select_end_of_line");
806  a->setText(i18n("Select to End of Line"));
807  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_End));
808  connect(a, SIGNAL(triggered(bool)), SLOT(shiftEnd()));
809  m_editActions << a;
810 
811  a = ac->addAction("select_end_of_document");
812  a->setText(i18n("Select to End of Document"));
813  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_End));
814  connect(a, SIGNAL(triggered(bool)), SLOT(shiftBottom()));
815  m_editActions << a;
816 
817 
818  a = ac->addAction("select_line_up");
819  a->setText(i18n("Select to Previous Line"));
820  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Up));
821  connect(a, SIGNAL(triggered(bool)), SLOT(shiftUp()));
822  m_editActions << a;
823 
824  a = ac->addAction("scroll_line_up");
825  a->setText(i18n("Scroll Line Up"));
826  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
827  connect(a, SIGNAL(triggered(bool)), SLOT(scrollUp()));
828  m_editActions << a;
829 
830 
831  a = ac->addAction("move_line_down");
832  a->setText(i18n("Move to Next Line"));
833  a->setShortcut(QKeySequence(Qt::Key_Down));
834  connect(a, SIGNAL(triggered(bool)), SLOT(down()));
835  m_editActions << a;
836 
837 
838  a = ac->addAction("move_line_up");
839  a->setText(i18n("Move to Previous Line"));
840  a->setShortcut(QKeySequence(Qt::Key_Up));
841  connect(a, SIGNAL(triggered(bool)), SLOT(up()));
842  m_editActions << a;
843 
844 
845  a = ac->addAction("move_cursor_right");
846  a->setText(i18n("Move Cursor Right"));
847  a->setShortcut(QKeySequence(Qt::Key_Right));
848  connect(a, SIGNAL(triggered(bool)), SLOT(cursorRight()));
849  m_editActions << a;
850 
851 
852  a = ac->addAction("move_cusor_left");
853  a->setText(i18n("Move Cursor Left"));
854  a->setShortcut(QKeySequence(Qt::Key_Left));
855  connect(a, SIGNAL(triggered(bool)), SLOT(cursorLeft()));
856  m_editActions << a;
857 
858 
859  a = ac->addAction("select_line_down");
860  a->setText(i18n("Select to Next Line"));
861  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Down));
862  connect(a, SIGNAL(triggered(bool)), SLOT(shiftDown()));
863  m_editActions << a;
864 
865  a = ac->addAction("scroll_line_down");
866  a->setText(i18n("Scroll Line Down"));
867  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down));
868  connect(a, SIGNAL(triggered(bool)), SLOT(scrollDown()));
869  m_editActions << a;
870 
871 
872  a = ac->addAction("scroll_page_up");
873  a->setText(i18n("Scroll Page Up"));
874  a->setShortcuts(KStandardShortcut::prior());
875  connect(a, SIGNAL(triggered(bool)), SLOT(pageUp()));
876  m_editActions << a;
877 
878  a = ac->addAction("select_page_up");
879  a->setText(i18n("Select Page Up"));
880  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_PageUp));
881  connect(a, SIGNAL(triggered(bool)), SLOT(shiftPageUp()));
882  m_editActions << a;
883 
884  a = ac->addAction("move_top_of_view");
885  a->setText(i18n("Move to Top of View"));
886  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageUp));
887  connect(a, SIGNAL(triggered(bool)), SLOT(topOfView()));
888  m_editActions << a;
889 
890  a = ac->addAction("select_top_of_view");
891  a->setText(i18n("Select to Top of View"));
892  a->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_PageUp));
893  connect(a, SIGNAL(triggered(bool)), SLOT(shiftTopOfView()));
894  m_editActions << a;
895 
896 
897  a = ac->addAction("scroll_page_down");
898  a->setText(i18n("Scroll Page Down"));
899  a->setShortcuts(KStandardShortcut::next());
900  connect(a, SIGNAL(triggered(bool)), SLOT(pageDown()));
901  m_editActions << a;
902 
903  a = ac->addAction("select_page_down");
904  a->setText(i18n("Select Page Down"));
905  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_PageDown));
906  connect(a, SIGNAL(triggered(bool)), SLOT(shiftPageDown()));
907  m_editActions << a;
908 
909  a = ac->addAction("move_bottom_of_view");
910  a->setText(i18n("Move to Bottom of View"));
911  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageDown));
912  connect(a, SIGNAL(triggered(bool)), SLOT(bottomOfView()));
913  m_editActions << a;
914 
915  a = ac->addAction("select_bottom_of_view");
916  a->setText(i18n("Select to Bottom of View"));
917  a->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_PageDown));
918  connect(a, SIGNAL(triggered(bool)), SLOT(shiftBottomOfView()));
919  m_editActions << a;
920 
921  a = ac->addAction("to_matching_bracket");
922  a->setText(i18n("Move to Matching Bracket"));
923  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_6));
924  connect(a, SIGNAL(triggered(bool)), SLOT(toMatchingBracket()));
925  m_editActions << a;
926 
927  a = ac->addAction("select_matching_bracket");
928  a->setText(i18n("Select to Matching Bracket"));
929  a->setShortcut(QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_6));
930  connect(a, SIGNAL(triggered(bool)), SLOT(shiftToMatchingBracket()));
931  m_editActions << a;
932 
933 
934  // anders: shortcuts doing any changes should not be created in browserextension
935  if ( !m_doc->readOnly() )
936  {
937  a = ac->addAction("transpose_char");
938  a->setText(i18n("Transpose Characters"));
939  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T));
940  connect(a, SIGNAL(triggered(bool)), SLOT(transpose()));
941  m_editActions << a;
942 
943  a = ac->addAction("delete_line");
944  a->setText(i18n("Delete Line"));
945  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_K));
946  connect(a, SIGNAL(triggered(bool)), SLOT(killLine()));
947  m_editActions << a;
948 
949  a = ac->addAction("delete_word_left");
950  a->setText(i18n("Delete Word Left"));
951  a->setShortcuts(KStandardShortcut::deleteWordBack());
952  connect(a, SIGNAL(triggered(bool)), SLOT(deleteWordLeft()));
953  m_editActions << a;
954 
955  a = ac->addAction("delete_word_right");
956  a->setText(i18n("Delete Word Right"));
957  a->setShortcuts(KStandardShortcut::deleteWordForward());
958  connect(a, SIGNAL(triggered(bool)), SLOT(deleteWordRight()));
959  m_editActions << a;
960 
961  a = ac->addAction("delete_next_character");
962  a->setText(i18n("Delete Next Character"));
963  a->setShortcut(QKeySequence(Qt::Key_Delete));
964  connect(a, SIGNAL(triggered(bool)), SLOT(keyDelete()));
965  m_editActions << a;
966 
967  a = ac->addAction("backspace");
968  a->setText(i18n("Backspace"));
969  QList<QKeySequence> scuts;
970  scuts << QKeySequence(Qt::Key_Backspace)
971  << QKeySequence(Qt::SHIFT + Qt::Key_Backspace);
972  a->setShortcuts(scuts);
973  connect(a, SIGNAL(triggered(bool)), SLOT(backspace()));
974  m_editActions << a;
975 
976  a = ac->addAction("insert_tabulator");
977  a->setText(i18n("Insert Tab"));
978  connect(a, SIGNAL(triggered(bool)), SLOT(insertTab()));
979  m_editActions << a;
980 
981  a = ac->addAction("smart_newline");
982  a->setText(i18n("Insert Smart Newline"));
983  a->setWhatsThis(i18n("Insert newline including leading characters of the current line which are not letters or numbers."));
984  scuts.clear();
985  scuts << QKeySequence(Qt::SHIFT + Qt::Key_Return)
986  << QKeySequence(Qt::SHIFT + Qt::Key_Enter);
987  a->setShortcuts(scuts);
988  connect(a, SIGNAL(triggered(bool)), SLOT(smartNewline()));
989  m_editActions << a;
990 
991  a = ac->addAction("tools_indent");
992  a->setIcon(KIcon("format-indent-more"));
993  a->setText(i18n("&Indent"));
994  a->setWhatsThis(i18n("Use this to indent a selected block of text.<br /><br />"
995  "You can configure whether tabs should be honored and used or replaced with spaces, in the configuration dialog."));
996  a->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_I));
997  connect(a, SIGNAL(triggered(bool)), SLOT(indent()));
998 
999  a = ac->addAction("tools_unindent");
1000  a->setIcon(KIcon("format-indent-less"));
1001  a->setText(i18n("&Unindent"));
1002  a->setWhatsThis(i18n("Use this to unindent a selected block of text."));
1003  a->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_I));
1004  connect(a, SIGNAL(triggered(bool)), SLOT(unIndent()));
1005  }
1006 
1007  if( hasFocus() )
1008  slotGotFocus();
1009  else
1010  slotLostFocus();
1011 }
1012 
1013 void KateView::setupCodeFolding()
1014 {
1015  //FIXME: FOLDING
1016  KActionCollection *ac=this->actionCollection();
1017 
1018  KAction* a;
1019 
1020  a = ac->addAction("folding_toplevel");
1021  a->setText(i18n("Fold Toplevel Nodes"));
1022  a->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Minus));
1023  connect(a, SIGNAL(triggered(bool)), SLOT(slotFoldToplevelNodes()));
1024 
1025  /*a = ac->addAction("folding_expandtoplevel");
1026  a->setText(i18n("Unfold Toplevel Nodes"));
1027  a->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Plus));
1028  connect(a, SIGNAL(triggered(bool)), m_doc->foldingTree(), SLOT(expandToplevelNodes()));
1029 
1030  a = ac->addAction("folding_expandall");
1031  a->setText(i18n("Unfold All Nodes"));
1032  connect(a, SIGNAL(triggered(bool)), m_doc->foldingTree(), SLOT(expandAll()));
1033 
1034  a = ac->addAction("folding_collapse_dsComment");
1035  a->setText(i18n("Fold Multiline Comments"));
1036  connect(a, SIGNAL(triggered(bool)), m_doc->foldingTree(), SLOT(collapseAll_dsComments()));
1037 */
1038  a = ac->addAction("folding_collapselocal");
1039  a->setText(i18n("Fold Current Node"));
1040  connect(a, SIGNAL(triggered(bool)), SLOT(slotCollapseLocal()));
1041 
1042  a = ac->addAction("folding_expandlocal");
1043  a->setText(i18n("Unfold Current Node"));
1044  connect(a, SIGNAL(triggered(bool)), SLOT(slotExpandLocal()));
1045 }
1046 
1047 void KateView::slotFoldToplevelNodes()
1048 {
1049  // FIXME: more performant implementation
1050  for (int line = 0; line < doc()->lines(); ++line) {
1051  if (textFolding().isLineVisible(line)) {
1052  foldLine(line);
1053  }
1054  }
1055 }
1056 
1057 void KateView::slotCollapseLocal()
1058 {
1059  foldLine (cursorPosition().line());
1060 }
1061 
1062 void KateView::slotExpandLocal()
1063 {
1064  unfoldLine (cursorPosition().line());
1065 }
1066 
1067 void KateView::slotCollapseLevel()
1068 {
1069  //FIXME: FOLDING
1070 #if 0
1071  if (!sender()) return;
1072  QAction *action = qobject_cast<QAction*>(sender());
1073  if (!action) return;
1074 
1075  const int level = action->data().toInt();
1076  Q_ASSERT(level > 0);
1077  m_doc->foldingTree()->collapseLevel(level);
1078 #endif
1079 }
1080 
1081 void KateView::slotExpandLevel()
1082 {
1083  //FIXME: FOLDING
1084 #if 0
1085  if (!sender()) return;
1086  QAction *action = qobject_cast<QAction*>(sender());
1087  if (!action) return;
1088 
1089  const int level = action->data().toInt();
1090  Q_ASSERT(level > 0);
1091  m_doc->foldingTree()->expandLevel(level);
1092 #endif
1093 }
1094 
1095 void KateView::foldLine (int startLine)
1096 {
1097  // only for valid lines
1098  if (startLine < 0)
1099  return;
1100 
1101  // try to fold all known ranges
1102  QVector<QPair<qint64, Kate::TextFolding::FoldingRangeFlags> > startingRanges = textFolding().foldingRangesStartingOnLine (startLine);
1103  for (int i = 0; i < startingRanges.size(); ++i)
1104  textFolding().foldRange (startingRanges[i].first);
1105 
1106  // try if the highlighting can help us and create a fold
1107  textFolding().newFoldingRange (doc()->buffer().computeFoldingRangeForStartLine (startLine), Kate::TextFolding::Folded);
1108 }
1109 
1110 void KateView::unfoldLine (int startLine)
1111 {
1112  // only for valid lines
1113  if (startLine < 0)
1114  return;
1115 
1116  // try to unfold all known ranges
1117  QVector<QPair<qint64, Kate::TextFolding::FoldingRangeFlags> > startingRanges = textFolding().foldingRangesStartingOnLine (startLine);
1118  for (int i = 0; i < startingRanges.size(); ++i)
1119  textFolding().unfoldRange (startingRanges[i].first);
1120 }
1121 
1122 KTextEditor::View::EditMode KateView::viewEditMode() const
1123 {
1124  if (viInputMode())
1125  return EditViMode;
1126 
1127  return isOverwriteMode() ? EditOverwrite : EditInsert;
1128 }
1129 
1130 QString KateView::viewMode () const
1131 {
1135  QString currentMode = isOverwriteMode() ? i18n("OVR") : i18n ("INS");
1136 
1140  if (viInputMode()) {
1141  currentMode = KateViInputModeManager::modeToString (getCurrentViMode());
1142 
1143  if (m_viewInternal->getViInputModeManager()->isRecordingMacro())
1144  {
1145  currentMode += " (" + i18n("recording") + ") ";
1146  }
1147 
1151  QString cmd = m_viewInternal->getViInputModeManager()->getVerbatimKeys();
1152  if (!cmd.isEmpty())
1153  currentMode.append (QString (" <em>%1</em>").arg (cmd));
1154 
1158  currentMode = QString ("<b>%1</b>").arg (currentMode);
1159  }
1160 
1164  if (!m_doc->isReadWrite())
1165  currentMode = i18n ("%1 (R/O)", currentMode);
1166 
1170  return currentMode;
1171 }
1172 
1173 void KateView::slotGotFocus()
1174 {
1175  //kDebug(13020) << "KateView::slotGotFocus";
1176 
1177  if ( !viInputMode() ) {
1178  activateEditActions();
1179  }
1180  emit focusIn ( this );
1181 }
1182 
1183 void KateView::slotLostFocus()
1184 {
1185  //kDebug(13020) << "KateView::slotLostFocus";
1186 
1187  if ( !viInputMode() ) {
1188  deactivateEditActions();
1189  }
1190 
1191  emit focusOut ( this );
1192 }
1193 
1194 void KateView::setDynWrapIndicators(int mode)
1195 {
1196  config()->setDynWordWrapIndicators (mode);
1197 }
1198 
1199 bool KateView::isOverwriteMode() const
1200 {
1201  return m_doc->config()->ovr();
1202 }
1203 
1204 void KateView::reloadFile()
1205 {
1206  // bookmarks and cursor positions are temporarily saved by the document
1207  m_doc->documentReload();
1208 }
1209 
1210 void KateView::slotReadWriteChanged ()
1211 {
1212  if ( m_toggleWriteLock )
1213  m_toggleWriteLock->setChecked( ! m_doc->isReadWrite() );
1214 
1215  m_cut->setEnabled (m_doc->isReadWrite() && (selection() || m_config->smartCopyCut()));
1216  m_paste->setEnabled (m_doc->isReadWrite());
1217  m_pasteMenu->setEnabled (m_doc->isReadWrite() && !KateGlobal::self()->clipboardHistory().isEmpty());
1218  m_setEndOfLine->setEnabled (m_doc->isReadWrite());
1219 
1220  QStringList l;
1221 
1222  l << "edit_replace" << "tools_spelling" << "tools_indent"
1223  << "tools_unindent" << "tools_cleanIndent" << "tools_align" << "tools_comment"
1224  << "tools_uncomment" << "tools_toggle_comment" << "tools_uppercase" << "tools_lowercase"
1225  << "tools_capitalize" << "tools_join_lines" << "tools_apply_wordwrap"
1226  << "tools_spelling_from_cursor"
1227  << "tools_spelling_selection" << "tools_create_snippet";
1228 
1229  QAction *a = 0;
1230  for (int z = 0; z < l.size(); z++)
1231  if ((a = actionCollection()->action( l[z].toAscii().constData() )))
1232  a->setEnabled (m_doc->isReadWrite());
1233  slotUpdateUndo();
1234 
1235  // inform search bar
1236  if (m_searchBar)
1237  m_searchBar->slotReadWriteChanged ();
1238 
1239  // => view mode changed
1240  emit viewModeChanged(this);
1241  emit viewEditModeChanged(this,viewEditMode());
1242 }
1243 
1244 void KateView::slotClipboardHistoryChanged ()
1245 {
1246  m_pasteMenu->setEnabled (m_doc->isReadWrite() && !KateGlobal::self()->clipboardHistory().isEmpty());
1247 }
1248 
1249 void KateView::slotUpdateUndo()
1250 {
1251  if (m_doc->readOnly())
1252  return;
1253 
1254  m_editUndo->setEnabled(m_doc->isReadWrite() && m_doc->undoCount() > 0);
1255  m_editRedo->setEnabled(m_doc->isReadWrite() && m_doc->redoCount() > 0);
1256 }
1257 
1258 void KateView::slotDropEventPass( QDropEvent * ev )
1259 {
1260  const KUrl::List lstDragURLs=KUrl::List::fromMimeData(ev->mimeData());
1261  bool ok = !lstDragURLs.isEmpty();
1262 
1263  KParts::BrowserExtension * ext = KParts::BrowserExtension::childObject( doc() );
1264  if ( ok && ext )
1265  emit ext->openUrlRequest( lstDragURLs.first() );
1266 }
1267 
1268 void KateView::contextMenuEvent( QContextMenuEvent *ev )
1269 {
1270  if ( !m_doc || !m_doc->browserExtension() )
1271  return;
1272  KParts::OpenUrlArguments args;
1273  args.setMimeType( QLatin1String("text/plain") );
1274  emit m_doc->browserExtension()->popupMenu( ev->globalPos(), m_doc->url(), S_IFREG, args );
1275  ev->accept();
1276 }
1277 
1278 bool KateView::setCursorPositionInternal( const KTextEditor::Cursor& position, uint tabwidth, bool calledExternally )
1279 {
1280  Kate::TextLine l = m_doc->kateTextLine( position.line() );
1281 
1282  if (!l)
1283  return false;
1284 
1285  QString line_str = m_doc->line( position.line() );
1286 
1287  int x = 0;
1288  int z = 0;
1289  for (; z < line_str.length() && z < position.column(); z++) {
1290  if (line_str[z] == QChar('\t')) x += tabwidth - (x % tabwidth); else x++;
1291  }
1292 
1293  if (blockSelection())
1294  if (z < position.column())
1295  x += position.column() - z;
1296 
1297  m_viewInternal->updateCursor( KTextEditor::Cursor(position.line(), x), false, true, calledExternally );
1298 
1299  return true;
1300 }
1301 
1302 void KateView::toggleInsert()
1303 {
1304  m_doc->config()->setOvr(!m_doc->config()->ovr());
1305  m_toggleInsert->setChecked (isOverwriteMode ());
1306 
1307  emit viewModeChanged(this);
1308  emit viewEditModeChanged(this,viewEditMode());
1309 }
1310 
1311 void KateView::slotSaveCanceled( const QString& error )
1312 {
1313  if ( !error.isEmpty() ) // happens when canceling a job
1314  KMessageBox::error( this, error );
1315 }
1316 
1317 void KateView::gotoLine()
1318 {
1319  gotoBar()->updateData();
1320  bottomViewBar()->showBarWidget(gotoBar());
1321 }
1322 
1323 void KateView::changeDictionary()
1324 {
1325  dictionaryBar()->updateData();
1326  bottomViewBar()->showBarWidget(dictionaryBar());
1327 }
1328 
1329 void KateView::joinLines()
1330 {
1331  int first = selectionRange().start().line();
1332  int last = selectionRange().end().line();
1333  //int left = m_doc->line( last ).length() - m_doc->selEndCol();
1334  if ( first == last )
1335  {
1336  first = cursorPosition().line();
1337  last = first + 1;
1338  }
1339  m_doc->joinLines( first, last );
1340 }
1341 
1342 void KateView::readSessionConfig(const KConfigGroup& config)
1343 {
1344  // cursor position
1345  setCursorPositionInternal(KTextEditor::Cursor(config.readEntry("CursorLine",0), config.readEntry("CursorColumn",0)));
1346 
1347  // TODO: text folding state
1348 // m_savedFoldingState = config.readEntry("TextFolding", QVariantList());
1349 // applyFoldingState ();
1350 
1351  // save vi registers and jump list
1352  getViInputModeManager()->readSessionConfig( config );
1353 }
1354 
1355 void KateView::writeSessionConfig(KConfigGroup& config)
1356 {
1357  // cursor position
1358  config.writeEntry("CursorLine",m_viewInternal->m_cursor.line());
1359  config.writeEntry("CursorColumn",m_viewInternal->m_cursor.column());
1360 
1361  // TODO: text folding state
1362 // saveFoldingState();
1363 // config.writeEntry("TextFolding", m_savedFoldingState);
1364 // m_savedFoldingState.clear ();
1365 
1366  // save vi registers and jump list
1367  getViInputModeManager()->writeSessionConfig( config );
1368 }
1369 
1370 int KateView::getEol() const
1371 {
1372  return m_doc->config()->eol();
1373 }
1374 
1375 void KateView::setEol(int eol)
1376 {
1377  if (!doc()->isReadWrite())
1378  return;
1379 
1380  if (m_updatingDocumentConfig)
1381  return;
1382 
1383  if (eol != m_doc->config()->eol()) {
1384  m_doc->setModified(true); // mark modified (bug #143120)
1385  m_doc->config()->setEol (eol);
1386  }
1387 }
1388 
1389 void KateView::setAddBom(bool enabled)
1390 {
1391  if (!doc()->isReadWrite())
1392  return;
1393 
1394  if (m_updatingDocumentConfig)
1395  return;
1396 
1397  m_doc->config()->setBom (enabled);
1398  m_doc->bomSetByUser();
1399 }
1400 
1401 void KateView::setIconBorder( bool enable )
1402 {
1403  config()->setIconBar (enable);
1404 }
1405 
1406 void KateView::toggleIconBorder()
1407 {
1408  config()->setIconBar (!config()->iconBar());
1409 }
1410 
1411 void KateView::setLineNumbersOn( bool enable )
1412 {
1413  config()->setLineNumbers (enable);
1414 }
1415 
1416 void KateView::toggleLineNumbersOn()
1417 {
1418  config()->setLineNumbers (!config()->lineNumbers());
1419 }
1420 
1421 void KateView::setScrollBarMarks( bool enable )
1422 {
1423  config()->setScrollBarMarks (enable);
1424 }
1425 
1426 void KateView::toggleScrollBarMarks()
1427 {
1428  config()->setScrollBarMarks (!config()->scrollBarMarks());
1429 }
1430 
1431 void KateView::setScrollBarMiniMap( bool enable )
1432 {
1433  config()->setScrollBarMiniMap (enable);
1434 }
1435 
1436 void KateView::toggleScrollBarMiniMap()
1437 {
1438  config()->setScrollBarMiniMap (!config()->scrollBarMiniMap());
1439 }
1440 
1441 void KateView::setScrollBarMiniMapAll( bool enable )
1442 {
1443  config()->setScrollBarMiniMapAll (enable);
1444 }
1445 
1446 void KateView::toggleScrollBarMiniMapAll()
1447 {
1448  config()->setScrollBarMiniMapAll (!config()->scrollBarMiniMapAll());
1449 }
1450 
1451 void KateView::setScrollBarMiniMapWidth( int width )
1452 {
1453  config()->setScrollBarMiniMapWidth (width);
1454 }
1455 
1456 void KateView::toggleDynWordWrap()
1457 {
1458  config()->setDynWordWrap( !config()->dynWordWrap() );
1459 }
1460 
1461 void KateView::toggleWWMarker()
1462 {
1463  m_renderer->config()->setWordWrapMarker (!m_renderer->config()->wordWrapMarker());
1464 }
1465 
1466 void KateView::setFoldingMarkersOn( bool enable )
1467 {
1468  config()->setFoldingBar ( enable );
1469 }
1470 
1471 void KateView::toggleFoldingMarkers()
1472 {
1473  config()->setFoldingBar ( !config()->foldingBar() );
1474 }
1475 
1476 bool KateView::iconBorder() {
1477  return m_viewInternal->m_leftBorder->iconBorderOn();
1478 }
1479 
1480 bool KateView::lineNumbersOn() {
1481  return m_viewInternal->m_leftBorder->lineNumbersOn();
1482 }
1483 
1484 bool KateView::scrollBarMarks() {
1485  return m_viewInternal->m_lineScroll->showMarks();
1486 }
1487 
1488 bool KateView::scrollBarMiniMap() {
1489  return m_viewInternal->m_lineScroll->showMiniMap();
1490 }
1491 
1492 int KateView::dynWrapIndicators() {
1493  return m_viewInternal->m_leftBorder->dynWrapIndicators();
1494 }
1495 
1496 bool KateView::foldingMarkersOn() {
1497  return m_viewInternal->m_leftBorder->foldingMarkersOn();
1498 }
1499 
1500 void KateView::toggleWriteLock()
1501 {
1502  m_doc->setReadWrite( ! m_doc->isReadWrite() );
1503 }
1504 
1505 void KateView::enableTextHints(int timeout)
1506 {
1507  m_viewInternal->enableTextHints(timeout);
1508 }
1509 
1510 void KateView::disableTextHints()
1511 {
1512  m_viewInternal->disableTextHints();
1513 }
1514 
1515 bool KateView::viInputMode() const
1516 {
1517  return m_viewInternal->m_viInputMode;
1518 }
1519 
1520 bool KateView::viInputModeStealKeys() const
1521 {
1522  return m_viewInternal->m_viInputModeStealKeys;
1523 }
1524 
1525 void KateView::toggleViInputMode()
1526 {
1527  config()->setViInputMode (!config()->viInputMode());
1528 
1529  if ( viInputMode() ) {
1530  m_viewInternal->getViInputModeManager()->viEnterNormalMode();
1531  deactivateEditActions();
1532  } else { // disabling the vi input mode
1533  activateEditActions();
1534  }
1535 
1536  emit viewModeChanged(this);
1537  emit viewEditModeChanged(this,viewEditMode());
1538 }
1539 
1540 void KateView::showViModeEmulatedCommandBar()
1541 {
1542  if (viInputMode() && config()->viInputModeEmulateCommandBar()) {
1543  bottomViewBar()->addBarWidget(viModeEmulatedCommandBar());
1544  bottomViewBar()->showBarWidget(viModeEmulatedCommandBar());
1545  }
1546 }
1547 
1548 void KateView::updateViModeBarMode()
1549 {
1550  // view mode changed => status bar in container apps might change!
1551  emit viewModeChanged (this);
1552  emit viewEditModeChanged(this,viewEditMode());
1553 }
1554 
1555 void KateView::updateViModeBarCmd()
1556 {
1557  // view mode changed => status bar in container apps might change!
1558  emit viewModeChanged (this);
1559  emit viewEditModeChanged(this,viewEditMode());
1560 }
1561 
1562 ViMode KateView::getCurrentViMode() const
1563 {
1564  return m_viewInternal->getCurrentViMode();
1565 }
1566 
1567 KateViInputModeManager* KateView::getViInputModeManager()
1568 {
1569  return m_viewInternal->getViInputModeManager();
1570 }
1571 
1572 KateViInputModeManager* KateView::resetViInputModeManager()
1573 {
1574  return m_viewInternal->resetViInputModeManager();
1575 }
1576 
1577 void KateView::find()
1578 {
1579  const bool INIT_HINT_AS_INCREMENTAL = false;
1580  KateSearchBar * const bar = searchBar(INIT_HINT_AS_INCREMENTAL);
1581  bar->enterIncrementalMode();
1582  bottomViewBar()->addBarWidget(bar);
1583  bottomViewBar()->showBarWidget(bar);
1584  bar->setFocus();
1585 }
1586 
1587 void KateView::findSelectedForwards()
1588 {
1589  KateSearchBar::nextMatchForSelection(this, KateSearchBar::SearchForward);
1590 }
1591 
1592 void KateView::findSelectedBackwards()
1593 {
1594  KateSearchBar::nextMatchForSelection(this, KateSearchBar::SearchBackward);
1595 }
1596 
1597 void KateView::replace()
1598 {
1599  const bool INIT_HINT_AS_POWER = true;
1600  KateSearchBar * const bar = searchBar(INIT_HINT_AS_POWER);
1601  bar->enterPowerMode();
1602  bottomViewBar()->addBarWidget(bar);
1603  bottomViewBar()->showBarWidget(bar);
1604  bar->setFocus();
1605 }
1606 
1607 void KateView::findNext()
1608 {
1609  searchBar()->findNext();
1610 }
1611 
1612 void KateView::findPrevious()
1613 {
1614  searchBar()->findPrevious();
1615 }
1616 
1617 void KateView::slotSelectionChanged ()
1618 {
1619  m_copy->setEnabled (selection() || m_config->smartCopyCut());
1620  m_deSelect->setEnabled (selection());
1621 
1622  if (m_doc->readOnly())
1623  return;
1624 
1625  m_cut->setEnabled (selection() || m_config->smartCopyCut() );
1626 
1627  actionCollection()->action ("tools_create_snippet")->setEnabled (selection());
1628 
1629  m_spell->updateActions ();
1630 }
1631 
1632 void KateView::switchToCmdLine ()
1633 {
1634  // if the user has selected text, insert the selection's range (start line to end line) in the
1635  // command line when opened
1636  if (selectionRange().start().line() != -1 && selectionRange().end().line() != -1) {
1637  cmdLineBar()->setText(QString::number(selectionRange().start().line()+1)+','
1638  +QString::number(selectionRange().end().line()+1));
1639  }
1640  bottomViewBar()->showBarWidget(cmdLineBar());
1641  cmdLineBar()->setFocus ();
1642 }
1643 
1644 void KateView::switchToConsole ()
1645 {
1646  if (!m_console)
1647  m_console = new KateScriptConsole (this, bottomViewBar());
1648  bottomViewBar()->addBarWidget(m_console);
1649  bottomViewBar()->showBarWidget(m_console);
1650  m_console->setFocus ();
1651 }
1652 
1653 KateRenderer *KateView::renderer ()
1654 {
1655  return m_renderer;
1656 }
1657 
1658 void KateView::updateConfig ()
1659 {
1660  if (m_startingUp)
1661  return;
1662 
1663  // dyn. word wrap & markers
1664  if (m_hasWrap != config()->dynWordWrap()) {
1665  m_viewInternal->prepareForDynWrapChange();
1666 
1667  m_hasWrap = config()->dynWordWrap();
1668 
1669  m_viewInternal->dynWrapChanged();
1670 
1671  m_setDynWrapIndicators->setEnabled(config()->dynWordWrap());
1672  m_toggleDynWrap->setChecked( config()->dynWordWrap() );
1673  }
1674 
1675  m_viewInternal->m_leftBorder->setDynWrapIndicators( config()->dynWordWrapIndicators() );
1676  m_setDynWrapIndicators->setCurrentItem( config()->dynWordWrapIndicators() );
1677 
1678  // line numbers
1679  m_viewInternal->m_leftBorder->setLineNumbersOn( config()->lineNumbers() );
1680  m_toggleLineNumbers->setChecked( config()->lineNumbers() );
1681 
1682  // icon bar
1683  m_viewInternal->m_leftBorder->setIconBorderOn( config()->iconBar() );
1684  m_toggleIconBar->setChecked( config()->iconBar() );
1685 
1686  // scrollbar marks
1687  m_viewInternal->m_lineScroll->setShowMarks( config()->scrollBarMarks() );
1688  m_toggleScrollBarMarks->setChecked( config()->scrollBarMarks() );
1689 
1690  // scrollbar mini-map
1691  m_viewInternal->m_lineScroll->setShowMiniMap( config()->scrollBarMiniMap() );
1692  m_toggleScrollBarMiniMap->setChecked( config()->scrollBarMiniMap() );
1693 
1694  // scrollbar mini-map - (whole document)
1695  m_viewInternal->m_lineScroll->setMiniMapAll( config()->scrollBarMiniMapAll() );
1696  //m_toggleScrollBarMiniMapAll->setChecked( config()->scrollBarMiniMapAll() );
1697 
1698  // scrollbar mini-map.width
1699  m_viewInternal->m_lineScroll->setMiniMapWidth( config()->scrollBarMiniMapWidth() );
1700 
1701  // misc edit
1702  m_toggleBlockSelection->setChecked( blockSelection() );
1703  m_toggleInsert->setChecked( isOverwriteMode() );
1704 
1705  // vi modes
1706  m_viInputModeAction->setChecked( config()->viInputMode() );
1707 
1708  updateFoldingConfig ();
1709 
1710  // bookmark
1711  m_bookmarks->setSorting( (KateBookmarks::Sorting) config()->bookmarkSort() );
1712 
1713  m_viewInternal->setAutoCenterLines(config()->autoCenterLines ());
1714 
1715  // vi input mode
1716  m_viewInternal->m_viInputMode = config()->viInputMode();
1717 
1718  // whether vi input mode should override actions or not
1719  m_viewInternal->m_viInputModeStealKeys = config()->viInputModeStealKeys();
1720 
1721  reflectOnTheFlySpellCheckStatus(m_doc->isOnTheFlySpellCheckingEnabled());
1722 
1723  // register/unregister word completion...
1724  unregisterCompletionModel (KateGlobal::self()->wordCompletionModel());
1725  if (config()->wordCompletion ())
1726  registerCompletionModel (KateGlobal::self()->wordCompletionModel());
1727 
1728  // add snippet completion, later with option
1729  unregisterCompletionModel (KateGlobal::self()->snippetGlobal()->completionModel());
1730  if (1)
1731  registerCompletionModel (KateGlobal::self()->snippetGlobal()->completionModel());
1732 
1733  m_cut->setEnabled(m_doc->isReadWrite() && (selection() || m_config->smartCopyCut()));
1734  m_copy->setEnabled(selection() || m_config->smartCopyCut());
1735 
1736  // now redraw...
1737  m_viewInternal->cache()->clear();
1738  tagAll ();
1739  updateView (true);
1740 
1741  emit configChanged();
1742 }
1743 
1744 void KateView::updateDocumentConfig()
1745 {
1746  if (m_startingUp)
1747  return;
1748 
1749  m_updatingDocumentConfig = true;
1750 
1751  m_setEndOfLine->setCurrentItem (m_doc->config()->eol());
1752 
1753  m_addBom->setChecked(m_doc->config()->bom());
1754 
1755  m_updatingDocumentConfig = false;
1756 
1757  // maybe block selection or wrap-cursor mode changed
1758  ensureCursorColumnValid();
1759 
1760  // first change this
1761  m_renderer->setTabWidth (m_doc->config()->tabWidth());
1762  m_renderer->setIndentWidth (m_doc->config()->indentationWidth());
1763 
1764  // now redraw...
1765  m_viewInternal->cache()->clear();
1766  tagAll ();
1767  updateView (true);
1768 }
1769 
1770 void KateView::updateRendererConfig()
1771 {
1772  if (m_startingUp)
1773  return;
1774 
1775  m_toggleWWMarker->setChecked( m_renderer->config()->wordWrapMarker() );
1776 
1777  m_viewInternal->updateBracketMarkAttributes();
1778  m_viewInternal->updateBracketMarks();
1779 
1780  if (m_searchBar) {
1781  m_searchBar->updateHighlightColors();
1782  }
1783 
1784  // now redraw...
1785  m_viewInternal->cache()->clear();
1786  tagAll ();
1787  m_viewInternal->updateView (true);
1788 
1789  // update the left border right, for example linenumbers
1790  m_viewInternal->m_leftBorder->updateFont();
1791  m_viewInternal->m_leftBorder->repaint ();
1792 
1793  m_viewInternal->m_lineScroll->queuePixmapUpdate ();
1794 
1795 // @@ showIndentLines is not cached anymore.
1796 // m_renderer->setShowIndentLines (m_renderer->config()->showIndentationLines());
1797  emit configChanged();
1798 }
1799 
1800 void KateView::updateFoldingConfig ()
1801 {
1802  // folding bar
1803  m_viewInternal->m_leftBorder->setFoldingMarkersOn(config()->foldingBar());
1804  m_toggleFoldingMarkers->setChecked( config()->foldingBar() );
1805 
1806 #if 0
1807  // FIXME: FOLDING
1808  QStringList l;
1809 
1810  l << "folding_toplevel" << "folding_expandtoplevel"
1811  << "folding_collapselocal" << "folding_expandlocal";
1812 
1813  QAction *a = 0;
1814  for (int z = 0; z < l.size(); z++)
1815  if ((a = actionCollection()->action( l[z].toAscii().constData() )))
1816  a->setEnabled (m_doc->highlight() && m_doc->highlight()->allowsFolding());
1817 #endif
1818 }
1819 
1820 void KateView::ensureCursorColumnValid()
1821 {
1822  KTextEditor::Cursor c = m_viewInternal->getCursor();
1823 
1824  // make sure the cursor is valid:
1825  // - in block selection mode or if wrap cursor is off, the column is arbitrary
1826  // - otherwise: it's bounded by the line length
1827  if (!blockSelection() && wrapCursor()
1828  && (!c.isValid() || c.column() > m_doc->lineLength(c.line())))
1829  {
1830  c.setColumn(m_doc->kateTextLine(cursorPosition().line())->length());
1831  setCursorPosition(c);
1832  }
1833 }
1834 
1835 //BEGIN EDIT STUFF
1836 void KateView::editStart ()
1837 {
1838  m_viewInternal->editStart ();
1839 }
1840 
1841 void KateView::editEnd (int editTagLineStart, int editTagLineEnd, bool tagFrom)
1842 {
1843  m_viewInternal->editEnd (editTagLineStart, editTagLineEnd, tagFrom);
1844 }
1845 
1846 void KateView::editSetCursor (const KTextEditor::Cursor &cursor)
1847 {
1848  m_viewInternal->editSetCursor (cursor);
1849 }
1850 //END
1851 
1852 //BEGIN TAG & CLEAR
1853 bool KateView::tagLine (const KTextEditor::Cursor& virtualCursor)
1854 {
1855  return m_viewInternal->tagLine (virtualCursor);
1856 }
1857 
1858 bool KateView::tagRange(const KTextEditor::Range& range, bool realLines)
1859 {
1860  return m_viewInternal->tagRange(range, realLines);
1861 }
1862 
1863 bool KateView::tagLines (int start, int end, bool realLines)
1864 {
1865  return m_viewInternal->tagLines (start, end, realLines);
1866 }
1867 
1868 bool KateView::tagLines (KTextEditor::Cursor start, KTextEditor::Cursor end, bool realCursors)
1869 {
1870  return m_viewInternal->tagLines (start, end, realCursors);
1871 }
1872 
1873 void KateView::tagAll ()
1874 {
1875  m_viewInternal->tagAll ();
1876 }
1877 
1878 void KateView::clear ()
1879 {
1880  m_viewInternal->clear ();
1881 }
1882 
1883 void KateView::repaintText (bool paintOnlyDirty)
1884 {
1885  if (paintOnlyDirty)
1886  m_viewInternal->updateDirty();
1887  else
1888  m_viewInternal->update();
1889 }
1890 
1891 void KateView::updateView (bool changed)
1892 {
1893  //kDebug(13020) << "KateView::updateView";
1894 
1895  m_viewInternal->updateView (changed);
1896  m_viewInternal->m_leftBorder->update();
1897 }
1898 
1899 //END
1900 
1901 void KateView::slotHlChanged()
1902 {
1903  KateHighlighting *hl = m_doc->highlight();
1904  bool ok ( !hl->getCommentStart(0).isEmpty() || !hl->getCommentSingleLineStart(0).isEmpty() );
1905 
1906  if (actionCollection()->action("tools_comment"))
1907  actionCollection()->action("tools_comment")->setEnabled( ok );
1908 
1909  if (actionCollection()->action("tools_uncomment"))
1910  actionCollection()->action("tools_uncomment")->setEnabled( ok );
1911 
1912  if (actionCollection()->action("tools_toggle_comment"))
1913  actionCollection()->action("tools_toggle_comment")->setEnabled( ok );
1914 
1915  // show folding bar if "view defaults" says so, otherwise enable/disable only the menu entry
1916  updateFoldingConfig ();
1917 }
1918 
1919 int KateView::virtualCursorColumn() const
1920 {
1921  return m_doc->toVirtualColumn(m_viewInternal->getCursor());
1922 }
1923 
1924 void KateView::notifyMousePositionChanged(const KTextEditor::Cursor& newPosition)
1925 {
1926  emit mousePositionChanged(this, newPosition);
1927 }
1928 
1929 //BEGIN KTextEditor::SelectionInterface stuff
1930 
1931 bool KateView::setSelection( const KTextEditor::Range &selection )
1932 {
1936  if (selection == m_selection)
1937  return true;
1938 
1942  KTextEditor::Range oldSelection = m_selection;
1943 
1947  m_selection.setRange (selection.isEmpty() ? KTextEditor::Range::invalid() : selection);
1948 
1952  tagSelection(oldSelection);
1953  repaintText(true);
1954 
1958  emit selectionChanged (this);
1959 
1963  return true;
1964 }
1965 
1966 bool KateView::clearSelection()
1967 {
1968  return clearSelection (true);
1969 }
1970 
1971 bool KateView::clearSelection(bool redraw, bool finishedChangingSelection)
1972 {
1976  if( !selection() )
1977  return false;
1978 
1982  KTextEditor::Range oldSelection = m_selection;
1983 
1987  m_selection.setRange (KTextEditor::Range::invalid());
1988 
1992  tagSelection(oldSelection);
1993  if (redraw)
1994  repaintText(true);
1995 
1999  if (finishedChangingSelection)
2000  emit selectionChanged (this);
2001 
2005  return true;
2006 }
2007 
2008 bool KateView::selection() const
2009 {
2010  if (!wrapCursor())
2011  return m_selection != KTextEditor::Range::invalid();
2012  else
2013  return m_selection.toRange().isValid();
2014 }
2015 
2016 QString KateView::selectionText() const
2017 {
2018  return m_doc->text(m_selection, blockSelect);
2019 }
2020 
2021 bool KateView::removeSelectedText()
2022 {
2023  if (!selection())
2024  return false;
2025 
2026  m_doc->editStart ();
2027 
2028  // Optimization: clear selection before removing text
2029  KTextEditor::Range selection = m_selection;
2030 
2031  m_doc->removeText(selection, blockSelect);
2032 
2033  // don't redraw the cleared selection - that's done in editEnd().
2034  if (blockSelect) {
2035  int selectionColumn = qMin(m_doc->toVirtualColumn(selection.start()), m_doc->toVirtualColumn(selection.end()));
2036  KTextEditor::Range newSelection = selection;
2037  newSelection.start().setColumn(m_doc->fromVirtualColumn(newSelection.start().line(), selectionColumn));
2038  newSelection.end().setColumn(m_doc->fromVirtualColumn(newSelection.end().line(), selectionColumn));
2039  setSelection(newSelection);
2040  setCursorPositionInternal(newSelection.start());
2041  }
2042  else
2043  clearSelection(false);
2044 
2045  m_doc->editEnd ();
2046 
2047  return true;
2048 }
2049 
2050 bool KateView::selectAll()
2051 {
2052  setBlockSelection (false);
2053  top();
2054  shiftBottom();
2055  return true;
2056 }
2057 
2058 bool KateView::cursorSelected(const KTextEditor::Cursor& cursor)
2059 {
2060  KTextEditor::Cursor ret = cursor;
2061  if ( (!blockSelect) && (ret.column() < 0) )
2062  ret.setColumn(0);
2063 
2064  if (blockSelect)
2065  return cursor.line() >= m_selection.start().line() && ret.line() <= m_selection.end().line()
2066  && ret.column() >= m_selection.start().column() && ret.column() <= m_selection.end().column();
2067  else
2068  return m_selection.toRange().contains(cursor) || m_selection.end() == cursor;
2069 }
2070 
2071 bool KateView::lineSelected (int line)
2072 {
2073  return !blockSelect && m_selection.toRange().containsLine(line);
2074 }
2075 
2076 bool KateView::lineEndSelected (const KTextEditor::Cursor& lineEndPos)
2077 {
2078  return (!blockSelect)
2079  && (lineEndPos.line() > m_selection.start().line() || (lineEndPos.line() == m_selection.start().line() && (m_selection.start().column() < lineEndPos.column() || lineEndPos.column() == -1)))
2080  && (lineEndPos.line() < m_selection.end().line() || (lineEndPos.line() == m_selection.end().line() && (lineEndPos.column() <= m_selection.end().column() && lineEndPos.column() != -1)));
2081 }
2082 
2083 bool KateView::lineHasSelected (int line)
2084 {
2085  return selection() && m_selection.toRange().containsLine(line);
2086 }
2087 
2088 bool KateView::lineIsSelection (int line)
2089 {
2090  return (line == m_selection.start().line() && line == m_selection.end().line());
2091 }
2092 
2093 void KateView::tagSelection(const KTextEditor::Range &oldSelection)
2094 {
2095  if (selection()) {
2096  if (oldSelection.start().line() == -1) {
2097  // We have to tag the whole lot if
2098  // 1) we have a selection, and:
2099  // a) it's new; or
2100  tagLines(m_selection, true);
2101 
2102  } else if (blockSelection() && (oldSelection.start().column() != m_selection.start().column() || oldSelection.end().column() != m_selection.end().column())) {
2103  // b) we're in block selection mode and the columns have changed
2104  tagLines(m_selection, true);
2105  tagLines(oldSelection, true);
2106 
2107  } else {
2108  if (oldSelection.start() != m_selection.start()) {
2109  if (oldSelection.start() < m_selection.start())
2110  tagLines(oldSelection.start(), m_selection.start(), true);
2111  else
2112  tagLines(m_selection.start(), oldSelection.start(), true);
2113  }
2114 
2115  if (oldSelection.end() != m_selection.end()) {
2116  if (oldSelection.end() < m_selection.end())
2117  tagLines(oldSelection.end(), m_selection.end(), true);
2118  else
2119  tagLines(m_selection.end(), oldSelection.end(), true);
2120  }
2121  }
2122 
2123  } else {
2124  // No more selection, clean up
2125  tagLines(oldSelection, true);
2126  }
2127 }
2128 
2129 void KateView::selectWord( const KTextEditor::Cursor& cursor )
2130 {
2131  // TODO: KDE5: reuse KateDocument::getWord() or rather KTextEditor::Document::wordRangeAt()
2132  // avoid code duplication of selectWord() here, and KateDocument::getWord()
2133  int start, end, len;
2134 
2135  Kate::TextLine textLine = m_doc->plainKateTextLine(cursor.line());
2136 
2137  if (!textLine)
2138  return;
2139 
2140  len = textLine->length();
2141  start = end = cursor.column();
2142  while (start > 0 && m_doc->highlight()->isInWord(textLine->at(start - 1), textLine->attribute(start - 1))) start--;
2143  while (end < len && m_doc->highlight()->isInWord(textLine->at(end), textLine->attribute(start - 1))) end++;
2144  if (end <= start) return;
2145 
2146  setSelection (KTextEditor::Range(cursor.line(), start, cursor.line(), end));
2147 }
2148 
2149 void KateView::selectLine( const KTextEditor::Cursor& cursor )
2150 {
2151  int line = cursor.line();
2152  if ( line+1 >= m_doc->lines() )
2153  setSelection (KTextEditor::Range(line, 0, line, m_doc->lineLength(line)));
2154  else
2155  setSelection (KTextEditor::Range(line, 0, line+1, 0));
2156 }
2157 
2158 void KateView::cut()
2159 {
2160  if (!selection() && !m_config->smartCopyCut())
2161  return;
2162 
2163  copy();
2164  if (!selection())
2165  selectLine(m_viewInternal->m_cursor);
2166  removeSelectedText();
2167 }
2168 
2169 void KateView::copy() const
2170 {
2171  QString text = selectionText();
2172 
2173  if (!selection()) {
2174  if (!m_config->smartCopyCut())
2175  return;
2176  text = m_doc->line(m_viewInternal->m_cursor.line()) + '\n';
2177  m_viewInternal->moveEdge(KateViewInternal::left, false);
2178  }
2179 
2180  // copy to clipboard and our history!
2181  KateGlobal::self()->copyToClipboard (text);
2182 }
2183 
2184 void KateView::applyWordWrap ()
2185 {
2186  if (selection())
2187  m_doc->wrapText (selectionRange().start().line(), selectionRange().end().line());
2188  else
2189  m_doc->wrapText (0, m_doc->lastLine());
2190 }
2191 
2192 //END
2193 
2194 //BEGIN KTextEditor::BlockSelectionInterface stuff
2195 
2196 bool KateView::blockSelection () const
2197 {
2198  return blockSelect;
2199 }
2200 
2201 bool KateView::setBlockSelection (bool on)
2202 {
2203  if (on != blockSelect)
2204  {
2205  blockSelect = on;
2206 
2207  KTextEditor::Range oldSelection = m_selection;
2208 
2209  const bool hadSelection = clearSelection(false, false);
2210 
2211  setSelection(oldSelection);
2212 
2213  m_toggleBlockSelection->setChecked( blockSelection() );
2214 
2215  // when leaving block selection mode, if cursor is at an invalid position or past the end of the
2216  // line, move the cursor to the last column of the current line unless cursor wrapping is off
2217  ensureCursorColumnValid();
2218 
2219  if (!hadSelection) {
2220  // emit selectionChanged() according to the KTextEditor::View api
2221  // documentation also if there is no selection around. This is needed,
2222  // as e.g. the Kate App status bar uses this signal to update the state
2223  // of the selection mode (block selection, line based selection)
2224  emit selectionChanged(this);
2225  }
2226  }
2227 
2228  return true;
2229 }
2230 
2231 bool KateView::toggleBlockSelection ()
2232 {
2233  m_toggleBlockSelection->setChecked (!blockSelect);
2234  return setBlockSelection (!blockSelect);
2235 }
2236 
2237 bool KateView::wrapCursor () const
2238 {
2239  return !blockSelection();
2240 }
2241 
2242 //END
2243 
2244 
2245 void KateView::slotTextInserted ( KTextEditor::View *view, const KTextEditor::Cursor &position, const QString &text)
2246 {
2247  emit textInserted ( view, position, text);
2248 }
2249 
2250 bool KateView::insertTemplateTextImplementation ( const KTextEditor::Cursor& c,
2251  const QString &templateString,
2252  const QMap<QString,QString> &initialValues)
2253 {
2254  return insertTemplateTextImplementation(c, templateString, initialValues, 0);
2255 }
2256 
2257 bool KateView::insertTemplateTextImplementation ( const KTextEditor::Cursor& c,
2258  const QString &templateString,
2259  const QMap<QString,QString> &initialValues,
2260  KTextEditor::TemplateScript* templateScript)
2261 {
2265  if (templateString.isEmpty())
2266  return false;
2267 
2271  if (!m_doc->isReadWrite())
2272  return false;
2273 
2277  KateTemplateScript* kateTemplateScript = KateGlobal::self()->scriptManager()->templateScript(templateScript);
2278 
2282  new KateTemplateHandler(this, c, templateString, initialValues, m_doc->undoManager(), kateTemplateScript);
2283  return true;
2284 }
2285 
2286 
2287 bool KateView::tagLines( KTextEditor::Range range, bool realRange )
2288 {
2289  return tagLines(range.start(), range.end(), realRange);
2290 }
2291 
2292 void KateView::deactivateEditActions()
2293 {
2294  foreach(QAction *action, m_editActions)
2295  action->setEnabled(false);
2296 }
2297 
2298 void KateView::activateEditActions()
2299 {
2300  foreach(QAction *action, m_editActions)
2301  action->setEnabled(true);
2302 }
2303 
2304 bool KateView::mouseTrackingEnabled( ) const
2305 {
2306  // FIXME support
2307  return true;
2308 }
2309 
2310 bool KateView::setMouseTrackingEnabled( bool )
2311 {
2312  // FIXME support
2313  return true;
2314 }
2315 
2316 bool KateView::isCompletionActive( ) const
2317 {
2318  return completionWidget()->isCompletionActive();
2319 }
2320 
2321 KateCompletionWidget* KateView::completionWidget() const
2322 {
2323  if (!m_completionWidget)
2324  m_completionWidget = new KateCompletionWidget(const_cast<KateView*>(this));
2325 
2326  return m_completionWidget;
2327 }
2328 
2329 void KateView::startCompletion( const KTextEditor::Range & word, KTextEditor::CodeCompletionModel * model )
2330 {
2331  completionWidget()->startCompletion(word, model);
2332 }
2333 
2334 void KateView::abortCompletion( )
2335 {
2336  completionWidget()->abortCompletion();
2337 }
2338 
2339 void KateView::forceCompletion( )
2340 {
2341  completionWidget()->execute();
2342 }
2343 
2344 void KateView::registerCompletionModel(KTextEditor::CodeCompletionModel* model)
2345 {
2346  completionWidget()->registerCompletionModel(model);
2347 }
2348 
2349 void KateView::unregisterCompletionModel(KTextEditor::CodeCompletionModel* model)
2350 {
2351  completionWidget()->unregisterCompletionModel(model);
2352 }
2353 
2354 bool KateView::isAutomaticInvocationEnabled() const
2355 {
2356  return m_config->automaticCompletionInvocation();
2357 }
2358 
2359 void KateView::setAutomaticInvocationEnabled(bool enabled)
2360 {
2361  config()->setAutomaticCompletionInvocation(enabled);
2362 }
2363 
2364 void KateView::sendCompletionExecuted(const KTextEditor::Cursor& position, KTextEditor::CodeCompletionModel* model, const QModelIndex& index)
2365 {
2366  emit completionExecuted(this, position, model, index);
2367 }
2368 
2369 void KateView::sendCompletionAborted()
2370 {
2371  emit completionAborted(this);
2372 }
2373 
2374 void KateView::paste(const QString *textToPaste)
2375 {
2376  const bool completionEnabled = isAutomaticInvocationEnabled();
2377  if (completionEnabled) {
2378  setAutomaticInvocationEnabled(false);
2379  }
2380 
2381  m_doc->paste( this, textToPaste ? *textToPaste : QApplication::clipboard()->text(QClipboard::Clipboard) );
2382 
2383  if (completionEnabled) {
2384  setAutomaticInvocationEnabled(true);
2385  }
2386 }
2387 
2388 void KateView::setCaretStyle( KateRenderer::caretStyles style, bool repaint )
2389 {
2390  m_viewInternal->setCaretStyle( style, repaint );
2391 }
2392 
2393 bool KateView::setCursorPosition( KTextEditor::Cursor position )
2394 {
2395  return setCursorPositionInternal( position, 1, true );
2396 }
2397 
2398 KTextEditor::Cursor KateView::cursorPosition( ) const
2399 {
2400  return m_viewInternal->getCursor();
2401 }
2402 
2403 KTextEditor::Cursor KateView::cursorPositionVirtual( ) const
2404 {
2405  return KTextEditor::Cursor (m_viewInternal->getCursor().line(), virtualCursorColumn());
2406 }
2407 
2408 QPoint KateView::cursorToCoordinate( const KTextEditor::Cursor & cursor ) const
2409 {
2410  return m_viewInternal->cursorToCoordinate(cursor);
2411 }
2412 
2413 KTextEditor::Cursor KateView::coordinatesToCursor(const QPoint& coords) const
2414 {
2415  return m_viewInternal->coordinatesToCursor(coords);
2416 }
2417 
2418 QPoint KateView::cursorPositionCoordinates( ) const
2419 {
2420  return m_viewInternal->cursorCoordinates();
2421 }
2422 
2423 bool KateView::setCursorPositionVisual( const KTextEditor::Cursor & position )
2424 {
2425  return setCursorPositionInternal( position, m_doc->config()->tabWidth(), true );
2426 }
2427 
2428 QString KateView::currentTextLine( )
2429 {
2430  return m_doc->line( cursorPosition().line() );
2431 }
2432 
2433 QString KateView::searchPattern() const
2434 {
2435  if (hasSearchBar()) {
2436  return m_searchBar->searchPattern();
2437  } else {
2438  return QString();
2439  }
2440 }
2441 
2442 QString KateView::replacementPattern() const
2443 {
2444  if (hasSearchBar()) {
2445  return m_searchBar->replacementPattern();
2446  } else {
2447  return QString();
2448  }
2449 }
2450 
2451 void KateView::setSearchPattern(const QString &searchPattern)
2452 {
2453  searchBar()->setSearchPattern(searchPattern);
2454 }
2455 
2456 void KateView::setReplacementPattern(const QString &replacementPattern)
2457 {
2458  searchBar()->setReplacementPattern(replacementPattern);
2459 }
2460 
2461 void KateView::indent( )
2462 {
2463  KTextEditor::Cursor c(cursorPosition().line(), 0);
2464  KTextEditor::Range r = selection() ? selectionRange() : KTextEditor::Range(c, c);
2465  m_doc->indent( r, 1 );
2466 }
2467 
2468 void KateView::unIndent( )
2469 {
2470  KTextEditor::Cursor c(cursorPosition().line(), 0);
2471  KTextEditor::Range r = selection() ? selectionRange() : KTextEditor::Range(c, c);
2472  m_doc->indent( r, -1 );
2473 }
2474 
2475 void KateView::cleanIndent( )
2476 {
2477  KTextEditor::Cursor c(cursorPosition().line(), 0);
2478  KTextEditor::Range r = selection() ? selectionRange() : KTextEditor::Range(c, c);
2479  m_doc->indent( r, 0 );
2480 }
2481 
2482 void KateView::align( )
2483 {
2484  // no selection: align current line; selection: use selection range
2485  const int line = cursorPosition().line();
2486  KTextEditor::Range alignRange(KTextEditor::Cursor (line,0), KTextEditor::Cursor (line,0));
2487  if (selection()) {
2488  alignRange = selectionRange();
2489  }
2490 
2491  m_doc->align( this, alignRange );
2492 }
2493 
2494 void KateView::comment( )
2495 {
2496  m_selection.setInsertBehaviors(Kate::TextRange::ExpandLeft | Kate::TextRange::ExpandRight);
2497  m_doc->comment( this, cursorPosition().line(), cursorPosition().column(), 1 );
2498  m_selection.setInsertBehaviors(Kate::TextRange::ExpandRight);
2499 }
2500 
2501 void KateView::uncomment( )
2502 {
2503  m_doc->comment( this, cursorPosition().line(), cursorPosition().column(),-1 );
2504 }
2505 
2506 void KateView::toggleComment( )
2507 {
2508  m_selection.setInsertBehaviors(Kate::TextRange::ExpandLeft | Kate::TextRange::ExpandRight);
2509  m_doc->comment( this, cursorPosition().line(), cursorPosition().column(), 0 );
2510  m_selection.setInsertBehaviors(Kate::TextRange::ExpandRight);
2511 }
2512 
2513 void KateView::uppercase( )
2514 {
2515  m_doc->transform( this, m_viewInternal->m_cursor, KateDocument::Uppercase );
2516 }
2517 
2518 void KateView::killLine( )
2519 {
2520  m_doc->removeLine( cursorPosition().line() );
2521 }
2522 
2523 void KateView::lowercase( )
2524 {
2525  m_doc->transform( this, m_viewInternal->m_cursor, KateDocument::Lowercase );
2526 }
2527 
2528 void KateView::capitalize( )
2529 {
2530  m_doc->editStart();
2531  m_doc->transform( this, m_viewInternal->m_cursor, KateDocument::Lowercase );
2532  m_doc->transform( this, m_viewInternal->m_cursor, KateDocument::Capitalize );
2533  m_doc->editEnd();
2534 }
2535 
2536 void KateView::keyReturn( )
2537 {
2538  m_viewInternal->doReturn();
2539 }
2540 
2541 void KateView::smartNewline( )
2542 {
2543  m_viewInternal->doSmartNewline();
2544 }
2545 
2546 void KateView::backspace( )
2547 {
2548  m_viewInternal->doBackspace();
2549 }
2550 
2551 void KateView::insertTab( )
2552 {
2553  m_viewInternal->doTabulator();
2554 }
2555 
2556 void KateView::deleteWordLeft( )
2557 {
2558  m_viewInternal->doDeletePrevWord();
2559 }
2560 
2561 void KateView::keyDelete( )
2562 {
2563  m_viewInternal->doDelete();
2564 }
2565 
2566 void KateView::deleteWordRight( )
2567 {
2568  m_viewInternal->doDeleteNextWord();
2569 }
2570 
2571 void KateView::transpose( )
2572 {
2573  m_viewInternal->doTranspose();
2574 }
2575 
2576 void KateView::cursorLeft( )
2577 {
2578  if (m_viewInternal->m_view->currentTextLine().isRightToLeft())
2579  m_viewInternal->cursorNextChar();
2580  else
2581  m_viewInternal->cursorPrevChar();
2582 }
2583 
2584 void KateView::shiftCursorLeft( )
2585 {
2586  if (m_viewInternal->m_view->currentTextLine().isRightToLeft())
2587  m_viewInternal->cursorNextChar(true);
2588  else
2589  m_viewInternal->cursorPrevChar(true);
2590 }
2591 
2592 void KateView::cursorRight( )
2593 {
2594  if (m_viewInternal->m_view->currentTextLine().isRightToLeft())
2595  m_viewInternal->cursorPrevChar();
2596  else
2597  m_viewInternal->cursorNextChar();
2598 }
2599 
2600 void KateView::shiftCursorRight( )
2601 {
2602  if (m_viewInternal->m_view->currentTextLine().isRightToLeft())
2603  m_viewInternal->cursorPrevChar(true);
2604  else
2605  m_viewInternal->cursorNextChar(true);
2606 }
2607 
2608 void KateView::wordLeft( )
2609 {
2610  if (m_viewInternal->m_view->currentTextLine().isRightToLeft())
2611  m_viewInternal->wordNext();
2612  else
2613  m_viewInternal->wordPrev();
2614 }
2615 
2616 void KateView::shiftWordLeft( )
2617 {
2618  if (m_viewInternal->m_view->currentTextLine().isRightToLeft())
2619  m_viewInternal->wordNext(true);
2620  else
2621  m_viewInternal->wordPrev(true);
2622 }
2623 
2624 void KateView::wordRight( )
2625 {
2626  if (m_viewInternal->m_view->currentTextLine().isRightToLeft())
2627  m_viewInternal->wordPrev();
2628  else
2629  m_viewInternal->wordNext();
2630 }
2631 
2632 void KateView::shiftWordRight( )
2633 {
2634  if (m_viewInternal->m_view->currentTextLine().isRightToLeft())
2635  m_viewInternal->wordPrev(true);
2636  else
2637  m_viewInternal->wordNext(true);
2638 }
2639 
2640 void KateView::home( )
2641 {
2642  m_viewInternal->home();
2643 }
2644 
2645 void KateView::shiftHome( )
2646 {
2647  m_viewInternal->home(true);
2648 }
2649 
2650 void KateView::end( )
2651 {
2652  m_viewInternal->end();
2653 }
2654 
2655 void KateView::shiftEnd( )
2656 {
2657  m_viewInternal->end(true);
2658 }
2659 
2660 void KateView::up( )
2661 {
2662  m_viewInternal->cursorUp();
2663 }
2664 
2665 void KateView::shiftUp( )
2666 {
2667  m_viewInternal->cursorUp(true);
2668 }
2669 
2670 void KateView::down( )
2671 {
2672  m_viewInternal->cursorDown();
2673 }
2674 
2675 void KateView::shiftDown( )
2676 {
2677  m_viewInternal->cursorDown(true);
2678 }
2679 
2680 void KateView::scrollUp( )
2681 {
2682  m_viewInternal->scrollUp();
2683 }
2684 
2685 void KateView::scrollDown( )
2686 {
2687  m_viewInternal->scrollDown();
2688 }
2689 
2690 void KateView::topOfView( )
2691 {
2692  m_viewInternal->topOfView();
2693 }
2694 
2695 void KateView::shiftTopOfView( )
2696 {
2697  m_viewInternal->topOfView(true);
2698 }
2699 
2700 void KateView::bottomOfView( )
2701 {
2702  m_viewInternal->bottomOfView();
2703 }
2704 
2705 void KateView::shiftBottomOfView( )
2706 {
2707  m_viewInternal->bottomOfView(true);
2708 }
2709 
2710 void KateView::pageUp( )
2711 {
2712  m_viewInternal->pageUp();
2713 }
2714 
2715 void KateView::shiftPageUp( )
2716 {
2717  m_viewInternal->pageUp(true);
2718 }
2719 
2720 void KateView::pageDown( )
2721 {
2722  m_viewInternal->pageDown();
2723 }
2724 
2725 void KateView::shiftPageDown( )
2726 {
2727  m_viewInternal->pageDown(true);
2728 }
2729 
2730 void KateView::top( )
2731 {
2732  m_viewInternal->top_home();
2733 }
2734 
2735 void KateView::shiftTop( )
2736 {
2737  m_viewInternal->top_home(true);
2738 }
2739 
2740 void KateView::bottom( )
2741 {
2742  m_viewInternal->bottom_end();
2743 }
2744 
2745 void KateView::shiftBottom( )
2746 {
2747  m_viewInternal->bottom_end(true);
2748 }
2749 
2750 void KateView::toMatchingBracket( )
2751 {
2752  m_viewInternal->cursorToMatchingBracket();
2753 }
2754 
2755 void KateView::shiftToMatchingBracket( )
2756 {
2757  m_viewInternal->cursorToMatchingBracket(true);
2758 }
2759 
2760 const KTextEditor::Range & KateView::selectionRange( ) const
2761 {
2762  // update the cache
2763  m_holdSelectionRangeForAPI = m_selection;
2764 
2765  // return cached value, has right type!
2766  return m_holdSelectionRangeForAPI;
2767 }
2768 
2769 KTextEditor::Document * KateView::document( ) const
2770 {
2771  return m_doc;
2772 }
2773 
2774 void KateView::setContextMenu( QMenu * menu )
2775 {
2776  if (m_contextMenu) {
2777  disconnect(m_contextMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowContextMenu()));
2778  disconnect(m_contextMenu, SIGNAL(aboutToHide()), this, SLOT(aboutToHideContextMenu()));
2779  }
2780  m_contextMenu = menu;
2781  m_userContextMenuSet=true;
2782 
2783  if (m_contextMenu) {
2784  connect(m_contextMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowContextMenu()));
2785  connect(m_contextMenu, SIGNAL(aboutToHide()), this, SLOT(aboutToHideContextMenu()));
2786  }
2787 }
2788 
2789 QMenu *KateView::contextMenu( ) const
2790 {
2791  if (m_userContextMenuSet)
2792  return m_contextMenu;
2793  else
2794  {
2795  KXMLGUIClient* client = const_cast<KateView*>(this);
2796  while (client->parentClient())
2797  client = client->parentClient();
2798 
2799  //kDebug() << "looking up all menu containers";
2800  if (client->factory()){
2801  QList<QWidget*> conts = client->factory()->containers("menu");
2802  foreach (QWidget *w, conts)
2803  {
2804  if (w->objectName() == "ktexteditor_popup")
2805  {//perhaps optimize this block
2806  QMenu* menu=(QMenu*)w;
2807  disconnect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowContextMenu()));
2808  disconnect(menu, SIGNAL(aboutToHide()), this, SLOT(aboutToHideContextMenu()));
2809  connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowContextMenu()));
2810  connect(menu, SIGNAL(aboutToHide()), this, SLOT(aboutToHideContextMenu()));
2811  return menu;
2812  }
2813  }
2814  }
2815  }
2816  return 0;
2817 }
2818 
2819 QMenu * KateView::defaultContextMenu(QMenu* menu) const
2820 {
2821  if (!menu)
2822  menu = new KMenu(const_cast<KateView*>(this));
2823 
2824  menu->addAction(m_editUndo);
2825  menu->addAction(m_editRedo);
2826  menu->addSeparator();
2827  menu->addAction(m_cut);
2828  menu->addAction(m_copy);
2829  menu->addAction(m_paste);
2830  menu->addSeparator();
2831  menu->addAction(m_selectAll);
2832  menu->addAction(m_deSelect);
2833  if (QAction *spellingSuggestions = actionCollection()->action("spelling_suggestions")) {
2834  menu->addSeparator();
2835  menu->addAction(spellingSuggestions);
2836  }
2837  if (QAction* bookmark = actionCollection()->action("bookmarks")) {
2838  menu->addSeparator();
2839  menu->addAction(bookmark);
2840  }
2841  return menu;
2842 }
2843 
2844 void KateView::aboutToShowContextMenu( )
2845 {
2846  QMenu* menu = qobject_cast<QMenu*>(sender());
2847 
2848  if (menu) {
2849  emit contextMenuAboutToShow(this, menu);
2850  }
2851 }
2852 
2853 void KateView::aboutToHideContextMenu( )
2854 {
2855  m_spellingMenu->setUseMouseForMisspelledRange(false);
2856 }
2857 
2858 // BEGIN ConfigInterface stff
2859 QStringList KateView::configKeys() const
2860 {
2861  return QStringList() << "icon-bar" << "line-numbers" << "dynamic-word-wrap"
2862  << "background-color" << "selection-color"
2863  << "search-highlight-color" << "replace-highlight-color"
2864  << "folding-bar";
2865 }
2866 
2867 QVariant KateView::configValue(const QString &key)
2868 {
2869  if (key == "icon-bar")
2870  return config()->iconBar();
2871  else if (key == "line-numbers")
2872  return config()->lineNumbers();
2873  else if (key == "dynamic-word-wrap")
2874  return config()->dynWordWrap();
2875  else if (key == "background-color")
2876  return renderer()->config()->backgroundColor();
2877  else if (key == "selection-color")
2878  return renderer()->config()->selectionColor();
2879  else if (key == "search-highlight-color")
2880  return renderer()->config()->searchHighlightColor();
2881  else if (key == "replace-highlight-color")
2882  return renderer()->config()->replaceHighlightColor();
2883  else if (key == "default-mark-type")
2884  return config()->defaultMarkType();
2885  else if (key == "allow-mark-menu")
2886  return config()->allowMarkMenu();
2887  else if (key == "folding-bar")
2888  return config()->foldingBar();
2889 
2890  // return invalid variant
2891  return QVariant();
2892 }
2893 
2894 void KateView::setConfigValue(const QString &key, const QVariant &value)
2895 {
2896  if ( value.canConvert(QVariant::Color) ) {
2897  if (key == "background-color")
2898  renderer()->config()->setBackgroundColor(value.value<QColor>());
2899  else if (key == "selection-color")
2900  renderer()->config()->setSelectionColor(value.value<QColor>());
2901  else if (key == "search-highlight-color")
2902  renderer()->config()->setSearchHighlightColor(value.value<QColor>());
2903  else if (key == "replace-highlight-color")
2904  renderer()->config()->setReplaceHighlightColor(value.value<QColor>());
2905  } else if ( value.type() == QVariant::Bool ) {
2906  // Note explicit type check above. If we used canConvert, then
2907  // values of type UInt will be trapped here.
2908  if (key == "icon-bar")
2909  config()->setIconBar(value.toBool());
2910  else if (key == "line-numbers")
2911  config()->setLineNumbers(value.toBool());
2912  else if (key == "dynamic-word-wrap")
2913  config()->setDynWordWrap(value.toBool());
2914  else if (key == "allow-mark-menu")
2915  config()->setAllowMarkMenu(value.toBool());
2916  else if (key == "folding-bar")
2917  config()->setFoldingBar(value.toBool());
2918  } else if ( value.canConvert(QVariant::UInt) ) {
2919  if (key == "default-mark-type")
2920  config()->setDefaultMarkType(value.toUInt());
2921  }
2922 }
2923 
2924 // END ConfigInterface
2925 
2926 void KateView::userInvokedCompletion()
2927 {
2928  completionWidget()->userInvokedCompletion();
2929 }
2930 
2931 KateViewBar *KateView::topViewBar() const
2932 {
2933  return m_topViewBar;
2934 }
2935 
2936 KateViewBar *KateView::bottomViewBar() const
2937 {
2938  return m_bottomViewBar;
2939 }
2940 
2941 KateCommandLineBar *KateView::cmdLineBar ()
2942 {
2943  if (!m_cmdLine) {
2944  m_cmdLine = new KateCommandLineBar (this, bottomViewBar());
2945  bottomViewBar()->addBarWidget(m_cmdLine);
2946  }
2947 
2948  return m_cmdLine;
2949 }
2950 
2951 KateScriptConsole *KateView::consoleBar ()
2952 {
2953  if (!m_console) {
2954  m_console = new KateScriptConsole (this, bottomViewBar());
2955  bottomViewBar()->addBarWidget(m_console);
2956  }
2957 
2958  return m_console;
2959 }
2960 
2961 KateSearchBar *KateView::searchBar (bool initHintAsPower)
2962 {
2963  if (!m_searchBar) {
2964  m_searchBar = new KateSearchBar(initHintAsPower, this, KateViewConfig::global());
2965  }
2966  return m_searchBar;
2967 }
2968 
2969 KateGotoBar *KateView::gotoBar ()
2970 {
2971  if (!m_gotoBar) {
2972  m_gotoBar = new KateGotoBar (this);
2973  bottomViewBar()->addBarWidget(m_gotoBar);
2974  }
2975 
2976  return m_gotoBar;
2977 }
2978 
2979 KateDictionaryBar *KateView::dictionaryBar ()
2980 {
2981  if(!m_dictionaryBar) {
2982  m_dictionaryBar = new KateDictionaryBar(this);
2983  bottomViewBar()->addBarWidget(m_dictionaryBar);
2984  }
2985 
2986  return m_dictionaryBar;
2987 }
2988 
2989 KateViEmulatedCommandBar* KateView::viModeEmulatedCommandBar()
2990 {
2991  if (!m_viModeEmulatedCommandBar) {
2992  m_viModeEmulatedCommandBar = new KateViEmulatedCommandBar(this, this);
2993  m_viModeEmulatedCommandBar->hide ();
2994  }
2995 
2996  return m_viModeEmulatedCommandBar;
2997 }
2998 
2999 void KateView::setAnnotationModel( KTextEditor::AnnotationModel* model )
3000 {
3001  KTextEditor::AnnotationModel* oldmodel = m_annotationModel;
3002  m_annotationModel = model;
3003  m_viewInternal->m_leftBorder->annotationModelChanged(oldmodel, m_annotationModel);
3004 }
3005 
3006 KTextEditor::AnnotationModel* KateView::annotationModel() const
3007 {
3008  return m_annotationModel;
3009 }
3010 
3011 void KateView::setAnnotationBorderVisible( bool visible )
3012 {
3013  m_viewInternal->m_leftBorder->setAnnotationBorderOn( visible );
3014 }
3015 
3016 bool KateView::isAnnotationBorderVisible() const
3017 {
3018  return m_viewInternal->m_leftBorder->annotationBorderOn();
3019 }
3020 
3021 KTextEditor::Range KateView::visibleRange()
3022 {
3023  //ensure that the view is up-to-date, otherwise 'endPos()' might fail!
3024  m_viewInternal->updateView();
3025  return KTextEditor::Range(m_viewInternal->toRealCursor(m_viewInternal->startPos()),
3026  m_viewInternal->toRealCursor(m_viewInternal->endPos()));
3027 }
3028 
3029 void KateView::toggleOnTheFlySpellCheck(bool b)
3030 {
3031  m_doc->onTheFlySpellCheckingEnabled(b);
3032 }
3033 
3034 void KateView::reflectOnTheFlySpellCheckStatus(bool enabled)
3035 {
3036  m_spellingMenu->setVisible(enabled);
3037  m_toggleOnTheFlySpellCheck->setChecked(enabled);
3038 }
3039 
3040 KateSpellingMenu* KateView::spellingMenu()
3041 {
3042  return m_spellingMenu;
3043 }
3044 
3045 void KateView::notifyAboutRangeChange (int startLine, int endLine, bool rangeWithAttribute)
3046 {
3047 #ifdef VIEW_RANGE_DEBUG
3048  // output args
3049  kDebug() << "trigger attribute changed from" << startLine << "to" << endLine << "rangeWithAttribute" << rangeWithAttribute;
3050 #endif
3051 
3052  // first call:
3053  if (!m_delayedUpdateTriggered) {
3054  m_delayedUpdateTriggered = true;
3055  m_lineToUpdateMin = -1;
3056  m_lineToUpdateMax = -1;
3057 
3058  // only set initial line range, if range with attribute!
3059  if (rangeWithAttribute) {
3060  m_lineToUpdateMin = startLine;
3061  m_lineToUpdateMax = endLine;
3062  }
3063 
3064  // emit queued signal and be done
3065  emit delayedUpdateOfView ();
3066  return;
3067  }
3068 
3069  // ignore lines if no attribute
3070  if (!rangeWithAttribute)
3071  return;
3072 
3073  // update line range
3074  if (startLine != -1 && (m_lineToUpdateMin == -1 || startLine < m_lineToUpdateMin))
3075  m_lineToUpdateMin = startLine;
3076 
3077  if (endLine != -1 && endLine > m_lineToUpdateMax)
3078  m_lineToUpdateMax = endLine;
3079 }
3080 
3081 void KateView::slotDelayedUpdateOfView ()
3082 {
3083  if (!m_delayedUpdateTriggered)
3084  return;
3085 
3086 #ifdef VIEW_RANGE_DEBUG
3087  // output args
3088  kDebug() << "delayed attribute changed from" << m_lineToUpdateMin << "to" << m_lineToUpdateMax;
3089 #endif
3090 
3091  // update ranges in
3092  updateRangesIn (KTextEditor::Attribute::ActivateMouseIn);
3093  updateRangesIn (KTextEditor::Attribute::ActivateCaretIn);
3094 
3095  // update view, if valid line range, else only feedback update wanted anyway
3096  if (m_lineToUpdateMin != -1 && m_lineToUpdateMax != -1) {
3097  tagLines (m_lineToUpdateMin, m_lineToUpdateMax, true);
3098  updateView (true);
3099  }
3100 
3101  // reset flags
3102  m_delayedUpdateTriggered = false;
3103  m_lineToUpdateMin = -1;
3104  m_lineToUpdateMax = -1;
3105 }
3106 
3107 void KateView::updateRangesIn (KTextEditor::Attribute::ActivationType activationType)
3108 {
3109  // new ranges with cursor in, default none
3110  QSet<Kate::TextRange *> newRangesIn;
3111 
3112  // on which range set we work?
3113  QSet<Kate::TextRange *> &oldSet = (activationType == KTextEditor::Attribute::ActivateMouseIn) ? m_rangesMouseIn : m_rangesCaretIn;
3114 
3115  // which cursor position to honor?
3116  KTextEditor::Cursor currentCursor = (activationType == KTextEditor::Attribute::ActivateMouseIn) ? m_viewInternal->getMouse() : m_viewInternal->getCursor ();
3117 
3118  // first: validate the remembered ranges
3119  QSet<Kate::TextRange *> validRanges;
3120  foreach (Kate::TextRange *range, oldSet)
3121  if (m_doc->buffer().rangePointerValid(range))
3122  validRanges.insert (range);
3123 
3124  // cursor valid? else no new ranges can be found
3125  if (currentCursor.isValid () && currentCursor.line() < m_doc->buffer().lines()) {
3126  // now: get current ranges for the line of cursor with an attribute
3127  QList<Kate::TextRange *> rangesForCurrentCursor = m_doc->buffer().rangesForLine (currentCursor.line(), this, false);
3128 
3129  // match which ranges really fit the given cursor
3130  foreach (Kate::TextRange *range, rangesForCurrentCursor) {
3131  // range has no dynamic attribute of right type and no feedback object
3132  if ((!range->attribute() || !range->attribute()->dynamicAttribute (activationType)) && !range->feedback())
3133  continue;
3134 
3135  // range doesn't contain cursor, not interesting
3136  if ((range->start().insertBehavior() == KTextEditor::MovingCursor::StayOnInsert)
3137  ? (currentCursor < range->start().toCursor ()) : (currentCursor <= range->start().toCursor ()))
3138  continue;
3139 
3140  if ((range->end().insertBehavior() == KTextEditor::MovingCursor::StayOnInsert)
3141  ? (range->end().toCursor () <= currentCursor) : (range->end().toCursor () < currentCursor))
3142  continue;
3143 
3144  // range contains cursor, was it already in old set?
3145  if (validRanges.contains (range)) {
3146  // insert in new, remove from old, be done with it
3147  newRangesIn.insert (range);
3148  validRanges.remove (range);
3149  continue;
3150  }
3151 
3152  // oh, new range, trigger update and insert into new set
3153  newRangesIn.insert (range);
3154 
3155  if (range->attribute() && range->attribute()->dynamicAttribute (activationType))
3156  notifyAboutRangeChange (range->start().line(), range->end().line(), true);
3157 
3158  // feedback
3159  if (range->feedback ()) {
3160  if (activationType == KTextEditor::Attribute::ActivateMouseIn)
3161  range->feedback ()->mouseEnteredRange (range, this);
3162  else
3163  range->feedback ()->caretEnteredRange (range, this);
3164  }
3165 
3166 #ifdef VIEW_RANGE_DEBUG
3167  // found new range for activation
3168  kDebug() << "activated new range" << range << "by" << activationType;
3169 #endif
3170  }
3171  }
3172 
3173  // now: notify for left ranges!
3174  foreach (Kate::TextRange *range, validRanges) {
3175  // range valid + right dynamic attribute, trigger update
3176  if (range->toRange().isValid() && range->attribute() && range->attribute()->dynamicAttribute (activationType))
3177  notifyAboutRangeChange (range->start().line(), range->end().line(), true);
3178 
3179  // feedback
3180  if (range->feedback ()) {
3181  if (activationType == KTextEditor::Attribute::ActivateMouseIn)
3182  range->feedback ()->mouseExitedRange (range, this);
3183  else
3184  range->feedback ()->caretExitedRange (range, this);
3185  }
3186  }
3187 
3188  // set new ranges
3189  oldSet = newRangesIn;
3190 }
3191 
3192 void KateView::postMessage(KTextEditor::Message* message,
3193  QList<QSharedPointer<QAction> > actions)
3194 {
3195  // just forward to KateMessageWidget :-)
3196  if (message->position() == KTextEditor::Message::AboveView) {
3197  m_topMessageWidget->postMessage(message, actions);
3198  } else if (message->position() == KTextEditor::Message::BelowView) {
3199  m_bottomMessageWidget->postMessage(message, actions);
3200  } else if (message->position() == KTextEditor::Message::TopInView) {
3201  if (!m_floatTopMessageWidget) {
3202  m_floatTopMessageWidget = new KateMessageWidget(m_viewInternal, true);
3203  m_notificationLayout->insertWidget(0, m_floatTopMessageWidget, 0, Qt::AlignTop | Qt::AlignRight);
3204  connect(this, SIGNAL(displayRangeChanged(KateView*)), m_floatTopMessageWidget, SLOT(startAutoHideTimer()));
3205  connect(this, SIGNAL(cursorPositionChanged(KTextEditor::View*, const KTextEditor::Cursor&)), m_floatTopMessageWidget, SLOT(startAutoHideTimer()));
3206  }
3207  m_floatTopMessageWidget->postMessage(message, actions);
3208  } else if (message->position() == KTextEditor::Message::BottomInView) {
3209  if (!m_floatBottomMessageWidget) {
3210  m_floatBottomMessageWidget = new KateMessageWidget(m_viewInternal, true);
3211  m_notificationLayout->addWidget(m_floatBottomMessageWidget, 0, Qt::AlignBottom | Qt::AlignRight);
3212  connect(this, SIGNAL(displayRangeChanged(KateView*)), m_floatBottomMessageWidget, SLOT(startAutoHideTimer()));
3213  connect(this, SIGNAL(cursorPositionChanged(KTextEditor::View*, const KTextEditor::Cursor&)), m_floatBottomMessageWidget, SLOT(startAutoHideTimer()));
3214  }
3215  m_floatBottomMessageWidget->postMessage(message, actions);
3216  }
3217 }
3218 
3219 void KateView::saveFoldingState ()
3220 {
3221  m_savedFoldingState = m_textFolding.exportFoldingRanges ();
3222 }
3223 
3224 void KateView::applyFoldingState ()
3225 {
3226  m_textFolding.importFoldingRanges (m_savedFoldingState);
3227  m_savedFoldingState.clear ();
3228 }
3229 
3230 // kate: space-indent on; indent-width 2; replace-tabs on;
KateViewInternal::editEnd
void editEnd(int editTagLineStart, int editTagLineEnd, bool tagFrom)
Definition: kateviewinternal.cpp:3325
QVariant
KateView::foldingMarkersOn
bool foldingMarkersOn()
Definition: kateview.cpp:1496
KateView::findSelectedBackwards
void findSelectedBackwards()
Definition: kateview.cpp:1592
KateDocument::line
virtual QString line(int line) const
Definition: katedocument.cpp:447
KParts::BrowserExtension
KateDocument::align
void align(KateView *view, const KTextEditor::Range &range)
Definition: katedocument.cpp:2908
KateViewInternal::cursorPrevChar
void cursorPrevChar(bool sel=false)
Definition: kateviewinternal.cpp:1061
KateDocument::buffer
KateBuffer & buffer()
Get access to buffer of this document.
Definition: katedocument.h:946
KateView::updateViModeBarMode
void updateViModeBarMode()
Update vi mode statusbar according to the current mode.
Definition: kateview.cpp:1548
QColor
KateScrollBar::showMiniMap
bool showMiniMap()
Definition: kateviewhelpers.h:77
KateViInputModeManager::getVerbatimKeys
const QString getVerbatimKeys() const
Definition: kateviinputmodemanager.cpp:554
KateGlobal::writeConfig
void writeConfig(KConfig *config=0)
Write editor configuration to given config object.
Definition: kateglobal.cpp:274
KateView::getEol
int getEol() const
Definition: kateview.cpp:1370
KTextEditor::Range::start
Cursor & start()
KateViInputModeManager::viEnterNormalMode
void viEnterNormalMode()
set normal mode to be the active vi mode and perform the needed setup work
Definition: kateviinputmodemanager.cpp:472
KateDocument::config
KateDocumentConfig * config()
Configuration.
Definition: katedocument.h:1009
KateView::m_spellingMenu
KateSpellingMenu * m_spellingMenu
Definition: kateview.h:759
KateView::shiftDown
void shiftDown()
Definition: kateview.cpp:2675
KateView::tagLines
bool tagLines(int start, int end, bool realLines=false)
Definition: kateview.cpp:1863
KateView::userInvokedCompletion
void userInvokedCompletion()
Definition: kateview.cpp:2926
KateView::defaultContextMenu
QMenu * defaultContextMenu(QMenu *menu=0L) const
Definition: kateview.cpp:2819
KateViewInternal::doReturn
void doReturn()
Definition: kateviewinternal.cpp:765
KTextEditor::ViewBarContainer::TopBar
KateView::shiftHome
void shiftHome()
Definition: kateview.cpp:2645
KActionCollection
KateSpellCheckDialog::updateActions
void updateActions()
Definition: spellcheckdialog.cpp:79
KateViewInternal::doBackspace
void doBackspace()
Definition: kateviewinternal.cpp:796
katehighlight.h
katetextline.h
KateSearchBar::setReplacementPattern
void setReplacementPattern(const QString &replacementPattern)
Set the current replacement pattern.
Definition: katesearchbar.cpp:226
Kate::TextRange::feedback
KTextEditor::MovingRangeFeedback * feedback() const
Gets the active MovingRangeFeedback for this range.
Definition: katetextrange.h:195
kateview.h
KStandardShortcut::deleteWordForward
const KShortcut & deleteWordForward()
kateviemulatedcommandbar.h
print
KAction * print(const QObject *recvr, const char *slot, QObject *parent)
KateView::dynWrapIndicators
int dynWrapIndicators()
Definition: kateview.cpp:1492
KateRendererConfig::selectionColor
const QColor & selectionColor() const
Definition: kateconfig.cpp:2199
KTextEditor::TemplateScript
Kate::Script::i18n
QScriptValue i18n(QScriptContext *context, QScriptEngine *engine)
i18n("text", arguments [optional])
Definition: katescripthelpers.cpp:186
KAction::setShortcuts
void setShortcuts(const QList< QKeySequence > &shortcuts, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
kcharsets.h
KateIconBorder::updateFont
void updateFont()
Definition: kateviewhelpers.cpp:1396
KateScrollBar::queuePixmapUpdate
void queuePixmapUpdate()
Definition: kateviewhelpers.h:86
KateRendererConfig::wordWrapMarker
bool wordWrapMarker() const
Definition: kateconfig.cpp:2157
KateView::clearSelection
bool clearSelection()
Definition: kateview.cpp:1966
KTextEditor::View::viewModeChanged
void viewModeChanged(KTextEditor::View *view)
KateViewBar::addBarWidget
void addBarWidget(KateViewBarWidget *newBarWidget)
Adds a widget to this viewbar.
Definition: kateviewhelpers.cpp:2437
KTextEditor::View::EditViMode
KStandardShortcut::next
const KShortcut & next()
KateSearchBar::setSearchPattern
void setSearchPattern(const QString &searchPattern)
Set the current search pattern.
Definition: katesearchbar.cpp:942
KateView::scrollBarMarks
bool scrollBarMarks()
Definition: kateview.cpp:1484
KateView::toggleBlockSelection
bool toggleBlockSelection()
Definition: kateview.cpp:2231
KateViewInternal::startPos
KTextEditor::Cursor startPos() const
Definition: kateviewinternal.h:124
KateView::end
void end()
Definition: kateview.cpp:2650
KateView::sendCompletionExecuted
void sendCompletionExecuted(const KTextEditor::Cursor &position, KTextEditor::CodeCompletionModel *model, const QModelIndex &index)
Definition: kateview.cpp:2364
Kate::TextRange::start
const KTextEditor::MovingCursor & start() const
Retrieve start cursor of this range, read-only.
Definition: katetextrange.h:119
KateView::selectWord
void selectWord(const KTextEditor::Cursor &cursor)
Definition: kateview.cpp:2129
KXMLGUIClient::actionCollection
virtual KActionCollection * actionCollection() const
KTextEditor::MovingCursor::column
virtual int column() const =0
kdebug.h
KStandardAction::Redo
katehighlightmenu.h
KateViewInternal::topOfView
void topOfView(bool sel=false)
Definition: kateviewinternal.cpp:1466
KateView::renderer
KateRenderer * renderer()
Definition: kateview.cpp:1653
undo
KAction * undo(const QObject *recvr, const char *slot, QObject *parent)
KateViewInternal::tagRange
bool tagRange(const KTextEditor::Range &range, bool realCursors)
Definition: kateviewinternal.cpp:2051
KateView::comment
void comment()
Definition: kateview.cpp:2494
KateView::document
KTextEditor::Document * document() const
Definition: kateview.cpp:2769
KateView::isCompletionActive
virtual bool isCompletionActive() const
Definition: kateview.cpp:2316
katerenderer.h
KTextEditor::Attribute::ActivateMouseIn
KXMLGUIClient
KateGlobal::container
QObject * container()
Get the currently associated Container object.
Definition: kateglobal.cpp:516
KTextEditor::View::contextMenuAboutToShow
void contextMenuAboutToShow(KTextEditor::View *view, QMenu *menu)
KParts::BrowserExtension::popupMenu
void popupMenu(const QPoint &global, const KFileItemList &items, const KParts::OpenUrlArguments &args=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArgs=KParts::BrowserArguments(), KParts::BrowserExtension::PopupFlags flags=KParts::BrowserExtension::DefaultPopupItems, const KParts::BrowserExtension::ActionGroupMap &actionGroups=ActionGroupMap())
spellcheckdialog.h
kapplication.h
KateView::bottomViewBar
KateViewBar * bottomViewBar() const
Definition: kateview.cpp:2936
KateView::selectAll
bool selectAll()
Definition: kateview.cpp:2050
KateScrollBar::showMarks
bool showMarks()
Definition: kateviewhelpers.h:74
KateDocument::setReadWrite
virtual void setReadWrite(bool rw=true)
Definition: katedocument.cpp:2468
KateDocument::removeLine
virtual bool removeLine(int line)
Definition: katedocument.cpp:727
KateDocumentConfig::ovr
bool ovr() const
Definition: kateconfig.cpp:759
KateDocument::highlight
KateHighlighting * highlight() const
Definition: katedocument.cpp:4702
KateView::slotExpandLevel
void slotExpandLevel()
Definition: kateview.cpp:1081
KateViewConfig::smartCopyCut
bool smartCopyCut() const
Definition: kateconfig.cpp:1833
KateView::cleanIndent
void cleanIndent()
Definition: kateview.cpp:2475
KateView::disableTextHints
void disableTextHints()
Definition: kateview.cpp:1510
KTextEditor::Range::isValid
virtual bool isValid() const
KateRendererConfig::replaceHighlightColor
const QColor & replaceHighlightColor() const
Definition: kateconfig.cpp:2559
KateView::bottom
void bottom()
Definition: kateview.cpp:2740
Kate::TextCursor::column
int column() const
Retrieve the column on which this cursor is situated.
Definition: katetextcursor.h:141
KateIconBorder::setAnnotationBorderOn
void setAnnotationBorderOn(bool enable)
Definition: kateviewhelpers.cpp:1301
KateView::startCompletion
virtual void startCompletion(const KTextEditor::Range &word, KTextEditor::CodeCompletionModel *model)
Definition: kateview.cpp:2329
KStandardShortcut::forwardWord
const KShortcut & forwardWord()
KateView::dynWordWrap
bool dynWordWrap() const
Definition: kateview.h:245
Kate::Script::i18nc
QScriptValue i18nc(QScriptContext *context, QScriptEngine *engine)
i18nc("context", "text", arguments [optional])
Definition: katescripthelpers.cpp:210
KXMLGUIFactory::removeClient
void removeClient(KXMLGUIClient *client)
KateView::shiftBottom
void shiftBottom()
Definition: kateview.cpp:2745
KateView::deleteWordLeft
void deleteWordLeft()
Definition: kateview.cpp:2556
Kate::TextBuffer::rangePointerValid
bool rangePointerValid(TextRange *range) const
Check if the given range pointer is still valid.
Definition: katetextbuffer.h:429
KateGlobal::deregisterView
void deregisterView(KateView *view)
unregister view at the factory
Definition: kateglobal.cpp:491
KateDocumentConfig::setOvr
void setOvr(bool on)
Definition: kateconfig.cpp:746
KateView::setDynWrapIndicators
void setDynWrapIndicators(int mode)
Definition: kateview.cpp:1194
KateView::enableTextHints
void enableTextHints(int timeout)
Definition: kateview.cpp:1505
KateGlobal::configDialog
void configDialog(QWidget *parent)
Shows a config dialog for the part, changes will be applied to the editor, but not saved anywhere aut...
Definition: kateglobal.cpp:303
KateView::backspace
void backspace()
Definition: kateview.cpp:2546
KateViewInternal::bottomOfView
void bottomOfView(bool sel=false)
Definition: kateviewinternal.cpp:1473
KateDocument::paste
void paste(KateView *view, const QString &text)
Definition: katedocument.cpp:2828
KateView::setCaretStyle
void setCaretStyle(KateRenderer::caretStyles style, bool repaint=false)
Set the caret's style.
Definition: kateview.cpp:2388
KateDocument::lineLength
virtual int lineLength(int line) const
Definition: katedocument.cpp:758
KateDocument::simpleMode
static bool simpleMode()
Definition: katedocument.cpp:4787
kactioncollection.h
KateViewConfig::setIconBar
void setIconBar(bool on)
Definition: kateconfig.cpp:1494
kateautoindent.h
KateViewInternal::clear
void clear()
Definition: kateviewinternal.cpp:3205
KMenu
KateSearchBar::searchPattern
QString searchPattern() const
Definition: katesearchbar.cpp:955
KateView::replacementPattern
QString replacementPattern() const
The current replacement string.
Definition: kateview.cpp:2442
KateCommandLineBar::setText
void setText(const QString &text, bool selected=true)
Definition: kateviewhelpers.cpp:839
KateViewConfig::setScrollBarMiniMapAll
void setScrollBarMiniMapAll(bool on)
Definition: kateconfig.cpp:1452
KateView::toggleScrollBarMarks
void toggleScrollBarMarks()
Definition: kateview.cpp:1426
KateViewInternal::top_home
void top_home(bool sel=false)
Definition: kateviewinternal.cpp:1642
KateHighlighting::getCommentStart
QString getCommentStart(int attrib=0) const
Definition: katehighlight.cpp:1119
KateViewInternal::editSetCursor
void editSetCursor(const KTextEditor::Cursor &cursor)
Definition: kateviewinternal.cpp:3379
kconfig.h
KTextEditor::Message::BelowView
KateSpellingMenu::createActions
void createActions(KActionCollection *ac)
Definition: spellingmenu.cpp:95
KateModeMenu
Definition: katemodemenu.h:33
KateView::isAutomaticInvocationEnabled
virtual bool isAutomaticInvocationEnabled() const
Definition: kateview.cpp:2354
KateView::setAddBom
void setAddBom(bool enabled)
Definition: kateview.cpp:1389
QWidget
KateDocument::onTheFlySpellCheckingEnabled
void onTheFlySpellCheckingEnabled(bool enable)
Definition: katedocument.cpp:5152
KateView::shiftWordLeft
void shiftWordLeft()
Definition: kateview.cpp:2616
KateViewInternal::pageUp
void pageUp(bool sel=false, bool half=false)
Definition: kateviewinternal.cpp:1513
KateSearchBar
Definition: katesearchbar.h:47
KStandardAction::SaveAs
KateView::toggleWriteLock
void toggleWriteLock()
Definition: kateview.cpp:1500
KateViewInternal::cursorToCoordinate
QPoint cursorToCoordinate(const KTextEditor::Cursor &cursor, bool realCursor=true, bool includeBorder=true) const
Definition: kateviewinternal.cpp:712
KStandardAction::Cut
KateView::toggleScrollBarMiniMapAll
void toggleScrollBarMiniMapAll()
Definition: kateview.cpp:1446
katedocument.h
KateTemplateHandler
Inserts a template and offers advanced snippet features, like navigation and mirroring.
Definition: katetemplatehandler.h:73
KateView::mouseTrackingEnabled
virtual bool mouseTrackingEnabled() const
Definition: kateview.cpp:2304
KateDocument::documentReload
virtual bool documentReload()
Reloads the current document from disk if possible.
Definition: katedocument.cpp:3805
KateView::wordRight
void wordRight()
Definition: kateview.cpp:2624
KateView::repaintText
void repaintText(bool paintOnlyDirty=false)
Definition: kateview.cpp:1883
KateHighlightingMenu::updateMenu
void updateMenu(KateDocument *doc)
Definition: katehighlightmenu.cpp:66
KateView::lineNumbersOn
bool lineNumbersOn()
Definition: kateview.cpp:1480
KateView::searchPattern
QString searchPattern() const
The current search pattern.
Definition: kateview.cpp:2433
KateView::shiftTopOfView
void shiftTopOfView()
Definition: kateview.cpp:2695
KateView::gotoLine
void gotoLine()
Definition: kateview.cpp:1317
KateViInputModeManager
Definition: kateviinputmodemanager.h:68
KateDocument::addView
void addView(KTextEditor::View *)
Definition: katedocument.cpp:2523
KateSearchBar::SearchBackward
Definition: katesearchbar.h:73
kxmlguifactory.h
KateView::showViModeEmulatedCommandBar
void showViModeEmulatedCommandBar()
Definition: kateview.cpp:1540
KateView::readSessionConfig
void readSessionConfig(const KConfigGroup &)
Definition: kateview.cpp:1342
KStandardShortcut::zoomIn
const KShortcut & zoomIn()
KParts::ReadOnlyPart::browserExtension
BrowserExtension * browserExtension() const
KateView::slotExpandLocal
void slotExpandLocal()
Definition: kateview.cpp:1062
KateView::scrollUp
void scrollUp()
Definition: kateview.cpp:2680
KateGlobal::copyToClipboard
void copyToClipboard(const QString &text)
Copy text to clipboard an remember it in the history.
Definition: kateglobal.cpp:547
KActionCollection::addAction
QAction * addAction(const QString &name, QAction *action)
KConfigGroup::writeEntry
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
KateDictionaryBar::updateData
void updateData()
Definition: katedialogs.cpp:1420
KXMLGUIClient::setXMLFile
virtual void setXMLFile(const QString &file, bool merge=false, bool setXMLDoc=true)
KStandardAction::Copy
KateView::tagLine
bool tagLine(const KTextEditor::Cursor &virtualCursor)
Definition: kateview.cpp:1853
KateGotoBar
Definition: katedialogs.h:113
KateView::contextMenu
QMenu * contextMenu() const
Definition: kateview.cpp:2789
KStandardAction::Print
KTextEditor::ViewBarContainer::BottomBar
KXMLGUIClient::factory
KXMLGUIFactory * factory() const
KateGlobal::self
static KateGlobal * self()
Kate Part Internal stuff ;)
Definition: kateglobal.cpp:462
KateView::forceCompletion
virtual void forceCompletion()
Definition: kateview.cpp:2339
KStandardAction::Undo
KateViewInternal::wordNext
void wordNext(bool sel=false)
Definition: kateviewinternal.cpp:1117
KateDocument::undoManager
KateUndoManager * undoManager()
Definition: katedocument.h:338
KateView::slotClipboardHistoryChanged
void slotClipboardHistoryChanged()
Definition: kateview.cpp:1244
KateView::shiftCursorRight
void shiftCursorRight()
Definition: kateview.cpp:2600
KateRendererConfig::setSelectionColor
void setSelectionColor(const QColor &col)
Definition: kateconfig.cpp:2207
QString
KateLayoutCache::clear
void clear()
Definition: katelayoutcache.cpp:513
KateView::toggleOnTheFlySpellCheck
void toggleOnTheFlySpellCheck(bool b)
Definition: kateview.cpp:3029
KateViewInternal::scrollDown
void scrollDown()
Definition: kateviewinternal.cpp:1499
KateIconBorder::lineNumbersOn
bool lineNumbersOn() const
Definition: kateviewhelpers.h:174
KateSearchBar::enterIncrementalMode
void enterIncrementalMode()
Definition: katesearchbar.cpp:1418
KateView::textFolding
Kate::TextFolding & textFolding()
Folding handler for this view.
Definition: kateview.h:574
KTextEditor::ViewBarContainer::getViewBarParent
virtual QWidget * getViewBarParent(View *view, enum Position position)=0
katedialogs.h
KateViewInternal::doSmartNewline
void doSmartNewline()
Definition: kateviewinternal.cpp:771
KateView::smartNewline
void smartNewline()
Definition: kateview.cpp:2541
KateIconBorder::foldingMarkersOn
bool foldingMarkersOn() const
Definition: kateviewhelpers.h:175
KateView::setCursorPosition
bool setCursorPosition(KTextEditor::Cursor position)
Definition: kateview.cpp:2393
KateView::toggleDynWordWrap
void toggleDynWordWrap()
Definition: kateview.cpp:1456
KateView::annotationModel
KTextEditor::AnnotationModel * annotationModel() const
Definition: kateview.cpp:3006
KateView::switchToConsole
void switchToConsole()
Definition: kateview.cpp:1644
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KTextEditor::Cursor
KateView::home
void home()
Definition: kateview.cpp:2640
klocale.h
KateDocument::bomSetByUser
void bomSetByUser()
Set that the BOM marker is forced via the tool menu.
Definition: katedocument.cpp:1536
KateView::m_completionWidget
KateCompletionWidget * m_completionWidget
Definition: kateview.h:230
KatePartPluginManager::removeView
void removeView(KTextEditor::View *view)
Definition: katepartpluginmanager.cpp:136
KateView::toggleScrollBarMiniMap
void toggleScrollBarMiniMap()
Definition: kateview.cpp:1436
KateSpellCheckDialog
Definition: spellcheckdialog.h:49
KateDocument::plainKateTextLine
Kate::TextLine plainKateTextLine(uint i)
Definition: katedocument.cpp:4713
KateView::findSelectedForwards
void findSelectedForwards()
Definition: kateview.cpp:1587
KateDocument::indent
void indent(KTextEditor::Range range, int change)
Definition: katedocument.cpp:2898
KateView::tagRange
bool tagRange(const KTextEditor::Range &range, bool realLines=false)
Definition: kateview.cpp:1858
KateBookmarks
Definition: katebookmarks.h:34
KateView::registerCompletionModel
virtual void registerCompletionModel(KTextEditor::CodeCompletionModel *model)
Definition: kateview.cpp:2344
KateView::toggleWWMarker
void toggleWWMarker()
Definition: kateview.cpp:1461
KateDocument::fromVirtualColumn
int fromVirtualColumn(int line, int column) const
Definition: katedocument.cpp:2579
spellcheck.h
KateGlobal::clipboardHistory
const QStringList & clipboardHistory() const
Clipboard history, filled with text we ever copied to clipboard via copyToClipboard.
Definition: kateglobal.h:423
KateView::wordLeft
void wordLeft()
Definition: kateview.cpp:2608
KParts::ReadOnlyPart::url
KUrl url
KateViewConfig::foldingBar
bool foldingBar() const
Definition: kateconfig.cpp:1507
KateViewConfig::setScrollBarMarks
void setScrollBarMarks(bool on)
Definition: kateconfig.cpp:1410
KateView::top
void top()
Definition: kateview.cpp:2730
KateSnippetGlobal::showDialog
void showDialog(KateView *view)
Show the snippet dialog, used by most simple apps using just KatePart.
Definition: katesnippetglobal.cpp:61
KateView::getViInputModeManager
KateViInputModeManager * getViInputModeManager()
Definition: kateview.cpp:1567
KateViewInternal::doDeletePrevWord
void doDeletePrevWord()
Definition: kateviewinternal.cpp:811
katebookmarks.h
KTextEditor::View::textInserted
void textInserted(KTextEditor::View *view, const KTextEditor::Cursor &position, const QString &text)
kencodingfiledialog.h
KateDocument::comment
void comment(KateView *view, uint line, uint column, int change)
Definition: katedocument.cpp:3301
Kate::TextFolding::foldRange
bool foldRange(qint64 id)
Fold the given range.
Definition: katetextfolding.cpp:168
KateView::cursorSelected
bool cursorSelected(const KTextEditor::Cursor &cursor)
Definition: kateview.cpp:2058
KGlobal::config
KSharedConfigPtr config()
kateviewhelpers.h
katebuffer.h
Kate::TextFolding::unfoldRange
bool unfoldRange(qint64 id, bool remove=false)
Unfold the given range.
Definition: katetextfolding.cpp:191
KTextEditor::ViewBarContainer::addViewBarToLayout
virtual void addViewBarToLayout(View *view, QWidget *bar, enum Position position)=0
KateDocument::lastLine
int lastLine() const
gets the last line number (lines() - 1)
Definition: katedocument.h:691
KateView::shiftUp
void shiftUp()
Definition: kateview.cpp:2665
KateViewInternal::tagLines
bool tagLines(int start, int end, bool realLines=false)
Definition: kateviewinternal.cpp:1965
KateScriptConsole
Definition: katescriptconsole.h:72
KateViewInternal::doDeleteNextWord
void doDeleteNextWord()
Definition: kateviewinternal.cpp:822
KStandardAction::FindPrev
KateSpellCheckDialog::createActions
void createActions(KActionCollection *)
Definition: spellcheckdialog.cpp:62
KateView::setLineNumbersOn
void setLineNumbersOn(bool enable)
Definition: kateview.cpp:1411
KateViewSchemaAction
Definition: kateschema.h:80
KateCompletionWidget::unregisterCompletionModel
void unregisterCompletionModel(KTextEditor::CodeCompletionModel *model)
Definition: katecompletionwidget.cpp:1218
KateView::setScrollBarMiniMapWidth
void setScrollBarMiniMapWidth(int width)
Definition: kateview.cpp:1451
KateView::iconBorder
bool iconBorder()
Definition: kateview.cpp:1476
KateHighlightingMenu
Definition: katehighlightmenu.h:30
KTextEditor::MovingRangeFeedback::mouseEnteredRange
virtual void mouseEnteredRange(MovingRange *range, View *view)
KateView::selectionRange
virtual const KTextEditor::Range & selectionRange() const
Definition: kateview.cpp:2760
KSelectAction
kcursor.h
KStandardAction::Deselect
KateView::keyReturn
void keyReturn()
Definition: kateview.cpp:2536
KateView::slotUpdateUndo
void slotUpdateUndo()
Definition: kateview.cpp:1249
KateView::visibleRange
KTextEditor::Range visibleRange()
Definition: kateview.cpp:3021
KateViewInternal::cursorToMatchingBracket
void cursorToMatchingBracket(bool sel=false)
Definition: kateviewinternal.cpp:1456
KateDocument::Lowercase
Definition: katedocument.h:734
KateRenderer
Handles all of the work of rendering the text (used for the views and printing)
Definition: katerenderer.h:50
KateView::displayRangeChanged
void displayRangeChanged(KateView *view)
KateView::completionWidget
KateCompletionWidget * completionWidget() const
Definition: kateview.cpp:2321
KateIconBorder::setIconBorderOn
void setIconBorderOn(bool enable)
Definition: kateviewhelpers.cpp:1289
katescriptconsole.h
KTextEditor::View::EditOverwrite
kglobal.h
KateView::replace
void replace()
Definition: kateview.cpp:1597
KateView::toggleViInputMode
void toggleViInputMode()
Definition: kateview.cpp:1525
KateIconBorder::setFoldingMarkersOn
void setFoldingMarkersOn(bool enable)
Definition: kateviewhelpers.cpp:1352
KTextEditor::Message::position
MessagePosition position() const
KateView::setConfigValue
void setConfigValue(const QString &key, const QVariant &value)
Definition: kateview.cpp:2894
KTextEditor::MovingRange::ExpandLeft
KateViewConfig::setViInputMode
void setViInputMode(bool on)
Definition: kateconfig.cpp:1698
katemodemenu.h
KateGlobal::registerView
void registerView(KateView *view)
register view at the factory this allows us to loop over all views for example on config changes ...
Definition: kateglobal.cpp:485
KateView::updateRendererConfig
void updateRendererConfig()
Definition: kateview.cpp:1770
KateView::up
void up()
Definition: kateview.cpp:2660
KateView::viewEditMode
EditMode viewEditMode() const
Definition: kateview.cpp:1122
Kate::TextFolding::foldingRangesStartingOnLine
QVector< QPair< qint64, FoldingRangeFlags > > foldingRangesStartingOnLine(int line) const
Queries which folding ranges start at the given line and returns the id + flags for all of them...
Definition: katetextfolding.cpp:476
KateCompletionWidget
This is the code completion's main widget, and also contains the core interface logic.
Definition: katecompletionwidget.h:55
KStandardShortcut::zoomOut
const KShortcut & zoomOut()
KateView::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *)
Definition: kateview.cpp:1268
KateViewInternal::cursorNextChar
void cursorNextChar(bool sel=false)
Definition: kateviewinternal.cpp:1069
KateView::transpose
void transpose()
Definition: kateview.cpp:2571
KateView::keyDelete
void keyDelete()
Definition: kateview.cpp:2561
KateView::scrollBarMiniMap
bool scrollBarMiniMap()
Definition: kateview.cpp:1488
KTextEditor::Cursor::isValid
virtual bool isValid() const
KateBookmarks::createActions
void createActions(KActionCollection *)
Definition: katebookmarks.cpp:83
katesnippetglobal.h
KateView::dictionaryBar
KateDictionaryBar * dictionaryBar()
Definition: kateview.cpp:2979
KateDocument::wrapText
bool wrapText(int startLine, int endLine)
Remove a line.
Definition: katedocument.cpp:855
kateschema.h
KateRenderer::config
KateRendererConfig * config() const
Configuration.
Definition: katerenderer.h:362
KStandardAction::Replace
KateView::slotCollapseLevel
void slotCollapseLevel()
Definition: kateview.cpp:1067
KateView::setSelection
virtual bool setSelection(const KTextEditor::Range &selection)
Definition: kateview.cpp:1931
KateViewInternal::cursorUp
void cursorUp(bool sel=false)
Definition: kateviewinternal.cpp:1402
KateDocument::transform
void transform(KateView *view, const KTextEditor::Cursor &, TextTransform)
Handling uppercase, lowercase and capitalize for the view.
Definition: katedocument.cpp:3383
KateView::consoleBar
KateScriptConsole * consoleBar()
Definition: kateview.cpp:2951
KUrl::List::fromMimeData
static KUrl::List fromMimeData(const QMimeData *mimeData, KUrl::MetaDataMap *metaData=0)
KateView::deleteWordRight
void deleteWordRight()
Definition: kateview.cpp:2566
kmenu.h
katepartpluginmanager.h
KateView::uppercase
void uppercase()
Uppercases selected text, or an alphabetic character next to the cursor.
Definition: kateview.cpp:2513
KXMLGUIClient::componentData
virtual KComponentData componentData() const
messageinterface.h
KTextEditor::Document
KateSearchBar::updateHighlightColors
void updateHighlightColors()
Definition: katesearchbar.cpp:1556
KateView::lineIsSelection
bool lineIsSelection(int line)
Definition: kateview.cpp:2088
KateView::configChanged
void configChanged()
KateView::shiftCursorLeft
void shiftCursorLeft()
Definition: kateview.cpp:2584
KateView::editEnd
void editEnd(int editTagLineStart, int editTagLineEnd, bool tagFrom)
Definition: kateview.cpp:1841
katelayoutcache.h
KateGlobal::snippetGlobal
KateSnippetGlobal * snippetGlobal()
global instance of the snippet handling lazy constructed on first use to allow it to use the session ...
Definition: kateglobal.cpp:250
KateView::scrollBarMiniMapAll
bool scrollBarMiniMapAll()
KateViewInternal::left
Definition: kateviewinternal.h:72
KateIconBorder::setDynWrapIndicators
void setDynWrapIndicators(int state)
Definition: kateviewhelpers.cpp:1339
kateglobal.h
KStandardShortcut::endOfLine
const KShortcut & endOfLine()
KateViewInternal::tagAll
void tagAll()
Definition: kateviewinternal.cpp:2056
KateView::unregisterCompletionModel
virtual void unregisterCompletionModel(KTextEditor::CodeCompletionModel *model)
Definition: kateview.cpp:2349
KateView::cursorToCoordinate
QPoint cursorToCoordinate(const KTextEditor::Cursor &cursor) const
Definition: kateview.cpp:2408
KateViewConfig::viInputModeStealKeys
bool viInputModeStealKeys() const
Definition: kateconfig.cpp:1716
KateView::topOfView
void topOfView()
Definition: kateview.cpp:2690
KateView::postMessage
void postMessage(KTextEditor::Message *message, QList< QSharedPointer< QAction > > actions)
Used by Document::postMessage().
Definition: kateview.cpp:3192
KateView::writeSessionConfig
void writeSessionConfig(KConfigGroup &)
Definition: kateview.cpp:1355
Kate::TextRange::setView
void setView(KTextEditor::View *view)
Sets the currently active view for this range.
Definition: katetextrange.cpp:243
KParts::BrowserExtension::childObject
static BrowserExtension * childObject(QObject *obj)
KateView::lineSelected
bool lineSelected(int line)
Definition: kateview.cpp:2071
QStringList
KTextEditor::View::EditInsert
KateViewInternal
Definition: kateviewinternal.h:57
KTextEditor::Range::invalid
static Range invalid()
KateView::toggleComment
void toggleComment()
Definition: kateview.cpp:2506
KActionCollection::actions
QList< QAction * > actions() const
KateDocumentConfig::eol
int eol() const
Definition: kateconfig.cpp:842
KStandardAction::SelectAll
KateSpellingMenu::setVisible
void setVisible(bool b)
Definition: spellingmenu.cpp:82
KateMessageWidget
This class implements a message widget based on KMessageWidget.
Definition: katemessagewidget.h:42
KateView::shiftToMatchingBracket
void shiftToMatchingBracket()
Definition: kateview.cpp:2755
KateIconBorder::iconBorderOn
bool iconBorderOn() const
Definition: kateviewhelpers.h:173
KateSearchBar::findPrevious
void findPrevious()
Definition: katesearchbar.cpp:269
KateSearchBar::slotReadWriteChanged
void slotReadWriteChanged()
Definition: katesearchbar.cpp:1632
KateDocument::lines
virtual int lines() const
Definition: katedocument.cpp:753
KParts::ReadWritePart::isReadWrite
bool isReadWrite() const
Kate::TextCursor::line
int line() const
Retrieve the line on which this cursor is situated.
Definition: katetextcursor.cpp:132
Kate::TextRange::toRange
const KTextEditor::Range toRange() const
Convert this clever range into a dumb one.
Definition: katetextrange.h:143
KStandardShortcut::backwardWord
const KShortcut & backwardWord()
KIcon
KStandardShortcut::beginningOfLine
const KShortcut & beginningOfLine()
KateViewInternal::getMouse
KTextEditor::Cursor getMouse() const
Definition: kateviewinternal.h:191
KateView::insertTemplateTextImplementation
virtual bool insertTemplateTextImplementation(const KTextEditor::Cursor &, const QString &templateString, const QMap< QString, QString > &initialValues)
Definition: kateview.cpp:2250
KateView::cmdLineBar
KateCommandLineBar * cmdLineBar()
Definition: kateview.cpp:2941
KateView::completionExecuted
void completionExecuted(KTextEditor::View *view, const KTextEditor::Cursor &position, KTextEditor::CodeCompletionModel *model, const QModelIndex &)
KateViewSchemaAction::updateMenu
void updateMenu(KateView *view)
Definition: kateschema.cpp:88
KateSpellingMenu
Definition: spellingmenu.h:40
katecompletionwidget.h
KateView::toggleInsert
void toggleInsert()
Definition: kateview.cpp:1302
KateView::shiftPageUp
void shiftPageUp()
Definition: kateview.cpp:2715
KateCompletionWidget::registerCompletionModel
void registerCompletionModel(KTextEditor::CodeCompletionModel *model)
Definition: katecompletionwidget.cpp:1201
KateViewInternal::setCaretStyle
void setCaretStyle(KateRenderer::caretStyles style, bool repaint=false)
Set the caret's style.
Definition: kateviewinternal.cpp:1804
KTextEditor::MovingRangeFeedback::mouseExitedRange
virtual void mouseExitedRange(MovingRange *range, View *view)
kateviewinternal.h
KTextEditor::Message::AboveView
KateViewConfig::lineNumbers
bool lineNumbers() const
Definition: kateconfig.cpp:1381
katesearchbar.h
KTextEditor::MovingRangeFeedback::caretExitedRange
virtual void caretExitedRange(MovingRange *range, View *view)
KateView::toggleIconBorder
void toggleIconBorder()
Definition: kateview.cpp:1406
KateView::insertTab
void insertTab()
Definition: kateview.cpp:2551
KateDocument::undoCount
uint undoCount() const
Definition: katedocument.cpp:1365
KStandardAction::Find
Kate::TextFolding::Folded
Range is folded away.
Definition: katetextfolding.h:69
KateViewInternal::end
void end(bool sel=false)
Definition: kateviewinternal.cpp:1201
KateViInputModeManager::writeSessionConfig
void writeSessionConfig(KConfigGroup &config)
Definition: kateviinputmodemanager.cpp:612
redo
KAction * redo(const QObject *recvr, const char *slot, QObject *parent)
KateView::blockSelection
virtual bool blockSelection() const
Definition: kateview.cpp:2196
KParts::BrowserExtension::openUrlRequest
void openUrlRequest(const KUrl &url, const KParts::OpenUrlArguments &arguments=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArguments=KParts::BrowserArguments())
KateScrollBar::setMiniMapAll
void setMiniMapAll(bool b)
Definition: kateviewhelpers.h:81
ViMode
ViMode
The four vi modes supported by Kate's vi input mode.
Definition: kateviinputmodemanager.h:48
KateRendererConfig::setBackgroundColor
void setBackgroundColor(const QColor &col)
Definition: kateconfig.cpp:2186
KateView::setReplacementPattern
void setReplacementPattern(const QString &replacementPattern)
Set the current replacement pattern.
Definition: kateview.cpp:2456
KateView::find
void find()
Definition: kateview.cpp:1577
kstandardaction.h
KateViewInternal::editStart
void editStart()
Definition: kateviewinternal.cpp:3313
KateView::foldLine
void foldLine(int startLine)
Try to fold starting at the given line.
Definition: kateview.cpp:1095
KateViewConfig::setDefaultMarkType
void setDefaultMarkType(uint type)
Definition: kateconfig.cpp:1646
katedocumenthelpers.h
KateDocument::setModified
virtual void setModified(bool m)
Definition: katedocument.cpp:2483
KateView::configKeys
QStringList configKeys() const
Definition: kateview.cpp:2859
KateView::shiftWordRight
void shiftWordRight()
Definition: kateview.cpp:2632
KXMLGUIClient::setComponentData
virtual void setComponentData(const KComponentData &componentData)
KStandardAction::FindNext
KateView::killLine
void killLine()
Definition: kateview.cpp:2518
katetemplatehandler.h
KateView::updateConfig
void updateConfig()
Definition: kateview.cpp:1658
KateView::updateRangesIn
void updateRangesIn(KTextEditor::Attribute::ActivationType activationType)
check if ranges changed for mouse in and caret in
Definition: kateview.cpp:3107
KateSearchBar::replacementPattern
QString replacementPattern() const
Definition: katesearchbar.cpp:237
KateView::clear
void clear()
Definition: kateview.cpp:1878
KateView::activateEditActions
void activateEditActions()
Definition: kateview.cpp:2298
KateView::findNext
void findNext()
Definition: kateview.cpp:1607
KateViewInternal::doTabulator
void doTabulator()
Definition: kateviewinternal.cpp:801
KStandardShortcut::reload
const KShortcut & reload()
KTextEditor::AnnotationModel
KateViewInternal::doDelete
void doDelete()
Definition: kateviewinternal.cpp:791
katewordcompletion.h
KTextEditor::Attribute::ActivateCaretIn
KateView::selection
virtual bool selection() const
Definition: kateview.cpp:2008
KateView::setScrollBarMiniMapAll
void setScrollBarMiniMapAll(bool enable)
Definition: kateview.cpp:1441
KateView::delayedUpdateOfView
void delayedUpdateOfView()
Delayed update for view after text ranges changed.
KStandardAction::Save
KateSearchBar::SearchForward
Definition: katesearchbar.h:72
KateDocument::Uppercase
Definition: katedocument.h:734
KateView::blockFix
static void blockFix(KTextEditor::Range &range)
Definition: kateview.cpp:100
KateView::showSnippetsDialog
void showSnippetsDialog()
Definition: kateview.cpp:711
KatePartPluginManager::self
static KatePartPluginManager * self()
Definition: katepartpluginmanager.cpp:70
KateView::dropEventPass
void dropEventPass(QDropEvent *)
KTextEditor::View::cursorPositionChanged
void cursorPositionChanged(KTextEditor::View *view, const KTextEditor::Cursor &newPosition)
KateViewConfig::iconBar
bool iconBar() const
Definition: kateconfig.cpp:1486
KateIconBorder::annotationModelChanged
void annotationModelChanged(KTextEditor::AnnotationModel *oldmodel, KTextEditor::AnnotationModel *newmodel)
Definition: kateviewhelpers.cpp:2191
KTextEditor::View::focusIn
void focusIn(KTextEditor::View *view)
KateRendererConfig::setWordWrapMarker
void setWordWrapMarker(bool on)
Definition: kateconfig.cpp:2165
KateView
Definition: kateview.h:78
KTextEditor::MovingCursor::toCursor
const Cursor toCursor() const
KateIconBorder::setLineNumbersOn
void setLineNumbersOn(bool enable)
Definition: kateviewhelpers.cpp:1326
KateView::align
void align()
Definition: kateview.cpp:2482
KateView::editStart
void editStart()
Definition: kateview.cpp:1836
KTextEditor::Range
KateView::setEol
void setEol(int eol)
Definition: kateview.cpp:1375
KateView::unfoldLine
void unfoldLine(int startLine)
Try to unfold all foldings starting at the given line.
Definition: kateview.cpp:1110
KateView::spellingMenu
KateSpellingMenu * spellingMenu()
Definition: kateview.cpp:3040
KateRenderer::setIndentWidth
void setIndentWidth(int indentWidth)
Sets the width of the tab.
Definition: katerenderer.cpp:130
KAction::setShortcut
void setShortcut(const KShortcut &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
KateViewInternal::updateDirty
void updateDirty()
Definition: kateviewinternal.cpp:2839
kaction.h
KCursor::setAutoHideCursor
static void setAutoHideCursor(QWidget *w, bool enable, bool customEventFilter=false)
kstandardshortcut.h
KateView::toggleLineNumbersOn
void toggleLineNumbersOn()
Definition: kateview.cpp:1416
KateView::slotTextInserted
void slotTextInserted(KTextEditor::View *view, const KTextEditor::Cursor &position, const QString &text)
Definition: kateview.cpp:2245
KateView::setSearchPattern
void setSearchPattern(const QString &searchPattern)
Set the current search pattern.
Definition: kateview.cpp:2451
KateView::updateView
void updateView(bool changed=false)
Definition: kateview.cpp:1891
KateView::setMouseTrackingEnabled
virtual bool setMouseTrackingEnabled(bool enable)
Definition: kateview.cpp:2310
KateView::cursorRight
void cursorRight()
Definition: kateview.cpp:2592
KateDocument
Definition: katedocument.h:74
KateViewConfig::setAutomaticCompletionInvocation
void setAutomaticCompletionInvocation(bool on)
Definition: kateconfig.cpp:1763
KateView::joinLines
void joinLines()
Joins lines touched by the selection.
Definition: kateview.cpp:1329
KateView::selectLine
void selectLine(const KTextEditor::Cursor &cursor)
Definition: kateview.cpp:2149
QSet< Kate::TextRange * >
KateViewIndentationAction
This action provides a list of available indenters and gets plugged into the KateView's KActionCollec...
Definition: kateautoindent.h:235
KateView::isAnnotationBorderVisible
bool isAnnotationBorderVisible() const
Definition: kateview.cpp:3016
KateView::cursorLeft
void cursorLeft()
Definition: kateview.cpp:2576
KateViewInternal::doTranspose
void doTranspose()
Definition: kateviewinternal.cpp:806
KateViewConfig::allowMarkMenu
bool allowMarkMenu() const
Definition: kateconfig.cpp:1659
KateView::down
void down()
Definition: kateview.cpp:2670
KateViInputModeManager::readSessionConfig
void readSessionConfig(const KConfigGroup &config)
Definition: kateviinputmodemanager.cpp:576
KateCompletionWidget::userInvokedCompletion
void userInvokedCompletion()
Definition: katecompletionwidget.cpp:1320
KateViewInternal::wordPrev
void wordPrev(bool sel=false)
Definition: kateviewinternal.cpp:1074
KateViewInternal::pageDown
void pageDown(bool sel=false, bool half=false)
Definition: kateviewinternal.cpp:1555
KateRenderer::setTabWidth
void setTabWidth(int tabWidth)
Sets the width of the tab.
Definition: katerenderer.cpp:115
KateViewConfig::setFoldingBar
void setFoldingBar(bool on)
Definition: kateconfig.cpp:1515
KateScriptActionMenu
Tools > Scripts menu This menu is filled with the command line scripts exported via the scripting sup...
Definition: katescriptaction.h:55
KateIconBorder::annotationBorderOn
bool annotationBorderOn() const
Definition: kateviewhelpers.h:176
KateBookmarks::Sorting
Sorting
Definition: katebookmarks.h:39
KateSearchBar::nextMatchForSelection
static void nextMatchForSelection(KateView *view, SearchDirection searchDirection)
Definition: katesearchbar.cpp:1228
KateCommandLineBar
Definition: kateviewhelpers.h:408
ok
KGuiItem ok()
KateDocument::kateTextLine
Kate::TextLine kateTextLine(uint i)
Definition: katedocument.cpp:4707
KateRenderer::caretStyles
caretStyles
Style of Caret.
Definition: katerenderer.h:69
KateView::slotFoldToplevelNodes
void slotFoldToplevelNodes()
Definition: kateview.cpp:1047
KateView::reloadFile
void reloadFile()
Definition: kateview.cpp:1204
KateView::pageUp
void pageUp()
Definition: kateview.cpp:2710
Kate::TextFolding::isLineVisible
bool isLineVisible(int line, qint64 *foldedRangeId=0) const
Query if a given line is visible.
Definition: katetextfolding.cpp:281
KateView::capitalize
void capitalize()
Capitalizes the selection (makes each word start with an uppercase) or the word under the cursor...
Definition: kateview.cpp:2528
KTextEditor::MovingRange::ExpandRight
KateRendererConfig::setSearchHighlightColor
void setSearchHighlightColor(const QColor &col)
Definition: kateconfig.cpp:2546
QMenu
KTextEditor::MovingRangeFeedback::caretEnteredRange
virtual void caretEnteredRange(MovingRange *range, View *view)
KateDictionaryBar
Definition: katedialogs.h:133
KateDocumentConfig::indentationWidth
int indentationWidth() const
Definition: kateconfig.cpp:427
KateView::cursorPosition
KTextEditor::Cursor cursorPosition() const
Definition: kateview.cpp:2398
KConfigGroup
KateView::KateView
KateView(KateDocument *doc, QWidget *parent)
Definition: kateview.cpp:110
KateView::cursorPositionVirtual
KTextEditor::Cursor cursorPositionVirtual() const
Definition: kateview.cpp:2403
KateGotoBar::updateData
void updateData()
Definition: katedialogs.cpp:1357
KUrl::List
KateMessageWidget::postMessage
void postMessage(KTextEditor::Message *message, QList< QSharedPointer< QAction > > actions)
Post a new incoming message.
Definition: katemessagewidget.cpp:186
Kate::TextRange::setInsertBehaviors
void setInsertBehaviors(InsertBehaviors insertBehaviors)
Set insert behaviors.
Definition: katetextrange.cpp:68
KTextEditor::Cursor::line
virtual int line() const
KateCompletionWidget::isCompletionActive
bool isCompletionActive() const
Definition: katecompletionwidget.cpp:746
KateView::setAnnotationModel
void setAnnotationModel(KTextEditor::AnnotationModel *model)
Definition: kateview.cpp:2999
KateView::removeSelectedText
bool removeSelectedText()
Definition: kateview.cpp:2021
KateViewInternal::getCursor
KTextEditor::Cursor getCursor() const
Definition: kateviewinternal.h:190
KTextEditor::MovingCursor::insertBehavior
virtual InsertBehavior insertBehavior() const =0
kxmlguiclient.h
Kate::TextBuffer::rangesForLine
QList< TextRange * > rangesForLine(int line, KTextEditor::View *view, bool rangesWithAttributeOnly) const
Return the ranges which affect the given line.
Definition: katetextbuffer.cpp:872
Kate::TextRange::end
const KTextEditor::MovingCursor & end() const
Retrieve end cursor of this range, read-only.
Definition: katetextrange.h:131
KateIconBorder::dynWrapIndicators
int dynWrapIndicators() const
Definition: kateviewhelpers.h:167
Kate::TextBuffer::lines
int lines() const
Lines currently stored in this buffer.
Definition: katetextbuffer.h:189
KateDocumentConfig::setEol
void setEol(int mode)
Definition: kateconfig.cpp:862
KTextEditor::MovingCursor::line
virtual int line() const =0
KXMLGUIClient::action
QAction * action(const char *name) const
KXMLGUIClient::parentClient
KXMLGUIClient * parentClient() const
KateSearchBar::enterPowerMode
void enterPowerMode()
Definition: katesearchbar.cpp:1276
KTextEditor::ViewBarContainer::deleteViewBarForView
virtual void deleteViewBarForView(View *view, enum Position position)=0
KatePartPluginManager::addView
void addView(KTextEditor::View *view)
Definition: katepartpluginmanager.cpp:124
KateViewConfig::automaticCompletionInvocation
bool automaticCompletionInvocation() const
Definition: kateconfig.cpp:1755
KStandardShortcut::deleteWordBack
const KShortcut & deleteWordBack()
KateView::viInputMode
bool viInputMode() const
Definition: kateview.cpp:1515
KateWordCompletionView
Definition: katewordcompletion.h:85
spellingmenu.h
KateView::tagSelection
void tagSelection(const KTextEditor::Range &oldSelection)
Definition: kateview.cpp:2093
KateViewInternal::prepareForDynWrapChange
void prepareForDynWrapChange()
Definition: kateviewinternal.cpp:241
KateViewConfig::viInputMode
bool viInputMode() const
Definition: kateconfig.cpp:1690
KateView::updateViModeBarCmd
void updateViModeBarCmd()
Update vi mode statusbar with the (partial) vi command being typed.
Definition: kateview.cpp:1555
KateViewBar::showBarWidget
void showBarWidget(KateViewBarWidget *barWidget)
Shows barWidget that was previously added with addBarWidget.
Definition: kateviewhelpers.cpp:2501
KateView::uncomment
void uncomment()
Definition: kateview.cpp:2501
KateView::setAnnotationBorderVisible
void setAnnotationBorderVisible(bool visible)
Definition: kateview.cpp:3011
QPoint
KTextEditor::View::focusOut
void focusOut(KTextEditor::View *view)
KateHighlighting::getCommentSingleLineStart
QString getCommentSingleLineStart(int attrib=0) const
Definition: katehighlight.cpp:1129
KateView::viModeEmulatedCommandBar
KateViEmulatedCommandBar * viModeEmulatedCommandBar()
Definition: kateview.cpp:2989
KStandardShortcut::prior
const KShortcut & prior()
KateView::m_toggleOnTheFlySpellCheck
KToggleAction * m_toggleOnTheFlySpellCheck
Definition: kateview.h:758
event.h
KateView::viewMode
QString viewMode() const
Definition: kateview.cpp:1130
KateView::getCurrentViMode
ViMode getCurrentViMode() const
Definition: kateview.cpp:1562
KateView::resetViInputModeManager
KateViInputModeManager * resetViInputModeManager()
Replace ViInputModeManager by new one.
Definition: kateview.cpp:1572
KParts::OpenUrlArguments::setMimeType
void setMimeType(const QString &mime)
KTextEditor::View::selectionChanged
void selectionChanged(KTextEditor::View *view)
KateViewInternal::endPos
KTextEditor::Cursor endPos() const
Definition: kateviewinternal.cpp:279
KateView::toMatchingBracket
void toMatchingBracket()
Definition: kateview.cpp:2750
snippetcompletionmodel.h
kselectaction.h
KateModeMenu::updateMenu
void updateMenu(KTextEditor::Document *doc)
Definition: katemodemenu.cpp:73
KateView::~KateView
~KateView()
Definition: kateview.cpp:294
KateDocument::editEnd
void editEnd()
End a editor operation.
Definition: katedocument.cpp:796
KStandardAction::PasteText
KTextEditor::Range::end
Cursor & end()
KateSpellingMenu::setUseMouseForMisspelledRange
void setUseMouseForMisspelledRange(bool b)
This method has to be called before the menu is shown in response to a context menu event...
Definition: spellingmenu.cpp:161
KateHighlighting
Definition: katehighlight.h:119
KateViewInternal::disableTextHints
void disableTextHints()
Definition: kateviewinternal.cpp:3304
KateView::switchToCmdLine
void switchToCmdLine()
Definition: kateview.cpp:1632
KateView::findPrevious
void findPrevious()
Definition: kateview.cpp:1612
KTextEditor::Range::containsLine
bool containsLine(int line) const
KAction
KateCompletionWidget::startCompletion
void startCompletion(KTextEditor::CodeCompletionModel::InvocationType invocationType, const QList< KTextEditor::CodeCompletionModel * > &models=QList< KTextEditor::CodeCompletionModel * >())
Definition: katecompletionwidget.cpp:286
Kate::TextLine
QSharedPointer< TextLineData > TextLine
The normal world only accesses the text lines with shared pointers.
Definition: katetextline.h:443
KateView::notifyAboutRangeChange
void notifyAboutRangeChange(int startLine, int endLine, bool rangeWithAttribute)
Attribute of a range changed or range with attribute changed in given line range. ...
Definition: kateview.cpp:3045
KateView::cut
void cut()
Definition: kateview.cpp:2158
KStandardAction::GotoLine
KTextEditor::Message::TopInView
Kate::TextRange::setRange
void setRange(const KTextEditor::Range &range)
Set the range of this range.
Definition: katetextrange.cpp:122
KateView::sendCompletionAborted
void sendCompletionAborted()
Definition: kateview.cpp:2369
KateView::deactivateEditActions
void deactivateEditActions()
Definition: kateview.cpp:2292
KTextEditor::Attribute::ActivationType
ActivationType
KateRendererConfig::searchHighlightColor
const QColor & searchHighlightColor() const
Definition: kateconfig.cpp:2538
KateViInputModeManager::isRecordingMacro
bool isRecordingMacro()
Definition: kateviinputmodemanager.cpp:340
KateViewInternal::home
void home(bool sel=false)
Definition: kateviewinternal.cpp:1166
KActionCollection::addAssociatedWidget
void addAssociatedWidget(QWidget *widget)
KateView::selectionText
virtual QString selectionText() const
Definition: kateview.cpp:2016
KateDocument::isOnTheFlySpellCheckingEnabled
bool isOnTheFlySpellCheckingEnabled() const
Definition: katedocument.cpp:5172
KateViInputModeManager::modeToString
static QString modeToString(ViMode mode)
convert mode to string representation for user
Definition: kateviinputmodemanager.cpp:866
Kate::TextRange::setZDepth
void setZDepth(qreal zDepth)
Set the current Z-depth of this range.
Definition: katetextrange.cpp:306
KatePasteMenu
Definition: kateviewhelpers.h:476
KateRendererConfig::backgroundColor
const QColor & backgroundColor() const
Definition: kateconfig.cpp:2178
KateView::ensureCursorColumnValid
void ensureCursorColumnValid()
Definition: kateview.cpp:1820
KateDocument::text
virtual QString text(const KTextEditor::Range &range, bool blockwise=false) const
Definition: katedocument.cpp:337
KateView::wrapCursor
bool wrapCursor() const
Definition: kateview.cpp:2237
KateView::setCursorPositionVisual
bool setCursorPositionVisual(const KTextEditor::Cursor &position)
Definition: kateview.cpp:2423
KTextEditor::View::mousePositionChanged
void mousePositionChanged(KTextEditor::View *view, const KTextEditor::Cursor &newPosition)
KateView::bottomOfView
void bottomOfView()
Definition: kateview.cpp:2700
KateScrollBar::setMiniMapWidth
void setMiniMapWidth(int width)
Definition: kateviewhelpers.h:84
Kate::TextFolding::newFoldingRange
qint64 newFoldingRange(const KTextEditor::Range &range, FoldingRangeFlags flags=FoldingRangeFlags())
Create a new folding range.
Definition: katetextfolding.cpp:99
ktoggleaction.h
KateView::lineHasSelected
bool lineHasSelected(int line)
Definition: kateview.cpp:2083
kateundomanager.h
KateView::setScrollBarMiniMap
void setScrollBarMiniMap(bool enable)
Definition: kateview.cpp:1431
KateView::virtualCursorColumn
int virtualCursorColumn() const
Return the virtual cursor column, each tab is expanded into the document's tabWidth characters...
Definition: kateview.cpp:1919
KateViewConfig::setLineNumbers
void setLineNumbers(bool on)
Definition: kateconfig.cpp:1389
KateViewConfig::dynWordWrap
bool dynWordWrap() const
Definition: kateconfig.cpp:1318
KateView::toggleFoldingMarkers
void toggleFoldingMarkers()
Definition: kateview.cpp:1471
KateView::setScrollBarMarks
void setScrollBarMarks(bool enable)
Definition: kateview.cpp:1421
KActionCollection::action
QAction * action(int index) const
KateView::setBlockSelection
virtual bool setBlockSelection(bool on)
Definition: kateview.cpp:2201
KToggleAction
KateBookmarks::setSorting
void setSorting(Sorting s)
Definition: katebookmarks.h:46
KateScrollBar::setShowMiniMap
void setShowMiniMap(bool b)
Definition: kateviewhelpers.cpp:131
KateScrollBar::setShowMarks
void setShowMarks(bool b)
Definition: kateviewhelpers.h:75
KateView::doc
KateDocument * doc()
accessor to katedocument pointer
Definition: kateview.h:552
KTextEditor::ViewBarContainer
KateDocument::toVirtualColumn
int toVirtualColumn(int line, int column) const
Definition: katedocument.cpp:2564
KateView::abortCompletion
virtual void abortCompletion()
Definition: kateview.cpp:2334
KateView::configValue
QVariant configValue(const QString &key)
Definition: kateview.cpp:2867
KateSnippetGlobal::createSnippet
void createSnippet(KateView *view)
Create snippet for given view, e.g.
Definition: katesnippetglobal.cpp:132
KateViewConfig::defaultMarkType
uint defaultMarkType() const
Definition: kateconfig.cpp:1638
KateViewInternal::enableTextHints
void enableTextHints(int timeout)
Definition: kateviewinternal.cpp:3293
KateView::tagAll
void tagAll()
Definition: kateview.cpp:1873
KateView::viInputModeStealKeys
bool viInputModeStealKeys() const
Definition: kateview.cpp:1520
KateDocument::Capitalize
Definition: katedocument.h:734
KTextEditor::Range::contains
bool contains(const Range &range) const
KateView::editSetCursor
void editSetCursor(const KTextEditor::Cursor &cursor)
Definition: kateview.cpp:1846
KateViewConfig
Definition: kateconfig.h:381
KateDocument::readOnly
bool readOnly() const
Definition: katedocument.h:138
KateViewConfig::setScrollBarMiniMapWidth
void setScrollBarMiniMapWidth(int width)
Definition: kateconfig.cpp:1473
KateViewInternal::tagLine
bool tagLine(const KTextEditor::Cursor &virtualCursor)
Definition: kateviewinternal.cpp:1949
katescriptaction.h
KateView::isOverwriteMode
bool isOverwriteMode() const
Return values for "save" related commands.
Definition: kateview.cpp:1199
KateDocument::redoCount
uint redoCount() const
Definition: katedocument.cpp:1370
KateView::reflectOnTheFlySpellCheckStatus
void reflectOnTheFlySpellCheckStatus(bool enabled)
Definition: kateview.cpp:3034
KateView::coordinatesToCursor
KTextEditor::Cursor coordinatesToCursor(const QPoint &coord) const
Definition: kateview.cpp:2413
Kate::TextRange::attribute
KTextEditor::Attribute::Ptr attribute() const
Gets the active Attribute for this range.
Definition: katetextrange.h:173
KateViewEncodingAction
Definition: kateviewhelpers.h:244
KateViewInternal::cursorDown
void cursorDown(bool sel=false)
Definition: kateviewinternal.cpp:1429
KTextEditor::MovingCursor::StayOnInsert
KateView::slotCollapseLocal
void slotCollapseLocal()
Definition: kateview.cpp:1057
KateRendererConfig::setReplaceHighlightColor
void setReplaceHighlightColor(const QColor &col)
Definition: kateconfig.cpp:2567
KateView::lineEndSelected
bool lineEndSelected(const KTextEditor::Cursor &lineEndPos)
Definition: kateview.cpp:2076
KateView::slotReadWriteChanged
void slotReadWriteChanged()
Definition: kateview.cpp:1210
katescriptmanager.h
KateView::createSnippet
void createSnippet()
Definition: kateview.cpp:706
KateDocument::editStart
void editStart()
Enclose editor actions with editStart() and editEnd() to group them.
Definition: katedocument.cpp:776
KateViewConfig::setAllowMarkMenu
void setAllowMarkMenu(bool allow)
Definition: kateconfig.cpp:1664
KTextEditor::View
KateView::shiftBottomOfView
void shiftBottomOfView()
Definition: kateview.cpp:2705
KateDocument::removeView
void removeView(KTextEditor::View *)
removes the view from the list of views.
Definition: katedocument.cpp:2540
kicon.h
KateView::cursorPositionCoordinates
QPoint cursorPositionCoordinates() const
Definition: kateview.cpp:2418
KateViewConfig::setDynWordWrap
void setDynWordWrap(bool wrap)
Definition: kateconfig.cpp:1326
KateViewBar
Definition: kateviewhelpers.h:319
kmessagebox.h
KateDocumentConfig::setBom
void setBom(bool bom)
Definition: kateconfig.cpp:875
KateView::shiftTop
void shiftTop()
Definition: kateview.cpp:2735
KTextEditor::Range::isEmpty
bool isEmpty() const
KateView::currentTextLine
QString currentTextLine()
Definition: kateview.cpp:2428
KateCompletionWidget::abortCompletion
void abortCompletion()
Definition: katecompletionwidget.cpp:751
KateSearchBar::findNext
void findNext()
Definition: katesearchbar.cpp:255
katemessagewidget.h
KateTemplateScript
Definition: katetemplatescript.h:28
KateDocumentConfig::tabWidth
int tabWidth() const
Definition: kateconfig.cpp:403
Kate::TextFolding::importFoldingRanges
void importFoldingRanges(const QVariantList &folds)
Import the folding ranges given as a QVariantList like read from configs.
Definition: katetextfolding.cpp:905
KateView::config
KateViewConfig * config()
Configuration.
Definition: kateview.h:654
KateHighlighting::isInWord
bool isInWord(QChar c, int attrib=0) const
Definition: katehighlight.cpp:1084
QFrame
KateView::setIconBorder
void setIconBorder(bool enable)
Definition: kateview.cpp:1401
KateView::setFoldingMarkersOn
void setFoldingMarkersOn(bool enable)
Definition: kateview.cpp:1466
KTextEditor::Message::BottomInView
kateviglobal.h
KStandardShortcut::end
const KShortcut & end()
KateHighlighting::allowsFolding
bool allowsFolding()
Definition: katehighlight.h:400
KateView::updateDocumentConfig
void updateDocumentConfig()
Definition: kateview.cpp:1744
kateconfig.h
KateView::scrollDown
void scrollDown()
Definition: kateview.cpp:2685
KTextEditor::Cursor::setColumn
virtual void setColumn(int column)
KTextEditor::Cursor::column
int column() const
Kate::TextFolding::exportFoldingRanges
QVariantList exportFoldingRanges() const
Return the current known folding ranges a QVariantList to store in configs.
Definition: katetextfolding.cpp:874
KTextEditor::View::EditMode
EditMode
KTextEditor::Message
KConfigGroup::readEntry
T readEntry(const QString &key, const T &aDefault) const
KateDocument::joinLines
void joinLines(uint first, uint last)
Unwrap a range of lines.
Definition: katedocument.cpp:3496
KateView::setCursorPositionInternal
bool setCursorPositionInternal(const KTextEditor::Cursor &position, uint tabwidth=1, bool calledExternally=false)
Definition: kateview.cpp:1278
KateViewInternal::cursorCoordinates
QPoint cursorCoordinates(bool includeBorder=true) const
Definition: kateviewinternal.cpp:737
Kate::TextRange
Class representing a 'clever' text range.
Definition: katetextrange.h:46
KateViewInternal::scrollUp
void scrollUp()
Definition: kateviewinternal.cpp:1493
KateView::lowercase
void lowercase()
Lowercases selected text, or an alphabetic character next to the cursor.
Definition: kateview.cpp:2523
KateView::changeDictionary
void changeDictionary()
Definition: kateview.cpp:1323
KateView::completionAborted
void completionAborted(KTextEditor::View *view)
KateViEmulatedCommandBar
A KateViewBarWidget that attempts to emulate some of the features of Vim's own command bar...
Definition: kateviemulatedcommandbar.h:40
KateView::setContextMenu
void setContextMenu(QMenu *menu)
Definition: kateview.cpp:2774
KTextEditor::View::viewEditModeChanged
void viewEditModeChanged(KTextEditor::View *view, enum KTextEditor::View::EditMode mode)
KateDocument::removeText
virtual bool removeText(const KTextEditor::Range &range, bool block=false)
Definition: katedocument.cpp:633
KateView::shiftPageDown
void shiftPageDown()
Definition: kateview.cpp:2725
QAction
KateViewInternal::bottom_end
void bottom_end(bool sel=false)
Definition: kateviewinternal.cpp:1654
KateCompletionWidget::execute
void execute()
Definition: katecompletionwidget.cpp:795
KXMLGUIFactory::containers
QList< QWidget * > containers(const QString &tagName)
KMessageBox::error
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
KateViewInternal::dynWrapChanged
void dynWrapChanged()
Definition: kateviewinternal.cpp:247
QMap< QString, QString >
KateViewConfig::setScrollBarMiniMap
void setScrollBarMiniMap(bool on)
Definition: kateconfig.cpp:1431
KateDocument::browserView
bool browserView() const
Definition: katedocument.h:139
KateViewConfig::setDynWordWrapIndicators
void setDynWordWrapIndicators(int mode)
Definition: kateconfig.cpp:1347
KParts::OpenUrlArguments
KateView::pageDown
void pageDown()
Definition: kateview.cpp:2720
KateViewInternal::coordinatesToCursor
KTextEditor::Cursor coordinatesToCursor(const QPoint &coord, bool includeBorder=true) const
Definition: kateviewinternal.cpp:2736
KateView::paste
void paste(const QString *textToPaste=0)
Definition: kateview.cpp:2374
KateView::topViewBar
KateViewBar * topViewBar() const
Accessors to the bars...
Definition: kateview.cpp:2931
KateView::copy
void copy() const
Definition: kateview.cpp:2169
QList
KateGlobal::scriptManager
KateScriptManager * scriptManager()
Global script collection.
Definition: kateglobal.h:320
KateDocumentConfig::bom
bool bom() const
Definition: kateconfig.cpp:888
KateViewConfig::global
static KateViewConfig * global()
Definition: kateconfig.h:402
KStandardShortcut::begin
const KShortcut & begin()
KateView::shiftEnd
void shiftEnd()
Definition: kateview.cpp:2655
KateScriptManager::templateScript
KateTemplateScript * templateScript(KTextEditor::TemplateScript *templateScript)
Definition: katescriptmanager.cpp:410
list
QStringList list(const QString &fileClass)
KateView::unIndent
void unIndent()
Definition: kateview.cpp:2468
KateView::setAutomaticInvocationEnabled
virtual void setAutomaticInvocationEnabled(bool enabled=true)
Definition: kateview.cpp:2359
KateView::indent
void indent()
Definition: kateview.cpp:2461
KTextEditor::CodeCompletionModel
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Applications
  •   Libraries
  •     libkonq
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal