• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • part
katesearch.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2004-2005 Anders Lund <anders@alweb.dk>
3  Copyright (C) 2002 John Firebaugh <jfirebaugh@kde.org>
4  Copyright (C) 2001-2004 Christoph Cullmann <cullmann@kde.org>
5  Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
6  Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License version 2 as published by the Free Software Foundation.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef __KATE_SEARCH_H__
24 #define __KATE_SEARCH_H__
25 
26 #include "katecursor.h"
27 #include "../interfaces/document.h"
28 
29 #include <kdialogbase.h>
30 
31 #include <tqstring.h>
32 #include <tqregexp.h>
33 #include <tqstringlist.h>
34 #include <tqvaluelist.h>
35 
36 class KateView;
37 class KateDocument;
38 class KateSuperRangeList;
39 
40 class TDEActionCollection;
41 
42 class KateSearch : public TQObject
43 {
44  TQ_OBJECT
45 
46  friend class KateDocument;
47 
48  private:
49  class SearchFlags
50  {
51  public:
52  bool caseSensitive :1;
53  bool wholeWords :1;
54  bool fromBeginning :1;
55  bool backward :1;
56  bool selected :1;
57  bool prompt :1;
58  bool replace :1;
59  bool finished :1;
60  bool regExp :1;
61  bool useBackRefs :1;
62  };
63 
64  class SConfig
65  {
66  public:
67  SearchFlags flags;
68  KateTextCursor cursor;
69  KateTextCursor wrappedEnd; // after wraping around, search/replace until here
70  bool wrapped; // have we allready wrapped around ?
71  bool showNotFound; // pop up annoying dialogs?
72  uint matchedLength;
73  KateTextCursor selBegin;
74  KateTextCursor selEnd;
75  };
76 
77  public:
78  enum Dialog_results {
79  srCancel = KDialogBase::Cancel,
80  srAll = KDialogBase::User1,
81  srLast = KDialogBase::User2,
82  srNo = KDialogBase::User3,
83  srYes = KDialogBase::Ok
84  };
85 
86  public:
87  KateSearch( KateView* );
88  ~KateSearch();
89 
90  void createActions( TDEActionCollection* );
91 
92  public slots:
93  void find();
105  void find( const TQString &pattern, long flags, bool add=true, bool shownotfound=false );
106  void replace();
115  void replace( const TQString &pattern, const TQString &replacement, long flags );
116  void findAgain( bool reverseDirection );
117 
118  private slots:
119  void replaceSlot();
120  void slotFindNext() { findAgain( false ); }
121  void slotFindPrev() { findAgain( true ); }
122 
123  private:
124  static void addToList( TQStringList&, const TQString& );
125  static void addToSearchList( const TQString& s ) { addToList( s_searchList, s ); }
126  static void addToReplaceList( const TQString& s ) { addToList( s_replaceList, s ); }
127  static TQStringList s_searchList;
128  static TQStringList s_replaceList;
129  static TQString s_pattern;
130 
131  void search( SearchFlags flags );
132  void wrapSearch();
133  bool askContinue();
134 
135  void findAgain();
136  void promptReplace();
137  void replaceAll();
138  void replaceOne();
139  void skipOne();
140 
141  TQString getSearchText();
142  KateTextCursor getCursor( SearchFlags flags );
143  bool doSearch( const TQString& text );
144  void exposeFound( KateTextCursor &cursor, int slen );
145 
146  inline KateView* view() { return m_view; }
147  inline KateDocument* doc() { return m_doc; }
148 
149  KateView* m_view;
150  KateDocument* m_doc;
151 
152  KateSuperRangeList* m_arbitraryHLList;
153 
154  SConfig s;
155 
156  TQValueList<SConfig> m_searchResults;
157  int m_resultIndex;
158 
159  int replaces;
160  TQDialog* replacePrompt;
161  TQString m_replacement;
162  TQRegExp m_re;
163 };
164 
168 class KateReplacePrompt : public KDialogBase
169 {
170  TQ_OBJECT
171 
172  public:
177  KateReplacePrompt(TQWidget *parent);
178 
179  signals:
183  void clicked();
184 
185  protected slots:
189  void slotOk ();
190 
194  void slotClose ();
195 
199  void slotUser1 ();
200 
204  void slotUser2 ();
205 
209  void slotUser3 ();
210 
215  void done (int result);
216 };
217 
218 class SearchCommand : public Kate::Command, public Kate::CommandExtension
219 {
220  public:
221  SearchCommand() : m_ifindFlags(0) {;}
222  bool exec(class Kate::View *view, const TQString &cmd, TQString &errorMsg);
223  bool help(class Kate::View *, const TQString &, TQString &);
224  TQStringList cmds();
225  bool wantsToProcessText( const TQString &/*cmdname*/ );
226  void processText( Kate::View *view, const TQString& text );
227 
228  private:
232  void ifindInit( const TQString &cmd );
236  void ifindClear();
237 
238  long m_ifindFlags;
239 };
240 
241 #endif
KDialogBase
KDialogBase::User3
User3
KDialogBase::User2
User2
KDialogBase::User1
User1
KDialogBase::Ok
Ok
KDialogBase::Cancel
Cancel
KateReplacePrompt
simple replace prompt dialog
Definition: katesearch.h:169
KateReplacePrompt::slotUser3
void slotUser3()
Yes pressed.
Definition: katesearch.cpp:802
KateReplacePrompt::slotUser2
void slotUser2()
last pressed
Definition: katesearch.cpp:796
KateReplacePrompt::slotOk
void slotOk()
ok pressed
Definition: katesearch.cpp:778
KateReplacePrompt::KateReplacePrompt
KateReplacePrompt(TQWidget *parent)
Constructor.
Definition: katesearch.cpp:764
KateReplacePrompt::done
void done(int result)
dialog done
Definition: katesearch.cpp:808
KateReplacePrompt::slotClose
void slotClose()
close pressed
Definition: katesearch.cpp:784
KateReplacePrompt::slotUser1
void slotUser1()
replace all pressed
Definition: katesearch.cpp:790
KateReplacePrompt::clicked
void clicked()
button clicked
KateTextCursor
Simple cursor class with no document pointer.
Definition: katecursor.h:34
Kate::CommandExtension
Extension to the Command interface, allowing to interact with commands during typing.
Definition: document.h:130
Kate::CommandExtension::wantsToProcessText
virtual bool wantsToProcessText(const TQString &cmdname)
Definition: document.h:169
Kate::CommandExtension::processText
virtual void processText(Kate::View *view, const TQString &text)
This is called by the commandline each time the argument text for the command changes,...
Definition: document.h:177
Kate::Command
Kate Commands.
Definition: document.h:97
Kate::Command::cmds
virtual TQStringList cmds()=0
Pure text start part of the commands which can be handled by this object which means i....
Kate::Command::help
virtual bool help(View *view, const TQString &cmd, TQString &msg)=0
Shows help for the given view and cmd string, return a bool about success, msg for status.
Kate::Command::exec
virtual bool exec(View *view, const TQString &cmd, TQString &msg)=0
Execute this command for the given view and cmd string, return a bool about success,...
Kate::View
The Kate::View text editor interface.
Definition: view.h:45
TDEActionCollection
TDEStdAccel::find
const TDEShortcut & find()
TDEStdAccel::replace
const TDEShortcut & replace()

kate

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

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.9.1
This website is maintained by Timothy Pearson.