Factorize showInsetDialog() for InsetParamsDialog based dialogs.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33487 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2010-02-16 13:35:40 +00:00
parent 175c03336e
commit 6490dd8636
12 changed files with 22 additions and 56 deletions

View File

@ -89,7 +89,7 @@ static void build_translator()
insetnames[FLOAT_CODE] = InsetName("float", _("Float"));
insetnames[WRAP_CODE] = InsetName("wrap");
insetnames[SPECIALCHAR_CODE] = InsetName("specialchar");
insetnames[TABULAR_CODE] = InsetName("tabular");
insetnames[TABULAR_CODE] = InsetName("tabular", _("Table"));
insetnames[EXTERNAL_CODE] = InsetName("external");
insetnames[CAPTION_CODE] = InsetName("caption");
insetnames[MATHMACRO_CODE] = InsetName("mathmacro");
@ -289,6 +289,26 @@ void Inset::dispatch(Cursor & cur, FuncRequest & cmd)
}
bool Inset::showInsetDialog(BufferView * bv) const
{
InsetCode const code = lyxCode();
switch (code){
case ERT_CODE:
case FLOAT_CODE:
case BOX_CODE:
case INFO_CODE:
//FIXME: not ready yet.
//case TABULAR_CODE:
case VSPACE_CODE:
bv->showDialog(insetName(code));
break;
default:
return false;
}
return true;
}
void Inset::doDispatch(Cursor & cur, FuncRequest &cmd)
{
switch (cmd.action) {

View File

@ -190,7 +190,7 @@ public:
///
virtual bool editing(BufferView const * bv) const;
///
virtual bool showInsetDialog(BufferView *) const { return false; }
virtual bool showInsetDialog(BufferView *) const;
/// draw inset decoration if necessary.
/// This can use \c drawMarkers() for example.

View File

@ -184,13 +184,6 @@ bool InsetBox::forcePlainLayout(idx_type) const
}
bool InsetBox::showInsetDialog(BufferView * bv) const
{
bv->showDialog("box");
return true;
}
void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
{
switch (cmd.action) {

View File

@ -98,8 +98,6 @@ private:
void setButtonLabel();
///
void metrics(MetricsInfo &, Dimension &) const;
/// show the Box dialog
bool showInsetDialog(BufferView * bv) const;
///
DisplayType display() const { return Inline; }
///

View File

@ -147,13 +147,6 @@ docstring const InsetERT::buttonLabel(BufferView const & bv) const
}
bool InsetERT::showInsetDialog(BufferView * bv) const
{
bv->showDialog("ert");
return true;
}
InsetCollapsable::CollapseStatus InsetERT::string2params(string const & in)
{
if (in.empty())

View File

@ -52,8 +52,6 @@ private:
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
void validate(LaTeXFeatures &) const {}
///
bool showInsetDialog(BufferView *) const;
/// should paragraph indendation be omitted in any case?
bool neverIndent() const { return true; }
///

View File

@ -427,14 +427,6 @@ bool InsetFloat::insetAllowed(InsetCode code) const
}
bool InsetFloat::showInsetDialog(BufferView * bv) const
{
if (!InsetText::showInsetDialog(bv))
bv->showDialog("float");
return true;
}
void InsetFloat::setWide(bool w, bool update_label)
{
params_.wide = w;

View File

@ -95,8 +95,6 @@ private:
insets that may contain several paragraphs */
bool noFontChange() const { return true; }
///
bool showInsetDialog(BufferView *) const;
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
// Update the counters of this inset and of its contents
void updateLabels(ParIterator const &, UpdateType);

View File

@ -529,12 +529,6 @@ void InsetText::cursorPos(BufferView const & bv,
}
bool InsetText::showInsetDialog(BufferView *) const
{
return false;
}
void InsetText::setText(docstring const & data, Font const & font, bool trackChanges)
{
clear();

View File

@ -112,8 +112,6 @@ public:
///
void setFrameColor(ColorCode);
///
bool showInsetDialog(BufferView *) const;
///
Text * getText(int i) const {
return (i == 0) ? const_cast<Text*>(&text_) : 0;
}

View File

@ -53,12 +53,6 @@ InsetVSpace::InsetVSpace(VSpace const & space)
{}
InsetVSpace::~InsetVSpace()
{
hideDialogs("vspace", this);
}
void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
{
switch (cmd.action) {
@ -95,14 +89,6 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
}
bool InsetVSpace::showInsetDialog(BufferView * bv) const
{
bv->showDialog("vspace", params2string(space()),
const_cast<InsetVSpace *>(this));
return true;
}
void InsetVSpace::read(Lexer & lex)
{
LASSERT(lex.isOK(), /**/);

View File

@ -25,8 +25,6 @@ public:
InsetVSpace() : Inset(0) {}
///
InsetVSpace(VSpace const &);
///
~InsetVSpace();
/// How much?
VSpace const & space() const { return space_; }
///
@ -70,8 +68,6 @@ private:
Inset * clone() const { return new InsetVSpace(*this); }
///
docstring const label() const;
///
bool showInsetDialog(BufferView * bv) const;
///
VSpace space_;