]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetGraphics.cpp
Move code to more appropriate place, cosmetics.
[features.git] / src / insets / InsetGraphics.cpp
index f280818a2479604477e19044f5f7cb1bbc989b38..40354e85ffc8466c82496d0bbbff0cf28e2f784d 100644 (file)
@@ -985,26 +985,37 @@ string InsetGraphics::getGroupParams(Buffer const & b, std::string const & group
        return string();
 }
 
+
 void InsetGraphics::unifyGraphicsGroups(Buffer const & b, std::string const & argument)
 {
-                       InsetGraphicsParams params;
-                       InsetGraphics::string2params(argument, b, params);
-
-                       Inset & inset = b.inset();
-                       InsetIterator it  = inset_iterator_begin(inset);
-                       InsetIterator const end = inset_iterator_end(inset);
-                       for (; it != end; ++it) {
-                               if (it->lyxCode() == GRAPHICS_CODE) {
-                                       InsetGraphics & ins = static_cast<InsetGraphics &>(*it);
-                                       InsetGraphicsParams inspar = ins.getParams();
-                                       if (params.groupId == inspar.groupId) {
-                                               params.filename = inspar.filename;
-                                               ins.setParams(params);
-                                       }
-                               }
+       InsetGraphicsParams params;
+       InsetGraphics::string2params(argument, b, params);
+
+       Inset & inset = b.inset();
+       InsetIterator it  = inset_iterator_begin(inset);
+       InsetIterator const end = inset_iterator_end(inset);
+       for (; it != end; ++it) {
+               if (it->lyxCode() == GRAPHICS_CODE) {
+                       InsetGraphics & ins = static_cast<InsetGraphics &>(*it);
+                       InsetGraphicsParams inspar = ins.getParams();
+                       if (params.groupId == inspar.groupId) {
+                               params.filename = inspar.filename;
+                               ins.setParams(params);
                        }
+               }
+       }
 
 }
 
 
+InsetGraphics * 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;
+
+       InsetGraphics & ins = static_cast<InsetGraphics &>(*instmp);
+       return &ins;
+}
+
 } // namespace lyx