X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormInclude.C;h=57bbb468e5fab34ad7f0fc43344aae83e535dec6;hb=37e82a546392d43f787826b85481a11f2a27af15;hp=f430ac8adf00d8e013b2a6f1651c6f4c8ad4681d;hpb=0be0fcfd5907d448cd51addf83ed7032719a0692;p=lyx.git diff --git a/src/frontends/xforms/FormInclude.C b/src/frontends/xforms/FormInclude.C index f430ac8adf..57bbb468e5 100644 --- a/src/frontends/xforms/FormInclude.C +++ b/src/frontends/xforms/FormInclude.C @@ -12,21 +12,25 @@ #include -#include "debug.h" - -#include "xformsBC.h" -#include "ControlInclude.h" #include "FormInclude.h" +#include "ControlInclude.h" #include "forms/form_include.h" -#include "insets/insetinclude.h" + #include "Tooltips.h" #include "xforms_helpers.h" // setEnabled +#include "xformsBC.h" + #include "support/lstrings.h" // strip + #include "lyx_forms.h" -#include +using std::string; + +namespace lyx { -using namespace lyx::support; +using support::rtrim; + +namespace frontend { typedef FormController > base_class; @@ -80,9 +84,9 @@ void FormInclude::build() void FormInclude::update() { - string const filename = controller().params().cparams.getContents(); - string const cmdname = controller().params().cparams.getCmdName(); - bool const preview = static_cast((controller().params().cparams.preview())); + string const filename = controller().params().getContents(); + string const cmdname = controller().params().getCmdName(); + bool const preview = static_cast((controller().params().preview())); fl_set_input(dialog_->input_filename, filename.c_str()); @@ -115,26 +119,21 @@ void FormInclude::update() void FormInclude::apply() { - InsetInclude::Params params = controller().params(); - - params.cparams.preview(fl_get_button(dialog_->check_preview)); + InsetCommandParams params = controller().params(); - string const file = fl_get_input(dialog_->input_filename); - if (controller().fileExists(file)) - params.cparams.setContents(file); - else - params.cparams.setContents(""); + params.preview(fl_get_button(dialog_->check_preview)); + params.setContents(getString(dialog_->input_filename)); ControlInclude::Type const type = ControlInclude::Type(type_.get()); if (type == ControlInclude::INPUT) - params.flag = InsetInclude::INPUT; + params.setCmdName("input"); else if (type == ControlInclude::INCLUDE) - params.flag = InsetInclude::INCLUDE; + params.setCmdName("include"); else if (type == ControlInclude::VERBATIM) { if (fl_get_button(dialog_->check_visiblespace)) - params.flag = InsetInclude::VERBAST; + params.setCmdName("verbatiminput*"); else - params.flag = InsetInclude::VERB; + params.setCmdName("verbatiminput"); } controller().setParams(params); @@ -146,15 +145,15 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long) ButtonPolicy::SMInput action = ButtonPolicy::SMI_VALID; if (ob == dialog_->button_browse) { - string const in_name = fl_get_input(dialog_->input_filename); + string const in_name = getString(dialog_->input_filename); fl_freeze_form(form()); ControlInclude::Type const type = ControlInclude::Type(type_.get()); - string const out_name = controller().Browse(in_name, type); + string const out_name = controller().browse(in_name, type); fl_set_input(dialog_->input_filename, out_name.c_str()); fl_unfreeze_form(form()); } else if (ob == dialog_->button_load) { - string const in_name = fl_get_input(dialog_->input_filename); + string const in_name = getString(dialog_->input_filename); if (!rtrim(in_name).empty() && controller().fileExists(in_name)) { dialog().OKButton(); controller().load(rtrim(in_name)); @@ -172,7 +171,7 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long) setEnabled(dialog_->button_load, true); } else if (ob == dialog_->input_filename) { - string const in_name = fl_get_input(dialog_->input_filename); + string const in_name = getString(dialog_->input_filename); if (rtrim(in_name).empty()) action = ButtonPolicy::SMI_INVALID; } @@ -187,3 +186,6 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long) return action; } + +} // namespace frontend +} // namespace lyx