]> git.lyx.org Git - features.git/commitdiff
implement open-stuff + small things
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 11 Jul 2001 12:10:46 +0000 (12:10 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 11 Jul 2001 12:10:46 +0000 (12:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2219 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/ToolbarDefaults.C
src/insets/ChangeLog
src/insets/insetcollapsable.C
src/insets/insetcommand.C
src/lyxfunc.C
src/lyxtext.h
src/paragraph.C
src/paragraph.h
src/text2.C
src/undo_funcs.C

index beae2eacb5bfef6ee15572ee5c09cdaa47d30135..f42ae6f02262e72e9424758da020aec78285fd3e 100644 (file)
@@ -2634,6 +2634,18 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        }
        break;
        
+       case LFUN_OPENSTUFF:
+       {
+               LyXText * lt = bv_->getLyXText();
+               hideCursor();
+               beforeChange(lt);
+               update(lt, BufferView::SELECT|BufferView::FITCUR);
+               lt->openStuff(bv_);
+               update(lt, BufferView::SELECT|BufferView::FITCUR);
+               setState();
+       }       
+               break;
+
        case LFUN_QUOTE:
                bv_->insertCorrectQuote();
                break;
index a9d3cccf2462004874dcf1dce6d175a9fe8644db..70bb3a8ecd1f41b9d8f4a45b9df002f6c80622c7 100644 (file)
@@ -1,6 +1,25 @@
+2001-07-10  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * BufferView_pimpl.C (Dispatch): handle LFUN_OPENSTUFF.
+
+       * text2.C (openStuff): reintroduce this method (which had been
+       nuked in NEW_INSETS frenzy).
+
+       * lyxfunc.C (Dispatch): when an action has not been handled, use
+       its name in the error message, not its number.
+
+       * paragraph.C (inInset): change method name to begin with lowercase.
+
+       * undo_funcs.C:
+       * text2.C: updates because of this.
+
+2001-07-09  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * ToolbarDefaults.C (add): add spaces in error message
+
 2001-07-10  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
-       * buffer.C (readLyXformat2): initailize the ert comp. variables.
+       * buffer.C (readLyXformat2): initialize the ert comp. variables.
        (readLyXformat2): rename return_par to first_par, use lyxlex's
        pushToken and remove the manual push handling.
        (parseSingleLyXformat2Token): add another ert comp. variable:
index afca95d8813d8c6b51b4e4477795ef6a5631ed66..a51b9ff984daf43b4642ec5981a11148ec181154 100644 (file)
@@ -155,8 +155,8 @@ void ToolbarDefaults::add(string const & func)
        int const tf = lyxaction.LookupFunc(func);
 
        if (tf == -1) {
-               lyxerr << "Toolbar::add: no LyX command called`"
-                      << func << "'exists!" << endl; 
+               lyxerr << "Toolbar::add: no LyX command called `"
+                      << func << "' exists!" << endl; 
        } else {
                add(tf);
        }
index ddb944ed321bc16fbe4bcc9b704d3c4227b7dace..9d83f19d052924c8eb78dc199ff285f94742d3af 100644 (file)
@@ -1,3 +1,10 @@
+2001-07-11  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * insetcollapsable.C (edit): always open collapsed insets (even if
+       they are not autocollapsable)
+
+       * insetcommand.C (operator=): simplify.
+
 2001-07-10  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * insetert.C (latex): handle META_NEWLINE
index 96b4b2976823a6e89fa7c32571f8bcd126513a63..43d93e69189e05c5e0d65e8134aa45ae71284251 100644 (file)
@@ -229,13 +229,13 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
 {
        UpdatableInset::edit(bv, xp, yp, button);
 
-       if (collapsed && autocollapse) {
+       if (collapsed) {
                collapsed = false;
                if (!bv->lockInset(this))
                        return;
                bv->updateInset(this, false);
                inset.edit(bv, 0, 0, button);
-       } else if (!collapsed) {
+       } else {
                if (!bv->lockInset(this))
                        return;
                inset.edit(bv, xp, yp + (top_baseline - inset.y()), button);
index 0c893240880ad0a74a6b4fa045e6fa3de774e214..d48bbbdcb4dbcc7a8531608c294020a53c2e65a9 100644 (file)
@@ -66,8 +66,8 @@ void InsetCommandParams::setFromString( string const & b )
 
 bool InsetCommandParams::operator==(InsetCommandParams const & o) const
 {
-       if (cmdname == o.cmdname && contents == o.contents && options == o.options) return true;
-       return false;
+       return cmdname == o.cmdname && contents == o.contents
+               && options == o.options;
 }
 
 
index 00feadb0650c5ed8621b1338e8e2b03e95fc50cd..57b5ac205c2f47c926f5a733f89eb02ecb186cf4 100644 (file)
@@ -1555,7 +1555,8 @@ string const LyXFunc::Dispatch(int ac,
                // Then if it was none of the above
                if (!owner->view()->Dispatch(action, argument))
                        lyxerr << "A truly unknown func ["
-                              << action << "]!" << endl;
+                              << lyxaction.getActionName(action) << "]!"
+                              << endl;
                break;
        } // end of switch
 
index e5f4275df900bf80d6a7ae09cb0ecc5b0929ffcc..9cf1d7859f8d337bc8afdd2d68aa855c620f6997 100644 (file)
@@ -376,6 +376,8 @@ public:
        void getVisibleRow(BufferView *, int y_offset, int x_offset,
                           Row * row_ptr, int y, bool cleared=false);
 
+       /// 
+       void openStuff(BufferView *);
        ///
        void cutSelection(BufferView *, bool = true);
        ///
index c6553fdc3925364c9dca4ac9f0819e0e38486c0d..5ce8667b97355d3c7eb494aee59e6b1dd32eabe7 100644 (file)
@@ -861,7 +861,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
        // create a new paragraph
        Paragraph * tmp = new Paragraph(this);
        // remember to set the inset_owner
-       tmp->setInsetOwner(InInset());
+       tmp->setInsetOwner(inInset());
        
        // this is an idea for a more userfriendly layout handling, I will
        // see what the users say
@@ -2018,7 +2018,7 @@ bool Paragraph::isFirstInSequence() const
 }
 
 
-Inset * Paragraph::InInset() const
+Inset * Paragraph::inInset() const
 {
        return pimpl_->inset_owner;
 }
index 8d014b08b414856987bbf4e734e35cf73f96f98b..da4fb0189497fa8f5e218cef05fb99c3b90133ee 100644 (file)
@@ -150,7 +150,7 @@ public:
            proof environment */
        int getEndLabel(BufferParams const &) const;
        ///
-       Inset * InInset() const;
+       Inset * inInset() const;
        ///
        void setInsetOwner(Inset * i);
        ///
index 70d560cc6d8d32e6f41d28f4ddeb0aa4808a3300..a33a829bac268b1821963c2ce114c21500955c4b 100644 (file)
@@ -360,6 +360,22 @@ void LyXText::insertParagraph(BufferView * bview, Paragraph * par,
        }
 }
 
+void LyXText::openStuff(BufferView * bview)
+{
+       if (cursor.pos() == 0 && cursor.par()->bibkey){
+               cursor.par()->bibkey->edit(bview, 0, 0, 0);
+       } else if (cursor.pos() < cursor.par()->size() 
+                  && cursor.par()->getChar(cursor.pos()) == Paragraph::META_INSET) {
+               Inset * inset = cursor.par()->getInset(cursor.pos());
+               if (!inset->editable())
+                       return;
+               bview->owner()->message(inset->editMessage());
+               if (inset->editable() != Inset::HIGHLY_EDITABLE)
+                       setCursorParUndo(bview);
+               inset->edit(bview, 0, 0, 0);
+       }
+}
+
 
 /* used in setlayout */
 // Asger is not sure we want to do this...
@@ -1455,11 +1471,11 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
                
                // the caption hack:
                if (layout.labeltype == LABEL_SENSITIVE) {
-                       bool isOK (par->InInset() && par->InInset()->owner() &&
-                                  (par->InInset()->owner()->lyxCode() == Inset::FLOAT_CODE));
+                       bool isOK (par->inInset() && par->inInset()->owner() &&
+                                  (par->inInset()->owner()->lyxCode() == Inset::FLOAT_CODE));
                        
                        if (isOK) {
-                               InsetFloat * tmp = static_cast<InsetFloat*>(par->InInset()->owner());
+                               InsetFloat * tmp = static_cast<InsetFloat*>(par->inInset()->owner());
                                Floating const & fl
                                        = floatList.getType(tmp->type());
                                // We should get the correct number here too.
@@ -2079,7 +2095,7 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par,
                              Paragraph::size_type pos,
                              bool setfont, bool boundary) const
 {
-       InsetText * it = static_cast<InsetText *>(par->InInset());
+       InsetText * it = static_cast<InsetText *>(par->inInset());
        if (it && (it != inset_owner)) {
                it->getLyXText(bview)->setCursorIntern(bview, par, pos, setfont,
                                                       boundary);
@@ -2446,8 +2462,8 @@ Paragraph * LyXText::ownerParagraph(Paragraph * p) const
 Paragraph * LyXText::ownerParagraph(int id, Paragraph * p) const
 {
        Paragraph * op = bv_owner->buffer()->getParFromID(id);
-       if (op && op->InInset()) {
-               static_cast<InsetText *>(op->InInset())->paragraph(p);
+       if (op && op->inInset()) {
+               static_cast<InsetText *>(op->inInset())->paragraph(p);
        } else {
                if (inset_owner) {
                        inset_owner->paragraph(p);
index 0288a053c56e54f9d31c7b3405df31b9e92e7d7c..70095c3424ed41036c8361af267963b7d74bdbea 100644 (file)
@@ -159,7 +159,7 @@ bool textHandleUndo(BufferView * bv, Undo * undo)
                        endpar = behind;
     
                tmppar = bv->buffer()->getParFromID(undo->number_of_cursor_par);
-               UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->InInset());
+               UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->inInset());
                if (it) {
                        it->getLyXText(bv)->redoParagraphs(bv, it->getLyXText(bv)->cursor,
                                                           endpar);
@@ -239,8 +239,8 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
                before_number = first->previous()->id();
        if (behind)
                behind_number = behind->id();
-       if (first->InInset())
-               inset_id = first->InInset()->id();
+       if (first->inInset())
+               inset_id = first->inInset()->id();
 
        // Undo::EDIT  and Undo::FINISH are
        // always finished. (no overlapping there)