]> git.lyx.org Git - features.git/commitdiff
Fix bugs
authorDekel Tsur <dekelts@tau.ac.il>
Sun, 28 Apr 2002 14:00:48 +0000 (14:00 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Sun, 28 Apr 2002 14:00:48 +0000 (14:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4082 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/insets/ChangeLog
src/insets/insetfloatlist.C

index be52aba916c1ab1bdff9285a705b5e9afbf1b343..87f5e13afcc691f169550d1b3de7f9469adc73b2 100644 (file)
@@ -2928,23 +2928,17 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                break;
 
        case LFUN_INSET_WIDE_FLOAT:
-       {
                // check if the float type exist
                if (floatList.typeExist(argument)) {
                        InsetFloat * new_inset =
                                new InsetFloat(buffer_->params, argument);
                        new_inset->wide(true);
-                       if (insertInset(new_inset))
-                               new_inset->edit(bv_);
-                       else
-                               delete new_inset;
+                       insertAndEditInset(new_inset);
                } else {
                        lyxerr << "Non-existent float type: "
                               << argument << endl;
                }
-
-       }
-       break;
+               break;
 
 #if 0
        case LFUN_INSET_LIST:
@@ -3247,13 +3241,15 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        break;
 
        case LFUN_FLOAT_LIST:
-       {
-               // We should check the argument for validity. (Lgb)
-               Inset * inset = new InsetFloatList(argument);
-               if (!insertInset(inset, "Standard"))
-                       delete inset;
-       }
-       break;
+               if (floatList.typeExist(argument)) {
+                       Inset * inset = new InsetFloatList(argument);
+                       if (!insertInset(inset, "Standard"))
+                               delete inset;
+               } else {
+                       lyxerr << "Non-existent float type: "
+                              << argument << endl;
+               }
+               break;
 
        case LFUN_THESAURUS_ENTRY:
        {
index 8faa08f87c0d52e42696ded0388ec0b783c6eba0..6613cec435bcab7b3d76b34dca58750d4a68c344 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-28  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * BufferView_pimpl.C (Dispatch): Check that float type exists when 
+       inserting list of floats.
+
 2002-04-24  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * CutAndPaste.C (SwitchLayoutsBetweenClasses): when converting a
index 2f858565510d3fffad0e04b152935c224709d569..759095ec867c367d7351c6a14c48e4eb5010f28c 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-28  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * insetfloatlist.C (getScreenLabel): Fix crash in the case where
+       float type do not exist.
+
 2002-04-26  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * insetfloat.C (c-tor, wide): translate the name of the float.
index cb2785b5197d4733287f9bb931d16d2538511da4..7c146848c2179004318197eec0d3ffb9fae5dcf0 100644 (file)
@@ -34,11 +34,11 @@ InsetFloatList::InsetFloatList(string const & type)
 
 string const InsetFloatList::getScreenLabel(Buffer const *) const
 {
-       string const guiName = floatList[getCmdName()]->second.listName();
-       if (!guiName.empty()) {
-               return _(guiName);
-       }
-       return _("ERROR: Nonexistent float type!");
+       FloatList::const_iterator it = floatList[getCmdName()];
+       if (it != floatList.end())
+               return _(it->second.listName());
+       else
+               return _("ERROR: Nonexistent float type!");
 }
 
 
@@ -60,7 +60,9 @@ void InsetFloatList::read(Buffer const *, LyXLex & lex)
 
        if (lex.eatLine()) {
                setCmdName(lex.getString());
-               lyxerr << "FloatList::float_type: " << getCmdName() << endl;
+               lyxerr[Debug::INSETS] << "FloatList::float_type: " << getCmdName() << endl;
+               if (!floatList.typeExist(getCmdName()))
+                       lex.printError("InsetFloatList: Unknown float type: `$$Token'");
        } else
                lex.printError("InsetFloatList: Parse error: `$$Token'");
        while (lex.isOK()) {