]> git.lyx.org Git - features.git/commitdiff
Move graphics code from class to namespace.
authorPavel Sanda <sanda@lyx.org>
Tue, 27 May 2008 12:06:34 +0000 (12:06 +0000)
committerPavel Sanda <sanda@lyx.org>
Tue, 27 May 2008 12:06:34 +0000 (12:06 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24958 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyXFunc.cpp
src/Text3.cpp
src/frontends/qt4/Menus.cpp
src/insets/InsetGraphics.cpp
src/insets/InsetGraphics.h

index 7ef1eaf6c5cee7f5c8c7f1551c60ff0fcce7733c..c0c3eb0b15fcfa4fff5fa082bb97011dd5ddba77 100644 (file)
@@ -1410,7 +1410,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        if (argument.empty() || !lyx_view_->buffer())
                                break;
                        //view()->cursor().recordUndoFullDocument(); let inset-apply do that job
-                       InsetGraphics::unifyGraphicsGroups(*lyx_view_->buffer(), argument);
+                       graphics::unifyGraphicsGroups(*lyx_view_->buffer(), argument);
                        lyx_view_->buffer()->markDirty();
                        updateFlags = Update::Force | Update::FitCursor;
                        break;
index 17b8d474db3440c105f65ebf9ba46fffd4aa278e..e787e08d07515cedb9a86a78a1db90cfe2dbbf16 100644 (file)
@@ -893,14 +893,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_SET_GRAPHICS_GROUP: {
-               InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
+               InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
                if (!ins)
                        break;
 
                cur.recordUndoFullDocument();
 
                string id = to_utf8(cmd.argument());
-               string grp = InsetGraphics::getGroupParams(bv->buffer(), id);
+               string grp = graphics::getGroupParams(bv->buffer(), id);
                InsetGraphicsParams tmp, inspar = ins->getParams();
 
                if (id.empty())
@@ -2183,7 +2183,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                break;
 
        case LFUN_SET_GRAPHICS_GROUP: {
-               InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
+               InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
                if (!ins) 
                        enable = false;
                else
index f72582dc418c0dcd850acc70be8e57927dc388e2..928559999f91d5e6c5e5f911db9f0a8bb70f2660 100644 (file)
@@ -640,7 +640,7 @@ void MenuDefinition::expandGraphicsGroups(BufferView const * bv)
        if (!bv)
                return;
        set<string> grp;
-       InsetGraphics::getGraphicsGroups(bv->buffer(), grp);
+       graphics::getGraphicsGroups(bv->buffer(), grp);
        if (grp.empty())
                return;
 
index d2ac809aa50f692fbe0326b8722d0f30a4a4b82b..640124a8600ec2fc668c9f3bf63f12897a927079 100644 (file)
@@ -949,8 +949,9 @@ string InsetGraphics::params2string(InsetGraphicsParams const & params,
        return data.str();
 }
 
+namespace graphics {
 
-void InsetGraphics::getGraphicsGroups(Buffer const & b, std::set<string> & ids)
+void getGraphicsGroups(Buffer const & b, std::set<string> & ids)
 {
        Inset & inset = b.inset();
        InsetIterator it  = inset_iterator_begin(inset);
@@ -965,7 +966,7 @@ void InsetGraphics::getGraphicsGroups(Buffer const & b, std::set<string> & ids)
 }
 
 
-string InsetGraphics::getGroupParams(Buffer const & b, std::string const & groupId)
+string getGroupParams(Buffer const & b, std::string const & groupId)
 {
        if (groupId.empty())
                return string();
@@ -979,14 +980,14 @@ string InsetGraphics::getGroupParams(Buffer const & b, std::string const & group
                        if (inspar.groupId == groupId) {
                                InsetGraphicsParams tmp = inspar;
                                tmp.filename.erase();
-                               return params2string(tmp, b);
+                               return InsetGraphics::params2string(tmp, b);
                        }
                }
        return string();
 }
 
 
-void InsetGraphics::unifyGraphicsGroups(Buffer const & b, std::string const & argument)
+void unifyGraphicsGroups(Buffer const & b, std::string const & argument)
 {
        InsetGraphicsParams params;
        InsetGraphics::string2params(argument, b, params);
@@ -1008,7 +1009,7 @@ void InsetGraphics::unifyGraphicsGroups(Buffer const & b, std::string const & ar
 }
 
 
-InsetGraphics * InsetGraphics::getCurrentGraphicsInset(Cursor const & cur)
+InsetGraphics * getCurrentGraphicsInset(Cursor const & cur)
 {
        Inset * instmp = &cur.inset();
        if (instmp->lyxCode() != GRAPHICS_CODE)
@@ -1019,4 +1020,6 @@ InsetGraphics * InsetGraphics::getCurrentGraphicsInset(Cursor const & cur)
        return static_cast<InsetGraphics *>(instmp);
 }
 
+} // namespace graphics
+
 } // namespace lyx
index bfb4784aed5325a282bbffe1702f82a55a38e5c8..d2ab83f32b11985457aa28415617c4eab2fbeb75 100644 (file)
@@ -48,16 +48,6 @@ public:
        ///
        static std::string params2string(InsetGraphicsParams const &,
                                          Buffer const &);
-       /// Saves the list of currently used groups in the document.
-       static void getGraphicsGroups(Buffer const &, std::set<std::string> &);
-       /// Returns parameters of a given graphics group (except filename).
-       static std::string getGroupParams(Buffer const &,
-                                               std::string const &);
-       /** Synchronize all Graphics insets of the group.
-           Both groupId and params are taken from argument.
-       */
-       static void unifyGraphicsGroups(Buffer const &, std::string const &);
-       static InsetGraphics * getCurrentGraphicsInset(Cursor const &);
 
        /** Set the inset parameters, used by the GUIndependent dialog.
            Return true of new params are different from what was so far.
@@ -133,6 +123,22 @@ private:
        boost::scoped_ptr<RenderGraphic> const graphic_;
 };
 
+namespace graphics {
+
+       /// Saves the list of currently used groups in the document.
+       void getGraphicsGroups(Buffer const &, std::set<std::string> &);
+
+       /// Returns parameters of a given graphics group (except filename).
+       std::string getGroupParams(Buffer const &, std::string const &);
+
+       /** Synchronize all Graphics insets of the group.
+           Both groupId and params are taken from argument.
+       */
+       void unifyGraphicsGroups(Buffer const &,        std::string const &);
+       InsetGraphics * getCurrentGraphicsInset(Cursor const &);
+
+}
+
 } // namespace lyx
 
 #endif // INSET_GRAPHICS_H