mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Make GuiRef and GuiInclude subclasses of GuiCommand.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21264 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
50e5d51038
commit
a0a04e4886
@ -152,6 +152,7 @@ class GuiCommand : public GuiDialog
|
||||
{
|
||||
public:
|
||||
/// We need to know with what sort of inset we're associated.
|
||||
// FIXME This should probably be an InsetCode
|
||||
GuiCommand(LyXView &, std::string const & name);
|
||||
///
|
||||
bool initialiseParams(std::string const & data);
|
||||
|
@ -59,13 +59,8 @@ using support::getStringFromVector;
|
||||
using support::getVectorFromString;
|
||||
|
||||
|
||||
/// Flags what action is taken by Kernel::dispatch()
|
||||
/// Needed because we're not inheriting from GuiCommand
|
||||
static std::string const lfun_include_ = "include";
|
||||
|
||||
|
||||
GuiInclude::GuiInclude(LyXView & lv)
|
||||
: GuiDialog(lv, "include"), params_(INCLUDE_CODE)
|
||||
: GuiCommand(lv, "include")
|
||||
{
|
||||
setupUi(this);
|
||||
setViewTitle(_("Child Document"));
|
||||
@ -329,25 +324,6 @@ bool GuiInclude::isValid()
|
||||
}
|
||||
|
||||
|
||||
bool GuiInclude::initialiseParams(string const & data)
|
||||
{
|
||||
InsetCommandMailer::string2params(lfun_include_, data, params_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GuiInclude::clearParams()
|
||||
{
|
||||
params_.clear();
|
||||
}
|
||||
|
||||
|
||||
void GuiInclude::dispatchParams()
|
||||
{
|
||||
dispatch(FuncRequest(getLfun(), InsetCommandMailer::params2string(lfun_include_, params_)));
|
||||
}
|
||||
|
||||
|
||||
docstring GuiInclude::browse(docstring const & in_name, Type in_type) const
|
||||
{
|
||||
docstring const title = _("Select document to include");
|
||||
|
@ -25,9 +25,7 @@
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
//FIXME This could, and therefore probably should, inherit from
|
||||
//GuiCommand.
|
||||
class GuiInclude : public GuiDialog, public Ui::IncludeUi
|
||||
class GuiInclude : public GuiCommand, public Ui::IncludeUi
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -50,21 +48,6 @@ private Q_SLOTS:
|
||||
void set_listings_msg();
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent * e);
|
||||
///
|
||||
void updateLists();
|
||||
/// validate listings parameters and return an error message, if any
|
||||
docstring validate_listings_params();
|
||||
///
|
||||
void edit(std::string const & file);
|
||||
|
||||
///
|
||||
bool isValid();
|
||||
/// Apply changes
|
||||
void applyView();
|
||||
/// update
|
||||
void updateContents();
|
||||
|
||||
///
|
||||
enum Type {
|
||||
///
|
||||
@ -76,22 +59,24 @@ private:
|
||||
///
|
||||
LISTINGS,
|
||||
};
|
||||
|
||||
///
|
||||
bool initialiseParams(std::string const & data);
|
||||
/// clean-up on hide.
|
||||
void clearParams();
|
||||
/// clean-up on hide.
|
||||
void dispatchParams();
|
||||
void closeEvent(QCloseEvent * e);
|
||||
///
|
||||
void updateLists();
|
||||
/// validate listings parameters and return an error message, if any
|
||||
docstring validate_listings_params();
|
||||
///
|
||||
void edit(std::string const & file);
|
||||
///
|
||||
bool isValid();
|
||||
/// Apply changes
|
||||
void applyView();
|
||||
/// update
|
||||
void updateContents();
|
||||
///
|
||||
bool isBufferDependent() const { return true; }
|
||||
|
||||
/// Browse for a file
|
||||
docstring browse(docstring const &, Type) const;
|
||||
|
||||
private:
|
||||
///
|
||||
InsetCommandParams params_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -42,12 +42,8 @@ namespace frontend {
|
||||
using support::makeAbsPath;
|
||||
using support::makeDisplayPath;
|
||||
|
||||
/// Flags what action is taken by Kernel::dispatch()
|
||||
/// Needed because we're not inheriting from GuiCommand
|
||||
static std::string const lfun_ref_ = "ref";
|
||||
|
||||
GuiRef::GuiRef(LyXView & lv)
|
||||
: GuiDialog(lv, "ref"), params_(REF_CODE)
|
||||
: GuiCommand(lv, "ref")
|
||||
{
|
||||
setupUi(this);
|
||||
setViewTitle(_("Cross-reference"));
|
||||
@ -376,28 +372,6 @@ void GuiRef::gotoBookmark()
|
||||
}
|
||||
|
||||
|
||||
bool GuiRef::initialiseParams(string const & data)
|
||||
{
|
||||
// The name passed with LFUN_INSET_APPLY is also the name
|
||||
// used to identify the mailer.
|
||||
InsetCommandMailer::string2params(lfun_ref_, data, params_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GuiRef::clearParams()
|
||||
{
|
||||
params_.clear();
|
||||
}
|
||||
|
||||
|
||||
void GuiRef::dispatchParams()
|
||||
{
|
||||
string const lfun = InsetCommandMailer::params2string(lfun_ref_, params_);
|
||||
dispatch(FuncRequest(getLfun(), lfun));
|
||||
}
|
||||
|
||||
|
||||
Dialog * createGuiRef(LyXView & lv) { return new GuiRef(lv); }
|
||||
|
||||
|
||||
|
@ -24,10 +24,7 @@ class QListWidgetItem;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
// FIXME This could, and therefore, should inherit from
|
||||
// GuiCommand. Note, e.g., that the definitions of the first
|
||||
// three private functions all just replicate what's there.
|
||||
class GuiRef : public GuiDialog, public Ui::RefUi
|
||||
class GuiRef : public GuiCommand, public Ui::RefUi
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -45,15 +42,8 @@ private Q_SLOTS:
|
||||
void reset_dialog();
|
||||
|
||||
private:
|
||||
///
|
||||
bool initialiseParams(std::string const & data);
|
||||
/// clean-up on hide.
|
||||
void clearParams();
|
||||
/// clean-up on hide.
|
||||
void dispatchParams();
|
||||
///
|
||||
bool isBufferDependent() const { return true; }
|
||||
|
||||
/** disconnect from the inset when the Apply button is pressed.
|
||||
Allows easy insertion of multiple references. */
|
||||
bool disconnectOnApply() const { return true; }
|
||||
@ -61,7 +51,6 @@ private:
|
||||
void gotoRef(std::string const &);
|
||||
///
|
||||
void gotoBookmark();
|
||||
|
||||
///
|
||||
void closeEvent(QCloseEvent * e);
|
||||
///
|
||||
@ -96,9 +85,6 @@ private:
|
||||
int restored_buffer_;
|
||||
/// the references
|
||||
std::vector<docstring> refs_;
|
||||
|
||||
///
|
||||
InsetCommandParams params_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
Loading…
Reference in New Issue
Block a user