]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
english_language was not used at all.
[lyx.git] / src / Text3.cpp
index a38b5ab579b9da6d0118e67c1c1572666218f535..3dd736b9dd698d399466b69d843bb7d5568cb530 100644 (file)
@@ -57,6 +57,8 @@
 #include "insets/InsetSpecialChar.h"
 #include "insets/InsetText.h"
 #include "insets/InsetInfo.h"
+#include "insets/InsetGraphics.h"
+#include "insets/InsetGraphicsParams.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
@@ -873,17 +875,47 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_INSET_SETTINGS: {
-               // if there is an inset at cursor, access this
-               Inset * inset = cur.nextInset();
-               if (inset) {
-                       inset->showInsetDialog(bv);
+               Inset & inset = cur.inset();
+               if (cmd.getArg(0) == insetName(inset.lyxCode())) {
+                       // This inset dialog has been explicitely requested.
+                       inset.showInsetDialog(bv);
+                       break;
+               }
+               // else, if there is an inset at the cursor, access this
+               Inset * next_inset = cur.nextInset();
+               if (next_inset) {
+                       next_inset->showInsetDialog(bv);
                        break;
                }
-               // if not work, access the underlying inset.
-               cur.inset().showInsetDialog(bv);
+               // if not then access the underlying inset.
+               inset.showInsetDialog(bv);
                break;
        }
 
+       case LFUN_SET_GRAPHICS_GROUP: {
+               Inset * instmp = &cur.inset();
+               if (instmp->lyxCode() != GRAPHICS_CODE) instmp = cur.nextInset();
+               if (!instmp || instmp->lyxCode() != GRAPHICS_CODE) break;
+
+               cur.recordUndoFullDocument();
+               Inset & inset = *instmp;
+               InsetGraphics & ins = static_cast<InsetGraphics &>(inset);
+
+               string id = to_utf8(cmd.argument());
+               string grp = InsetGraphics::getGroupParams(bv->buffer(), id);
+               InsetGraphicsParams tmp, inspar = ins.getParams();
+
+               if (id.empty())
+                       inspar.groupId = to_utf8(cmd.argument());
+               else {
+                       InsetGraphics::string2params(grp, bv->buffer(), tmp);
+                       tmp.filename = inspar.filename;
+                       inspar = tmp;
+               }
+
+               ins.setParams(inspar);
+       }
+
        case LFUN_SPACE_INSERT:
                if (cur.paragraph().layout().free_spacing)
                        insertChar(cur, ' ');
@@ -2245,6 +2277,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_BUFFER_BEGIN_SELECT:
        case LFUN_BUFFER_END_SELECT:
        case LFUN_UNICODE_INSERT:
+       case LFUN_SET_GRAPHICS_GROUP:
                // these are handled in our dispatch()
                enable = true;
                break;