]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GCitation.h
Add Bernhard's GTK+ citation dialog
[lyx.git] / src / frontends / gtk / GCitation.h
1 // -*- C++ -*-
2 /**
3  * \file GCitation.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Bernhard Reiter
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GCITATION_H
13 #define GCITATION_H
14
15 #include "GViewBase.h"
16
17 #include "ControlCitation.h"
18
19 #include "bufferparams.h"
20
21
22 namespace lyx {
23 namespace frontend {
24
25 class ControlCitation;
26
27 /** This class provides a GTK+ implementation of the Citation Dialog.
28  */
29 class GCitation : public GViewCB<ControlCitation, GViewGladeB> {
30 public:
31         GCitation(Dialog & parent);
32 private:
33         virtual void apply();
34         virtual void doBuild();
35         virtual void update();
36
37         /// Update dialog before/whilst showing it.
38         virtual void update_contents();
39
40         /// fill the styles combo
41         void fill_styles();
42
43         /// set the styles combo
44         void update_style();
45
46         /// enable the apply button if applylock_ is false
47         void enable_apply();
48
49         /// Move selected inset key up one line in list
50         void up();
51         /// Move selected inset key down one line in list
52         void down();
53
54         /// Add bibliography key to inset key list, remove it from bibliography view
55         void add();
56         /// Remove inset key from list, move it back to bibliography key view
57         void remove();
58
59         /// Find previous occurence of search string in selected key view
60         void previous();
61         /// Find next occurence of search string in selected key view
62         void next();
63         /// Find function, called by previous() and next()
64         void find(biblio::Direction);
65
66         /// Called when inset key is (un)selected
67         void cite_selected();
68         /// Called when bibliography key is (un)selected
69         void bib_selected();
70
71         /** Set previous and next buttons according to state of the search
72             string entry, the radio buttons and the selected keys in the inset
73             and bibliography views.
74          */
75         inline void set_search_buttons();
76
77         /** Helper function for bibFilter_; true if argument's 
78             [bibColumns.cite] is false.
79          */
80         static inline bool bib_visible(const Gtk::TreeModel::const_iterator&); 
81
82         /** apply() won't act when this is true. 
83             true if no text is selected when the citation dialog is opened 
84          */
85         bool applylock_;
86
87         /// Last selected stylecombo_ item
88         int style_;
89
90         Gtk::Button * restorebutton_;
91         Gtk::Button * cancelbutton_;
92         Gtk::Button * okbutton_;
93         Gtk::Button * applybutton_;
94
95         Gtk::Button * addbutton_;
96         Gtk::Button * removebutton_;
97         Gtk::Button * backbutton_;
98         Gtk::Button * forwardbutton_;
99         Gtk::Button * upbutton_;
100         Gtk::Button * downbutton_;
101
102         Gtk::TreeView * citekeysview_;
103         Gtk::TreeView * bibkeysview_;
104
105         Gtk::TextView * infoview_;
106
107         Gtk::Entry * findentry_;
108         Gtk::CheckButton * citeradio_;
109         Gtk::CheckButton * bibradio_;
110         Gtk::CheckButton * casecheck_;
111         Gtk::CheckButton * regexpcheck_;
112
113         Gtk::Label * stylelabel_;
114         Gtk::ComboBox * stylecombo_;
115
116         Gtk::Label * beforelabel_;
117         Gtk::Entry * beforeentry_;
118         Gtk::Entry * afterentry_;
119         Gtk::CheckButton * authorcheck_;
120         Gtk::CheckButton * uppercasecheck_;
121
122         Glib::RefPtr<Gtk::TextBuffer> info_;    
123
124         Glib::RefPtr<Gtk::ListStore> allListStore_;
125         Glib::RefPtr<Gtk::ListStore> styleStore_;
126
127         Glib::RefPtr<Gtk::TreeSelection> citeselection_;
128         Glib::RefPtr<Gtk::TreeSelection> bibselection_;
129
130         Glib::RefPtr<Gtk::TreeModelFilter> citeFilter_;
131         Glib::RefPtr<Gtk::TreeModelFilter> bibFilter_;
132         Glib::RefPtr<Gtk::TreeModelSort> bibSort_;
133
134 };
135
136 } // namespace frontend
137 } // namespace lyx
138
139 #endif // GCITATION_H