mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
consolidate showDialog() incarnations
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21662 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
55b4fbcf21
commit
d5fc2425a9
@ -1970,23 +1970,15 @@ void BufferView::message(docstring const & msg)
|
||||
void BufferView::showDialog(std::string const & name)
|
||||
{
|
||||
if (d->gui_)
|
||||
d->gui_->showDialog(name);
|
||||
d->gui_->showDialog(name, string());
|
||||
}
|
||||
|
||||
|
||||
void BufferView::showDialogWithData(std::string const & name,
|
||||
std::string const & data)
|
||||
{
|
||||
if (d->gui_)
|
||||
d->gui_->showDialogWithData(name, data);
|
||||
}
|
||||
|
||||
|
||||
void BufferView::showInsetDialog(std::string const & name,
|
||||
void BufferView::showDialog(std::string const & name,
|
||||
std::string const & data, Inset * inset)
|
||||
{
|
||||
if (d->gui_)
|
||||
d->gui_->showInsetDialog(name, data, inset);
|
||||
d->gui_->showDialog(name, data, inset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,11 +231,8 @@ public:
|
||||
|
||||
/// This signal is emitted when some dialog needs to be shown with
|
||||
/// some data.
|
||||
void showDialogWithData(std::string const & name, std::string const & data);
|
||||
|
||||
/// This signal is emitted when some inset dialogs needs to be shown.
|
||||
void showInsetDialog(std::string const & name, std::string const & data,
|
||||
Inset * inset);
|
||||
void showDialog(std::string const & name, std::string const & data,
|
||||
Inset * inset = 0);
|
||||
|
||||
/// This signal is emitted when some dialogs needs to be updated.
|
||||
void updateDialog(std::string const & name, std::string const & data);
|
||||
|
@ -1080,7 +1080,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
case LFUN_BUFFER_EXPORT:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
if (argument == "custom")
|
||||
lyx_view_->showDialog("sendto");
|
||||
lyx_view_->showDialog("sendto", string());
|
||||
else
|
||||
lyx_view_->buffer()->doExport(argument, false);
|
||||
break;
|
||||
@ -1423,7 +1423,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
if (name == "character") {
|
||||
data = freefont2string();
|
||||
if (!data.empty())
|
||||
lyx_view_->showDialogWithData("character", data);
|
||||
lyx_view_->showDialog("character", data);
|
||||
} else if (name == "latexlog") {
|
||||
Buffer::LogType type;
|
||||
string const logfile = lyx_view_->buffer()->logName(&type);
|
||||
@ -1436,13 +1436,13 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
data += Lexer::quoteString(logfile);
|
||||
lyx_view_->showDialogWithData("log", data);
|
||||
lyx_view_->showDialog("log", data);
|
||||
} else if (name == "vclog") {
|
||||
string const data = "vc " +
|
||||
Lexer::quoteString(lyx_view_->buffer()->lyxvc().getLogFile());
|
||||
lyx_view_->showDialogWithData("log", data);
|
||||
lyx_view_->showDialog("log", data);
|
||||
} else
|
||||
lyx_view_->showDialogWithData(name, data);
|
||||
lyx_view_->showDialog(name, data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1233,7 +1233,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
content : cmd.argument();
|
||||
string const data = InsetCommandMailer::params2string("href", p);
|
||||
if (p["target"].empty()) {
|
||||
bv->showInsetDialog("href", data, 0);
|
||||
bv->showDialog("href", data);
|
||||
} else {
|
||||
FuncRequest fr(LFUN_INSET_INSERT, data);
|
||||
dispatch(cur, fr);
|
||||
@ -1250,7 +1250,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
string const data = InsetCommandMailer::params2string("label", p);
|
||||
|
||||
if (cmd.argument().empty()) {
|
||||
bv->showInsetDialog("label", data, 0);
|
||||
bv->showDialog("label", data);
|
||||
} else {
|
||||
FuncRequest fr(LFUN_INSET_INSERT, data);
|
||||
dispatch(cur, fr);
|
||||
@ -1574,7 +1574,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
string data;
|
||||
params2string(cur.paragraph(), data);
|
||||
data = "show\n" + data;
|
||||
bv->showDialogWithData("paragraph", data);
|
||||
bv->showDialog("paragraph", data);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1659,7 +1659,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
arg = cur.selectionAsString(false);
|
||||
}
|
||||
}
|
||||
bv->showDialogWithData("thesaurus", to_utf8(arg));
|
||||
bv->showDialog("thesaurus", to_utf8(arg));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -29,17 +29,9 @@ public:
|
||||
/// This function is called when some message shows up.
|
||||
virtual void message(docstring const & msg) = 0;
|
||||
|
||||
/// This function is called when some dialog needs to be shown.
|
||||
virtual void showDialog(std::string const & name) = 0;
|
||||
|
||||
/// This function is called when some dialog needs to be shown with
|
||||
/// some data.
|
||||
virtual void showDialogWithData(std::string const & name,
|
||||
std::string const & data) = 0;
|
||||
|
||||
/// This function is called when some inset dialogs needs to be shown.
|
||||
virtual void showInsetDialog(std::string const & name,
|
||||
std::string const & data, Inset * inset) = 0;
|
||||
virtual void showDialog(std::string const & name,
|
||||
std::string const & data, Inset * inset = 0) = 0;
|
||||
|
||||
/// This function is called when some dialogs needs to be updated.
|
||||
virtual void updateDialog(std::string const & name,
|
||||
|
@ -22,7 +22,7 @@ enum KeyModifier {
|
||||
NoModifier = 0, //< no modifiers held
|
||||
ControlModifier = 1, //< control button held
|
||||
AltModifier = 2, //< alt/meta key held
|
||||
ShiftModifier = 4 //< shift key held
|
||||
ShiftModifier = 4 //< shift key held
|
||||
};
|
||||
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "frontends/Delegates.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
namespace support { class FileName; }
|
||||
@ -158,7 +156,7 @@ public:
|
||||
the current cursor position or modify an existing, 'open' inset?
|
||||
*/
|
||||
virtual void showDialog(std::string const & name,
|
||||
std::string const & data = std::string(), Inset * inset = 0) = 0;
|
||||
std::string const & data, Inset * inset = 0) = 0;
|
||||
|
||||
/** \param name == "citation", "bibtex" etc; an identifier used
|
||||
to update the contents of a particular dialog with \param data.
|
||||
|
@ -960,24 +960,6 @@ void GuiView::errors(string const & error_type)
|
||||
}
|
||||
|
||||
|
||||
void GuiView::showDialog(std::string const & name)
|
||||
{
|
||||
showDialog(name, string());
|
||||
}
|
||||
|
||||
void GuiView::showDialogWithData(string const & name, string const & data)
|
||||
{
|
||||
showDialog(name, data);
|
||||
}
|
||||
|
||||
|
||||
void GuiView::showInsetDialog(string const & name, string const & data,
|
||||
Inset * inset)
|
||||
{
|
||||
showDialog(name, data, inset);
|
||||
}
|
||||
|
||||
|
||||
void GuiView::updateDialog(string const & name, string const & data)
|
||||
{
|
||||
if (!isDialogVisible(name))
|
||||
|
@ -93,12 +93,6 @@ public:
|
||||
void structureChanged() { updateToc(); }
|
||||
///@}
|
||||
|
||||
////
|
||||
void showDialog(std::string const & name);
|
||||
void showDialogWithData(std::string const & name,
|
||||
std::string const & data);
|
||||
void showInsetDialog(std::string const & name,
|
||||
std::string const & data, Inset * inset);
|
||||
|
||||
/// called on timeout
|
||||
void autoSave();
|
||||
@ -244,7 +238,7 @@ public:
|
||||
the current cursor position or modify an existing, 'open' inset?
|
||||
*/
|
||||
void showDialog(std::string const & name,
|
||||
std::string const & data = std::string(), Inset * inset = 0);
|
||||
std::string const & data, Inset * inset = 0);
|
||||
|
||||
/** \param name == "citation", "bibtex" etc; an identifier used
|
||||
to update the contents of a particular dialog with \param data.
|
||||
|
@ -28,7 +28,7 @@ using std::string;
|
||||
void MailInset::showDialog(BufferView * bv) const
|
||||
{
|
||||
BOOST_ASSERT(bv);
|
||||
bv->showInsetDialog(name(), inset2string(bv->buffer()), &inset());
|
||||
bv->showDialog(name(), inset2string(bv->buffer()), &inset());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
std::string const data = InsetCommandMailer::params2string("label", p);
|
||||
|
||||
if (cmd.argument().empty())
|
||||
cur.bv().showInsetDialog("label", data, 0);
|
||||
cur.bv().showDialog("label", data);
|
||||
else {
|
||||
FuncRequest fr(LFUN_INSET_INSERT, data);
|
||||
dispatch(cur, fr);
|
||||
|
@ -1028,7 +1028,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
InsetMathRef tmp(name);
|
||||
data = tmp.createDialogStr(to_utf8(name));
|
||||
}
|
||||
cur.bv().showInsetDialog(to_utf8(name), data, 0);
|
||||
cur.bv().showDialog(to_utf8(name), data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ void InsetMathRef::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
// Eventually trigger dialog with button 3, not 1
|
||||
string const data = createDialogStr("ref");
|
||||
cur.bv().showInsetDialog("ref", data, this);
|
||||
cur.bv().showDialog("ref", data, this);
|
||||
break;
|
||||
}
|
||||
cur.undispatched();
|
||||
|
Loading…
Reference in New Issue
Block a user