]> git.lyx.org Git - features.git/blobdiff - src/lyxfunc.C
read the Changelog
[features.git] / src / lyxfunc.C
index 8d2ca3f1ed8556e1b63ffe23413839945580960c..164a193fb89cb8d3fbd67091716f60439b8db878 100644 (file)
@@ -88,6 +88,7 @@ using std::istringstream;
 #include "menus.h"
 #include "bufferview_funcs.h"
 #include "frontends/Dialogs.h"
+#include "FloatList.h"
 
 using std::pair;
 using std::endl;
@@ -869,7 +870,11 @@ string LyXFunc::Dispatch(int ac,
        }
                
        case LFUN_TABLE:
+#ifndef NEW_TABULAR
                Table();
+#else
+               owner->getDialogs()->showTabularCreate();
+#endif
                break;
                
        case LFUN_FIGURE:
@@ -1398,8 +1403,9 @@ string LyXFunc::Dispatch(int ac,
                                                    txt->cursor.par(),
                                                    txt->cursor.pos());
                        tmpinset->Edit(owner->view(),
-                                      tmpinset->x() + tmpinset->width(owner->view()->painter(),font),
-                                      tmpinset->descent(owner->view()->painter(),font),
+                                      tmpinset->x() +
+                                      tmpinset->width(owner->view(),font),
+                                      tmpinset->descent(owner->view(),font),
                                       0);
                        break;
                }
@@ -2061,11 +2067,18 @@ string LyXFunc::Dispatch(int ac,
 
        case LFUN_INSET_FLOAT:
        {
-               InsetFloat * new_inset = new InsetFloat;
-               if (owner->view()->insertInset(new_inset))
-                       new_inset->Edit(owner->view(), 0, 0, 0);
-               else
-                       delete new_inset;
+               // check if the float type exist
+               if (floatList.typeExist(argument)) {
+                       InsetFloat * new_inset = new InsetFloat(argument);
+                       if (owner->view()->insertInset(new_inset))
+                               new_inset->Edit(owner->view(), 0, 0, 0);
+                       else
+                               delete new_inset;
+               } else {
+                       lyxerr << "Non-existant float type: "
+                              << argument << endl;
+               }
+               
        }
        break;
 
@@ -2377,27 +2390,22 @@ string LyXFunc::Dispatch(int ac,
        }
        break;
        
+       case LFUN_CREATE_CITATION:
+       {
+               owner->getDialogs()->createCitation( argument );
+       }
+       break;
+                   
        case LFUN_INSERT_CITATION:
-       {   
-               InsetCitation * new_inset = new InsetCitation();
-               // ale970405
-               // The note, if any, must be after the key, delimited
-               // by a | so both key and remark can have spaces.
-               if (!argument.empty()) {
-                       string lsarg(argument);
-                       if (contains(lsarg, "|")) {
-                               new_inset->setContents(token(lsarg, '|', 0));
-                               new_inset->setOptions(token(lsarg, '|', 1));
-                       } else
-                               new_inset->setContents(lsarg);
-                       if (!owner->view()->insertInset(new_inset))
-                               delete new_inset;
-               } else {
-                       if (owner->view()->insertInset(new_inset))
-                               new_inset->Edit(owner->view(), 0, 0, 0);
-                       else
-                               delete new_inset;
-               }
+       {
+               string keys = token(argument, '|', 0);
+               string text = token(argument, '|', 1);
+
+               InsetCitation * inset = new InsetCitation( keys, text );
+               if (!owner->view()->insertInset(inset))
+                       delete inset;
+               else
+                       owner->view()->updateInset( inset, true );
        }
        break;