]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/FormCitation.h
Mathed fix from Dekel, GNOME patch from Marko, language-code from Garst
[lyx.git] / src / frontends / gnome / FormCitation.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2000 The LyX Team.
8  *
9  * ======================================================
10  */
11
12 #ifndef FORMCITATION_H
13 #define FORMCITATION_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "DialogBase.h"
20 #include "LString.h"
21 #include "support/utility.hpp"
22 #include "insets/insetcommand.h"
23
24 #include <gtk--/container.h>
25 #include <gtk--/clist.h>
26 #include <gnome--/entry.h>
27 #include <gnome--/less.h>
28 #include <gtk--/button.h>
29 #include <gtk--/paned.h>
30 #include <gtk--/box.h>
31 #include <gtk--/checkbutton.h>
32 #include "pixbutton.h"
33
34 /** This class provides an Gnome implementation of the FormCitation Dialog.
35  */
36 class FormCitation : public DialogBase, public noncopyable {
37 public:
38   ///
39   FormCitation(LyXView *, Dialogs *);
40   ///
41   ~FormCitation();
42 private:
43   /// Slot launching dialog to (possibly) create a new inset
44   void createInset( string const & );
45   /// Slot launching dialog to an existing inset
46   void showInset( InsetCommand * const );
47
48   /// The following three methods do nothing in this implementation
49   virtual void update() { }
50   virtual void apply() { }
51   void show() { }
52
53   /// Explicitly free the dialog.
54   void free();
55   /// Hide the dialog.
56   void hide();
57
58   /// Apply from dialog (modify or create inset)
59   void applySelect();
60   /// Apply from dialog (modify or create inset)
61   void applyEdit();
62
63   /// Ask user for requested action: add new citation or edit the existing ones
64   void showStageAction();
65   /// Ask user for regexp or keyword(s)
66   void showStageSearch();
67   /// Ask user to select the citation in the list
68   void showStageSelect();
69   /// Ask user to edit the citation in the list
70   void showStageEdit();
71
72   /// moves from Search to Select "stage"
73   void moveFromSearchToSelect();
74   /// moves from Action to Search "stage"
75   void moveFromActionToSearch();
76   /// moves from Action to Edit "stage"
77   void moveFromActionToEdit();
78   
79   /// sort biblist
80   void sortBibList(gint);
81   /// update state of the buttons
82   void updateButtons();
83   /// clist selection/unselection callback
84   void selectionToggled(gint            row,
85                         gint            column,
86                         GdkEvent       *event,
87                         bool selected,
88                         bool citeselected);
89
90   /// removes selected citation key
91   void removeCitation();
92   /// moves citation up
93   void moveCitationUp();
94   /// moves citation up
95   void moveCitationDown();
96
97   /// searches for entries (calls searchReg or searchSimple)
98   void search();
99   /// searches for entries using regexp
100   void searchReg();
101   /// searches for entries containing keyword(s)
102   void searchSimple();
103
104   /// adds item to clist_bib_
105   void addItemToBibList(int i);
106
107   /// sets all widget pointers to NULL
108   void cleanupWidgets();
109   /// initializes all non-NULL member widgets
110   void initWidgets();
111   /// stores configuration of all non-NULL member widgets
112   void storeWidgets();
113   
114   /** Which LyXFunc do we use?
115       We could modify Dialogs to have a visible LyXFunc* instead and
116       save a couple of bytes per dialog.
117   */
118   LyXView * lv_;
119   /** Which Dialogs do we belong to?
120       Used so we can get at the signals we have to connect to.
121   */
122   Dialogs * d_;
123   /// pointer to the inset passed through showInset (if any)
124   InsetCommand * inset_;
125   /// the nitty-griity. What is modified and passed back
126   InsetCommandParams params;
127   /// Update connection.
128   Connection u_;
129   /// Hide connection.
130   Connection h_;
131   /// inset::hide connection.
132   Connection ih_;
133
134   /// Real GUI implementation.
135   Gtk::Container * dialog_;
136   Gtk::Button * b_ok;
137   Gtk::Button * b_cancel;
138
139   Gnome::Entry * search_text_;
140   string search_string_;
141   bool use_regexp_;
142
143   Gnome::Less * info_;
144   Gnome::Entry * text_after_;
145
146   Gnome::PixButton * button_unselect_;
147   Gnome::PixButton * button_up_;
148   Gnome::PixButton * button_down_;
149   Gtk::CheckButton * button_regexp_;
150   
151   Gtk::CList * clist_selected_;
152   Gtk::CList * clist_bib_;
153   
154   Gtk::Paned * paned_info_;
155   
156   std::vector<string> bibkeys;
157   ///
158   std::vector<string> bibkeysInfo;
159 };
160
161 #endif