From: Angus Leeming Date: Tue, 12 Jun 2001 12:39:26 +0000 (+0000) Subject: The Ok button is now activated in the Include dialog when the filename is X-Git-Tag: 1.6.10~21192 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=79327ea1ad2b1b9e074685c737102252b556a2f7;p=features.git The Ok button is now activated in the Include dialog when the filename is input from the keyboard. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2105 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index fd4ee4a1ad..02e1f07cbc 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,5 +1,9 @@ 2001-06-12 Angus Leeming + * FormInclude.C: + * form_include.fd: (various places): Ok button is now activated when + the filename is input from the keyboard. + * FormPreferences.C white-space change in various places. (Converters::GetTo): get the contents of "to" not "from"! Thus fix bug that disabled addition of new converters. diff --git a/src/frontends/xforms/FormInclude.C b/src/frontends/xforms/FormInclude.C index 372db8d422..42015d2d3e 100644 --- a/src/frontends/xforms/FormInclude.C +++ b/src/frontends/xforms/FormInclude.C @@ -21,7 +21,7 @@ #include "form_include.h" #include "insets/insetinclude.h" #include "xforms_helpers.h" // setEnabled -#include "support/lstrings.h" // compare +#include "support/lstrings.h" // strip typedef FormCB > base_class; @@ -34,6 +34,8 @@ void FormInclude::build() { dialog_.reset(build_include()); + fl_set_input_return(dialog_->input_filename, FL_RETURN_CHANGED); + // Manage the ok and cancel buttons bc().setOK(dialog_->button_ok); bc().setCancel(dialog_->button_cancel); @@ -106,6 +108,8 @@ void FormInclude::apply() ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long) { + ButtonPolicy::SMInput action = ButtonPolicy::SMI_VALID; + if (ob == dialog_->button_browse) { ControlInclude::Type type; if (fl_get_button(dialog_->check_useinput)) @@ -121,24 +125,26 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long) fl_set_input(dialog_->input_filename, out_name.c_str()); fl_unfreeze_form(form()); - return ButtonPolicy::SMI_VALID; - } - - if (ob == dialog_->button_load) { - if (compare(fl_get_input(dialog_->input_filename),"")) { + } else if (ob == dialog_->button_load) { + string const in_name = fl_get_input(dialog_->input_filename); + if (!strip(in_name).empty()) { ApplyButton(); - return ButtonPolicy::SMI_NOOP; + action = ButtonPolicy::SMI_NOOP; } - } - if (ob == dialog_->check_verbatim) { + } else if (ob == dialog_->check_verbatim) { setEnabled(dialog_->check_visiblespace, true); } else if (ob == dialog_->check_useinclude || ob == dialog_->check_useinput) { fl_set_button(dialog_->check_visiblespace, 0); setEnabled(dialog_->check_visiblespace, false); + + } else if (ob == dialog_->input_filename) { + string const in_name = fl_get_input(dialog_->input_filename); + if (strip(in_name).empty()) + action = ButtonPolicy::SMI_INVALID; } - return ButtonPolicy::SMI_VALID; + return action; } diff --git a/src/frontends/xforms/form_include.C b/src/frontends/xforms/form_include.C index 8e602c31e6..8cf2f8b8a8 100644 --- a/src/frontends/xforms/form_include.C +++ b/src/frontends/xforms/form_include.C @@ -63,6 +63,7 @@ FD_form_include * FormInclude::build_include() } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Visible space|#s"); fdui->check_visiblespace = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 100, 150, 30, idex(_(dummy))); diff --git a/src/frontends/xforms/forms/form_include.fd b/src/frontends/xforms/forms/form_include.fd index 8a69831e98..79c4182028 100644 --- a/src/frontends/xforms/forms/form_include.fd +++ b/src/frontends/xforms/forms/form_include.fd @@ -153,7 +153,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_filename -callback: +callback: C_FormBaseInputCB argument: --------------------