]> git.lyx.org Git - lyx.git/blob - src/lyxfr0.h
Angus's 23rd November patch
[lyx.git] / src / lyxfr0.h
1 // -*- C++ -*-
2 #ifndef LYXFR0_H
3 #define LYXFR0_H
4
5 #ifdef __GNUG__
6 #pragma interface
7 #endif
8
9 #include "LString.h"
10 #include FORMS_H_LOCATION
11 #include "form1.h"
12 #include <sigc++/signal_system.h>
13
14 class LyXFindReplace;
15
16 #ifdef SIGC_CXX_NAMESPACES
17 using SigC::Object;
18 #endif
19
20 /**
21    The comments below are most likely not valied anymore since
22    the rewrite of LyXFindReplace0 and LyXFindReplace1. (Lgb)
23    
24   LyXFindReplace0
25  
26   This is a virtual base class. It does not handle text specific
27   items. It only manages the Find & Replace form and the variables.
28   
29   To be added:
30
31   - Confirm replace lightbutton (checkbox)
32
33   - A history list for search and replace strings.
34   These 2 stringlists should match, so that you can replay previous replaces.
35   If you select another search string, then the first choice should be the 
36   replace string you have typed before.
37   
38   - regex searches (I'm working on that -- dnaber, 1999-02-24)
39
40 */
41 class SearchForm : public Object {
42 public:
43         ///
44         SearchForm();
45         ///
46         ~SearchForm();  
47         
48         ///
49         bool CaseSensitive() const {
50                 return fl_get_button(search_form->btnCaseSensitive);
51         }
52
53         ///
54         bool MatchWord() const {
55                 return fl_get_button(search_form->btnMatchWord);
56         }
57
58         ///
59         string const SearchString() const {
60                 return fl_get_input(search_form->input_search);
61         }
62
63         /// Initialize internal variables and dialog
64         void StartSearch(LyXFindReplace *);
65
66         ///
67         void replaceEnabled(bool fEnabled);
68         ///
69         bool replaceEnabled() const { return fReplaceEnabled; }
70
71         // Callbacks from form
72         ///
73         void SearchCancelCB();
74
75         // Return values
76         ///
77         void SetSearchString(string const & ls);
78         ///
79         string const ReplaceString() const;
80
81         ///
82         bool ValidSearchData() const { return !(SearchString().empty()); }
83 private:
84         /** Redraw the form (on receipt of a Signal indicating, for example,
85             that the xform colors have been re-mapped).
86         */
87         void redraw();
88         ///
89         FD_form_search * search_form;
90         /// replace buttons enabled?
91         bool fReplaceEnabled;
92         /// Redraw connection.
93         SigC::Connection r_;
94 };
95
96 #endif