From 6490dd8636b57e178684e507449aa87589fe06e4 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 16 Feb 2010 13:35:40 +0000 Subject: [PATCH] Factorize showInsetDialog() for InsetParamsDialog based dialogs. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33487 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/Inset.cpp | 22 +++++++++++++++++++++- src/insets/Inset.h | 2 +- src/insets/InsetBox.cpp | 7 ------- src/insets/InsetBox.h | 2 -- src/insets/InsetERT.cpp | 7 ------- src/insets/InsetERT.h | 2 -- src/insets/InsetFloat.cpp | 8 -------- src/insets/InsetFloat.h | 2 -- src/insets/InsetText.cpp | 6 ------ src/insets/InsetText.h | 2 -- src/insets/InsetVSpace.cpp | 14 -------------- src/insets/InsetVSpace.h | 4 ---- 12 files changed, 22 insertions(+), 56 deletions(-) diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 65af1b0aa9..7edf4df634 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -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) { diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 3d4148cf67..942faebcf1 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -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. diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 769a2aeff1..3b7dec3e19 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -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) { diff --git a/src/insets/InsetBox.h b/src/insets/InsetBox.h index b838cc8e47..55d189294f 100644 --- a/src/insets/InsetBox.h +++ b/src/insets/InsetBox.h @@ -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; } /// diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp index 10452d7cf1..3de5ccaf50 100644 --- a/src/insets/InsetERT.cpp +++ b/src/insets/InsetERT.cpp @@ -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()) diff --git a/src/insets/InsetERT.h b/src/insets/InsetERT.h index b530e05f3f..2839af02ff 100644 --- a/src/insets/InsetERT.h +++ b/src/insets/InsetERT.h @@ -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; } /// diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index f8807f974c..41d0766eed 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -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; diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index d656fdcbc2..a0c55a072b 100644 --- a/src/insets/InsetFloat.h +++ b/src/insets/InsetFloat.h @@ -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); diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index bdf2953070..a74f4bc30a 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -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(); diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index d33b6bda32..d81d6ef142 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -112,8 +112,6 @@ public: /// void setFrameColor(ColorCode); /// - bool showInsetDialog(BufferView *) const; - /// Text * getText(int i) const { return (i == 0) ? const_cast(&text_) : 0; } diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index 3d271a672d..bcbe0decc9 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -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(this)); - return true; -} - - void InsetVSpace::read(Lexer & lex) { LASSERT(lex.isOK(), /**/); diff --git a/src/insets/InsetVSpace.h b/src/insets/InsetVSpace.h index eeec30c1b8..2cac05ed71 100644 --- a/src/insets/InsetVSpace.h +++ b/src/insets/InsetVSpace.h @@ -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_; -- 2.39.2