diff --git a/lib/ChangeLog b/lib/ChangeLog index 6f9866bbad..65b65ea2e7 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2001-06-23 The LyX Project + + * templates/dinbrief.lyx: remove obsolete \cursor tag + 2001-06-18 Jean-Marc Lasgouttes * tex/cv.cls: diff --git a/lib/bind/math.bind b/lib/bind/math.bind index 17ac804aec..53d5aaa0ed 100644 --- a/lib/bind/math.bind +++ b/lib/bind/math.bind @@ -47,6 +47,25 @@ \bind "M-m 8" "math-insert infty" \bind "M-m v" "accent-vector" +\bind "M-m t t" "math-mutate dump" +\bind "M-m t a" "math-mutate align" +\bind "M-m t i" "math-mutate inline" +\bind "M-m t d" "math-mutate display" +\bind "M-m t e" "math-mutate eqnarray" + +\bind "M-m c i" "math-column-insert" +\bind "M-m c d" "math-column-delete" + +\bind "M-m w i" "math-row-insert" +\bind "M-m w d" "math-row-delete" + +\bind "M-m a v t" "math-valign top" +\bind "M-m a v c" "math-valign center" +\bind "M-m a v b" "math-valign bottom" +\bind "M-m a h l" "math-halign left" +\bind "M-m a h c" "math-halign center" +\bind "M-m a h r" "math-halign right" + # The accent-circumflex is 'h' for 'hat', which is what most math # folks call it verbally. diff --git a/lib/templates/dinbrief.lyx b/lib/templates/dinbrief.lyx index 8b19b12ebf..2711b0e2d2 100644 --- a/lib/templates/dinbrief.lyx +++ b/lib/templates/dinbrief.lyx @@ -37,7 +37,6 @@ \newline \layout Stadt -\cursor 17 \layout Datum diff --git a/lib/ui/default.ui b/lib/ui/default.ui index 99d3897bcc..5ca433c7fa 100644 --- a/lib/ui/default.ui +++ b/lib/ui/default.ui @@ -146,14 +146,14 @@ Menuset End Menu "edit_math" - Item "Make eqnarray|e" "break-line e" - Item "Make multline|m" "break-line m" - Item "Make align 1 column|1" "break-line 1" - Item "Make align 2 columns|2" "break-line 2" - Item "Make align 3 columns|3" "break-line 3" - Item "Make alignat 2 columns|2" "break-line B" - Item "Make alignat 3 columns|3" "break-line C" - Separator +# Item "Make eqnarray|e" "break-line e" +# Item "Make multline|m" "break-line m" +# Item "Make align 1 column|1" "break-line 1" +# Item "Make align 2 columns|2" "break-line 2" +# Item "Make align 3 columns|3" "break-line 3" +# Item "Make alignat 2 columns|2" "break-line B" +# Item "Make alignat 3 columns|3" "break-line C" +# Separator Item "Toggle numbering|n" "math-number" Item "Toggle numbering of line|u" "math-nonumber" Item "Toggle limits|l" "math-limits" @@ -163,8 +163,12 @@ Menuset # INSERT MENU # Menu "insert" - Item "Math Formula|h" "math-mode" - Item "Display Formula|D" "math-display" + Item "Math Formula|h" "math-mode simple" + Item "Display Formula|D" "math-mode display" + Item "Change to Inline Math Formula|q" "math-mutate simple" + Item "Change to Displayed Math Formula|q" "math-mutate equation" + Item "Change to Eqnarray Environment|q" "math-mutate eqnarray" + Item "Change to Align Environment|g" "math-mutate align" Separator Submenu "Special Character|S" "insert_special" Item "Citation Reference...|C" "citation-insert" diff --git a/lib/ui/old-default.ui b/lib/ui/old-default.ui index c328a9f389..1ae668abb3 100644 --- a/lib/ui/old-default.ui +++ b/lib/ui/old-default.ui @@ -244,8 +244,8 @@ Menuset Item "Sum|u" "math-insert sum" Item "Integral|I" "math-insert int" Separator - Item "Math mode|M" "math-mode" - Item "Display|D" "math-display" + Item "Math mode|M" "math-mode simple" + Item "Display|D" "math-mode display" Separator Item "Math Panel...|P" "math-panel" End diff --git a/po/POTFILES.in b/po/POTFILES.in index 55116f1083..53c323e68c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -10,8 +10,8 @@ src/CutAndPaste.C src/debug.C src/exporter.C src/ext_l10n.h -src/figureForm.C src/figure_form.C +src/figureForm.C src/FontLoader.C src/frontends/controllers/ButtonController.h src/frontends/controllers/character.C @@ -89,67 +89,67 @@ src/frontends/qt2/paragraphdlgimpl.C src/frontends/qt2/tabularcreatedlgimpl.C src/frontends/xforms/combox.C src/frontends/xforms/FileDialog.C -src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibitem.C -src/frontends/xforms/FormBibtex.C +src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibtex.C +src/frontends/xforms/FormBibtex.C src/frontends/xforms/form_browser.C -src/frontends/xforms/FormCharacter.C src/frontends/xforms/form_character.C -src/frontends/xforms/FormCitation.C +src/frontends/xforms/FormCharacter.C src/frontends/xforms/form_citation.C -src/frontends/xforms/FormCopyright.C +src/frontends/xforms/FormCitation.C src/frontends/xforms/form_copyright.C -src/frontends/xforms/FormCredits.C +src/frontends/xforms/FormCopyright.C src/frontends/xforms/form_credits.C -src/frontends/xforms/FormDocument.C +src/frontends/xforms/FormCredits.C src/frontends/xforms/form_document.C -src/frontends/xforms/FormError.C +src/frontends/xforms/FormDocument.C src/frontends/xforms/form_error.C -src/frontends/xforms/FormExternal.C +src/frontends/xforms/FormError.C src/frontends/xforms/form_external.C -src/frontends/xforms/FormFiledialog.C +src/frontends/xforms/FormExternal.C src/frontends/xforms/form_filedialog.C -src/frontends/xforms/FormGraphics.C +src/frontends/xforms/FormFiledialog.C src/frontends/xforms/form_graphics.C -src/frontends/xforms/FormInclude.C +src/frontends/xforms/FormGraphics.C src/frontends/xforms/form_include.C -src/frontends/xforms/FormIndex.C +src/frontends/xforms/FormInclude.C src/frontends/xforms/form_index.C +src/frontends/xforms/FormIndex.C src/frontends/xforms/FormLog.C src/frontends/xforms/FormMathsBitmap.C -src/frontends/xforms/FormMathsDeco.C src/frontends/xforms/form_maths_deco.C -src/frontends/xforms/FormMathsDelim.C +src/frontends/xforms/FormMathsDeco.C src/frontends/xforms/form_maths_delim.C -src/frontends/xforms/FormMathsMatrix.C +src/frontends/xforms/FormMathsDelim.C src/frontends/xforms/form_maths_matrix.C -src/frontends/xforms/FormMathsPanel.C +src/frontends/xforms/FormMathsMatrix.C src/frontends/xforms/form_maths_panel.C -src/frontends/xforms/FormMathsSpace.C +src/frontends/xforms/FormMathsPanel.C src/frontends/xforms/form_maths_space.C -src/frontends/xforms/FormMinipage.C +src/frontends/xforms/FormMathsSpace.C src/frontends/xforms/form_minipage.C -src/frontends/xforms/FormParagraph.C +src/frontends/xforms/FormMinipage.C src/frontends/xforms/form_paragraph.C -src/frontends/xforms/FormPreamble.C +src/frontends/xforms/FormParagraph.C src/frontends/xforms/form_preamble.C -src/frontends/xforms/FormPreferences.C +src/frontends/xforms/FormPreamble.C src/frontends/xforms/form_preferences.C -src/frontends/xforms/FormPrint.C +src/frontends/xforms/FormPreferences.C src/frontends/xforms/form_print.C -src/frontends/xforms/FormRef.C +src/frontends/xforms/FormPrint.C src/frontends/xforms/form_ref.C -src/frontends/xforms/FormSearch.C +src/frontends/xforms/FormRef.C src/frontends/xforms/form_search.C -src/frontends/xforms/FormTabular.C +src/frontends/xforms/FormSearch.C src/frontends/xforms/form_tabular.C -src/frontends/xforms/FormTabularCreate.C +src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular_create.C -src/frontends/xforms/FormToc.C +src/frontends/xforms/FormTabularCreate.C src/frontends/xforms/form_toc.C -src/frontends/xforms/FormUrl.C +src/frontends/xforms/FormToc.C src/frontends/xforms/form_url.C +src/frontends/xforms/FormUrl.C src/frontends/xforms/FormVCLog.C src/frontends/xforms/input_validators.C src/frontends/xforms/Menubar_pimpl.C diff --git a/src/BufferView.h b/src/BufferView.h index a239d0ce6d..6a783e7c23 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -19,6 +19,7 @@ #include "LString.h" #include "undo.h" #include "commandtags.h" +#include "insets/inset.h" #include class LyXView; @@ -28,6 +29,8 @@ class Buffer; class LyXScreen; class WorkArea; class Language; +class Painter; +class UpdatableInset; /// class BufferView : boost::noncopyable { diff --git a/src/BufferView2.C b/src/BufferView2.C index 7a3162d1bb..09232ceb84 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -8,11 +8,11 @@ * * ====================================================== */ -#include - #include #include +#include + #include "BufferView.h" #include "buffer.h" #include "lyxcursor.h" @@ -98,7 +98,7 @@ bool BufferView::insertLyXFile(string const & filen) bool BufferView::removeAutoInsets() { - LyXParagraph * par = buffer()->paragraph; + Paragraph * par = buffer()->paragraph; LyXCursor tmpcursor = text->cursor; LyXCursor cursor; @@ -107,12 +107,12 @@ bool BufferView::removeAutoInsets() while (par) { // this has to be done before the delete - text->SetCursor(this, cursor, par, 0); - if (par->AutoDeleteInsets()){ + text->setCursor(this, cursor, par, 0); + if (par->autoDeleteInsets()){ a = true; - text->RedoParagraphs(this, cursor, + text->redoParagraphs(this, cursor, cursor.par()->next()); - text->FullRebreak(this); + text->fullRebreak(this); } par = par->next(); } @@ -121,7 +121,7 @@ bool BufferView::removeAutoInsets() if (tmpcursor.pos() > tmpcursor.par()->size()) tmpcursor.pos(tmpcursor.par()->size()); - text->SetCursorIntern(this, tmpcursor.par(), tmpcursor.pos()); + text->setCursorIntern(this, tmpcursor.par(), tmpcursor.pos()); return a; } @@ -148,25 +148,25 @@ void BufferView::insertErrors(TeXErrors & terr) buffer()->texrow.increasePos(tmpid, tmppos); } - LyXParagraph * texrowpar = 0; + Paragraph * texrowpar = 0; if (tmpid == -1) { - texrowpar = text->FirstParagraph(); + texrowpar = text->firstParagraph(); tmppos = 0; } else { - texrowpar = text->GetParFromID(tmpid); + texrowpar = text->getParFromID(tmpid); } if (texrowpar == 0) continue; InsetError * new_inset = new InsetError(msgtxt); - text->SetCursorIntern(this, texrowpar, tmppos); - text->InsertInset(this, new_inset); - text->FullRebreak(this); + text->setCursorIntern(this, texrowpar, tmppos); + text->insertInset(this, new_inset); + text->fullRebreak(this); } // Restore the cursor position - text->SetCursorIntern(this, cursor.par(), cursor.pos()); + text->setCursorIntern(this, cursor.par(), cursor.pos()); } @@ -177,15 +177,15 @@ void BufferView::setCursorFromRow(int row) buffer()->texrow.getIdFromRow(row, tmpid, tmppos); - LyXParagraph * texrowpar; + Paragraph * texrowpar; if (tmpid == -1) { - texrowpar = text->FirstParagraph(); + texrowpar = text->firstParagraph(); tmppos = 0; } else { - texrowpar = text->GetParFromID(tmpid); + texrowpar = text->getParFromID(tmpid); } - text->SetCursor(this, texrowpar, tmppos); + text->setCursor(this, texrowpar, tmppos); } @@ -209,7 +209,7 @@ bool BufferView::gotoLabel(string const & label) if (find(labels.begin(),labels.end(),label) != labels.end()) { beforeChange(text); - text->SetCursor(this, it.getPar(), it.getPos()); + text->setCursor(this, it.getPar(), it.getPos()); text->selection.cursor = text->cursor; update(text, BufferView::SELECT|BufferView::FITCUR); return true; @@ -226,7 +226,7 @@ void BufferView::menuUndo() hideCursor(); beforeChange(text); update(text, BufferView::SELECT|BufferView::FITCUR); - if (!text->TextUndo(this)) + if (!text->textUndo(this)) owner()->message(_("No forther undo information")); else update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); @@ -247,7 +247,7 @@ void BufferView::menuRedo() hideCursor(); beforeChange(text); update(text, BufferView::SELECT|BufferView::FITCUR); - if (!text->TextRedo(this)) + if (!text->textRedo(this)) owner()->message(_("No further redo information")); else update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); @@ -262,7 +262,7 @@ void BufferView::copyEnvironment() text->copyEnvironmentType(); // clear the selection, even if mark_set toggleSelection(); - text->ClearSelection(this); + text->clearSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR); owner()->message(_("Paragraph environment type copied")); } @@ -282,10 +282,10 @@ void BufferView::pasteEnvironment() void BufferView::copy() { if (available()) { - text->CopySelection(this); + text->copySelection(this); // clear the selection, even if mark_set toggleSelection(); - text->ClearSelection(this); + text->clearSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR); owner()->message(_("Copy")); } @@ -297,7 +297,7 @@ void BufferView::cut() if (available()) { hideCursor(); update(text, BufferView::SELECT|BufferView::FITCUR); - text->CutSelection(this); + text->cutSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); owner()->message(_("Cut")); } @@ -313,16 +313,16 @@ void BufferView::paste() hideCursor(); // clear the selection toggleSelection(); - text->ClearSelection(this); + text->clearSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR); // paste - text->PasteSelection(this); + text->pasteSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); // clear the selection toggleSelection(); - text->ClearSelection(this); + text->clearSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR); } @@ -334,7 +334,7 @@ void BufferView::insertCorrectQuote() char c; if (text->cursor.pos()) - c = text->cursor.par()->GetChar(text->cursor.pos() - 1); + c = text->cursor.par()->getChar(text->cursor.pos() - 1); else c = ' '; @@ -350,7 +350,7 @@ string const BufferView::nextWord(float & value) return string(); } - return text->SelectNextWord(this, value); + return text->selectNextWord(this, value); } @@ -360,7 +360,7 @@ void BufferView::selectLastWord() hideCursor(); beforeChange(text); - text->SelectSelectedWord(this); + text->selectSelectedWord(this); toggleSelection(false); update(text, BufferView::SELECT|BufferView::FITCUR); } @@ -372,8 +372,8 @@ void BufferView::endOfSpellCheck() hideCursor(); beforeChange(text); - text->SelectSelectedWord(this); - text->ClearSelection(this); + text->selectSelectedWord(this); + text->clearSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR); } @@ -391,13 +391,13 @@ void BufferView::replaceWord(string const & replacestring) /* clear the selection (if there is any) */ toggleSelection(false); - text->ReplaceSelectionWithString(this, replacestring); + text->replaceSelectionWithString(this, replacestring); - text->SetSelectionOverString(this, replacestring); + text->setSelectionOverString(this, replacestring); // Go back so that replacement string is also spellchecked for (string::size_type i = 0; i < replacestring.length() + 1; ++i) { - text->CursorLeft(this); + text->cursorLeft(this); } update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } @@ -421,11 +421,11 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc) if (theLockingInset() && available()) { LyXCursor cursor = text->cursor; if ((cursor.pos() - 1 >= 0) && - (cursor.par()->GetChar(cursor.pos() - 1) == - LyXParagraph::META_INSET) && - (cursor.par()->GetInset(cursor.pos() - 1) == + (cursor.par()->getChar(cursor.pos() - 1) == + Paragraph::META_INSET) && + (cursor.par()->getInset(cursor.pos() - 1) == theLockingInset()->GetLockingInset())) - text->SetCursor(this, cursor, + text->setCursor(this, cursor, cursor.par(), cursor.pos() - 1); LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE; LyXText * txt = getLyXText(); @@ -468,11 +468,11 @@ int BufferView::unlockInset(UpdatableInset * inset) if (inset && theLockingInset() == inset) { inset->InsetUnlock(this); theLockingInset(0); - text->FinishUndo(); + text->finishUndo(); return 0; } else if (inset && theLockingInset() && theLockingInset()->UnlockInsetInInset(this, inset)) { - text->FinishUndo(); + text->finishUndo(); return 0; } return bufferlist.unlockInset(inset); @@ -485,7 +485,7 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind) return; // shouldn't happen if (kind == Undo::EDIT) // in this case insets would not be stored! kind = Undo::FINISH; - text->SetUndo(buffer(), kind, + text->setUndo(buffer(), kind, text->cursor.par()->previous(), text->cursor.par()->next()); } @@ -501,7 +501,7 @@ bool BufferView::ChangeInsets(Inset::Code code, string const & from, string const & to) { bool flag = false; - LyXParagraph * par = buffer()->paragraph; + Paragraph * par = buffer()->paragraph; LyXCursor cursor = text->cursor; LyXCursor tmpcursor = cursor; cursor.par(tmpcursor.par()); @@ -509,7 +509,7 @@ bool BufferView::ChangeInsets(Inset::Code code, while (par) { bool flag2 = false; - for (LyXParagraph::inset_iterator it = par->inset_iterator_begin(); + for (Paragraph::inset_iterator it = par->inset_iterator_begin(); it != par->inset_iterator_end(); ++it) { if ((*it)->LyxCode() == code) { InsetCommand * inset = static_cast(*it); @@ -523,14 +523,14 @@ bool BufferView::ChangeInsets(Inset::Code code, flag = true; // this is possible now, since SetCursor takes // care about footnotes - text->SetCursorIntern(this, par, 0); - text->RedoParagraphs(this, text->cursor, + text->setCursorIntern(this, par, 0); + text->redoParagraphs(this, text->cursor, text->cursor.par()->next()); - text->FullRebreak(this); + text->fullRebreak(this); } par = par->next(); } - text->SetCursorIntern(this, cursor.par(), cursor.pos()); + text->setCursorIntern(this, cursor.par(), cursor.pos()); return flag; } @@ -602,6 +602,6 @@ LyXText * BufferView::getParentText(Inset * inset) const Language const * BufferView::getParentLanguage(Inset * inset) const { LyXText * text = getParentText(inset); - return text->cursor.par()->GetFontSettings(buffer()->params, + return text->cursor.par()->getFontSettings(buffer()->params, text->cursor.pos()).language(); } diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 1538a7515f..d0f753a5da 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -57,7 +57,9 @@ #include "insets/insetfloatlist.h" #include "insets/insetspecialchar.h" #include "mathed/formulamacro.h" +#include "mathed/formula.h" #include "gettext.h" +#include "ParagraphParameters.h" extern LyXTextClass::size_type current_layout; extern int greek_kb_flag; @@ -275,14 +277,14 @@ int BufferView::Pimpl::resizeCurrentBuffer() { lyxerr[Debug::INFO] << "resizeCurrentBuffer" << endl; - LyXParagraph * par = 0; - LyXParagraph * selstartpar = 0; - LyXParagraph * selendpar = 0; + Paragraph * par = 0; + Paragraph * selstartpar = 0; + Paragraph * selendpar = 0; UpdatableInset * the_locking_inset = 0; - LyXParagraph::size_type pos = 0; - LyXParagraph::size_type selstartpos = 0; - LyXParagraph::size_type selendpos = 0; + Paragraph::size_type pos = 0; + Paragraph::size_type selstartpos = 0; + Paragraph::size_type selendpos = 0; bool selection = false; bool mark_set = false; @@ -327,13 +329,13 @@ int BufferView::Pimpl::resizeCurrentBuffer() * Mechanism when setting the cursor */ bv_->text->selection.mark(mark_set); if (selection) { - bv_->text->SetCursor(bv_, selstartpar, selstartpos); + bv_->text->setCursor(bv_, selstartpar, selstartpos); bv_->text->selection.cursor = bv_->text->cursor; - bv_->text->SetCursor(bv_, selendpar, selendpos); - bv_->text->SetSelection(bv_); - bv_->text->SetCursor(bv_, par, pos); + bv_->text->setCursor(bv_, selendpar, selendpos); + bv_->text->setSelection(bv_); + bv_->text->setCursor(bv_, par, pos); } else { - bv_->text->SetCursor(bv_, par, pos); + bv_->text->setCursor(bv_, par, pos); bv_->text->selection.cursor = bv_->text->cursor; bv_->text->selection.set(false); } @@ -403,7 +405,7 @@ void BufferView::Pimpl::updateScrollbar() workarea_.setScrollbarBounds(0, height_diff); - double const lineh = bv_->text->DefaultHeight(); + double const lineh = bv_->text->defaultHeight(); workarea_.setScrollbarIncrements(lineh); double const slider_size = 1.0 / double(height_diff) ; workarea_.setScrollbar(current_scrollbar_value, slider_size); @@ -431,14 +433,14 @@ void BufferView::Pimpl::scrollCB(double value) LyXText * vbt = bv_->text; - int const height = vbt->DefaultHeight(); + int const height = vbt->defaultHeight(); int const first = static_cast((bv_->text->first + height)); int const last = static_cast((bv_->text->first + workarea_.height() - height)); if (vbt->cursor.y() < first) - vbt->SetCursorFromCoordinates(bv_, 0, first); + vbt->setCursorFromCoordinates(bv_, 0, first); else if (vbt->cursor.y() > last) - vbt->SetCursorFromCoordinates(bv_, 0, last); + vbt->setCursorFromCoordinates(bv_, 0, last); waitForX(); } @@ -453,12 +455,12 @@ int BufferView::Pimpl::scrollUp(long time) if (value == 0) return 0; - float add_value = (bv_->text->DefaultHeight() + float add_value = (bv_->text->defaultHeight() + float(time) * float(time) * 0.125); if (add_value > workarea_.height()) add_value = float(workarea_.height() - - bv_->text->DefaultHeight()); + bv_->text->defaultHeight()); value -= add_value; @@ -483,12 +485,12 @@ int BufferView::Pimpl::scrollDown(long time) if (value == max) return 0; - float add_value = (bv_->text->DefaultHeight() + float add_value = (bv_->text->defaultHeight() + float(time) * float(time) * 0.125); if (add_value > workarea_.height()) add_value = float(workarea_.height() - - bv_->text->DefaultHeight()); + bv_->text->defaultHeight()); value += add_value; @@ -519,7 +521,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state) // Check for inset locking if (bv_->theLockingInset()) { LyXCursor cursor = bv_->text->cursor; - LyXFont font = bv_->text->GetFont(buffer_, + LyXFont font = bv_->text->getFont(buffer_, cursor.par(), cursor.pos()); int width = bv_->theLockingInset()->width(bv_, font); int inset_x = font.isVisibleRightToLeft() @@ -541,12 +543,12 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state) screen_->HideCursor(); - bv_->text->SetCursorFromCoordinates(bv_, x, y + bv_->text->first); + bv_->text->setCursorFromCoordinates(bv_, x, y + bv_->text->first); if (!bv_->text->selection.set()) update(bv_->text, BufferView::UPDATE); // Maybe an empty line was deleted - bv_->text->SetSelection(bv_); + bv_->text->setSelection(bv_); screen_->ToggleToggle(bv_->text, bv_); fitCursor(bv_->text); screen_->ShowCursor(bv_->text, bv_); @@ -605,8 +607,8 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, // Clear the selection screen_->ToggleSelection(bv_->text, bv_); - bv_->text->ClearSelection(bv_); - bv_->text->FullRebreak(bv_); + bv_->text->clearSelection(bv_); + bv_->text->fullRebreak(bv_); screen_->Update(bv_->text, bv_); updateScrollbar(); @@ -630,8 +632,8 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, } if (!inset_hit) // otherwise it was already set in checkInsetHit(...) - bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + screen_first); - bv_->text->FinishUndo(); + bv_->text->setCursorFromCoordinates(bv_, xpos, ypos + screen_first); + bv_->text->finishUndo(); bv_->text->selection.cursor = bv_->text->cursor; bv_->text->cursor.x_fix(bv_->text->cursor.x()); @@ -670,10 +672,10 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button) if (text->bv_owner) { screen_->HideCursor(); screen_->ToggleSelection(text, bv_); - text->SelectWord(bv_); + text->selectWord(bv_); screen_->ToggleSelection(text, bv_, false); } else { - text->SelectWord(bv_); + text->selectWord(bv_); } /* This will fit the cursor on the screen * if necessary */ @@ -696,10 +698,10 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button) if (screen_.get() && (button == 1)) { screen_->HideCursor(); screen_->ToggleSelection(text, bv_); - text->CursorHome(bv_); + text->cursorHome(bv_); text->selection.cursor = text->cursor; - text->CursorEnd(bv_); - text->SetSelection(bv_); + text->cursorEnd(bv_); + text->setSelection(bv_); screen_->ToggleSelection(text, bv_, false); /* This will fit the cursor on the screen * if necessary */ @@ -776,7 +778,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, // ...or maybe the SetCursorParUndo() // below isn't necessary at all anylonger? if (inset_hit->LyxCode() == Inset::REF_CODE) { - bv_->text->SetCursorParUndo(buffer_); + bv_->text->setCursorParUndo(buffer_); } owner_->message(inset_hit->EditMessage()); @@ -799,11 +801,11 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, if (bv_->text->cursor.pos() < bv_->text->cursor.par()->size()) { c = bv_->text->cursor.par()-> - GetChar(bv_->text->cursor.pos()); + getChar(bv_->text->cursor.pos()); } if (bv_->text->cursor.pos() - 1 >= 0) { c = bv_->text->cursor.par()-> - GetChar(bv_->text->cursor.pos() - 1); + getChar(bv_->text->cursor.pos() - 1); } if (hit == true) { selection_possible = false; @@ -837,18 +839,18 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y, int y_tmp = y + text->first; LyXCursor cursor; - text->SetCursorFromCoordinates(bv_, cursor, x, y_tmp); - text->SetCursor(bv_, cursor, cursor.par(),cursor.pos(),true); + text->setCursorFromCoordinates(bv_, cursor, x, y_tmp); + text->setCursor(bv_, cursor, cursor.par(),cursor.pos(),true); if (cursor.pos() < cursor.par()->size() - && cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET - && cursor.par()->GetInset(cursor.pos()) - && cursor.par()->GetInset(cursor.pos())->Editable()) { + && cursor.par()->getChar(cursor.pos()) == Paragraph::META_INSET + && cursor.par()->getInset(cursor.pos()) + && cursor.par()->getInset(cursor.pos())->Editable()) { // Check whether the inset really was hit - Inset * tmpinset = cursor.par()->GetInset(cursor.pos()); - LyXFont font = text->GetFont(buffer_, + Inset * tmpinset = cursor.par()->getInset(cursor.pos()); + LyXFont font = text->getFont(buffer_, cursor.par(), cursor.pos()); int const width = tmpinset->width(bv_, font); int const inset_x = font.isVisibleRightToLeft() @@ -859,7 +861,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y, if (x > start_x && x < end_x && y_tmp > cursor.y() - tmpinset->ascent(bv_, font) && y_tmp < cursor.y() + tmpinset->descent(bv_, font)) { - text->SetCursor(bv_, cursor.par(),cursor.pos(), true); + text->setCursor(bv_, cursor.par(),cursor.pos(), true); x = x - start_x; // The origin of an inset is on the baseline y = y_tmp - (text->cursor.y()); @@ -868,11 +870,11 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y, } if ((cursor.pos() - 1 >= 0) && - (cursor.par()->GetChar(cursor.pos()-1) == LyXParagraph::META_INSET) && - (cursor.par()->GetInset(cursor.pos() - 1)) && - (cursor.par()->GetInset(cursor.pos() - 1)->Editable())) { - Inset * tmpinset = cursor.par()->GetInset(cursor.pos()-1); - LyXFont font = text->GetFont(buffer_, cursor.par(), + (cursor.par()->getChar(cursor.pos()-1) == Paragraph::META_INSET) && + (cursor.par()->getInset(cursor.pos() - 1)) && + (cursor.par()->getInset(cursor.pos() - 1)->Editable())) { + Inset * tmpinset = cursor.par()->getInset(cursor.pos()-1); + LyXFont font = text->getFont(buffer_, cursor.par(), cursor.pos()-1); int const width = tmpinset->width(bv_, font); int const inset_x = font.isVisibleRightToLeft() @@ -886,7 +888,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y, #if 0 if (move_cursor && (tmpinset != bv_->theLockingInset())) #endif - text->SetCursor(bv_, cursor.par(), + text->setCursor(bv_, cursor.par(), cursor.pos() - 1, true); x = x - start_x; // The origin of an inset is on the baseline @@ -911,8 +913,8 @@ void BufferView::Pimpl::workAreaExpose() work_area_height = workarea_.height(); if (buffer_ != 0) { if (widthChange) { - // All buffers need a resize - bufferlist.resize(); + // The visible LyXView need a resize + owner_->resize(); // Remove all texts from the textcache // This is not _really_ what we want to do. What @@ -1002,7 +1004,7 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f) text->selection.cursor = text->cursor; } - text->FullRebreak(bv_); + text->fullRebreak(bv_); if (text->inset_owner) { text->inset_owner->SetUpdateStatus(bv_, InsetText::NONE); @@ -1063,11 +1065,11 @@ void BufferView::Pimpl::cursorPrevious(LyXText * text) if (text->inset_owner) y += bv_->text->first; Row * cursorrow = text->cursor.row(); - text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y); - bv_->text->FinishUndo(); + text->setCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y); + bv_->text->finishUndo(); // This is to allow jumping over large insets if ((cursorrow == text->cursor.row())) - text->CursorUp(bv_); + text->cursorUp(bv_); if (text->inset_owner || text->cursor.row()->height() < workarea_.height()) @@ -1088,14 +1090,14 @@ void BufferView::Pimpl::cursorNext(LyXText * text) int y = text->first + workarea_.height(); // if (text->inset_owner) // y += bv_->text->first; - text->GetRowNearY(y); + text->getRowNearY(y); Row * cursorrow = text->cursor.row(); - text->SetCursorFromCoordinates(bv_, text->cursor.x_fix(), y); // + workarea_->height()); - bv_->text->FinishUndo(); + text->setCursorFromCoordinates(bv_, text->cursor.x_fix(), y); // + workarea_->height()); + bv_->text->finishUndo(); // This is to allow jumping over large insets if ((cursorrow == bv_->text->cursor.row())) - text->CursorDown(bv_); + text->cursorDown(bv_); if (text->inset_owner || text->cursor.row()->height() < workarea_.height()) @@ -1115,7 +1117,7 @@ bool BufferView::Pimpl::available() const void BufferView::Pimpl::beforeChange(LyXText * text) { toggleSelection(); - text->ClearSelection(bv_); + text->clearSelection(bv_); } @@ -1150,11 +1152,11 @@ void BufferView::Pimpl::restorePosition(unsigned int i) if (b != 0 ) buffer(b); } - LyXParagraph * par = bv_->text->GetParFromID(saved_positions[i].par_id); + Paragraph * par = bv_->text->getParFromID(saved_positions[i].par_id); if (!par) return; - bv_->text->SetCursor(bv_, par, + bv_->text->setCursor(bv_, par, min(par->size(), saved_positions[i].par_pos)); update(bv_->text, BufferView::SELECT|BufferView::FITCUR); @@ -1217,7 +1219,7 @@ void BufferView::Pimpl::insetUnlock() if (!inset_slept) bv_->theLockingInset()->InsetUnlock(bv_); bv_->theLockingInset(0); - bv_->text->FinishUndo(); + bv_->text->finishUndo(); inset_slept = false; } } @@ -1300,9 +1302,9 @@ void BufferView::Pimpl::pasteClipboard(bool asPara) if (clip.empty()) return; if (asPara) { - bv_->text->InsertStringB(bv_, clip); + bv_->text->insertStringAsParagraphs(bv_, clip); } else { - bv_->text->InsertStringA(bv_, clip); + bv_->text->insertStringAsLines(bv_, clip); } update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } @@ -1326,7 +1328,7 @@ void BufferView::Pimpl::moveCursorUpdate(bool selecting) LyXText * lt = bv_->getLyXText(); if (selecting || lt->selection.mark()) { - lt->SetSelection(bv_); + lt->setSelection(bv_); if (lt->bv_owner) toggleToggle(); } @@ -1605,7 +1607,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT | BufferView::FITCUR); - lt->SetLayout(bv_, layout.second); + lt->setLayout(bv_, layout.second); owner_->setLayout(layout.second); update(lt, BufferView::SELECT @@ -1678,7 +1680,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT | BufferView::FITCUR); - lt->ChangeWordCase(bv_, LyXText::text_uppercase); + lt->changeWordCase(bv_, LyXText::text_uppercase); if (lt->inset_owner) updateInset(lt->inset_owner, true); update(lt, @@ -1693,7 +1695,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->ChangeWordCase(bv_, LyXText::text_lowercase); + lt->changeWordCase(bv_, LyXText::text_lowercase); if (lt->inset_owner) updateInset(lt->inset_owner, true); update(lt, @@ -1708,7 +1710,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->ChangeWordCase(bv_, + lt->changeWordCase(bv_, LyXText::text_capitalization); if (lt->inset_owner) updateInset(lt->inset_owner, true); @@ -1724,7 +1726,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->TransposeChars(*bv_); + lt->transposeChars(*bv_); if (lt->inset_owner) updateInset(lt->inset_owner, true); update(lt, @@ -1795,18 +1797,18 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); if (is_rtl) - lt->CursorLeft(bv_, false); + lt->cursorLeft(bv_, false); if (lt->cursor.pos() < lt->cursor.par()->size() - && lt->cursor.par()->GetChar(lt->cursor.pos()) - == LyXParagraph::META_INSET - && lt->cursor.par()->GetInset(lt->cursor.pos()) - && lt->cursor.par()->GetInset(lt->cursor.pos())->Editable() == Inset::HIGHLY_EDITABLE){ - Inset * tmpinset = lt->cursor.par()->GetInset(lt->cursor.pos()); + && lt->cursor.par()->getChar(lt->cursor.pos()) + == Paragraph::META_INSET + && lt->cursor.par()->getInset(lt->cursor.pos()) + && lt->cursor.par()->getInset(lt->cursor.pos())->Editable() == Inset::HIGHLY_EDITABLE){ + Inset * tmpinset = lt->cursor.par()->getInset(lt->cursor.pos()); owner_->getLyXFunc()->setMessage(tmpinset->EditMessage()); int y = 0; if (is_rtl) { LyXFont const font = - lt->GetFont(buffer_, + lt->getFont(buffer_, lt->cursor.par(), lt->cursor.pos()); y = tmpinset->descent(bv_,font); @@ -1815,8 +1817,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) break; } if (!is_rtl) - lt->CursorRight(bv_, false); - lt->FinishUndo(); + lt->cursorRight(bv_, false); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1833,18 +1835,18 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); LyXCursor const cur = lt->cursor; if (!is_rtl) - lt->CursorLeft(bv_, false); + lt->cursorLeft(bv_, false); if ((is_rtl || cur != lt->cursor) && // only if really moved! lt->cursor.pos() < lt->cursor.par()->size() && - (lt->cursor.par()->GetChar(lt->cursor.pos()) == - LyXParagraph::META_INSET) && - lt->cursor.par()->GetInset(lt->cursor.pos()) && - (lt->cursor.par()->GetInset(lt->cursor.pos())->Editable() + (lt->cursor.par()->getChar(lt->cursor.pos()) == + Paragraph::META_INSET) && + lt->cursor.par()->getInset(lt->cursor.pos()) && + (lt->cursor.par()->getInset(lt->cursor.pos())->Editable() == Inset::HIGHLY_EDITABLE)) { - Inset * tmpinset = lt->cursor.par()->GetInset(lt->cursor.pos()); + Inset * tmpinset = lt->cursor.par()->getInset(lt->cursor.pos()); owner_->getLyXFunc()->setMessage(tmpinset->EditMessage()); - LyXFont const font = lt->GetFont(buffer_, + LyXFont const font = lt->getFont(buffer_, lt->cursor.par(), lt->cursor.pos()); int y = is_rtl ? 0 @@ -1856,9 +1858,9 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) break; } if (is_rtl) - lt->CursorRight(bv_, false); + lt->cursorRight(bv_, false); - lt->FinishUndo(); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1871,8 +1873,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); - lt->CursorUp(bv_); - lt->FinishUndo(); + lt->cursorUp(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1885,8 +1887,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); - lt->CursorDown(bv_); - lt->FinishUndo(); + lt->cursorDown(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1899,8 +1901,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); - lt->CursorUpParagraph(bv_); - lt->FinishUndo(); + lt->cursorUpParagraph(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1913,8 +1915,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::UPDATE); - lt->CursorDownParagraph(bv_); - lt->FinishUndo(); + lt->cursorDownParagraph(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1928,7 +1930,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::UPDATE); cursorPrevious(lt); - lt->FinishUndo(); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1942,7 +1944,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::UPDATE); cursorNext(lt); - lt->FinishUndo(); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1955,8 +1957,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!lt->selection.mark()) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorHome(bv_); - lt->FinishUndo(); + lt->cursorHome(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1970,8 +1972,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorEnd(bv_); - lt->FinishUndo(); + lt->cursorEnd(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -1986,8 +1988,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorTab(bv_); - lt->FinishUndo(); + lt->cursorTab(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -2001,10 +2003,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) - lt->CursorLeftOneWord(bv_); + lt->cursorLeftOneWord(bv_); else - lt->CursorRightOneWord(bv_); - lt->FinishUndo(); + lt->cursorRightOneWord(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -2018,10 +2020,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) - lt->CursorRightOneWord(bv_); + lt->cursorRightOneWord(bv_); else - lt->CursorLeftOneWord(bv_); - lt->FinishUndo(); + lt->cursorLeftOneWord(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -2035,8 +2037,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorTop(bv_); - lt->FinishUndo(); + lt->cursorTop(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -2050,8 +2052,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorBottom(bv_); - lt->FinishUndo(); + lt->cursorBottom(bv_); + lt->finishUndo(); moveCursorUpdate(false); owner_->showState(); } @@ -2065,10 +2067,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) - lt->CursorLeft(bv_); + lt->cursorLeft(bv_); else - lt->CursorRight(bv_); - lt->FinishUndo(); + lt->cursorRight(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2081,10 +2083,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) - lt->CursorRight(bv_); + lt->cursorRight(bv_); else - lt->CursorLeft(bv_); - lt->FinishUndo(); + lt->cursorLeft(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2096,8 +2098,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorUp(bv_); - lt->FinishUndo(); + lt->cursorUp(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2109,8 +2111,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorDown(bv_); - lt->FinishUndo(); + lt->cursorDown(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2122,8 +2124,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorUpParagraph(bv_); - lt->FinishUndo(); + lt->cursorUpParagraph(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2135,8 +2137,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorDownParagraph(bv_); - lt->FinishUndo(); + lt->cursorDownParagraph(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2148,7 +2150,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); cursorPrevious(lt); - lt->FinishUndo(); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2160,7 +2162,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); cursorNext(lt); - lt->FinishUndo(); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2171,8 +2173,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorHome(bv_); - lt->FinishUndo(); + lt->cursorHome(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2183,8 +2185,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorEnd(bv_); - lt->FinishUndo(); + lt->cursorEnd(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2196,10 +2198,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) - lt->CursorLeftOneWord(bv_); + lt->cursorLeftOneWord(bv_); else - lt->CursorRightOneWord(bv_); - lt->FinishUndo(); + lt->cursorRightOneWord(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2211,10 +2213,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) update(lt, BufferView::SELECT|BufferView::FITCUR); if (lt->cursor.par()->isRightToLeftPar(buffer_->params)) - lt->CursorRightOneWord(bv_); + lt->cursorRightOneWord(bv_); else - lt->CursorLeftOneWord(bv_); - lt->FinishUndo(); + lt->cursorLeftOneWord(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2227,8 +2229,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (lt->inset_owner) break; update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorTop(bv_); - lt->FinishUndo(); + lt->cursorTop(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2242,8 +2244,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) break; update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->CursorBottom(bv_); - lt->FinishUndo(); + lt->cursorBottom(bv_); + lt->finishUndo(); moveCursorUpdate(true); owner_->showState(); } @@ -2255,7 +2257,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); beforeChange(lt); - lt->InsertChar(bv_, LyXParagraph::META_NEWLINE); + lt->insertChar(bv_, Paragraph::META_NEWLINE); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -2270,10 +2272,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXLayout const & style = textclasslist .Style(buffer_->params.textclass, - lt->cursor.par()->GetLayout()); + lt->cursor.par()->getLayout()); if (style.free_spacing) { - lt->InsertChar(bv_, ' '); + lt->insertChar(bv_, ' '); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -2340,28 +2342,28 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!lt->selection.set()) { if (cursor.pos() == cursor.par()->size()) { - lt->CursorRight(bv_); + lt->cursorRight(bv_); cursor = lt->cursor; if (cursor.pos() == 0 - && !(cursor.par()->params.spaceTop() + && !(cursor.par()->params().spaceTop() == VSpace (VSpace::NONE))) { - lt->SetParagraph + lt->setParagraph (bv_, - cursor.par()->params.lineTop(), - cursor.par()->params.lineBottom(), - cursor.par()->params.pagebreakTop(), - cursor.par()->params.pagebreakBottom(), + cursor.par()->params().lineTop(), + cursor.par()->params().lineBottom(), + cursor.par()->params().pagebreakTop(), + cursor.par()->params().pagebreakBottom(), VSpace(VSpace::NONE), - cursor.par()->params.spaceBottom(), - cursor.par()->params.align(), - cursor.par()->params.labelWidthString(), 0); - lt->CursorLeft(bv_); + cursor.par()->params().spaceBottom(), + cursor.par()->params().align(), + cursor.par()->params().labelWidthString(), 0); + lt->cursorLeft(bv_); update(lt, BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); } else { - lt->CursorLeft(bv_); + lt->cursorLeft(bv_); lt->Delete(bv_); lt->selection.cursor = lt->cursor; update(lt, @@ -2386,7 +2388,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) /* -------> Delete word forward. */ case LFUN_DELETE_WORD_FORWARD: update(bv_->getLyXText(), BufferView::SELECT|BufferView::FITCUR); - bv_->getLyXText()->DeleteWordForward(bv_); + bv_->getLyXText()->deleteWordForward(bv_); update(bv_->getLyXText(), BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); moveCursorUpdate(false); owner_->showState(); @@ -2398,7 +2400,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->DeleteWordBackward(bv_); + lt->deleteWordBackward(bv_); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -2414,7 +2416,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); update(lt, BufferView::SELECT|BufferView::FITCUR); - lt->DeleteLineForward(bv_); + lt->deleteLineForward(bv_); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -2454,7 +2456,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!lt->selection.set()) { if (owner_->getIntl()->getTrans().backspace()) { - lt->Backspace(bv_); + lt->backspace(bv_); lt->selection.cursor = lt->cursor; update(lt, BufferView::SELECT @@ -2481,23 +2483,23 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!lt->selection.set()) { if (cursor.pos() == 0 - && !(cursor.par()->params.spaceTop() + && !(cursor.par()->params().spaceTop() == VSpace (VSpace::NONE))) { - lt->SetParagraph + lt->setParagraph (bv_, - cursor.par()->params.lineTop(), - cursor.par()->params.lineBottom(), - cursor.par()->params.pagebreakTop(), - cursor.par()->params.pagebreakBottom(), - VSpace(VSpace::NONE), cursor.par()->params.spaceBottom(), - cursor.par()->params.align(), - cursor.par()->params.labelWidthString(), 0); + cursor.par()->params().lineTop(), + cursor.par()->params().lineBottom(), + cursor.par()->params().pagebreakTop(), + cursor.par()->params().pagebreakBottom(), + VSpace(VSpace::NONE), cursor.par()->params().spaceBottom(), + cursor.par()->params().align(), + cursor.par()->params().labelWidthString(), 0); update(lt, BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); } else { - lt->Backspace(bv_); + lt->backspace(bv_); lt->selection.cursor = cursor; update(lt, BufferView::SELECT @@ -2514,7 +2516,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); beforeChange(lt); - lt->BreakParagraph(bv_, 0); + lt->breakParagraph(bv_, 0); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -2530,7 +2532,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); beforeChange(lt); - lt->BreakParagraph(bv_, 1); + lt->breakParagraph(bv_, 1); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -2552,21 +2554,21 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) beforeChange(lt); if (cursor.pos() == 0) { - if (cursor.par()->params.spaceTop() == VSpace(VSpace::NONE)) { - lt->SetParagraph + if (cursor.par()->params().spaceTop() == VSpace(VSpace::NONE)) { + lt->setParagraph (bv_, - cursor.par()->params.lineTop(), - cursor.par()->params.lineBottom(), - cursor.par()->params.pagebreakTop(), - cursor.par()->params.pagebreakBottom(), - VSpace(VSpace::DEFSKIP), cursor.par()->params.spaceBottom(), - cursor.par()->params.align(), - cursor.par()->params.labelWidthString(), 1); + cursor.par()->params().lineTop(), + cursor.par()->params().lineBottom(), + cursor.par()->params().pagebreakTop(), + cursor.par()->params().pagebreakBottom(), + VSpace(VSpace::DEFSKIP), cursor.par()->params().spaceBottom(), + cursor.par()->params().align(), + cursor.par()->params().labelWidthString(), 1); //update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } } else { - lt->BreakParagraph(bv_, 0); + lt->breakParagraph(bv_, 0); //update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } @@ -2584,11 +2586,11 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) { LyXText * lt = bv_->getLyXText(); - LyXParagraph * par = lt->cursor.par(); - Spacing::Space cur_spacing = par->params.spacing().getSpace(); + Paragraph * par = lt->cursor.par(); + Spacing::Space cur_spacing = par->params().spacing().getSpace(); float cur_value = 1.0; if (cur_spacing == Spacing::Other) { - cur_value = par->params.spacing().getValue(); + cur_value = par->params().spacing().getValue(); } istringstream istr(argument.c_str()); @@ -2620,8 +2622,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) << argument << endl; } if (cur_spacing != new_spacing || cur_value != new_value) { - par->params.spacing(Spacing(new_spacing, new_value)); - lt->RedoParagraph(bv_); + par->params().spacing(Spacing(new_spacing, new_value)); + lt->redoParagraph(bv_); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -2812,10 +2814,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_CHARATCURSOR: { - LyXParagraph::size_type pos = bv_->getLyXText()->cursor.pos(); + Paragraph::size_type pos = bv_->getLyXText()->cursor.pos(); if (pos < bv_->getLyXText()->cursor.par()->size()) owner_->getLyXFunc()->setMessage( - tostr(bv_->getLyXText()->cursor.par()->GetChar(pos))); + tostr(bv_->getLyXText()->cursor.par()->getChar(pos))); else owner_->getLyXFunc()->setMessage("EOF"); } @@ -2833,7 +2835,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) int x; int y; ::sscanf(argument.c_str(), " %d %d", &x, &y); - bv_->getLyXText()->SetCursorFromCoordinates(bv_, x, y); + bv_->getLyXText()->setCursorFromCoordinates(bv_, x, y); } break; @@ -2903,7 +2905,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_INSERT_MATRIX: { if (available()) { - if (open_new_inset(new InsetFormula(false))) { + if (open_new_inset(new InsetFormula, false)) { bv_->theLockingInset() ->LocalDispatch(bv_, action, argument); } @@ -2916,16 +2918,16 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (!available()) break; - InsetFormula * f = new InsetFormula(true); + InsetFormula * f = new InsetFormula(LM_OT_EQUATION); open_new_inset(f); f->LocalDispatch(bv_, LFUN_INSERT_MATH, argument); } break; case LFUN_MATH_DISPLAY: - { + { if (available()) - open_new_inset(new InsetFormula(true)); + open_new_inset(new InsetFormula(LM_OT_EQUATION), false); break; } @@ -2938,7 +2940,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) else { string const s1 = token(s, ' ', 1); int const na = s1.empty() ? 0 : lyx::atoi(s1); - open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na)); + open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na), false); } } } @@ -2947,7 +2949,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_MATH_MODE: // Open or create a math inset { if (available()) - open_new_inset(new InsetFormula); + open_new_inset(new InsetFormula, false); owner_->getLyXFunc()->setMessage(N_("Math editor mode")); } break; @@ -3023,13 +3025,13 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (argument.empty()) { // Get the word immediately preceding the cursor - LyXParagraph::size_type curpos = + Paragraph::size_type curpos = bv_->getLyXText()->cursor.pos() - 1; string curstring; if (curpos >= 0 ) curstring = bv_->getLyXText() - ->cursor.par()->GetWord(curpos); + ->cursor.par()->getWord(curpos); p.setContents( curstring ); } else { @@ -3056,13 +3058,13 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) case LFUN_INDEX_INSERT_LAST: { // Get word immediately preceding the cursor - LyXParagraph::size_type curpos = + Paragraph::size_type curpos = bv_->getLyXText()->cursor.pos() - 1; // Can't do that at the beginning of a paragraph if (curpos < 0) break; string const curstring(bv_->getLyXText() - ->cursor.par()->GetWord(curpos)); + ->cursor.par()->getWord(curpos)); InsetCommandParams p("index", curstring); InsetIndex * inset = new InsetIndex(p); @@ -3137,7 +3139,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) if (lyxrc.auto_region_delete) { if (lt->selection.set()) { - lt->CutSelection(bv_, false); + lt->cutSelection(bv_, false); bv_->update(lt, BufferView::SELECT | BufferView::FITCUR @@ -3191,7 +3193,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) LyXText * lt = bv_->getLyXText(); for (int i = 0; i < datetmp_len; i++) { - lt->InsertChar(bv_, datetmp[i]); + lt->insertChar(bv_, datetmp[i]); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -3223,7 +3225,7 @@ void BufferView::Pimpl::newline() update(lt, BufferView::SELECT | BufferView::FITCUR); - lt->InsertChar(bv_, LyXParagraph::META_NEWLINE); + lt->insertChar(bv_, Paragraph::META_NEWLINE); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -3240,7 +3242,7 @@ void BufferView::Pimpl::hfill() update(lt, BufferView::SELECT | BufferView::FITCUR); - lt->InsertChar(bv_, LyXParagraph::META_HFILL); + lt->insertChar(bv_, Paragraph::META_HFILL); update(lt, BufferView::SELECT | BufferView::FITCUR @@ -3328,7 +3330,7 @@ bool BufferView::Pimpl::open_new_inset(UpdatableInset * new_inset, bool behind) LyXText * lt = bv_->getLyXText(); beforeChange(lt); - lt->FinishUndo(); + lt->finishUndo(); if (!insertInset(new_inset)) { delete new_inset; return false; @@ -3353,19 +3355,19 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout) } // not quite sure if we want this... - bv_->text->SetCursorParUndo(buffer_); - bv_->text->FreezeUndo(); + bv_->text->setCursorParUndo(buffer_); + bv_->text->freezeUndo(); beforeChange(bv_->text); if (!lout.empty()) { update(bv_->text, BufferView::SELECT|BufferView::FITCUR); - bv_->text->BreakParagraph(bv_); + bv_->text->breakParagraph(bv_); update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); if (bv_->text->cursor.par()->size()) { - bv_->text->CursorLeft(bv_); + bv_->text->cursorLeft(bv_); - bv_->text->BreakParagraph(bv_); + bv_->text->breakParagraph(bv_); update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } @@ -3381,9 +3383,9 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout) lay = 0; } - bv_->text->SetLayout(bv_, lay); + bv_->text->setLayout(bv_, lay); - bv_->text->SetParagraph(bv_, 0, 0, + bv_->text->setParagraph(bv_, 0, 0, 0, 0, VSpace(VSpace::NONE), VSpace(VSpace::NONE), LYX_ALIGN_LAYOUT, @@ -3394,10 +3396,10 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout) bv_->text->current_font.setLatex(LyXFont::OFF); } - bv_->text->InsertInset(bv_, inset); + bv_->text->insertInset(bv_, inset); update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); - bv_->text->UnFreezeUndo(); + bv_->text->unFreezeUndo(); return true; } @@ -3410,7 +3412,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty) // first check for locking insets if (bv_->theLockingInset()) { if (bv_->theLockingInset() == inset) { - if (bv_->text->UpdateInset(bv_, inset)) { + if (bv_->text->updateInset(bv_, inset)) { update(); if (mark_dirty) { buffer_->markDirty(); @@ -3419,7 +3421,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty) return; } } else if (bv_->theLockingInset()->UpdateInsetInInset(bv_, inset)) { - if (bv_->text->UpdateInset(bv_, + if (bv_->text->updateInset(bv_, bv_->theLockingInset())) { update(); if (mark_dirty){ @@ -3435,7 +3437,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty) if (available()) { hideCursor(); update(bv_->text, BufferView::UPDATE); - if (bv_->text->UpdateInset(bv_, inset)) { + if (bv_->text->updateInset(bv_, inset)) { if (mark_dirty) { update(bv_->text, BufferView::SELECT @@ -3461,21 +3463,21 @@ void BufferView::Pimpl::gotoInset(vector const & codes, string contents; if (same_content && - bv_->text->cursor.par()->GetChar(bv_->text->cursor.pos()) == LyXParagraph::META_INSET) { - Inset const * inset = bv_->text->cursor.par()->GetInset(bv_->text->cursor.pos()); + bv_->text->cursor.par()->getChar(bv_->text->cursor.pos()) == Paragraph::META_INSET) { + Inset const * inset = bv_->text->cursor.par()->getInset(bv_->text->cursor.pos()); if (find(codes.begin(), codes.end(), inset->LyxCode()) != codes.end()) contents = static_cast(inset)->getContents(); } - if (!bv_->text->GotoNextInset(bv_, codes, contents)) { + if (!bv_->text->gotoNextInset(bv_, codes, contents)) { if (bv_->text->cursor.pos() - || bv_->text->cursor.par() != bv_->text->FirstParagraph()) { + || bv_->text->cursor.par() != bv_->text->firstParagraph()) { LyXCursor tmp = bv_->text->cursor; - bv_->text->cursor.par(bv_->text->FirstParagraph()); + bv_->text->cursor.par(bv_->text->firstParagraph()); bv_->text->cursor.pos(0); - if (!bv_->text->GotoNextInset(bv_, codes, contents)) { + if (!bv_->text->gotoNextInset(bv_, codes, contents)) { bv_->text->cursor = tmp; bv_->owner()->message(_("No more insets")); } diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index f1234753cf..6f3e376230 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -10,6 +10,7 @@ #include "commandtags.h" #include "frontends/Timeout.h" #include "WorkArea.h" +#include "paragraph.h" #ifdef __GNUG__ #pragma interface @@ -178,11 +179,11 @@ private: /// Cursor paragraph Id int par_id; /// Cursor position - LyXParagraph::size_type par_pos; + Paragraph::size_type par_pos; /// Position() : par_id(0), par_pos(0) {} /// - Position(string const & f, int id, LyXParagraph::size_type pos) + Position(string const & f, int id, Paragraph::size_type pos) : filename(f), par_id(id), par_pos(pos) {} }; /// diff --git a/src/ChangeLog b/src/ChangeLog index 47b70bd4ef..fb9d1afea6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,85 @@ +2001-06-24 The LyX Project + + * lyxlex_pimpl.C (compare_tags): use compare_ascii_no_case instead + of compare_no_case + +2001-06-24 Lars Gullik Bjønnes + + * lyxtext.h: rename most methods to begin with a small char. + Lots of changes because of this. + + * paragraph.C (Paragraph): do not call fitToSize + (erase): call Pimpl::erase + (insertChar): call Pimpl::insertChar + (insertInset): call Pipl::insertInset + (breakParagraph): do not call fitToSize + (breakParagraphConservative): do not call fitToSize + (fitToSize): remove method + + * buffer.C (parseSingleLyXformat2Token): do not call fitToSize + +2001-06-24 The LyX Project + + * Fix Qt compilation^2 + +2001-06-24 The LyX Project + + * paragraph.[Ch] (outerHook): new method. mostly equivalent to + depthHook(getDepth()-1). + + * paragraph.h: + * ParagraphParameters.h: + * ParameterStruct.h: change type of depth to unsigned int == + depth_type. Many adaptations to other files before of that. + +2001-06-24 The LyX Project + + * Fix Qt compilation. + +2001-06-24 Lars Gullik Bjønnes + + * paragraph.h: renamed several methods to begin with small letter. + several changes to many parts of the code because of this. + +2001-06-23 The LyX Project + + * text2.C (InsertStringAsLines): renamed from InsertStringA; + rewritten to discard all double spaces when KeepEmpty is off + (InsertStringAsParagraphs): renamed from InsertStringB; rewritten + to only handle newlines but not fiddle with spaces and friends. + + * lyxfunc.C (MenuNew): when doing 'new from template', use + template_path as default directory + +2001-06-23 The LyX Project + + * Clean-up of header file includes all over + * paragraph.h: Move some of the stuff into paragraph_pimpl.h + +2001-06-23 Lars Gullik Bjønnes + + * paragraph.h: renamed from lyxparagraph.h + +2001-06-23 Asger + + * Buffer.h: Removed Buffer::resize + * BufferList.h: Removed BufferList::resize + * LyXView.h: Added LyXView::resize. This way, we will only reflow + the document lazily when we change the width, or the font settings. + +2001-06-22 John Levon + + * lyxfunc.C: silently ignore empty dispatches from the minibuffer + +2001-06-22 John Levon + + * buffer.h: remove out of date comment + +2001-06-22 John Levon + + * lyxscreen.h: + * screen.C: fix "theoretical" GC leak + 2001-06-20 Jean-Marc Lasgouttes * LaTeX.C (scanAuxFile): @@ -42,7 +124,7 @@ 2001-06-14 Angus Leeming * BufferView.C: - * Bullet.C + * Bullet.C: * ColorHandler.C: * FontInfo.C: * FontLoader.C: diff --git a/src/ColorHandler.h b/src/ColorHandler.h index cee0790174..b5864e0f6e 100644 --- a/src/ColorHandler.h +++ b/src/ColorHandler.h @@ -25,7 +25,10 @@ class LyXFont; class WorkArea; -/// +/** + * This is a factory class that can produce GCs with a specific + * color. It will cache GCs for performance. + */ class LyXColorHandler { public: /// diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 43f6fa246d..36af28fbc7 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -12,7 +12,7 @@ #include "CutAndPaste.h" #include "BufferView.h" #include "buffer.h" -#include "lyxparagraph.h" +#include "paragraph.h" #include "insets/inseterror.h" #include "lyx_gui_misc.h" #include "lyxcursor.h" @@ -30,7 +30,7 @@ extern BufferView * current_view; // of selections cut/copied. So IMHO later we should have a // list/vector/deque that we could store // struct selection_item { -// LyXParagraph * buf; +// Paragraph * buf; // LyXTextClassList::size_type textclass; // }; // in and some method of choosing beween them (based on the first few chars @@ -47,7 +47,7 @@ extern BufferView * current_view; namespace { -LyXParagraph * buf = 0; +Paragraph * buf = 0; LyXTextClassList::size_type textclass = 0; // for now here this should be in another Cut&Paste Class! @@ -56,23 +56,23 @@ LyXTextClassList::size_type textclass = 0; // Perhaps it even should take a parameter? (Lgb) void DeleteBuffer() { - if (!buf) + if (!buf) return; - LyXParagraph * tmppar; + Paragraph * tmppar; - while (buf) { + while (buf) { tmppar = buf; buf = buf->next(); delete tmppar; - } - buf = 0; + } + buf = 0; } } // namespace anon -bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar, +bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar, int start, int & end, char tc, bool doclear) { if (!startpar || (start > startpar->size())) @@ -85,26 +85,26 @@ bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar, if (!(*endpar) || startpar == (*endpar)) { // only within one paragraph - buf = new LyXParagraph; - LyXParagraph::size_type i = start; + buf = new Paragraph; + Paragraph::size_type i = start; if (end > startpar->size()) end = startpar->size(); for (; i < end; ++i) { - startpar->CopyIntoMinibuffer(*current_view->buffer(), + startpar->copyIntoMinibuffer(*current_view->buffer(), start); - startpar->Erase(start); + startpar->erase(start); - buf->InsertFromMinibuffer(buf->size()); + buf->insertFromMinibuffer(buf->size()); } end = start - 1; } else { // more than one paragraph - (*endpar)->BreakParagraphConservative(current_view->buffer()->params, + (*endpar)->breakParagraphConservative(current_view->buffer()->params, end); *endpar = (*endpar)->next(); end = 0; - - startpar->BreakParagraphConservative(current_view->buffer()->params, + + startpar->breakParagraphConservative(current_view->buffer()->params, start); // store the selection @@ -119,14 +119,14 @@ bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar, (*endpar)->previous(startpar); // the cut selection should begin with standard layout - buf->Clear(); + buf->clear(); // paste the paragraphs again, if possible if (doclear) - startpar->next()->StripLeadingSpaces(textclass); - if (startpar->HasSameLayout(startpar->next()) || + startpar->next()->stripLeadingSpaces(textclass); + if (startpar->hasSameLayout(startpar->next()) || !startpar->next()->size()) { - startpar->PasteParagraph(current_view->buffer()->params); + startpar->pasteParagraph(current_view->buffer()->params); (*endpar) = startpar; // this because endpar gets deleted here! } } @@ -134,7 +134,7 @@ bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar, } -bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar, +bool CutAndPaste::copySelection(Paragraph * startpar, Paragraph * endpar, int start, int end, char tc) { if (!startpar || (start > startpar->size())) @@ -147,46 +147,46 @@ bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar, if (!endpar || startpar == endpar) { // only within one paragraph - buf = new LyXParagraph; - LyXParagraph::size_type i = start; + buf = new Paragraph; + Paragraph::size_type i = start; if (end > startpar->size()) end = startpar->size(); for (; i < end; ++i) { - startpar->CopyIntoMinibuffer(*current_view->buffer(), i); - buf->InsertFromMinibuffer(buf->size()); + startpar->copyIntoMinibuffer(*current_view->buffer(), i); + buf->insertFromMinibuffer(buf->size()); } } else { // copy more than one paragraph // clone the paragraphs within the selection - LyXParagraph * tmppar = startpar; - buf = new LyXParagraph(*tmppar); - LyXParagraph * tmppar2 = buf; + Paragraph * tmppar = startpar; + buf = new Paragraph(*tmppar); + Paragraph * tmppar2 = buf; while (tmppar != endpar && tmppar->next()) { tmppar = tmppar->next(); - tmppar2->next(new LyXParagraph(*tmppar)); + tmppar2->next(new Paragraph(*tmppar)); tmppar2->next()->previous(tmppar2); tmppar2 = tmppar2->next(); } tmppar2->next(0); // the buf paragraph is too big - LyXParagraph::size_type tmpi2 = start; + Paragraph::size_type tmpi2 = start; for (; tmpi2; --tmpi2) - buf->Erase(0); + buf->erase(0); // now tmppar 2 is too big, delete all after end tmpi2 = end; while (tmppar2->size() > tmpi2) { - tmppar2->Erase(tmppar2->size() - 1); + tmppar2->erase(tmppar2->size() - 1); } } return true; } -bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, +bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar, int & pos, char tc) { if (!checkPastePossible(*par)) @@ -195,15 +195,15 @@ bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, if (pos > (*par)->size()) pos = (*par)->size(); - // LyXParagraph * tmpbuf; - LyXParagraph * tmppar = *par; + // Paragraph * tmpbuf; + Paragraph * tmppar = *par; int tmppos = pos; // There are two cases: cutbuffer only one paragraph or many if (!buf->next()) { // only within a paragraph - LyXParagraph * tmpbuf = new LyXParagraph(*buf); - + Paragraph * tmpbuf = new Paragraph(*buf); + // Some provisions should be done here for checking // if we are inserting at the beginning of a // paragraph. If there are a space at the beginning @@ -214,12 +214,12 @@ bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, // This is an attempt to fix the // "never insert a space at the // beginning of a paragraph" problem. - if (!tmppos && buf->IsLineSeparator(0)) { - buf->Erase(0); + if (!tmppos && buf->isLineSeparator(0)) { + buf->erase(0); } else { - buf->CutIntoMinibuffer(current_view->buffer()->params, 0); - buf->Erase(0); - if (tmppar->InsertFromMinibuffer(tmppos)) + buf->cutIntoMinibuffer(current_view->buffer()->params, 0); + buf->erase(0); + if (tmppar->insertFromMinibuffer(tmppos)) ++tmppos; } } @@ -231,13 +231,13 @@ bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, // many paragraphs // make a copy of the simple cut_buffer - LyXParagraph * tmpbuf = buf; - LyXParagraph * simple_cut_clone = new LyXParagraph(*tmpbuf); - LyXParagraph * tmpbuf2 = simple_cut_clone; - + Paragraph * tmpbuf = buf; + Paragraph * simple_cut_clone = new Paragraph(*tmpbuf); + Paragraph * tmpbuf2 = simple_cut_clone; + while (tmpbuf->next()) { tmpbuf = tmpbuf->next(); - tmpbuf2->next(new LyXParagraph(*tmpbuf)); + tmpbuf2->next(new Paragraph(*tmpbuf)); tmpbuf2->next()->previous(tmpbuf2); tmpbuf2 = tmpbuf2->next(); } @@ -247,10 +247,10 @@ bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, // make the buf exactly the same layout than // the cursor paragraph - buf->MakeSameLayout(*par); + buf->makeSameLayout(*par); // find the end of the buffer - LyXParagraph * lastbuffer = buf; + Paragraph * lastbuffer = buf; while (lastbuffer->next()) lastbuffer = lastbuffer->next(); @@ -259,7 +259,7 @@ bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, // open the paragraph for inserting the buf // if necessary if (((*par)->size() > pos) || !(*par)->next()) { - (*par)->BreakParagraphConservative(current_view->buffer()->params, + (*par)->breakParagraphConservative(current_view->buffer()->params, pos); paste_the_end = true; } @@ -276,22 +276,22 @@ bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, if ((*par)->next() == lastbuffer) lastbuffer = *par; - (*par)->PasteParagraph(current_view->buffer()->params); + (*par)->pasteParagraph(current_view->buffer()->params); // store the new cursor position *par = lastbuffer; pos = lastbuffer->size(); // maybe some pasting if (lastbuffer->next() && paste_the_end) { - if (lastbuffer->next()->HasSameLayout(lastbuffer)) { - lastbuffer->PasteParagraph(current_view->buffer()->params); + if (lastbuffer->next()->hasSameLayout(lastbuffer)) { + lastbuffer->pasteParagraph(current_view->buffer()->params); } else if (!lastbuffer->next()->size()) { - lastbuffer->next()->MakeSameLayout(lastbuffer); - lastbuffer->PasteParagraph(current_view->buffer()->params); + lastbuffer->next()->makeSameLayout(lastbuffer); + lastbuffer->pasteParagraph(current_view->buffer()->params); } else if (!lastbuffer->size()) { - lastbuffer->MakeSameLayout(lastbuffer->next()); - lastbuffer->PasteParagraph(current_view->buffer()->params); + lastbuffer->makeSameLayout(lastbuffer->next()); + lastbuffer->pasteParagraph(current_view->buffer()->params); } else - lastbuffer->next()->StripLeadingSpaces(tc); + lastbuffer->next()->stripLeadingSpaces(tc); } // restore the simple cut buffer buf = simple_cut_clone; @@ -305,9 +305,9 @@ int CutAndPaste::nrOfParagraphs() { if (!buf) return 0; - + int n = 1; - LyXParagraph * tmppar = buf; + Paragraph * tmppar = buf; while(tmppar->next()) { ++n; tmppar = tmppar->next(); @@ -318,13 +318,13 @@ int CutAndPaste::nrOfParagraphs() int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1, LyXTextClassList::size_type c2, - LyXParagraph * par) + Paragraph * par) { - int ret = 0; - if (!par || c1 == c2) + int ret = 0; + if (!par || c1 == c2) return ret; - - while (par) { + + while (par) { string const name = textclasslist.NameOfLayout(c1, par->layout); int lay = 0; @@ -347,17 +347,17 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1, + textclasslist.NameOfClass(c1) + _(" to ") + textclasslist.NameOfClass(c2); InsetError * new_inset = new InsetError(s); - par->InsertInset(0, new_inset); + par->insertInset(0, new_inset); } par = par->next(); - } - return ret; + } + return ret; } -bool CutAndPaste::checkPastePossible(LyXParagraph *) +bool CutAndPaste::checkPastePossible(Paragraph *) { - if (!buf) return false; - - return true; + if (!buf) return false; + + return true; } diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index bdb40f61bf..173de5ce75 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -17,22 +17,22 @@ #include "layout.h" -class LyXParagraph; +class Paragraph; /// class CutAndPaste { public: /// static - bool cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar, + bool cutSelection(Paragraph * startpar, Paragraph ** endpar, int start, int & end, char tc, bool doclear = false); /// static - bool copySelection(LyXParagraph * startpar, LyXParagraph * endpar, + bool copySelection(Paragraph * startpar, Paragraph * endpar, int start, int end, char tc); /// static - bool pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar, + bool pasteSelection(Paragraph ** par, Paragraph ** endpar, int & pos, char tc); /// static @@ -44,10 +44,10 @@ public: static int SwitchLayoutsBetweenClasses(LyXTextClassList::size_type class1, LyXTextClassList::size_type class2, - LyXParagraph * par); + Paragraph * par); /// static - bool checkPastePossible(LyXParagraph *); + bool checkPastePossible(Paragraph *); }; #endif diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index 3877a1a36d..324ff4ccce 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -71,7 +71,7 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, LyXTextClass::size_type n) boldsymbol = false; // special features - LyXParagraphIndent = false; + ParagraphIndent = false; NeedLyXFootnoteCode = false; NeedLyXMinipageIndent = false; } @@ -321,7 +321,7 @@ string const LaTeXFeatures::getMacros() const // other if (NeedLyXMinipageIndent) macros << minipageindent_def; - if (LyXParagraphIndent) + if (ParagraphIndent) macros << paragraphindent_def; if (NeedLyXFootnoteCode) macros << floatingfootnote_def; diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index c74bb09215..5ce3d84982 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -126,7 +126,7 @@ struct LaTeXFeatures { std::vector layout; /// - bool LyXParagraphIndent; + bool ParagraphIndent; /// bool NeedLyXFootnoteCode; /// diff --git a/src/LyXAction.C b/src/LyXAction.C index 25c91a8bd2..7c90498ccf 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -288,12 +288,19 @@ void LyXAction::init() N_("Insert math symbol"), Noop }, { LFUN_MATH_LIMITS, "math-limits", "", Noop }, { LFUN_MATH_MACRO, "math-macro", "", Noop }, + { LFUN_MATH_MUTATE, "math-mutate", "", Noop }, { LFUN_MATH_MACROARG, "math-macro-arg", "", Noop }, { LFUN_INSERT_MATRIX, "math-matrix", "", Noop }, { LFUN_MATH_MODE, "math-mode", N_("Math mode"), Noop }, { LFUN_MATH_NONUMBER, "math-nonumber", "", Noop }, { LFUN_MATH_NUMBER, "math-number", "", Noop }, { LFUN_MATH_EXTERN, "math-extern", "", Noop }, + { LFUN_MATH_VALIGN, "math-valign", "", Noop }, + { LFUN_MATH_HALIGN, "math-halign", "", Noop }, + { LFUN_MATH_ROW_INSERT, "math-row-insert", "", Noop }, + { LFUN_MATH_ROW_DELETE, "math-row-delete", "", Noop }, + { LFUN_MATH_COLUMN_INSERT, "math-column-insert", "", Noop }, + { LFUN_MATH_COLUMN_DELETE, "math-column-delete", "", Noop }, { LFUN_MATH_PANEL, "math-panel", "", Noop }, { LFUN_MATH_SIZE, "math-size", "", Noop }, { LFUN_MENU_OPEN_BY_NAME, "menu-open", "", NoBuffer }, diff --git a/src/LyXSendto.C b/src/LyXSendto.C index 881ad276eb..e548bd26f6 100644 --- a/src/LyXSendto.C +++ b/src/LyXSendto.C @@ -13,6 +13,7 @@ #include "gettext.h" #include "bufferview_funcs.h" #include "exporter.h" +#include "BufferView.h" extern FD_form_sendto * fd_form_sendto; extern BufferView * current_view; diff --git a/src/LyXView.C b/src/LyXView.C index f11ddce950..04e318f76a 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -1,3 +1,4 @@ + /* This file is part of * ====================================================== * @@ -39,6 +40,7 @@ #include "bufferview_funcs.h" // CurrentState() #include "gettext.h" #include "lyxfunc.h" +#include "BufferView.h" using std::endl; @@ -102,6 +104,12 @@ void LyXView::redraw() { } +void LyXView::resize() +{ + view()->resize(); +} + + /// returns the buffer currently shown in the main form. Buffer * LyXView::buffer() const { @@ -368,7 +376,7 @@ void LyXView::updateLayoutChoice() LyXTextClass::size_type layout = - bufferview->text->cursor.par()->GetLayout(); + bufferview->text->cursor.par()->getLayout(); if (layout != current_layout){ toolbar->setLayout(layout); diff --git a/src/LyXView.h b/src/LyXView.h index 85295c2736..646ac77509 100644 --- a/src/LyXView.h +++ b/src/LyXView.h @@ -59,6 +59,9 @@ public: /// Redraw the main form. void redraw(); + /// Resize all BufferViews in this LyXView (because the width changed) + void resize(); + /// returns the buffer currently shown in the main form. Buffer * buffer() const; diff --git a/src/Makefile.am b/src/Makefile.am index bd153c01fd..4cc29ddc21 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -154,7 +154,6 @@ lyx_SOURCES = \ lyxlex_pimpl.h \ lyxlookup.C \ lyxlookup.h \ - lyxparagraph.h \ lyxrc.C \ lyxrc.h \ lyxrow.C \ @@ -172,6 +171,9 @@ lyx_SOURCES = \ os2_defines.h \ os2_errortable.h \ paragraph.C \ + paragraph.h \ + paragraph_pimpl.C \ + paragraph_pimpl.h \ print_form.C \ print_form.h \ screen.C \ @@ -200,6 +202,8 @@ lyx_SOURCES = \ trans_mgr.h \ undo.C \ undo.h \ + undostack.C \ + undostack.h \ vc-backend.C \ vc-backend.h \ version.h \ diff --git a/src/ParagraphParameters.C b/src/ParagraphParameters.C index 8f73b952d1..6ccaf2c58d 100644 --- a/src/ParagraphParameters.C +++ b/src/ParagraphParameters.C @@ -231,7 +231,7 @@ void ParagraphParameters::align(LyXAlignment la) } -void ParagraphParameters::depth(char d) +void ParagraphParameters::depth(depth_type d) { ParameterStruct tmp(*param); tmp.depth = d; diff --git a/src/ParagraphParameters.h b/src/ParagraphParameters.h index 82f8ddc0a7..86a89cccf0 100644 --- a/src/ParagraphParameters.h +++ b/src/ParagraphParameters.h @@ -63,9 +63,11 @@ public: /// void align(LyXAlignment); /// - char depth() const; + typedef ParameterStruct::depth_type depth_type; /// - void depth(char); + depth_type depth() const; + /// + void depth(depth_type); /// bool startOfAppendix() const; /// @@ -119,7 +121,7 @@ private: inline -char ParagraphParameters::depth() const +ParagraphParameters::depth_type ParagraphParameters::depth() const { return param->depth; } diff --git a/src/ParameterStruct.h b/src/ParameterStruct.h index 0ac0cb42fc..294ce16f60 100644 --- a/src/ParameterStruct.h +++ b/src/ParameterStruct.h @@ -9,6 +9,8 @@ /// struct ParameterStruct { + /// + typedef unsigned int depth_type; /// VSpace added_space_top; /// @@ -28,7 +30,7 @@ struct ParameterStruct { /// LyXAlignment align; /// - char depth; // wrong type (Lgb) + depth_type depth; /// bool start_of_appendix; /// diff --git a/src/TextCache.h b/src/TextCache.h index 780652933b..d09559b9ca 100644 --- a/src/TextCache.h +++ b/src/TextCache.h @@ -36,7 +36,7 @@ // // Q. What are we caching? // A. We are caching the screen representations (LyXText) of the -// documents (Buffer,LyXParagraph) for specific BufferView widths. +// documents (Buffer,Paragraph) for specific BufferView widths. // Q. Why the cache? // A. It is not really needed, but it speeds things up a lot // when you have more than one document loaded at once since a total diff --git a/src/UpdateInset.C b/src/UpdateInset.C index 863229c229..632cfcb4ec 100644 --- a/src/UpdateInset.C +++ b/src/UpdateInset.C @@ -6,7 +6,7 @@ #include "UpdateInset.h" #include "BufferView.h" -//#include "insets/lyxinset.h" +//#include "insets/inset.h" void UpdateInset::update(BufferView * bv) { diff --git a/src/buffer.C b/src/buffer.C index 88249a22f3..f95fa7893c 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -49,7 +49,8 @@ #include "lyxfont.h" #include "version.h" #include "mathed/formulamacro.h" -#include "insets/lyxinset.h" +#include "mathed/formula.h" +#include "insets/inset.h" #include "insets/inseterror.h" #include "insets/insetlabel.h" #include "insets/insetref.h" @@ -99,6 +100,8 @@ #include "exporter.h" #include "Lsstream.h" #include "converter.h" +#include "BufferView.h" +#include "ParagraphParameters.h" using std::stringstream; using std::ostream; @@ -165,8 +168,8 @@ Buffer::~Buffer() DestroyBufferTmpDir(tmppath); } - LyXParagraph * par = paragraph; - LyXParagraph * tmppar; + Paragraph * par = paragraph; + Paragraph * tmppar; while (par) { tmppar = par->next(); delete par; @@ -178,12 +181,11 @@ Buffer::~Buffer() string const Buffer::getLatexName(bool no_path) const { + string name = ChangeExtension(MakeLatexName(filename), ".tex"); if (no_path) - return OnlyFilename(ChangeExtension(MakeLatexName(filename), - ".tex")); + return OnlyFilename(name); else - return ChangeExtension(MakeLatexName(filename), - ".tex"); + return name; } @@ -245,7 +247,7 @@ bool Buffer::saveParamsAsDefaults() // const defaults.params = params; // add an empty paragraph. Is this enough? - defaults.paragraph = new LyXParagraph; + defaults.paragraph = new Paragraph; return defaults.writeFile(defaults.filename, false); } @@ -284,13 +286,13 @@ void Buffer::setFileName(string const & newfile) // if par = 0 normal behavior // else insert behavior // Returns false if "\the_end" is not read for formats >= 2.13. (Asger) -bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par) +bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par) { int pos = 0; - char depth = 0; // signed or unsigned? + Paragraph::depth_type depth = 0; bool the_end_read = false; - LyXParagraph * return_par = 0; + Paragraph * return_par = 0; LyXFont font(LyXFont::ALL_INHERIT, params.language); if (file_format < 216 && params.language->lang() == "hebrew") font.setLanguage(default_language); @@ -299,10 +301,11 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par) string pretoken; if (!par) { - par = new LyXParagraph; + par = new Paragraph; } else { - users->text->BreakParagraph(users); - return_par = users->text->FirstParagraph(); + // We are inserting into an existing document + users->text->breakParagraph(users); + return_par = users->text->firstParagraph(); pos = 0; markDirty(); // We don't want to adopt the parameters from the @@ -352,10 +355,11 @@ string last_inset_read; bool -Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, - LyXParagraph *& return_par, +Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, + Paragraph *& return_par, string const & token, int & pos, - char & depth, LyXFont & font + Paragraph::depth_type & depth, + LyXFont & font ) { bool the_end_read = false; @@ -365,22 +369,21 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, static int call_depth; ++call_depth; bool checkminipage = false; - static LyXParagraph * minipar; - static LyXParagraph * parBeforeMinipage; + static Paragraph * minipar; + static Paragraph * parBeforeMinipage; #endif if (token[0] != '\\') { for (string::const_iterator cit = token.begin(); - cit != token.end(); ++cit) - { - par->InsertChar(pos, (*cit), font); + cit != token.end(); ++cit) { + par->insertChar(pos, (*cit), font); ++pos; } checkminipage = true; } else if (token == "\\i") { Inset * inset = new InsetLatexAccent; inset->Read(this, lex); - par->InsertInset(pos, inset, font); + par->insertInset(pos, inset, font); ++pos; } else if (token == "\\layout") { lex.EatLine(); @@ -445,8 +448,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, if (!return_par) return_par = par; else { - par->fitToSize(); - par = new LyXParagraph(par); + par = new Paragraph(par); } pos = 0; if (pp.first) { @@ -465,7 +467,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, .NumberOfLayout(params.textclass, layout.obsoleted_by()) .second; - par->params.depth(depth); + par->params().depth(depth); font = LyXFont(LyXFont::ALL_INHERIT, params.language); if (file_format < 216 && params.language->lang() == "hebrew") @@ -552,7 +554,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, LyXLex nylex(0, 0); nylex.setStream(istr); inset->Read(this, nylex); - par->InsertInset(pos, inset, font); + par->insertInset(pos, inset, font); ++pos; } else if (token == "\\begin_deeper") { ++depth; @@ -606,21 +608,21 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, lex.EatLine(); params.fonts = lex.GetString(); } else if (token == "\\noindent") { - par->params.noindent(true); + par->params().noindent(true); } else if (token == "\\fill_top") { - par->params.spaceTop(VSpace(VSpace::VFILL)); + par->params().spaceTop(VSpace(VSpace::VFILL)); } else if (token == "\\fill_bottom") { - par->params.spaceBottom(VSpace(VSpace::VFILL)); + par->params().spaceBottom(VSpace(VSpace::VFILL)); } else if (token == "\\line_top") { - par->params.lineTop(true); + par->params().lineTop(true); } else if (token == "\\line_bottom") { - par->params.lineBottom(true); + par->params().lineBottom(true); } else if (token == "\\pagebreak_top") { - par->params.pagebreakTop(true); + par->params().pagebreakTop(true); } else if (token == "\\pagebreak_bottom") { - par->params.pagebreakBottom(true); + par->params().pagebreakBottom(true); } else if (token == "\\start_of_appendix") { - par->params.startOfAppendix(true); + par->params().startOfAppendix(true); } else if (token == "\\paragraph_separation") { int tmpret = lex.FindToken(string_paragraph_separation); if (tmpret == -1) ++tmpret; @@ -811,7 +813,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, // Small hack so that files written with klyx will be // parsed correctly. if (return_par) { - par->params.spacing(Spacing(tmp_space, tmp_val)); + par->params().spacing(Spacing(tmp_space, tmp_val)); } else { params.spacing.set(tmp_space, tmp_val); } @@ -819,14 +821,14 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, lex.next(); string const tmp = strip(lex.GetString()); if (tmp == "single") { - par->params.spacing(Spacing(Spacing::Single)); + par->params().spacing(Spacing(Spacing::Single)); } else if (tmp == "onehalf") { - par->params.spacing(Spacing(Spacing::Onehalf)); + par->params().spacing(Spacing(Spacing::Onehalf)); } else if (tmp == "double") { - par->params.spacing(Spacing(Spacing::Double)); + par->params().spacing(Spacing(Spacing::Double)); } else if (tmp == "other") { lex.next(); - par->params.spacing(Spacing(Spacing::Other, + par->params().spacing(Spacing(Spacing::Other, lex.GetFloat())); } else { lex.printError("Unknown spacing token: '$$Token'"); @@ -900,37 +902,37 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, if (tmpret != LYX_LAYOUT_DEFAULT) { // tmpret != 99 ??? int const tmpret2 = int(pow(2.0, tmpret)); //lyxerr << "Tmpret2 = " << tmpret2 << endl; - par->params.align(LyXAlignment(tmpret2)); + par->params().align(LyXAlignment(tmpret2)); } } else if (token == "\\added_space_top") { lex.nextToken(); - par->params.spaceTop(VSpace(lex.GetString())); + par->params().spaceTop(VSpace(lex.GetString())); } else if (token == "\\added_space_bottom") { lex.nextToken(); - par->params.spaceBottom(VSpace(lex.GetString())); + par->params().spaceBottom(VSpace(lex.GetString())); #ifndef NO_PEXTRA_REALLY } else if (token == "\\pextra_type") { lex.nextToken(); - par->params.pextraType(lex.GetInteger()); + par->params().pextraType(lex.GetInteger()); } else if (token == "\\pextra_width") { lex.nextToken(); - par->params.pextraWidth(lex.GetString()); + par->params().pextraWidth(lex.GetString()); } else if (token == "\\pextra_widthp") { lex.nextToken(); - par->params.pextraWidthp(lex.GetString()); + par->params().pextraWidthp(lex.GetString()); } else if (token == "\\pextra_alignment") { lex.nextToken(); - par->params.pextraAlignment(lex.GetInteger()); + par->params().pextraAlignment(lex.GetInteger()); } else if (token == "\\pextra_hfill") { lex.nextToken(); - par->params.pextraHfill(lex.GetInteger()); + par->params().pextraHfill(lex.GetInteger()); } else if (token == "\\pextra_start_minipage") { lex.nextToken(); - par->params.pextraStartMinipage(lex.GetInteger()); + par->params().pextraStartMinipage(lex.GetInteger()); #endif } else if (token == "\\labelwidthstring") { lex.EatLine(); - par->params.labelWidthString(lex.GetString()); + par->params().labelWidthString(lex.GetString()); // do not delete this token, it is still needed! } else if (token == "\\end_inset") { lyxerr << "Solitary \\end_inset. Missing \\begin_inset?.\n" @@ -945,7 +947,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, } else if (token == "\\SpecialChar") { LyXLayout const & layout = textclasslist.Style(params.textclass, - par->GetLayout()); + par->getLayout()); // Insets don't make sense in a free-spacing context! ---Kayvan if (layout.free_spacing) { @@ -953,10 +955,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, lex.next(); string next_token = lex.GetString(); if (next_token == "\\-") { - par->InsertChar(pos, '-', font); + par->insertChar(pos, '-', font); } else if (next_token == "\\protected_separator" || next_token == "~") { - par->InsertChar(pos, ' ', font); + par->insertChar(pos, ' ', font); } else { lex.printError("Token `$$Token' " "is in free space " @@ -967,22 +969,22 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, } else { Inset * inset = new InsetSpecialChar; inset->Read(this, lex); - par->InsertInset(pos, inset, font); + par->insertInset(pos, inset, font); } ++pos; } else if (token == "\\newline") { - par->InsertChar(pos, LyXParagraph::META_NEWLINE, font); + par->insertChar(pos, Paragraph::META_NEWLINE, font); ++pos; } else if (token == "\\LyXTable") { Inset * inset = new InsetTabular(*this); inset->Read(this, lex); - par->InsertInset(pos, inset, font); + par->insertInset(pos, inset, font); ++pos; // because of OLD_TABULAR_READ where tabulars have been // one paragraph. checkminipage = true; } else if (token == "\\hfill") { - par->InsertChar(pos, LyXParagraph::META_HFILL, font); + par->insertChar(pos, Paragraph::META_HFILL, font); ++pos; } else if (token == "\\protected_separator") { // obsolete // This is a backward compability thingie. (Lgb) @@ -990,13 +992,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, // 2.16. (Lgb) LyXLayout const & layout = textclasslist.Style(params.textclass, - par->GetLayout()); + par->getLayout()); if (layout.free_spacing) { - par->InsertChar(pos, ' ', font); + par->insertChar(pos, ' ', font); } else { Inset * inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR); - par->InsertInset(pos, inset, font); + par->insertInset(pos, inset, font); } ++pos; } else if (token == "\\bibitem") { // ale970302 @@ -1006,7 +1008,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, } par->bibkey->Read(this, lex); } else if (token == "\\backslash") { - par->InsertChar(pos, '\\', font); + par->insertChar(pos, '\\', font); ++pos; } else if (token == "\\the_end") { the_end_read = true; @@ -1018,7 +1020,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, string::const_iterator cit = token.begin(); string::const_iterator end = token.end(); for (; cit != end; ++cit) { - par->InsertChar(pos, (*cit), font); + par->insertChar(pos, (*cit), font); ++pos; } } @@ -1042,53 +1044,53 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, if (checkminipage && (call_depth == 1)) { checkminipage = false; if (minipar && (minipar != par) && - (par->params.pextraType()==LyXParagraph::PEXTRA_MINIPAGE)) + (par->params().pextraType()==Paragraph::PEXTRA_MINIPAGE)) { lyxerr << "minipages in a row" << endl; - if (par->params.pextraStartMinipage()) { + if (par->params().pextraStartMinipage()) { lyxerr << "start new minipage" << endl; // minipages in a row par->previous()->next(0); par->previous(0); - LyXParagraph * tmp = minipar; + Paragraph * tmp = minipar; while (tmp) { - tmp->params.pextraType(0); - tmp->params.pextraWidth(string()); - tmp->params.pextraWidthp(string()); - tmp->params.pextraAlignment(0); - tmp->params.pextraHfill(false); - tmp->params.pextraStartMinipage(false); + tmp->params().pextraType(0); + tmp->params().pextraWidth(string()); + tmp->params().pextraWidthp(string()); + tmp->params().pextraAlignment(0); + tmp->params().pextraHfill(false); + tmp->params().pextraStartMinipage(false); tmp = tmp->next(); } // create a new paragraph to insert the // minipages in the following case - if (par->params.pextraStartMinipage() && - !par->params.pextraHfill()) + if (par->params().pextraStartMinipage() && + !par->params().pextraHfill()) { - LyXParagraph * p = new LyXParagraph; + Paragraph * p = new Paragraph; p->layout = 0; p->previous(parBeforeMinipage); parBeforeMinipage->next(p); p->next(0); - p->params.depth(parBeforeMinipage->params.depth()); + p->params().depth(parBeforeMinipage->params().depth()); parBeforeMinipage = p; } InsetMinipage * mini = new InsetMinipage; - mini->pos(static_cast(par->params.pextraAlignment())); - mini->width(par->params.pextraWidth()); - if (!par->params.pextraWidthp().empty()) { + mini->pos(static_cast(par->params().pextraAlignment())); + mini->width(par->params().pextraWidth()); + if (!par->params().pextraWidthp().empty()) { lyxerr << "WP:" << mini->width() << endl; - mini->width(tostr(par->params.pextraWidthp())+"%"); + mini->width(tostr(par->params().pextraWidthp())+"%"); } mini->inset.par = par; // Insert the minipage last in the // previous paragraph. - if (par->params.pextraHfill()) { - parBeforeMinipage->InsertChar - (parBeforeMinipage->size(), LyXParagraph::META_HFILL); + if (par->params().pextraHfill()) { + parBeforeMinipage->insertChar + (parBeforeMinipage->size(), Paragraph::META_HFILL); } - parBeforeMinipage->InsertInset + parBeforeMinipage->insertInset (parBeforeMinipage->size(), mini); minipar = par; @@ -1107,20 +1109,20 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, par->previous()->next(0); par->previous(parBeforeMinipage); parBeforeMinipage->next(par); - LyXParagraph * tmp = minipar; + Paragraph * tmp = minipar; while (tmp) { - tmp->params.pextraType(0); - tmp->params.pextraWidth(string()); - tmp->params.pextraWidthp(string()); - tmp->params.pextraAlignment(0); - tmp->params.pextraHfill(false); - tmp->params.pextraStartMinipage(false); + tmp->params().pextraType(0); + tmp->params().pextraWidth(string()); + tmp->params().pextraWidthp(string()); + tmp->params().pextraAlignment(0); + tmp->params().pextraHfill(false); + tmp->params().pextraStartMinipage(false); tmp = tmp->next(); } - depth = parBeforeMinipage->params.depth(); + depth = parBeforeMinipage->params().depth(); minipar = parBeforeMinipage = 0; } else if (!minipar && - (par->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE)) + (par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) { // par is the first paragraph in a minipage lyxerr << "begin minipage" << endl; @@ -1129,12 +1131,12 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, // the first minipage in // a sequence of minipages // in its own paragraph. - LyXParagraph * p = new LyXParagraph; + Paragraph * p = new Paragraph; p->layout = 0; p->previous(par->previous()); p->next(0); - p->params.depth(depth); - par->params.depth(0); + p->params().depth(depth); + par->params().depth(0); depth = 0; if (par->previous()) par->previous()->next(p); @@ -1145,21 +1147,21 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, return_par = p; InsetMinipage * mini = new InsetMinipage; - mini->pos(static_cast(minipar->params.pextraAlignment())); - mini->width(minipar->params.pextraWidth()); - if (!par->params.pextraWidthp().empty()) { + mini->pos(static_cast(minipar->params().pextraAlignment())); + mini->width(minipar->params().pextraWidth()); + if (!par->params().pextraWidthp().empty()) { lyxerr << "WP:" << mini->width() << endl; - mini->width(tostr(par->params.pextraWidthp())+"%"); + mini->width(tostr(par->params().pextraWidthp())+"%"); } mini->inset.par = minipar; // Insert the minipage last in the // previous paragraph. - if (minipar->params.pextraHfill()) { - parBeforeMinipage->InsertChar - (parBeforeMinipage->size(),LyXParagraph::META_HFILL); + if (minipar->params().pextraHfill()) { + parBeforeMinipage->insertChar + (parBeforeMinipage->size(),Paragraph::META_HFILL); } - parBeforeMinipage->InsertInset + parBeforeMinipage->insertInset (parBeforeMinipage->size(), mini); } } @@ -1170,7 +1172,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, } -void Buffer::readInset(LyXLex & lex, LyXParagraph *& par, +void Buffer::readInset(LyXLex & lex, Paragraph *& par, int & pos, LyXFont & font) { // consistency check @@ -1278,13 +1280,13 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par, } if (inset) { - par->InsertInset(pos, inset, font); + par->insertInset(pos, inset, font); ++pos; } } -bool Buffer::readFile(LyXLex & lex, LyXParagraph * par) +bool Buffer::readFile(LyXLex & lex, Paragraph * par) { if (lex.IsOK()) { lex.next(); @@ -1336,7 +1338,6 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par) } - // Should probably be moved to somewhere else: BufferView? LyXView? bool Buffer::save() const { @@ -1370,7 +1371,7 @@ bool Buffer::save() const _exit(0) */ - // Should proabaly have some more error checking here. + // Should probably have some more error checking here. // Should be cleaned up in 0.13, at least a bit. // Doing it this way, also makes the inodes stay the same. // This is still not a very good solution, in particular we @@ -1395,7 +1396,7 @@ bool Buffer::save() const } } else { lyxerr << "LyX was not able to make " - "backupcopy. Beware." << endl; + "backup copy. Beware." << endl; } } } @@ -1472,7 +1473,7 @@ bool Buffer::writeFile(string const & fname, bool flag) const // now write out the buffer paramters. params.writeFile(ofs); - char depth = 0; + Paragraph::depth_type depth = 0; // this will write out all the paragraphs // using recursive descent. @@ -1508,13 +1509,13 @@ bool Buffer::writeFile(string const & fname, bool flag) const } -string const Buffer::asciiParagraph(LyXParagraph const * par, +string const Buffer::asciiParagraph(Paragraph const * par, unsigned int linelen) const { ostringstream buffer; - char depth = 0; + Paragraph::depth_type depth = 0; int ltype = 0; - int ltype_depth = 0; + Paragraph::depth_type ltype_depth = 0; unsigned int currlinelen = 0; bool ref_printed = false; @@ -1522,13 +1523,13 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, int islatex = 0; if (!par->previous()) { // begins or ends a deeper area ? - if (depth != par->params.depth()) { - if (par->params.depth() > depth) { - while (par->params.depth() > depth) { + if (depth != par->params().depth()) { + if (par->params().depth() > depth) { + while (par->params().depth() > depth) { ++depth; } } else { - while (par->params.depth() < depth) { + while (par->params().depth() < depth) { --depth; } } @@ -1578,11 +1579,11 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, } LyXFont const font1 = LyXFont(LyXFont::ALL_INHERIT, params.language); - for (LyXParagraph::size_type i = 0; i < par->size(); ++i) { + for (Paragraph::size_type i = 0; i < par->size(); ++i) { if (!i && !noparbreak) { if (linelen > 0) buffer << "\n\n"; - for (char j = 0; j < depth; ++j) + for (Paragraph::depth_type j = 0; j < depth; ++j) buffer << " "; currlinelen = depth * 2; switch (ltype) { @@ -1606,16 +1607,17 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, } break; default: - buffer << par->params.labelString() << " "; + buffer << par->params().labelString() << " "; break; } if (ltype_depth > depth) { - for (char j = ltype_depth - 1; j > depth; --j) + for (Paragraph::depth_type j = ltype_depth - 1; + j > depth; --j) buffer << " "; currlinelen += (ltype_depth-depth)*2; } } - LyXFont const font2 = par->GetFontSettings(params, i); + LyXFont const font2 = par->getFontSettings(params, i); if (font1.latex() != font2.latex()) { if (font2.latex() == LyXFont::OFF) islatex = 0; @@ -1625,13 +1627,13 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, islatex = 0; } - char c = par->GetUChar(params, i); + char c = par->getUChar(params, i); if (islatex) continue; switch (c) { - case LyXParagraph::META_INSET: + case Paragraph::META_INSET: { - Inset const * inset = par->GetInset(i); + Inset const * inset = par->getInset(i); if (inset) { if (!inset->Ascii(this, buffer)) { string dummy; @@ -1647,22 +1649,23 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, } break; - case LyXParagraph::META_NEWLINE: + case Paragraph::META_NEWLINE: if (linelen > 0) { buffer << "\n"; - for (char j = 0; j < depth; ++j) + for (Paragraph::depth_type j = 0; + j < depth; ++j) buffer << " "; } currlinelen = depth * 2; if (ltype_depth > depth) { - for (char j = ltype_depth; - j > depth; --j) + for (Paragraph::depth_type j = ltype_depth; + j > depth; --j) buffer << " "; currlinelen += (ltype_depth - depth) * 2; } break; - case LyXParagraph::META_HFILL: + case Paragraph::META_HFILL: buffer << "\t"; break; @@ -1675,11 +1678,12 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, (c == ' ') && ((i + 2) < par->size())) { buffer << "\n"; - for (char j = 0; j < depth; ++j) + for (Paragraph::depth_type j = 0; + j < depth; ++j) buffer << " "; currlinelen = depth * 2; if (ltype_depth > depth) { - for (char j = ltype_depth; + for (Paragraph::depth_type j = ltype_depth; j > depth; --j) buffer << " "; currlinelen += (ltype_depth-depth)*2; @@ -1709,7 +1713,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen) void Buffer::writeFileAscii(ostream & ofs, int linelen) { - LyXParagraph * par = paragraph; + Paragraph * par = paragraph; while (par) { ofs << asciiParagraph(par, linelen); par = par->next(); @@ -2226,8 +2230,8 @@ void Buffer::makeLaTeXFile(string const & fname, // // LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end // -void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par, - LyXParagraph * endpar, TexRow & texrow) const +void Buffer::latexParagraphs(ostream & ofs, Paragraph * par, + Paragraph * endpar, TexRow & texrow) const { bool was_title = false; bool already_title = false; @@ -2297,7 +2301,7 @@ bool Buffer::isSGML() const } -void Buffer::sgmlOpenTag(ostream & os, int depth, +void Buffer::sgmlOpenTag(ostream & os, Paragraph::depth_type depth, string const & latexname) const { if (!latexname.empty() && latexname != "!-- --") @@ -2305,7 +2309,7 @@ void Buffer::sgmlOpenTag(ostream & os, int depth, } -void Buffer::sgmlCloseTag(ostream & os, int depth, +void Buffer::sgmlCloseTag(ostream & os, Paragraph::depth_type depth, string const & latexname) const { if (!latexname.empty() && latexname != "!-- --") @@ -2358,8 +2362,8 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) << " created this file. For more info see http://www.lyx.org/" << " -->\n"; - int depth = 0; // paragraph depth - LyXParagraph * par = paragraph; + Paragraph::depth_type depth = 0; // paragraph depth + Paragraph * par = paragraph; string item_name; vector environment_stack(5); @@ -2369,8 +2373,8 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) par->layout); // treat as a special case for compatibility with old code - if (par->GetChar(0) == LyXParagraph::META_INSET) { - Inset * inset = par->GetInset(0); + if (par->getChar(0) == Paragraph::META_INSET) { + Inset * inset = par->getInset(0); Inset::Code lyx_code = inset->LyxCode(); if (lyx_code == Inset::TOC_CODE){ string const temp = "toc"; @@ -2382,7 +2386,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) } // environment tag closing - for (; depth > par->params.depth(); --depth) { + for (; depth > par->params().depth(); --depth) { sgmlCloseTag(ofs, depth, environment_stack[depth]); environment_stack[depth].erase(); } @@ -2390,7 +2394,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) // write opening SGML tags switch (style.latextype) { case LATEX_PARAGRAPH: - if (depth == par->params.depth() + if (depth == par->params().depth() && !environment_stack[depth].empty()) { sgmlCloseTag(ofs, depth, environment_stack[depth]); environment_stack[depth].erase(); @@ -2420,14 +2424,14 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) case LATEX_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT: - if (depth == par->params.depth() + if (depth == par->params().depth() && environment_stack[depth] != style.latexname()) { sgmlCloseTag(ofs, depth, environment_stack[depth]); environment_stack[depth].erase(); } - if (depth < par->params.depth()) { - depth = par->params.depth(); + if (depth < par->params().depth()) { + depth = par->params().depth(); environment_stack[depth].erase(); } if (environment_stack[depth] != style.latexname()) { @@ -2493,10 +2497,10 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only) void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag, - int depth, int desc_on, - LyXParagraph * & par) + Paragraph::depth_type depth, int desc_on, + Paragraph * & par) { - LyXParagraph * tpar = par; + Paragraph * tpar = par; while (tpar && (tpar->layout != textclasslist.NumberOfLayout(params.textclass, "Caption").second)) @@ -2575,10 +2579,11 @@ void reset(PAR_TAG & p1, PAR_TAG const & p2) // Handle internal paragraph parsing -- layout already processed. void Buffer::SimpleLinuxDocOnePar(ostream & os, - LyXParagraph * par, int /*depth*/) + Paragraph * par, + Paragraph::depth_type /*depth*/) { LyXLayout const & style = textclasslist.Style(params.textclass, - par->GetLayout()); + par->getLayout()); string::size_type char_line_count = 5; // Heuristic choice ;-) // gets paragraph main font @@ -2599,7 +2604,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, stack < PAR_TAG > tag_state; // parsing main loop - for (LyXParagraph::size_type i = 0; i < par->size(); ++i) { + for (Paragraph::size_type i = 0; i < par->size(); ++i) { PAR_TAG tag_close = NONE; list < PAR_TAG > tag_open; @@ -2713,10 +2718,10 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, os << "<" << tag_name(*j) << ">"; } - char c = par->GetChar(i); + char c = par->getChar(i); - if (c == LyXParagraph::META_INSET) { - Inset * inset = par->GetInset(i); + if (c == Paragraph::META_INSET) { + Inset * inset = par->getInset(i); inset->Linuxdoc(this, os); font_old = font; continue; @@ -2766,12 +2771,12 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, // Print an error message. -void Buffer::LinuxDocError(LyXParagraph * par, int pos, +void Buffer::LinuxDocError(Paragraph * par, int pos, string const & message) { // insert an error marker in text InsetError * new_inset = new InsetError(message); - par->InsertInset(pos, new_inset); + par->insertInset(pos, new_inset); } @@ -2783,7 +2788,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) return; } - LyXParagraph * par = paragraph; + Paragraph * par = paragraph; niceFile = nice; // this will be used by Insetincludes. @@ -2829,10 +2834,10 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) vector command_stack(10); bool command_flag = false; - int command_depth = 0; - int command_base = 0; - int cmd_depth = 0; - int depth = 0; // paragraph depth + Paragraph::depth_type command_depth = 0; + Paragraph::depth_type command_base = 0; + Paragraph::depth_type cmd_depth = 0; + Paragraph::depth_type depth = 0; // paragraph depth string item_name; string command_name; @@ -2848,7 +2853,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) par->layout); // environment tag closing - for (; depth > par->params.depth(); --depth) { + for (; depth > par->params().depth(); --depth) { if (environment_inner[depth] != "!-- --") { item_name = "listitem"; sgmlCloseTag(ofs, command_depth + depth, @@ -2863,7 +2868,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) environment_inner[depth].erase(); } - if (depth == par->params.depth() + if (depth == par->params().depth() && environment_stack[depth] != style.latexname() && !environment_stack[depth].empty()) { if (environment_inner[depth] != "!-- --") { @@ -2905,11 +2910,11 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) if (command_flag) { if (cmd_depth < command_base) { - for (int j = command_depth; j >= command_base; --j) + for (Paragraph::depth_type j = command_depth; j >= command_base; --j) sgmlCloseTag(ofs, j, command_stack[j]); command_depth = command_base = cmd_depth; } else if (cmd_depth <= command_depth) { - for (int j = command_depth; j >= cmd_depth; --j) + for (int j = command_depth; j >= int(cmd_depth); --j) sgmlCloseTag(ofs, j, command_stack[j]); command_depth = cmd_depth; } else @@ -2919,13 +2924,13 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) command_flag = true; } if (command_stack.size() == command_depth + 1) - command_stack.push_back(""); + command_stack.push_back(string()); command_stack[command_depth] = command_name; // treat label as a special case for // more WYSIWYM handling. - if (par->GetChar(0) == LyXParagraph::META_INSET) { - Inset * inset = par->GetInset(0); + if (par->getChar(0) == Paragraph::META_INSET) { + Inset * inset = par->getInset(0); Inset::Code lyx_code = inset->LyxCode(); if (lyx_code == Inset::LABEL_CODE){ command_name += " id=\""; @@ -2945,8 +2950,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) case LATEX_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT: - if (depth < par->params.depth()) { - depth = par->params.depth(); + if (depth < par->params().depth()) { + depth = par->params().depth(); environment_stack[depth].erase(); } @@ -3048,7 +3053,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) } // Close open tags - for (; depth >= 0; --depth) { + for (int d = depth; d >= 0; --d) { if (!environment_stack[depth].empty()) { if (environment_inner[depth] != "!-- --") { item_name = "listitem"; @@ -3064,7 +3069,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) } } - for (int j = command_depth; j >= command_base; --j) + for (int j = command_depth; j >= 0 ; --j) if (!command_stack[j].empty()) sgmlCloseTag(ofs, j, command_stack[j]); @@ -3077,13 +3082,13 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) void Buffer::SimpleDocBookOnePar(ostream & os, string & extra, - LyXParagraph * par, int & desc_on, - int depth) const + Paragraph * par, int & desc_on, + Paragraph::depth_type depth) const { bool emph_flag = false; LyXLayout const & style = textclasslist.Style(params.textclass, - par->GetLayout()); + par->getLayout()); LyXFont font_old = style.labeltype == LABEL_MANUAL ? style.labelfont : style.font; @@ -3092,7 +3097,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra, os << string(depth,' '); // parsing main loop - for (LyXParagraph::size_type i = 0; + for (Paragraph::size_type i = 0; i < par->size(); ++i) { LyXFont font = par->getFont(params, i); @@ -3107,10 +3112,10 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra, } } - char c = par->GetChar(i); + char c = par->getChar(i); - if (c == LyXParagraph::META_INSET) { - Inset * inset = par->GetInset(i); + if (c == Paragraph::META_INSET) { + Inset * inset = par->getInset(i); std::ostringstream ost; inset->DocBook(this, ost); string tmp_out = ost.str().c_str(); @@ -3227,7 +3232,7 @@ int Buffer::runChktex() void Buffer::validate(LaTeXFeatures & features) const { - LyXParagraph * par = paragraph; + Paragraph * par = paragraph; LyXTextClass const & tclass = textclasslist.TextClass(params.textclass); @@ -3351,7 +3356,7 @@ vector const Buffer::getLabelList() Buffer::Lists const Buffer::getLists() const { Lists l; - LyXParagraph * par = paragraph; + Paragraph * par = paragraph; bool found; LyXTextClassList::size_type cap; boost::tie(found, cap) = textclasslist @@ -3360,7 +3365,7 @@ Buffer::Lists const Buffer::getLists() const while (par) { char const labeltype = textclasslist.Style(params.textclass, - par->GetLayout()).labeltype; + par->getLayout()).labeltype; if (labeltype >= LABEL_COUNTER_CHAPTER && labeltype <= LABEL_COUNTER_CHAPTER + params.tocdepth) { @@ -3369,15 +3374,15 @@ Buffer::Lists const Buffer::getLists() const int depth = max(0, labeltype - textclasslist.TextClass(params.textclass).maxcounter()); - item.push_back(TocItem(par, depth, par->String(this, true))); + item.push_back(TocItem(par, depth, par->asString(this, true))); } // For each paragrph, traverse its insets and look for // FLOAT_CODE if (found) { - LyXParagraph::inset_iterator it = + Paragraph::inset_iterator it = par->inset_iterator_begin(); - LyXParagraph::inset_iterator end = + Paragraph::inset_iterator end = par->inset_iterator_end(); for (; it != end; ++it) { @@ -3390,12 +3395,12 @@ Buffer::Lists const Buffer::getLists() const // Now find the caption in the float... // We now tranverse the paragraphs of // the inset... - LyXParagraph * tmp = il->inset.par; + Paragraph * tmp = il->inset.par; while (tmp) { if (tmp->layout == cap) { SingleList & item = l[type]; string const str = - tostr(item.size()+1) + ". " + tmp->String(this, false); + tostr(item.size()+1) + ". " + tmp->asString(this, false); item.push_back(TocItem(tmp, 0 , str)); } tmp = tmp->next(); @@ -3424,11 +3429,11 @@ vector > const Buffer::getBibkeyList() } vector > keys; - LyXParagraph * par = paragraph; + Paragraph * par = paragraph; while (par) { if (par->bibkey) keys.push_back(pair(par->bibkey->getContents(), - par->String(this, false))); + par->asString(this, false))); par = par->next(); } @@ -3512,30 +3517,29 @@ bool Buffer::Dispatch(int action, string const & argument) } -void Buffer::resize() -{ - /// resize the BufferViews! - if (users) - users->resize(); -} - - void Buffer::resizeInsets(BufferView * bv) { /// then remove all LyXText in text-insets - LyXParagraph * par = paragraph; + Paragraph * par = paragraph; for (; par; par = par->next()) { par->resizeInsetsLyXText(bv); } } +void Buffer::redraw() +{ + users->redraw(); + users->fitCursor(users->text); +} + + void Buffer::ChangeLanguage(Language const * from, Language const * to) { - LyXParagraph * par = paragraph; + Paragraph * par = paragraph; while (par) { - par->ChangeLanguage(params, from, to); + par->changeLanguage(params, from, to); par = par->next(); } } @@ -3543,7 +3547,7 @@ void Buffer::ChangeLanguage(Language const * from, Language const * to) bool Buffer::isMultiLingual() { - LyXParagraph * par = paragraph; + Paragraph * par = paragraph; while (par) { if (par->isMultiLingual(params)) return true; @@ -3553,8 +3557,8 @@ bool Buffer::isMultiLingual() } -Buffer::inset_iterator::inset_iterator(LyXParagraph * paragraph, - LyXParagraph::size_type pos) +Buffer::inset_iterator::inset_iterator(Paragraph * paragraph, + Paragraph::size_type pos) : par(paragraph) { it = par->InsetIterator(pos); diff --git a/src/buffer.h b/src/buffer.h index 021b56c74e..ddc23bea7a 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -10,15 +10,6 @@ * * ====================================================== */ -// Change Log: -// =========== -// 23/03/98 Heinrich Bauer (heinrich.bauer@t-mobil.de) -// Spots marked "changed Heinrich Bauer, 23/03/98" modified due to the -// following bug: dvi file export did not work after printing (or previewing) -// and vice versa as long as the same file was concerned. This happened -// every time the LyX-file was left unchanged between the two actions mentioned -// above. - #ifndef BUFFER_H #define BUFFER_H @@ -27,13 +18,14 @@ #endif #include "LString.h" - -#include "BufferView.h" +#include "undo.h" +#include "undostack.h" #include "lyxvc.h" #include "bufferparams.h" #include "texrow.h" +#include "paragraph.h" - +class BufferView; class LyXRC; class TeXErrors; class LaTeXFeatures; @@ -50,7 +42,7 @@ struct DEPCLEAN { }; /** The buffer object. - The is is the buffer object. It contains all the informations about + This is the buffer object. It contains all the informations about a document loaded into LyX. I am not sure if the class is complete or minimal, probably not. \author Lars Gullik Bjønnes @@ -69,7 +61,7 @@ public: */ explicit Buffer(string const & file, bool b = false); - /// Destrucotr + /// Destructor ~Buffer(); /** Save the buffer's parameters as user default. @@ -88,8 +80,6 @@ public: /// Maybe we know the function already by number... bool Dispatch(int ac, string const & argument); - /// Should be changed to work for a list. - void resize(); /// void resizeInsets(BufferView *); @@ -120,22 +110,23 @@ public: \param par if != 0 insert the file. \return \c false if method fails. */ - bool readFile(LyXLex &, LyXParagraph * par = 0); + bool readFile(LyXLex &, Paragraph * par = 0); /** Reads a file without header. \param par if != 0 insert the file. \return \c false if file is not completely read. */ - bool readLyXformat2(LyXLex &, LyXParagraph * par = 0); + bool readLyXformat2(LyXLex &, Paragraph * par = 0); /// This parses a single LyXformat-Token. - bool parseSingleLyXformat2Token(LyXLex &, LyXParagraph *& par, - LyXParagraph *& return_par, + bool parseSingleLyXformat2Token(LyXLex &, Paragraph *& par, + Paragraph *& return_par, string const & token, int & pos, - char & depth, LyXFont &); + Paragraph::depth_type & depth, + LyXFont &); private: /// Parse a single inset. - void readInset(LyXLex &, LyXParagraph *& par, int & pos, LyXFont &); + void readInset(LyXLex &, Paragraph *& par, int & pos, LyXFont &); public: /** Save file. Takes care of auto-save files and backup file if requested. @@ -151,7 +142,7 @@ public: /// void writeFileAscii(std::ostream &, int); /// - string const asciiParagraph(LyXParagraph const *, + string const asciiParagraph(Paragraph const *, unsigned int linelen) const; /// void makeLaTeXFile(string const & filename, @@ -160,13 +151,13 @@ public: /** LaTeX all paragraphs from par to endpar. \param \a endpar if == 0 then to the end */ - void latexParagraphs(std::ostream & os, LyXParagraph * par, - LyXParagraph * endpar, TexRow & texrow) const; + void latexParagraphs(std::ostream & os, Paragraph * par, + Paragraph * endpar, TexRow & texrow) const; /// void SimpleDocBookOnePar(std::ostream &, string & extra, - LyXParagraph * par, int & desc_on, - int depth) const ; + Paragraph * par, int & desc_on, + Paragraph::depth_type depth) const ; /// int runChktex(); @@ -260,10 +251,10 @@ public: std::vector > const getBibkeyList(); /// struct TocItem { - TocItem(LyXParagraph * p, int d, string const & s) + TocItem(Paragraph * p, int d, string const & s) : par(p), depth(d), str(s) {} /// - LyXParagraph * par; + Paragraph * par; /// int depth; /// @@ -300,7 +291,7 @@ public: This is a linked list of paragraph, this list holds the whole contents of the document. */ - LyXParagraph * paragraph; + Paragraph * paragraph; /// LyX version control object. LyXVC lyxvc; @@ -321,19 +312,20 @@ public: private: /// void DocBookHandleCaption(std::ostream & os, string & inner_tag, - int depth, int desc_on, - LyXParagraph * & par); + Paragraph::depth_type depth, int desc_on, + Paragraph * & par); /// Open SGML/XML tag. - void sgmlOpenTag(std::ostream & os, int depth, + void sgmlOpenTag(std::ostream & os, Paragraph::depth_type depth, string const & latexname) const; /// Closes SGML/XML tag. - void sgmlCloseTag(std::ostream & os, int depth, + void sgmlCloseTag(std::ostream & os, Paragraph::depth_type depth, string const & latexname) const; /// - void LinuxDocError(LyXParagraph * par, int pos, + void LinuxDocError(Paragraph * par, int pos, string const & message); /// - void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par, int depth); + void SimpleLinuxDocOnePar(std::ostream & os, Paragraph * par, + Paragraph::depth_type depth); /// is save needed mutable bool lyx_clean; @@ -378,12 +370,12 @@ public: /// inset_iterator() : par(0) /*, it(0)*/ {} // - inset_iterator(LyXParagraph * paragraph) : par(paragraph) { + inset_iterator(Paragraph * paragraph) : par(paragraph) { SetParagraph(); } /// - inset_iterator(LyXParagraph * paragraph, - LyXParagraph::size_type pos); + inset_iterator(Paragraph * paragraph, + Paragraph::size_type pos); /// inset_iterator & operator++() { // prefix ++ if (par) { @@ -411,9 +403,9 @@ public: Inset * operator*() { return *it; } /// - LyXParagraph * getPar() { return par; } + Paragraph * getPar() { return par; } /// - LyXParagraph::size_type getPos() const { return it.getPos(); } + Paragraph::size_type getPos() const { return it.getPos(); } /// friend bool operator==(inset_iterator const & iter1, @@ -422,9 +414,9 @@ public: /// void SetParagraph(); /// - LyXParagraph * par; + Paragraph * par; /// - LyXParagraph::inset_iterator it; + Paragraph::inset_iterator it; }; /// @@ -452,14 +444,6 @@ void Buffer::delUser(BufferView *) } -inline -void Buffer::redraw() -{ - users->redraw(); - users->fitCursor(users->text); -} - - inline Language const * Buffer::GetLanguage() const { diff --git a/src/bufferlist.C b/src/bufferlist.C index ecfcb4945a..36ba4b357d 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -34,6 +34,7 @@ #include "lyxtext.h" #include "lyx_cb.h" #include "bufferview_funcs.h" +#include "BufferView.h" #include "gettext.h" #include "LyXView.h" #include "vc-backend.h" @@ -161,12 +162,6 @@ void BufferList::closeAll() } -void BufferList::resize() -{ - for_each(bstore.begin(), bstore.end(), mem_fun(&Buffer::resize)); -} - - bool BufferList::close(Buffer * buf) { lyx::Assert(buf); @@ -461,10 +456,10 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed) WriteAlert(_("Error!"), _("Unable to open template"), MakeDisplayPath(tname)); // no template, start with empty buffer - b->paragraph = new LyXParagraph; + b->paragraph = new Paragraph; } } else { // start with empty buffer - b->paragraph = new LyXParagraph; + b->paragraph = new Paragraph; } if (!lyxrc.new_ask_filename && !isNamed) { diff --git a/src/bufferlist.h b/src/bufferlist.h index 9bff70c263..8452221588 100644 --- a/src/bufferlist.h +++ b/src/bufferlist.h @@ -101,9 +101,6 @@ public: /// Close all open buffers. void closeAll(); - /// - void resize(); - /// Read a file into a buffer readonly or not. Buffer * readFile(string const &, bool ro); diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 065e488036..117f28bad5 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -17,7 +17,7 @@ #include "bufferview_funcs.h" #include "LyXView.h" #include "BufferView.h" -#include "lyxparagraph.h" +#include "paragraph.h" #include "lyxfont.h" #include "lyx_gui_misc.h" #include "lyxtext.h" @@ -26,7 +26,7 @@ #include "lyx_cb.h" #include "language.h" #include "gettext.h" - +#include "ParagraphParameters.h" void Emph(BufferView * bv) { @@ -90,9 +90,9 @@ void changeDepth(BufferView * bv, LyXText * text, int decInc) bv->hideCursor(); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); if (decInc >= 0) - text->IncDepth(bv); + text->incDepth(bv); else - text->DecDepth(bv); + text->decDepth(bv); if (text->inset_owner) bv->updateInset((Inset *)text->inset_owner, true); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); @@ -209,15 +209,15 @@ string const CurrentState(BufferView * bv) << font.stateText(&buffer->params); // The paragraph depth - int depth = text->GetDepth(); + int depth = text->getDepth(); if (depth > 0) state << _(", Depth: ") << depth; // The paragraph spacing, but only if different from // buffer spacing. - if (!text->cursor.par()->params.spacing().isDefault()) { + if (!text->cursor.par()->params().spacing().isDefault()) { Spacing::Space cur_space = - text->cursor.par()->params.spacing().getSpace(); + text->cursor.par()->params().spacing().getSpace(); state << _(", Spacing: "); switch (cur_space) { @@ -233,7 +233,7 @@ string const CurrentState(BufferView * bv) break; case Spacing::Other: state << _("Other (") - << text->cursor.par()->params.spacing().getValue() + << text->cursor.par()->params().spacing().getValue() << ")"; break; case Spacing::Default: @@ -262,7 +262,7 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall) bv->hideCursor(); bv->update(text, BufferView::SELECT|BufferView::FITCUR); - text->ToggleFree(bv, font, toggleall); + text->toggleFree(bv, font, toggleall); bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); if (font.language() != ignore_language || @@ -270,11 +270,11 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall) font.number() != LyXFont::IGNORE) { LyXCursor & cursor = text->cursor; - text->ComputeBidiTables(bv->buffer(), cursor.row()); + text->computeBidiTables(bv->buffer(), cursor.row()); if (cursor.boundary() != - text->IsBoundary(bv->buffer(), cursor.par(), cursor.pos(), + text->isBoundary(bv->buffer(), cursor.par(), cursor.pos(), text->real_current_font) ) - text->SetCursor(bv, cursor.par(), cursor.pos(), + text->setCursor(bv, cursor.par(), cursor.pos(), false, !cursor.boundary()); } } diff --git a/src/commandtags.h b/src/commandtags.h index 34059e3c8b..d3fc152ae8 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -141,8 +141,15 @@ enum kb_action { LFUN_MATH_SIZE, // Alejandro 150896 LFUN_MATH_MACRO, // ale970510 LFUN_MATH_MACROARG, // ale970510 // 120 - LFUN_MATH_EXTERN, // Andre' 20010424 - LFUN_MATH_PANEL, + LFUN_MATH_EXTERN, // Andre' 20010424 + LFUN_MATH_PANEL, // Andre' 20010522 + LFUN_MATH_VALIGN, // Andre' 20010522 + LFUN_MATH_HALIGN, // Andre' 20010522 + LFUN_MATH_ROW_INSERT, // Andre' 20010522 + LFUN_MATH_ROW_DELETE, // Andre' 20010522 + LFUN_MATH_COLUMN_INSERT, // Andre' 20010522 + LFUN_MATH_COLUMN_DELETE, // Andre' 20010522 + LFUN_MATH_MUTATE, // Andre' 20010523 LFUN_FIGURE, LFUN_DELETE_WORD_FORWARD, LFUN_DELETE_WORD_BACKWARD, diff --git a/src/converter.C b/src/converter.C index e6c493028f..423274cd1c 100644 --- a/src/converter.C +++ b/src/converter.C @@ -29,6 +29,7 @@ #include "lyx_cb.h" // ShowMessage() #include "support/lyxfunctional.h" #include "gettext.h" +#include "BufferView.h" using std::vector; using std::queue; diff --git a/src/figureForm.C b/src/figureForm.C index ca0b11c3f1..6707866851 100644 --- a/src/figureForm.C +++ b/src/figureForm.C @@ -63,24 +63,24 @@ void FigureApplyCB(FL_OBJECT *, long) current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR); current_view->beforeChange(current_view->text); - current_view->text->SetCursorParUndo(current_view->buffer()); - current_view->text->FreezeUndo(); + current_view->text->setCursorParUndo(current_view->buffer()); + current_view->text->freezeUndo(); - current_view->text->BreakParagraph(current_view); + current_view->text->breakParagraph(current_view); current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); if (current_view->text->cursor.par()->size()) { - current_view->text->CursorLeft(current_view); + current_view->text->cursorLeft(current_view); - current_view->text->BreakParagraph(current_view); + current_view->text->breakParagraph(current_view); current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } // The standard layout should always be numer 0; - current_view->text->SetLayout(current_view, 0); + current_view->text->setLayout(current_view, 0); current_view->text-> - SetParagraph(current_view, 0, 0, + setParagraph(current_view, 0, 0, 0, 0, VSpace (0.3 * buffer->params.spacing.getValue(), LyXLength::CM), @@ -96,7 +96,7 @@ void FigureApplyCB(FL_OBJECT *, long) new_inset->Edit(current_view, 0, 0, 0); current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR); current_view->owner()->message(_("Figure inserted")); - current_view->text->UnFreezeUndo(); + current_view->text->unFreezeUndo(); current_view->setState(); } diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 6b209d6840..bddf95e1c6 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,7 @@ +2001-06-22 John Levon + + * Makefile.am: remove kde frontend + 2001-06-15 Angus Leeming * Dialogs.h: removed unused signal showCharacter. diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 1e807ba45e..926dfaae0f 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -44,7 +44,7 @@ class InsetInfo; class InsetTabular; class InsetCommand; class InsetMinipage; -class LyXParagraph; +class Paragraph; /** Container of all dialogs and signals a LyXView needs or uses to access them The list of dialog signals isn't comprehensive but should be a good guide diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index 808367f678..7a441b7774 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -34,10 +34,9 @@ libfrontends_la_SOURCES=\ Toolbar.C \ Toolbar.h -EXTRA_DIST = kde qt2 gnome +EXTRA_DIST = qt2 gnome dist-hook: @cd $(distdir) ; \ - rm -rf `find kde -name \*CVS\*`; \ rm -rf `find qt2 -name \*CVS\*`; \ rm -rf `find gnome -name \*CVS\*` diff --git a/src/frontends/controllers/ControlBibitem.C b/src/frontends/controllers/ControlBibitem.C index c1023622de..845dbaa2b2 100644 --- a/src/frontends/controllers/ControlBibitem.C +++ b/src/frontends/controllers/ControlBibitem.C @@ -25,6 +25,7 @@ #include "Dialogs.h" #include "LyXView.h" #include "buffer.h" +#include "BufferView.h" using SigC::slot; diff --git a/src/frontends/controllers/ControlBibtex.C b/src/frontends/controllers/ControlBibtex.C index 3a10c45255..9cfa01fcf6 100644 --- a/src/frontends/controllers/ControlBibtex.C +++ b/src/frontends/controllers/ControlBibtex.C @@ -25,6 +25,7 @@ #include "Dialogs.h" #include "LyXView.h" #include "buffer.h" +#include "BufferView.h" using SigC::slot; diff --git a/src/frontends/controllers/ControlCharacter.C b/src/frontends/controllers/ControlCharacter.C index 4f14ca4f03..7725a1a4fa 100644 --- a/src/frontends/controllers/ControlCharacter.C +++ b/src/frontends/controllers/ControlCharacter.C @@ -24,6 +24,7 @@ #include "bufferview_funcs.h" // ToggleAndShow #include "gettext.h" #include "language.h" +#include "BufferView.h" using Liason::setMinibuffer; using SigC::slot; diff --git a/src/frontends/controllers/ControlCommand.C b/src/frontends/controllers/ControlCommand.C index 6689bbf644..e68a300651 100644 --- a/src/frontends/controllers/ControlCommand.C +++ b/src/frontends/controllers/ControlCommand.C @@ -24,6 +24,7 @@ #include "Dialogs.h" #include "LyXView.h" #include "lyxfunc.h" +#include "BufferView.h" ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac) : ControlInset(lv, d), diff --git a/src/frontends/controllers/ControlDialogs.h b/src/frontends/controllers/ControlDialogs.h index c07de11329..d749676ac5 100644 --- a/src/frontends/controllers/ControlDialogs.h +++ b/src/frontends/controllers/ControlDialogs.h @@ -49,7 +49,7 @@ protected: #include "LyXView.h" - +#include "BufferView.h" template ControlDialog::ControlDialog(LyXView & lv, Dialogs & d) diff --git a/src/frontends/controllers/ControlExternal.C b/src/frontends/controllers/ControlExternal.C index 0edb6f83a2..d5df5b7186 100644 --- a/src/frontends/controllers/ControlExternal.C +++ b/src/frontends/controllers/ControlExternal.C @@ -33,6 +33,7 @@ #include "frontends/FileDialog.h" #include "lyx_gui_misc.h" // WriteAlert #include "gettext.h" +#include "BufferView.h" using std::make_pair; using std::vector; diff --git a/src/frontends/controllers/ControlGraphics.C b/src/frontends/controllers/ControlGraphics.C index 167d2ad140..c3a2f4779d 100644 --- a/src/frontends/controllers/ControlGraphics.C +++ b/src/frontends/controllers/ControlGraphics.C @@ -31,6 +31,7 @@ #include "support/FileInfo.h" // for FileInfo #include "helper_funcs.h" // for browseFile #include "support/filetools.h" // for AddName +#include "BufferView.h" using std::pair; using std::make_pair; diff --git a/src/frontends/controllers/ControlInclude.C b/src/frontends/controllers/ControlInclude.C index dd3beaadbf..5c0ccf545f 100644 --- a/src/frontends/controllers/ControlInclude.C +++ b/src/frontends/controllers/ControlInclude.C @@ -19,6 +19,7 @@ #include "ButtonControllerBase.h" #include "ControlInclude.h" #include "buffer.h" +#include "BufferView.h" #include "Dialogs.h" #include "LyXView.h" #include "gettext.h" diff --git a/src/frontends/controllers/ControlLog.C b/src/frontends/controllers/ControlLog.C index c85f91bcbe..2c9c570de6 100644 --- a/src/frontends/controllers/ControlLog.C +++ b/src/frontends/controllers/ControlLog.C @@ -24,6 +24,7 @@ #include "LyXView.h" #include "Dialogs.h" #include "lyxrc.h" +#include "BufferView.h" using SigC::slot; diff --git a/src/frontends/controllers/ControlMinipage.C b/src/frontends/controllers/ControlMinipage.C index dab432c839..122338fd43 100644 --- a/src/frontends/controllers/ControlMinipage.C +++ b/src/frontends/controllers/ControlMinipage.C @@ -23,6 +23,7 @@ #include "Dialogs.h" #include "LyXView.h" #include "buffer.h" +#include "BufferView.h" using std::vector; using SigC::slot; diff --git a/src/frontends/controllers/ControlPreamble.C b/src/frontends/controllers/ControlPreamble.C index 2d4c7b93a6..b0f313c970 100644 --- a/src/frontends/controllers/ControlPreamble.C +++ b/src/frontends/controllers/ControlPreamble.C @@ -21,7 +21,7 @@ #include "lyxrc.h" #include "Liason.h" #include "gettext.h" - +#include "BufferView.h" ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d) : ControlDialog(lv, d), diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index 7ee3ac2938..77bbf8cdbc 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -30,6 +30,7 @@ #include "helper_funcs.h" // browseFile #include "lyx_gui_misc.h" // WriteAlert #include "gettext.h" +#include "BufferView.h" using Liason::printBuffer; using Liason::getPrinterParams; diff --git a/src/frontends/controllers/ControlSearch.C b/src/frontends/controllers/ControlSearch.C index 2928857c85..5b6305d8ef 100644 --- a/src/frontends/controllers/ControlSearch.C +++ b/src/frontends/controllers/ControlSearch.C @@ -27,6 +27,7 @@ #include "lyxfind.h" #include "debug.h" #include "gettext.h" +#include "BufferView.h" using Liason::setMinibuffer; using SigC::slot; diff --git a/src/frontends/controllers/ControlToc.C b/src/frontends/controllers/ControlToc.C index 235d043c9d..c4eae44f55 100644 --- a/src/frontends/controllers/ControlToc.C +++ b/src/frontends/controllers/ControlToc.C @@ -26,6 +26,7 @@ #include "lyxfunc.h" #include "support/lstrings.h" // tostr #include "gettext.h" +#include "BufferView.h" using std::vector; using SigC::slot; diff --git a/src/frontends/controllers/ControlVCLog.C b/src/frontends/controllers/ControlVCLog.C index 087cd5fa77..600ea3c996 100644 --- a/src/frontends/controllers/ControlVCLog.C +++ b/src/frontends/controllers/ControlVCLog.C @@ -24,6 +24,7 @@ #include "ButtonControllerBase.h" #include "ControlVCLog.h" #include "buffer.h" +#include "BufferView.h" #include "LyXView.h" #include "Dialogs.h" #include "lyxrc.h" diff --git a/src/frontends/kde/FormParagraph.C b/src/frontends/kde/FormParagraph.C index 795c014c8d..17c334d43d 100644 --- a/src/frontends/kde/FormParagraph.C +++ b/src/frontends/kde/FormParagraph.C @@ -60,7 +60,7 @@ void FormParagraph::update(bool switched) if (!text) text = lv_->view()->text; - LyXParagraph const * par = text->cursor.par(); + Paragraph const * par = text->cursor.par(); int align = par->GetAlign(); @@ -69,7 +69,7 @@ void FormParagraph::update(bool switched) #if 0 // Just remove this and change physpar to par - LyXParagraph const * physpar = par; + Paragraph const * physpar = par; if (physpar->params.spaceTop().kind() == VSpace::LENGTH) { LyXGlueLength above = physpar->params.spaceTop().length(); diff --git a/src/frontends/kde/paradlg.h b/src/frontends/kde/paradlg.h index ca11f21665..d679ad5991 100644 --- a/src/frontends/kde/paradlg.h +++ b/src/frontends/kde/paradlg.h @@ -16,7 +16,7 @@ #include "paraextradlg.h" #include "vspace.h" -#include "lyxparagraph.h" +#include "paragraph.h" #include "debug.h" #include "dlg/paradlgdata.h" diff --git a/src/frontends/qt2/FormCharacter.C b/src/frontends/qt2/FormCharacter.C index fd50819ef5..67319f2752 100644 --- a/src/frontends/qt2/FormCharacter.C +++ b/src/frontends/qt2/FormCharacter.C @@ -19,6 +19,7 @@ #include "lyxtext.h" #include "language.h" #include "support/lstrings.h" +#include "BufferView.h" using SigC::slot; using Liason::setMinibuffer; diff --git a/src/frontends/qt2/FormParagraph.C b/src/frontends/qt2/FormParagraph.C index 451f499a8a..41d8d1bb64 100644 --- a/src/frontends/qt2/FormParagraph.C +++ b/src/frontends/qt2/FormParagraph.C @@ -18,6 +18,8 @@ #include "QtLyXView.h" #include "lyxtext.h" #include "debug.h" +#include "BufferView.h" +#include "ParagraphParameters.h" using SigC::slot; using Liason::setMinibuffer; @@ -65,14 +67,14 @@ void FormParagraph::update(bool switched) if (!text) text = lv_->view()->text; - LyXParagraph * par = text->cursor.par(); + Paragraph * par = text->cursor.par(); - int align = par->GetAlign(); + int align = par->getAlign(); if (align==LYX_ALIGN_LAYOUT) - align = textclasslist.Style(buf->params.textclass, par->GetLayout()).align; + align = textclasslist.Style(buf->params.textclass, par->getLayout()).align; - ParagraphParameters * params = &(par->params); + ParagraphParameters * params = &(par->params()); if (params->spaceTop().kind() == VSpace::LENGTH) { LyXGlueLength above = params->spaceTop().length(); @@ -90,7 +92,7 @@ void FormParagraph::update(bool switched) } else dialog_->setBelowLength(0.0, 0.0, 0.0, LyXLength::UNIT_NONE, LyXLength::UNIT_NONE, LyXLength::UNIT_NONE); - dialog_->setLabelWidth(text->cursor.par()->GetLabelWidthString().c_str()); + dialog_->setLabelWidth(text->cursor.par()->getLabelWidthString().c_str()); dialog_->setAlign(align); dialog_->setChecks(params->lineTop(), params->lineBottom(), params->pagebreakTop(), params->pagebreakBottom(), params->noindent()); @@ -102,7 +104,7 @@ void FormParagraph::update(bool switched) LyXLength extrawidth; float val = 0.0; LyXLength::UNIT unit = LyXLength::CM; - params = &(par->params); + params = &(par->params()); if (isValidLength(params->pextraWidth(), &extrawidth)) { lyxerr[Debug::GUI] << "Reading extra width \"" << extrawidth.asString() << "\"" << endl; val = extrawidth.value(); @@ -115,7 +117,7 @@ void FormParagraph::update(bool switched) params->pextraAlignment(), params->pextraHfill(), params->pextraStartMinipage(), - static_cast(params->pextraType())); + static_cast(params->pextraType())); } diff --git a/src/frontends/qt2/FormSearch.C b/src/frontends/qt2/FormSearch.C index 1f323549d6..d5646174dd 100644 --- a/src/frontends/qt2/FormSearch.C +++ b/src/frontends/qt2/FormSearch.C @@ -19,6 +19,7 @@ #include "lyxfind.h" //#include "language.h" #include "support/lstrings.h" +#include "BufferView.h" using Liason::setMinibuffer; diff --git a/src/frontends/qt2/paragraphdlgimpl.C b/src/frontends/qt2/paragraphdlgimpl.C index fc07f73763..bb0ef288b7 100644 --- a/src/frontends/qt2/paragraphdlgimpl.C +++ b/src/frontends/qt2/paragraphdlgimpl.C @@ -166,9 +166,9 @@ void ParagraphDlgImpl::setBelowLength(float val, float plus, float minus, void ParagraphDlgImpl::setExtra(float widthval, LyXLength::UNIT units, const string percent, int align, - bool hfill, bool startminipage, LyXParagraph::PEXTRA_TYPE type) + bool hfill, bool startminipage, Paragraph::PEXTRA_TYPE type) { - if (type!=LyXParagraph::PEXTRA_NONE) { + if (type!=Paragraph::PEXTRA_NONE) { lyxerr[Debug::GUI] << "percent : $" << percent << "$ widthval " << widthval << " unit " << long(units) << endl; if (percent != "") { extraWidth->setText(percent.c_str()); @@ -181,32 +181,32 @@ void ParagraphDlgImpl::setExtra(float widthval, LyXLength::UNIT units, const str extraWidth->setText(""); switch (type) { - case LyXParagraph::PEXTRA_NONE: + case Paragraph::PEXTRA_NONE: extraType->setCurrentItem(0); break; - case LyXParagraph::PEXTRA_MINIPAGE: + case Paragraph::PEXTRA_MINIPAGE: extraType->setCurrentItem(1); enable_extraOptions(1); enable_minipageOptions(1); break; - case LyXParagraph::PEXTRA_FLOATFLT: + case Paragraph::PEXTRA_FLOATFLT: extraType->setCurrentItem(2); enable_extraOptions(2); break; - case LyXParagraph::PEXTRA_INDENT: + case Paragraph::PEXTRA_INDENT: extraType->setCurrentItem(3); enable_extraOptions(3); break; } switch (align) { - case LyXParagraph::MINIPAGE_ALIGN_TOP: + case Paragraph::MINIPAGE_ALIGN_TOP: minipageValign->setCurrentItem(0); break; - case LyXParagraph::MINIPAGE_ALIGN_MIDDLE: + case Paragraph::MINIPAGE_ALIGN_MIDDLE: minipageValign->setCurrentItem(1); break; - case LyXParagraph::MINIPAGE_ALIGN_BOTTOM: + case Paragraph::MINIPAGE_ALIGN_BOTTOM: minipageValign->setCurrentItem(2); break; } @@ -331,23 +331,23 @@ VSpace::vspace_kind ParagraphDlgImpl::getSpaceBelowKind() const { } -LyXParagraph::PEXTRA_TYPE ParagraphDlgImpl::getExtraType() const { +Paragraph::PEXTRA_TYPE ParagraphDlgImpl::getExtraType() const { switch (extraType->currentItem()) { - case 0: return LyXParagraph::PEXTRA_NONE; - case 1: return LyXParagraph::PEXTRA_MINIPAGE; - case 2: return LyXParagraph::PEXTRA_FLOATFLT; - case 3: return LyXParagraph::PEXTRA_INDENT; + case 0: return Paragraph::PEXTRA_NONE; + case 1: return Paragraph::PEXTRA_MINIPAGE; + case 2: return Paragraph::PEXTRA_FLOATFLT; + case 3: return Paragraph::PEXTRA_INDENT; } - return LyXParagraph::PEXTRA_NONE; + return Paragraph::PEXTRA_NONE; } -LyXParagraph::MINIPAGE_ALIGNMENT ParagraphDlgImpl::getExtraAlign() const { +Paragraph::MINIPAGE_ALIGNMENT ParagraphDlgImpl::getExtraAlign() const { switch (minipageValign->currentItem()) { - case 0: return LyXParagraph::MINIPAGE_ALIGN_TOP; - case 1: return LyXParagraph::MINIPAGE_ALIGN_MIDDLE; - case 2: return LyXParagraph::MINIPAGE_ALIGN_BOTTOM; - default: return LyXParagraph::MINIPAGE_ALIGN_BOTTOM; + case 0: return Paragraph::MINIPAGE_ALIGN_TOP; + case 1: return Paragraph::MINIPAGE_ALIGN_MIDDLE; + case 2: return Paragraph::MINIPAGE_ALIGN_BOTTOM; + default: return Paragraph::MINIPAGE_ALIGN_BOTTOM; } } diff --git a/src/frontends/qt2/paragraphdlgimpl.h b/src/frontends/qt2/paragraphdlgimpl.h index 6066d9a403..e5e3871deb 100644 --- a/src/frontends/qt2/paragraphdlgimpl.h +++ b/src/frontends/qt2/paragraphdlgimpl.h @@ -14,7 +14,7 @@ #include "paragraphdlg.h" #include "vspace.h" -#include "lyxparagraph.h" +#include "paragraph.h" class FormParagraph; @@ -35,7 +35,7 @@ public: void setSpace(VSpace::vspace_kind, VSpace::vspace_kind, bool, bool); void setAboveLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT); void setBelowLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT); - void setExtra(float, LyXGlueLength::UNIT, const string, int, bool, bool, LyXParagraph::PEXTRA_TYPE); + void setExtra(float, LyXGlueLength::UNIT, const string, int, bool, bool, Paragraph::PEXTRA_TYPE); LyXGlueLength getAboveLength() const; LyXGlueLength getBelowLength() const; LyXLength getExtraWidth() const; @@ -52,8 +52,8 @@ public: bool getNoIndent() const; VSpace::vspace_kind getSpaceAboveKind() const; VSpace::vspace_kind getSpaceBelowKind() const; - LyXParagraph::PEXTRA_TYPE getExtraType() const; - LyXParagraph::MINIPAGE_ALIGNMENT getExtraAlign() const; + Paragraph::PEXTRA_TYPE getExtraType() const; + Paragraph::MINIPAGE_ALIGNMENT getExtraAlign() const; bool getHfillBetween() const; bool getStartNewMinipage() const; diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index 9173cd4c22..1a58f9b31f 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -25,6 +25,8 @@ #include "buffer.h" #include "lyxtext.h" #include "xforms_helpers.h" +#include "BufferView.h" +#include "ParagraphParameters.h" using Liason::setMinibuffer; using SigC::slot; @@ -55,7 +57,7 @@ void FormParagraph::disconnect() } -LyXParagraph const * FormParagraph::getCurrentParagraph() const +Paragraph const * FormParagraph::getCurrentParagraph() const { LyXText * text = 0; @@ -70,7 +72,7 @@ LyXParagraph const * FormParagraph::getCurrentParagraph() const void FormParagraph::changedParagraph() { /// Record the paragraph - LyXParagraph const * const p = getCurrentParagraph(); + Paragraph const * const p = getCurrentParagraph(); if (p == 0 || p == par_) return; @@ -268,7 +270,7 @@ void FormParagraph::general_apply() text = lv_->view()->theLockingInset()->getLyXText(lv_->view()); if (!text) text = lv_->view()->text; - text->SetParagraph(lv_->view(), line_top, line_bottom, pagebreak_top, + text->setParagraph(lv_->view(), line_top, line_bottom, pagebreak_top, pagebreak_bottom, space_top, space_bottom, align, labelwidthstring, noindent); } @@ -285,16 +287,16 @@ void FormParagraph::general_update() par_ = getCurrentParagraph(); fl_set_input(general_->input_labelwidth, - par_->GetLabelWidthString().c_str()); + par_->getLabelWidthString().c_str()); fl_set_button(general_->radio_align_right, 0); fl_set_button(general_->radio_align_left, 0); fl_set_button(general_->radio_align_center, 0); fl_set_button(general_->radio_align_block, 0); - int align = par_->GetAlign(); + int align = par_->getAlign(); if (align == LYX_ALIGN_LAYOUT) align = textclasslist.Style(buf->params.textclass, - par_->GetLayout()).align; + par_->getLayout()).align; switch (align) { case LYX_ALIGN_RIGHT: @@ -313,7 +315,7 @@ void FormParagraph::general_update() LyXAlignment alignpos = textclasslist.Style(buf->params.textclass, - par_->GetLayout()).alignpossible; + par_->getLayout()).alignpossible; setEnabled(general_->radio_align_block, bool(alignpos & LYX_ALIGN_BLOCK)); setEnabled(general_->radio_align_center, bool(alignpos & LYX_ALIGN_CENTER)); @@ -321,19 +323,19 @@ void FormParagraph::general_update() setEnabled(general_->radio_align_right, bool(alignpos & LYX_ALIGN_RIGHT)); fl_set_button(general_->check_lines_top, - par_->params.lineTop()); + par_->params().lineTop()); fl_set_button(general_->check_lines_bottom, - par_->params.lineBottom()); + par_->params().lineBottom()); fl_set_button(general_->check_pagebreaks_top, - par_->params.pagebreakTop()); + par_->params().pagebreakTop()); fl_set_button(general_->check_pagebreaks_bottom, - par_->params.pagebreakBottom()); + par_->params().pagebreakBottom()); fl_set_button(general_->check_noindent, - par_->params.noindent()); + par_->params().noindent()); fl_set_input (general_->input_space_above, ""); - switch (par_->params.spaceTop().kind()) { + switch (par_->params().spaceTop().kind()) { case VSpace::NONE: fl_set_choice (general_->choice_space_above, 1); break; @@ -355,15 +357,15 @@ void FormParagraph::general_update() case VSpace::LENGTH: fl_set_choice (general_->choice_space_above, 7); fl_set_input(general_->input_space_above, par_-> - params.spaceTop().length().asString().c_str()); + params().spaceTop().length().asString().c_str()); break; } fl_set_button (general_->check_space_above, - par_->params.spaceTop().keep()); + par_->params().spaceTop().keep()); fl_set_input (general_->input_space_below, ""); - switch (par_->params.spaceBottom().kind()) { + switch (par_->params().spaceBottom().kind()) { case VSpace::NONE: fl_set_choice (general_->choice_space_below, 1); break; @@ -385,13 +387,13 @@ void FormParagraph::general_update() case VSpace::LENGTH: fl_set_choice (general_->choice_space_below, 7); fl_set_input(general_->input_space_below, par_-> - params.spaceBottom().length().asString().c_str()); + params().spaceBottom().length().asString().c_str()); break; } fl_set_button(general_->check_space_below, - par_->params.spaceBottom().keep()); + par_->params().spaceBottom().keep()); fl_set_button(general_->check_noindent, - par_->params.noindent()); + par_->params().noindent()); } diff --git a/src/frontends/xforms/FormParagraph.h b/src/frontends/xforms/FormParagraph.h index fffb70b1d4..3fd36d7d30 100644 --- a/src/frontends/xforms/FormParagraph.h +++ b/src/frontends/xforms/FormParagraph.h @@ -21,7 +21,7 @@ #include "FormBaseDeprecated.h" -class LyXParagraph; +class Paragraph; struct FD_form_tabbed_paragraph; struct FD_form_paragraph_general; struct FD_form_paragraph_extra; @@ -54,7 +54,7 @@ private: /// void changedParagraph(); /// - LyXParagraph const * getCurrentParagraph() const; + Paragraph const * getCurrentParagraph() const; /// virtual FL_FORM * form() const; @@ -78,8 +78,8 @@ private: /// Changed Paragraph connection. SigC::Connection cp_; - /// The current LyXParagraph - LyXParagraph const * par_; + /// The current Paragraph + Paragraph const * par_; }; diff --git a/src/frontends/xforms/xformsBC.h b/src/frontends/xforms/xformsBC.h index 21c5ac831c..d435b23552 100644 --- a/src/frontends/xforms/xformsBC.h +++ b/src/frontends/xforms/xformsBC.h @@ -25,8 +25,7 @@ #include "ButtonController.h" -class xformsBC : public GuiBC -{ +class xformsBC : public GuiBC { public: /// xformsBC(string const &, string const &); diff --git a/src/importer.C b/src/importer.C index 58f1c87b28..8b71939547 100644 --- a/src/importer.C +++ b/src/importer.C @@ -25,6 +25,7 @@ #include "support/filetools.h" #include "lyx_gui_misc.h" //WriteAlert #include "gettext.h" +#include "BufferView.h" using std::vector; using std::find; diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 447dfa82cb..cdf5931066 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,20 @@ +2001-06-24 The LyX Project + + * insettabular.C (getMaxWidth): We cache a mapping from + inset to cell in order to speed this method up. + +2001-06-24 The LyX Project + + * insettext.C: Optimized InsetText::draw or something. + +2001-06-23 The LyX Project + + * insettext.C (LocalDispatch): fixed inserting of 'normal chars' + +2001-06-23 Lars Gullik Bjønnes + + * inset.h: name change from lyxinset.h + 2001-06-22 Dekel Tsur * insetfloat.C (Validate): Add a call to InsetCollapsable::Validate diff --git a/src/insets/Makefile.am b/src/insets/Makefile.am index cb6998712d..920b63c766 100644 --- a/src/insets/Makefile.am +++ b/src/insets/Makefile.am @@ -13,6 +13,7 @@ libinsets_la_SOURCES = \ figinset.C \ figinset.h \ inset.C \ + inset.h \ insetbib.C \ insetbib.h \ insetbutton.C \ @@ -78,5 +79,4 @@ libinsets_la_SOURCES = \ insettoc.C \ insettoc.h \ inseturl.C \ - inseturl.h \ - lyxinset.h + inseturl.h diff --git a/src/insets/figinset.C b/src/insets/figinset.C index b14e9d8bd6..5b9614c559 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -64,6 +64,7 @@ #include "ColorHandler.h" #include "converter.h" #include "frontends/Dialogs.h" // redrawGUI +#include "BufferView.h" using std::ostream; using std::istream; diff --git a/src/insets/figinset.h b/src/insets/figinset.h index 02cb893e2d..cd1c005264 100644 --- a/src/insets/figinset.h +++ b/src/insets/figinset.h @@ -11,7 +11,7 @@ #include "LString.h" #include "buffer.h" #include "LaTeXFeatures.h" -#include "insets/lyxinset.h" +#include "insets/inset.h" #include /* the rest is figure stuff */ diff --git a/src/insets/inset.C b/src/insets/inset.C index c3664b454a..e86a169fed 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -11,10 +11,10 @@ #include #ifdef __GNUG__ -#pragma implementation "lyxinset.h" +#pragma implementation #endif -#include "lyxinset.h" +#include "inset.h" #include "debug.h" #include "BufferView.h" #include "support/lstrings.h" @@ -22,6 +22,7 @@ #include "commandtags.h" #include "support/lstrings.h" #include "gettext.h" +#include "lyxfont.h" using std::endl; diff --git a/src/insets/lyxinset.h b/src/insets/inset.h similarity index 99% rename from src/insets/lyxinset.h rename to src/insets/inset.h index dccc5e3ae9..a332baecf7 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/inset.h @@ -8,25 +8,24 @@ * * ====================================================== */ -#ifndef LYXINSET_H -#define LYXINSET_H +#ifndef INSET_H +#define INSET_H #ifdef __GNUG__ #pragma interface #endif #include - +#include "LString.h" #include - -#include "lyxfont.h" -#include "lyxlex.h" #include "commandtags.h" +class LyXFont; class BufferView; class Buffer; class Painter; class LyXText; +class LyXLex; struct LaTeXFeatures; diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index cca2c271fc..4823ecf04c 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -255,7 +255,7 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font) { int w = 0; // Does look like a hack? It is! (but will change at 0.13) - LyXParagraph * par = bv->buffer()->paragraph; + Paragraph * par = bv->buffer()->paragraph; while (par) { if (par->bibkey) { @@ -273,7 +273,7 @@ string const bibitemWidest(Buffer const * buffer) { int w = 0; // Does look like a hack? It is! (but will change at 0.13) - LyXParagraph * par = buffer->paragraph; + Paragraph * par = buffer->paragraph; InsetBibKey * bkey = 0; LyXFont font; diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C index 70d30aa92b..7787c63483 100644 --- a/src/insets/insetbutton.C +++ b/src/insets/insetbutton.C @@ -19,6 +19,7 @@ #include "BufferView.h" #include "Painter.h" #include "support/LAssert.h" +#include "lyxfont.h" using std::ostream; using std::endl; diff --git a/src/insets/insetbutton.h b/src/insets/insetbutton.h index 93c6c8a443..23f4e73f6a 100644 --- a/src/insets/insetbutton.h +++ b/src/insets/insetbutton.h @@ -16,7 +16,7 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" #include "LString.h" /** Used to provide an inset that looks like a button. diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 9b0e65425d..a645a0cdbc 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -17,7 +17,7 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" #include "insettext.h" #include "lyxfont.h" #include "LColor.h" diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index b795f3140d..ce5a2b4ea8 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -17,6 +17,7 @@ #include "insetcommand.h" #include "debug.h" #include "Painter.h" +#include "lyxlex.h" using std::ostream; using std::endl; diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h index 071339c487..07212d0c2e 100644 --- a/src/insets/inseterror.h +++ b/src/insets/inseterror.h @@ -16,7 +16,7 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" #include "LString.h" #include diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 4318042606..4e8a48c951 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -17,7 +17,7 @@ #pragma interface #endif -#include "insets/lyxinset.h" +#include "insets/inset.h" #include "insets/insetgraphicsParams.h" #include "graphics/GraphicsCacheItem.h" #include diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index bdfcd6a28d..9c1652f81a 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -12,6 +12,7 @@ #include "insetinclude.h" #include "buffer.h" #include "bufferlist.h" +#include "BufferView.h" #include "debug.h" #include "support/filetools.h" #include "lyxrc.h" diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C index 378d932afb..1aedaa180c 100644 --- a/src/insets/insetinfo.C +++ b/src/insets/insetinfo.C @@ -17,7 +17,7 @@ #endif #include "insetinfo.h" -#include "lyxparagraph.h" +#include "paragraph.h" #include "debug.h" #include "gettext.h" #include "lyx_gui_misc.h" // CancelCloseBoxCB @@ -25,6 +25,7 @@ #include "support/lstrings.h" #include "Painter.h" #include "font.h" +#include "BufferView.h" using std::ostream; using std::endl; diff --git a/src/insets/insetinfo.h b/src/insets/insetinfo.h index 334f460c62..2049847fc1 100644 --- a/src/insets/insetinfo.h +++ b/src/insets/insetinfo.h @@ -16,9 +16,10 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" #include FORMS_H_LOCATION #include "LString.h" +#include "lyxfont.h" /** Info. Handles the note insets. diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index b13e406c20..5be50470db 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -21,6 +21,7 @@ #include "lyxtext.h" #include "buffer.h" #include "gettext.h" +#include "BufferView.h" using std::ostream; using std::vector; @@ -56,7 +57,7 @@ void InsetLabel::Edit(BufferView * bv, int, int, unsigned int) bool flag = bv->ChangeRefsIfUnique(getContents(), new_contents); setContents(new_contents); - bv->text->RedoParagraph(bv); + bv->text->redoParagraph(bv); if (flag) { bv->redraw(); bv->fitCursor(getLyXText(bv)); diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index 9d7cbe4362..acf1b81dd1 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -15,7 +15,7 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" #include "LString.h" #include "lyxlex.h" diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 0f559dda97..0b50057837 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -25,6 +25,7 @@ #include "Painter.h" #include "font.h" #include "language.h" +#include "BufferView.h" using std::ostream; using std::endl; @@ -85,8 +86,8 @@ InsetQuotes::InsetQuotes(char c, BufferParams const & params) // Decide whether left or right switch (c) { case ' ': case '(': case '{': case '[': case '-': case ':': - case LyXParagraph::META_HFILL: - case LyXParagraph::META_NEWLINE: + case Paragraph::META_HFILL: + case Paragraph::META_NEWLINE: side = InsetQuotes::LeftQ; // left quote break; default: diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index 8e2ca060c6..fcb037452e 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -16,7 +16,7 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" class BufferParams; diff --git a/src/insets/insetref.C b/src/insets/insetref.C index cdc3caf9bd..d0331fb6cf 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -13,6 +13,7 @@ #include "LyXView.h" #include "frontends/Dialogs.h" #include "lyxfunc.h" +#include "BufferView.h" using std::ostream; diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index 33315256d9..74487bb735 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -15,7 +15,7 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" #include "LString.h" struct LaTeXFeatures; diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index e6711f0d36..437971d5ab 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -14,6 +14,7 @@ #include #include +#include #ifdef __GNUG__ #pragma implementation @@ -36,6 +37,7 @@ #include "WorkArea.h" #include "gettext.h" #include "language.h" +#include "BufferView.h" using std::ostream; using std::ifstream; @@ -499,7 +501,7 @@ void InsetTabular::Edit(BufferView * bv, int x, int y, unsigned int button) inset_y = 0; setPos(bv, x, y); sel_cell_start = sel_cell_end = actcell; - bv->text->FinishUndo(); + bv->text->finishUndo(); if (InsetHit(bv, x, y) && (button != 3)) { ActivateCellInsetAbs(bv, x, y, button); } @@ -957,7 +959,7 @@ InsetTabular::LocalDispatch(BufferView * bv, case LFUN_CUT: if (!copySelection(bv)) break; - bv->text->SetUndo(bv->buffer(), Undo::DELETE, + bv->text->setUndo(bv->buffer(), Undo::DELETE, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); cutSelection(); @@ -966,12 +968,12 @@ InsetTabular::LocalDispatch(BufferView * bv, case LFUN_COPY: if (!hasSelection()) break; - bv->text->FinishUndo(); + bv->text->finishUndo(); copySelection(bv); break; case LFUN_PASTESELECTION: { - string clip(bv->getClipboard()); + string const clip(bv->getClipboard()); if (clip.empty()) break; @@ -1037,7 +1039,7 @@ InsetTabular::LocalDispatch(BufferView * bv, } case LFUN_PASTE: if (hasPasteBuffer()) { - bv->text->SetUndo(bv->buffer(), Undo::INSERT, + bv->text->setUndo(bv->buffer(), Undo::INSERT, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); pasteSelection(bv); @@ -1299,7 +1301,7 @@ void InsetTabular::resetPos(BufferView * bv) const } else if (the_locking_inset && (tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20)) { - int xx = cursor.x() - offset + bv->text->GetRealCursorX(bv); + int xx = cursor.x() - offset + bv->text->getRealCursorX(bv); if (xx > (bv->workWidth()-20)) { scroll(bv, -(xx - bv->workWidth() + 60)); UpdateLocal(bv, FULL, false); @@ -1481,12 +1483,12 @@ void InsetTabular::SetFont(BufferView * bv, LyXFont const & font, bool tall, } if (hasSelection()) { bool frozen; - bv->text->SetUndo(bv->buffer(), Undo::EDIT, + bv->text->setUndo(bv->buffer(), Undo::EDIT, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); frozen = bv->text->undo_frozen; if (!frozen) - bv->text->FreezeUndo(); + bv->text->freezeUndo(); // apply the fontchange on the whole selection int sel_row_start; int sel_row_end; @@ -1499,7 +1501,7 @@ void InsetTabular::SetFont(BufferView * bv, LyXFont const & font, bool tall, } } if (!frozen) - bv->text->UnFreezeUndo(); + bv->text->unFreezeUndo(); UpdateLocal(bv, INIT, true); } if (the_locking_inset) @@ -1582,7 +1584,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, sel_col_start = sel_col_end = tabular->column_of_cell(actcell); sel_row_start = sel_row_end = tabular->row_of_cell(actcell); } - bv->text->SetUndo(bv->buffer(), Undo::FINISH, + bv->text->setUndo(bv->buffer(), Undo::FINISH, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); @@ -1902,12 +1904,28 @@ int InsetTabular::GetMaxWidthOfCell(BufferView * bv, int cell) const int InsetTabular::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const { - int const n = tabular->GetNumberOfCells(); - int cell = 0; - for (; cell < n; ++cell) { - if (tabular->GetCellInset(cell) == inset) - break; + typedef std::map Cache; + static Cache cache; + + int cell = -1; + Cache::const_iterator ci = cache.find(inset); + if (ci != cache.end()) { + cell = (*ci).second; + if (tabular->GetCellInset(cell) != inset) { + cell = -1; + } } + + int const n = tabular->GetNumberOfCells(); + if (cell == -1) { + cell = 0; + for (; cell < n; ++cell) { + if (tabular->GetCellInset(cell) == inset) + break; + } + cache[inset] = cell; + } + if (cell >= n) return -1; int w = GetMaxWidthOfCell(bv, cell); @@ -1917,11 +1935,13 @@ int InsetTabular::getMaxWidth(BufferView * bv, return w; } + void InsetTabular::deleteLyXText(BufferView * bv, bool recursive) const { resizeLyXText(bv, recursive); } + void InsetTabular::resizeLyXText(BufferView * bv, bool force) const { if (force) { @@ -2329,6 +2349,7 @@ bool InsetTabular::isRightToLeft(BufferView *bv ) return bv->getParentLanguage(this)->RightToLeft(); } + bool InsetTabular::nodraw() const { if (!UpdatableInset::nodraw() && the_locking_inset) @@ -2336,6 +2357,7 @@ bool InsetTabular::nodraw() const return UpdatableInset::nodraw(); } + int InsetTabular::scroll(bool recursive) const { int sx = UpdatableInset::scroll(false); @@ -2346,11 +2368,13 @@ int InsetTabular::scroll(bool recursive) const return sx; } + bool InsetTabular::doClearArea() const { return !locked || (need_update & (FULL|INIT)); } + void InsetTabular::getSelection(int & srow, int & erow, int & scol, int & ecol) const { srow = tabular->row_of_cell(sel_cell_start); diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 1b2ed5ab4f..2de5b4b949 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -52,7 +52,7 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" #include "tabular.h" #include "LString.h" #include "lyxcursor.h" diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 4ce503b794..8b8b4e9c43 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -20,7 +20,7 @@ #endif #include "insettext.h" -#include "lyxparagraph.h" +#include "paragraph.h" #include "lyxlex.h" #include "debug.h" #include "lyxfont.h" @@ -47,6 +47,7 @@ #include "WorkArea.h" #include "gettext.h" #include "lyxfunc.h" +#include "ParagraphParameters.h" using std::ostream; using std::ifstream; @@ -60,7 +61,7 @@ extern int greek_kb_flag; InsetText::InsetText() { - par = new LyXParagraph; + par = new Paragraph; init(); } @@ -104,7 +105,7 @@ void InsetText::init(InsetText const * ins) autoBreakRows = ins->autoBreakRows; drawFrame_ = ins->drawFrame_; } - par->SetInsetOwner(this); + par->setInsetOwner(this); frame_color = LColor::insetframe; locked = false; old_par = 0; @@ -123,7 +124,7 @@ InsetText::~InsetText() } while (par) { - LyXParagraph * tmp = par->next(); + Paragraph * tmp = par->next(); delete par; par = tmp; } @@ -140,11 +141,11 @@ void InsetText::clear() } while (par) { - LyXParagraph * tmp = par->next(); + Paragraph * tmp = par->next(); delete par; par = tmp; } - par = new LyXParagraph; + par = new Paragraph; } @@ -172,8 +173,8 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex) { string token; int pos = 0; - LyXParagraph * return_par = 0; - char depth = 0; // signed or unsigned? + Paragraph * return_par = 0; + Paragraph::depth_type depth = 0; LyXFont font(LyXFont::ALL_INHERIT); clear(); @@ -197,7 +198,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex) return_par = par; par = return_par; while(return_par) { - return_par->SetInsetOwner(this); + return_par->setInsetOwner(this); return_par = return_par->next(); } @@ -212,7 +213,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex) int InsetText::ascent(BufferView * bv, LyXFont const &) const { int y_temp = 0; - Row * row = TEXT(bv)->GetRowNearY(y_temp); + Row * row = TEXT(bv)->getRowNearY(y_temp); insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET; return insetAscent; } @@ -221,7 +222,7 @@ int InsetText::ascent(BufferView * bv, LyXFont const &) const int InsetText::descent(BufferView * bv, LyXFont const &) const { int y_temp = 0; - Row * row = TEXT(bv)->GetRowNearY(y_temp); + Row * row = TEXT(bv)->getRowNearY(y_temp); insetDescent = TEXT(bv)->height - row->ascent_of_text() + TEXT_TO_INSET_OFFSET; return insetDescent; @@ -326,14 +327,14 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, } if (!cleared && (need_update == CURSOR) && !TEXT(bv)->selection.set()) { drawFrame(pain, cleared); - x += width(bv, f); + x += last_width; // was width(bv, f); need_update = NONE; return; } x += TEXT_TO_INSET_OFFSET; int y = 0; - Row * row = TEXT(bv)->GetRowNearY(y); + Row * row = TEXT(bv)->getRowNearY(y); int y_offset = baseline - row->ascent_of_text(); int ph = pain.paperHeight(); int first = 0; @@ -350,7 +351,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, int yf = y_offset; y = 0; while ((row != 0) && (yf < ph)) { - TEXT(bv)->GetVisibleRow(bv, y+y_offset, int(x), row, + TEXT(bv)->getVisibleRow(bv, y+y_offset, int(x), row, y+first, cleared); y += row->height(); yf += row->height(); @@ -359,7 +360,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, } else if (!locked) { if (need_update & CURSOR) { bv->screen()->ToggleSelection(TEXT(bv), bv, true, y_offset,int(x)); - TEXT(bv)->ClearSelection(bv); + TEXT(bv)->clearSelection(bv); TEXT(bv)->selection.cursor = TEXT(bv)->cursor; } bv->screen()->Update(TEXT(bv), bv, y_offset, int(x)); @@ -369,7 +370,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, bv->screen()->ToggleToggle(TEXT(bv), bv, y_offset, int(x)); else if (need_update & CURSOR) { bv->screen()->ToggleSelection(TEXT(bv), bv, true, y_offset,int(x)); - TEXT(bv)->ClearSelection(bv); + TEXT(bv)->clearSelection(bv); TEXT(bv)->selection.cursor = TEXT(bv)->cursor; } bv->screen()->Update(TEXT(bv), bv, y_offset, int(x)); @@ -383,7 +384,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, drawFrame(pain, cleared); else if (need_update & CLEAR_FRAME) clearFrame(pain, cleared); - x += width(bv, f) - TEXT_TO_INSET_OFFSET; + x += last_width /* was width(bv, f) */ - TEXT_TO_INSET_OFFSET; if (bv->text->status==LyXText::CHANGED_IN_DRAW) { need_update |= INIT; } else if (need_update != INIT) @@ -452,7 +453,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit) if ((need_update&CURSOR_PAR) && (TEXT(bv)->status==LyXText::UNCHANGED) && the_locking_inset) { - TEXT(bv)->UpdateInset(bv, the_locking_inset); + TEXT(bv)->updateInset(bv, the_locking_inset); } if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH) @@ -477,20 +478,20 @@ void InsetText::SetUpdateStatus(BufferView * bv, int what) const // this to not draw a selection when we redraw all of it! if ((need_update & (INIT|FULL)) && (need_update & CURSOR)) - TEXT(bv)->ClearSelection(bv); + TEXT(bv)->clearSelection(bv); } void InsetText::UpdateLocal(BufferView * bv, int what, bool mark_dirty) { - TEXT(bv)->FullRebreak(bv); + TEXT(bv)->fullRebreak(bv); SetUpdateStatus(bv, what); if ((need_update != CURSOR) || (TEXT(bv)->status != LyXText::UNCHANGED) || TEXT(bv)->selection.set()) bv->updateInset(this, mark_dirty); bv->owner()->showState(); if (old_par != cpar(bv)) { - bv->owner()->setLayout(cpar(bv)->GetLayout()); + bv->owner()->setLayout(cpar(bv)->getLayout()); old_par = cpar(bv); } } @@ -519,10 +520,10 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button) old_par = 0; int tmp_y = (y < 0)?0:y; if (!checkAndActivateInset(bv, x, tmp_y, button)) - TEXT(bv)->SetCursorFromCoordinates(bv, x - drawTextXOffset, + TEXT(bv)->setCursorFromCoordinates(bv, x - drawTextXOffset, y + insetAscent); TEXT(bv)->selection.cursor = TEXT(bv)->cursor; - bv->text->FinishUndo(); + bv->text->finishUndo(); ShowInsetCursor(bv); UpdateLocal(bv, CURSOR, false); @@ -549,13 +550,13 @@ void InsetText::InsetUnlock(BufferView * bv) locked = false; int code = CURSOR|CLEAR_FRAME; if (TEXT(bv)->selection.set()) { - TEXT(bv)->ClearSelection(bv); + TEXT(bv)->clearSelection(bv); code = FULL; } else if (owner()) bv->owner()->setLayout(owner()->getLyXText(bv) - ->cursor.par()->GetLayout()); + ->cursor.par()->getLayout()); else - bv->owner()->setLayout(bv->text->cursor.par()->GetLayout()); + bv->owner()->setLayout(bv->text->cursor.par()->getLayout()); UpdateLocal(bv, code, false); } @@ -566,7 +567,7 @@ bool InsetText::LockInsetInInset(BufferView * bv, UpdatableInset * inset) << inset << "): "; if (!inset) return false; - if (inset == cpar(bv)->GetInset(cpos(bv))) { + if (inset == cpar(bv)->getInset(cpos(bv))) { lyxerr[Debug::INSETS] << "OK" << endl; the_locking_inset = inset; inset_x = cx(bv) - top_x + drawTextXOffset; @@ -575,7 +576,7 @@ bool InsetText::LockInsetInInset(BufferView * bv, UpdatableInset * inset) inset_par = cpar(bv); inset_boundary = cboundary(bv); #if 0 - TEXT(bv)->ClearSelection(bv); + TEXT(bv)->clearSelection(bv); TEXT(bv)->sel_cursor = TEXT(bv)->cursor; TEXT(bv)->UpdateInset(bv, the_locking_inset); #else @@ -606,7 +607,7 @@ bool InsetText::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset, return false; if (the_locking_inset == inset) { the_locking_inset->InsetUnlock(bv); - TEXT(bv)->UpdateInset(bv, inset); + TEXT(bv)->updateInset(bv, inset); the_locking_inset = 0; if (lr) moveRight(bv, false); @@ -626,12 +627,12 @@ bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset) if (!the_locking_inset) return false; if (the_locking_inset != inset) { - TEXT(bv)->UpdateInset(bv, the_locking_inset); + TEXT(bv)->updateInset(bv, the_locking_inset); SetUpdateStatus(bv, CURSOR_PAR); return the_locking_inset->UpdateInsetInInset(bv, inset); } // UpdateLocal(bv, FULL, false); - if (TEXT(bv)->UpdateInset(bv, inset)) + if (TEXT(bv)->updateInset(bv, inset)) UpdateLocal(bv, CURSOR_PAR, false); if (cpar(bv) == inset_par && cpos(bv) == inset_pos) { inset_x = cx(bv) - top_x + drawTextXOffset; @@ -696,11 +697,11 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button) LocalDispatch(bv, LFUN_COPY, ""); paste_internally = true; } - TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset, + TEXT(bv)->setCursorFromCoordinates(bv, x-drawTextXOffset, y + insetAscent); TEXT(bv)->selection.cursor = TEXT(bv)->cursor; UpdateLocal(bv, CURSOR, false); - bv->owner()->setLayout(cpar(bv)->GetLayout()); + bv->owner()->setLayout(cpar(bv)->getLayout()); old_par = cpar(bv); // Insert primary selection with middle mouse // if there is a local selection in the current buffer, @@ -727,8 +728,8 @@ void InsetText::InsetButtonRelease(BufferView * bv, int x, int y, int button) x - inset_x, y - inset_y, button); } else { - if (cpar(bv)->GetChar(cpos(bv)) == LyXParagraph::META_INSET) { - inset = static_cast(cpar(bv)->GetInset(cpos(bv))); + if (cpar(bv)->getChar(cpos(bv)) == Paragraph::META_INSET) { + inset = static_cast(cpar(bv)->getInset(cpos(bv))); if (inset->Editable() == Inset::HIGHLY_EDITABLE) { inset->InsetButtonRelease(bv, x - inset_x, @@ -759,9 +760,9 @@ void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int state) return; } HideInsetCursor(bv); - TEXT(bv)->SetCursorFromCoordinates(bv, x - drawTextXOffset, + TEXT(bv)->setCursorFromCoordinates(bv, x - drawTextXOffset, y + insetAscent); - TEXT(bv)->SetSelection(bv); + TEXT(bv)->setSelection(bv); if (TEXT(bv)->toggle_cursor.par()!=TEXT(bv)->toggle_end_cursor.par() || TEXT(bv)->toggle_cursor.pos()!=TEXT(bv)->toggle_end_cursor.pos()) UpdateLocal(bv, SELECTION, false); @@ -780,7 +781,7 @@ void InsetText::InsetKeyPress(XKeyEvent * xke) UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv, - kb_action action, string const & arg) + kb_action action, string const & arg) { no_selection = false; UpdatableInset::RESULT @@ -829,7 +830,7 @@ InsetText::LocalDispatch(BufferView * bv, HideInsetCursor(bv); switch (action) { // Normal chars - case LFUN_UNKNOWN_ACTION: + case LFUN_SELFINSERT: if (bv->buffer()->isReadonly()) { // setErrorMessage(N_("Document is read only")); break; @@ -841,16 +842,16 @@ InsetText::LocalDispatch(BufferView * bv, * "auto_region_delete", which defaults to * true (on). */ - bv->text->SetUndo(bv->buffer(), Undo::INSERT, + bv->text->setUndo(bv->buffer(), Undo::INSERT, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); bv->setState(); if (lyxrc.auto_region_delete) { if (TEXT(bv)->selection.set()) { - TEXT(bv)->CutSelection(bv, false); + TEXT(bv)->cutSelection(bv, false); } } - TEXT(bv)->ClearSelection(bv); + TEXT(bv)->clearSelection(bv); for (string::size_type i = 0; i < arg.length(); ++i) { if (greek_kb_flag) { if (!math_insert_greek(bv, arg[i])) { @@ -869,88 +870,88 @@ InsetText::LocalDispatch(BufferView * bv, break; // --- Cursor Movements ----------------------------------- case LFUN_RIGHTSEL: - bv->text->FinishUndo(); + bv->text->finishUndo(); moveRight(bv, false, true); - TEXT(bv)->SetSelection(bv); + TEXT(bv)->setSelection(bv); UpdateLocal(bv, SELECTION, false); break; case LFUN_RIGHT: result = moveRight(bv); - bv->text->FinishUndo(); + bv->text->finishUndo(); UpdateLocal(bv, CURSOR, false); break; case LFUN_LEFTSEL: - bv->text->FinishUndo(); + bv->text->finishUndo(); moveLeft(bv, false, true); - TEXT(bv)->SetSelection(bv); + TEXT(bv)->setSelection(bv); UpdateLocal(bv, SELECTION, false); break; case LFUN_LEFT: - bv->text->FinishUndo(); + bv->text->finishUndo(); result = moveLeft(bv); UpdateLocal(bv, CURSOR, false); break; case LFUN_DOWNSEL: - bv->text->FinishUndo(); + bv->text->finishUndo(); moveDown(bv); - TEXT(bv)->SetSelection(bv); + TEXT(bv)->setSelection(bv); UpdateLocal(bv, SELECTION, false); break; case LFUN_DOWN: - bv->text->FinishUndo(); + bv->text->finishUndo(); result = moveDown(bv); UpdateLocal(bv, CURSOR, false); break; case LFUN_UPSEL: - bv->text->FinishUndo(); + bv->text->finishUndo(); moveUp(bv); - TEXT(bv)->SetSelection(bv); + TEXT(bv)->setSelection(bv); UpdateLocal(bv, SELECTION, false); break; case LFUN_UP: - bv->text->FinishUndo(); + bv->text->finishUndo(); result = moveUp(bv); UpdateLocal(bv, CURSOR, false); break; case LFUN_HOME: - bv->text->FinishUndo(); - TEXT(bv)->CursorHome(bv); + bv->text->finishUndo(); + TEXT(bv)->cursorHome(bv); UpdateLocal(bv, CURSOR, false); break; case LFUN_END: - TEXT(bv)->CursorEnd(bv); + TEXT(bv)->cursorEnd(bv); UpdateLocal(bv, CURSOR, false); break; case LFUN_BACKSPACE: - bv->text->SetUndo(bv->buffer(), Undo::DELETE, + bv->text->setUndo(bv->buffer(), Undo::DELETE, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); if (TEXT(bv)->selection.set()) - TEXT(bv)->CutSelection(bv); + TEXT(bv)->cutSelection(bv); else - TEXT(bv)->Backspace(bv); + TEXT(bv)->backspace(bv); UpdateLocal(bv, CURSOR_PAR, true); break; case LFUN_DELETE: - bv->text->SetUndo(bv->buffer(), Undo::DELETE, + bv->text->setUndo(bv->buffer(), Undo::DELETE, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); if (TEXT(bv)->selection.set()) - TEXT(bv)->CutSelection(bv); + TEXT(bv)->cutSelection(bv); else TEXT(bv)->Delete(bv); UpdateLocal(bv, CURSOR_PAR, true); break; case LFUN_CUT: - bv->text->SetUndo(bv->buffer(), Undo::DELETE, + bv->text->setUndo(bv->buffer(), Undo::DELETE, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); - TEXT(bv)->CutSelection(bv); + TEXT(bv)->cutSelection(bv); UpdateLocal(bv, CURSOR_PAR, true); break; case LFUN_COPY: - bv->text->FinishUndo(); - TEXT(bv)->CopySelection(bv); + bv->text->finishUndo(); + TEXT(bv)->copySelection(bv); UpdateLocal(bv, CURSOR_PAR, false); break; case LFUN_PASTESELECTION: @@ -960,9 +961,9 @@ InsetText::LocalDispatch(BufferView * bv, if (clip.empty()) break; if (arg == "paragraph") { - TEXT(bv)->InsertStringB(bv, clip); + TEXT(bv)->insertStringAsParagraphs(bv, clip); } else { - TEXT(bv)->InsertStringA(bv, clip); + TEXT(bv)->insertStringAsLines(bv, clip); } UpdateLocal(bv, CURSOR_PAR, true); break; @@ -978,31 +979,31 @@ InsetText::LocalDispatch(BufferView * bv, break; } } - bv->text->SetUndo(bv->buffer(), Undo::INSERT, + bv->text->setUndo(bv->buffer(), Undo::INSERT, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); - TEXT(bv)->PasteSelection(bv); + TEXT(bv)->pasteSelection(bv); UpdateLocal(bv, CURSOR_PAR, true); break; case LFUN_BREAKPARAGRAPH: if (!autoBreakRows) return DISPATCHED; - TEXT(bv)->BreakParagraph(bv, 0); + TEXT(bv)->breakParagraph(bv, 0); UpdateLocal(bv, FULL, true); break; case LFUN_BREAKPARAGRAPHKEEPLAYOUT: if (!autoBreakRows) return DISPATCHED; - TEXT(bv)->BreakParagraph(bv, 1); + TEXT(bv)->breakParagraph(bv, 1); UpdateLocal(bv, FULL, true); break; case LFUN_BREAKLINE: if (!autoBreakRows) return DISPATCHED; - bv->text->SetUndo(bv->buffer(), Undo::INSERT, + bv->text->setUndo(bv->buffer(), Undo::INSERT, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); - TEXT(bv)->InsertChar(bv, LyXParagraph::META_NEWLINE); + TEXT(bv)->insertChar(bv, Paragraph::META_NEWLINE); UpdateLocal(bv, CURSOR_PAR, true); break; case LFUN_LAYOUT: @@ -1034,13 +1035,13 @@ InsetText::LocalDispatch(BufferView * bv, if (cur_layout != layout.second) { cur_layout = layout.second; - TEXT(bv)->SetLayout(bv, layout.second); - bv->owner()->setLayout(cpar(bv)->GetLayout()); + TEXT(bv)->setLayout(bv, layout.second); + bv->owner()->setLayout(cpar(bv)->getLayout()); UpdateLocal(bv, CURSOR_PAR, true); } } else { // reset the layout box - bv->owner()->setLayout(cpar(bv)->GetLayout()); + bv->owner()->setLayout(cpar(bv)->getLayout()); } break; case LFUN_PARAGRAPH_SPACING: @@ -1048,11 +1049,11 @@ InsetText::LocalDispatch(BufferView * bv, // it also seems to me that the paragraphs inside the insettext // inherit bufferparams/paragraphparams in a strange way. (Lgb) { - LyXParagraph * par = TEXT(bv)->cursor.par(); - Spacing::Space cur_spacing = par->params.spacing().getSpace(); + Paragraph * par = TEXT(bv)->cursor.par(); + Spacing::Space cur_spacing = par->params().spacing().getSpace(); float cur_value = 1.0; if (cur_spacing == Spacing::Other) { - cur_value = par->params.spacing().getValue(); + cur_value = par->params().spacing().getValue(); } std::istringstream istr(arg.c_str()); @@ -1083,7 +1084,7 @@ InsetText::LocalDispatch(BufferView * bv, << arg << endl; } if (cur_spacing != new_spacing || cur_value != new_value) { - par->params.spacing(Spacing(new_spacing, new_value)); + par->params().spacing(Spacing(new_spacing, new_value)); //TEXT(bv)->RedoParagraph(owner->view()); UpdateLocal(bv, CURSOR_PAR, true); //bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); @@ -1123,7 +1124,7 @@ int InsetText::Latex(Buffer const * buf, ostream & os, bool, bool) const int InsetText::Ascii(Buffer const * buf, ostream & os, int linelen) const { - LyXParagraph * p = par; + Paragraph * p = par; unsigned int lines = 0; while (p) { @@ -1138,7 +1139,7 @@ int InsetText::Ascii(Buffer const * buf, ostream & os, int linelen) const int InsetText::DocBook(Buffer const * buf, ostream & os) const { - LyXParagraph * p = par; + Paragraph * p = par; unsigned int lines = 0; int desc = 0; @@ -1154,7 +1155,7 @@ int InsetText::DocBook(Buffer const * buf, ostream & os) const void InsetText::Validate(LaTeXFeatures & features) const { - LyXParagraph * p = par; + Paragraph * p = par; while (p) { p->validate(features); p = p->next(); @@ -1162,13 +1163,13 @@ void InsetText::Validate(LaTeXFeatures & features) const } -int InsetText::BeginningOfMainBody(Buffer const * buf, LyXParagraph * p) const +int InsetText::BeginningOfMainBody(Buffer const * buf, Paragraph * p) const { if (textclasslist.Style(buf->params.textclass, - p->GetLayout()).labeltype != LABEL_MANUAL) + p->getLayout()).labeltype != LABEL_MANUAL) return 0; else - return p->BeginningOfMainBody(); + return p->beginningOfMainBody(); } @@ -1196,7 +1197,7 @@ void InsetText::ToggleInsetCursor(BufferView * bv) return; } - LyXFont const font(TEXT(bv)->GetFont(bv->buffer(), cpar(bv), cpos(bv))); + LyXFont const font(TEXT(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv))); int const asc = lyxfont::maxAscent(font); int const desc = lyxfont::maxDescent(font); @@ -1217,7 +1218,7 @@ void InsetText::ShowInsetCursor(BufferView * bv, bool show) } if (!isCursorVisible()) { LyXFont const font = - TEXT(bv)->GetFont(bv->buffer(), cpar(bv), cpos(bv)); + TEXT(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv)); int const asc = lyxfont::maxAscent(font); int const desc = lyxfont::maxDescent(font); @@ -1269,7 +1270,7 @@ InsetText::moveRightIntern(BufferView * bv, bool behind, return FINISHED; if (activate_inset && checkAndActivateInset(bv, behind)) return DISPATCHED; - TEXT(bv)->CursorRight(bv); + TEXT(bv)->cursorRight(bv); if (!selecting) TEXT(bv)->selection.cursor = TEXT(bv)->cursor; return DISPATCHED_NOUPDATE; @@ -1282,7 +1283,7 @@ InsetText::moveLeftIntern(BufferView * bv, bool behind, { if (!cpar(bv)->previous() && (cpos(bv) <= 0)) return FINISHED; - TEXT(bv)->CursorLeft(bv); + TEXT(bv)->cursorLeft(bv); if (!selecting) TEXT(bv)->selection.cursor = TEXT(bv)->cursor; if (activate_inset && checkAndActivateInset(bv, behind)) @@ -1296,7 +1297,7 @@ InsetText::moveUp(BufferView * bv) { if (!crow(bv)->previous()) return FINISHED; - TEXT(bv)->CursorUp(bv); + TEXT(bv)->cursorUp(bv); return DISPATCHED_NOUPDATE; } @@ -1306,7 +1307,7 @@ InsetText::moveDown(BufferView * bv) { if (!crow(bv)->next()) return FINISHED; - TEXT(bv)->CursorDown(bv); + TEXT(bv)->cursorDown(bv); return DISPATCHED_NOUPDATE; } @@ -1318,14 +1319,14 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset) return the_locking_inset->InsertInset(bv, inset); return false; } - bv->text->SetUndo(bv->buffer(), Undo::INSERT, + bv->text->setUndo(bv->buffer(), Undo::INSERT, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); inset->setOwner(this); HideInsetCursor(bv); - TEXT(bv)->InsertInset(bv, inset); + TEXT(bv)->insertInset(bv, inset); #if 0 - if ((cpar(bv)->GetChar(cpos(bv)) != LyXParagraph::META_INSET) || + if ((cpar(bv)->GetChar(cpos(bv)) != Paragraph::META_INSET) || (cpar(bv)->GetInset(cpos(bv)) != inset)) TEXT(bv)->CursorLeft(bv); #endif @@ -1364,10 +1365,10 @@ std::vector const InsetText::getLabelList() const { std::vector label_list; - LyXParagraph * tpar = par; + Paragraph * tpar = par; while (tpar) { - LyXParagraph::inset_iterator beg = tpar->inset_iterator_begin(); - LyXParagraph::inset_iterator end = tpar->inset_iterator_end(); + Paragraph::inset_iterator beg = tpar->inset_iterator_begin(); + Paragraph::inset_iterator end = tpar->inset_iterator_end(); for (; beg != end; ++beg) { std::vector const l = (*beg)->getLabelList(); label_list.insert(label_list.end(), l.begin(), l.end()); @@ -1386,15 +1387,15 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall, return; } if (TEXT(bv)->selection.set()) { - bv->text->SetUndo(bv->buffer(), Undo::EDIT, + bv->text->setUndo(bv->buffer(), Undo::EDIT, bv->text->cursor.par()->previous(), bv->text->cursor.par()->next()); } if (selectall) selectAll(bv); - TEXT(bv)->SetFont(bv, font, toggleall); + TEXT(bv)->setFont(bv, font, toggleall); if (selectall) - TEXT(bv)->ClearSelection(bv); + TEXT(bv)->clearSelection(bv); bv->fitCursor(TEXT(bv)); if (selectall || TEXT(bv)->selection.set()) UpdateLocal(bv, FULL, true); @@ -1405,15 +1406,15 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall, bool InsetText::checkAndActivateInset(BufferView * bv, bool behind) { - if (cpar(bv)->GetChar(cpos(bv)) == LyXParagraph::META_INSET) { + if (cpar(bv)->getChar(cpos(bv)) == Paragraph::META_INSET) { unsigned int x; unsigned int y; Inset * inset = - static_cast(cpar(bv)->GetInset(cpos(bv))); + static_cast(cpar(bv)->getInset(cpos(bv))); if (!inset || inset->Editable() != Inset::HIGHLY_EDITABLE) return false; LyXFont const font = - TEXT(bv)->GetFont(bv->buffer(), cpar(bv), cpos(bv)); + TEXT(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv)); if (behind) { x = inset->width(bv, font); y = font.isRightToLeft() ? 0 : inset->descent(bv, font); @@ -1436,10 +1437,9 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool behind) bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y, int button) { - int dummyx, dummyy; - - dummyx = x = x - drawTextXOffset; - dummyy = y + insetAscent; + x -= drawTextXOffset; + int dummyx = x; + int dummyy = y + insetAscent; Inset * inset = bv->checkInsetHit(TEXT(bv), dummyx, dummyy, button); if (inset) { @@ -1475,7 +1475,7 @@ int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const } -void InsetText::SetParagraphData(LyXParagraph * p) +void InsetText::SetParagraphData(Paragraph * p) { // delete all instances of LyXText before deleting the paragraps used // by it. @@ -1485,20 +1485,20 @@ void InsetText::SetParagraphData(LyXParagraph * p) } while (par) { - LyXParagraph * tmp = par->next(); + Paragraph * tmp = par->next(); delete par; par = tmp; } - par = new LyXParagraph(*p); - par->SetInsetOwner(this); - LyXParagraph * np = par; + par = new Paragraph(*p); + par->setInsetOwner(this); + Paragraph * np = par; while (p->next()) { p = p->next(); - np->next(new LyXParagraph(*p)); + np->next(new Paragraph(*p)); np->next()->previous(np); np = np->next(); - np->SetInsetOwner(this); + np->setInsetOwner(this); } need_update = INIT; @@ -1510,7 +1510,7 @@ void InsetText::SetText(string const & data) clear(); LyXFont font(LyXFont::ALL_SANE); for (unsigned int i=0; i < data.length(); ++i) - par->InsertChar(i, data[i], font); + par->insertChar(i, data[i], font); } @@ -1550,7 +1550,7 @@ int InsetText::cx(BufferView * bv) const LyXText * text = TEXT(bv); int x = text->cursor.x() + top_x + TEXT_TO_INSET_OFFSET; if (the_locking_inset) { - LyXFont font = text->GetFont(bv->buffer(), + LyXFont font = text->getFont(bv->buffer(), text->cursor.par(), text->cursor.pos()); if (font.isVisibleRightToLeft()) @@ -1567,13 +1567,13 @@ int InsetText::cy(BufferView * bv) const } -LyXParagraph::size_type InsetText::cpos(BufferView * bv) const +Paragraph::size_type InsetText::cpos(BufferView * bv) const { return TEXT(bv)->cursor.pos(); } -LyXParagraph * InsetText::cpar(BufferView * bv) const +Paragraph * InsetText::cpar(BufferView * bv) const { return TEXT(bv)->cursor.par(); } @@ -1606,7 +1606,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv, lt->init(bv); cache[bv] = lt; if (the_locking_inset) { - lt->SetCursor(bv, inset_par, inset_pos, true, inset_boundary); + lt->setCursor(bv, inset_par, inset_pos, true, inset_boundary); if (recursive) return the_locking_inset->getLyXText(bv); } @@ -1622,7 +1622,7 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const cache.erase(bv); if (recursive) { /// then remove all LyXText in text-insets - LyXParagraph * p = par; + Paragraph * p = par; for (; p; p = p->next()) { p->deleteInsetsLyXText(bv); } @@ -1640,12 +1640,12 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const if ((cache.find(bv) == cache.end()) || !cache[bv]) return; - LyXParagraph * lpar = 0; - LyXParagraph * selstartpar = 0; - LyXParagraph * selendpar = 0; - LyXParagraph::size_type pos = 0; - LyXParagraph::size_type selstartpos = 0; - LyXParagraph::size_type selendpos = 0; + Paragraph * lpar = 0; + Paragraph * selstartpar = 0; + Paragraph * selendpar = 0; + Paragraph::size_type pos = 0; + Paragraph::size_type selstartpos = 0; + Paragraph::size_type selendpos = 0; bool boundary = false; bool selstartboundary = false; bool selendboundary = false; @@ -1675,15 +1675,15 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const * Mechanism when setting the cursor */ TEXT(bv)->selection.mark(mark_set); if (selection) { - TEXT(bv)->SetCursor(bv, selstartpar, selstartpos, + TEXT(bv)->setCursor(bv, selstartpar, selstartpos, true, selstartboundary); TEXT(bv)->selection.cursor = TEXT(bv)->cursor; - TEXT(bv)->SetCursor(bv, selendpar, selendpos, + TEXT(bv)->setCursor(bv, selendpar, selendpos, true, selendboundary); - TEXT(bv)->SetSelection(bv); - TEXT(bv)->SetCursor(bv, lpar, pos); + TEXT(bv)->setSelection(bv); + TEXT(bv)->setCursor(bv, lpar, pos); } else { - TEXT(bv)->SetCursor(bv, lpar, pos, true, boundary); + TEXT(bv)->setCursor(bv, lpar, pos, true, boundary); TEXT(bv)->selection.cursor = TEXT(bv)->cursor; TEXT(bv)->selection.set(false); } @@ -1697,7 +1697,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const /// then resize all LyXText in text-insets inset_x = cx(bv) - top_x + drawTextXOffset; inset_y = cy(bv) + drawTextYOffset; - for (LyXParagraph * p = par; p; p = p->next()) { + for (Paragraph * p = par; p; p = p->next()) { p->resizeInsetsLyXText(bv); } } @@ -1707,10 +1707,10 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const void InsetText::removeNewlines() { - for (LyXParagraph * p = par; p; p = p->next()) { + for (Paragraph * p = par; p; p = p->next()) { for (int i = 0; i < p->size(); ++i) { - if (p->GetChar(i) == LyXParagraph::META_NEWLINE) - p->Erase(i); + if (p->getChar(i) == Paragraph::META_NEWLINE) + p->erase(i); } } } @@ -1740,19 +1740,22 @@ bool InsetText::doClearArea() const return !locked || (need_update & (FULL|INIT)); } + void InsetText::selectAll(BufferView * bv) { - TEXT(bv)->CursorTop(bv); + TEXT(bv)->cursorTop(bv); TEXT(bv)->selection.cursor = TEXT(bv)->cursor; - TEXT(bv)->CursorBottom(bv); - TEXT(bv)->SetSelection(bv); + TEXT(bv)->cursorBottom(bv); + TEXT(bv)->setSelection(bv); } + void InsetText::clearSelection(BufferView * bv) { - TEXT(bv)->ClearSelection(bv); + TEXT(bv)->clearSelection(bv); } + void InsetText::clearInset(Painter & pain, int baseline, bool & cleared) const { int w = insetWidth; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 50075adcf4..7516a4a6b1 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -19,7 +19,7 @@ #pragma interface #endif -#include "lyxinset.h" +#include "inset.h" #include "LString.h" #include "lyxcursor.h" @@ -27,7 +27,7 @@ class Painter; class BufferView; class Buffer; class LyXCursor; -class LyXParagraph; +class Paragraph; class LColor; class LyXText; class LyXScreen; @@ -161,7 +161,7 @@ public: /// void WriteParagraphData(Buffer const *, std::ostream &) const; /// - void SetParagraphData(LyXParagraph *); + void SetParagraphData(Paragraph *); /// void SetText(string const &); /// @@ -195,7 +195,7 @@ public: /// void clearSelection(BufferView *bv); - LyXParagraph * par; + Paragraph * par; /// mutable int need_update; @@ -219,7 +219,7 @@ private: /// typedef Cache::value_type value_type; /// - int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const; + int BeginningOfMainBody(Buffer const *, Paragraph * par) const; /// void ShowInsetCursor(BufferView *, bool show=true); /// @@ -259,9 +259,9 @@ private: /// int cy(BufferView *) const; /// - LyXParagraph::size_type cpos(BufferView *) const; + Paragraph::size_type cpos(BufferView *) const; /// - LyXParagraph * cpar(BufferView *) const; + Paragraph * cpar(BufferView *) const; /// bool cboundary(BufferView *) const; /// @@ -293,9 +293,9 @@ private: /// mutable int top_y; /// - LyXParagraph * inset_par; + Paragraph * inset_par; /// - LyXParagraph::size_type inset_pos; + Paragraph::size_type inset_pos; /// bool inset_boundary; /// @@ -311,7 +311,7 @@ private: /// UpdatableInset * the_locking_inset; /// - LyXParagraph * old_par; + Paragraph * old_par; /// The cache. mutable Cache cache; /// diff --git a/src/lyx_cb.C b/src/lyx_cb.C index f6173f5c38..8bb730868f 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -33,6 +33,7 @@ #include "support/path.h" #include "support/syscall.h" #include "gettext.h" +#include "BufferView.h" using std::vector; using std::ifstream; @@ -461,9 +462,9 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph) // clear the selection bv->beforeChange(bv->text); if (!asParagraph) - bv->text->InsertStringA(bv, tmpstr); + bv->text->insertStringAsLines(bv, tmpstr); else - bv->text->InsertStringB(bv, tmpstr); + bv->text->insertStringAsParagraphs(bv, tmpstr); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } @@ -473,16 +474,16 @@ void MenuInsertLabel(BufferView * bv, string const & arg) string label(arg); ProhibitInput(bv); if (label.empty()) { - LyXParagraph * par = bv->text->cursor.par(); + Paragraph * par = bv->text->cursor.par(); LyXLayout const * layout = &textclasslist.Style(bv->buffer()->params.textclass, - par->GetLayout()); + par->getLayout()); if (layout->latextype == LATEX_PARAGRAPH && par->previous()) { - LyXParagraph * par2 = par->previous(); + Paragraph * par2 = par->previous(); LyXLayout const * layout2 = &textclasslist.Style(bv->buffer()->params.textclass, - par2->GetLayout()); + par2->getLayout()); if (layout2->latextype != LATEX_PARAGRAPH) { par = par2; layout = layout2; @@ -496,7 +497,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg) if (layout->latextype == LATEX_PARAGRAPH || lyxrc.label_init_length < 0) text.erase(); - string par_text = par->String(bv->buffer(), false); + string par_text = par->asString(bv->buffer(), false); for (int i = 0; i < lyxrc.label_init_length; ++i) { if (par_text.empty()) break; diff --git a/src/lyx_gui.C b/src/lyx_gui.C index cdb1f36457..ed579f89c0 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -15,7 +15,6 @@ #pragma implementation #endif -//#include #include "lyx_gui.h" #include FORMS_H_LOCATION #include "support/filetools.h" @@ -28,6 +27,7 @@ #include "version.h" #include "LyXView.h" #include "buffer.h" +#include "BufferView.h" #include "lyxserver.h" #include "lyxrc.h" #include "gettext.h" diff --git a/src/lyxcursor.C b/src/lyxcursor.C index 5b61bdd20b..94b31e8d13 100644 --- a/src/lyxcursor.C +++ b/src/lyxcursor.C @@ -23,31 +23,31 @@ LyXCursor::LyXCursor() : par_(0), pos_(0), boundary_(false), } -void LyXCursor::par(LyXParagraph * p) +void LyXCursor::par(Paragraph * p) { par_ = p; } -LyXParagraph * LyXCursor::par() +Paragraph * LyXCursor::par() { return par_; } -LyXParagraph * LyXCursor::par() const +Paragraph * LyXCursor::par() const { return par_; } -void LyXCursor::pos(LyXParagraph::size_type p) +void LyXCursor::pos(Paragraph::size_type p) { pos_ = p; } -LyXParagraph::size_type LyXCursor::pos() const +Paragraph::size_type LyXCursor::pos() const { return pos_; } diff --git a/src/lyxcursor.h b/src/lyxcursor.h index bb5e1f6ae8..0fdf06a296 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -16,7 +16,7 @@ #pragma interface #endif -#include "lyxparagraph.h" +#include "paragraph.h" struct Row; @@ -26,15 +26,15 @@ class LyXCursor { public: LyXCursor(); /// - void par(LyXParagraph * p); + void par(Paragraph * p); /// - LyXParagraph * par(); + Paragraph * par(); /// - LyXParagraph * par() const; + Paragraph * par() const; /// - void pos(LyXParagraph::size_type p); + void pos(Paragraph::size_type p); /// - LyXParagraph::size_type pos() const; + Paragraph::size_type pos() const; /// void boundary(bool b); /// @@ -59,9 +59,9 @@ public: Row * row() const; private: /// The paragraph the cursor is in. - LyXParagraph * par_; + Paragraph * par_; /// The position inside the paragraph - LyXParagraph::size_type pos_; + Paragraph::size_type pos_; /// bool boundary_; /// diff --git a/src/lyxfind.C b/src/lyxfind.C index 0098c0ff04..97a2a0756b 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -39,8 +39,8 @@ int LyXReplace(BufferView * bv, // start at top if replaceall bool fw = forward; if (replaceall) { - bv->text->ClearSelection(bv); - bv->text->CursorTop(bv); + bv->text->clearSelection(bv); + bv->text->cursorTop(bv); // override search direction because we search top to bottom fw = true; } @@ -58,8 +58,8 @@ int LyXReplace(BufferView * bv, bv->hideCursor(); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); bv->toggleSelection(false); - bv->text->ReplaceSelectionWithString(bv, replacestr); - bv->text->SetSelectionOverString(bv, replacestr); + bv->text->replaceSelectionWithString(bv, replacestr); + bv->text->setSelectionOverString(bv, replacestr); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); ++replace_count; found = LyXFind(bv, searchstr, casesens, matchwrd, fw); @@ -95,8 +95,8 @@ bool LyXFind(BufferView * bv, : SearchBackward(bv, searchstr, casesens, matchwrd)) { bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); bv->toggleSelection(); - bv->text->ClearSelection(bv); - bv->text->SetSelectionOverString(bv, searchstr); + bv->text->clearSelection(bv); + bv->text->setSelectionOverString(bv, searchstr); bv->toggleSelection(false); found = true; }; @@ -109,7 +109,7 @@ bool LyXFind(BufferView * bv, // returns true if the specified string is at the specified position -bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos, +bool IsStringInText(Paragraph * par, Paragraph::size_type pos, string const & str, bool const & cs, bool const & mw) { @@ -117,22 +117,21 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos, return false; string::size_type size = str.length(); - LyXParagraph::size_type i = 0; + Paragraph::size_type i = 0; while (((pos + i) < par->size()) && (string::size_type(i) < size) - && (cs ? (str[i] == par->GetChar(pos + i)) - : (toupper(str[i]) == toupper(par->GetChar(pos + i))))) + && (cs ? (str[i] == par->getChar(pos + i)) + : (toupper(str[i]) == toupper(par->getChar(pos + i))))) { ++i; } if (size == string::size_type(i)) { // if necessary, check whether string matches word if (!mw || - (mw && ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1))) - && (pos + size >= par->size() - || !IsLetterCharOrDigit(par->GetChar(pos + size)))) - ) - ) + (mw && ((pos <= 0 || !IsLetterCharOrDigit(par->getChar(pos - 1))) + && (pos + Paragraph::size_type(size) >= par->size() + || !IsLetterCharOrDigit(par->getChar(pos + size)))) + )) return true; } return false; @@ -144,8 +143,8 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos, bool SearchForward(BufferView * bv, string const & str, bool const & cs, bool const & mw) { - LyXParagraph * par = bv->text->cursor.par(); - LyXParagraph::size_type pos = bv->text->cursor.pos(); + Paragraph * par = bv->text->cursor.par(); + Paragraph::size_type pos = bv->text->cursor.pos(); while (par && !IsStringInText(par, pos, str, cs, mw)) { if (pos < par->size() - 1) @@ -156,7 +155,7 @@ bool SearchForward(BufferView * bv, string const & str, } } if (par) { - bv->text->SetCursor(bv, par, pos); + bv->text->setCursor(bv, par, pos); return true; } else @@ -170,8 +169,8 @@ bool SearchForward(BufferView * bv, string const & str, bool SearchBackward(BufferView * bv, string const & str, bool const & cs, bool const & mw) { - LyXParagraph * par = bv->text->cursor.par(); - LyXParagraph::size_type pos = bv->text->cursor.pos(); + Paragraph * par = bv->text->cursor.par(); + Paragraph::size_type pos = bv->text->cursor.pos(); do { if (pos > 0) @@ -187,7 +186,7 @@ bool SearchBackward(BufferView * bv, string const & str, } while (par && !IsStringInText(par, pos, str, cs, mw)); if (par) { - bv->text->SetCursor(bv, par, pos); + bv->text->setCursor(bv, par, pos); return true; } else return false; diff --git a/src/lyxfind.h b/src/lyxfind.h index 52b79307e4..59e2553458 100644 --- a/src/lyxfind.h +++ b/src/lyxfind.h @@ -7,7 +7,7 @@ #endif #include "LString.h" -#include "lyxparagraph.h" +#include "paragraph.h" class BufferView; @@ -18,7 +18,7 @@ bool LyXFind(BufferView * bv, string const &, bool const &, bool const &, bool const &); /// returns true if the specified string is at the specified position -bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos, +bool IsStringInText(Paragraph * par, Paragraph::size_type pos, string const & str, bool const & = true, bool const & = false); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 1ea444bac6..245c063478 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -19,7 +19,6 @@ #include #include -//#include #ifdef __GNUG__ #pragma implementation @@ -30,6 +29,7 @@ #include "kbmap.h" #include "lyxfunc.h" #include "bufferlist.h" +#include "BufferView.h" #include "ColorHandler.h" #include "lyxserver.h" #include "figure_form.h" @@ -181,7 +181,7 @@ inline void LyXFunc::moveCursorUpdate(bool flag, bool selecting) { if (selecting || TEXT(flag)->selection.mark()) { - TEXT(flag)->SetSelection(owner->view()); + TEXT(flag)->setSelection(owner->view()); if (TEXT(flag)->bv_owner) owner->view()->toggleToggle(); } @@ -190,7 +190,6 @@ void LyXFunc::moveCursorUpdate(bool flag, bool selecting) /* ---> Everytime the cursor is moved, show the current font state. */ // should this too me moved out of this func? - //owner->showState(); owner->view()->setState(); } @@ -232,8 +231,6 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state) if (keysym == NoSymbol) { lyxerr[Debug::KEY] << "Empty kbd action (probably composing)" << endl; - //return 0; - //return FL_PREEMPT; return; } @@ -243,7 +240,6 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state) // all of them should be explictly mentioned? if ((keysym >= XK_Shift_L && keysym <= XK_Hyper_R) || keysym == XK_Mode_switch || keysym == 0x0) { - //return 0; return; } @@ -312,7 +308,6 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state) } if (action == -1) { owner->message(_("Unknown function.")); - //return 0; return; } } @@ -364,12 +359,12 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const LyXFunc::func_status LyXFunc::getStatus(int ac, string const & not_to_use_arg) const { - kb_action action; - func_status flag = LyXFunc::OK; - string argument; - Buffer * buf = owner->buffer(); + kb_action action; + func_status flag = LyXFunc::OK; + string argument; + Buffer * buf = owner->buffer(); - if (lyxaction.isPseudoAction(ac)) + if (lyxaction.isPseudoAction(ac)) action = lyxaction.retrieveActionArg(ac, argument); else { action = static_cast(ac); @@ -539,7 +534,9 @@ LyXFunc::func_status LyXFunc::getStatus(int ac, // temporary dispatch method void LyXFunc::miniDispatch(string const & s) { - Dispatch(s); + if (!s.empty()) { + Dispatch(s); + } } @@ -548,7 +545,7 @@ string const LyXFunc::Dispatch(string const & s) // Split command string into command and argument string cmd; string line = frontStrip(s); - string arg = strip(frontStrip(split(line, cmd, ' '))); + string const arg = strip(frontStrip(split(line, cmd, ' '))); return Dispatch(lyxaction.LookupFunc(cmd), arg); } @@ -657,10 +654,10 @@ string const LyXFunc::Dispatch(int ac, owner->view()->unlockInset(inset); owner->view()->menuUndo(); if (TEXT()->cursor.par()-> - IsInset(TEXT()->cursor.pos())) { + isInset(TEXT()->cursor.pos())) { inset = static_cast( TEXT()->cursor.par()-> - GetInset(TEXT()-> + getInset(TEXT()-> cursor.pos())); } else { inset = 0; @@ -678,7 +675,7 @@ string const LyXFunc::Dispatch(int ac, owner->view()->menuRedo(); inset = static_cast( TEXT()->cursor.par()-> - GetInset(TEXT()-> + getInset(TEXT()-> cursor.pos())); if (inset) inset->Edit(owner->view(),slx,sly,0); @@ -695,29 +692,29 @@ string const LyXFunc::Dispatch(int ac, case LFUN_UNKNOWN_ACTION: case LFUN_BREAKPARAGRAPH: case LFUN_BREAKLINE: - TEXT()->CursorRight(owner->view()); + TEXT()->cursorRight(owner->view()); owner->view()->setState(); owner->showState(); break; case LFUN_RIGHT: if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) { - TEXT()->CursorRight(owner->view()); + TEXT()->cursorRight(owner->view()); moveCursorUpdate(true, false); owner->showState(); } return string(); case LFUN_LEFT: if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) { - TEXT()->CursorRight(owner->view()); + TEXT()->cursorRight(owner->view()); moveCursorUpdate(true, false); owner->showState(); } return string(); case LFUN_DOWN: if (TEXT()->cursor.row()->next()) - TEXT()->CursorDown(owner->view()); + TEXT()->cursorDown(owner->view()); else - TEXT()->CursorRight(owner->view()); + TEXT()->cursorRight(owner->view()); moveCursorUpdate(true, false); owner->showState(); return string(); @@ -744,7 +741,7 @@ string const LyXFunc::Dispatch(int ac, if (tli == lock) { owner->view()->unlockInset(tli); - TEXT()->CursorRight(owner->view()); + TEXT()->cursorRight(owner->view()); moveCursorUpdate(true, false); owner->showState(); } else { @@ -780,12 +777,12 @@ string const LyXFunc::Dispatch(int ac, // ??? Needed ??? // clear the selection (if there is any) owner->view()->toggleSelection(); - TEXT()->ClearSelection(owner->view()); + TEXT()->clearSelection(owner->view()); // Move cursor so that successive C-s 's will not stand in place. if (action == LFUN_WORDFINDFORWARD ) - TEXT()->CursorRightOneWord(owner->view()); - TEXT()->FinishUndo(); + TEXT()->cursorRightOneWord(owner->view()); + TEXT()->finishUndo(); moveCursorUpdate(true, false); // ??? Needed ??? @@ -1247,12 +1244,12 @@ string const LyXFunc::Dispatch(int ac, int id; istr >> id; - LyXParagraph * par = TEXT()->GetParFromID(id); + Paragraph * par = TEXT()->getParFromID(id); if (par == 0) break; // Set the cursor - TEXT()->SetCursor(owner->view(), par, 0); + TEXT()->setCursor(owner->view(), par, 0); owner->view()->setState(); owner->showState(); @@ -1328,6 +1325,7 @@ string const LyXFunc::Dispatch(int ac, case LFUN_MATH_EXTERN: case LFUN_MATH_NUMBER: + case LFUN_MATH_NONUMBER: case LFUN_MATH_LIMITS: { setErrorMessage(N_("This is only allowed in math mode!")); @@ -1424,8 +1422,8 @@ string const LyXFunc::Dispatch(int ac, fontloader.update(); // Of course we should only do the resize and the textcache.clear // if values really changed...but not very important right now. (Lgb) - // All buffers will need resize - bufferlist.resize(); + // All visible buffers will need resize + owner->resize(); // We also need to empty the textcache so that // the buffer will be formatted correctly after // a zoom change. @@ -1610,7 +1608,7 @@ void LyXFunc::MenuNew(bool fromTemplate) string(lyxrc.template_path))); FileDialog::Result result = - fileDlg.Select(initpath, + fileDlg.Select(lyxrc.template_path, _("*.lyx|LyX Documents (*.lyx)")); if (result.first == FileDialog::Later) diff --git a/src/lyxfunc.h b/src/lyxfunc.h index e9ad1d6b7d..68ee86ff53 100644 --- a/src/lyxfunc.h +++ b/src/lyxfunc.h @@ -11,7 +11,7 @@ #include FORMS_H_LOCATION #include "commandtags.h" #include "kbsequence.h" -#include "insets/lyxinset.h" +#include "insets/inset.h" #include "LString.h" class LyXView; diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index 84412bf08c..bcb4137621 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -22,7 +22,10 @@ struct compare_tags { // used by lower_bound, sort and sorted inline int operator()(keyword_item const & a, keyword_item const & b) const { - return compare_no_case(a.tag, b.tag) < 0; + // we use the ascii version, because in turkish, 'i' + // is not the lowercase version of 'I', and thus + // turkish locale breaks parsing of tags. + return compare_ascii_no_case(a.tag, b.tag) < 0; } }; // } // end of anon namespace @@ -44,7 +47,7 @@ string const LyXLex::Pimpl::GetString() const void LyXLex::Pimpl::printError(string const & message) const { - string tmpmsg = subst(message, "$$Token", GetString()); + string const tmpmsg = subst(message, "$$Token", GetString()); lyxerr << "LyX: " << tmpmsg << " [around line " << lineno << " of file " << MakeDisplayPath(name) << ']' << endl; } @@ -170,7 +173,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */) lyxerr[Debug::LYXLEX] << "Comment read: `" << c << buff << "'" << endl; #else - // unfortunately is ignore buggy (Lgb) + // unfortunately ignore is buggy (Lgb) is.ignore(100, '\n'); #endif ++lineno; diff --git a/src/lyxparagraph.h b/src/lyxparagraph.h deleted file mode 100644 index 8311f79e04..0000000000 --- a/src/lyxparagraph.h +++ /dev/null @@ -1,605 +0,0 @@ -// -*- C++ -*- -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ - -#ifndef LYXPARAGRAPH_H -#define LYXPARAGRAPH_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include "LString.h" - -#include -#include -#include - -#include "insets/lyxinset.h" -#include "ParagraphParameters.h" -#include "support/LAssert.h" - -class BufferParams; -class LyXBuffer; -class TexRow; -struct LaTeXFeatures; -class InsetBibKey; -class BufferView; -class Language; - -// After 1.2.0 is released, during 1.3.0cvs, we enable this. And after -// a while we verify that reading of 1.2.x files work perfectly we remove -// this code completely. (Lgb) -//#define NO_PEXTRA_REALLY 1 - -// Define this if you want to try out the new storage container for -// paragraphs. std::container instead of obfuscated homegrown -// linked list. (Lgb) -// This is non working and far from finished. -// #define NO_NEXT 1 - -/// A LyXParagraph holds all text, attributes and insets in a text paragraph -class LyXParagraph { -public: -#ifndef NO_PEXTRA_REALLY - /// - enum PEXTRA_TYPE { - /// - PEXTRA_NONE, - /// - PEXTRA_INDENT, - /// - PEXTRA_MINIPAGE, - /// - PEXTRA_FLOATFLT - }; - /// - enum MINIPAGE_ALIGNMENT { - /// - MINIPAGE_ALIGN_TOP, - /// - MINIPAGE_ALIGN_MIDDLE, - /// - MINIPAGE_ALIGN_BOTTOM - }; -#endif - /// - enum META_KIND { - /// - META_HFILL = 1, - /// - META_NEWLINE, - /// - META_INSET - }; - /// - typedef char value_type; - /// - typedef std::vector TextContainer; - /// - /* This should be TextContainer::size_type, but we need - signed values for now. - */ - typedef TextContainer::difference_type size_type; - - /// - LyXParagraph(); - /// this constructor inserts the new paragraph in a list - explicit - LyXParagraph(LyXParagraph * par); - /// - LyXParagraph(LyXParagraph const &); - /// the destructor removes the new paragraph from the list - ~LyXParagraph(); - - /// - Language const * getParLanguage(BufferParams const &) const; - /// - bool isRightToLeftPar(BufferParams const &) const; - /// - void ChangeLanguage(BufferParams const & bparams, - Language const * from, Language const * to); - /// - bool isMultiLingual(BufferParams const &); - /// - - string const String(Buffer const *, bool label); - /// - string const String(Buffer const *, size_type beg, size_type end); - - /// - void writeFile(Buffer const *, std::ostream &, BufferParams const &, - char) const; - /// - void validate(LaTeXFeatures &) const; - - /// - int id() const; - /// - void id(int id_arg); - /// - void read(); - - /// - LyXParagraph * TeXOnePar(Buffer const *, BufferParams const &, - std::ostream &, TexRow & texrow, - bool moving_arg); - /// - bool SimpleTeXOnePar(Buffer const *, BufferParams const &, - std::ostream &, TexRow & texrow, bool moving_arg); - - /// - LyXParagraph * TeXEnvironment(Buffer const *, BufferParams const &, - std::ostream &, TexRow & texrow); - /// - bool HasSameLayout(LyXParagraph const * par) const; - - /// - void MakeSameLayout(LyXParagraph const * par); - - /// Is it the first par with same depth and layout? - bool IsFirstInSequence() const; - - /** Check if the current paragraph is the last paragraph in a - proof environment */ - int GetEndLabel(BufferParams const &) const; - /// - Inset * InInset(); - /// - void SetInsetOwner(Inset * i); - /// - void deleteInsetsLyXText(BufferView *); - /// - void resizeInsetsLyXText(BufferView *); -private: - /// - TextContainer text; - /// - Inset * inset_owner; - -public: - /// - inline - size_type size() const; - /// - void fitToSize(); - /// - void setContentsFromPar(LyXParagraph * par); - /// - void clearContents(); - - ParagraphParameters params; - - /// - LyXTextClass::LayoutList::size_type layout; -private: - /// - boost::array counter_; -public: - /// - void setCounter(int i, int v); - /// - int getCounter(int i) const; - /// - void incCounter(int i); - - /// - char enumdepth; - - /// - char itemdepth; -private: - /// - LyXParagraph * next_; - /// - LyXParagraph * previous_; -public: - /// - InsetBibKey * bibkey; // ale970302 - - /// - void next(LyXParagraph *); - /** these function are able to hide closed footnotes - */ - LyXParagraph * next(); - /// - LyXParagraph const * next() const; - - /// - void previous(LyXParagraph *); - /// - LyXParagraph * previous(); - /// - LyXParagraph const * previous() const; - - /// for the environments - LyXParagraph * DepthHook(int depth); - /// for the environments - LyXParagraph const * DepthHook(int depth) const; - /// - int BeginningOfMainBody() const; - /// - string const & GetLabelstring() const; - - /// the next two functions are for the manual labels - string const GetLabelWidthString() const; - /// - void SetLabelWidthString(string const & s); - /// - inline - LyXTextClass::LayoutList::size_type GetLayout() const; - /// - char GetAlign() const; - /// - char GetDepth() const; - /// - void SetLayout(LyXTextClass::LayoutList::size_type new_layout); - /// - void SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout); - /// - int GetFirstCounter(int i) const; - /// - void Erase(size_type pos); - /** the flag determines wether the layout should be copied - */ - void BreakParagraph(BufferParams const &, size_type pos, int flag); - /// - void BreakParagraphConservative(BufferParams const &, size_type pos); - /** Get unistantiated font setting. Returns the difference - between the characters font and the layoutfont. - This is what is stored in the fonttable - */ - LyXFont const - GetFontSettings(BufferParams const &, size_type pos) const; - /// - LyXFont const GetFirstFontSettings() const; - - /** Get fully instantiated font. If pos == -1, use the layout - font attached to this paragraph. - If pos == -2, use the label font of the layout attached here. - In all cases, the font is instantiated, i.e. does not have any - attributes with values LyXFont::INHERIT, LyXFont::IGNORE or - LyXFont::TOGGLE. - */ - LyXFont const getFont(BufferParams const &, size_type pos) const; - /// - value_type GetChar(size_type pos) const; - /// - value_type GetUChar(BufferParams const &, size_type pos) const; - /// The position must already exist. - void SetChar(size_type pos, value_type c); - /// - void SetFont(size_type pos, LyXFont const & font); - /// - string const GetWord(size_type &) const; - /// Returns the height of the highest font in range - LyXFont::FONT_SIZE HighestFontInRange(size_type startpos, - size_type endpos) const; - /// - void InsertChar(size_type pos, value_type c); - /// - void InsertChar(size_type pos, value_type c, LyXFont const &); - /// - void InsertInset(size_type pos, Inset * inset); - /// - void InsertInset(size_type pos, Inset * inset, LyXFont const &); - /// - bool InsertInsetAllowed(Inset * inset); - /// - Inset * GetInset(size_type pos); - /// - Inset const * GetInset(size_type pos) const; - /** important for cut and paste - Temporary change from BufferParams to Buffer. Will revert when we - get rid of the argument to Inset::Clone(Buffer const &) */ - void CopyIntoMinibuffer(Buffer const &, size_type pos) const; - /// - void CutIntoMinibuffer(BufferParams const &, size_type pos); - /// - bool InsertFromMinibuffer(size_type pos); - - /// - bool IsHfill(size_type pos) const; - /// - bool IsInset(size_type pos) const; - /// - bool IsNewline(size_type pos) const; - /// - bool IsSeparator(size_type pos) const; - /// - bool IsLineSeparator(size_type pos) const; - /// - bool IsKomma(size_type pos) const; - /// Used by the spellchecker - bool IsLetter(size_type pos) const; - /// - bool IsWord(size_type pos) const; - - /** This one resets all layout and dtp switches but not the font - of the single characters - */ - void Clear(); - - /** paste this paragraph with the next one - be carefull, this doesent make any check at all - */ - void PasteParagraph(BufferParams const &); - - /// used to remove the error messages - int AutoDeleteInsets(); - - /// returns -1 if inset not found - int GetPositionOfInset(Inset * inset) const; - - /// - int StripLeadingSpaces(LyXTextClassList::size_type tclass); - -#ifndef NO_PEXTRA_REALLY - /* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE - I have to set it on each of it's elements */ - /// - void SetPExtraType(BufferParams const &, int type, - string const & width, string const & widthp); - /// - void UnsetPExtraType(BufferParams const &); -#endif - /// - bool linuxDocConvertChar(char c, string & sgml_string); -private: - /// - struct InsetTable { - /// - size_type pos; - /// - Inset * inset; - /// - InsetTable(size_type p, Inset * i) : pos(p), inset(i) {} - }; - /// - friend struct matchIT; - /// - struct matchIT { - /// used by lower_bound and upper_bound - inline - int operator()(LyXParagraph::InsetTable const & a, - LyXParagraph::InsetTable const & b) const { - return a.pos < b.pos; - } - }; - /** A font entry covers a range of positions. Notice that the - entries in the list are inserted in random order. - I don't think it's worth the effort to implement a more effective - datastructure, because the number of different fonts in a paragraph - is limited. (Asger) - Nevertheless, I decided to store fontlist using a sorted vector: - fontlist = { {pos_1,font_1} , {pos_2,font_2} , ... } where - pos_1 < pos_2 < ..., font_{i-1} != font_i for all i, - and font_i covers the chars in positions pos_{i-1}+1,...,pos_i - (font_1 covers the chars 0,...,pos_1) (Dekel) - */ - struct FontTable { - /// - FontTable(size_type p, LyXFont const & f) - : pos_(p) - { - font_ = container.get(f); - } - /// - size_type pos() const { return pos_; } - /// - void pos(size_type p) { pos_ = p; } - /// - LyXFont const & font() const { return *font_; } - /// - void font(LyXFont const & f) { font_ = container.get(f);} - private: - /// End position of paragraph this font attribute covers - size_type pos_; - /** Font. Interpretation of the font values: - If a value is LyXFont::INHERIT_*, it means that the font - attribute is inherited from either the layout of this - paragraph or, in the case of nested paragraphs, from the - layout in the environment one level up until completely - resolved. - The values LyXFont::IGNORE_* and LyXFont::TOGGLE are NOT - allowed in these font tables. - */ - boost::shared_ptr font_; - /// - static ShareContainer container; - }; - /// - friend struct matchFT; - /// - struct matchFT { - /// used by lower_bound and upper_bound - inline - int operator()(LyXParagraph::FontTable const & a, - LyXParagraph::FontTable const & b) const { - return a.pos() < b.pos(); - } - }; - - /// - typedef std::vector FontList; - /// - FontList fontlist; - /// - typedef std::vector InsetList; - /// - InsetList insetlist; - /// - LyXParagraph * TeXDeeper(Buffer const *, BufferParams const &, - std::ostream &, TexRow & texrow); - /// - void SimpleTeXBlanks(std::ostream &, TexRow & texrow, - size_type const i, - int & column, LyXFont const & font, - LyXLayout const & style); - /// - void SimpleTeXSpecialChars(Buffer const *, BufferParams const &, - std::ostream &, TexRow & texrow, - bool moving_arg, - LyXFont & font, LyXFont & running_font, - LyXFont & basefont, bool & open_font, - LyXLayout const & style, - size_type & i, - int & column, value_type const c); - /// - unsigned int id_; - /// - static unsigned int paragraph_id; -public: - /// - class inset_iterator { - public: - /// - inset_iterator() {} - // - inset_iterator(InsetList::iterator const & iter) : it(iter) {}; - /// - inset_iterator & operator++() { - ++it; - return *this; - } - /// - Inset * operator*() { return (*it).inset; } - /// - size_type getPos() const {return (*it).pos; } - /// - bool operator==(inset_iterator const & iter) const { - return it == iter.it; - } - /// - bool operator!=(inset_iterator const & iter) const { - return it != iter.it; - } - private: - /// - InsetList::iterator it; - }; - /// - inset_iterator inset_iterator_begin(); - /// - inset_iterator inset_iterator_end(); - /// - inset_iterator InsetIterator(size_type pos); -}; - - -inline -LyXParagraph::size_type LyXParagraph::size() const -{ - return text.size(); -} - - -inline -LyXParagraph::value_type -LyXParagraph::GetChar(LyXParagraph::size_type pos) const -{ - lyx::Assert(pos <= size()); - // This is stronger, and I belive that this is the assertion - // that we should really use. (Lgb) - //Assert(pos < size()); - - // Then this has no meaning. (Lgb) - if (!size() || pos == size()) return '\0'; - - return text[pos]; -} - - -inline -int LyXParagraph::id() const -{ - return id_; -} - - -inline -void LyXParagraph::id(int id_arg) -{ - id_ = id_arg; -} - - -inline -LyXTextClass::size_type LyXParagraph::GetLayout() const -{ - return layout; -} - - -inline -bool LyXParagraph::IsFirstInSequence() const -{ - LyXParagraph const * dhook = DepthHook(GetDepth()); - return (dhook == this - || dhook->GetLayout() != GetLayout() - || dhook->GetDepth() != GetDepth()); -} - - -inline -Inset * LyXParagraph::InInset() -{ - return inset_owner; -} - - -inline -void LyXParagraph::clearContents() -{ - text.clear(); -} - - -inline -void LyXParagraph::setCounter(int i, int v) -{ - counter_[i] = v; -} - - -inline -int LyXParagraph::getCounter(int i) const -{ - return counter_[i]; -} - - -inline -void LyXParagraph::incCounter(int i) -{ - counter_[i]++; -} - - -inline -void LyXParagraph::SetChar(size_type pos, value_type c) -{ - text[pos] = c; -} - - -inline -LyXParagraph::inset_iterator LyXParagraph::inset_iterator_begin() -{ - return inset_iterator(insetlist.begin()); -} - - -inline -LyXParagraph::inset_iterator LyXParagraph::inset_iterator_end() -{ - return inset_iterator(insetlist.end()); -} -#endif diff --git a/src/lyxrow.C b/src/lyxrow.C index 748dddda1a..8cb91b8465 100644 --- a/src/lyxrow.C +++ b/src/lyxrow.C @@ -23,19 +23,19 @@ Row::Row() {} -void Row::par(LyXParagraph * p) +void Row::par(Paragraph * p) { par_ = p; } -void Row::pos(LyXParagraph::size_type p) +void Row::pos(Paragraph::size_type p) { pos_ = p; } -LyXParagraph::size_type Row::pos() const +Paragraph::size_type Row::pos() const { return pos_; } diff --git a/src/lyxrow.h b/src/lyxrow.h index 291c60da1a..c28fc04381 100644 --- a/src/lyxrow.h +++ b/src/lyxrow.h @@ -16,7 +16,7 @@ #pragma interface #endif -#include "lyxparagraph.h" +#include "paragraph.h" /// class Row { @@ -24,15 +24,15 @@ public: /// Row(); /// - void par(LyXParagraph * p); + void par(Paragraph * p); /// - LyXParagraph * par(); + Paragraph * par(); /// - LyXParagraph * par() const; + Paragraph * par() const; /// - void pos(LyXParagraph::size_type p); + void pos(Paragraph::size_type p); /// - LyXParagraph::size_type pos() const; + Paragraph::size_type pos() const; /// void fill(int f); /// @@ -63,9 +63,9 @@ public: Row * previous() const; private: /// - LyXParagraph * par_; + Paragraph * par_; /// - LyXParagraph::size_type pos_; + Paragraph::size_type pos_; /** what is missing to a full row can be negative. Needed for hfills, flushright, block etc. */ mutable int fill_; @@ -85,14 +85,14 @@ private: inline -LyXParagraph * Row::par() +Paragraph * Row::par() { return par_; } inline -LyXParagraph * Row::par() const +Paragraph * Row::par() const { return par_; } diff --git a/src/lyxscreen.h b/src/lyxscreen.h index e37529607d..7ecfa3561a 100644 --- a/src/lyxscreen.h +++ b/src/lyxscreen.h @@ -50,6 +50,9 @@ public: /// LyXScreen(WorkArea &); + /// + ~LyXScreen(); + /// Sets the cursor color to LColor::cursor. void setCursorColor(); diff --git a/src/lyxtext.h b/src/lyxtext.h index 413ec2a6e1..a7d11dbefa 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -19,9 +19,10 @@ #include "lyxfont.h" #include "undo.h" #include "lyxcursor.h" -#include "lyxparagraph.h" +#include "paragraph.h" #include "layout.h" #include "lyxrow.h" +#include "vspace.h" class Buffer; class BufferParams; @@ -76,87 +77,87 @@ public: UpdatableInset * the_locking_inset; /// - int GetRealCursorX(BufferView *) const; + int getRealCursorX(BufferView *) const; /// - LyXFont const GetFont(Buffer const *, LyXParagraph * par, - LyXParagraph::size_type pos) const; + LyXFont const getFont(Buffer const *, Paragraph * par, + Paragraph::size_type pos) const; /// - void SetCharFont(Buffer const *, LyXParagraph * par, - LyXParagraph::size_type pos, LyXFont const & font); - void SetCharFont(BufferView *, LyXParagraph * par, - LyXParagraph::size_type pos, + void setCharFont(Buffer const *, Paragraph * par, + Paragraph::size_type pos, LyXFont const & font); + void setCharFont(BufferView *, Paragraph * par, + Paragraph::size_type pos, LyXFont const & font, bool toggleall); - /// returns a pointer to the very first LyXParagraph - LyXParagraph * FirstParagraph() const; + /// returns a pointer to the very first Paragraph + Paragraph * firstParagraph() const; /// what you expect when pressing at cursor position - void BreakParagraph(BufferView *, char keep_layout = 0); + void breakParagraph(BufferView *, char keep_layout = 0); /** set layout over selection and make a total rebreak of those paragraphs */ - LyXParagraph * SetLayout(BufferView *, LyXCursor & actual_cursor, + Paragraph * setLayout(BufferView *, LyXCursor & actual_cursor, LyXCursor & selection_start, LyXCursor & selection_end, LyXTextClass::size_type layout); - void SetLayout(BufferView *, LyXTextClass::size_type layout); + void setLayout(BufferView *, LyXTextClass::size_type layout); /// used in setlayout - void MakeFontEntriesLayoutSpecific(Buffer const *, LyXParagraph * par); + void makeFontEntriesLayoutSpecific(Buffer const *, Paragraph * par); /** increment depth over selection and make a total rebreak of those paragraphs */ - void IncDepth(BufferView *); + void incDepth(BufferView *); /** decrement depth over selection and make a total rebreak of those paragraphs */ - void DecDepth(BufferView *); + void decDepth(BufferView *); /** Get the depth at current cursor position */ - int GetDepth() const { return cursor.par()->GetDepth(); } + int getDepth() const { return cursor.par()->getDepth(); } /** set font over selection and make a total rebreak of those paragraphs. toggleall defaults to false. */ - void SetFont(BufferView *, LyXFont const &, bool toggleall = false); + void setFont(BufferView *, LyXFont const &, bool toggleall = false); /** deletes and inserts again all paragaphs between the cursor and the specified par. The Cursor is needed to set the refreshing parameters. This function is needed after SetLayout and SetFont etc. */ - void RedoParagraphs(BufferView *, LyXCursor const & cursor, - LyXParagraph const * end_par) const; + void redoParagraphs(BufferView *, LyXCursor const & cursor, + Paragraph const * end_par) const; /// - void RedoParagraph(BufferView *) const; + void redoParagraph(BufferView *) const; /// - void ToggleFree(BufferView *, LyXFont const &, bool toggleall = false); + void toggleFree(BufferView *, LyXFont const &, bool toggleall = false); /** recalculates the heights of all previous rows of the specified paragraph. needed, if the last characters font has changed. */ - void RedoHeightOfParagraph(BufferView *, LyXCursor const & cursor); + void redoHeightOfParagraph(BufferView *, LyXCursor const & cursor); /** forces the redrawing of a paragraph. Needed when manipulating a right address box */ - void RedoDrawingOfParagraph(BufferView *, LyXCursor const & cursor); + void redoDrawingOfParagraph(BufferView *, LyXCursor const & cursor); /** insert a character, moves all the following breaks in the same Paragraph one to the right and make a little rebreak */ - void InsertChar(BufferView *, char c); + void insertChar(BufferView *, char c); /// - void InsertInset(BufferView *, Inset * inset); + void insertInset(BufferView *, Inset * inset); /** Completes the insertion with a full rebreak. Returns true if something was broken. */ - bool FullRebreak(BufferView *); + bool fullRebreak(BufferView *); /// Row * need_break_row; @@ -182,23 +183,23 @@ public: (relative to the whole text). y is set to the real beginning of this row */ - Row * GetRowNearY(int & y) const; + Row * getRowNearY(int & y) const; /** returns the column near the specified x-coordinate of the row x is set to the real beginning of this column */ - int GetColumnNearX(BufferView *, Row * row, + int getColumnNearX(BufferView *, Row * row, int & x, bool & boundary) const; /** returns a pointer to a specified row. y is set to the beginning of the row */ - Row * GetRow(LyXParagraph * par, - LyXParagraph::size_type pos, int & y) const; + Row * getRow(Paragraph * par, + Paragraph::size_type pos, int & y) const; /** returns the height of a default row, needed for scrollbar */ - int DefaultHeight() const; + int defaultHeight() const; /** The cursor. Later this variable has to be removed. There should be now internal @@ -257,91 +258,91 @@ public: LyXCursor toggle_end_cursor; /// need the selection cursor: - void SetSelection(BufferView *); + void setSelection(BufferView *); /// - void ClearSelection(BufferView *) const; + void clearSelection(BufferView *) const; /// string const selectionAsString(Buffer const *) const; /// just selects the word the cursor is in - void SelectWord(BufferView *); + void selectWord(BufferView *); /** 'selects" the next word, where the cursor is not in and returns this word as string. THe cursor will be moved to the beginning of this word. With SelectSelectedWord can this be highlighted really */ - string const SelectNextWord(BufferView *, float & value) const; + string const selectNextWord(BufferView *, float & value) const; /// - void SelectSelectedWord(BufferView *); + void selectSelectedWord(BufferView *); /// - void SetCursor(BufferView *, LyXParagraph * par, - LyXParagraph::size_type pos, + void setCursor(BufferView *, Paragraph * par, + Paragraph::size_type pos, bool setfont = true, bool boundary = false) const; /// - void SetCursor(BufferView *, LyXCursor &, LyXParagraph * par, - LyXParagraph::size_type pos, + void setCursor(BufferView *, LyXCursor &, Paragraph * par, + Paragraph::size_type pos, bool boundary = false) const; /// - void SetCursorIntern(BufferView *, LyXParagraph * par, - LyXParagraph::size_type pos, + void setCursorIntern(BufferView *, Paragraph * par, + Paragraph::size_type pos, bool setfont = true, bool boundary = false) const; /// - void SetCurrentFont(BufferView *) const; + void setCurrentFont(BufferView *) const; /// - bool IsBoundary(Buffer const *, LyXParagraph * par, - LyXParagraph::size_type pos) const; + bool isBoundary(Buffer const *, Paragraph * par, + Paragraph::size_type pos) const; /// - bool IsBoundary(Buffer const *, LyXParagraph * par, - LyXParagraph::size_type pos, + bool isBoundary(Buffer const *, Paragraph * par, + Paragraph::size_type pos, LyXFont const & font) const; /// - void SetCursorFromCoordinates(BufferView *, int x, int y) const; + void setCursorFromCoordinates(BufferView *, int x, int y) const; /// - void SetCursorFromCoordinates(BufferView *, LyXCursor &, + void setCursorFromCoordinates(BufferView *, LyXCursor &, int x, int y) const; /// - void CursorUp(BufferView *) const; + void cursorUp(BufferView *) const; /// - void CursorDown(BufferView *) const; + void cursorDown(BufferView *) const; /// - void CursorLeft(BufferView *, bool internal = true) const; + void cursorLeft(BufferView *, bool internal = true) const; /// - void CursorRight(BufferView *, bool internal = true) const; + void cursorRight(BufferView *, bool internal = true) const; /// - void CursorLeftOneWord(BufferView *) const; + void cursorLeftOneWord(BufferView *) const; /// - void CursorRightOneWord(BufferView *) const; + void cursorRightOneWord(BufferView *) const; /// - void CursorUpParagraph(BufferView *) const; + void cursorUpParagraph(BufferView *) const; /// - void CursorDownParagraph(BufferView *) const; + void cursorDownParagraph(BufferView *) const; /// - void CursorHome(BufferView *) const; + void cursorHome(BufferView *) const; /// - void CursorEnd(BufferView *) const; + void cursorEnd(BufferView *) const; /// - void CursorTab(BufferView *) const; + void cursorTab(BufferView *) const; /// - void CursorTop(BufferView *) const; + void cursorTop(BufferView *) const; /// - void CursorBottom(BufferView *) const; + void cursorBottom(BufferView *) const; /// void Delete(BufferView *); /// - void Backspace(BufferView *); + void backspace(BufferView *); /// - void DeleteWordForward(BufferView *); + void deleteWordForward(BufferView *); /// - void DeleteWordBackward(BufferView *); + void deleteWordBackward(BufferView *); /// - void DeleteLineForward(BufferView *); + void deleteLineForward(BufferView *); /// - bool SelectWordWhenUnderCursor(BufferView *); + bool selectWordWhenUnderCursor(BufferView *); /// enum TextCase { /// @@ -352,34 +353,35 @@ public: text_uppercase = 2 }; /// Change the case of the word at cursor position. - void ChangeWordCase(BufferView *, TextCase action); - void TransposeChars(BufferView const &); + void changeWordCase(BufferView *, TextCase action); + /// + void transposeChars(BufferView const &); /** returns a printed row in a pixmap. The y value is needed to decide, wether it is selected text or not. This is a strange solution but faster. */ - void GetVisibleRow(BufferView *, int y_offset, int x_offset, + void getVisibleRow(BufferView *, int y_offset, int x_offset, Row * row_ptr, int y, bool cleared=false); /// - void CutSelection(BufferView *, bool = true); + void cutSelection(BufferView *, bool = true); /// - void CopySelection(BufferView *); + void copySelection(BufferView *); /// - void PasteSelection(BufferView *); + void pasteSelection(BufferView *); /// void copyEnvironmentType(); /// void pasteEnvironmentType(BufferView *); /// - void InsertFootnote(); + void insertFootnote(); /// - void InsertMarginpar(); + void insertMarginpar(); /// - void InsertFigure(); + void insertFigure(); /// - void InsertTabular(); + void insertTabular(); /** the DTP switches for paragraphs. LyX will store the top settings always in the first physical paragraph, the bottom settings in the @@ -387,7 +389,7 @@ public: settings are given to the new one. So I can make shure, they do not duplicate themself (and you cannnot make dirty things with them! ) */ - void SetParagraph(BufferView *, + void setParagraph(BufferView *, bool line_top, bool line_bottom, bool pagebreak_top, bool pagebreak_bottom, VSpace const & space_top, @@ -401,81 +403,81 @@ public: /** sets the selection over the number of characters of string, no check!! */ - void SetSelectionOverString(BufferView *, string const & str); + void setSelectionOverString(BufferView *, string const & str); /** simple replacing. The font of the first selected character is used */ - void ReplaceSelectionWithString(BufferView *, string const & str); + void replaceSelectionWithString(BufferView *, string const & str); /// needed to insert the selection - void InsertStringA(BufferView *, string const & str); + void insertStringAsLines(BufferView *, string const & str); /// needed to insert the selection - void InsertStringB(BufferView *, string const & str); + void insertStringAsParagraphs(BufferView *, string const & str); /// Find next inset of some specified type. - bool GotoNextInset(BufferView *, std::vector const & codes, + bool gotoNextInset(BufferView *, std::vector const & codes, string const & contents = string()) const; /// /* for the greater insets */ /// returns false if inset wasn't found - bool UpdateInset(BufferView *, Inset *); + bool updateInset(BufferView *, Inset *); /// - void CheckParagraph(BufferView *, LyXParagraph * par, - LyXParagraph::size_type pos); + void checkParagraph(BufferView *, Paragraph * par, + Paragraph::size_type pos); /// - int NumberOfCell(LyXParagraph * par, - LyXParagraph::size_type pos) const; + int numberOfCell(Paragraph * par, + Paragraph::size_type pos) const; /// - LyXParagraph * GetParFromID(int id); + Paragraph * getParFromID(int id); // undo functions /// returns false if no undo possible - bool TextUndo(BufferView *); + bool textUndo(BufferView *); /// returns false if no redo possible - bool TextRedo(BufferView *); + bool textRedo(BufferView *); /// used by TextUndo/TextRedo - bool TextHandleUndo(BufferView *, Undo * undo); + bool textHandleUndo(BufferView *, Undo * undo); /// makes sure the next operation will be stored - void FinishUndo(); + void finishUndo(); /// this is dangerous and for internal use only - void FreezeUndo(); + void freezeUndo(); /// this is dangerous and for internal use only - void UnFreezeUndo(); + void unFreezeUndo(); /// the flag used by FinishUndo(); mutable bool undo_finished; /// a flag bool undo_frozen; /// - void SetUndo(Buffer *, Undo::undo_kind kind, - LyXParagraph const * before, - LyXParagraph const * end) const; + void setUndo(Buffer *, Undo::undo_kind kind, + Paragraph const * before, + Paragraph const * end) const; /// - void SetRedo(Buffer *, Undo::undo_kind kind, - LyXParagraph const * before, - LyXParagraph const * end); + void setRedo(Buffer *, Undo::undo_kind kind, + Paragraph const * before, + Paragraph const * end); /// - Undo * CreateUndo(Buffer *, Undo::undo_kind kind, - LyXParagraph const * before, - LyXParagraph const * end) const; + Undo * createUndo(Buffer *, Undo::undo_kind kind, + Paragraph const * before, + Paragraph const * end) const; /// for external use in lyx_cb.C - void SetCursorParUndo(Buffer *); + void setCursorParUndo(Buffer *); /// - void RemoveTableRow(LyXCursor & cursor) const; + void removeTableRow(LyXCursor & cursor) const; /// - bool IsEmptyTableCell() const; + bool isEmptyTableCell() const; /// void toggleAppendix(BufferView *); /// int workWidth(BufferView *) const; /// - void ComputeBidiTables(Buffer const *, Row * row) const; + void computeBidiTables(Buffer const *, Row * row) const; /// Maps positions in the visual string to positions in logical string. inline - LyXParagraph::size_type log2vis(LyXParagraph::size_type pos) const { + Paragraph::size_type log2vis(Paragraph::size_type pos) const { if (bidi_start == -1) return pos; else @@ -484,7 +486,7 @@ public: /// Maps positions in the logical string to positions in visual string. inline - LyXParagraph::size_type vis2log(LyXParagraph::size_type pos) const { + Paragraph::size_type vis2log(Paragraph::size_type pos) const { if (bidi_start == -1) return pos; else @@ -492,7 +494,7 @@ public: } /// inline - LyXParagraph::size_type bidi_level(LyXParagraph::size_type pos) const { + Paragraph::size_type bidi_level(Paragraph::size_type pos) const { if (bidi_start == -1) return 0; else @@ -500,7 +502,7 @@ public: } /// inline - bool bidi_InRange(LyXParagraph::size_type pos) const { + bool bidi_InRange(Paragraph::size_type pos) const { return bidi_start == -1 || (bidi_start <= pos && pos <= bidi_end); } @@ -520,145 +522,145 @@ private: /** inserts a new row behind the specified row, increments the touched counters */ - void InsertRow(Row * row, LyXParagraph * par, - LyXParagraph::size_type pos) const; + void insertRow(Row * row, Paragraph * par, + Paragraph::size_type pos) const; /** removes the row and reset the touched counters */ - void RemoveRow(Row * row) const; + void removeRow(Row * row) const; /** remove all following rows of the paragraph of the specified row. */ - void RemoveParagraph(Row * row) const; + void removeParagraph(Row * row) const; /** insert the specified paragraph behind the specified row */ - void InsertParagraph(BufferView *, - LyXParagraph * par, Row * row) const; + void insertParagraph(BufferView *, + Paragraph * par, Row * row) const; /** appends the implizit specified paragraph behind the specified row, * start at the implizit given position */ - void AppendParagraph(BufferView *, Row * row) const; + void appendParagraph(BufferView *, Row * row) const; /// - void BreakAgain(BufferView *, Row * row) const; + void breakAgain(BufferView *, Row * row) const; /// - void BreakAgainOneRow(BufferView *, Row * row); + void breakAgainOneRow(BufferView *, Row * row); /// Calculate and set the height of the row - void SetHeightOfRow(BufferView *, Row * row_ptr) const; + void setHeightOfRow(BufferView *, Row * row_ptr) const; /** this calculates the specified parameters. needed when setting * the cursor and when creating a visible row */ - void PrepareToPrint(BufferView *, Row * row, float & x, + void prepareToPrint(BufferView *, Row * row, float & x, float & fill_separator, float & fill_hfill, float & fill_label_hfill, bool bidi = true) const; /// - void DeleteEmptyParagraphMechanism(BufferView *, + void deleteEmptyParagraphMechanism(BufferView *, LyXCursor const & old_cursor) const; /** Updates all counters starting BEHIND the row. Changed paragraphs * with a dynamic left margin will be rebroken. */ - void UpdateCounters(BufferView *, Row * row) const; + void updateCounters(BufferView *, Row * row) const; /// - void SetCounter(Buffer const *, LyXParagraph * par) const; + void setCounter(Buffer const *, Paragraph * par) const; /* * some low level functions */ /// - int SingleWidth(BufferView *, LyXParagraph * par, - LyXParagraph::size_type pos) const; + int singleWidth(BufferView *, Paragraph * par, + Paragraph::size_type pos) const; /// - int SingleWidth(BufferView *, LyXParagraph * par, - LyXParagraph::size_type pos, char c) const; + int singleWidth(BufferView *, Paragraph * par, + Paragraph::size_type pos, char c) const; /// void draw(BufferView *, Row const * row, - LyXParagraph::size_type & pos, + Paragraph::size_type & pos, int offset, float & x, bool cleared); /// get the next breakpoint in a given paragraph - LyXParagraph::size_type NextBreakPoint(BufferView *, Row const * row, + Paragraph::size_type nextBreakPoint(BufferView *, Row const * row, int width) const; /// returns the minimum space a row needs on the screen in pixel - int Fill(BufferView *, Row * row, int workwidth) const; + int fill(BufferView *, Row * row, int workwidth) const; /** returns the minimum space a manual label needs on the screen in pixel */ - int LabelFill(BufferView *, Row const * row) const; + int labelFill(BufferView *, Row const * row) const; /// - LyXParagraph::size_type - BeginningOfMainBody(Buffer const *, LyXParagraph const * par) const; + Paragraph::size_type + beginningOfMainBody(Buffer const *, Paragraph const * par) const; /** Returns the left beginning of the text. This information cannot be taken from the layouts-objekt, because in LaTeX the beginning of the text fits in some cases (for example sections) exactly the label-width. */ - int LeftMargin(BufferView *, Row const * row) const; + int leftMargin(BufferView *, Row const * row) const; /// - int RightMargin(Buffer const *, Row const * row) const; + int rightMargin(Buffer const *, Row const * row) const; /// - int LabelEnd (BufferView *, Row const * row) const; + int labelEnd (BufferView *, Row const * row) const; /** returns the number of separators in the specified row. The separator on the very last column doesnt count */ - int NumberOfSeparators(Buffer const *, Row const * row) const; + int numberOfSeparators(Buffer const *, Row const * row) const; /** returns the number of hfills in the specified row. The LyX-Hfill is a LaTeX \hfill so that the hfills at the beginning and at the end were ignored. This is {\em MUCH} more usefull than not to ignore! */ - int NumberOfHfills(Buffer const *, Row const * row) const; + int numberOfHfills(Buffer const *, Row const * row) const; /// like NumberOfHfills, but only those in the manual label! - int NumberOfLabelHfills(Buffer const *, Row const * row) const; + int numberOfLabelHfills(Buffer const *, Row const * row) const; /** returns true, if a expansion is needed. Rules are given by LaTeX */ - bool HfillExpansion(Buffer const *, Row const * row_ptr, - LyXParagraph::size_type pos) const; + bool hfillExpansion(Buffer const *, Row const * row_ptr, + Paragraph::size_type pos) const; /// - mutable std::vector log2vis_list; + mutable std::vector log2vis_list; /// - mutable std::vector vis2log_list; + mutable std::vector vis2log_list; /// - mutable std::vector bidi_levels; + mutable std::vector bidi_levels; /// - mutable LyXParagraph::size_type bidi_start; + mutable Paragraph::size_type bidi_start; /// - mutable LyXParagraph::size_type bidi_end; + mutable Paragraph::size_type bidi_end; /// mutable bool bidi_same_direction; /// - unsigned char TransformChar(unsigned char c, LyXParagraph * par, - LyXParagraph::size_type pos) const; + unsigned char transformChar(unsigned char c, Paragraph * par, + Paragraph::size_type pos) const; /** returns the paragraph position of the last character in the specified row */ - LyXParagraph::size_type RowLast(Row const * row) const; + Paragraph::size_type rowLast(Row const * row) const; /// - LyXParagraph::size_type RowLastPrintable(Row const * row) const; + Paragraph::size_type rowLastPrintable(Row const * row) const; /// void charInserted(); // // special owner functions /// - LyXParagraph * OwnerParagraph() const; + Paragraph * ownerParagraph() const; // - LyXParagraph * OwnerParagraph(LyXParagraph *) const; + Paragraph * ownerParagraph(Paragraph *) const; }; @@ -666,7 +668,7 @@ private: * (relative to the whole text). y is set to the real beginning * of this row */ inline -Row * LyXText::GetRowNearY(int & y) const +Row * LyXText::getRowNearY(int & y) const { // If possible we should optimize this method. (Lgb) Row * tmprow = firstrow; diff --git a/src/lyxvc.C b/src/lyxvc.C index 11946528e2..b921cfb042 100644 --- a/src/lyxvc.C +++ b/src/lyxvc.C @@ -12,6 +12,7 @@ #include "debug.h" #include "lyx_gui_misc.h" #include "buffer.h" +#include "BufferView.h" #include "gettext.h" #include "support/filetools.h" #include "support/lyxlib.h" diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 4c08132b0d..a4e88d22d8 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,26 @@ +2001-06-24 The LyX Project + + * math_inset.C: Cursor movement is better in square roots, among + other things. + + * math_cursor.C (Interpret): Improved subscript bullshit. Improved + cursor up/down movement. What not. + +2001-06-24 The LyX Project + + * math_matrixinset.C: Hidden labels are hidden, unless a small + dragon jumps out of the screen, and pronounce them to the entire + world. + +2001-06-24 The LyX Project + + * math_cursor.C: Cursor improvements after a few dead-ends + in the evolution of cursor movement were tested and scrapped. + +2001-06-24 The LyX Project + + * math_cursor.C: Renamed stack to path. + 2001-06-19 Angus Leeming * math_macro.C: @@ -41,11 +64,14 @@ * math_parser.C: fix \frac handling bug introduced on 04-24 * math_xiter.C: hotfix for merging "shared" insets + * formula.C: fixing display after using math-insert 2001-04-25 André Pönitz * math_*.[Ch]: WriteNormal * formula.C: Support for new "math extern" command + * math_parser.C: fix \frac handling bug introduced on 04-24 + * math_xiter.C: hotfix for merging "shared" insets 2001-04-25 Lars Gullik Bjønnes diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index 58b7589ef0..34af4fca28 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -10,14 +10,18 @@ INCLUDES = -I${srcdir}/../ $(SIGC_CFLAGS) $(BOOST_INCLUDES) libmathed_la_SOURCES = \ array.C \ array.h \ + xarray.C \ + xarray.h \ + formulabase.C \ + formulabase.h \ formula.C \ formula.h \ formulamacro.C \ formulamacro.h \ macro_support.C \ macro_support.h \ - math_sqrtinset.C \ - math_sqrtinset.h \ + math_arrayinset.C \ + math_arrayinset.h \ math_accentinset.C \ math_accentinset.h \ math_bigopinset.C \ @@ -35,11 +39,11 @@ libmathed_la_SOURCES = \ math_fracinset.h \ math_funcinset.C \ math_funcinset.h \ + math_grid.C \ + math_grid.h \ math_hash.C \ math_inset.C \ math_inset.h \ - math_iter.C \ - math_iter.h \ math_macro.C \ math_macro.h \ math_macroarg.C \ @@ -50,20 +54,20 @@ libmathed_la_SOURCES = \ math_macrotable.h \ math_matrixinset.C \ math_matrixinset.h \ - math_parinset.C \ - math_parinset.h \ math_parser.C \ math_parser.h \ math_root.C \ math_root.h \ - math_rowst.C \ - math_rowst.h \ + math_scriptinset.C \ + math_scriptinset.h \ + math_sizeinset.C \ + math_sizeinset.h \ math_spaceinset.C \ math_spaceinset.h \ + math_sqrtinset.C \ + math_sqrtinset.h \ math_utils.C \ math_utils.h \ - math_xiter.C \ - math_xiter.h \ matriz.C \ matriz.h \ support.C \ diff --git a/src/mathed/array.C b/src/mathed/array.C index 85f1e88b80..acbecb1230 100644 --- a/src/mathed/array.C +++ b/src/mathed/array.C @@ -7,379 +7,315 @@ #include "debug.h" #include "array.h" -#include "math_iter.h" #include "math_inset.h" -#include "math_macro.h" +#include "math_scriptinset.h" +#include "math_parser.h" +#include "mathed/support.h" -#include "support/LOstream.h" - -using std::ostream; -using std::endl; - -#ifndef CXX_GLOBAL_CSTD -using std::memmove; -#endif +using namespace std; -namespace { - -inline -void * my_memcpy(void * ps_in, void const * pt_in, size_t n) -{ - char * ps = static_cast(ps_in); - char const * pt = static_cast(pt_in); - while (n--) *ps++ = *pt++; - return ps_in; -} - -} // namespace anon - - -MathedArray::MathedArray() - : bf_(1, '\0'), last_(0) +MathArray::MathArray() {} -MathedArray::~MathedArray() +MathArray::~MathArray() { - // deep destruction - // let's leak for a while... -/* - MathedIter it; - it.SetData(this); - while (it.OK()) { - if (it.IsInset()) { - MathedInset * inset = it.GetInset(); - delete inset; - } - it.Next(); + for (int pos = 0; pos < size(); next(pos)) + if (MathIsInset(pos)) + delete GetInset(pos); +} + + +MathArray::MathArray(MathArray const & array) + : bf_(array.bf_) +{ + for (int pos = 0; pos < size(); next(pos)) + if (isInset(pos)) + replace(pos, GetInset(pos)->Clone()); +} + + +bool MathArray::next(int & pos) const +{ + if (pos >= size() - 1) + return false; + + pos += item_size(pos); + return true; +} + + +bool MathArray::prev(int & pos) const +{ + if (pos == 0) + return false; + + pos -= item_size(pos - 1); + return true; +} + + +bool MathArray::last(int & pos) const +{ + pos = bf_.size(); + return prev(pos); +} + + +int MathArray::item_size(int pos) const +{ + return 2 + (isInset(pos) ? sizeof(MathInset*) : 1); +} + + + +void MathArray::substitute(MathMacro const & m) +{ + MathArray tmp; + for (int pos = 0; pos < size(); next(pos)) { + if (isInset(pos)) + GetInset(pos)->substitute(tmp, m); + else + tmp.push_back(GetChar(pos), GetCode(pos)); } -*/ + swap(tmp); } -MathedArray::MathedArray(MathedArray const & array) +MathArray & MathArray::operator=(MathArray const & array) { - // this "implementation" is obviously wrong: MathedIter should be - // implemented by MathedArray (not the other way round) but I think - // getting the _interface_ of MathedArray right is more important right - // now (Andre') - - // shallow copy - bf_ = array.bf_; - last_ = array.last_; - - // deep copy - deep_copy(); -} - - -void MathedArray::deep_copy() -{ - MathedIter it(this); - while (it.OK()) { - if (it.IsInset()) { - MathedInset * inset = it.GetInset(); - inset = inset->Clone(); - raw_pointer_insert(inset, it.getPos() + 1); - } - it.Next(); - } -} - - -void MathedArray::substitute(MathMacro * m) -{ - if (m->nargs() == 0) - return; - - MathedIter it(this); - while (it.OK()) { - if (it.IsInset()) { - MathedInset * inset = it.GetInset(); - if (inset->GetType() == LM_OT_MACRO_ARG) { - int n = static_cast(inset)->number() - 1; - //lyxerr << "substituting an argument inset: " << n << "\n"; - inset = m->arg(n)->Clone(); - } else { - inset->substitute(m); -/* - if (it.IsActive()) { - MathParInset * pinset = static_cast(inset); - int n = pinset->getMaxArgumentIdx(); - int idx = pinset->getArgumentIdx(); - for (int i = 0; i <= n; ++i) { - pinset->setArgumentIdx(i); - pinset->GetData().substitute(m); - } - pinset->setArgumentIdx(idx); - } -*/ - - //lyxerr << "substituting in an ordinary inset\n"; - } - raw_pointer_insert(inset, it.getPos() + 1); - } - it.Next(); - } -} - - -MathedArray & MathedArray::operator=(MathedArray const & array) -{ - MathedArray tmp(array); + MathArray tmp(array); swap(tmp); return *this; } -void MathedArray::push_back(MathedInset * inset, int t) +MathInset * MathArray::GetInset(int pos) const { - MathedIter it(this); - while (it.Next()) - ; - it.insertInset(inset, t); + if (!isInset(pos)) + return 0; + MathInset * p; + memcpy(&p, bf_.begin() + pos + 1, sizeof(p)); + return p; +} + +char MathArray::GetChar(int pos) const +{ + return pos < size() ? bf_[pos + 1] : '\0'; +} + +MathTextCodes MathArray::GetCode(int pos) const +{ + return pos < size() ? MathTextCodes(bf_[pos]) : LM_TC_MIN; +} + +void MathArray::insert(int pos, MathInset * p) +{ + bf_.insert(bf_.begin() + pos, 2 + sizeof(p), LM_TC_INSET); + memcpy(&bf_[pos + 1], &p, sizeof(p)); } -void MathedArray::push_back(byte b, MathedTextCodes c) +void MathArray::replace(int pos, MathInset * p) { - MathedIter it(this); - while (it.Next()) - ; - it.insert(b, c); + memcpy(&bf_[pos + 1], &p, sizeof(p)); +} + +void MathArray::insert(int pos, char b, MathTextCodes t) +{ + bf_.insert(bf_.begin() + pos, 3, t); + bf_[pos + 1] = b; } -void MathedArray::clear() +void MathArray::insert(int pos, MathArray const & array) { - last_ = 0; - bf_.resize(1); - bf_[0] = 0; +#ifdef WITH_WARNINGS +#warning quick and really dirty: make sure that we really own our insets +#endif + MathArray a = array; + bf_.insert(bf_.begin() + pos, a.bf_.begin(), a.bf_.end()); } -void MathedArray::swap(MathedArray & array) +void MathArray::push_back(MathInset * p) +{ + insert(size(), p); +} + +void MathArray::push_back(char b, MathTextCodes c) { - if (this != &array) { + insert(size(), b, c); +} + +void MathArray::push_back(MathArray const & array) +{ + insert(size(), array); +} + + + +void MathArray::clear() +{ + bf_.clear(); +} + + +void MathArray::swap(MathArray & array) +{ + if (this != &array) bf_.swap(array.bf_); - std::swap(last_, array.last_); - } } -MathedArray::iterator MathedArray::begin() +bool MathArray::empty() const { - return bf_.begin(); -} - - -MathedArray::iterator MathedArray::end() -{ - return bf_.end(); -} - - -MathedArray::const_iterator MathedArray::begin() const -{ - return bf_.begin(); -} - - -MathedArray::const_iterator MathedArray::end() const -{ - return bf_.end(); -} - - -int MathedArray::empty() const -{ - return (last_ == 0); + return bf_.empty(); } -int MathedArray::last() const +int MathArray::size() const { - return last_; + return bf_.size(); } -void MathedArray::last(int l) +void MathArray::erase(int pos) { - last_ = l; + if (pos < bf_.size()) + erase(pos, pos + item_size(pos)); } -void MathedArray::need_size(int needed) +void MathArray::erase(int pos1, int pos2) { - if (needed >= static_cast(bf_.size())) - resize(needed); + bf_.erase(bf_.begin() + pos1, bf_.begin() + pos2); } -void MathedArray::resize(int newsize) +bool MathArray::isInset(int pos) const { - // still a bit smelly... - ++newsize; - bf_.resize(newsize + 1); - if (last_ >= newsize) - last_ = newsize - 1; - bf_[last_] = 0; + if (pos >= size()) + return false; + return MathIsInset(bf_[pos]); } -void MathedArray::move(int p, int shift) +MathInset * MathArray::back_inset() const { - if (p <= last_) { - need_size(last_ + shift); - memmove(&bf_[p + shift], &bf_[p], last_ - p); - last_ += shift; - bf_[last_] = 0; + if (!empty()) { + int pos = size(); + prev(pos); + if (isInset(pos)) + return GetInset(pos); } -} - - - -void MathedArray::shrink(int pos1, int pos2) -{ - if (pos1 == 0 && pos2 >= last()) - return; - - short fc = 0; - if (pos1 > 0 && bf_[pos1] > ' ') { - for (int p = pos1; p >= 0; --p) { - if (MathIsFont(bf_[p])) { - if (p != pos1 - 1) - fc = bf_[p]; - else - --pos1; - break; - } - } - } - - if (pos2 > 0 && bf_[pos2] >= ' ' && MathIsFont(bf_[pos2 - 1])) - --pos2; - - int dx = pos2 - pos1; - MathedArray a; - a.resize(dx + 1); - strange_copy(&a, (fc) ? 1 : 0, pos1, dx); - if (fc) { - a[0] = fc; - ++dx; - } - a.last(dx); - a[dx] = '\0'; - - swap(a); - deep_copy(); -} - - -#if 0 -void MathedArray::insert(MathedArray::iterator pos, - MathedArray::const_iterator beg, - MathedArray::const_iterator end) -{ - bf_.insert(pos, beg, end); - last_ = bf_.size() - 1; -} -#else -void MathedArray::merge(MathedArray const & a, int p) -{ - my_memcpy(&bf_[p], &a.bf_[0], a.last()); -} -#endif - - -void MathedArray::raw_pointer_copy(MathedInset ** p, int pos) const -{ - my_memcpy(p, &bf_[pos], sizeof(MathedInset*)); -} - - -#if 0 -void MathedArray::insertInset(int pos, MathedInset * p, int type) -{ - //bf_.insert(pos, type); - InsetTable tmp(pos, p); - insetList_.push_back(tmp); -} - - -MathedInset * MathedArray::getInset(int pos) -{ - InsetList::const_iterator cit = insetList_.begin(); - InsetList::const_iterator end = insetList_.end(); - for (; cit != end; ++cit) { - if ((*cit).pos == pos) - return (*cit).inset; - } - // not found return 0; - // We would really like to throw an exception instead... (Lgb) - // throw inset_not_found(); -} - -#else -void MathedArray::raw_pointer_insert(void * p, int pos) -{ - my_memcpy(&bf_[pos], &p, sizeof(p)); -} -#endif - - -void MathedArray::strange_copy(MathedArray * dest, int dpos, - int spos, int len) -{ - my_memcpy(&dest->bf_[dpos], &bf_[spos], len); } -byte MathedArray::operator[](int i) const +MathScriptInset * MathArray::prevScriptInset(int pos) const { - return bf_[i]; + if (!pos) + return 0; + prev(pos); + + MathInset * inset = GetInset(pos); + if (inset && inset->GetType() == LM_OT_SCRIPT) + return static_cast(inset); + + return 0; } -byte & MathedArray::operator[](int i) +void MathArray::dump2(ostream & os) const { - return bf_[i]; -} - - -void MathedArray::dump2(ostream & os) const -{ - buffer_type::const_iterator cit = bf_.begin(); - buffer_type::const_iterator end = bf_.end(); - for (; cit != end; ++cit) { - os << (*cit); - } + for (buffer_type::const_iterator it = bf_.begin(); it != bf_.end(); ++it) + os << int(*it) << ' '; os << endl; } -void MathedArray::dump(ostream & os) const + +void MathArray::dump(ostream & os) const { - MathedIter it( const_cast(this) ); - while (it.OK()) { - if (it.IsInset()) { - MathedInset * inset = it.GetInset(); - os << ""; - } - else if (it.IsTab()) - os << ""; - else if (it.IsCR()) - os << ""; - else if (it.IsScript()) - os << "