]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetGraphics.cpp
Remove all BufferParam arguments in InsetXXX methods (since insets know about their...
[lyx.git] / src / insets / InsetGraphics.cpp
index 1116a5f96a42005e753ec897a4db905b31d26c5c..9decdaaa80cc0b0ee08a5ee6bb54bb22d922b202 100644 (file)
@@ -101,8 +101,9 @@ namespace {
 /// Note that \p format may be unknown (i. e. an empty string)
 string findTargetFormat(string const & format, OutputParams const & runparams)
 {
-       // Are we using latex or pdflatex?
-       if (runparams.flavor == OutputParams::PDFLATEX) {
+       // Are we using latex or XeTeX/pdflatex?
+       if (runparams.flavor == OutputParams::PDFLATEX
+           || runparams.flavor == OutputParams::XETEX) {
                LYXERR(Debug::GRAPHICS, "findTargetFormat: PDF mode");
                Format const * const f = formats.getFormat(format);
                // Convert vector graphics to pdf
@@ -215,11 +216,6 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.bv().updateDialog("graphics", params2string(params(), buffer()));
                break;
 
-       case LFUN_MOUSE_RELEASE:
-               if (!cur.selection() && cmd.button() == mouse_button::button1)
-                       cur.bv().showDialog("graphics", params2string(params(), buffer()), this);
-               break;
-
        default:
                Inset::doDispatch(cur, cmd);
                break;
@@ -243,13 +239,15 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetGraphics::edit(Cursor & cur, bool, EntryDirection)
+bool InsetGraphics::showInsetDialog(BufferView * bv) const
 {
-       cur.bv().showDialog("graphics", params2string(params(),
-               cur.bv().buffer()), this);
+       bv->showDialog("graphics", params2string(params(), bv->buffer()),
+               const_cast<InsetGraphics *>(this));
+       return true;
 }
 
 
+
 void InsetGraphics::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        graphic_->metrics(mi, dim);
@@ -262,12 +260,6 @@ void InsetGraphics::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-Inset::EDITABLE InsetGraphics::editable() const
-{
-       return IS_EDITABLE;
-}
-
-
 void InsetGraphics::write(ostream & os) const
 {
        os << "Graphics\n";
@@ -970,6 +962,24 @@ void getGraphicsGroups(Buffer const & b, set<string> & ids)
 }
 
 
+int countGroupMembers(Buffer const & b, string const & groupId)
+{
+       int n = 0;
+       if (groupId.empty())
+               return n;
+       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);
+                       if (ins.getParams().groupId == groupId)
+                               ++n;
+               }
+       return n;
+}
+
+
 string getGroupParams(Buffer const & b, string const & groupId)
 {
        if (groupId.empty())