]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
citation patch from Angus
[lyx.git] / src / lyxfunc.C
index 79d0dc66a0db010db0a72d57901e216b79f1ebe6..0d9c79a790cac6bfcfaf3d0a23d836edaba50668 100644 (file)
@@ -612,6 +612,9 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
        case LFUN_VC_HISTORY:
                disable = !buf->lyxvc.inUse();
                break;
+       case LFUN_REF_BACK:
+               disable = owner->view()->NoSavedPositions();
+               break;
        default:
                break;
         }
@@ -1584,26 +1587,22 @@ string LyXFunc::Dispatch(int ac,
                MenuInsertLabel(argument.c_str());
                break;
                
-       case LFUN_REF_CREATE:
-       {
-               InsetCommandParams p( "ref" );
-               owner->getDialogs()->createRef( p.getAsString() );
-       }
-       break;
-               
        case LFUN_REF_INSERT:
-       {
-               InsetCommandParams p;
-               p.setFromString( argument );
+               if (argument.empty()) {
+                       InsetCommandParams p("ref");
+               owner->getDialogs()->createRef(p.getAsString());
+               } else {
+                       InsetCommandParams p;
+                       p.setFromString(argument);
+
+                       InsetRef * inset = new InsetRef(p);
+                       if (!owner->view()->insertInset(inset))
+                               delete inset;
+                       else
+                               owner->view()->updateInset(inset, true);
+               }
+               break;
 
-               InsetRef * inset = new InsetRef( p );
-               if (!owner->view()->insertInset(inset))
-                       delete inset;
-               else
-                       owner->view()->updateInset( inset, true );
-       }
-       break;
-                   
        case LFUN_REF_BACK:
        {
                owner->view()->restorePosition();
@@ -2533,6 +2532,28 @@ string LyXFunc::Dispatch(int ac,
        }
        break;
 
+       case LFUN_GOTO_PARAGRAPH:
+       {
+#ifdef HAVE_SSTREAM
+                istringstream istr(argument);
+#else
+                istrstream istr(argument.c_str());
+#endif
+
+               int id;
+               istr >> id;
+               LyXParagraph * par = owner->view()->text->GetParFromID(id);
+
+               // Set the cursor
+               owner->view()->text->SetCursor(owner->view(), par, 0);
+               owner->view()->setState();
+               owner->showState();
+
+               // Recenter screen
+               owner->view()->center();
+       }
+       break;
+
        case LFUN_APROPOS:
        case LFUN_GETTIP:
        {