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"
29 extern "C" int C_FormBaseDeprecatedWMHideCB(FL_FORM * ob, void * d)
31 return FormBaseDeprecated::WMHideCB(ob, d);
33 extern "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT * ob, long d)
35 FormBaseDeprecated::ApplyCB(ob, d);
37 extern "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT * ob, long d)
39 FormBaseDeprecated::OKCB(ob, d);
41 extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT * ob, long d)
43 FormBaseDeprecated::CancelCB(ob, d);
45 extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT * ob, long d)
47 FormBaseDeprecated::InputCB(ob, d);
49 extern "C" void C_FormBaseDeprecatedRestoreCB(FL_OBJECT * ob, long d)
51 FormBaseDeprecated::RestoreCB(ob, d);
55 FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d,
56 string const & t, bool allowResize)
57 : lv_(lv), d_(d), h_(0), r_(0), title_(t),
58 minw_(0), minh_(0), allow_resize_(allowResize)
64 void FormBaseDeprecated::redraw()
66 if (form() && form()->visible)
67 fl_redraw_form(form());
71 void FormBaseDeprecated::connect()
73 fl_set_form_minsize(form(), minw_, minh_);
74 r_ = Dialogs::redrawGUI.connect(slot(this,&FormBaseDeprecated::redraw));
78 void FormBaseDeprecated::disconnect()
85 void FormBaseDeprecated::show()
92 // work around dumb xforms sizing bug
96 fl_set_form_atclose(form(),
97 C_FormBaseDeprecatedWMHideCB, 0);
100 fl_freeze_form(form());
101 update(); // make sure its up-to-date
102 fl_unfreeze_form(form());
104 if (form()->visible) {
105 fl_raise_form(form());
106 /* This XMapWindow() will hopefully ensure that
107 * iconified dialogs are de-iconified. Mad props
108 * out to those crazy Xlib guys for forgetting a
109 * XDeiconifyWindow(). At least WindowMaker, when
110 * being notified of the redirected MapRequest will
111 * specifically de-iconify. From source, fvwm2 seems
114 XMapWindow(fl_get_display(), form()->window);
118 // calls to fl_set_form_minsize/maxsize apply only to the next
119 // fl_show_form(), so this comes first.
120 fl_set_form_minsize(form(), minw_, minh_);
122 fl_set_form_maxsize(form(), minw_, minh_);
125 FL_PLACE_MOUSE | FL_FREE_SIZE,
126 (lyxrc.dialogs_iconify_with_main ? FL_TRANSIENT : 0),
132 void FormBaseDeprecated::hide()
134 if (form() && form()->visible) {
135 // some dialogs might do things to the form first
136 // such as the nested tabfolder problem in Preferences
138 fl_hide_form(form());
143 int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
146 // Ensure that the signals (u and h) are disconnected even if the
147 // window manager is used to close the dialog.
148 FormBaseDeprecated * pre =
149 static_cast<FormBaseDeprecated*>(form->u_vdata);
157 void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
159 lyx::Assert(ob && ob->form);
160 FormBaseDeprecated * pre =
161 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
168 void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
170 lyx::Assert(ob && ob->form);
171 FormBaseDeprecated * pre =
172 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
179 void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
181 lyx::Assert(ob && ob->form);
182 FormBaseDeprecated * pre =
183 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
190 void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
192 lyx::Assert(ob && ob->form);
193 FormBaseDeprecated * pre =
194 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
196 pre->bc().valid(pre->input(ob, data));
200 void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long)
202 lyx::Assert(ob && ob->form);
203 FormBaseDeprecated * pre =
204 static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
211 FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t,
213 : FormBaseDeprecated(lv, d, t, allowResize)
217 void FormBaseBI::connect()
219 h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
220 FormBaseDeprecated::connect();
224 FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t,
226 : FormBaseDeprecated(lv, d, t, allowResize),
231 void FormBaseBD::connect()
233 u_ = d_->updateBufferDependent.
234 connect(slot(this, &FormBaseBD::updateSlot));
235 h_ = d_->hideBufferDependent.
236 connect(slot(this, &FormBaseBD::hide));
237 FormBaseDeprecated::connect();
241 void FormBaseBD::disconnect()
244 FormBaseDeprecated::disconnect();