3 * FormGraphics Interface Class
6 * ======================================================
8 * LyX, The Document Processor
10 * Copyright 1995 Matthias Ettrich
11 * Copyright 1995-2000 The LyX Team.
13 * This file Copyright 2000
15 * ======================================================
18 #ifndef FORMGRAPHICS_H
19 #define FORMGRAPHICS_H
23 #include "frontends/DialogBase.h"
24 //#include "form_graphics.h"
25 #include "RadioButtonGroup.h"
32 // same arguement as in Dialogs.h s/LyX/UI/
36 struct FD_form_graphics;
38 /** This class provides an XForms implementation of the FormGraphics Dialog.
40 class FormGraphics: public DialogBase {
42 /**@name Constructors and Destructors */
44 /// #FormGraphics x(LyXFunc ..., Dialogs ...);#
45 FormGraphics(LyXView *, Dialogs *);
50 /**@name Real per-instance Callback Methods */
52 static int WMHideCB(FL_FORM *, void *);
53 static void OKCB(FL_OBJECT *, long);
54 static void ApplyCB(FL_OBJECT *, long);
55 static void CancelCB(FL_OBJECT *, long);
56 static void BrowseCB(FL_OBJECT *, long);
57 static void AdvancedOptionsCB(FL_OBJECT *, long);
58 static void InputCB(FL_OBJECT *, long);
62 FormGraphics() : widthButtons(5), heightButtons(4), displayButtons(4) {}
63 FormGraphics(FormGraphics &) : DialogBase() {}
65 /**@name Define enum constants */
67 /// The maximum digits for the image width (cm, inch, percent)
68 enum { WIDTH_MAXDIGITS = 3 };
69 /// The maximum digits for the image height (cm, inch, percent)
70 enum { HEIGHT_MAXDIGITS = 3 };
71 /// The maximum characters in the rotation angle (minus sign and 3 digits)
72 enum { ROTATE_MAXCHARS = 4 };
73 /// The maximum characters in a filename.
74 enum { FILENAME_MAXCHARS = 1024 };
78 /**@name Slot Methods */
80 /// Save the active inset and show the dialog.
81 void showDialog(InsetGraphics * inset);
82 /// Create the dialog if necessary, update it and display it.
90 /**@name Callback methods */
92 /// Apply the changes to the inset.
94 /// Verify that the input is correct. If not disable ok/apply buttons.
96 /// 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 /**@name Private Data */
111 /// Real GUI implementation.
112 FD_form_graphics * dialog_;
113 /** Which LyXFunc do we use?
114 We could modify Dialogs to have a visible LyXFunc* instead and
115 save a couple of bytes per dialog.
118 /** Which Dialogs do we belong to?
119 Used so we can get at the signals we have to connect to.
122 /** Which Inset do we belong to?
123 * Used to set and update data to/from the inset.
125 InsetGraphics * inset_;
126 /// The radio buttons groups
127 RadioButtonGroup widthButtons;
128 RadioButtonGroup heightButtons;
129 RadioButtonGroup displayButtons;
131 /// Inset Hide connection, connected to the calling inset hide signal.
135 /// Update connection.
137 /// Last used figure path
138 string last_image_path;