diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 6a5e1f9800..25069f11fa 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,11 @@ +2001-08-29 Angus Leeming + + * FormBase.C (C_CutandPastePH): new function that can be used as a + pre-handler to any xforms text input widget. Will trigger an event on + pasting into the widget using the middle mouse button. + + * FormPreamble.C (build): use this pre-handler for the input widget. + 2001-08-26 Angus Leeming * FormCitation.C: diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index 70038eb489..5b5b737643 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -21,8 +21,15 @@ #include "xformsBC.h" #include "support/LAssert.h" +// Callback function invoked by xforms when the dialog is closed by the +// window manager extern "C" int C_FormBaseWMHideCB(FL_FORM * form, void *); +// To trigger an input event when pasting in an xforms input object +// using the middle mouse button. +extern "C" int C_CutandPastePH(FL_OBJECT *, int, FL_Coord, FL_Coord, + int, void *); + FormBase::FormBase(ControlButtons & c, string const & t, bool allowResize) : ViewBC(c), minw_(0), minh_(0), allow_resize_(allowResize), @@ -155,3 +162,16 @@ extern "C" void C_FormBaseInputCB(FL_OBJECT * ob, long d) { GetForm(ob)->InputCB(ob, d); } + + +// To trigger an input event when pasting in an xforms input object +// using the middle mouse button. +extern "C" int C_CutandPastePH(FL_OBJECT * ob, int event, + FL_Coord, FL_Coord, int key, void *) +{ + if ((event == FL_PUSH) && (key == 2) && (ob->objclass == FL_INPUT)) { + C_FormBaseInputCB(ob, 0); + } + + return 0; +} diff --git a/src/frontends/xforms/FormPreamble.C b/src/frontends/xforms/FormPreamble.C index eed32d8163..537ec7012e 100644 --- a/src/frontends/xforms/FormPreamble.C +++ b/src/frontends/xforms/FormPreamble.C @@ -18,6 +18,11 @@ #include "form_preamble.h" #include "xforms_helpers.h" +// To trigger an input event when pasting in an xforms input object +// using the middle mouse button. +extern "C" int C_CutandPastePH(FL_OBJECT *, int, FL_Coord, FL_Coord, + int, void *); + typedef FormCB > base_class; FormPreamble::FormPreamble(ControlPreamble & c) @@ -28,8 +33,9 @@ FormPreamble::FormPreamble(ControlPreamble & c) void FormPreamble::build() { dialog_.reset(build_preamble()); - + fl_set_input_return(dialog_->input_preamble, FL_RETURN_CHANGED); + fl_set_object_prehandler(dialog_->input_preamble, C_CutandPastePH); // Manage the ok, apply and cancel/close buttons bc().setOK(dialog_->button_ok);