X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormSendto.C;h=7fd0484ca845ffacb612cd4c346fe74fd73517ea;hb=37e82a546392d43f787826b85481a11f2a27af15;hp=fa4a9e884516c56db2f6acb487fd5c570bc94285;hpb=cedd9c91a280142ab8c29e40b8ba4e3cd6087076;p=lyx.git diff --git a/src/frontends/xforms/FormSendto.C b/src/frontends/xforms/FormSendto.C index fa4a9e8845..7fd0484ca8 100644 --- a/src/frontends/xforms/FormSendto.C +++ b/src/frontends/xforms/FormSendto.C @@ -1,51 +1,63 @@ -/* +/** * \file FormSendto.C - * Copyright 2002 the LyX Team - * Read the file COPYING + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * \author Angus Leeming + * \author Angus Leeming + * + * Full author contact details are available in file CREDITS. */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "FormSendto.h" -#include "form_sendto.h" #include "ControlSendto.h" -#include "xformsBC.h" +#include "forms/form_sendto.h" + +#include "Tooltips.h" #include "xforms_helpers.h" -#include "converter.h" -#include "gettext.h" +#include "xformsBC.h" + +#include "format.h" + +#include "support/lstrings.h" + +#include "lyx_forms.h" using std::vector; +using std::string; + +namespace lyx { + +using support::trim; -typedef FormCB > base_class; +namespace frontend { -FormSendto::FormSendto(ControlSendto & c) - : base_class(c, _("Send document to command")) +typedef FormController > base_class; + +FormSendto::FormSendto(Dialog & parent) + : base_class(parent, _("Send document to command")) {} void FormSendto::build() { - dialog_.reset(build_sendto()); + dialog_.reset(build_sendto(this)); fl_set_input_return(dialog_->input_command, FL_RETURN_CHANGED); + setPrehandler(dialog_->input_command); - // The help choice - fillTooltipChoice(dialog_->choice_help); + // Manage the ok, apply, restore and cancel/close buttons + bcview().setOK(dialog_->button_ok); + bcview().setApply(dialog_->button_apply); + bcview().setCancel(dialog_->button_close); // Set up the tooltip mechanism - setTooltipHandler(dialog_->browser_formats); - setTooltipHandler(dialog_->input_command); + string str = _("Export the buffer to this format before running the command below on it."); + tooltips().init(dialog_->browser_formats, str); - // Manage the ok, apply, restore and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_cancel); + str = _("Run this command on the buffer exported to the chosen format. $$FName will be replaced by the name of this file."); + tooltips().init(dialog_->input_command, str); } @@ -64,9 +76,9 @@ void FormSendto::update() for (; it != end; ++it, ++result) { *result = (*it)->prettyname(); } - + vector const browser_keys = - getVectorFromBrowser(dialog_->browser_formats); + getVector(dialog_->browser_formats); if (browser_keys == keys) return; @@ -83,19 +95,14 @@ void FormSendto::update() } -ButtonPolicy::SMInput FormSendto::input(FL_OBJECT * ob, long) +ButtonPolicy::SMInput FormSendto::input(FL_OBJECT *, long) { - if (ob == dialog_->choice_help) { - setTooltipLevel(dialog_->choice_help); - return ButtonPolicy::SMI_NOOP; - } - int const line = fl_get_browser(dialog_->browser_formats); if (line < 1 || line > fl_get_browser_maxline(dialog_->browser_formats)) return ButtonPolicy::SMI_INVALID; - string cmd = getStringFromInput(dialog_->input_command); - cmd = strip(frontStrip(cmd)); + string cmd = getString(dialog_->input_command); + cmd = trim(cmd); if (cmd.empty()) return ButtonPolicy::SMI_INVALID; @@ -109,23 +116,11 @@ void FormSendto::apply() if (line < 1 || line > fl_get_browser_maxline(dialog_->browser_formats)) return; - string const cmd = getStringFromInput(dialog_->input_command); + string const cmd = getString(dialog_->input_command); controller().setFormat(all_formats_[line-1]); controller().setCommand(cmd); } - -string const FormSendto::getVerboseTooltip(FL_OBJECT const * ob) const -{ - string str; - - if (ob == dialog_->browser_formats) { - str = N_("Export the buffer to this format before running the command below on it."); - - } else if (ob == dialog_->input_command) { - str = N_("Run this command on the buffer exported to the chosen format. $$FName will be replaced by the name of this file."); - } - - return str; -} +} // namespace frontend +} // namespace lyx