From: Lars Gullik Bjønnes Date: Tue, 10 Jun 2003 14:39:45 +0000 (+0000) Subject: the current_view patch X-Git-Tag: 1.6.10~16659 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=309c18fbeb10e1d7c207c390c9d83f9ad09e25ea;p=features.git the current_view patch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7140 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/po/POTFILES.in b/po/POTFILES.in index 668bd4eeba..62f9f0357c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/src/ChangeLog b/src/ChangeLog index 27ac7e4f7d..26bddd322b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,33 @@ +2003-06-10 Lars Gullik Bjønnes + + * 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 * buffer.C: @@ -16,7 +46,7 @@ 2003-06-06 Alfredo Braunstein * BufferView_pimpl.C (dispatch): use Dialogs::visible - + 2003-06-04 Angus Leeming * buffer.C: bump format to 224. diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 076d6eca7b..4a220f144d 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -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 > 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 -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 -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(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(lit->inset); - it->buffer(current_view->buffer()); + it->buffer(const_cast(&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(); diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index 690514cb02..8e47b6829b 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -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 -pasteSelection(ParagraphList & pars, +pasteSelection(Buffer const & buffer, + ParagraphList & pars, ParagraphList::iterator pit, int pos, lyx::textclass_type tc, ErrorList &); /// std::pair -pasteSelection(ParagraphList & pars, +pasteSelection(Buffer const & buffer, + ParagraphList & pars, ParagraphList::iterator pit, int pos, lyx::textclass_type tc, size_t cuts_indexm, ErrorList &); diff --git a/src/buffer.C b/src/buffer.C index 1fd247b510..9b7ceb0e82 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -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(); diff --git a/src/bufferlist.C b/src/bufferlist.C index 25faf205fb..a0c6cf31a2 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -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()); diff --git a/src/bufferparams.C b/src/bufferparams.C index d4c166aaf8..6ee643655c 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -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(); diff --git a/src/bufferparams.h b/src/bufferparams.h index 02e49186d4..8aa0b4a671 100644 --- a/src/bufferparams.h +++ b/src/bufferparams.h @@ -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; /// diff --git a/src/frontends/qt2/QMath.C b/src/frontends/qt2/QMath.C index 0909cd5ff4..1e2f2cbcce 100644 --- a/src/frontends/qt2/QMath.C +++ b/src/frontends/qt2/QMath.C @@ -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)); } diff --git a/src/frontends/qt2/QtView.C b/src/frontends/qt2/QtView.C index 7edfbcb877..b58e7acfc9 100644 --- a/src/frontends/qt2/QtView.C +++ b/src/frontends/qt2/QtView.C @@ -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)); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 2cb34db8b6..c6214f4552 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,10 @@ +2003-06-10 Lars Gullik Bjønnes + + * XFormsView.C: remvoe current_view global variable. + (create_form_form_main): and the usage + + * FormDocument.C: adjust for type + 2003-06-10 Angus Leeming * FormExternal.C (input, updateComboChange): diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index da801fcad9..b3c60b7f1b 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -702,10 +702,10 @@ bool FormDocument::class_apply(BufferParams ¶ms) 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(); diff --git a/src/frontends/xforms/XFormsView.C b/src/frontends/xforms/XFormsView.C index 824ba45ba1..3f104fecc5 100644 --- a/src/frontends/xforms/XFormsView.C +++ b/src/frontends/xforms/XFormsView.C @@ -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)); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 1587a9e782..291dab45ee 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2003-06-10 Lars Gullik Bjønnes + + * insettext.C (appendParagraphs): remove some commented code. + 2003-06-10 Angus Leeming * graphicinset.[Ch] (params): removed. @@ -205,7 +209,7 @@ * 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 diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 6f68e04604..d13ead97c1 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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(); } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 56caaafc3e..08dc527a06 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -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; diff --git a/src/lyx_cb.h b/src/lyx_cb.h index 8ebb2262f2..0c3240eb57 100644 --- a/src/lyx_cb.h +++ b/src/lyx_cb.h @@ -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(); /// diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 7fb2c50776..293e23f3c5 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -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: { diff --git a/src/main.C b/src/main.C index 26bbed4764..6ba9adc0c7 100644 --- a/src/main.C +++ b/src/main.C @@ -13,8 +13,12 @@ #include "gettext.h" #include "support/os.h" +#include + int main(int argc, char * argv[]) { + std::ios::sync_with_stdio(false); + os::init(&argc, &argv); // initialize for internationalized version *EK* diff --git a/src/messages.C b/src/messages.C index 663da2a8f2..18b30d0605 100644 --- a/src/messages.C +++ b/src/messages.C @@ -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()); diff --git a/src/text2.C b/src/text2.C index 1224d22cd5..e068784223 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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);