]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetGraphics.cpp
Stupid bug fix.
[lyx.git] / src / insets / InsetGraphics.cpp
index 40354e85ffc8466c82496d0bbbff0cf28e2f784d..2bd0cae1118a9aff97be69506576ac5a0dda2480 100644 (file)
@@ -59,6 +59,7 @@ TODO
 #include "Format.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetIterator.h"
 #include "LaTeXFeatures.h"
 #include "Length.h"
 #include "Lexer.h"
@@ -67,7 +68,6 @@ TODO
 #include "OutputParams.h"
 #include "sgml.h"
 #include "TocBackend.h"
-#include "InsetIterator.h"
 
 #include "frontends/alert.h"
 #include "frontends/Application.h"
@@ -230,7 +230,7 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_INSET_EDIT:
        case LFUN_INSET_MODIFY:
        case LFUN_INSET_DIALOG_UPDATE:
-               flag.enabled(true);
+               flag.setEnabled(true);
                return true;
 
        default:
@@ -907,7 +907,7 @@ void InsetGraphics::editGraphics(InsetGraphicsParams const & p,
 }
 
 
-void InsetGraphics::addToToc(ParConstIterator const & cpit) const
+void InsetGraphics::addToToc(DocIterator const & cpit)
 {
        TocBackend & backend = buffer().tocBackend();
 
@@ -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, set<string> & ids)
 {
        Inset & inset = b.inset();
        InsetIterator it  = inset_iterator_begin(inset);
@@ -959,16 +960,16 @@ void InsetGraphics::getGraphicsGroups(Buffer const & b, std::set<string> & ids)
                if (it->lyxCode() == GRAPHICS_CODE) {
                        InsetGraphics & ins = static_cast<InsetGraphics &>(*it);
                        InsetGraphicsParams inspar = ins.getParams();
-                       if (!inspar.groupId.empty()) {
+                       if (!inspar.groupId.empty())
                                ids.insert(inspar.groupId);
-                       }
                }
 }
 
 
-string InsetGraphics::getGroupParams(Buffer const & b, std::string const & groupId)
+string getGroupParams(Buffer const & b, string const & groupId)
 {
-       if (groupId.empty()) return string();
+       if (groupId.empty())
+               return string();
        Inset & inset = b.inset();
        InsetIterator it  = inset_iterator_begin(inset);
        InsetIterator const end = inset_iterator_end(inset);
@@ -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, string const & argument)
 {
        InsetGraphicsParams params;
        InsetGraphics::string2params(argument, b, params);
@@ -1008,14 +1009,17 @@ 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) instmp = cur.nextInset();
-       if (!instmp || instmp->lyxCode() != GRAPHICS_CODE) return 0;
+       if (instmp->lyxCode() != GRAPHICS_CODE)
+               instmp = cur.nextInset();
+       if (!instmp || instmp->lyxCode() != GRAPHICS_CODE)
+               return 0;
 
-       InsetGraphics & ins = static_cast<InsetGraphics &>(*instmp);
-       return &ins;
+       return static_cast<InsetGraphics *>(instmp);
 }
 
+} // namespace graphics
+
 } // namespace lyx