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
This commit is contained in:
Angus Leeming 2001-06-12 12:39:26 +00:00
parent 3171db33d2
commit 79327ea1ad
4 changed files with 22 additions and 11 deletions

View File

@ -1,5 +1,9 @@
2001-06-12 Angus Leeming <a.leeming@ic.ac.uk>
* 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.

View File

@ -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<ControlInclude, FormDB<FD_form_include> > 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;
}

View File

@ -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)));

View File

@ -153,7 +153,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_filename
callback:
callback: C_FormBaseInputCB
argument:
--------------------