]> git.lyx.org Git - features.git/commitdiff
the current_view patch
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 10 Jun 2003 14:39:45 +0000 (14:39 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 10 Jun 2003 14:39:45 +0000 (14:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7140 a592a061-630c-0410-9148-cb99ea01b6c8

21 files changed:
po/POTFILES.in
src/ChangeLog
src/CutAndPaste.C
src/CutAndPaste.h
src/buffer.C
src/bufferlist.C
src/bufferparams.C
src/bufferparams.h
src/frontends/qt2/QMath.C
src/frontends/qt2/QtView.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormDocument.C
src/frontends/xforms/XFormsView.C
src/insets/ChangeLog
src/insets/insettext.C
src/lyx_cb.C
src/lyx_cb.h
src/lyxfunc.C
src/main.C
src/messages.C
src/text2.C

index 668bd4eebaf3855b4b05e589cda345d84188ff10..62f9f0357c587f321b3f0d8d8412e6bf8ebd1e42 100644 (file)
@@ -53,7 +53,6 @@ src/frontends/qt2/QExternal.C
 src/frontends/qt2/QExternalDialog.C
 src/frontends/qt2/QFloat.C
 src/frontends/qt2/QGraphics.C
-src/frontends/qt2/QGraphicsDialog.C
 src/frontends/qt2/QInclude.C
 src/frontends/qt2/QLPrintDialog.C
 src/frontends/qt2/QLog.C
@@ -133,6 +132,7 @@ src/frontends/xforms/xformsBC.h
 src/frontends/xforms/xforms_helpers.C
 src/gettext.h
 src/importer.C
+src/insets/graphicinset.C
 src/insets/inset.C
 src/insets/insetbibtex.C
 src/insets/insetcaption.C
@@ -151,7 +151,6 @@ src/insets/insetmarginal.C
 src/insets/insetminipage.C
 src/insets/insetnote.C
 src/insets/insetoptarg.C
-src/insets/insetparent.C
 src/insets/insetref.C
 src/insets/insettabular.C
 src/insets/insettext.C
index 27ac7e4f7d23f9f0ea1f410c4de3089e8bf7b478..26bddd322b1c4e950cae7e52ae30073a8652861f 100644 (file)
@@ -1,3 +1,33 @@
+2003-06-10  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * text2.C (cutSelection): adjust
+       (pasteSelection): adjust
+
+       * messages.C: handle get of empty string
+
+       * main.C (main): use sync_with_stdio(false)
+
+       * lyxfunc.C (dispatch): adjust
+
+       * lyx_cb.[Ch] (MenuWrite): remove unneeded BufferView arg
+       (WriteAs): remove unneeded BufferView arg.
+
+       * bufferparams.h: use correct types on papersize, papersize2 and
+       paperpackage.
+
+       * bufferparams.C (readToken): adjust for type
+       (writeLaTeX): add missing cases to switch.
+
+       * bufferlist.C (quitWriteBuffer): adjust
+       (close): adjust
+
+       * buffer.C (asciiParagraph): remove some commented code.
+
+       * CutAndPaste.C: remove current_view extern variable.
+       (cutSelection): add BufferParams arg.
+       (eraseSelection): add BufferParams arg.
+       (pasteSelection): add Buffer const & arg
+
 2003-06-07  John Levon  <levon@movementarian.org>
 
        * buffer.C:
@@ -16,7 +46,7 @@
 2003-06-06  Alfredo Braunstein  <abraunst@libero.it>
 
        * BufferView_pimpl.C (dispatch): use Dialogs::visible
-       
+
 2003-06-04  Angus Leeming  <leeming@lyx.org>
 
        * buffer.C: bump format to 224.
index 076d6eca7b8eac83d5403c3e5db9bb98c8a97376..4a220f144d6803231a423427cd540e259b379305 100644 (file)
@@ -39,8 +39,6 @@ using std::for_each;
 using lyx::pos_type;
 using lyx::textclass_type;
 
-extern BufferView * current_view;
-
 // Jürgen, note that this means that you cannot currently have a list
 // of selections cut/copied. So IMHO later we should have a
 // list/vector/deque that we could store
@@ -66,19 +64,21 @@ limited_stack<pair<ParagraphList, textclass_type> > cuts(10);
 
 } // namespace anon
 
-PitPosPair CutAndPaste::cutSelection(ParagraphList & pars,
+PitPosPair CutAndPaste::cutSelection(BufferParams const & params,
+                                    ParagraphList & pars,
                                     ParagraphList::iterator startpit,
                                     ParagraphList::iterator endpit,
                                     int startpos, int endpos,
                                     textclass_type tc, bool doclear)
 {
        copySelection(startpit, endpit, startpos, endpos, tc);
-       return eraseSelection(pars, startpit, endpit, startpos,
+       return eraseSelection(params, pars, startpit, endpit, startpos,
                              endpos, doclear);
 }
 
 
-PitPosPair CutAndPaste::eraseSelection(ParagraphList & pars,
+PitPosPair CutAndPaste::eraseSelection(BufferParams const & params,
+                                      ParagraphList & pars,
                                       ParagraphList::iterator startpit,
                                       ParagraphList::iterator endpit,
                                       int startpos, int endpos, bool doclear)
@@ -138,10 +138,7 @@ PitPosPair CutAndPaste::eraseSelection(ParagraphList & pars,
        if (all_erased &&
            (startpit->hasSameLayout(*boost::next(startpit)) ||
             boost::next(startpit)->empty())) {
-#warning current_view used here.
-// should we pass buffer or buffer->params around?
-               Buffer * buffer = current_view->buffer();
-               mergeParagraph(buffer->params, pars, startpit);
+               mergeParagraph(params, pars, startpit);
                // this because endpar gets deleted here!
                endpit = startpit;
                endpos = startpos;
@@ -196,16 +193,18 @@ bool CutAndPaste::copySelection(ParagraphList::iterator startpit,
 
 
 pair<PitPosPair, ParagraphList::iterator>
-CutAndPaste::pasteSelection(ParagraphList & pars,
+CutAndPaste::pasteSelection(Buffer const & buffer,
+                           ParagraphList & pars,
                            ParagraphList::iterator pit, int pos,
                            textclass_type tc,
                            ErrorList & errorlist)
 {
-       return pasteSelection(pars, pit, pos, tc, 0, errorlist);
+       return pasteSelection(buffer, pars, pit, pos, tc, 0, errorlist);
 }
 
 pair<PitPosPair, ParagraphList::iterator>
-CutAndPaste::pasteSelection(ParagraphList & pars,
+CutAndPaste::pasteSelection(Buffer const & buffer,
+                           ParagraphList & pars,
                            ParagraphList::iterator pit, int pos,
                            textclass_type tc, size_t cut_index,
                            ErrorList & errorlist)
@@ -258,7 +257,7 @@ CutAndPaste::pasteSelection(ParagraphList & pars,
                                        tmpbuf->erase(i--);
                                }
                        } else {
-                               LyXFont f1 = tmpbuf->getFont(current_view->buffer()->params, i, outerFont(pit, pars));
+                               LyXFont f1 = tmpbuf->getFont(buffer.params, i, outerFont(pit, pars));
                                LyXFont f2 = f1;
                                if (!pit->checkInsertChar(f1)) {
                                        tmpbuf->erase(i--);
@@ -288,17 +287,17 @@ CutAndPaste::pasteSelection(ParagraphList & pars,
                        case Inset::INCLUDE_CODE: {
                                InsetInclude * ii = static_cast<InsetInclude*>(lit->inset);
                                InsetInclude::Params ip = ii->params();
-                               ip.masterFilename_ = current_view->buffer()->fileName();
+                               ip.masterFilename_ = buffer.fileName();
                                ii->set(ip);
                                break;
                        }
-                               
+
                        case Inset::TABULAR_CODE: {
                                InsetTabular * it = static_cast<InsetTabular*>(lit->inset);
-                               it->buffer(current_view->buffer());
+                               it->buffer(const_cast<Buffer*>(&buffer));
                                break;
                        }
-                               
+
                        default:
                                break; // nothing
                        }
@@ -310,7 +309,7 @@ CutAndPaste::pasteSelection(ParagraphList & pars,
        // Open the paragraph for inserting the buf
        // if necessary.
        if (pit->size() > pos || boost::next(pit) == pars.end()) {
-               breakParagraphConservative(current_view->buffer()->params,
+               breakParagraphConservative(buffer.params,
                                           pars, pit, pos);
                paste_the_end = true;
        }
@@ -328,7 +327,7 @@ CutAndPaste::pasteSelection(ParagraphList & pars,
        if (boost::next(pit) == last_paste)
                last_paste = pit;
 
-       mergeParagraph(current_view->buffer()->params, pars, pit);
+       mergeParagraph(buffer.params, pars, pit);
 
        // Store the new cursor position.
        pit = last_paste;
@@ -339,15 +338,15 @@ CutAndPaste::pasteSelection(ParagraphList & pars,
        if (boost::next(last_paste) != pars.end() &&
            paste_the_end) {
                if (boost::next(last_paste)->hasSameLayout(*last_paste)) {
-                       mergeParagraph(current_view->buffer()->params, pars,
+                       mergeParagraph(buffer.params, pars,
                                       last_paste);
                } else if (boost::next(last_paste)->empty()) {
                        boost::next(last_paste)->makeSameLayout(*last_paste);
-                       mergeParagraph(current_view->buffer()->params, pars,
+                       mergeParagraph(buffer.params, pars,
                                       last_paste);
                } else if (last_paste->empty()) {
                        last_paste->makeSameLayout(*boost::next(last_paste));
-                       mergeParagraph(current_view->buffer()->params, pars,
+                       mergeParagraph(buffer.params, pars,
                                       last_paste);
                } else
                        boost::next(last_paste)->stripLeadingSpaces();
index 690514cb021ea7947829fe7c81548e9eccbe35f4..8e47b6829b6fb251883646446dff5292ef94442a 100644 (file)
@@ -23,29 +23,33 @@ class ErrorList;
 ///
 namespace CutAndPaste {
 ///
-PitPosPair cutSelection(ParagraphList & pars,
-            ParagraphList::iterator startpit,
-            ParagraphList::iterator endpit,
-            int start, int end, lyx::textclass_type tc,
-            bool doclear = false);
+PitPosPair cutSelection(BufferParams const & params,
+                       ParagraphList & pars,
+                       ParagraphList::iterator startpit,
+                       ParagraphList::iterator endpit,
+                       int start, int end, lyx::textclass_type tc,
+                       bool doclear = false);
 ///
-PitPosPair eraseSelection(ParagraphList & pars,
-              ParagraphList::iterator startpit,
-              ParagraphList::iterator endpit,
-              int start, int end, bool doclear = false);
+PitPosPair eraseSelection(BufferParams const & params,
+                         ParagraphList & pars,
+                         ParagraphList::iterator startpit,
+                         ParagraphList::iterator endpit,
+                         int start, int end, bool doclear = false);
 ///
 bool copySelection(ParagraphList::iterator startpit,
                   ParagraphList::iterator endpit,
                   int start, int end, lyx::textclass_type tc);
 ///
 std::pair<PitPosPair, ParagraphList::iterator>
-pasteSelection(ParagraphList & pars,
+pasteSelection(Buffer const & buffer,
+              ParagraphList & pars,
               ParagraphList::iterator pit, int pos,
               lyx::textclass_type tc, ErrorList &);
 
 ///
 std::pair<PitPosPair, ParagraphList::iterator>
-pasteSelection(ParagraphList & pars,
+pasteSelection(Buffer const & buffer,
+              ParagraphList & pars,
               ParagraphList::iterator pit, int pos,
               lyx::textclass_type tc,
               size_t cuts_indexm, ErrorList &);
index 1fd247b510f31415cb9cf7c32bf63b23bd35b727..9b7ceb0e82cb0f166a6aad8b0b5fb471860e8da2 100644 (file)
@@ -731,27 +731,10 @@ string const Buffer::asciiParagraph(Paragraph const & par,
                                    bool noparbreak) const
 {
        ostringstream buffer;
-       Paragraph::depth_type depth = 0;
        int ltype = 0;
        Paragraph::depth_type ltype_depth = 0;
        bool ref_printed = false;
-//     if (!par->previous()) {
-#if 0
-       // begins or ends a deeper area ?
-       if (depth != par->params().depth()) {
-               if (par->params().depth() > depth) {
-                       while (par->params().depth() > depth) {
-                               ++depth;
-                       }
-               } else {
-                       while (par->params().depth() < depth) {
-                               --depth;
-                       }
-               }
-       }
-#else
-       depth = par.params().depth();
-#endif
+       Paragraph::depth_type depth = par.params().depth();
 
        // First write the layout
        string const & tmp = par.layout()->name();
index 25faf205fbc3bb15d5cfe814f01ceb1d8fd9aec7..a0c6cf31a239d5ce533e5d47d3cab949d75f9be5 100644 (file)
@@ -48,8 +48,6 @@ using std::find_if;
 using std::for_each;
 using std::mem_fun;
 
-extern BufferView * current_view;
-
 
 BufferList::BufferList()
 {}
@@ -81,9 +79,9 @@ bool BufferList::quitWriteBuffer(Buffer * buf)
                bool succeeded;
 
                if (buf->isUnnamed())
-                       succeeded = WriteAs(current_view, buf);
+                       succeeded = WriteAs(buf);
                else
-                       succeeded = MenuWrite(current_view, buf);
+                       succeeded = MenuWrite(buf);
 
                if (!succeeded)
                        return false;
@@ -180,7 +178,7 @@ bool BufferList::close(Buffer * buf, bool ask)
 
        if (ret == 0) {
                if (buf->isUnnamed()) {
-                       if (!WriteAs(current_view, buf))
+                       if (!WriteAs(buf))
                                return false;
                } else if (buf->save()) {
                        lastfiles->newFile(buf->fileName());
index d4c166aaf828de5bfeebfc15af4780e810ff738d..6ee643655c6b142e54129446612e5538fa1531d4 100644 (file)
@@ -165,14 +165,14 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
                if (tmpret == -1)
                        ++tmpret;
                else
-                       papersize2 = tmpret;
+                       papersize2 = VMARGIN_PAPER_TYPE(tmpret);
        } else if (token == "\\paperpackage") {
                int tmpret = lex.findToken(string_paperpackages);
                if (tmpret == -1) {
                        ++tmpret;
                        paperpackage = BufferParams::PACKAGE_NONE;
                } else
-                       paperpackage = tmpret;
+                       paperpackage = PAPER_PACKAGES(tmpret);
        } else if (token == "\\use_geometry") {
                lex.nextToken();
                use_geometry = lex.getInteger();
@@ -473,6 +473,9 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
        if (!use_geometry &&
            (paperpackage == PACKAGE_NONE)) {
                switch (papersize) {
+               case PAPER_A3PAPER:
+                       clsoptions << "a3paper,";
+                       break;
                case PAPER_A4PAPER:
                        clsoptions << "a4paper,";
                        break;
@@ -491,6 +494,8 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                case PAPER_LEGALPAPER:
                        clsoptions << "legalpaper,";
                        break;
+               case PAPER_DEFAULT:
+                       break;
                }
        }
 
@@ -589,6 +594,8 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
        // At the very beginning the text parameters.
        if (paperpackage != PACKAGE_NONE) {
                switch (paperpackage) {
+               case PACKAGE_NONE:
+                       break;
                case PACKAGE_A4:
                        os << "\\usepackage{a4}\n";
                        texrow.newline();
index 02e49186d48ad0a2a2dfa465d300884afe1b4421..8aa0b4a671ec8cfea82485a7a142c79f0868ef83 100644 (file)
@@ -154,13 +154,13 @@ public:
 
        /* this are for the PaperLayout */
        /// the general papersize (papersize2 or paperpackage
-       char papersize; // add apprip. signedness
+       PAPER_SIZE papersize;
        ///  the selected Geometry papersize
-       char papersize2; // add approp. signedness
+       VMARGIN_PAPER_TYPE papersize2;
        /// a special paperpackage .sty-file
-       char paperpackage; // add approp. signedness
+       PAPER_PACKAGES paperpackage;
        ///
-       PAPER_ORIENTATION orientation; // add approp. signedness
+       PAPER_ORIENTATION orientation;
        ///
        bool use_geometry;
        ///
index 0909cd5ff49a50e0574697c6b199db0cf3aec114..1e2f2cbcce3635a3f62cbc15e5980af2bbf858a6 100644 (file)
@@ -24,6 +24,7 @@
 #include "iconpalette.h"
 
 // needless to say, this can't last for long
+#warning FIXME Current_view used here!
 extern BufferView * current_view;
 
 
@@ -58,24 +59,28 @@ void QMath::build_dialog()
 
 void QMath::subscript()
 {
+#warning FIXME Current_view used here!
        current_view->owner()->dispatch(FuncRequest(LFUN_SUBSCRIPT));
 }
 
 
 void QMath::superscript()
 {
+#warning FIXME Current_view used here!
        current_view->owner()->dispatch(FuncRequest(LFUN_SUPERSCRIPT));
 }
 
 
 void QMath::insert(string const & name)
 {
+#warning FIXME Current_view used here!
        current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name));
 }
 
 
 void QMath::insertCubeRoot()
 {
+#warning FIXME Current_view used here!
        current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, "\\root"));
        current_view->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "3"));
        current_view->owner()->dispatch(FuncRequest(LFUN_RIGHT));
@@ -84,17 +89,20 @@ void QMath::insertCubeRoot()
 
 void QMath::insertMatrix(string const & str)
 {
+#warning FIXME Current_view used here!
        current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, str));
 }
 
 
 void QMath::insertDelim(string const & str)
 {
+#warning FIXME Current_view used here!
        current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str));
 }
 
 
 void QMath::toggleDisplay()
 {
+#warning FIXME Current_view used here!
        current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY));
 }
index 7edfbcb877e6214230b4d89a4cee998dbc322bad..b58e7acfc96838d9a9dd72b5d03ed85b15a4eac4 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjornes
+ * \author Lars Gullik Bjønnes
  * \author John Levon
  *
  * Full author contact details are available in file CREDITS
@@ -47,7 +47,7 @@ int const statusbar_timer_value = 3000;
 
 } // namespace anon
 
-// FIXME: this has to go away
+#warning FIXME Current_view is used here!
 BufferView * current_view;
 
 qfont_loader fontloader;
@@ -61,6 +61,7 @@ QtView::QtView(unsigned int width, unsigned int height)
        qApp->setMainWidget(this);
 
        bufferview_.reset(new BufferView(this, 0, 0, width, height));
+#warning FIXME Current_view is used here!
        ::current_view = bufferview_.get();
 
        menubar_.reset(new Menubar(this, menubackend));
index 2cb34db8b66706f3fe1cfa537b70f822ca9e5695..c6214f4552afe22bb63771a725bbdc35fc0b5831 100644 (file)
@@ -1,3 +1,10 @@
+2003-06-10  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * XFormsView.C: remvoe current_view global variable.
+       (create_form_form_main): and the usage
+
+       * FormDocument.C: adjust for type
+
 2003-06-10  Angus Leeming  <leeming@lyx.org>
 
        * FormExternal.C (input, updateComboChange):
index da801fcad9425406ec238f9f84e34be1fa7c6c91..b3c60b7f1b556aedce799c8e6414bd342e79d676 100644 (file)
@@ -702,10 +702,10 @@ bool FormDocument::class_apply(BufferParams &params)
 
 void FormDocument::paper_apply(BufferParams & params)
 {
-       params.papersize2 = char(fl_get_choice(paper_->choice_papersize) - 1);
+       params.papersize2 = BufferParams::VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1);
 
        params.paperpackage =
-               char(fl_get_choice(paper_->choice_paperpackage) - 1);
+               BufferParams::PAPER_PACKAGES(fl_get_choice(paper_->choice_paperpackage) - 1);
 
        // set params.papersize from params.papersize2 and params.paperpackage
        params.setPaperStuff();
index 824ba45ba15102a733f945f577e86b0732dfae21..3f104fecc5d4328fbabc65e73c406986e6bc047e 100644 (file)
@@ -37,9 +37,6 @@ using std::endl;
 //extern void AutoSave(BufferView *);
 extern void QuitLyX();
 
-// This is very temporary
-BufferView * current_view;
-
 extern "C" {
 
 static
@@ -149,7 +146,6 @@ void XFormsView::create_form_form_main(int width, int height)
 
        bufferview_.reset(new BufferView(this, air, ywork,
                width - 3 * air, workheight));
-       ::current_view = bufferview_.get();
 
        minibuffer_.reset(new XMiniBuffer(*controlcommand_,
                air, height - (25 + air), width - (2 * air), 25));
index 1587a9e782ad6412ef8c1d7e05eb5185c0950186..291dab45ee9d8618c15a1fc1f409c45e159624e1 100644 (file)
@@ -1,3 +1,7 @@
+2003-06-10  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * insettext.C (appendParagraphs): remove some commented code.
+
 2003-06-10  Angus Leeming  <leeming@lyx.org>
 
        * graphicinset.[Ch] (params): removed.
 
        * insetert.C (clone): remove const_cast
 
-       * delete commented same_id functions from a lot of files. 
+       * delete commented same_id functions from a lot of files.
 
 2003-05-28  John Levon  <levon@movementarian.org>
 
index 6f68e04604e47037f74738eb662a7107c0ae2122..d13ead97c16267b2df8f63debfe2b316b9bcac6c 100644 (file)
@@ -2593,40 +2593,6 @@ void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
 #warning FIXME Check if Changes stuff needs changing here. (Lgb)
 // And it probably does. You have to take a look at this John. (Lgb)
 #warning John, have a look here. (Lgb)
-#if 0
-       BufferParams const & bparams = buffer->params;
-       Paragraph * buf;
-       Paragraph * tmpbuf = newpar;
-       Paragraph * lastbuffer = buf = new Paragraph(*tmpbuf, false);
-       if (bparams.tracking_changes)
-               buf->cleanChanges();
-
-       while (tmpbuf->next()) {
-               tmpbuf = tmpbuf->next();
-               lastbuffer->next(new Paragraph(*tmpbuf, false));
-               lastbuffer->next()->previous(lastbuffer);
-               lastbuffer = lastbuffer->next();
-               if (bparams.tracking_changes)
-                       lastbuffer->cleanChanges();
-       }
-
-       lastbuffer = &*(paragraphs.begin());
-       while (lastbuffer->next())
-               lastbuffer = lastbuffer->next();
-       if (!newpar->empty() && !lastbuffer->empty() &&
-               !lastbuffer->isSeparator(lastbuffer->size() - 1))
-       {
-               lastbuffer->insertChar(lastbuffer->size(), ' ');
-       }
-
-       // make the buf exactly the same layout than our last paragraph
-       buf->makeSameLayout(lastbuffer);
-
-       // paste it!
-       lastbuffer->next(buf);
-       buf->previous(lastbuffer);
-       mergeParagraph(buffer->params, paragraphs, lastbuffer);
-#else
        ParagraphList::iterator pit = plist.begin();
        ParagraphList::iterator ins = paragraphs.insert(paragraphs.end(), *pit);
        ++pit;
@@ -2637,8 +2603,6 @@ void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
                paragraphs.push_back(*pit);
        }
 
-#endif
-
        reinitLyXText();
 }
 
index 56caaafc3e0d4b80239c5d921a74f7bd4fa49121..08dc527a06e0c7044793240edccc7699a4a338d2 100644 (file)
@@ -75,7 +75,7 @@ void ShowMessage(Buffer const * buf,
 // Menu callbacks
 //
 
-bool MenuWrite(BufferView * bv, Buffer * buffer)
+bool MenuWrite(Buffer * buffer)
 {
        if (buffer->save()) {
                lastfiles->newFile(buffer->fileName());
@@ -92,13 +92,13 @@ bool MenuWrite(BufferView * bv, Buffer * buffer)
                text, 0, 1, _("&Rename"), _("&Cancel"));
 
        if (ret == 0)
-               return WriteAs(bv, buffer);
+               return WriteAs(buffer);
        return false;
 }
 
 
 
-bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
+bool WriteAs(Buffer * buffer, string const & filename)
 {
        string fname = buffer->fileName();
        string const oldname = fname;
@@ -153,7 +153,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
        bool unnamed = buffer->isUnnamed();
        buffer->setUnnamed(false);
 
-       if (!MenuWrite(bv, buffer)) {
+       if (!MenuWrite(buffer)) {
                buffer->setFileName(oldname);
                buffer->setUnnamed(unnamed);
                return false;
index 8ebb2262f2dcf45ca0a249e9afae2231420bbc85..0c3240eb57ece5b77cb3e63972b90ae509bfaa22 100644 (file)
@@ -16,10 +16,9 @@ void ShowMessage(Buffer const * buf,
                 string const & msg2 = string(),
                 string const & msg3 = string());
 ///
-bool MenuWrite(BufferView * bv, Buffer * buffer);
+bool MenuWrite(Buffer * buffer);
 /// write the given file, or ask if no name given
-bool WriteAs(BufferView * bv, Buffer * buffer,
-            string const & filename = string());
+bool WriteAs(Buffer * buffer, string const & filename = string());
 ///
 void QuitLyX();
 ///
index 7fb2c50776711f42433de0c416f8d3abadd22864..293e23f3c53bbd928f20b65967facbb0076fc5bf 100644 (file)
@@ -1056,14 +1056,14 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                        string const str = bformat(_("Saving document %1$s..."),
                           MakeDisplayPath(owner->buffer()->fileName()));
                        owner->message(str);
-                       MenuWrite(view(), owner->buffer());
+                       MenuWrite(owner->buffer());
                        owner->message(str + _(" done."));
                } else
-                       WriteAs(view(), owner->buffer());
+                       WriteAs(owner->buffer());
                break;
 
        case LFUN_WRITEAS:
-               WriteAs(view(), owner->buffer(), argument);
+               WriteAs(owner->buffer(), argument);
                break;
 
        case LFUN_MENURELOAD: {
index 26bbed47641188738b76e3ca2c55a95ac424811f..6ba9adc0c7608d0448f633dc296312a3e200067c 100644 (file)
 #include "gettext.h"
 #include "support/os.h"
 
+#include <ios>
+
 int main(int argc, char * argv[])
 {
+       std::ios::sync_with_stdio(false);
+
        os::init(&argc, &argv);
 
        // initialize for internationalized version *EK*
index 663da2a8f2317413cfcb224b971d6c2aa04b7ac0..18b30d06058780727e90aadb445705c1e09cb250 100644 (file)
@@ -102,6 +102,9 @@ public:
 
        string const get(string const & m) const
        {
+               if (m.empty())
+                       return m;
+
                char * old = strdup(setlocale(LC_ALL, 0));
                char * n = setlocale(LC_ALL, lang_.c_str());
                const char* msg = gettext(m.c_str());
index 1224d22cd5b1212dcab9bae9e60455f1f10567e1..e0687842238f333b00319e6bbba97ede1bbc4eef 100644 (file)
@@ -1333,12 +1333,14 @@ void LyXText::cutSelection(bool doclear, bool realcut)
        int endpos = selection.end.pos();
 
        boost::tie(endpit, endpos) = realcut ?
-               CutAndPaste::cutSelection(ownerParagraphs(),
+               CutAndPaste::cutSelection(bv()->buffer()->params,
+                                         ownerParagraphs(),
                                          selection.start.par(), endpit,
                                          selection.start.pos(), endpos,
                                          bv()->buffer()->params.textclass,
                                          doclear)
-               : CutAndPaste::eraseSelection(ownerParagraphs(),
+               : CutAndPaste::eraseSelection(bv()->buffer()->params,
+                                             ownerParagraphs(),
                                              selection.start.par(), endpit,
                                              selection.start.pos(), endpos,
                                              doclear);
@@ -1406,7 +1408,8 @@ void LyXText::pasteSelection()
        ErrorList el;
 
        boost::tie(ppp, endpit) =
-               CutAndPaste::pasteSelection(ownerParagraphs(),
+               CutAndPaste::pasteSelection(*bv()->buffer(),
+                                           ownerParagraphs(),
                                            cursor.par(), cursor.pos(),
                                            bv()->buffer()->params.textclass,
                                            el);