1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2000-2001 The LyX Team.
8 * ======================================================
13 #include FORMS_H_LOCATION
16 #pragma implementation
20 #include "FormBaseDeprecated.h"
22 #include "support/LAssert.h"
32 int C_FormBaseDeprecatedWMHideCB(FL_FORM * ob, void * d)
34 return FormBaseDeprecated::WMHideCB(ob, d);
37 void C_FormBaseDeprecatedApplyCB(FL_OBJECT * ob, long d)
39 FormBaseDeprecated::ApplyCB(ob, d);
42 void C_FormBaseDeprecatedOKCB(FL_OBJECT * ob, long d)
44 FormBaseDeprecated::OKCB(ob, d);
47 void C_FormBaseDeprecatedCancelCB(FL_OBJECT * ob, long d)
49 FormBaseDeprecated::CancelCB(ob, d);
52 void C_FormBaseDeprecatedInputCB(FL_OBJECT * ob, long d)
54 FormBaseDeprecated::InputCB(ob, d);
57 void C_FormBaseDeprecatedRestoreCB(FL_OBJECT * ob, long d)
59 FormBaseDeprecated::RestoreCB(ob, d);
64 FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d,
65 string const & t, bool allowResize)
66 : lv_(lv), d_(d), h_(0), r_(0), title_(t),
67 minw_(0), minh_(0), allow_resize_(allowResize)
73 void FormBaseDeprecated::redraw()
75 if (form() && form()->visible)
76 fl_redraw_form(form());
80 void FormBaseDeprecated::connect()
82 fl_set_form_minsize(form(), minw_, minh_);
83 r_ = Dialogs::redrawGUI.connect(slot(this,&FormBaseDeprecated::redraw));
87 void FormBaseDeprecated::disconnect()
94 void FormBaseDeprecated::show()
101 // work around dumb xforms sizing bug
105 fl_set_form_atclose(form(),
106 C_FormBaseDeprecatedWMHideCB, 0);
109 fl_freeze_form(form());
110 update(); // make sure its up-to-date
111 fl_unfreeze_form(form());
113 if (form()->visible) {
114 fl_raise_form(form());
115 /* This XMapWindow() will hopefully ensure that
116 * iconified dialogs are de-iconified. Mad props
117 * out to those crazy Xlib guys for forgetting a
118 * XDeiconifyWindow(). At least WindowMaker, when
119 * being notified of the redirected MapRequest will
120 * specifically de-iconify. From source, fvwm2 seems
123 XMapWindow(fl_get_display(), form()->window);
127 // calls to fl_set_form_minsize/maxsize apply only to the next
128 // fl_show_form(), so this comes first.
129 fl_set_form_minsize(form(), minw_, minh_);
131 fl_set_form_maxsize(form(), minw_, minh_);
134 FL_PLACE_MOUSE | FL_FREE_SIZE,
135 (lyxrc.dialogs_iconify_with_main ? FL_TRANSIENT : 0),
141 void FormBaseDeprecated::hide()
143 if (form() && form()->visible) {
144 // some dialogs might do things to the form first
145 // such as the nested tabfolder problem in Preferences
147 fl_hide_form(form());
152 int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
155 // Ensure that the signals (u and h) are disconnected even if the
156 // window manager is used to close the dialog.
157 FormBaseDeprecated * pre =
158 static_cast<FormBaseDeprecated*>(form->u_vdata);
166 void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
168 lyx::Assert(ob && ob->form);
169 FormBaseDeprecated * pre =
170 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
177 void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
179 lyx::Assert(ob && ob->form);
180 FormBaseDeprecated * pre =
181 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
188 void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
190 lyx::Assert(ob && ob->form);
191 FormBaseDeprecated * pre =
192 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
199 void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
201 lyx::Assert(ob && ob->form);
202 FormBaseDeprecated * pre =
203 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
205 pre->bc().valid(pre->input(ob, data));
209 void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long)
211 lyx::Assert(ob && ob->form);
212 FormBaseDeprecated * pre =
213 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
220 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t,
222 : FormBaseDeprecated(lv, d, t, allowResize)
226 void FormBaseBI::connect()
228 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
229 FormBaseDeprecated::connect();
233 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t,
235 : FormBaseDeprecated(lv, d, t, allowResize),
240 void FormBaseBD::connect()
242 u_ = d_->updateBufferDependent.
243 connect(slot(this, &FormBaseBD::updateSlot));
244 h_ = d_->hideBufferDependent.
245 connect(slot(this, &FormBaseBD::hide));
246 FormBaseDeprecated::connect();
250 void FormBaseBD::disconnect()
253 FormBaseDeprecated::disconnect();