[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ktexteditor-devel
Subject:    rfc: View::isActiveView() ?
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2007-02-11 20:27:02
Message-ID: 200702112127.03245.dhdev () gmx ! de
[Download RAW message or body]

Hi,

in katepart we are checking for the active view in several places with

  if (document()->activeView() == a_view)

whether a_view is the document's active view.
The view emits several signals, for example cursorPositionChanged. If an 
application supports multiple views it might only be interested of changed 
cursor position of the active view. So for all such cases the user has to 
check for the activeView() like above.

The attached patch adds View::isActiveView() which simply returns the 
condition above.

(a) Do you agree to add this?
(b) Should I even remove 'virtual' or
(c) remove the implementation (i.e. make it abstract like everything else)
    and implement it in katepart?

Dominik

["active-view.diff" (text/x-diff)]

Index: ktexteditor.cpp
===================================================================
--- ktexteditor.cpp	(Revision 630572)
+++ ktexteditor.cpp	(Arbeitskopie)
@@ -162,6 +162,11 @@
   return v;
 }
 
+bool View::isActiveView() const
+{
+  return this == document()->activeView();
+}
+
 bool View::setSelection(const Cursor& position, int length,bool wrap)
 {
   KTextEditor::Document *doc=document();
Index: view.h
===================================================================
--- view.h	(Revision 630572)
+++ view.h	(Arbeitskopie)
@@ -169,6 +169,12 @@
      */
     virtual Document *document () const = 0;
 
+    /**
+     * Check whether this view is the document's active view.
+     * This is equal to document()->activeView() == view.
+     */
+    virtual bool isActiveView() const;
+
   /*
    * General information about this view
    */


_______________________________________________
KTextEditor-Devel mailing list
KTextEditor-Devel@kde.org
https://mail.kde.org/mailman/listinfo/ktexteditor-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic