3 * FormGraphics Interface Class
6 * ======================================================
8 * LyX, The Document Processor
10 * Copyright 1995 Matthias Ettrich
11 * Copyright 1995-2000 The LyX Team.
13 * ======================================================
16 #ifndef FORMGRAPHICS_H
17 #define FORMGRAPHICS_H
20 #include "frontends/DialogBase.h"
21 #include "RadioButtonGroup.h"
22 #include <boost/utility.hpp>
23 #include "ButtonController.h"
24 #include "ButtonPolicies.h"
30 // Forward declarations for classes we use only as pointers.
35 struct FD_form_graphics;
37 /** This class provides an XForms implementation of the FormGraphics Dialog.
39 * @Author Baruch Even <baruch.even@writeme.com>
41 class FormGraphics: public DialogBase, public noncopyable {
43 /// #FormGraphics x(LyXFunc ..., Dialogs ...);#
44 FormGraphics(LyXView *, Dialogs *);
48 static int WMHideCB(FL_FORM *, void *);
50 static void OKCB(FL_OBJECT *, long);
52 static void ApplyCB(FL_OBJECT *, long);
54 static void CancelCB(FL_OBJECT *, long);
56 static void BrowseCB(FL_OBJECT *, long);
58 static void AdvancedOptionsCB(FL_OBJECT *, long);
60 static void InputCB(FL_OBJECT *, long);
63 /// The maximum digits for the image width (cm, inch, percent)
68 /// The maximum digits for the image height (cm, inch, percent)
73 /// The maximum characters in the rotation angle (minus sign and 3 digits)
78 /// The maximum characters in a filename.
81 FILENAME_MAXCHARS = 1024
84 /// Save the active inset and show the dialog.
85 void showDialog(InsetGraphics * inset);
86 /// Create the dialog if necessary, update it and display it.
91 void update(bool switched = false);
93 /// Apply the changes to the inset.
95 /// Verify that the input is correct. If not disable ok/apply buttons.
97 /// Open the file browse dialog to select an image file.
103 FD_form_graphics * build_graphics();
104 /// Explicitly free the dialog.
106 /// Display a file browser dialog and return the file chosen.
107 string browseFile(string const & filename);
109 /// Real GUI implementation.
110 FD_form_graphics * dialog_;
111 /** Which LyXFunc do we use?
112 We could modify Dialogs to have a visible LyXFunc* instead and
113 save a couple of bytes per dialog.
116 /** Which Dialogs do we belong to?
117 Used so we can get at the signals we have to connect to.
120 /** Which Inset do we belong to?
121 Used to set and update data to/from the inset.
123 InsetGraphics * inset_;
124 /// The radio buttons groups
125 RadioButtonGroup widthButtons;
127 RadioButtonGroup heightButtons;
129 RadioButtonGroup displayButtons;
130 /// Controls the actions of the buttons.
131 ButtonController * bc_;
133 /// Inset Hide connection, connected to the calling inset hide signal.
137 /// Update connection.
139 /// Last used figure path
140 string last_image_path;