]> git.lyx.org Git - features.git/commitdiff
Factorize showInsetDialog() for InsetParamsDialog based dialogs.
authorAbdelrazak Younes <younes@lyx.org>
Tue, 16 Feb 2010 13:35:40 +0000 (13:35 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 16 Feb 2010 13:35:40 +0000 (13:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33487 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/insets/Inset.cpp
src/insets/Inset.h
src/insets/InsetBox.cpp
src/insets/InsetBox.h
src/insets/InsetERT.cpp
src/insets/InsetERT.h
src/insets/InsetFloat.cpp
src/insets/InsetFloat.h
src/insets/InsetText.cpp
src/insets/InsetText.h
src/insets/InsetVSpace.cpp
src/insets/InsetVSpace.h

index 65af1b0aa96220e16fbda1d7d617504d8fb95397..7edf4df634b8be87c4398acaaafd68b153cf2025 100644 (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) {
index 3d4148cf6755ee535d5baf37c2be9cf1f172983c..942faebcf120d660cfa7aac81d4eb252aecfb168 100644 (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.
index 769a2aeff140d41937f14678d7ed6f146a9651d6..3b7dec3e19a9ffe49e03f82a10025d903bf88b3c 100644 (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) {
index b838cc8e47e00e3488e84f40af93e1e26d50f462..55d189294f452adb4d92c935c2e9adf3e78758e0 100644 (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; }
        ///
index 10452d7cf11f33a7b52aaf9917211387e908a426..3de5ccaf50423a17a02e517ef986e1e66967b016 100644 (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())
index b530e05f3fa01a8173d92427241036b94f57f02f..2839af02ff069a0a5e7e878fbdf0266d167e83a4 100644 (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; }
        ///
index f8807f974cc00d0641c39679d9bf6631e41a02d1..41d0766eed0de2bf13571540f968ea3556231ce5 100644 (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;
index d656fdcbc25cf39af6d7c35ed6e06a1668c34f6f..a0c55a072b3db1acfde204bbe3f48d22910405b7 100644 (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);
index bdf29530708d5de516ee6eed97e120f9e023dc6e..a74f4bc30af9e78b52cdec3fcf0861de91e99883 100644 (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();
index d33b6bda32bdf3fb6bd6b684d5085a8a3af06517..d81d6ef1420a88cb6bac5546d1545bafd1a1a5a8 100644 (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;
        }
index 3d271a672d40c7d810cdcc89bd1412b92ee742eb..bcbe0decc9370107a4673467f73566fc5cefc8e3 100644 (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(), /**/);
index eeec30c1b8970025c5b40835fbcac5b04969943a..2cac05ed718b49d5a9bb3cb536beeffef958a6cb 100644 (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_;