layout as layout

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4471 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-06-24 20:28:12 +00:00
parent 23f483a23e
commit 65d4b13616
68 changed files with 946 additions and 937 deletions

View File

@ -8,7 +8,6 @@ src/converter.C
src/CutAndPaste.C
src/debug.C
src/exporter.C
src/ext_l10n.h
src/FloatList.C
src/frontends/controllers/biblio.C
src/frontends/controllers/ButtonController.h
@ -24,7 +23,6 @@ src/frontends/controllers/ControlPreamble.C
src/frontends/controllers/ControlPrint.C
src/frontends/controllers/ControlSearch.C
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/ControlTexinfo.C
src/frontends/controllers/ControlThesaurus.C
src/frontends/controllers/ControlVCLog.C
src/frontends/controllers/frnt_lang.C
@ -51,6 +49,7 @@ src/frontends/qt2/QGraphics.C
src/frontends/qt2/QInclude.C
src/frontends/qt2/QIndex.C
src/frontends/qt2/QLog.C
src/frontends/qt2/QLyXKeySym.C
src/frontends/qt2/QMinipage.C
src/frontends/qt2/QParagraph.C
src/frontends/qt2/QParagraphDialog.C
@ -73,80 +72,43 @@ src/frontends/xforms/ColorHandler.C
src/frontends/xforms/combox.C
src/frontends/xforms/FeedbackController.C
src/frontends/xforms/FileDialog.C
src/frontends/xforms/form_aboutlyx.C
src/frontends/xforms/FormAboutlyx.C
src/frontends/xforms/form_bibitem.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/form_character.C
src/frontends/xforms/FormCharacter.C
src/frontends/xforms/form_citation.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/form_document.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/form_error.C
src/frontends/xforms/FormError.C
src/frontends/xforms/form_ert.C
src/frontends/xforms/FormERT.C
src/frontends/xforms/form_external.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/form_filedialog.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/form_float.C
src/frontends/xforms/FormFloat.C
src/frontends/xforms/form_forks.C
src/frontends/xforms/FormForks.C
src/frontends/xforms/form_graphics.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/form_include.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/form_maths_deco.C
src/frontends/xforms/FormMathsDeco.C
src/frontends/xforms/form_maths_delim.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/form_maths_matrix.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/form_maths_panel.C
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/form_maths_space.C
src/frontends/xforms/FormMathsSpace.C
src/frontends/xforms/form_maths_style.C
src/frontends/xforms/FormMathsStyle.C
src/frontends/xforms/form_minipage.C
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/form_paragraph.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/form_preamble.C
src/frontends/xforms/FormPreamble.C
src/frontends/xforms/form_preferences.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/form_print.C
src/frontends/xforms/FormPrint.C
src/frontends/xforms/form_ref.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/form_search.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/form_sendto.C
src/frontends/xforms/FormSendto.C
src/frontends/xforms/form_spellchecker.C
src/frontends/xforms/FormSpellchecker.C
src/frontends/xforms/form_tabular.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/form_tabular_create.C
src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/form_texinfo.C
src/frontends/xforms/FormTexinfo.C
src/frontends/xforms/form_thesaurus.C
src/frontends/xforms/FormThesaurus.C
src/frontends/xforms/form_toc.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
@ -196,6 +158,7 @@ src/mathed/formulabase.C
src/mathed/formula.C
src/mathed/formulamacro.C
src/mathed/math_cursor.C
src/mathed/ref_inset.C
src/MenuBackend.C
src/minibuffer.C
src/paragraph.C

View File

@ -611,7 +611,7 @@ int BufferView::unlockInset(UpdatableInset * inset)
inset->insetUnlock(this);
theLockingInset(0);
// make sure we update the combo !
owner()->setLayout(getLyXText()->cursor.par()->layout());
owner()->setLayout(getLyXText()->cursor.par()->layout()->name());
// Tell the paragraph dialog that we changed paragraph
owner()->getDialogs()->updateParagraph();
finishUndo();

View File

@ -130,7 +130,7 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
{
workarea_.reset(WorkAreaFactory::create(xpos, ypos, width, height));
screen_.reset(LyXScreenFactory::create(workarea()));
// Setup the signals
workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
workarea().workAreaResize
@ -163,7 +163,7 @@ WorkArea & BufferView::Pimpl::workarea() const
return *workarea_.get();
}
LyXScreen & BufferView::Pimpl::screen() const
{
return *screen_.get();
@ -207,7 +207,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
if (buffer_) {
lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl;
buffer_->addUser(bv_);
// If we don't have a text object for this, we make one
if (bv_->text == 0) {
resizeCurrentBuffer();
@ -215,7 +215,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
// FIXME: needed when ?
bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
// Similarly, buffer-dependent dialogs should be updated or
// hidden. This should go here because some dialogs (eg ToC)
// require bv_->text.
@ -231,7 +231,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
textcache.show(lyxerr, "buffer delete all");
textcache.clear();
}
repaint();
updateScrollbar();
owner_->updateMenubar();
@ -372,7 +372,7 @@ void BufferView::Pimpl::updateScrollbar()
}
LyXText const & t = *bv_->text;
workarea().setScrollbarParams(t.height, t.first_y, t.defaultHeight());
}
@ -408,10 +408,10 @@ int BufferView::Pimpl::scroll(long time)
return 0;
LyXText const * t = bv_->text;
double const diff = t->defaultHeight()
double const diff = t->defaultHeight()
+ double(time) * double(time) * 0.125;
scrollDocView(int(diff));
workarea().setScrollbarParams(t->height, t->first_y, t->defaultHeight());
return 0;
@ -896,7 +896,7 @@ void BufferView::Pimpl::workAreaResize()
// update from work area
work_area_width = workarea().workWidth();
work_area_height = workarea().workHeight();
if (buffer_ != 0) {
if (widthChange) {
// The visible LyXView need a resize
@ -911,7 +911,7 @@ void BufferView::Pimpl::workAreaResize()
if (lyxerr.debugging())
textcache.show(lyxerr, "Expose delete all");
textcache.clear();
// FIXME: this is aalready done in resizeCurrentBuffer() ??
// FIXME: this is aalready done in resizeCurrentBuffer() ??
buffer_->resizeInsets(bv_);
} else if (heightChange) {
// fitCursor() ensures we don't jump back
@ -924,7 +924,7 @@ void BufferView::Pimpl::workAreaResize()
if (widthChange || heightChange) {
repaint();
}
// always make sure that the scrollbar is sane.
updateScrollbar();
owner_->updateLayoutChoice();
@ -1360,7 +1360,7 @@ void BufferView::Pimpl::moveCursorUpdate(bool selecting, bool fitcur)
if (!lt->selection.set())
workarea().haveSelection(false);
/* ---> Everytime the cursor is moved, show the current font state. */
// should this too me moved out of this func?
//owner->showState();
@ -1614,7 +1614,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
// If the entry is obsolete, use the new one instead.
if (hasLayout) {
string const & obs = tclass[layout].obsoleted_by();
string const & obs = tclass[layout]->obsoleted_by();
if (!obs.empty())
layout = obs;
}
@ -1634,7 +1634,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
Paragraph * spar = lt->selection.start.par();
Paragraph * epar = lt->selection.end.par()->next();
while(spar != epar) {
if (spar->layout() != current_layout) {
if (spar->layout()->name() != current_layout) {
change_layout = true;
break;
}
@ -2292,10 +2292,9 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_PROTECTEDSPACE:
{
LyXText * lt = bv_->getLyXText();
LyXLayout_ptr const & style = lt->cursor.par()->layout();
LyXLayout const & style = tclass[lt->cursor.par()->layout()];
if (style.free_spacing) {
if (style->free_spacing) {
lt->insertChar(bv_, ' ');
update(lt,
BufferView::SELECT
@ -2983,7 +2982,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
}
InsetIndex * inset = new InsetIndex(InsetCommandParams("index", entry));
if (!insertInset(inset)) {
delete inset;
} else {
@ -3217,10 +3216,9 @@ void BufferView::Pimpl::smartQuote()
hideCursor();
LyXLayout const & style =
textclasslist[bv_->buffer()->params.textclass][par->layout()];
LyXLayout_ptr const & style = par->layout();
if (style.pass_thru ||
if (style->pass_thru ||
(!insertInset(new InsetQuotes(c, bv_->buffer()->params))))
bv_->owner()->getLyXFunc()->dispatch(LFUN_SELFINSERT, "\"");
}

View File

@ -1,3 +1,67 @@
2002-06-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
* text2.C: layout as layout
* text.C: layout as layout
* tabular.C (OldFormatRead): layout as layout
* paragraph_pimpl.C (TeXDeeper): layout as layout
(realizeFont): layout as layout
* paragraph.C (writeFile): layout as layout
(validate): layout as layout
(getFont): layout as layout
(getLabelFont): layout as layout
(getLayoutFont): layout as layout
(breakParagraph): layout as layout
(stripLeadingSpaces): layout as layout
(getEndLabel): layout as layout
(getMaxDepthAfter): layout as layout
(applyLayout): layout as layout
(TeXOnePar): layout as layout
(simpleTeXOnePar): layout as layout
(TeXEnvironment): layout as layout
(layout): layout as layout
(layout): layout as layout
* lyxtextclass.C (compare_name): new functor to work with
shared_ptr, layout as layout
(Read): layout as layout
(hasLayout): layout as layout
(operator): layout as layout
(delete_layout): layout as layout
(defaultLayout): layout as layout
* lyxlayout_ptr_fwd.h: new file
* lyxlayout.C (Read): layout as layout
* lyx_cb.C (MenuInsertLabel): layout as layout
* bufferlist.C (newFile): layout as layout
* buffer.C (readLyXformat2): layout as layout
(parseSingleLyXformat2Token): layout as layout
(insertStringAsLines): layout as layout
(asciiParagraph): layout as layout
(latexParagraphs): layout as layout
(makeLinuxDocFile): layout as layout
(simpleLinuxDocOnePar): layout as layout
(makeDocBookFile): layout as layout
(simpleDocBookOnePar): layout as layout
(getLists): layout as layout
* LaTeXFeatures.C (getTClassPreamble): layout as layout
* CutAndPaste.C (cutSelection): layout as layout
(pasteSelection): layout as layout
(SwitchLayoutsBetweenClasses): layout as layout
* BufferView_pimpl.C (Dispatch): layout as layout
(smartQuote): layout as layout
* BufferView2.C (unlockInset): layout as layout
2002-06-24 André Pönitz <poenitz@gmx.net>
@ -6,19 +70,19 @@
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* lyxrc.h:
* lyxrc.C:
* lyxrc.C:
* lyxfunc.C: remove display_shortcuts, show_banner
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* Buffer_pimpl.C: oops, update on resize
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* buffer.C:
* converter.C:
* buffer.C:
* converter.C:
* exporter.C:
* lyxfunc.C:
* lyxfunc.C:
* BufferView.h:
* BufferView.C: use repaint()
@ -26,13 +90,13 @@
* BufferView_pimpl.C: s/updateScreen()/repaint()/
as it's a clearer description. Remove superfluous
redraws.
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* text.C: fix bug 488. Not ideal, but getting
getWord() to work properly for the insets that
matter is more difficult ...
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* BufferView_pimpl.C:
@ -48,7 +112,7 @@
* BufferView_pimpl.h:
* BufferView_pimpl.C: clean up resize() stuff,
and unnecessary updateScreen()s
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* BufferView.h:
@ -56,19 +120,19 @@
* BufferView_pimpl.h:
* BufferView_pimpl.C:
* lyxfind.h:
* lyxfind.C:
* lyxfind.C:
* minibuffer.C: remove focus management of workarea,
not needed. Use screen's greyOut()
2002-06-17 Herbert Voss <voss@lyx.org>
* converter.C: (convert) do not post a message, when converting
fails, let the calling function decide what to do in this case
* converter.C: (convert) do not post a message, when converting
fails, let the calling function decide what to do in this case
2002-06-18 John Levon <moz@compsoc.man.ac.uk>
* lyxfunc.C: tidy up a little
2002-06-16 <alstrup@diku.dk>
* BufferView_pimpl.C (Pimpl): Use WorkAreaFactory.
@ -94,7 +158,7 @@
2002-06-15 Lyx Development team <larsbj@birdstep.com>
* lyxfunc.[Ch]: Use LyXKeySym instead of KeySym,
* lyxfunc.[Ch]: Use LyXKeySym instead of KeySym,
so it's X11 independent.
* kb*.[Ch]: ditto.
@ -129,27 +193,27 @@
* BufferView_pimpl.h:
* BufferView_pimpl.C: move bogus scrolling logic
to xforms
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* lyxfunc.C:
* BufferView_pimpl.C: view->resize() change
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* BufferView_pimpl.C: topCursorVisible
prototype change
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am:
* lyx_gui.h:
* lyx_gui.C: move to frontends/
* main.C:
* lyx_main.h:
* lyx_main.C: changes from above
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* intl.C:
@ -158,7 +222,7 @@
* kbsequence.C:
* lyx_cb.C:
* lyx_main.C: minor tidy
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* BufferView_pimpl.h:
@ -166,18 +230,18 @@
* BufferView.h:
* BufferView.C: make painter() const,
remove dead code
* BufferView2.C: use screen() accessor
* lyx_main.h:
* lyx_main.C: some minor cleanup
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* BufferView_pimpl.h:
* BufferView_pimpl.C: remove enter/leaveView,
use workHeight()
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* BufferView.h:
@ -188,10 +252,10 @@
rename
* lyxrc.C: remove pointless comment
2002-06-11 John Levon <moz@compsoc.man.ac.uk>
* BufferView.h:
* BufferView.h:
* BufferView.C: remove active() and belowMouse()
* BufferView_pimpl.h:
@ -201,7 +265,7 @@
2002-06-11 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: add debug message on BadWindow
2002-06-10 Lars Gullik Bjønnes <larsbj@birdstep.com>
* sp_spell.C: fdopen is not part of the C++ standard.

View File

@ -137,12 +137,12 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar,
if (realcut) {
buf->params().clear();
buf->bibkey = 0;
buf->layout(textclasslist[current_view->buffer()->params.textclass].defaultLayoutName());
buf->layout(textclasslist[current_view->buffer()->params.textclass].defaultLayout());
}
// paste the paragraphs again, if possible
if (doclear)
startpar->next()->stripLeadingSpaces(textclass);
startpar->next()->stripLeadingSpaces();
if (startpar->hasSameLayout(startpar->next()) ||
!startpar->next()->size()) {
startpar->pasteParagraph(current_view->buffer()->params);
@ -288,7 +288,7 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
SwitchLayoutsBetweenClasses(textclass, tc, tmpbuf,
current_view->buffer()->params);
Paragraph::depth_type max_depth = (*par)->getMaxDepthAfter(current_view->buffer());
Paragraph::depth_type max_depth = (*par)->getMaxDepthAfter();
while(tmpbuf) {
// if we have a negative jump so that the depth would go below
@ -304,7 +304,7 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
// only set this from the 2nd on as the 2nd depends for maxDepth
// still on *par
if (tmpbuf->previous() != (*par))
max_depth = tmpbuf->getMaxDepthAfter(current_view->buffer());
max_depth = tmpbuf->getMaxDepthAfter();
// set the inset owner of this paragraph
tmpbuf->setInsetOwner((*par)->inInset());
for(pos_type i = 0; i < tmpbuf->size(); ++i) {
@ -374,7 +374,7 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
lastbuffer->makeSameLayout(lastbuffer->next());
lastbuffer->pasteParagraph(current_view->buffer()->params);
} else
lastbuffer->next()->stripLeadingSpaces(tc);
lastbuffer->next()->stripLeadingSpaces();
}
// restore the simple cut buffer
buf = simple_cut_clone;
@ -413,17 +413,17 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
ParIterator end = ParIterator();
for (ParIterator it = ParIterator(par); it != end; ++it) {
par = *it;
string const name = par->layout();
string const name = par->layout()->name();
bool hasLayout = tclass2.hasLayout(name);
if (!hasLayout)
par->layout(tclass2.defaultLayoutName());
par->layout(tclass2.defaultLayout());
if (!hasLayout && name != tclass1.defaultLayoutName()) {
++ret;
string const s = _("Layout had to be changed from\n")
+ name + _(" to ")
+ par->layout()
+ par->layout()->name()
+ _("\nbecause of class conversion from\n")
+ textclasslist[c1].name() + _(" to ")
+ textclasslist[c2].name();

View File

@ -341,7 +341,7 @@ string const LaTeXFeatures::getTClassPreamble() const
set<string>::const_iterator cit = layout.begin();
set<string>::const_iterator end = layout.end();
for (; cit != end; ++cit) {
tcpreamble << tclass[*cit].preamble();
tcpreamble << tclass[*cit]->preamble();
}
return tcpreamble.str().c_str();

View File

@ -341,7 +341,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
if (!par) {
par = new Paragraph;
par->layout(textclasslist[params.textclass].defaultLayoutName());
par->layout(textclasslist[params.textclass].defaultLayout());
} else {
// We are inserting into an existing document
users->text->breakParagraph(users);
@ -621,15 +621,14 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
first_par = par;
else {
par = new Paragraph(par);
par->layout(textclasslist[params.textclass].defaultLayoutName());
par->layout(textclasslist[params.textclass].defaultLayout());
}
pos = 0;
par->layout(layoutname);
par->layout(textclasslist[params.textclass][layoutname]);
// Test whether the layout is obsolete.
LyXLayout const & layout =
textclasslist[params.textclass][par->layout()];
if (!layout.obsoleted_by().empty())
par->layout(layout.obsoleted_by());
LyXLayout_ptr const & layout = par->layout();
if (!layout->obsoleted_by().empty())
par->layout(textclasslist[params.textclass][layout->obsoleted_by()]);
par->params().depth(depth);
#ifndef NO_COMPABILITY
} else {
@ -637,10 +636,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
// the code then of NO_COMPATIBILITY
par->layout(layoutname);
// Test whether the layout is obsolete.
LyXLayout const & layout =
LyXLayout_ptr const & layout =
textclasslist[params.textclass][par->layout()];
if (!layout.obsoleted_by().empty())
par->layout(layout.obsoleted_by());
if (!layout->obsoleted_by().empty())
par->layout(layout->obsoleted_by());
par->params().depth(depth);
}
#endif
@ -734,11 +733,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
lex.next();
font.setLyXColor(lex.getString());
} else if (token == "\\SpecialChar") {
LyXLayout const & layout =
textclasslist[params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
// Insets don't make sense in a free-spacing context! ---Kayvan
if (layout.free_spacing || par->isFreeSpacing()) {
if (layout->free_spacing || par->isFreeSpacing()) {
if (lex.isOK()) {
lex.next();
string next_token = lex.getString();
@ -1195,7 +1193,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
// only add the length when value > 0 or
// with option keep
if ((value.length().len().value() != 0) ||
value.keep() ||
value.keep() ||
(value.kind() != VSpace::LENGTH))
par->params().spaceBottom(value);
#ifndef NO_COMPABILITY
@ -1256,10 +1254,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
// This is a backward compability thingie. (Lgb)
// Remove it later some time...introduced with fileformat
// 2.16. (Lgb)
LyXLayout const & layout =
textclasslist[params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
if (layout.free_spacing || par->isFreeSpacing()) {
if (layout->free_spacing || par->isFreeSpacing()) {
par->insertChar(pos, ' ', font);
} else {
Inset * inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
@ -1500,8 +1497,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
void Buffer::insertStringAsLines(Paragraph *& par, pos_type & pos,
LyXFont const & fn,string const & str) const
{
LyXLayout const & layout =
textclasslist[params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
LyXFont font = fn;
par->checkInsertChar(font);
@ -1512,9 +1509,9 @@ void Buffer::insertStringAsLines(Paragraph *& par, pos_type & pos,
for(string::const_iterator cit = str.begin();
cit != str.end(); ++cit) {
if (*cit == '\n') {
if (autobreakrows && (par->size() || layout.keepempty)) {
if (autobreakrows && (par->size() || layout->keepempty)) {
par->breakParagraph(params, pos,
layout.isEnvironment());
layout->isEnvironment());
par = par->next();
pos = 0;
space_inserted = true;
@ -1523,12 +1520,12 @@ void Buffer::insertStringAsLines(Paragraph *& par, pos_type & pos,
}
// do not insert consecutive spaces if !free_spacing
} else if ((*cit == ' ' || *cit == '\t') &&
space_inserted && !layout.free_spacing &&
space_inserted && !layout->free_spacing &&
!par->isFreeSpacing())
{
continue;
} else if (*cit == '\t') {
if (!layout.free_spacing && !par->isFreeSpacing()) {
if (!layout->free_spacing && !par->isFreeSpacing()) {
// tabs are like spaces here
par->insertChar(pos, ' ', font);
++pos;
@ -1952,7 +1949,7 @@ string const Buffer::asciiParagraph(Paragraph const * par,
#endif
// First write the layout
string const & tmp = par->layout();
string const & tmp = par->layout()->name();
if (compare_no_case(tmp, "itemize") == 0) {
ltype = 1;
ltype_depth = depth + 1;
@ -2680,10 +2677,9 @@ void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
// any special options in the paragraph and also we don't allow
// any environment other then "Standard" to be valid!
if ((in == 0) || !in->forceDefaultParagraphs(in)) {
LyXLayout const & layout =
textclasslist[params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
if (layout.intitle) {
if (layout->intitle) {
if (already_title) {
lyxerr <<"Error in latexParagraphs: You"
" should not mix title layouts"
@ -2697,7 +2693,7 @@ void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
was_title = false;
}
if (layout.isEnvironment() ||
if (layout->isEnvironment() ||
!par->params().leftIndent().zero())
{
par = par->TeXEnvironment(this, params, ofs, texrow);
@ -2755,7 +2751,7 @@ int Buffer::sgmlOpenTag(ostream & os, Paragraph::depth_type depth, bool mixcont,
if (!latexname.empty() && latexname != "!-- --") {
if (!mixcont)
os << string(" ",depth);
os << "<" << latexname << ">";
os << "<" << latexname << ">";
}
if (!mixcont)
@ -2836,8 +2832,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
vector<string> environment_stack(5);
while (par) {
LyXLayout const & style = tclass[par->layout()];
LyXLayout_ptr const & style = par->layout();
// treat <toc> as a special case for compatibility with old code
if (par->isInset(0)) {
Inset * inset = par->getInset(0);
@ -2858,7 +2853,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
}
// write opening SGML tags
switch (style.latextype) {
switch (style->latextype) {
case LATEX_PARAGRAPH:
if (depth == par->params().depth()
&& !environment_stack[depth].empty()) {
@ -2869,7 +2864,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
else
ofs << "</p>";
}
sgmlOpenTag(ofs, depth, false, style.latexname());
sgmlOpenTag(ofs, depth, false, style->latexname());
break;
case LATEX_COMMAND:
@ -2884,45 +2879,51 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
}
environment_stack[depth].erase();
sgmlOpenTag(ofs, depth, false, style.latexname());
sgmlOpenTag(ofs, depth, false, style->latexname());
break;
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
{
string const & latexname = style->latexname();
if (depth == par->params().depth()
&& environment_stack[depth] != style.latexname()) {
sgmlCloseTag(ofs, depth, false, environment_stack[depth]);
&& environment_stack[depth] != latexname) {
sgmlCloseTag(ofs, depth, false,
environment_stack[depth]);
environment_stack[depth].erase();
}
if (depth < par->params().depth()) {
depth = par->params().depth();
environment_stack[depth].erase();
}
if (environment_stack[depth] != style.latexname()) {
if (environment_stack[depth] != latexname) {
if (depth == 0) {
sgmlOpenTag(ofs, depth, false, "p");
}
sgmlOpenTag(ofs, depth, false, style.latexname());
sgmlOpenTag(ofs, depth, false, latexname);
if (environment_stack.size() == depth + 1)
environment_stack.push_back("!-- --");
environment_stack[depth] = style.latexname();
environment_stack[depth] = latexname;
}
if (style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
ofs << "<![CDATA[";
if (style.latextype == LATEX_ENVIRONMENT) break;
if (style->latextype == LATEX_ENVIRONMENT) break;
if (style.labeltype == LABEL_MANUAL)
if (style->labeltype == LABEL_MANUAL)
item_name = "tag";
else
item_name = "item";
sgmlOpenTag(ofs, depth + 1, false, item_name);
break;
}
break;
default:
sgmlOpenTag(ofs, depth, false, style.latexname());
sgmlOpenTag(ofs, depth, false, style->latexname());
break;
}
@ -2932,22 +2933,22 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
ofs << "\n";
// write closing SGML tags
switch (style.latextype) {
switch (style->latextype) {
case LATEX_COMMAND:
break;
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
if (style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
ofs << "]]>";
break;
default:
sgmlCloseTag(ofs, depth, false, style.latexname());
sgmlCloseTag(ofs, depth, false, style->latexname());
break;
}
}
// Close open tags
for (int i=depth; i >= 0; --i)
for (int i = depth; i >= 0; --i)
sgmlCloseTag(ofs, depth, false, environment_stack[i]);
if (!body_only) {
@ -3023,18 +3024,18 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
Paragraph * par,
Paragraph::depth_type /*depth*/)
{
LyXLayout const & style =
textclasslist[params.textclass][par->layout()];
LyXLayout_ptr const & style = par->layout();
string::size_type char_line_count = 5; // Heuristic choice ;-)
// gets paragraph main font
LyXFont font_old;
bool desc_on;
if (style.labeltype == LABEL_MANUAL) {
font_old = style.labelfont;
if (style->labeltype == LABEL_MANUAL) {
font_old = style->labelfont;
desc_on = true;
} else {
font_old = style.font;
font_old = style->font;
desc_on = false;
}
@ -3168,7 +3169,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
continue;
}
if (style.latexparam() == "CDATA") {
if (style->latexparam() == "CDATA") {
// "TeX"-Mode on == > SGML-Mode on.
if (c != '\0')
os << c;
@ -3176,7 +3177,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
} else {
string sgml_string;
if (par->sgmlConvertChar(c, sgml_string)
&& !style.free_spacing && !par->isFreeSpacing())
&& !style->free_spacing && !par->isFreeSpacing())
{
// in freespacing mode, spaces are
// non-breaking characters
@ -3302,7 +3303,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
string c_params;
int desc_on = 0; // description mode
LyXLayout const & style = tclass[par->layout()];
LyXLayout_ptr const & style = par->layout();
// environment tag closing
for (; depth > par->params().depth(); --depth) {
@ -3318,7 +3319,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
}
if (depth == par->params().depth()
&& environment_stack[depth] != style.latexname()
&& environment_stack[depth] != style->latexname()
&& !environment_stack[depth].empty()) {
if (environment_inner[depth] != "!-- --") {
item_name= "listitem";
@ -3334,9 +3335,10 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
}
// Write opening SGML tags.
switch (style.latextype) {
switch (style->latextype) {
case LATEX_PARAGRAPH:
sgmlOpenTag(ofs, depth + command_depth, false, style.latexname());
sgmlOpenTag(ofs, depth + command_depth,
false, style->latexname());
break;
case LATEX_COMMAND:
@ -3345,9 +3347,9 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
_("Error : Wrong depth for "
"LatexType Command.\n"));
command_name = style.latexname();
command_name = style->latexname();
sgmlparam = style.latexparam();
sgmlparam = style->latexparam();
c_params = split(sgmlparam, c_depth,'|');
cmd_depth = lyx::atoi(c_depth);
@ -3405,12 +3407,12 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
environment_stack[depth].erase();
}
if (environment_stack[depth] != style.latexname()) {
if (environment_stack[depth] != style->latexname()) {
if (environment_stack.size() == depth + 1) {
environment_stack.push_back("!-- --");
environment_inner.push_back("!-- --");
}
environment_stack[depth] = style.latexname();
environment_stack[depth] = style->latexname();
environment_inner[depth] = "!-- --";
sgmlOpenTag(ofs, depth + command_depth, false, environment_stack[depth]);
} else {
@ -3422,45 +3424,50 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
}
}
if (style.latextype == LATEX_ENVIRONMENT) {
if (!style.latexparam().empty()) {
if (style.latexparam() == "CDATA")
if (style->latextype == LATEX_ENVIRONMENT) {
if (!style->latexparam().empty()) {
if (style->latexparam() == "CDATA")
ofs << "<![CDATA[";
else
sgmlOpenTag(ofs, depth + command_depth, false, style.latexparam());
sgmlOpenTag(ofs, depth + command_depth, false, style->latexparam());
}
break;
}
desc_on = (style.labeltype == LABEL_MANUAL);
desc_on = (style->labeltype == LABEL_MANUAL);
environment_inner[depth] = desc_on?"varlistentry": "listitem";
sgmlOpenTag(ofs, depth + 1 + command_depth, false, environment_inner[depth]);
environment_inner[depth] = desc_on ? "varlistentry" : "listitem";
sgmlOpenTag(ofs, depth + 1 + command_depth,
false, environment_inner[depth]);
item_name = desc_on? "term": "para";
sgmlOpenTag(ofs, depth + 1 + command_depth, false, item_name);
item_name = desc_on ? "term" : "para";
sgmlOpenTag(ofs, depth + 1 + command_depth,
false, item_name);
break;
default:
sgmlOpenTag(ofs, depth + command_depth, false, style.latexname());
sgmlOpenTag(ofs, depth + command_depth,
false, style->latexname());
break;
}
simpleDocBookOnePar(ofs, par, desc_on, depth+1+command_depth);
simpleDocBookOnePar(ofs, par, desc_on,
depth + 1 + command_depth);
par = par->next();
string end_tag;
// write closing SGML tags
switch (style.latextype) {
switch (style->latextype) {
case LATEX_COMMAND:
end_tag = c_params.empty()?"title":c_params;
sgmlCloseTag(ofs, depth + command_depth, false, end_tag);
end_tag = c_params.empty() ? "title" : c_params;
sgmlCloseTag(ofs, depth + command_depth,
false, end_tag);
break;
case LATEX_ENVIRONMENT:
if (!style.latexparam().empty()) {
if (style.latexparam() == "CDATA")
if (!style->latexparam().empty()) {
if (style->latexparam() == "CDATA")
ofs << "]]>";
else
sgmlCloseTag(ofs, depth + command_depth, false, style.latexparam());
sgmlCloseTag(ofs, depth + command_depth, false, style->latexparam());
}
break;
case LATEX_ITEM_ENVIRONMENT:
@ -3469,10 +3476,10 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
sgmlCloseTag(ofs, depth + 1 + command_depth, false, end_tag);
break;
case LATEX_PARAGRAPH:
sgmlCloseTag(ofs, depth + command_depth, false, style.latexname());
sgmlCloseTag(ofs, depth + command_depth, false, style->latexname());
break;
default:
sgmlCloseTag(ofs, depth + command_depth, false, style.latexname());
sgmlCloseTag(ofs, depth + command_depth, false, style->latexname());
break;
}
}
@ -3514,9 +3521,9 @@ void Buffer::simpleDocBookOnePar(ostream & os,
{
bool emph_flag = false;
LyXLayout const & style = textclasslist[params.textclass][par->layout()];
LyXLayout_ptr const & style = par->layout();
LyXFont font_old = style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
LyXFont font_old = (style->labeltype == LABEL_MANUAL ? style->labelfont : style->font);
int char_line_count = depth;
//if (!style.free_spacing)
@ -3529,17 +3536,17 @@ void Buffer::simpleDocBookOnePar(ostream & os,
// handle <emphasis> tag
if (font_old.emph() != font.emph()) {
if (font.emph() == LyXFont::ON) {
if(style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
os << "]]>";
os << "<emphasis>";
if(style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
emph_flag = true;
} else if (i) {
if(style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
os << "]]>";
os << "</emphasis>";
if(style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
emph_flag = false;
}
@ -3549,11 +3556,11 @@ void Buffer::simpleDocBookOnePar(ostream & os,
if (par->isInset(i)) {
Inset * inset = par->getInset(i);
// don't print the inset in position 0 if desc_on == 3 (label)
if ( i || desc_on != 3) {
if(style.latexparam() == "CDATA")
if (i || desc_on != 3) {
if (style->latexparam() == "CDATA")
os << "]]>";
inset->docbook(this, os, false);
if(style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
}
} else {
@ -3561,9 +3568,9 @@ void Buffer::simpleDocBookOnePar(ostream & os,
string sgml_string;
par->sgmlConvertChar(c, sgml_string);
if (style.pass_thru) {
if (style->pass_thru) {
os << c;
} else if (style.free_spacing || par->isFreeSpacing() || c != ' ') {
} else if (style->free_spacing || par->isFreeSpacing() || c != ' ') {
os << sgml_string;
} else if (desc_on ==1) {
++char_line_count;
@ -3577,10 +3584,10 @@ void Buffer::simpleDocBookOnePar(ostream & os,
}
if (emph_flag) {
if(style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
os << "]]>";
os << "</emphasis>";
if(style.latexparam() == "CDATA")
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
}
@ -3589,7 +3596,8 @@ void Buffer::simpleDocBookOnePar(ostream & os,
// <term> not closed...
os << "</term>\n<listitem><para>&nbsp;</para>";
}
if (style.free_spacing) os << '\n';
if (style->free_spacing)
os << '\n';
}
@ -3748,7 +3756,8 @@ Buffer::Lists const Buffer::getLists() const
string const layout("Caption");
while (par) {
char const labeltype = textclass[par->layout()].labeltype;
#warning bogus type (Lgb)
char const labeltype = par->layout()->labeltype;
if (labeltype >= LABEL_COUNTER_CHAPTER
&& labeltype <= LABEL_COUNTER_CHAPTER + params.tocdepth) {
@ -3780,7 +3789,7 @@ Buffer::Lists const Buffer::getLists() const
// the inset...
Paragraph * tmp = il->inset.paragraph();
while (tmp) {
if (tmp->layout() == layout) {
if (tmp->layout()->name() == layout) {
SingleList & item = l[type];
string const str =
tostr(item.size()+1) + ". " + tmp->asString(this, false);
@ -3894,7 +3903,7 @@ bool Buffer::dispatch(string const & command, bool * result)
bool Buffer::dispatch(int action, string const & argument, bool * result)
{
bool dispatched = true;
switch (action) {
case LFUN_EXPORT: {
bool const tmp = Exporter::Export(this, argument, false);

View File

@ -482,11 +482,11 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
MakeDisplayPath(tname));
// no template, start with empty buffer
b->paragraph = new Paragraph;
b->paragraph->layout(textclasslist[b->params.textclass].defaultLayoutName());
b->paragraph->layout(textclasslist[b->params.textclass].defaultLayout());
}
} else { // start with empty buffer
b->paragraph = new Paragraph;
b->paragraph->layout(textclasslist[b->params.textclass].defaultLayoutName());
b->paragraph->layout(textclasslist[b->params.textclass].defaultLayout());
}
if (!lyxrc.new_ask_filename && !isNamed) {

View File

@ -1,46 +1,50 @@
2002-06-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
* LyXView.C: layout as layout
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* screen.C: add FIXME
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* WorkArea.h: remove redraw()
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* guiapi.h:
* Dialogs.h:
* Dialogs.C: createIndex() doesn't take string
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* WorkArea.h: remove unused resize(..) and change name
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* LyXKeySym.h:
* LyXKeySym.C: remove un-needed file
* WorkArea.h:
* WorkArea.C: remove un-needed file. Add back
comments. Remove focus management, greyOut()
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* WorkArea.h: remove focus/unfocus events
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* WorkArea.h: remove unused methods
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* Toolbar.C: add missing header
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* WorkArea.h: remove unused method width()
2002-06-16 Lars Gullik Bjønnes <larsbj@birdstep.com>
* add a nother layer of inderection for calling gui specific

View File

@ -68,7 +68,7 @@ void LyXView::init()
{
updateLayoutChoice();
updateMenubar();
// Start autosave timer
if (lyxrc.autosave) {
autosave_timeout_->setTimeout(lyxrc.autosave * 1000);
@ -194,7 +194,7 @@ void LyXView::updateLayoutChoice()
}
string const & layout =
bufferview_->getLyXText()->cursor.par()->layout();
bufferview_->getLyXText()->cursor.par()->layout()->name();
if (layout != current_layout) {
toolbar_->setLayout(layout);

View File

@ -55,7 +55,7 @@ public:
virtual ~LyXView();
/**
/**
* This is called after the concrete view has been created.
* We have to have the toolbar and the other stuff created
* before we can populate it with this call.

View File

@ -23,7 +23,7 @@
#include <utility>
class Painter;
/**
* The work area class represents the widget that provides the
* view onto a document. It is owned by the BufferView, and
@ -37,15 +37,15 @@ public:
WorkArea() {}
virtual ~WorkArea() {}
/// return the painter object for this work area
virtual Painter & getPainter() = 0;
/// return the width of the work area in pixels
virtual int workWidth() const = 0;
/// return the height of the work area in pixels
virtual int workHeight() const = 0;
/**
* Update the scrollbar.
* @param height the total document height in pixels
@ -53,7 +53,7 @@ public:
* @param line_height the line-scroll amount, in pixels
*/
virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
// FIXME: this is an odd place to have it, but xforms needs it here ...
/// a selection exists
virtual void haveSelection(bool) const = 0;
@ -61,7 +61,7 @@ public:
virtual string const getClipboard() const = 0;
/// fill the clipboard
virtual void putClipboard(string const &) const = 0;
/// work area dimensions have changed
boost::signal0<void> workAreaResize;
/// the scrollbar has changed
@ -83,5 +83,5 @@ public:
/// emitted when another X client has stolen our selection
boost::signal0<void> selectionLost;
};
#endif // WORKAREA_H

View File

@ -1,3 +1,7 @@
2002-06-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
* ControlParagraph.C: layout as layout
2002-06-21 Angus Leeming <leeming@lyx.org>
* tex_helpers.C: Use <vector> not <vector.h>. Reorder header files.
@ -7,7 +11,7 @@
* ControlBibtex.C:
* ControlBibitem.C: use repaint()
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* ControlTexinfo.C: do the same for Texinfo
@ -15,14 +19,14 @@
* tex_helpers.C: don't try to read a file that isn't there
2002-06-21 Herbert Voss <voss@perce.de>
* ControlBibtex.C: do an automatic update, when no bst-list
exists
* ControlBibtex.C: do an automatic update, when no bst-list
exists
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* GUI.h: createIndex() changed
2002-06-18 Herbert Voss <voss@perce.de>
* tex_helpers.[Ch]: move functions from ControlTexinfo into this
@ -31,7 +35,7 @@
2002-06-18 John Levon <moz@compsoc.man.ac.uk>
* ControlGraphics.C: just make the mask *.*
2002-06-16 Lars Gullik Bjønnes <larsbj@birdstep.com>
* changes to simplify function setup, removal of a lot of includes.

View File

@ -22,7 +22,6 @@
#include "gettext.h"
#include "buffer.h"
#include "lyxtext.h"
#include "lyxtextclasslist.h"
#include "support/LAssert.h"
using Liason::setMinibuffer;
@ -103,13 +102,12 @@ void ControlParagraph::setParams()
pp_->labelWidthString(par_->getLabelWidthString());
/// alignment
LyXTextClass const & tclass =
textclasslist[lv_.view()->buffer()->params.textclass];
LyXLayout_ptr const & layout = par_->layout();
if (pp_->align() == LYX_ALIGN_LAYOUT)
pp_->align(tclass[par_->layout()].align);
pp_->align(layout->align);
/// is alignment possible
alignpos_ = tclass[par_->layout()].alignpossible;
alignpos_ = layout->alignpossible;
/// is paragraph in inset
ininset_ = par_->inInset();

View File

@ -45,25 +45,25 @@ void LyXScreen::showCursor(LyXText const * text, BufferView const * bv)
{
if (cursor_visible_)
return;
workarea().getPainter().start();
Cursor_Shape shape = BAR_SHAPE;
BufferParams const & bp(bv->buffer()->params);
LyXFont const & realfont(text->real_current_font);
if (realfont.language() != bp.language
|| realfont.isVisibleRightToLeft()
|| realfont.isVisibleRightToLeft()
!= bp.language->RightToLeft()) {
shape = (realfont.isVisibleRightToLeft())
? REVERSED_L_SHAPE : L_SHAPE;
}
showManualCursor(text, text->cursor.x(), text->cursor.y(),
font_metrics::maxAscent(realfont),
font_metrics::maxDescent(realfont),
shape);
workarea().getPainter().end();
}
@ -73,7 +73,7 @@ bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
{
int const vheight = workarea().workHeight();
int newtop = text->first_y;
if (y + desc - text->first_y >= vheight)
newtop = y - 3 * vheight / 4; // the scroll region must be so big!!
else if (y - asc < text->first_y
@ -82,7 +82,7 @@ bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
}
newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb)
if (newtop != text->first_y) {
draw(text, bv, newtop);
text->first_y = newtop;
@ -111,7 +111,7 @@ unsigned int LyXScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
// Is this a hack? Yes, probably... (Lgb)
if (!row)
return max(newtop, 0);
if (cursor.y() - row->baseline() + row->height()
- top_y >= vheight) {
if (row->height() < vheight
@ -124,7 +124,7 @@ unsigned int LyXScreen::topCursorVisible(LyXCursor const & cursor, int top_y)
newtop = cursor.y()
- vheight / 2; /* the scroll region must be so big!! */
}
} else if (static_cast<int>((cursor.y()) - row->baseline()) <
top_y && top_y > 0) {
if (row->height() < vheight
@ -153,7 +153,7 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
return result;
}
void LyXScreen::update(LyXText * text, BufferView * bv,
int yo, int xo)
{
@ -161,7 +161,7 @@ void LyXScreen::update(LyXText * text, BufferView * bv,
int const vheight = workarea().workHeight();
workarea().getPainter().start();
switch (text->status()) {
case LyXText::NEED_MORE_REFRESH:
{
@ -197,7 +197,7 @@ void LyXScreen::update(LyXText * text, BufferView * bv,
// Nothing needs done
break;
}
workarea().getPainter().end();
}
@ -223,32 +223,32 @@ void LyXScreen::toggleSelection(LyXText * text, BufferView * bv,
if (kill_selection)
text->selection.set(false);
workarea().getPainter().start();
drawFromTo(text, bv, top - text->first_y, bottom - text->first_y,
yo, xo);
expose(0, top - text->first_y,
workarea().workWidth(),
bottom - text->first_y - (top - text->first_y));
bottom - text->first_y - (top - text->first_y));
workarea().getPainter().end();
}
void LyXScreen::toggleToggle(LyXText * text, BufferView * bv,
int yo, int xo)
{
if (text->toggle_cursor.par() == text->toggle_end_cursor.par()
&& text->toggle_cursor.pos() == text->toggle_end_cursor.pos())
return;
int const top_tmp = text->toggle_cursor.y()
- text->toggle_cursor.row()->baseline();
int const bottom_tmp = text->toggle_end_cursor.y()
- text->toggle_end_cursor.row()->baseline()
+ text->toggle_end_cursor.row()->height();
int const offset = yo < 0 ? yo : 0;
int const bottom = min(max(bottom_tmp, text->first_y),
static_cast<int>(text->first_y + workarea().workHeight())) - offset;
@ -262,7 +262,7 @@ void LyXScreen::toggleToggle(LyXText * text, BufferView * bv,
xo);
expose(0, top - text->first_y, workarea().workWidth(),
bottom - text->first_y - (top - text->first_y));
workarea().getPainter().end();
}
@ -280,9 +280,9 @@ void LyXScreen::redraw(LyXText * text, BufferView * bv)
drawFromTo(text, bv, 0, workarea().workHeight(), 0, 0, text == bv->text);
expose(0, 0, workarea().workWidth(), workarea().workHeight());
workarea().getPainter().end();
if (cursor_visible_) {
cursor_visible_ = false;
bv->showCursor();
@ -341,20 +341,20 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
bool internal)
{
lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << "-" << y2 << endl;
int y_text = text->first_y + y1;
// get the first needed row
Row * row = text->getRowNearY(y_text);
// y_text is now the real beginning of the row
int y = y_text - text->first_y;
// y1 is now the real beginning of row on the screen
while (row != 0 && y < y2) {
LyXText::text_status st = text->status();
text->getVisibleRow(bv, y + yo,
xo, row, y + text->first_y);
xo, row, y + text->first_y);
internal = internal && (st != LyXText::CHANGED_IN_DRAW);
while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
text->fullRebreak(bv);
@ -362,7 +362,7 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
text->setCursor(bv, text->cursor.par(), text->cursor.pos());
text->status(bv, st);
text->getVisibleRow(bv, y + yo,
xo, row, y + text->first_y);
xo, row, y + text->first_y);
}
y += row->height();
row = row->next();

View File

@ -14,7 +14,7 @@
#ifdef __GNUG__
#pragma interface
#endif
class LyXText;
class LyXCursor;
class WorkArea;
@ -24,7 +24,7 @@ struct Row;
/**
* LyXScreen - document rendering management
*
* This class is used to manage the on-screen rendering inside the
* This class is used to manage the on-screen rendering inside the
* work area; it is responsible for deciding which LyXText rows
* need re-drawing.
*
@ -48,15 +48,15 @@ public:
LyXScreen();
virtual ~LyXScreen();
/**
* draw the screen from a given position
* @param y the text position to draw from
*
* Uses as much of the already printed pixmap as possible
* Uses as much of the already printed pixmap as possible
*/
virtual void draw(LyXText *, BufferView *, unsigned int y) = 0;
/**
* showManualCursor - display the cursor on the work area
* @param text the lyx text containing the cursor
@ -69,10 +69,10 @@ public:
virtual void showManualCursor(LyXText const *, int x, int y,
int asc, int desc,
Cursor_Shape shape) = 0;
/// unpaint the cursor painted by showManualCursor()
virtual void hideCursor() = 0;
/**
* fit the cursor onto the visible work area, scrolling if necessary
* @param bv the buffer view
@ -86,13 +86,13 @@ public:
*/
bool fitManualCursor(BufferView * bv, LyXText * text,
int x, int y, int a, int d);
/// redraw the screen, without using existing pixmap
virtual void redraw(LyXText *, BufferView *);
/// draw the cursor if it's not already shown
virtual void showCursor(LyXText const *, BufferView const *);
/**
* topCursorVisible - get a new "top" to make the cursor visible
* @param c the cursor
@ -103,7 +103,7 @@ public:
* within the LyXText is "nicely" visible.
*/
virtual unsigned int topCursorVisible(LyXCursor const & c, int top_y);
/**
* fitCursor - fit the cursor onto the work area
* @param text the text containing the cursor
@ -113,7 +113,7 @@ public:
* Scrolls the screen so that the cursor is visible,
*/
virtual bool fitCursor(LyXText *, BufferView *);
/// show the cursor if it's not, and vice versa
virtual void cursorToggle(BufferView *) const;
@ -123,23 +123,23 @@ public:
* @param bv the bufferview
* @param xo the x offset into the text
* @param yo the x offset into the text
*
*
* Updates part of the screen. If text->status is
* LyXText::NEED_MORE_REFRESH, we update from the
* point of change and to the end of the screen.
* If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
* we only update the current row.
* we only update the current row.
*/
virtual void update(LyXText * text, BufferView * bv, int yo = 0, int xo = 0);
/// FIXME
virtual void toggleSelection(LyXText *, BufferView *, bool = true,
int y_offset = 0, int x_offset = 0);
/// FIXME - at least change the name !!
virtual void toggleToggle(LyXText *, BufferView *,
int y_offset = 0, int x_offset = 0);
/// FIXME
virtual bool forceClear() const { return force_clear_; }
@ -149,21 +149,21 @@ protected:
/// get the work area
virtual WorkArea & workarea() const = 0;
/// y1 and y2 are coordinates of the screen
virtual void drawFromTo(LyXText *, BufferView *, int y1, int y2,
int y_offset = 0, int x_offset = 0, bool internal = false);
int y_offset = 0, int x_offset = 0, bool internal = false);
/// y is a coordinate of the text
virtual void drawOneRow(LyXText *, BufferView *, Row * row,
int y_text, int y_offset = 0, int x_offset = 0);
/// grey out (no buffer)
void greyOut();
/// FIXME ?
bool force_clear_;
/// is the blinking cursor currently drawn
bool cursor_visible_;
};

View File

@ -1,3 +1,7 @@
2002-06-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Toolbar_pimpl.C: layout as layout
2002-06-21 Angus Leeming <leeming@lyx.org>
* xscreen.C: add a using std::endl directive.
@ -6,84 +10,84 @@
* FormPreferences.h:
* FormPreferences.C:
* forms/form_preferences.fd: remove show_banner, display_shortcuts
* forms/form_preferences.fd: remove show_banner, display_shortcuts
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.h:
* XWorkArea.C: remove splash, should be handled in
LyXScreen::greyOut()
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* forms/form_texinfo.fd: "Update List" not "Rescan"
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* guiapi.C: createIndex() changed
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* FormBibtex.C: use new lyx::eliminate_duplicates
2002-06-20 Herbert Voss <voss@perce.de>
* FormBibtex.C:
* forms/form_bibtex.fd: give better support for choosing the
bibstyle (new browserfield with the available bibstyles).
move some code of ControlTexinfo into a helper
file support/tex-helpers to use some of the functions
* FormBibtex.C:
* forms/form_bibtex.fd: give better support for choosing the
bibstyle (new browserfield with the available bibstyles).
move some code of ControlTexinfo into a helper
file support/tex-helpers to use some of the functions
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.h:
* XWorkArea.C: remove unused code, name change
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* XLyXKeySym.h:
* XLyXKeySym.C: whitespace
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.h: remove focus stuff, greyOut()
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.C: remove focus/unfocus events
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.h: remove unused methods
2002-06-15 Martin Vermeer <martin.vermeer@hut.fi>
* FormMathsDelim.C: Redesign of Delimiters dialogue in mathed.
* FormMathsDelim.C: Redesign of Delimiters dialogue in mathed.
Cleaner, smaller.
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.h: remove unused width()
2002-06-18 John Levon <moz@compsoc.man.ac.uk>
* guiapi.C: fix compile with libAiksaurus
2002-06-17 Herbert Voss <voss@perce.de>
* forms/.cvsignore: ignore the *.lo files
* forms/.cvsignore: ignore the *.lo files
2002-06-18 John Levon <moz@compsoc.man.ac.uk>
* FormSearch.h:
* FormSearch.C: focus and select search string on open (bug #77)
* FormSearch.C: focus and select search string on open (bug #77)
2002-06-16 Lars Gullik Bjønnes <larsbj@birdstep.com>
* changes to let the function setup happen in frontends
* guiapi.C: new file
2002-06-16 <alstrup@diku.dk>
* xscreen.C (draw): After drawing, we wait for X with XSync..

View File

@ -13,9 +13,9 @@
#pragma implementation
#endif
#include "FormAboutlyx.h"
#include "xformsBC.h"
#include "ControlAboutlyx.h"
#include "FormAboutlyx.h"
#include "forms/form_aboutlyx.h"
#include "xforms_helpers.h"
#include FORMS_H_LOCATION

View File

@ -17,8 +17,6 @@
#include "FormBase.h"
#include <vector>
#include <boost/scoped_ptr.hpp>
class ControlAboutlyx;

View File

@ -27,7 +27,7 @@
#include "forms_fwd.h"
#include <boost/signals/trackable.hpp>
//#include <boost/signals/trackable.hpp>
class Buffer;
class Dialogs;

View File

@ -62,12 +62,6 @@ FormDocument::FormDocument(LyXView * lv, Dialogs * d)
ActCell(0), Confirmed(0),
current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
{
#if 0
// let the dialog be shown
// This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting.
d->showDocument = boost::bind(&FormDocument::show, this);
#endif
}
@ -143,19 +137,12 @@ void FormDocument::build()
// Create the contents of the unit choices
// Don't include the "%" terms...
vector<string> units_vec = getLatexUnits();
#if 0
for (vector<string>::iterator it = units_vec.begin();
it != units_vec.end(); ++it) {
if (contains(*it, "%"))
it = units_vec.erase(it, it+1) - 1;
}
#else
vector<string>::iterator ret =
std::remove_if(units_vec.begin(),
units_vec.end(),
bind2nd(contains_functor(), "%"));
units_vec.erase(ret, units_vec.end());
#endif
string units = getStringFromVector(units_vec, "|");
fl_addto_choice(paper_->choice_custom_width_units, units.c_str());

View File

@ -152,9 +152,6 @@ FormMathsPanel::FormMathsPanel(LyXView * lv, Dialogs * d)
ams_ops_.reset(new FormMathsBitmap(lv, d, *this, _("AMS Operators"), latex));
//showUnderMouse(false);
#if 0
d->showMathPanel = boost::bind(&FormMathsPanel::show, this);
#endif
}

View File

@ -37,7 +37,7 @@ using std::bind2nd;
using std::remove_if;
typedef FormCB<ControlParagraph, FormDB<FD_paragraph> > base_class;
FormParagraph::FormParagraph(ControlParagraph & c)
: base_class(c, _("Paragraph Layout"), false)
{}
@ -74,19 +74,11 @@ void FormParagraph::build()
// Create the contents of the unit choices
// Don't include the "%" terms...
vector<string> units_vec = getLatexUnits();
#if 0
for (vector<string>::iterator it = units_vec.begin();
it != units_vec.end(); ++it) {
if (contains(*it, "%"))
it = units_vec.erase(it, it+1) - 1;
}
#else
// Something similar to this is a better way to erase
vector<string>::iterator del =
remove_if(units_vec.begin(), units_vec.end(),
bind2nd(contains_functor(), "%"));
units_vec.erase(del, units_vec.end());
#endif
string units = getStringFromVector(units_vec, "|");
@ -195,15 +187,15 @@ void FormParagraph::apply()
// the input field, reset the kind to "None".
validateVSpaceWidgets(dialog_->choice_space_above,
dialog_->input_space_above);
VSpace const space_top =
setVSpaceFromWidgets(dialog_->choice_space_above,
dialog_->input_space_above,
dialog_->choice_value_space_above,
dialog_->check_space_above);
controller().params().spaceTop(space_top);
validateVSpaceWidgets(dialog_->choice_space_below,
dialog_->input_space_below);
@ -212,7 +204,7 @@ void FormParagraph::apply()
dialog_->input_space_below,
dialog_->choice_value_space_below,
dialog_->check_space_below);
controller().params().spaceBottom(space_bottom);
/* lines and pagebreaks */
@ -224,10 +216,10 @@ void FormParagraph::apply()
bool const pagebreak_top = fl_get_button(dialog_->check_pagebreaks_top);
controller().params().pagebreakTop(pagebreak_top);
bool const pagebreak_bottom = fl_get_button(dialog_->check_pagebreaks_bottom);
controller().params().pagebreakBottom(pagebreak_bottom);
/* alignment */
LyXAlignment align;
@ -240,7 +232,7 @@ void FormParagraph::apply()
else
align = LYX_ALIGN_BLOCK;
controller().params().align(align);
/* label width */
string const labelwidthstring =
getStringFromInput(dialog_->input_labelwidth);
@ -274,7 +266,7 @@ void FormParagraph::apply()
Spacing const spacing(linespacing, other);
controller().params().spacing(spacing);
}
namespace {
@ -352,7 +344,7 @@ void FormParagraph::update()
fl_set_button(dialog_->radio_align_left, 0);
fl_set_button(dialog_->radio_align_center, 0);
fl_set_button(dialog_->radio_align_block, 0);
LyXAlignment align = controller().params().align();
switch (align) {
@ -531,5 +523,3 @@ ButtonPolicy::SMInput FormParagraph::input(FL_OBJECT * ob, long)
return ButtonPolicy::SMI_VALID;
}

View File

@ -80,12 +80,6 @@ FormPreferences::FormPreferences(LyXView & lv, Dialogs & d)
// let the dialog be shown
// This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting.
#if 0
d->showPreferences = boost::bind(&FormPreferences::show, this);
#endif
#if 0
d->showSpellcheckerPreferences = boost::bind(&FormPreferences::showSpellPref, this);
#endif
}

View File

@ -43,13 +43,6 @@ FormTabular::FormTabular(LyXView & lv, Dialogs & d)
: FormInset(&lv, &d, _("Tabular Layout")),
inset_(0), actCell_(-1), closing_(false)
{
#if 0
// let the dialog be shown
// This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting.
d->showTabular = boost::bind(&FormTabular::showInset, this, _1);
d->updateTabular = boost::bind(&FormTabular::updateInset, this, _1);
#endif
}
@ -154,18 +147,10 @@ void FormTabular::build()
// Create the contents of the unit choices
// Don't include the "%" terms...
vector<string> units_vec = getLatexUnits();
#if 0
for (vector<string>::iterator it = units_vec.begin();
it != units_vec.end(); ++it) {
if (contains(*it, "%"))
it = units_vec.erase(it, it + 1) - 1;
}
#else
vector<string>::iterator ret =
remove_if(units_vec.begin(), units_vec.end(),
bind2nd(contains_functor(), "%"));
units_vec.erase(ret, units_vec.end());
#endif
string units = getStringFromVector(units_vec, "|");

View File

@ -180,8 +180,8 @@ void Toolbar::Pimpl::layoutSelected()
LyXTextClass::const_iterator end = tc.end();
for (LyXTextClass::const_iterator cit = tc.begin();
cit != end; ++cit) {
if (_(cit->name()) == layoutguiname) {
owner->getLyXFunc()->dispatch(LFUN_LAYOUT, cit->name());
if (_((*cit)->name()) == layoutguiname) {
owner->getLyXFunc()->dispatch(LFUN_LAYOUT, (*cit)->name());
return;
}
}
@ -195,7 +195,7 @@ void Toolbar::Pimpl::setLayout(string const & layout)
if (combox) {
LyXTextClass const & tc =
textclasslist[owner->buffer()->params.textclass];
combox->select(_(tc[layout].name()));
combox->select(_(tc[layout]->name()));
}
}
@ -214,8 +214,8 @@ void Toolbar::Pimpl::updateLayoutList(bool force)
for (LyXTextClass::const_iterator cit = tc.begin();
cit != end; ++cit) {
// ignore obsolete entries
if (cit->obsoleted_by().empty())
combox->addline(_(cit->name()));
if ((*cit)->obsoleted_by().empty())
combox->addline(_((*cit)->name()));
}
}
// we need to do this.

View File

@ -33,7 +33,7 @@
// xforms doesn't define this (but it should be in <forms.h>).
extern "C"
FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
using std::endl;
using std::abs;
using std::hex;
@ -59,7 +59,7 @@ void setXtermCursor(Window win)
XDefineCursor(fl_get_display(), win, cursor);
XFlush(fl_get_display());
}
// FIXME !
mouse_button::state x_button_state(unsigned int button)
@ -178,9 +178,9 @@ XWorkArea::XWorkArea(int x, int y, int w, int h)
fl_set_scrollbar_bounds(scrollbar, 0.0, 0.0);
fl_set_scrollbar_value(scrollbar, 0.0);
fl_set_scrollbar_size(scrollbar, scrollbar->h);
int const bw = int(abs(fl_get_border_width()));
// Create the workarea pixmap
createPixmap(w - 15 - 2 * bw, h - 2 * bw);
@ -200,7 +200,7 @@ XWorkArea::XWorkArea(int x, int y, int w, int h)
C_XWorkArea_work_area_handler);
obj->wantkey = FL_KEY_ALL;
obj->u_vdata = this;
fl_set_object_boxtype(obj,FL_DOWN_BOX);
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
@ -278,7 +278,7 @@ void XWorkArea::setScrollbarParams(int height, int pos, int line_height)
lyxerr[Debug::GUI] << "scroll: height now " << height << endl;
lyxerr[Debug::GUI] << "scroll: work_height " << work_height << endl;
/* If the text is smaller than the working area, the scrollbar
* maximum must be the working area height. No scrolling will
* be possible */
@ -335,6 +335,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
area->createPixmap(area->workWidth(), area->workHeight());
area->workAreaResize();
area->redraw();
break;
case FL_PUSH:
if (!ev || ev->xbutton.button == 0) break;
@ -389,7 +390,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
// lyxerr << "We have " << num_keys << " keys in the returned buffer" << endl;
// lyxerr << "Our dummy string is " << dummy << endl;
#endif
if (lyxerr.debugging(Debug::KEY)) {
char const * tmp = XKeysymToString(key);
char const * tmp2 = XKeysymToString(keysym);
@ -477,7 +478,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
XLyXKeySym * xlk = new XLyXKeySym;
xlk->initFromKeySym(ret_key);
area->workAreaKeyPress(LyXKeySymPtr(xlk),
x_key_state(ret_state));
}

View File

@ -40,7 +40,7 @@ public:
}
///
Window getWin() const { return work_area->form->window; }
///
///
virtual void setScrollbarParams(int height, int pos, int line_height);
///
Pixmap getPixmap() const { return workareapixmap; }
@ -48,12 +48,12 @@ public:
static int work_area_handler(FL_OBJECT *, int event,
FL_Coord, FL_Coord,
int /*key*/, void * xev);
/// return x position of window
int xpos() const { return work_area->x; }
/// return y position of window
int ypos() const { return work_area->y; }
/// xforms callback from scrollbar
void scroll_cb();
/// a selection exists
@ -84,5 +84,5 @@ private:
/// the current document's height (for scrollbar)
int doc_height_;
};
#endif // XWORKAREA_H

View File

@ -106,7 +106,7 @@
#include "FormThesaurus.h"
#include "forms/form_thesaurus.h"
#endif
#include "FormToc.h"
#include "forms/form_toc.h"

View File

@ -40,14 +40,14 @@ namespace {
GC createGC()
{
XGCValues val;
val.foreground = BlackPixel(fl_get_display(),
val.foreground = BlackPixel(fl_get_display(),
DefaultScreen(fl_get_display()));
val.function = GXcopy;
val.graphics_exposures = false;
val.line_style = LineSolid;
val.line_width = 0;
return XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0),
return XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0),
GCForeground | GCFunction | GCGraphicsExposures
| GCLineWidth | GCLineStyle , &val);
}
@ -76,13 +76,13 @@ XScreen::~XScreen()
XFreeGC(fl_get_display(), gc_copy);
}
void XScreen::setCursorColor()
void XScreen::setCursorColor()
{
if (!lyxColorHandler.get()) return;
GC gc = lyxColorHandler->getGCForeground(LColor::cursor);
XGCValues val;
XGetGCValues(fl_get_display(),
gc, GCForeground, &val);
@ -95,14 +95,14 @@ void XScreen::showManualCursor(LyXText const * text, int x, int y,
{
// Update the cursor color.
setCursorColor();
int const y1 = max(y - text->first_y - asc, 0);
int const y_tmp = min(y - text->first_y + desc,
static_cast<int>(owner_.workHeight()));
// Secure against very strange situations
int const y2 = max(y_tmp, y1);
if (cursor_pixmap) {
XFreePixmap(fl_get_display(), cursor_pixmap);
cursor_pixmap = 0;
@ -127,7 +127,7 @@ void XScreen::showManualCursor(LyXText const * text, int x, int y,
break;
}
cursor_pixmap =
cursor_pixmap =
XCreatePixmap (fl_get_display(),
fl_root,
cursor_pixmap_w,
@ -174,11 +174,11 @@ void XScreen::hideCursor()
if (!cursor_visible_) return;
if (cursor_pixmap) {
XCopyArea (fl_get_display(),
XCopyArea (fl_get_display(),
cursor_pixmap,
owner_.getWin(),
gc_copy,
0, 0,
0, 0,
cursor_pixmap_w, cursor_pixmap_h,
cursor_pixmap_x + owner_.xpos(),
cursor_pixmap_y + owner_.ypos());
@ -186,7 +186,7 @@ void XScreen::hideCursor()
cursor_visible_ = false;
}
void XScreen::expose(int x, int y, int w, int h)
{
lyxerr[Debug::GUI] << "expose " << w << "x" << h
@ -233,8 +233,8 @@ void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
old_first - text->first_y);
} else {
drawFromTo(text, bv,
owner_.workHeight() + old_first - text->first_y,
owner_.workHeight(), 0, 0, internal);
owner_.workHeight() + old_first - text->first_y,
owner_.workHeight(), 0, 0, internal);
XCopyArea (fl_get_display(),
owner_.getWin(),
owner_.getWin(),
@ -250,7 +250,7 @@ void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
owner_.workWidth(), text->first_y - old_first);
}
} else {
// make a dumb new-draw
// make a dumb new-draw
drawFromTo(text, bv, 0, owner_.workHeight(), 0, 0, internal);
expose(0, 0, owner_.workWidth(), owner_.workHeight());
}

View File

@ -20,7 +20,7 @@
#include "screen.h"
#include "XWorkArea.h"
/** The class XScreen is used for the main Textbody.
Concretely, the screen is held in a pixmap. This pixmap is kept up to
date and used to optimize drawing on the screen.
@ -42,7 +42,7 @@ public:
virtual void showManualCursor(LyXText const *, int x, int y,
int asc, int desc,
Cursor_Shape shape);
/** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */
virtual void draw(LyXText *, BufferView *, unsigned int y);
@ -50,14 +50,14 @@ public:
protected:
/// get the work area
virtual WorkArea & workarea() const { return owner_; }
/// Copies specified area of pixmap to screen
virtual void expose(int x, int y, int w, int h);
virtual void expose(int x, int y, int w, int h);
private:
/// our owning widget
XWorkArea & owner_;
///
Pixmap cursor_pixmap;
///

View File

@ -1,3 +1,6 @@
2002-06-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insettext.C: layout as layout
2002-05-28 André Pönitz <poenitz@gmx.net>
@ -6,12 +9,12 @@
* insetref.C: tiny whitespace
2002-06-15 Herbert Voss <voss@perce.de>
* insetgraphics.C: (prepareFile) fix bug with zipped eps-files
and take always convert when no userdefined converter was
found
(latex) small changes in the lyxerr output
* insetgraphics.C: (prepareFile) fix bug with zipped eps-files
and take always convert when no userdefined converter was
found
(latex) small changes in the lyxerr output
2002-06-15 LyX Development team <lyx@rilke>
* inset*.[Ch] (docbook): Added new argument to take the pernicious
@ -24,7 +27,7 @@
2002-06-13 Edwin Leuven <leuven@fee.uva.nl>
* insetquotes.C: change lyxfont::draw to font_metrics::draw
2002-06-12 Vitaly Lipatov <LAV@VL3143.spb.edu>
* insetquotes.C (draw): fix drawing of double quotes
@ -32,27 +35,27 @@
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* insettabular.C: s/scrollCB/scrollDocView/
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* insettext.C: change of topCursorVisible()
prototype
2002-06-12 John Levon <moz@compsoc.man.ac.uk>
* insettext.h:
* insettext.C: rename/change of LyXScreen
2002-06-07 Angus Leeming <leeming@lyx.org>
Fixes needed to compile with Compaq cxx 6.5.
* insetexternal.C:
* insetexternal.C:
all c-library variables have been moved into namespace std.
Wrap using std::xyz declarations inside a #ifndef CXX_GLOBAL_CSTD block.
2002-06-05 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* insetinclude.C (uniqueID):
* insetinclude.C (uniqueID):
* insetgraphics.C (uniqueID): renamed from unique_id, since this
conflicted with some AIX headers.

View File

@ -19,7 +19,7 @@
#include "BufferView.h"
#include "support/lstrings.h"
#include "frontends/Painter.h"
#include "frontends/mouse_state.h"
#include "frontends/mouse_state.h"
#include "commandtags.h"
#include "support/lstrings.h"
#include "gettext.h"

View File

@ -454,7 +454,7 @@ public:
// if that one has one!
///
virtual bool insetButtonRelease(BufferView *,
int x, int y, mouse_button::state button);
int x, int y, mouse_button::state button);
///
virtual void insetMotionNotify(BufferView *, int x, int y, mouse_button::state state);
///

View File

@ -235,7 +235,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
mouse_button::state button)
mouse_button::state button)
{
UpdatableInset::edit(bv, xp, yp, button);

View File

@ -309,7 +309,7 @@ void InsetERT::insetButtonPress(BufferView * bv,
}
bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y,
bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y,
mouse_button::state button)
{
if (button == mouse_button::button3) {
@ -454,7 +454,7 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
switch (action) {
case LFUN_LAYOUT:
bv->owner()->setLayout(inset.paragraph()->layout());
bv->owner()->setLayout(inset.paragraph()->layout()->name());
break;
default:
result = InsetCollapsable::localDispatch(bv, action, arg);
@ -712,7 +712,7 @@ int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const
void InsetERT::update(BufferView * bv, LyXFont const & font,
bool reinit)
bool reinit)
{
if (inset.need_update & InsetText::INIT ||
inset.need_update & InsetText::FULL)

View File

@ -25,7 +25,6 @@
// the following are needed just to get the layout of the enclosing
// paragraph. This seems a bit too much to me (JMarc)
#include "lyxlayout.h"
#include "lyxtextclasslist.h"
#include "buffer.h"
#include "paragraph.h"
@ -65,9 +64,8 @@ int InsetFoot::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
if (buf && parOwner()) {
LyXLayout const & layout =
textclasslist[buf->params.textclass][parOwner()->layout()];
fragile |= layout.intitle;
LyXLayout_ptr const & layout = parOwner()->layout();
fragile |= layout->intitle;
}
os << "%\n\\footnote{";

View File

@ -601,8 +601,8 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
string const orig_file = params().filename;
string orig_file_with_path =
MakeAbsPath(orig_file, buf->filePath());
lyxerr[Debug::GRAPHICS] << "[InsetGraphics::prepareFile] orig_file = "
<< orig_file << "\n\twith path: "
lyxerr[Debug::GRAPHICS] << "[InsetGraphics::prepareFile] orig_file = "
<< orig_file << "\n\twith path: "
<< orig_file_with_path << endl;
if (!IsFileReadable(orig_file_with_path))
@ -627,13 +627,13 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
lyxerr[Debug::GRAPHICS] << "\twe have a zipped file ("
<< getExtFromContents(orig_file_with_path) << ")\n";
if (params().noUnzip && zipped) {
lyxerr[Debug::GRAPHICS]
lyxerr[Debug::GRAPHICS]
<< "\tpass file unzipped to LaTeX but with full path.\n";
// latex needs an absolue path, otherwise the coresponding
// *.eps.bb file isn't found
return orig_file_with_path;
}
string temp_file(orig_file);
// Uncompress the file if necessary. If it has been uncompressed in
// a previous call to prepareFile, do nothing.
@ -649,7 +649,7 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
<< (success ? " succeeded\n" : " failed\n");
} else
lyxerr[Debug::GRAPHICS]
<< "\tzipped file " << temp_file
<< "\tzipped file " << temp_file
<< " exists! Maybe no tempdir ...\n";
orig_file_with_path = unzipFile(temp_file);
lyxerr[Debug::GRAPHICS]
@ -691,12 +691,12 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
temp_file = MakeAbsPath(temp_file, buf->tmppath);
lyxerr[Debug::GRAPHICS]
<< "\tchanged to: " << temp_file << endl;
// if the file doen't exists, copy it into the tempdi
if (!IsFileReadable(temp_file)) {
bool const success = lyx::copy(orig_file_with_path, temp_file);
lyxerr[Debug::GRAPHICS]
<< "\tcopying from " << orig_file_with_path << " to "
<< "\tcopying from " << orig_file_with_path << " to "
<< temp_file
<< (success ? " succeeded\n" : " failed\n");
if (!success) {
@ -716,7 +716,7 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
// the orig_file_with_path, maybe it is a zipped one
return lyxrc.use_tempdir ? temp_file : orig_file_with_path;
}
string const outfile_base = RemoveExtension(temp_file);
lyxerr[Debug::GRAPHICS]
<< "\tThe original file is " << orig_file << "\n"
@ -728,21 +728,21 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
// if no special converter defined, than we take the default one
// from ImageMagic: convert from:inname.from to:outname.to
if (!converters.convert(buf, temp_file, outfile_base, from, to)) {
string const command =
string const command =
"convert " +
from + ':' + temp_file + ' ' +
to + ':' + outfile_base + '.' + to;
lyxerr[Debug::GRAPHICS]
lyxerr[Debug::GRAPHICS]
<< "No converter defined! I use convert from ImageMagic:\n\t"
<< command << endl;
Systemcall one;
one.startscript(Systemcall::Wait, command);
if (!IsFileReadable(ChangeExtension(outfile_base, to)))
Alert::alert(_("Cannot convert Image (not existing file??)"),
Alert::alert(_("Cannot convert Image (not existing file?)"),
_("No information for converting from ")
+ from + _(" to ") + to);
}
return RemoveExtension(temp_file);
}
@ -838,7 +838,8 @@ int InsetGraphics::linuxdoc(Buffer const *, ostream &) const
// For explanation on inserting graphics into DocBook checkout:
// http://linuxdoc.org/LDP/LDP-Author-Guide/inserting-pictures.html
// See also the docbook guide at http://www.docbook.org/
int InsetGraphics::docbook(Buffer const *, ostream & os, bool mixcont) const
int InsetGraphics::docbook(Buffer const *, ostream & os,
bool /*mixcont*/) const
{
// In DocBook v5.0, the graphic tag will be eliminated from DocBook, will
// need to switch to MediaObject. However, for now this is sufficient and

View File

@ -94,7 +94,7 @@ struct InsetGraphicsParams
void Write(std::ostream & os) const;
/// If the token belongs to our parameters, read it.
bool Read(LyXLex & lex, string const & token);
/// convert
/// convert
// Only a subset of InsetGraphicsParams is needed for display purposes.
// This function also interrogates lyxrc to ascertain whether
// to display or not.

View File

@ -342,7 +342,8 @@ int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const
}
int InsetInclude::docbook(Buffer const * buffer, ostream & os, bool mixcont) const
int InsetInclude::docbook(Buffer const * buffer, ostream & os,
bool /*mixcont*/) const
{
string incfile(params_.cparams.getContents());

View File

@ -53,7 +53,7 @@ int InsetSpecialChar::width(BufferView *, LyXFont const & font) const
case HYPHENATION:
{
int w = font_metrics::width('-', font);
if (w > 5)
if (w > 5)
w -= 2; // to make it look shorter
return w;
}

View File

@ -140,8 +140,7 @@ InsetText::InsetText(BufferParams const & bp)
do_reinit(false)
{
par = new Paragraph;
par->layout(textclasslist[bp.textclass].defaultLayoutName());
par->layout(textclasslist[bp.textclass].defaultLayout());
init();
}
@ -219,7 +218,7 @@ InsetText::~InsetText()
void InsetText::clear()
{
// This is a gross hack...
string old_layout = par->layout();
LyXLayout_ptr old_layout = par->layout();
while (par) {
Paragraph * tmp = par->next();
@ -663,7 +662,7 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty) const
bv->owner()->updateMenubar();
bv->owner()->updateToolbar();
if (old_par != cpar(bv)) {
bv->owner()->setLayout(cpar(bv)->layout());
bv->owner()->setLayout(cpar(bv)->layout()->name());
old_par = cpar(bv);
}
}
@ -807,9 +806,9 @@ void InsetText::insetUnlock(BufferView * bv)
code = FULL;
} else if (owner()) {
bv->owner()->setLayout(owner()->getLyXText(bv)
->cursor.par()->layout());
->cursor.par()->layout()->name());
} else
bv->owner()->setLayout(bv->text->cursor.par()->layout());
bv->owner()->setLayout(bv->text->cursor.par()->layout()->name());
// hack for deleteEmptyParMech
if (par->size()) {
lt->setCursor(bv, par, 0);
@ -1086,7 +1085,9 @@ void InsetText::insetButtonPress(BufferView * bv,
lt = 0;
updateLocal(bv, CURSOR, false);
}
bv->owner()->setLayout(cpar(bv)->layout());
bv->owner()->setLayout(cpar(bv)->layout()->name());
// we moved the view we cannot do mouse selection in this case!
if (getLyXText(bv)->first_y != old_first_y)
no_selection = true;
@ -1443,7 +1444,7 @@ InsetText::localDispatch(BufferView * bv,
case LFUN_LAYOUT:
// do not set layouts on non breakable textinsets
if (autoBreakRows) {
string cur_layout = cpar(bv)->layout();
string cur_layout = cpar(bv)->layout()->name();
// Derive layout number from given argument (string)
// and current buffer's textclass (number). */
@ -1454,7 +1455,7 @@ InsetText::localDispatch(BufferView * bv,
// If the entry is obsolete, use the new one instead.
if (hasLayout) {
string const & obs =
textclasslist[tclass][layout].
textclasslist[tclass][layout]->
obsoleted_by();
if (!obs.empty())
layout = obs;
@ -1470,13 +1471,13 @@ InsetText::localDispatch(BufferView * bv,
if (cur_layout != layout) {
cur_layout = layout;
lt->setLayout(bv, layout);
bv->owner()->setLayout(cpar(bv)->layout());
bv->owner()->setLayout(cpar(bv)->layout()->name());
updwhat = CURSOR_PAR;
updflag = true;
}
} else {
// reset the layout box
bv->owner()->setLayout(cpar(bv)->layout());
bv->owner()->setLayout(cpar(bv)->layout()->name());
}
break;
case LFUN_PARAGRAPH_SPACING:
@ -1593,8 +1594,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
string sgmlparam;
int desc_on = 0; // description mode
LyXLayout const & style =
textclasslist[buf->params.textclass][p->layout()];
LyXLayout_ptr const & style = p->layout();
// environment tag closing
for (; depth > p->params().depth(); --depth) {
@ -1610,7 +1610,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
}
if (depth == p->params().depth()
&& environment_stack[depth] != style.latexname()
&& environment_stack[depth] != style->latexname()
&& !environment_stack[depth].empty()) {
if (environment_inner[depth] != "!-- --") {
item_name= "listitem";
@ -1626,9 +1626,9 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
}
// Write opening SGML tags.
switch (style.latextype) {
switch (style->latextype) {
case LATEX_PARAGRAPH:
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style.latexname());
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style->latexname());
break;
case LATEX_COMMAND:
@ -1643,12 +1643,12 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
environment_stack[depth].erase();
}
if (environment_stack[depth] != style.latexname()) {
if (environment_stack[depth] != style->latexname()) {
if (environment_stack.size() == depth + 1) {
environment_stack.push_back("!-- --");
environment_inner.push_back("!-- --");
}
environment_stack[depth] = style.latexname();
environment_stack[depth] = style->latexname();
environment_inner[depth] = "!-- --";
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, environment_stack[depth]);
} else {
@ -1660,17 +1660,17 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
}
}
if (style.latextype == LATEX_ENVIRONMENT) {
if (!style.latexparam().empty()) {
if (style.latexparam() == "CDATA")
if (style->latextype == LATEX_ENVIRONMENT) {
if (!style->latexparam().empty()) {
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
else
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style.latexparam());
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style->latexparam());
}
break;
}
desc_on = (style.labeltype == LABEL_MANUAL);
desc_on = (style->labeltype == LABEL_MANUAL);
environment_inner[depth] = desc_on?"varlistentry":"listitem";
lines += buf->sgmlOpenTag(os, depth + 1 + command_depth, mixcont, environment_inner[depth]);
@ -1680,7 +1680,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
break;
default:
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style.latexname());
lines += buf->sgmlOpenTag(os, depth + command_depth, mixcont, style->latexname());
break;
}
@ -1689,13 +1689,13 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
string end_tag;
// write closing SGML tags
switch (style.latextype) {
switch (style->latextype) {
case LATEX_ENVIRONMENT:
if (!style.latexparam().empty()) {
if (style.latexparam() == "CDATA")
if (!style->latexparam().empty()) {
if (style->latexparam() == "CDATA")
os << "]]>";
else
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style.latexparam());
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style->latexparam());
}
break;
case LATEX_ITEM_ENVIRONMENT:
@ -1704,10 +1704,10 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
lines += buf->sgmlCloseTag(os, depth + 1 + command_depth, mixcont, end_tag);
break;
case LATEX_PARAGRAPH:
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style.latexname());
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style->latexname());
break;
default:
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style.latexname());
lines += buf->sgmlCloseTag(os, depth + command_depth, mixcont, style->latexname());
break;
}
}
@ -1740,9 +1740,9 @@ void InsetText::validate(LaTeXFeatures & features) const
}
int InsetText::beginningOfMainBody(Buffer const * buf, Paragraph * p) const
int InsetText::beginningOfMainBody(Paragraph * p) const
{
if (textclasslist[buf->params.textclass][p->layout()].labeltype != LABEL_MANUAL)
if (p->layout()->labeltype != LABEL_MANUAL)
return 0;
else
return p->beginningOfMainBody();

View File

@ -286,7 +286,7 @@ private:
///
typedef Cache::value_type value_type;
///
int beginningOfMainBody(Buffer const *, Paragraph * par) const;
int beginningOfMainBody(Paragraph * par) const;
///
UpdatableInset::RESULT moveRight(BufferView *,
bool activate_inset = true,

View File

@ -433,13 +433,12 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
bv->owner()->prohibitInput();
if (label.empty()) {
Paragraph * par = bv->getLyXText()->cursor.par();
LyXTextClass const & tclass =
textclasslist[bv->buffer()->params.textclass];
LyXLayout const * layout = &tclass[par->layout()];
LyXLayout_ptr layout = par->layout();
if (layout->latextype == LATEX_PARAGRAPH && par->previous()) {
Paragraph * par2 = par->previous();
LyXLayout const * layout2 = &tclass[par2->layout()];
LyXLayout_ptr const & layout2 = par2->layout();
if (layout2->latextype != LATEX_PARAGRAPH) {
par = par2;
layout = layout2;

View File

@ -14,7 +14,7 @@
#endif
#include "lyx_main.h"
#include "support/filetools.h"
#include "support/lyxlib.h"
#include "support/os.h"
@ -23,7 +23,7 @@
#include "debug.h"
#include "gettext.h"
#include "lyxlex.h"
#include "bufferlist.h"
#include "lyxtextclasslist.h"
#include "lyxserver.h"
@ -55,7 +55,7 @@ extern void LoadLyXFile(string const &);
extern void QuitLyX();
extern LyXServer * lyxserver;
string system_lyxdir;
string build_lyxdir;
string system_tempdir;
@ -118,7 +118,7 @@ LyX::LyX(int & argc, char * argv[])
if (first_start) {
files.push_back(i18nLibFileSearch("examples", "splash.lyx"));
}
#if 0 // FIXME: GUII
// Execute batch commands if available
if (!batch_command.empty()) {
@ -130,7 +130,7 @@ LyX::LyX(int & argc, char * argv[])
last_loaded = bufferlist.newFile("tmpfile", string());
bool success = false;
// try to dispatch to last loaded buffer first
bool const dispatched = last_loaded->dispatch(batch_command, &success);
@ -145,7 +145,7 @@ LyX::LyX(int & argc, char * argv[])
lyx_gui::start(batch_command, files);
}
extern "C" {
static
@ -819,7 +819,7 @@ bool LyX::easyParse(int & argc, char * argv[])
commandLineVersionInfo();
exit(0);
}
// FIXME: why is this commented out ?
// FIXME: why is this commented out ?
// Check for "-nw": No XWindows as for emacs this should
// give a LyX that could be used in a terminal window.
//else if (arg == "-nw") {
@ -836,7 +836,7 @@ bool LyX::easyParse(int & argc, char * argv[])
lyxerr << _("Missing command string after -x switch!") << endl;
// Argh. Setting gui to false segfaults..
// FIXME: when ? how ?
// FIXME: when ? how ?
// gui = false;
}
@ -859,11 +859,11 @@ bool LyX::easyParse(int & argc, char * argv[])
lyxerr << _("Missing filename for --import") << endl;
exit(1);
}
string const file(argv[i+2]);
string const type(argv[i+1]);
removeargs = 3;
batch_command = "buffer-import " + type + " " + file;
lyxerr << "batch_command: "
<< batch_command << endl;

View File

@ -98,7 +98,7 @@ int LyXReplace(BufferView * bv,
return replace_count;
}
bool LyXFind(BufferView * bv,
string const & searchstr, bool forward,
@ -135,7 +135,7 @@ bool LyXFind(BufferView * bv,
bv->toggleSelection();
text->clearSelection();
SearchResult result = forward ?
SearchForward(bv, text, searchstr, casesens, matchwrd) :
SearchBackward(bv, text, searchstr, casesens, matchwrd);
@ -158,7 +158,7 @@ bool LyXFind(BufferView * bv,
return found;
}
SearchResult LyXFind(BufferView * bv, LyXText * text,
string const & searchstr, bool forward,

View File

@ -1906,7 +1906,7 @@ void LyXFunc::doImport(string const & argument)
lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format
<< " file: " << filename << endl;
// need user interaction
if (filename.empty()) {
string initpath = lyxrc.document_path;
@ -1974,7 +1974,7 @@ void LyXFunc::doImport(string const & argument)
}
}
// if the file exists already, and we didn't do
// if the file exists already, and we didn't do
// -i lyx thefile.lyx, warn
if (FileInfo(lyxfile, true).exist() && filename != lyxfile) {
if (!Alert::askQuestion(_("A document by the name"),

View File

@ -183,15 +183,20 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
if (tclass.hasLayout(style)) {
string const tmpname = name_;
this->operator=(tclass[style]);
this->operator=(*tclass[style]);
name_ = tmpname;
} else {
lyxerr << "Cannot copy unknown style `" << style << "'" << endl;
LyXTextClass::const_iterator it = tclass.begin();
LyXTextClass::const_iterator end = tclass.end();
lyxerr << "All layouts so far:" << endl;
lyxerr << "Cannot copy unknown style `"
<< style << "'\n"
<< "All layouts so far:"
<< endl;
LyXTextClass::const_iterator it =
tclass.begin();
LyXTextClass::const_iterator end =
tclass.end();
for (; it != end; ++it) {
lyxerr << it->name() << endl;
lyxerr << (*it)->name()
<< endl;
}
//lexrc.printError("Cannot copy known "
@ -206,7 +211,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
if (tclass.hasLayout(style)) {
string const tmpname = name_;
this->operator=(tclass[style]);
this->operator=(*tclass[style]);
name_ = tmpname;
if (obsoleted_by().empty())
obsoleted_by_ = style;

26
src/lyxlayout_ptr_fwd.h Normal file
View File

@ -0,0 +1,26 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#ifndef LYXLAYOUT_PTR_FWD_H
#define LYXLAYOUT_PTR_FWD_H
#ifdef __GNUG__
#pragma interface
#endif
#include <boost/shared_ptr.hpp>
class LyXLayout;
/// Global typedef
typedef boost::shared_ptr<LyXLayout> LyXLayout_ptr;
#endif

View File

@ -31,6 +31,20 @@ using std::find_if;
using std::remove_if;
using std::ostream;
namespace { // anon
struct compare_name {
compare_name(string const & name)
: name_(name) {}
template <class C>
bool operator()(C & c) {
return c->name() == name_;
}
string name_;
};
} // anon
LyXTextClass::LyXTextClass(string const & fn, string const & cln,
string const & desc)
@ -183,14 +197,14 @@ bool LyXTextClass::Read(string const & filename, bool merge)
string const name = subst(lexrc.getString(),
'_', ' ');
if (hasLayout(name)) {
LyXLayout & lay =
const_cast<LyXLayout &>(operator[](name));
error = do_readStyle(lexrc, lay);
LyXLayout * lay =
operator[](name).get();
error = do_readStyle(lexrc, *lay);
} else {
LyXLayout lay;
lay.setName(name);
if (!(error = do_readStyle(lexrc, lay)))
layoutlist.push_back(lay);
layoutlist.push_back(boost::shared_ptr<LyXLayout>(new LyXLayout(lay)));
if (defaultlayout_.empty()) {
// We do not have a default
// layout yet, so we choose
@ -504,12 +518,12 @@ bool LyXTextClass::hasLayout(string const & n) const
string const name = (n.empty() ? defaultLayoutName() : n);
return find_if(layoutlist.begin(), layoutlist.end(),
lyx::compare_memfun(&LyXLayout::name, name))
compare_name(name))
!= layoutlist.end();
}
LyXLayout const & LyXTextClass::operator[](string const & n) const
LyXLayout_ptr const & LyXTextClass::operator[](string const & n) const
{
lyx::Assert(!n.empty());
@ -527,7 +541,7 @@ LyXLayout const & LyXTextClass::operator[](string const & n) const
LayoutList::const_iterator cit =
find_if(layoutlist.begin(),
layoutlist.end(),
lyx::compare_memfun(&LyXLayout::name, name));
compare_name(name));
if (cit == layoutlist.end()) {
lyxerr << "We failed to find the layout '" << name
@ -541,7 +555,7 @@ LyXLayout const & LyXTextClass::operator[](string const & n) const
lastLayoutName = name;
lastLayoutIndex = std::distance(layoutlist.begin(), cit);
return *cit;
return (*cit);
}
@ -552,7 +566,8 @@ bool LyXTextClass::delete_layout(string const & name)
LayoutList::iterator it =
remove_if(layoutlist.begin(), layoutlist.end(),
lyx::compare_memfun(&LyXLayout::name, name));
compare_name(name));
LayoutList::iterator end = layoutlist.end();
bool const ret = (it != end);
layoutlist.erase(it, end);
@ -589,7 +604,7 @@ string const LyXTextClass::defaultLayoutName() const
}
LyXLayout const & LyXTextClass::defaultLayout() const
LyXLayout_ptr const & LyXTextClass::defaultLayout() const
{
return operator[](defaultLayoutName());
}

View File

@ -17,22 +17,20 @@
#endif
#include "lyxlayout.h"
#include "LString.h"
#include "lyxlayout_ptr_fwd.h"
#include "support/types.h"
#include "LString.h"
#include <vector>
class LyXLex;
///
class LyXTextClass {
public:
///
typedef std::vector<LyXLayout> LayoutList;
typedef std::vector<LyXLayout_ptr> LayoutList;
///
typedef LayoutList::const_iterator const_iterator;
///
@ -58,7 +56,7 @@ public:
bool hasLayout(string const & name) const;
///
LyXLayout const & operator[](string const & vname) const;
LyXLayout_ptr const & operator[](string const & vname) const;
/// Sees to that the textclass structure has been loaded
bool load() const;
@ -66,7 +64,7 @@ public:
///
string const defaultLayoutName() const;
///
LyXLayout const & defaultLayout() const;
LyXLayout_ptr const & defaultLayout() const;
///
string const & name() const;
///

View File

@ -1,8 +1,13 @@
#include <config.h>
#include "button_inset.h"
#include "math_support.h"
#include "frontends/Painter.h"
#include <algorithm>
using std::max;
ButtonInset::ButtonInset()
: MathNestInset(2)
@ -38,4 +43,3 @@ void ButtonInset::draw(MathPainterInfo & pi, int x, int y) const
pi.base.font);
}
}

View File

@ -193,7 +193,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
if (grfx::ImagePtr image = preview(os.str()))
pain.image(x, y, w, h, *image);
#endif
xx += par_->width();
xo_ = x;
yo_ = y;

View File

@ -272,7 +272,7 @@ void InsetFormulaBase::fitInsetCursor(BufferView * bv) const
{
if (!mathcursor)
return;
int const asc = font_metrics::maxAscent(font_);
int const desc = font_metrics::maxDescent(font_);
int x, y;

View File

@ -340,7 +340,7 @@ void MathCursor::insert(string const & str)
void MathCursor::insert(char c)
{
//lyxerr << "inserting '" << c << "'\n";
selClearOrDel();
selClearOrDel();
plainInsert(MathAtom(new MathCharInset(c)));
}
@ -907,7 +907,7 @@ MathCursor::col_type MathCursor::hullCol() const
{
idx_type idx = 0;
MathHullInset * p = enclosingHull(idx);
return p->col(idx);
return p->col(idx);
}
@ -915,7 +915,7 @@ MathCursor::row_type MathCursor::hullRow() const
{
idx_type idx = 0;
MathHullInset * p = enclosingHull(idx);
return p->row(idx);
return p->row(idx);
}
@ -1109,7 +1109,7 @@ bool MathCursor::goUpDown(bool up)
// check if we had something else in mind, if not, this is the future goal
if (targetx_ == -1)
targetx_ = xo;
else
else
xo = targetx_;
// try neigbouring script insets
@ -1522,7 +1522,7 @@ bool MathCursor::interpret(char c)
// no special circumstances, so insert the character without any fuss
insert(c);
autocorrect_ = true;
autocorrect_ = true;
return true;
}
@ -1557,7 +1557,7 @@ string MathCursor::info() const
Cursor_[i].par_->infoize(os);
os << " ";
}
//if (pos() > 0)
//if (pos() > 0)
// prevAtom()->infoize(os);
os << " ";
return os.str().c_str(); // .c_str() needed for lyxstring
@ -1675,7 +1675,7 @@ void MathCursor::handleExtern(const string & arg)
iss >> lang >> extra;
if (extra.empty())
extra = "noextra";
if (selection()) {
MathArray ar;
@ -1710,7 +1710,7 @@ void MathCursor::handleExtern(const string & arg)
insert(pipeThroughExtern(lang, extra, ar));
return;
}
if (hull->getType() == LM_OT_EQUATION) {
lyxerr << "use equation inset\n";
hull->mutate(LM_OT_EQNARRAY);
@ -1722,8 +1722,8 @@ void MathCursor::handleExtern(const string & arg)
cursor().cell() = pipeThroughExtern(lang, extra, ar);
idxLineLast();
return;
}
}
{
lyxerr << "use eqnarray\n";
idxLineLast();

View File

@ -10,6 +10,8 @@
#include "math_mathmlstream.h"
#include "math_streamstr.h"
#include <ostream>
MathDecorationInset::MathDecorationInset(string const & name)
: MathNestInset(1), name_(name)

View File

@ -572,7 +572,7 @@ bool Parser::parse_macro(string & name)
MathMacroTable::create(name, nargs, ar1, ar2);
return true;
}
bool Parser::parse_normal(MathAtom & at)
{
@ -722,7 +722,7 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags,
else if (t.cat() == catAlign) {
++cellcol;
//lyxerr << " column now " << cellcol << " max: " << grid.ncols() << "\n";
if (cellcol == grid.ncols()) {
if (cellcol == grid.ncols()) {
lyxerr << "adding column " << cellcol << "\n";
grid.addCol(cellcol - 1);
}
@ -811,7 +811,7 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags,
// resize the table if necessary
for (int i = 0; i < cols; ++i) {
++cellcol;
if (cellcol == grid.ncols()) {
if (cellcol == grid.ncols()) {
lyxerr << "adding column " << cellcol << "\n";
grid.addCol(cellcol - 1);
}

View File

@ -1,4 +1,3 @@
#include <config.h>
#include "formula.h"
@ -60,7 +59,7 @@ grfx::ImagePtr preview(string const & str)
// do we already have access to a rendered version?
previews_map::const_iterator it = thePreviews.find(str);
if (it != thePreviews.end())
return it->second;
return it->second;
// constructing new item
//grfx::ImagePtr & im = thePreviews[str];
@ -130,4 +129,3 @@ grfx::ImagePtr preview(string const & str)
#endif
return it->second;
}

View File

@ -1,3 +1,4 @@
#include <config.h>
#include "ref_inset.h"
#include "math_cursor.h"
@ -10,6 +11,8 @@
#include "lyxfunc.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "debug.h"
RefInset::RefInset()
: CommandInset("ref")
@ -33,17 +36,17 @@ void RefInset::infoize(std::ostream & os) const
}
int RefInset::dispatch(string const & cmd, idx_type, pos_type)
int RefInset::dispatch(string const & cmd, idx_type, pos_type)
{
if (cmd == "mouse 3") {
cerr << "trying to goto ref" << cell(0) << "\n";
lyxerr << "trying to goto ref" << cell(0) << "\n";
mathcursor->formula()->view()->owner()->getLyXFunc()->
dispatch(LFUN_REF_GOTO, asString(cell(0)));
return 1; // dispatched
}
if (cmd == "mouse 1") {
cerr << "trying to open ref" << cell(0) << "\n";
lyxerr << "trying to open ref" << cell(0) << "\n";
// Eventually trigger dialog with button 3 not 1
// mathcursor->formula()->view()->owner()->getDialogs()
// ->showRef(this);
@ -108,6 +111,7 @@ int RefInset::docbook(std::ostream & os, bool) const
return 0;
}
RefInset::type_info RefInset::types[] = {
{ "ref", N_("Standard"), N_("Ref: ")},
{ "pageref", N_("Page Number"), N_("Page: ")},

View File

@ -209,7 +209,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
case 27:
case XK_Escape:
// Abort
// FIXME: really needed ? when ?
// FIXME: really needed ? when ?
//owner_->view()->focus(true);
init();
deactivate();
@ -236,7 +236,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
#endif
// Return the inputted string
deactivate();
// FIXME: really needed ? when ?
// FIXME: really needed ? when ?
//owner_->view()->focus(true);
if (!input.empty()) {
history_->push_back(input);

View File

@ -189,12 +189,7 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os,
}
// First write the layout
string lay = layout();
if (lay.empty()) {
lay = textclasslist[bparams.textclass].defaultLayoutName();
}
os << "\n\\layout " << layout() << "\n";
os << "\n\\layout " << layout()->name() << "\n";
// Maybe some vertical spaces.
if (params().spaceTop().kind() != VSpace::NONE)
@ -346,7 +341,7 @@ void Paragraph::validate(LaTeXFeatures & features) const
features.require("setspace");
// then the layouts
features.useLayout(layout());
features.useLayout(layout()->name());
// then the fonts
Language const * doc_language = bparams.language;
@ -397,14 +392,14 @@ void Paragraph::validate(LaTeXFeatures & features) const
features.require("ParagraphLeftIndent");
// then the insets
LyXLayout const & lout = textclasslist[bparams.textclass][layout()];
LyXLayout_ptr const & lout = layout();
InsetList::const_iterator icit = insetlist.begin();
InsetList::const_iterator iend = insetlist.end();
for (; icit != iend; ++icit) {
if (icit->inset) {
icit->inset->validate(features);
if (lout.needprotect &&
if (lout->needprotect &&
icit->inset->lyxCode() == Inset::FOOT_CODE)
features.require("NeedLyXFootnoteCode");
}
@ -644,17 +639,17 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams,
{
lyx::Assert(pos >= 0);
LyXLayout const & lout =
textclasslist[bparams.textclass][layout()];
LyXLayout_ptr const & lout = layout();
pos_type main_body = 0;
if (lout.labeltype == LABEL_MANUAL)
if (lout->labeltype == LABEL_MANUAL)
main_body = beginningOfMainBody();
LyXFont layoutfont;
if (pos < main_body)
layoutfont = lout.labelfont;
layoutfont = lout->labelfont;
else
layoutfont = lout.font;
layoutfont = lout->font;
LyXFont tmpfont = getFontSettings(bparams, pos);
#ifndef INHERIT_LANGUAGE
@ -669,10 +664,9 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams,
LyXFont const Paragraph::getLabelFont(BufferParams const & bparams) const
{
LyXLayout const & lout =
textclasslist[bparams.textclass][layout()];
LyXLayout_ptr const & lout = layout();
LyXFont tmpfont = lout.labelfont;
LyXFont tmpfont = lout->labelfont;
tmpfont.setLanguage(getParLanguage(bparams));
return pimpl_->realizeFont(tmpfont, bparams);
@ -681,10 +675,9 @@ LyXFont const Paragraph::getLabelFont(BufferParams const & bparams) const
LyXFont const Paragraph::getLayoutFont(BufferParams const & bparams) const
{
LyXLayout const & lout =
textclasslist[bparams.textclass][layout()];
LyXLayout_ptr const & lout = layout();
LyXFont tmpfont = lout.font;
LyXFont tmpfont = lout->font;
tmpfont.setLanguage(getParLanguage(bparams));
return pimpl_->realizeFont(tmpfont, bparams);
@ -877,8 +870,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
{
// create a new paragraph
Paragraph * tmp = new Paragraph(this);
tmp->layout(textclasslist[bparams.textclass].defaultLayoutName());
tmp->layout(textclasslist[bparams.textclass].defaultLayout());
// remember to set the inset_owner
tmp->setInsetOwner(inInset());
@ -891,8 +883,8 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
tmp->setLabelWidthString(params().labelWidthString());
}
bool isempty = (textclasslist[bparams.textclass][layout()].keepempty &&
!size());
bool isempty = (layout()->keepempty && !size());
if (!isempty && (size() > pos || !size() || flag == 2)) {
tmp->layout(layout());
tmp->params().align(params().align());
@ -932,7 +924,8 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
bibkey = 0;
params().clear();
layout(textclasslist[bparams.textclass].defaultLayoutName());
layout(textclasslist[bparams.textclass].defaultLayout());
// layout stays the same with latex-environments
if (flag) {
@ -952,9 +945,9 @@ void Paragraph::makeSameLayout(Paragraph const * par)
}
int Paragraph::stripLeadingSpaces(lyx::textclass_type tclass)
int Paragraph::stripLeadingSpaces()
{
if (textclasslist[tclass][layout()].free_spacing ||
if (layout()->free_spacing ||
isFreeSpacing()) {
return 0;
}
@ -1037,14 +1030,14 @@ void Paragraph::pasteParagraph(BufferParams const & bparams)
}
int Paragraph::getEndLabel(BufferParams const & bparams) const
int Paragraph::getEndLabel() const
{
Paragraph const * par = this;
depth_type par_depth = getDepth();
while (par) {
string const & layout = par->layout();
int const endlabeltype =
textclasslist[bparams.textclass][layout].endlabeltype;
LyXLayout_ptr const & layout = par->layout();
int const endlabeltype = layout->endlabeltype;
if (endlabeltype != END_LABEL_NO_LABEL) {
if (!next_)
return endlabeltype;
@ -1072,9 +1065,9 @@ Paragraph::depth_type Paragraph::getDepth() const
}
Paragraph::depth_type Paragraph::getMaxDepthAfter(Buffer const * buffer) const
Paragraph::depth_type Paragraph::getMaxDepthAfter() const
{
bool const isenv = textclasslist[buffer->params.textclass][layout()].isEnvironment();
bool const isenv = layout()->isEnvironment();
if (isenv)
return params().depth() + 1;
@ -1117,7 +1110,7 @@ void Paragraph::setLabelWidthString(string const & s)
}
void Paragraph::applyLayout(string const & new_layout)
void Paragraph::applyLayout(LyXLayout_ptr const & new_layout)
{
layout(new_layout);
params().labelWidthString(string());
@ -1254,14 +1247,14 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl;
Inset const * in = inInset();
bool further_blank_line = false;
LyXLayout style;
LyXLayout_ptr style;
// well we have to check if we are in an inset with unlimited
// lenght (all in one row) if that is true then we don't allow
// any special options in the paragraph and also we don't allow
// any environment other then "Standard" to be valid!
if ((in == 0) || !in->forceDefaultParagraphs(in)) {
style = textclasslist[bparams.textclass][layout()];
style = layout();
if (params().startOfAppendix()) {
os << "\\appendix\n";
@ -1274,7 +1267,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
texrow.newline();
}
if (tex_code_break_column && style.isCommand()) {
if (tex_code_break_column && style->isCommand()) {
os << '\n';
texrow.newline();
}
@ -1309,7 +1302,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
if (language->babel() != previous_language->babel()
// check if we already put language command in TeXEnvironment()
&& !(style.isEnvironment()
&& !(style->isEnvironment()
&& (!previous() || previous()->layout() != layout() ||
previous()->params().depth() != params().depth())))
{
@ -1340,11 +1333,11 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
texrow.newline();
}
switch (style.latextype) {
switch (style->latextype) {
case LATEX_COMMAND:
os << '\\'
<< style.latexname()
<< style.latexparam();
<< style->latexname()
<< style->latexparam();
break;
case LATEX_ITEM_ENVIRONMENT:
if (bibkey) {
@ -1374,9 +1367,9 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
(size() == 0
? getLayoutFont(bparams) : getFont(bparams, size() - 1));
bool is_command = style.isCommand();
bool is_command = style->isCommand();
if (style.resfont.size() != font.size() && next_ && !is_command) {
if (style->resfont.size() != font.size() && next_ && !is_command) {
if (!need_par)
os << "{";
os << "\\" << font.latexSize() << " \\par}";
@ -1385,7 +1378,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
} else if (is_command)
os << "}";
switch (style.latextype) {
switch (style->latextype) {
case LATEX_ITEM_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT:
if (next_ && (params().depth() < next_->params().depth())) {
@ -1559,7 +1552,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
bool return_value = false;
LyXLayout style;
LyXLayout_ptr style;
// well we have to check if we are in an inset with unlimited
// lenght (all in one row) if that is true then we don't allow
@ -1571,14 +1564,14 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
if (asdefault) {
style = textclasslist[bparams.textclass].defaultLayout();
} else {
style = textclasslist[bparams.textclass][layout()];
style = layout();
}
LyXFont basefont;
// Maybe we have to create a optional argument.
pos_type main_body;
if (style.labeltype != LABEL_MANUAL)
if (style->labeltype != LABEL_MANUAL)
main_body = 0;
else
main_body = beginningOfMainBody();
@ -1593,7 +1586,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
basefont = getLayoutFont(bparams);
}
moving_arg |= style.needprotect;
moving_arg |= style->needprotect;
// Which font is currently active?
LyXFont running_font(basefont);
@ -1604,7 +1597,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
// if the paragraph is empty, the loop will not be entered at all
if (!size()) {
if (style.isCommand()) {
if (style->isCommand()) {
os << '{';
++column;
}
@ -1627,7 +1620,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
os << ']';
++column;
}
if (style.isCommand()) {
if (style->isCommand()) {
os << '{';
++column;
}
@ -1671,7 +1664,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
// Do not print the separation of the optional argument
if (i != main_body - 1) {
pimpl_->simpleTeXBlanks(os, texrow, i,
column, font, style);
column, font, *style);
}
}
@ -1689,7 +1682,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
if (c == Paragraph::META_NEWLINE) {
// newlines are handled differently here than
// the default in SimpleTeXSpecialChars().
if (!style.newline_allowed) {
if (!style->newline_allowed) {
os << '\n';
} else {
if (open_font) {
@ -1715,7 +1708,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
os, texrow, moving_arg,
font, running_font,
basefont, open_font,
style, i, column, c);
*style, i, column, c);
}
}
@ -1826,8 +1819,7 @@ Paragraph * Paragraph::TeXEnvironment(Buffer const * buf,
{
lyxerr[Debug::LATEX] << "TeXEnvironment... " << this << endl;
LyXLayout const & style =
textclasslist[bparams.textclass][layout()];
LyXLayout_ptr const & style = layout();
Language const * language = getParLanguage(bparams);
Language const * doc_language = bparams.language;
@ -1860,21 +1852,21 @@ Paragraph * Paragraph::TeXEnvironment(Buffer const * buf,
leftindent_open = true;
}
if (style.isEnvironment()) {
if (style.latextype == LATEX_LIST_ENVIRONMENT) {
os << "\\begin{" << style.latexname() << "}{"
if (style->isEnvironment()) {
if (style->latextype == LATEX_LIST_ENVIRONMENT) {
os << "\\begin{" << style->latexname() << "}{"
<< params().labelWidthString() << "}\n";
} else if (style.labeltype == LABEL_BIBLIO) {
} else if (style->labeltype == LABEL_BIBLIO) {
// ale970405
os << "\\begin{" << style.latexname() << "}{"
os << "\\begin{" << style->latexname() << "}{"
<< bibitemWidest(buf)
<< "}\n";
} else if (style.latextype == LATEX_ITEM_ENVIRONMENT) {
os << "\\begin{" << style.latexname() << '}'
<< style.latexparam() << '\n';
} else if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
os << "\\begin{" << style->latexname() << '}'
<< style->latexparam() << '\n';
} else
os << "\\begin{" << style.latexname() << '}'
<< style.latexparam() << '\n';
os << "\\begin{" << style->latexname() << '}'
<< style->latexparam() << '\n';
texrow.newline();
}
Paragraph * par = this;
@ -1882,11 +1874,12 @@ Paragraph * Paragraph::TeXEnvironment(Buffer const * buf,
par = par->TeXOnePar(buf, bparams, os, texrow, false);
if (par && par->params().depth() > params().depth()) {
if (textclasslist[bparams.textclass][par->layout()].isParagraph()
if (par->layout()->isParagraph()) {
// Thinko!
// How to handle this? (Lgb)
//&& !suffixIs(os, "\n\n")
) {
//) {
// There should be at least one '\n' already
// but we need there to be two for Standard
// paragraphs that are depth-increment'ed to be
@ -1907,8 +1900,8 @@ Paragraph * Paragraph::TeXEnvironment(Buffer const * buf,
&& par->params().depth() == params().depth()
&& par->params().leftIndent() == params().leftIndent());
if (style.isEnvironment()) {
os << "\\end{" << style.latexname() << "}\n";
if (style->isEnvironment()) {
os << "\\end{" << style->latexname() << "}\n";
texrow.newline();
}
@ -2169,16 +2162,14 @@ void Paragraph::id(int id_arg)
}
string const & Paragraph::layout() const
LyXLayout_ptr const & Paragraph::layout() const
{
return layout_;
}
void Paragraph::layout(string const & new_layout)
void Paragraph::layout(LyXLayout_ptr const & new_layout)
{
lyx::Assert(!new_layout.empty());
layout_ = new_layout;
}

View File

@ -15,6 +15,7 @@
#include "LString.h"
#include "lyxlayout_ptr_fwd.h"
#include "insets/inset.h" // Just for Inset::Code
#include "lyxfont.h" // Just for LyXFont::FONT_SIZE
#include "support/types.h"
@ -146,7 +147,7 @@ public:
/** Check if the current paragraph is the last paragraph in a
proof environment */
int getEndLabel(BufferParams const &) const;
int getEndLabel() const;
///
Inset * inInset() const;
///
@ -164,9 +165,9 @@ public:
void clearContents();
///
string const & layout() const;
LyXLayout_ptr const & layout() const;
///
void layout(string const & new_layout);
void layout(LyXLayout_ptr const & new_layout);
///
void setCounter(int i, int v);
@ -221,9 +222,9 @@ public:
/// The nesting depth of a paragraph
depth_type getDepth() const;
/// The maximal possible depth of a paragraph after this one
depth_type getMaxDepthAfter(Buffer const *) const;
depth_type getMaxDepthAfter() const;
///
void applyLayout(string const & new_layout);
void applyLayout(LyXLayout_ptr const & new_layout);
///
int getFirstCounter(int i) const;
///
@ -318,7 +319,7 @@ public:
Paragraph * getParFromID(int id) const;
///
int stripLeadingSpaces(lyx::textclass_type tclass);
int stripLeadingSpaces();
#ifndef NO_PEXTRA_REALLY
/* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE
@ -338,7 +339,7 @@ public:
ParagraphParameters const & params() const;
private:
///
string layout_;
LyXLayout_ptr layout_;
public:
/** Both these definitions must be made public to keep Compaq cxx 6.5
* happy.

View File

@ -278,7 +278,7 @@ void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow,
bool Paragraph::Pimpl::isTextAt(string const & str, pos_type pos)
{
pos_type const len = str.length();
// is the paragraph large enough?
if (pos + len > size())
return false;
@ -384,7 +384,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
break;
case '±': case '²': case '³':
case '×': case '÷': case '¹':
case '×': case '÷': case '¹':
case '¬': case 'µ':
if ((bparams.inputenc == "latin1" ||
bparams.inputenc == "latin9") ||
@ -544,7 +544,7 @@ Paragraph * Paragraph::Pimpl::TeXDeeper(Buffer const * buf,
Paragraph * par = owner_;
while (par && par->params().depth() == owner_->params().depth()) {
if (textclasslist[bparams.textclass][par->layout()].isEnvironment()) {
if (par->layout()->isEnvironment()) {
par = par->TeXEnvironment(buf, bparams,
os, texrow);
} else {
@ -584,7 +584,7 @@ LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font,
while (par && par->getDepth() && !tmpfont.resolved()) {
par = par->outerHook();
if (par) {
tmpfont.realize(tclass[par->layout()].font
tmpfont.realize(par->layout()->font
#ifdef INHERIT_LANGUAGE
, bparams.language
#endif

View File

@ -54,7 +54,7 @@ struct firster {
/**
* copy elements in the given range to the output iterator
* copy elements in the given range to the output iterator
* if the predicate evaluates as true
*/
template <class InputIter, class OutputIter, class Func>

View File

@ -1449,7 +1449,8 @@ void LyXTabular::OldFormatRead(BufferParams const & bp,
Paragraph * par = new Paragraph;
Paragraph * return_par = 0;
par->layout(textclasslist[bp.textclass].defaultLayoutName());
par->layout(textclasslist[bp.textclass].defaultLayout());
string tmptok;
int pos = 0;
Paragraph::depth_type depth = 0;
@ -2371,7 +2372,8 @@ int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const
}
int LyXTabular::docbook(Buffer const * buf, ostream & os, bool mixcont) const
int LyXTabular::docbook(Buffer const * buf, ostream & os,
bool /*mixcont*/) const
{
int ret = 0;

View File

@ -90,10 +90,9 @@ int LyXText::workWidth(BufferView * bview, Inset * inset) const
return workWidth(bview);
}
LyXLayout const & layout =
textclasslist[bview->buffer()->params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
if (layout.margintype != MARGIN_RIGHT_ADDRESS_BOX) {
if (layout->margintype != MARGIN_RIGHT_ADDRESS_BOX) {
// Optimization here: in most cases, the real row is
// not needed, but only the par/pos values. So we just
// construct a dummy row for leftMargin. (JMarc)
@ -215,7 +214,7 @@ int LyXText::singleWidth(BufferView * bview, Paragraph * par,
return font_metrics::width(c, font);
} else if (IsHfillChar(c)) {
// Because of the representation as vertical lines
// Because of the representation as vertical lines
return 3;
} else if (c == Paragraph::META_INSET) {
Inset * tmpinset = par->getInset(pos);
@ -707,25 +706,25 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
LyXTextClass const & tclass =
textclasslist[bview->buffer()->params.textclass];
LyXLayout const & layout = tclass[row->par()->layout()];
LyXLayout_ptr const & layout = row->par()->layout();
string parindent = layout.parindent;
string parindent = layout->parindent;
int x = LYX_PAPER_MARGIN;
x += font_metrics::signedWidth(tclass.leftmargin(), tclass.defaultfont());
// this is the way, LyX handles the LaTeX-Environments.
// I have had this idea very late, so it seems to be a
// later added hack and this is true
if (!row->par()->getDepth()) {
if (row->par()->layout() == tclass.defaultLayoutName()) {
if (row->par()->layout() == tclass.defaultLayout()) {
// find the previous same level paragraph
if (row->par()->previous()) {
Paragraph * newpar = row->par()
->depthHook(row->par()->getDepth());
if (newpar &&
tclass[newpar->layout()].nextnoindent)
newpar->layout()->nextnoindent)
parindent.erase();
}
}
@ -738,7 +737,7 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
// make a corresponding row. Needed to call LeftMargin()
// check wether it is a sufficent paragraph
if (newpar && tclass[newpar->layout()].isEnvironment()) {
if (newpar && newpar->layout()->isEnvironment()) {
Row dummyrow;
dummyrow.par(newpar);
dummyrow.pos(newpar->size());
@ -751,67 +750,69 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
row->par()->params().depth(0);
}
if (newpar && row->par()->layout() == tclass.defaultLayoutName()) {
if (newpar && row->par()->layout() == tclass.defaultLayout()) {
if (newpar->params().noindent())
parindent.erase();
else
parindent = tclass[newpar->layout()].parindent;
else {
parindent = newpar->layout()->parindent;
}
}
}
LyXFont const labelfont = getLabelFont(bview->buffer(), row->par());
switch (layout.margintype) {
switch (layout->margintype) {
case MARGIN_DYNAMIC:
if (!layout.leftmargin.empty()) {
x += font_metrics::signedWidth(layout.leftmargin,
if (!layout->leftmargin.empty()) {
x += font_metrics::signedWidth(layout->leftmargin,
tclass.defaultfont());
}
if (!row->par()->getLabelstring().empty()) {
x += font_metrics::signedWidth(layout.labelindent,
x += font_metrics::signedWidth(layout->labelindent,
labelfont);
x += font_metrics::width(row->par()->getLabelstring(),
labelfont);
x += font_metrics::width(layout.labelsep, labelfont);
x += font_metrics::width(layout->labelsep, labelfont);
}
break;
case MARGIN_MANUAL:
x += font_metrics::signedWidth(layout.labelindent, labelfont);
x += font_metrics::signedWidth(layout->labelindent, labelfont);
if (row->pos() >= beginningOfMainBody(bview->buffer(), row->par())) {
if (!row->par()->getLabelWidthString().empty()) {
x += font_metrics::width(row->par()->getLabelWidthString(),
labelfont);
x += font_metrics::width(layout.labelsep, labelfont);
x += font_metrics::width(layout->labelsep, labelfont);
}
}
break;
case MARGIN_STATIC:
x += font_metrics::signedWidth(layout.leftmargin, tclass.defaultfont()) * 4
x += font_metrics::signedWidth(layout->leftmargin, tclass.defaultfont()) * 4
/ (row->par()->getDepth() + 4);
break;
case MARGIN_FIRST_DYNAMIC:
if (layout.labeltype == LABEL_MANUAL) {
if (layout->labeltype == LABEL_MANUAL) {
if (row->pos() >= beginningOfMainBody(bview->buffer(), row->par())) {
x += font_metrics::signedWidth(layout.leftmargin,
x += font_metrics::signedWidth(layout->leftmargin,
labelfont);
} else {
x += font_metrics::signedWidth(layout.labelindent,
x += font_metrics::signedWidth(layout->labelindent,
labelfont);
}
} else if (row->pos()
// Special case to fix problems with
// theorems (JMarc)
|| (layout.labeltype == LABEL_STATIC
&& layout.latextype == LATEX_ENVIRONMENT
|| (layout->labeltype == LABEL_STATIC
&& layout->latextype == LATEX_ENVIRONMENT
&& ! row->par()->isFirstInSequence())) {
x += font_metrics::signedWidth(layout.leftmargin,
x += font_metrics::signedWidth(layout->leftmargin,
labelfont);
} else if (layout.labeltype != LABEL_TOP_ENVIRONMENT
&& layout.labeltype != LABEL_BIBLIO
&& layout.labeltype !=
} else if (layout->labeltype != LABEL_TOP_ENVIRONMENT
&& layout->labeltype != LABEL_BIBLIO
&& layout->labeltype !=
LABEL_CENTERED_TOP_ENVIRONMENT) {
x += font_metrics::signedWidth(layout.labelindent,
x += font_metrics::signedWidth(layout->labelindent,
labelfont);
x += font_metrics::width(layout.labelsep, labelfont);
x += font_metrics::width(layout->labelsep, labelfont);
x += font_metrics::width(row->par()->getLabelstring(),
labelfont);
}
@ -835,8 +836,8 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
if (tmprow->fill() < minfill)
minfill = tmprow->fill();
}
x += font_metrics::signedWidth(layout.leftmargin,
x += font_metrics::signedWidth(layout->leftmargin,
tclass.defaultfont());
x += minfill;
}
@ -855,17 +856,17 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
LyXAlignment align; // wrong type
if (row->par()->params().align() == LYX_ALIGN_LAYOUT)
align = layout.align;
align = layout->align;
else
align = row->par()->params().align();
// set the correct parindent
if (row->pos() == 0) {
if ((layout.labeltype == LABEL_NO_LABEL
|| layout.labeltype == LABEL_TOP_ENVIRONMENT
|| layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
|| (layout.labeltype == LABEL_STATIC
&& layout.latextype == LATEX_ENVIRONMENT
if ((layout->labeltype == LABEL_NO_LABEL
|| layout->labeltype == LABEL_TOP_ENVIRONMENT
|| layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
|| (layout->labeltype == LABEL_STATIC
&& layout->latextype == LATEX_ENVIRONMENT
&& ! row->par()->isFirstInSequence()))
&& align == LYX_ALIGN_BLOCK
&& !row->par()->params().noindent()
@ -873,12 +874,12 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
&& (!row->par()->inInset() || !row->par()->inInset()->owner() ||
(row->par()->inInset()->owner()->lyxCode() != Inset::TABULAR_CODE &&
row->par()->inInset()->owner()->lyxCode() != Inset::ERT_CODE))
&& (row->par()->layout() != tclass.defaultLayoutName() ||
&& (row->par()->layout() != tclass.defaultLayout() ||
bview->buffer()->params.paragraph_separation ==
BufferParams::PARSEP_INDENT)) {
x += font_metrics::signedWidth(parindent,
tclass.defaultfont());
} else if (layout.labeltype == LABEL_BIBLIO) {
} else if (layout->labeltype == LABEL_BIBLIO) {
// ale970405 Right width for bibitems
x += bibitemMaxWidth(bview, tclass.defaultfont());
}
@ -897,7 +898,7 @@ int LyXText::rightMargin(Buffer const * buf, Row const * row) const
return LYX_PAPER_MARGIN;
LyXTextClass const & tclass = textclasslist[buf->params.textclass];
LyXLayout const & layout = tclass[row->par()->layout()];
LyXLayout_ptr const & layout = row->par()->layout();
int x = LYX_PAPER_MARGIN
+ font_metrics::signedWidth(tclass.rightmargin(),
@ -919,7 +920,7 @@ int LyXText::rightMargin(Buffer const * buf, Row const * row) const
// make a corresponding row. Needed to call LeftMargin()
// check wether it is a sufficent paragraph
if (newpar && tclass[newpar->layout()].isEnvironment()) {
if (newpar && newpar->layout()->isEnvironment()) {
Row dummyrow;
dummyrow.par(newpar);
dummyrow.pos(0);
@ -934,7 +935,8 @@ int LyXText::rightMargin(Buffer const * buf, Row const * row) const
}
//lyxerr << "rightmargin: " << layout->rightmargin << endl;
x += font_metrics::signedWidth(layout.rightmargin, tclass.defaultfont())
x += font_metrics::signedWidth(layout->rightmargin,
tclass.defaultfont())
* 4 / (row->par()->getDepth() + 4);
return x;
}
@ -942,17 +944,16 @@ int LyXText::rightMargin(Buffer const * buf, Row const * row) const
int LyXText::labelEnd(BufferView * bview, Row const * row) const
{
if (textclasslist[bview->buffer()->params.textclass][row->par()->layout()].margintype
== MARGIN_MANUAL) {
if (row->par()->layout()->margintype == MARGIN_MANUAL) {
Row tmprow;
tmprow = *row;
tmprow.pos(row->par()->size());
// just the beginning of the main body
// just the beginning of the main body
return leftMargin(bview, &tmprow);
} else {
// LabelEnd is only needed,
// if the layout fills a flushleft label.
return 0;
// if the layout fills a flushleft label.
return 0;
}
}
@ -975,11 +976,11 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
pos_type const main_body =
beginningOfMainBody(bview->buffer(), par);
LyXLayout const & layout =
textclasslist[bview->buffer()->params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
pos_type i = pos;
if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) {
if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
// special code for right address boxes, only newlines count
while (i < par->size()) {
if (par->isNewline(i)) {
@ -1012,8 +1013,8 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
// valid here. if not, change it to
// non-display
if (in->display() &&
(layout.isCommand() ||
(layout.labeltype == LABEL_MANUAL
(layout->isCommand() ||
(layout->labeltype == LABEL_MANUAL
&& i < beginningOfMainBody(bview->buffer(), par))))
{
// display istn't allowd
@ -1051,7 +1052,7 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
}
++i;
if (i == main_body) {
x += font_metrics::width(layout.labelsep,
x += font_metrics::width(layout->labelsep,
getLabelFont(bview->buffer(), par));
if (par->isLineSeparator(i - 1))
x-= singleWidth(bview, par, i - 1);
@ -1094,9 +1095,7 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const
pos_type const last = rowLastPrintable(row);
// special handling of the right address boxes
if (textclasslist[bview->buffer()->params.textclass][row->par()->layout()].margintype
== MARGIN_RIGHT_ADDRESS_BOX)
{
if (row->par()->layout()->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
int const tmpfill = row->fill();
row->fill(0); // the minfill in MarginLeft()
w = leftMargin(bview, row);
@ -1104,14 +1103,15 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const
} else
w = leftMargin(bview, row);
LyXLayout const & layout = textclasslist[bview->buffer()->params.textclass][row->par()->layout()];
LyXLayout_ptr const & layout = row->par()->layout();
pos_type const main_body =
beginningOfMainBody(bview->buffer(), row->par());
pos_type i = row->pos();
while (i <= last) {
if (main_body > 0 && i == main_body) {
w += font_metrics::width(layout.labelsep, getLabelFont(bview->buffer(), row->par()));
w += font_metrics::width(layout->labelsep, getLabelFont(bview->buffer(), row->par()));
if (row->par()->isLineSeparator(i - 1))
w -= singleWidth(bview, row->par(), i - 1);
int left_margin = labelEnd(bview, row);
@ -1122,7 +1122,7 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const
++i;
}
if (main_body > 0 && main_body > last) {
w += font_metrics::width(layout.labelsep, getLabelFont(bview->buffer(), row->par()));
w += font_metrics::width(layout->labelsep, getLabelFont(bview->buffer(), row->par()));
if (last >= 0 && row->par()->isLineSeparator(last))
w -= singleWidth(bview, row->par(), last);
int const left_margin = labelEnd(bview, row);
@ -1266,8 +1266,7 @@ bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr,
return true;
// in some labels it does not count
if (textclasslist[buf->params.textclass][row_ptr->par()->layout()].margintype
!= MARGIN_MANUAL
if (row_ptr->par()->layout()->margintype != MARGIN_MANUAL
&& pos < beginningOfMainBody(buf, row_ptr->par()))
return false;
@ -1305,15 +1304,14 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
// ok , let us initialize the maxasc and maxdesc value.
// This depends in LaTeX of the font of the last character
// in the paragraph. The hack below is necessary because
// of the possibility of open footnotes
// of the possibility of open footnotes
// Correction: only the fontsize count. The other properties
// are taken from the layoutfont. Nicer on the screen :)
// are taken from the layoutfont. Nicer on the screen :)
Paragraph * par = row_ptr->par();
Paragraph * firstpar = row_ptr->par();
LyXLayout const & layout
= textclasslist[bview->buffer()->params.textclass][firstpar->layout()];
LyXLayout_ptr const & layout = firstpar->layout();
// as max get the first character of this row then it can increes but not
// decrees the height. Just some point to start with so we don't have to
@ -1335,11 +1333,11 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
//lyxerr << "spacing_val = " << spacing_val << endl;
int maxasc = int(font_metrics::maxAscent(font) *
layout.spacing.getValue() *
spacing_val);
layout->spacing.getValue() *
spacing_val);
int maxdesc = int(font_metrics::maxDescent(font) *
layout.spacing.getValue() *
spacing_val);
layout->spacing.getValue() *
spacing_val);
pos_type const pos_end = rowLast(row_ptr);
int labeladdon = 0;
@ -1394,13 +1392,13 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
if (bview->buffer()->params.paragraph_separation ==
BufferParams::PARSEP_SKIP)
{
if (layout.isParagraph()
if (layout->isParagraph()
&& firstpar->getDepth() == 0
&& firstpar->previous())
{
maxasc += bview->buffer()->params.getDefSkip().inPixels(bview);
} else if (firstpar->previous() &&
textclasslist[bview->buffer()->params.textclass][firstpar->previous()->layout()].isParagraph() &&
firstpar->previous()->layout()->isParagraph() &&
firstpar->previous()->getDepth() == 0)
{
// is it right to use defskip here too? (AS)
@ -1427,7 +1425,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
// This is special code for the chapter, since the label of this
// layout is printed in an extra row
if (layout.labeltype == LABEL_COUNTER_CHAPTER
if (layout->labeltype == LABEL_COUNTER_CHAPTER
&& bview->buffer()->params.secnumdepth >= 0)
{
float spacing_val = 1.0;
@ -1438,17 +1436,17 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
}
labeladdon = int(font_metrics::maxDescent(labelfont) *
layout.spacing.getValue() *
spacing_val)
layout->spacing.getValue() *
spacing_val)
+ int(font_metrics::maxAscent(labelfont) *
layout.spacing.getValue() *
layout->spacing.getValue() *
spacing_val);
}
// special code for the top label
if ((layout.labeltype == LABEL_TOP_ENVIRONMENT
|| layout.labeltype == LABEL_BIBLIO
|| layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
if ((layout->labeltype == LABEL_TOP_ENVIRONMENT
|| layout->labeltype == LABEL_BIBLIO
|| layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
&& row_ptr->par()->isFirstInSequence()
&& !row_ptr->par()->getLabelstring().empty())
{
@ -1461,13 +1459,13 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
labeladdon = int(
(font_metrics::maxAscent(labelfont) *
layout.spacing.getValue() *
layout->spacing.getValue() *
spacing_val)
+(font_metrics::maxDescent(labelfont) *
layout.spacing.getValue() *
layout->spacing.getValue() *
spacing_val)
+ layout.topsep * defaultHeight()
+ layout.labelbottomsep * defaultHeight());
+ layout->topsep * defaultHeight()
+ layout->labelbottomsep * defaultHeight());
}
// and now the layout spaces, for example before and after a section,
@ -1481,17 +1479,17 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
prev->getDepth() == firstpar->getDepth() &&
prev->getLabelWidthString() == firstpar->getLabelWidthString())
{
layoutasc = (layout.itemsep * defaultHeight());
layoutasc = (layout->itemsep * defaultHeight());
} else if (row_ptr->previous()) {
tmptop = layout.topsep;
tmptop = layout->topsep;
if (row_ptr->previous()->par()->getDepth() >= row_ptr->par()->getDepth())
tmptop -= textclasslist[bview->buffer()->params.textclass][row_ptr->previous()->par()->layout()].bottomsep;
tmptop -= row_ptr->previous()->par()->layout()->bottomsep;
if (tmptop > 0)
layoutasc = (tmptop * defaultHeight());
} else if (row_ptr->par()->params().lineTop()) {
tmptop = layout.topsep;
tmptop = layout->topsep;
if (tmptop > 0)
layoutasc = (tmptop * defaultHeight());
@ -1499,7 +1497,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
prev = row_ptr->par()->outerHook();
if (prev) {
maxasc += int(textclasslist[bview->buffer()->params.textclass][prev->layout()].parsep * defaultHeight());
maxasc += int(prev->layout()->parsep * defaultHeight());
} else {
if (firstpar->previous() &&
firstpar->previous()->getDepth() == 0 &&
@ -1508,7 +1506,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
{
// avoid parsep
} else if (firstpar->previous()) {
maxasc += int(layout.parsep * defaultHeight());
maxasc += int(layout->parsep * defaultHeight());
}
}
}
@ -1529,7 +1527,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
// there height depends on the font of the nearest character
if (firstpar->params().lineBottom())
maxdesc += 2 * font_metrics::ascent('x',
getFont(bview->buffer(),
getFont(bview->buffer(),
par,
max(pos_type(0), par->size() - 1)));
@ -1548,13 +1546,13 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
float unusual = 0;
if (comparepar->getDepth() > nextpar->getDepth()) {
usual = (textclasslist[bview->buffer()->params.textclass][comparepar->layout()].bottomsep * defaultHeight());
usual = (comparepar->layout()->bottomsep * defaultHeight());
comparepar = comparepar->depthHook(nextpar->getDepth());
if (comparepar->layout()!= nextpar->layout()
|| nextpar->getLabelWidthString() !=
comparepar->getLabelWidthString())
{
unusual = (textclasslist[bview->buffer()->params.textclass][comparepar->layout()].bottomsep * defaultHeight());
unusual = (comparepar->layout()->bottomsep * defaultHeight());
}
if (unusual > usual)
layoutdesc = unusual;
@ -1565,7 +1563,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
if (comparepar->layout() != nextpar->layout()
|| nextpar->getLabelWidthString() !=
comparepar->getLabelWidthString())
layoutdesc = int(textclasslist[bview->buffer()->params.textclass][comparepar->layout()].bottomsep * defaultHeight());
layoutdesc = int(comparepar->layout()->bottomsep * defaultHeight());
}
}
}
@ -1582,7 +1580,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
height += row_ptr->height();
float x = 0;
if (layout.margintype != MARGIN_RIGHT_ADDRESS_BOX) {
if (layout->margintype != MARGIN_RIGHT_ADDRESS_BOX) {
float dummy;
// this IS needed
row_ptr->width(maxwidth);
@ -1602,7 +1600,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
// Appends the implicit specified paragraph behind the specified row,
// start at the implicit given position
// start at the implicit given position
void LyXText::appendParagraph(BufferView * bview, Row * row) const
{
bool not_ready = true;
@ -1675,7 +1673,7 @@ void LyXText::breakAgain(BufferView * bview, Row * row) const
not_ready = false;
}
// set the dimensions of the row
// set the dimensions of the row
tmprow->fill(fill(bview, tmprow, workWidth(bview)));
setHeightOfRow(bview, tmprow);
} while (not_ready);
@ -1692,7 +1690,7 @@ void LyXText::breakAgainOneRow(BufferView * bview, Row * row)
if (z < row->par()->size()) {
if (!row->next()
|| (row->next() && row->next()->par() != row->par())) {
// insert a new row
// insert a new row
++z;
insertRow(row, row->par(), z);
row = row->next();
@ -1727,13 +1725,13 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
{
LyXTextClass const & tclass =
textclasslist[bview->buffer()->params.textclass];
LyXLayout const & layout = tclass[cursor.par()->layout()];
LyXLayout_ptr const & layout = cursor.par()->layout();
// this is only allowed, if the current paragraph is not empty or caption
// and if it has not the keepempty flag aktive
if ((cursor.par()->size() <= 0)
&& layout.labeltype != LABEL_SENSITIVE
&& !layout.keepempty)
&& layout->labeltype != LABEL_SENSITIVE
&& !layout->keepempty)
return;
setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next());
@ -1750,32 +1748,32 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
if (keep_layout)
keep_layout = 2;
else
keep_layout = layout.isEnvironment();
keep_layout = layout->isEnvironment();
// we need to set this before we insert the paragraph. IMO the
// breakParagraph call should return a bool if it inserts the
// paragraph before or behind and we should react on that one
// but we can fix this in 1.3.0 (Jug 20020509)
bool const isempty = (layout.keepempty && !cursor.par()->size());
bool const isempty = (layout->keepempty && !cursor.par()->size());
cursor.par()->breakParagraph(bview->buffer()->params, cursor.pos(),
keep_layout);
// well this is the caption hack since one caption is really enough
if (layout.labeltype == LABEL_SENSITIVE) {
if (layout->labeltype == LABEL_SENSITIVE) {
if (!cursor.pos())
// set to standard-layout
cursor.par()->applyLayout(tclass.defaultLayoutName());
cursor.par()->applyLayout(tclass.defaultLayout());
else
// set to standard-layout
cursor.par()->next()->applyLayout(tclass.defaultLayoutName());
cursor.par()->next()->applyLayout(tclass.defaultLayout());
}
// if the cursor is at the beginning of a row without prior newline,
// move one row up!
// This touches only the screen-update. Otherwise we would may have
// an empty row on the screen
// an empty row on the screen
if (cursor.pos() && !cursor.row()->par()->isNewline(cursor.row()->pos() - 1)
&& cursor.row()->pos() == cursor.pos())
&& cursor.row()->pos() == cursor.pos())
{
cursorLeft(bview);
}
@ -1785,7 +1783,7 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
refresh_y = cursor.y() - cursor.row()->baseline();
// Do not forget the special right address boxes
if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) {
if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
while (refresh_row->previous() &&
refresh_row->previous()->par() == refresh_row->par())
{
@ -1832,7 +1830,7 @@ void LyXText::redoParagraph(BufferView * bview) const
// insert a character, moves all the following breaks in the
// same Paragraph one to the right and make a rebreak
// same Paragraph one to the right and make a rebreak
void LyXText::insertChar(BufferView * bview, char c)
{
setUndo(bview, Undo::INSERT, cursor.par(), cursor.par()->next());
@ -1840,8 +1838,7 @@ void LyXText::insertChar(BufferView * bview, char c)
// When the free-spacing option is set for the current layout,
// disable the double-space checking
bool const freeSpacing =
textclasslist[bview->buffer()->params.textclass][cursor.row()->par()->layout()].free_spacing ||
bool const freeSpacing = cursor.row()->par()->layout()->free_spacing ||
cursor.row()->par()->isFreeSpacing();
if (lyxrc.auto_number) {
@ -1904,9 +1901,9 @@ void LyXText::insertChar(BufferView * bview, char c)
// CHECK There is a bug here! (Asger)
LyXFont realtmpfont = real_current_font;
LyXFont rawtmpfont = current_font;
LyXFont rawtmpfont = current_font;
// store the current font. This is because of the use of cursor
// movements. The moving cursor would refresh the current font
// movements. The moving cursor would refresh the current font
// Get the font that is used to calculate the baselineskip
pos_type const lastpos = cursor.par()->size();
@ -2084,7 +2081,7 @@ void LyXText::insertChar(BufferView * bview, char c)
redoHeightOfParagraph(bview, cursor);
} else {
// now the special right address boxes
if (textclasslist[bview->buffer()->params.textclass][cursor.par()->layout()].margintype
if (cursor.par()->layout()->margintype
== MARGIN_RIGHT_ADDRESS_BOX) {
redoDrawingOfParagraph(bview, cursor);
}
@ -2134,11 +2131,10 @@ void LyXText::prepareToPrint(BufferView * bview,
? leftMargin(bview, row) : 0;
// is there a manual margin with a manual label
LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass];
LyXLayout const & layout = tclass[row->par()->layout()];
LyXLayout_ptr const & layout = row->par()->layout();
if (layout.margintype == MARGIN_MANUAL
&& layout.labeltype == LABEL_MANUAL) {
if (layout->margintype == MARGIN_MANUAL
&& layout->labeltype == LABEL_MANUAL) {
// one more since labels are left aligned
nlh = numberOfLabelHfills(bview->buffer(), row) + 1;
if (nlh && !row->par()->getLabelWidthString().empty()) {
@ -2160,7 +2156,7 @@ void LyXText::prepareToPrint(BufferView * bview,
// set x how you need it
int align;
if (row->par()->params().align() == LYX_ALIGN_LAYOUT) {
align = layout.align;
align = layout->align;
} else {
align = row->par()->params().align();
}
@ -2215,7 +2211,7 @@ void LyXText::prepareToPrint(BufferView * bview,
if (main_body > 0 &&
(main_body - 1 > last ||
!row->par()->isLineSeparator(main_body - 1))) {
x += font_metrics::width(layout.labelsep,
x += font_metrics::width(layout->labelsep,
getLabelFont(bview->buffer(), row->par()));
if (main_body - 1 <= last)
x += fill_label_hfill;
@ -2224,12 +2220,12 @@ void LyXText::prepareToPrint(BufferView * bview,
}
// important for the screen
// important for the screen
// the cursor set functions have a special mechanism. When they
// realize, that you left an empty paragraph, they will delete it.
// They also delete the corresponding row
// They also delete the corresponding row
void LyXText::cursorRightOneWord(BufferView * bview) const
{
@ -2282,7 +2278,7 @@ void LyXText::cursorTab(BufferView * bview) const
// Skip initial whitespace at end of word and move cursor to *start*
// of prior word, not to end of next prior word.
// of prior word, not to end of next prior word.
void LyXText::cursorLeftOneWord(BufferView * bview) const
{
LyXCursor tmpcursor = cursor;
@ -2320,7 +2316,7 @@ void LyXText::cursorLeftOneWord(LyXCursor & cur) const
// Select current word. This depends on behaviour of
// CursorLeftOneWord(), so it is patched as well.
// CursorLeftOneWord(), so it is patched as well.
void LyXText::getWord(LyXCursor & from, LyXCursor & to,
word_location const loc) const
{
@ -2382,7 +2378,7 @@ void LyXText::selectWord(BufferView * bview, word_location const loc)
// Select the word currently under the cursor when no
// selection is currently set
// selection is currently set
bool LyXText::selectWordWhenUnderCursor(BufferView * bview,
word_location const loc)
{
@ -2544,7 +2540,7 @@ void LyXText::deleteWordBackward(BufferView * bview)
}
// Kill to end of line.
// Kill to end of line.
void LyXText::deleteLineForward(BufferView * bview)
{
if (!cursor.par()->size())
@ -2782,12 +2778,12 @@ void LyXText::backspace(BufferView * bview)
// because the user would be confused if the footnote behaves
// different wether it is open or closed.
// Correction: Pasting is always allowed with standard-layout
// Correction: Pasting is always allowed with standard-layout
LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass];
if (cursor.par() != tmppar
&& (cursor.par()->layout() == tmppar->layout()
|| tmppar->layout() == tclass.defaultLayoutName())
|| tmppar->layout() == tclass.defaultLayout())
&& cursor.par()->getAlign() == tmppar->getAlign()) {
removeParagraph(tmprow);
removeRow(tmprow);
@ -2823,7 +2819,7 @@ void LyXText::backspace(BufferView * bview)
}
} else {
// this is the code for a normal backspace, not pasting
// any paragraphs
// any paragraphs
setUndo(bview, Undo::DELETE,
cursor.par(), cursor.par()->next());
// We used to do cursorLeftIntern() here, but it is
@ -2851,7 +2847,7 @@ void LyXText::backspace(BufferView * bview)
int y = cursor.y() - row->baseline();
pos_type z;
// remember that a space at the end of a row doesnt count
// when calculating the fill
// when calculating the fill
if (cursor.pos() < rowLast(row) ||
!cursor.par()->isLineSeparator(cursor.pos())) {
row->fill(row->fill() + singleWidth(bview,
@ -2860,7 +2856,7 @@ void LyXText::backspace(BufferView * bview)
}
// some special code when deleting a newline. This is similar
// to the behavior when pasting paragraphs
// to the behavior when pasting paragraphs
if (cursor.pos() && cursor.par()->isNewline(cursor.pos())) {
cursor.par()->erase(cursor.pos());
// refresh the positions
@ -2963,7 +2959,7 @@ void LyXText::backspace(BufferView * bview)
// it can happen that a paragraph loses one row
// without a real breakup. This is when a word
// is to long to be broken. Well, I don t care this
// hack ;-)
// hack ;-)
if (rowLast(row) == row->par()->size() - 1)
removeRow(row->next());
@ -3018,9 +3014,8 @@ void LyXText::backspace(BufferView * bview)
redoHeightOfParagraph(bview, cursor);
} else {
// now the special right address boxes
if (textclasslist
[bview->buffer()->params.textclass]
[cursor.par()->layout()].margintype == MARGIN_RIGHT_ADDRESS_BOX) {
if (cursor.par()->layout()->margintype
== MARGIN_RIGHT_ADDRESS_BOX) {
redoDrawingOfParagraph(bview, cursor);
}
}
@ -3153,13 +3148,10 @@ void LyXText::paintRowSelection(DrawRowParams & p)
pos_type pos = vis2log(vpos);
float const old_tmpx = tmpx;
if (main_body > 0 && pos == main_body - 1) {
LyXLayout const & layout =
textclasslist
[buffer->params.textclass]
[par->layout()];
LyXLayout_ptr const & layout = par->layout();
LyXFont const lfont = getLabelFont(buffer, par);
tmpx += p.label_hfill + font_metrics::width(layout.labelsep, lfont);
tmpx += p.label_hfill + font_metrics::width(layout->labelsep, lfont);
if (par->isLineSeparator(main_body - 1))
tmpx -= singleWidth(p.bv, par, main_body - 1);
@ -3376,20 +3368,19 @@ void LyXText::paintFirstRow(DrawRowParams & p)
Buffer const * buffer = p.bv->buffer();
LyXTextClass const & tclass = textclasslist[buffer->params.textclass];
LyXLayout const & layout = tclass[par->layout()];
LyXLayout_ptr const & layout = par->layout();
// think about the parskip
// some parskips VERY EASY IMPLEMENTATION
if (buffer->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
if (par->previous()) {
if (layout.latextype == LATEX_PARAGRAPH
if (layout->latextype == LATEX_PARAGRAPH
&& !par->getDepth()) {
y_top += buffer->params.getDefSkip().inPixels(p.bv);
} else {
LyXLayout const & playout =
tclass[par->previous()->layout()];
if (playout.latextype == LATEX_PARAGRAPH
LyXLayout_ptr const & playout =
par->previous()->layout();
if (playout->latextype == LATEX_PARAGRAPH
&& !par->previous()->getDepth()) {
// is it right to use defskip here, too? (AS)
y_top += buffer->params.getDefSkip().inPixels(p.bv);
@ -3419,9 +3410,9 @@ void LyXText::paintFirstRow(DrawRowParams & p)
bool const is_rtl = p.row->par()->isRightToLeftPar(p.bv->buffer()->params);
// should we print a label?
if (layout.labeltype >= LABEL_STATIC
&& (layout.labeltype != LABEL_STATIC
|| layout.latextype != LATEX_ENVIRONMENT
if (layout->labeltype >= LABEL_STATIC
&& (layout->labeltype != LABEL_STATIC
|| layout->latextype != LATEX_ENVIRONMENT
|| par->isFirstInSequence())) {
LyXFont font = getLabelFont(buffer, par);
@ -3432,7 +3423,7 @@ void LyXText::paintFirstRow(DrawRowParams & p)
// this is special code for the chapter layout. This is
// printed in an extra row and has a pagebreak at
// the top.
if (layout.labeltype == LABEL_COUNTER_CHAPTER) {
if (layout->labeltype == LABEL_COUNTER_CHAPTER) {
if (buffer->params.secnumdepth >= 0) {
float spacing_val = 1.0;
if (!parparams.spacing().isDefault()) {
@ -3442,8 +3433,8 @@ void LyXText::paintFirstRow(DrawRowParams & p)
}
int const maxdesc =
int(font_metrics::maxDescent(font) * layout.spacing.getValue() * spacing_val)
+ int(layout.parsep) * defaultHeight();
int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
+ int(layout->parsep) * defaultHeight();
if (is_rtl) {
x = ww - leftMargin(p.bv, p.row) -
@ -3458,9 +3449,9 @@ void LyXText::paintFirstRow(DrawRowParams & p)
} else {
if (is_rtl) {
x = ww - leftMargin(p.bv, p.row)
+ font_metrics::width(layout.labelsep, font);
+ font_metrics::width(layout->labelsep, font);
} else {
x = p.x - font_metrics::width(layout.labelsep, font)
x = p.x - font_metrics::width(layout->labelsep, font)
- font_metrics::width(str, font);
}
@ -3470,9 +3461,9 @@ void LyXText::paintFirstRow(DrawRowParams & p)
// the labels at the top of an environment.
// More or less for bibliography
} else if (par->isFirstInSequence() &&
(layout.labeltype == LABEL_TOP_ENVIRONMENT ||
layout.labeltype == LABEL_BIBLIO ||
layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
(layout->labeltype == LABEL_TOP_ENVIRONMENT ||
layout->labeltype == LABEL_BIBLIO ||
layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
LyXFont font = getLabelFont(buffer, par);
if (!par->getLabelstring().empty()) {
string const str = par->getLabelstring();
@ -3484,11 +3475,11 @@ void LyXText::paintFirstRow(DrawRowParams & p)
}
int maxdesc =
int(font_metrics::maxDescent(font) * layout.spacing.getValue() * spacing_val
+ (layout.labelbottomsep * defaultHeight()));
int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val
+ (layout->labelbottomsep * defaultHeight()));
float x = p.x;
if (layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
x = ((is_rtl ? leftMargin(p.bv, p.row) : p.x)
+ ww - rightMargin(buffer, p.row)) / 2;
x -= font_metrics::width(str, font) / 2;
@ -3502,14 +3493,14 @@ void LyXText::paintFirstRow(DrawRowParams & p)
}
}
if (layout.labeltype == LABEL_BIBLIO && par->bibkey) {
if (layout->labeltype == LABEL_BIBLIO && par->bibkey) {
LyXFont font = getLayoutFont(buffer, par);
float x;
if (is_rtl) {
x = ww - leftMargin(p.bv, p.row)
+ font_metrics::width(layout.labelsep, font);
+ font_metrics::width(layout->labelsep, font);
} else {
x = p.x - font_metrics::width(layout.labelsep, font)
x = p.x - font_metrics::width(layout->labelsep, font)
- par->bibkey->width(p.bv, font);
}
par->bibkey->draw(p.bv, font, p.yo + p.row->baseline(), x, p.cleared);
@ -3577,7 +3568,7 @@ void LyXText::paintLastRow(DrawRowParams & p)
}
bool const is_rtl = p.row->par()->isRightToLeftPar(p.bv->buffer()->params);
int const endlabel = par->getEndLabel(buffer->params);
int const endlabel = par->getEndLabel();
// draw an endlabel
switch (endlabel) {
@ -3602,10 +3593,13 @@ void LyXText::paintLastRow(DrawRowParams & p)
}
case END_LABEL_STATIC:
{
#if 0
LyXFont font(LyXFont::ALL_SANE);
string const & layout = par->layout();
string const str = textclasslist[buffer->params.textclass][layout].endlabelstring();
font = getLabelFont(buffer, par);
#else
LyXFont font = getLabelFont(buffer, par);
#endif
string const & str = par->layout()->endlabelstring();
int const x = is_rtl ?
int(p.x) - font_metrics::width(str, font)
: ww - rightMargin(buffer, p.row) - p.row->fill();
@ -3631,8 +3625,7 @@ void LyXText::paintRowText(DrawRowParams & p)
main_body = 0;
}
LyXLayout const & layout =
textclasslist[buffer->params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
pos_type vpos = p.row->pos();
while (vpos <= last) {
@ -3645,7 +3638,7 @@ void LyXText::paintRowText(DrawRowParams & p)
continue;
}
if (main_body > 0 && pos == main_body - 1) {
int const lwidth = font_metrics::width(layout.labelsep,
int const lwidth = font_metrics::width(layout->labelsep,
getLabelFont(buffer, par));
p.x += p.label_hfill + lwidth
@ -3756,12 +3749,12 @@ int LyXText::defaultHeight() const
{
LyXFont font(LyXFont::ALL_SANE);
return int(font_metrics::maxAscent(font)
+ font_metrics::maxDescent(font) * 1.5);
+ font_metrics::maxDescent(font) * 1.5);
}
// returns the column near the specified x-coordinate of the row
// x is set to the real beginning of this column
// x is set to the real beginning of this column
pos_type
LyXText::getColumnNearX(BufferView * bview, Row * row, int & x,
bool & boundary) const
@ -3777,9 +3770,9 @@ LyXText::getColumnNearX(BufferView * bview, Row * row, int & x,
pos_type vc = row->pos();
pos_type last = rowLastPrintable(row);
pos_type c = 0;
LyXLayout const & layout =
textclasslist[bview->buffer()->params.textclass][
row->par()->layout()];
LyXLayout_ptr const & layout = row->par()->layout();
bool left_side = false;
pos_type main_body = beginningOfMainBody(bview->buffer(), row->par());
@ -3795,7 +3788,7 @@ LyXText::getColumnNearX(BufferView * bview, Row * row, int & x,
last_tmpx = tmpx;
if (main_body > 0 && c == main_body-1) {
tmpx += fill_label_hfill +
font_metrics::width(layout.labelsep,
font_metrics::width(layout->labelsep,
getLabelFont(bview->buffer(), row->par()));
if (row->par()->isLineSeparator(main_body - 1))
tmpx -= singleWidth(bview, row->par(), main_body-1);
@ -3927,17 +3920,10 @@ Row * LyXText::getRowNearY(int & y) const
if (y < tmpy) {
lyxerr << "up" << endl;
#if 0
while (tmprow && tmpy - tmprow->height() >= y) {
tmpy -= tmprow->height();
tmprow = tmprow->previous();
}
#else
do {
tmpy -= tmprow->height();
tmprow = tmprow->previous();
} while (tmprow && tmpy - tmprow->height() >= y);
#endif
} else if (y > tmpy) {
lyxerr << "down" << endl;

View File

@ -128,12 +128,11 @@ LyXFont const realizeFont(LyXFont const & font,
par = par->outerHook();
if (par) {
#ifndef INHERIT_LANGUAGE
tmpfont.realize(textclasslist[buf->params.textclass][
par->layout()].font);
tmpfont.realize(par->layout()->font);
#else
tmpfont.realize(textclasslist.
Style(buf->params.textclass,
par->layout()).font,
par->layout())->font,
buf->params.language);
#endif
par_depth = par->getDepth();
@ -165,20 +164,19 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
{
lyx::Assert(pos >= 0);
LyXLayout const & layout =
textclasslist[buf->params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
Paragraph::depth_type par_depth = par->getDepth();
// We specialize the 95% common case:
if (!par_depth) {
if (layout.labeltype == LABEL_MANUAL
if (layout->labeltype == LABEL_MANUAL
&& pos < beginningOfMainBody(buf, par)) {
// 1% goes here
LyXFont f = par->getFontSettings(buf->params, pos);
if (par->inInset())
par->inInset()->getDrawFont(f);
#ifndef INHERIT_LANGUAGE
return f.realize(layout.reslabelfont);
return f.realize(layout->reslabelfont);
#else
return f.realize(layout.reslabelfont, buf->params.language);
#endif
@ -187,7 +185,7 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
if (par->inInset())
par->inInset()->getDrawFont(f);
#ifndef INHERIT_LANGUAGE
return f.realize(layout.resfont);
return f.realize(layout->resfont);
#else
return f.realize(layout.resfont, buf->params.language);
#endif
@ -200,10 +198,10 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
if (pos < beginningOfMainBody(buf, par)) {
// 1% goes here
layoutfont = layout.labelfont;
layoutfont = layout->labelfont;
} else {
// 99% goes here
layoutfont = layout.font;
layoutfont = layout->font;
}
LyXFont tmpfont = par->getFontSettings(buf->params, pos);
@ -221,31 +219,29 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
LyXFont const LyXText::getLayoutFont(Buffer const * buf, Paragraph * par) const
{
LyXLayout const & layout =
textclasslist[buf->params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
Paragraph::depth_type par_depth = par->getDepth();
if (!par_depth) {
return layout.resfont;
return layout->resfont;
}
return realizeFont(layout.font, buf, par);
return realizeFont(layout->font, buf, par);
}
LyXFont const LyXText::getLabelFont(Buffer const * buf, Paragraph * par) const
{
LyXLayout const & layout =
textclasslist[buf->params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
Paragraph::depth_type par_depth = par->getDepth();
if (!par_depth) {
return layout.reslabelfont;
return layout->reslabelfont;
}
return realizeFont(layout.labelfont, buf, par);
return realizeFont(layout->labelfont, buf, par);
}
@ -277,15 +273,15 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
LyXFont font(fnt);
LyXTextClass const & tclass = textclasslist[buf->params.textclass];
LyXLayout const & layout = tclass[par->layout()];
LyXLayout_ptr const & layout = par->layout();
// Get concrete layout font to reduce against
LyXFont layoutfont;
if (pos < beginningOfMainBody(buf, par))
layoutfont = layout.labelfont;
layoutfont = layout->labelfont;
else
layoutfont = layout.font;
layoutfont = layout->font;
// Realize against environment font information
if (par->getDepth()) {
@ -294,7 +290,7 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
tp = tp->outerHook();
if (tp)
#ifndef INHERIT_LANGUAGE
layoutfont.realize(tclass[tp->layout()].font);
layoutfont.realize(tp->layout()->font);
#else
layoutfont.realize(textclasslist.
Style(buf->params.textclass,
@ -460,15 +456,14 @@ void LyXText::toggleInset(BufferView * bview)
void LyXText::makeFontEntriesLayoutSpecific(Buffer const * buf,
Paragraph * par)
{
LyXLayout const & layout =
textclasslist[buf->params.textclass][par->layout()];
LyXLayout_ptr const & layout = par->layout();
LyXFont layoutfont;
for (pos_type pos = 0; pos < par->size(); ++pos) {
if (pos < beginningOfMainBody(buf, par))
layoutfont = layout.labelfont;
layoutfont = layout->labelfont;
else
layoutfont = layout.font;
layoutfont = layout->font;
LyXFont tmpfont = par->getFontSettings(buf->params, pos);
tmpfont.reduce(layoutfont);
@ -502,22 +497,22 @@ Paragraph * LyXText::setLayout(BufferView * bview,
Paragraph * par = sstart_cur.par();
Paragraph * epar = send_cur.par()->next();
LyXLayout const & lyxlayout =
LyXLayout_ptr const & lyxlayout =
textclasslist[bview->buffer()->params.textclass][layout];
do {
par->applyLayout(layout);
par->applyLayout(lyxlayout);
makeFontEntriesLayoutSpecific(bview->buffer(), par);
Paragraph * fppar = par;
fppar->params().spaceTop(lyxlayout.fill_top ?
fppar->params().spaceTop(lyxlayout->fill_top ?
VSpace(VSpace::VFILL)
: VSpace(VSpace::NONE));
fppar->params().spaceBottom(lyxlayout.fill_bottom ?
fppar->params().spaceBottom(lyxlayout->fill_bottom ?
VSpace(VSpace::VFILL)
: VSpace(VSpace::NONE));
if (lyxlayout.margintype == MARGIN_MANUAL)
par->setLabelWidthString(lyxlayout.labelstring());
if (lyxlayout.labeltype != LABEL_BIBLIO
if (lyxlayout->margintype == MARGIN_MANUAL)
par->setLabelWidthString(lyxlayout->labelstring());
if (lyxlayout->labeltype != LABEL_BIBLIO
&& fppar->bibkey) {
delete fppar->bibkey;
fppar->bibkey = 0;
@ -593,17 +588,14 @@ void LyXText::incDepth(BufferView * bview)
bool anything_changed = false;
LyXTextClass const & tclass =
textclasslist[bview->buffer()->params.textclass];
while (true) {
// NOTE: you can't change the depth of a bibliography entry
if (tclass[cursor.par()->layout()].labeltype != LABEL_BIBLIO) {
if (cursor.par()->layout()->labeltype != LABEL_BIBLIO) {
Paragraph * prev = cursor.par()->previous();
if (prev) {
if (cursor.par()->getDepth()
< prev->getMaxDepthAfter(bview->buffer())){
< prev->getMaxDepthAfter()) {
cursor.par()->params().depth(cursor.par()->getDepth() + 1);
anything_changed = true;
}
@ -917,7 +909,7 @@ void LyXText::fullRebreak(BufferView * bview)
// the cursor set functions have a special mechanism. When they
// realize, that you left an empty paragraph, they will delete it.
// They also delete the corresponding row
// They also delete the corresponding row
// need the selection cursor:
void LyXText::setSelection(BufferView * bview)
@ -1136,11 +1128,10 @@ string LyXText::getStringToIndex(BufferView * bview)
}
pos_type LyXText::beginningOfMainBody(Buffer const * buf,
pos_type LyXText::beginningOfMainBody(Buffer const * /*buf*/,
Paragraph const * par) const
{
if (textclasslist[buf->params.textclass][
par->layout()].labeltype != LABEL_MANUAL)
if (par->layout()->labeltype != LABEL_MANUAL)
return 0;
else
return par->beginningOfMainBody();
@ -1188,8 +1179,6 @@ void LyXText::setParagraph(BufferView * bview,
Paragraph * tmppar = selection.end.par();
LyXTextClass const & tclass =
textclasslist[bview->buffer()->params.textclass];
while (tmppar != selection.start.par()->previous()) {
setCursor(bview, tmppar, 0);
@ -1204,12 +1193,12 @@ void LyXText::setParagraph(BufferView * bview,
cursor.par()->params().spaceBottom(space_bottom);
cursor.par()->params().spacing(spacing);
// does the layout allow the new alignment?
LyXLayout const & layout = tclass[cursor.par()->layout()];
LyXLayout_ptr const & layout = cursor.par()->layout();
if (align == LYX_ALIGN_LAYOUT)
align = layout.align;
if (align & layout.alignpossible) {
if (align == layout.align)
align = layout->align;
if (align & layout->alignpossible) {
if (align == layout->align)
cursor.par()->params().align(LYX_ALIGN_LAYOUT);
else
cursor.par()->params().align(align);
@ -1290,8 +1279,7 @@ string const romanCounter(int n)
void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
{
LyXTextClass const & textclass = textclasslist[buf->params.textclass];
LyXLayout const & layout = textclass[par->layout()];
LyXLayout_ptr const & layout = par->layout();
// copy the prev-counters to this one,
// unless this is the first paragraph
@ -1326,16 +1314,16 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
*/
if (par->previous()
&& par->previous()->getDepth() < par->getDepth()
&& textclass[par->previous()->layout()].labeltype == LABEL_COUNTER_ENUMI
&& par->previous()->layout()->labeltype == LABEL_COUNTER_ENUMI
&& par->enumdepth < 3
&& layout.labeltype != LABEL_BIBLIO) {
&& layout->labeltype != LABEL_BIBLIO) {
par->enumdepth++;
}
// Maybe we have to decrement the enumeration depth, see note above
if (par->previous()
&& par->previous()->getDepth() > par->getDepth()
&& layout.labeltype != LABEL_BIBLIO) {
&& layout->labeltype != LABEL_BIBLIO) {
par->enumdepth = par->depthHook(par->getDepth())->enumdepth;
par->setCounter(6 + par->enumdepth,
par->depthHook(par->getDepth())->getCounter(6 + par->enumdepth));
@ -1348,30 +1336,30 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
par->params().labelString(string());
}
if (layout.margintype == MARGIN_MANUAL) {
if (layout->margintype == MARGIN_MANUAL) {
if (par->params().labelWidthString().empty()) {
par->setLabelWidthString(layout.labelstring());
par->setLabelWidthString(layout->labelstring());
}
} else {
par->setLabelWidthString(string());
}
// is it a layout that has an automatic label?
if (layout.labeltype >= LABEL_COUNTER_CHAPTER) {
if (layout->labeltype >= LABEL_COUNTER_CHAPTER) {
int i = layout.labeltype - LABEL_COUNTER_CHAPTER;
int i = layout->labeltype - LABEL_COUNTER_CHAPTER;
if (i >= 0 && i<= buf->params.secnumdepth) {
par->incCounter(i); // increment the counter
// Is there a label? Useful for Chapter layout
if (!par->params().appendix()) {
if (!layout.labelstring().empty())
par->params().labelString(layout.labelstring());
if (!layout->labelstring().empty())
par->params().labelString(layout->labelstring());
else
par->params().labelString(string());
} else {
if (!layout.labelstring_appendix().empty())
par->params().labelString(layout.labelstring_appendix());
if (!layout->labelstring_appendix().empty())
par->params().labelString(layout->labelstring_appendix());
else
par->params().labelString(string());
}
@ -1509,12 +1497,12 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
// reset the following counters
par->setCounter(i, 0);
}
} else if (layout.labeltype < LABEL_COUNTER_ENUMI) {
} else if (layout->labeltype < LABEL_COUNTER_ENUMI) {
for (i++; i < 10; ++i) {
// reset the following counters
par->setCounter(i, 0);
}
} else if (layout.labeltype == LABEL_COUNTER_ENUMI) {
} else if (layout->labeltype == LABEL_COUNTER_ENUMI) {
par->incCounter(i + par->enumdepth);
int number = par->getCounter(i + par->enumdepth);
@ -1561,7 +1549,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
}
}
} else if (layout.labeltype == LABEL_BIBLIO) {// ale970302
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
int i = LABEL_COUNTER_ENUMI - LABEL_COUNTER_CHAPTER + par->enumdepth;
par->incCounter(i);
int number = par->getCounter(i);
@ -1570,14 +1558,14 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
par->bibkey = new InsetBibKey(p);
}
par->bibkey->setCounter(number);
par->params().labelString(layout.labelstring());
par->params().labelString(layout->labelstring());
// In biblio should't be following counters but...
} else {
string s = layout.labelstring();
string s = layout->labelstring();
// the caption hack:
if (layout.labeltype == LABEL_SENSITIVE) {
if (layout->labeltype == LABEL_SENSITIVE) {
bool isOK (par->inInset() && par->inInset()->owner() &&
(par->inInset()->owner()->lyxCode() == Inset::FLOAT_CODE));
@ -1625,12 +1613,10 @@ void LyXText::updateCounters(BufferView * bview, Row * row) const
// now check for the headline layouts. remember that they
// have a dynamic left margin
LyXTextClass const & tclass =
textclasslist[bview->buffer()->params.textclass];
LyXLayout const & layout = tclass[par->layout()];
LyXLayout_ptr const & layout = par->layout();
if (layout.margintype == MARGIN_DYNAMIC
|| layout.labeltype == LABEL_SENSITIVE) {
if (layout->margintype == MARGIN_DYNAMIC
|| layout->labeltype == LABEL_SENSITIVE) {
// Rebreak the paragraph
removeParagraph(row);
appendParagraph(bview, row);
@ -1664,7 +1650,7 @@ void LyXText::insertInset(BufferView * bview, Inset * inset)
void LyXText::copyEnvironmentType()
{
copylayouttype = cursor.par()->layout();
copylayouttype = cursor.par()->layout()->name();
}
@ -1736,7 +1722,7 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut)
// sometimes necessary
if (doclear)
selection.start.par()->stripLeadingSpaces(bview->buffer()->params.textclass);
selection.start.par()->stripLeadingSpaces();
redoParagraphs(bview, selection.start, endpar);
@ -1971,10 +1957,7 @@ void LyXText::checkParagraph(BufferView * bview, Paragraph * par,
status(bview, LyXText::NEED_MORE_REFRESH);
// check the special right address boxes
if (textclasslist[bview->buffer()->params.textclass][
par->layout()].margintype
== MARGIN_RIGHT_ADDRESS_BOX)
{
if (par->layout()->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
tmpcursor.par(par);
tmpcursor.row(row);
tmpcursor.y(y);
@ -2143,13 +2126,13 @@ float LyXText::getCursorX(BufferView * bview, Row * row,
pos_type pos = vis2log(vpos);
if (main_body > 0 && pos == main_body - 1) {
x += fill_label_hfill +
font_metrics::width(textclasslist[
bview->buffer()->params.textclass][
row->par()->layout()]
.labelsep,
getLabelFont(bview->buffer(), row->par()));
if (row->par()->isLineSeparator(main_body-1))
x -= singleWidth(bview, row->par(),main_body-1);
font_metrics::width(
row->par()->layout()->labelsep,
getLabelFont(bview->buffer(),
row->par()));
if (row->par()->isLineSeparator(main_body - 1))
x -= singleWidth(bview,
row->par(), main_body - 1);
}
if (hfillExpansion(bview->buffer(), row, pos)) {
x += singleWidth(bview, row->par(), pos);
@ -2419,10 +2402,8 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview,
return false;
// We allow all kinds of "mumbo-jumbo" when freespacing.
if (textclasslist[bview->buffer()->params.textclass][
old_cursor.par()->layout()].free_spacing
|| old_cursor.par()->isFreeSpacing())
{
if (old_cursor.par()->layout()->free_spacing
|| old_cursor.par()->isFreeSpacing()) {
return false;
}
@ -2488,9 +2469,7 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview,
return false;
// Do not delete empty paragraphs with keepempty set.
if (textclasslist
[bview->buffer()->params.textclass]
[old_cursor.par()->layout()].keepempty)
if (old_cursor.par()->layout()->keepempty)
return false;
// only do our magic if we changed paragraph
@ -2586,7 +2565,7 @@ bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview,
}
}
if (!deleted) {
if (old_cursor.par()->stripLeadingSpaces(bview->buffer()->params.textclass)) {
if (old_cursor.par()->stripLeadingSpaces()) {
redoParagraphs(bview, old_cursor,
old_cursor.par()->next());
// correct cursor y

View File

@ -43,7 +43,7 @@ LyXCursor const & undoCursor(BufferView * bv)
return bv->theLockingInset()->cursor(bv);
return bv->text->cursor;
}
/**
* returns a pointer to the very first Paragraph depending of where we are
* so it will return the first paragraph of the buffer or the first paragraph
@ -73,13 +73,13 @@ void finishNoUndo(BufferView * bv)
bv->text->status(bv, LyXText::NEED_MORE_REFRESH);
unFreezeUndo();
}
// returns false if no undo possible
bool textHandleUndo(BufferView * bv, Undo & undo)
{
Buffer * b = bv->buffer();
Paragraph * before =
b->getParFromID(undo.number_of_before_par);
Paragraph * behind =
@ -128,9 +128,9 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
}
vector<Paragraph *> deletelist;
Paragraph * deletepar;
// now add old paragraphs to be deleted
if (before != behind || (!behind && !before)) {
if (before)
@ -142,7 +142,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
deletelist.push_back(deletepar);
tmppar = deletepar;
deletepar = deletepar->next();
// a memory optimization for edit:
// Only layout information
// is stored in the undo. So restore
@ -215,7 +215,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
// clear any selection and set the selection cursor
// for an evt. new selection.
t->clearSelection();
t->selection.cursor = t->cursor;
t->selection.cursor = t->cursor;
t->updateCounters(bv, t->cursor.row());
bv->fitCursor();
}
@ -237,7 +237,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
// clear any selection and set the selection cursor
// for an evt. new selection.
t->clearSelection();
t->selection.cursor = t->cursor;
t->selection.cursor = t->cursor;
t->updateCounters(bv, t->cursor.row());
}
}
@ -251,13 +251,13 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
delete (*pit);
}
}
finishUndo();
bv->text->status(bv, LyXText::NEED_MORE_REFRESH);
return true;
}
bool createUndo(BufferView * bv, Undo::undo_kind kind,
Paragraph const * first, Paragraph const * behind, shared_ptr<Undo> & u)
{
@ -275,7 +275,7 @@ bool createUndo(BufferView * bv, Undo::undo_kind kind,
inset_id = first->inInset()->id();
Buffer * b = bv->buffer();
// Undo::EDIT and Undo::FINISH are
// always finished. (no overlapping there)
// overlapping only with insert and delete inside one paragraph:
@ -293,7 +293,7 @@ bool createUndo(BufferView * bv, Undo::undo_kind kind,
return false;
}
}
// create a new Undo
Paragraph * undopar;
@ -382,16 +382,16 @@ void unFreezeUndo()
bool textUndo(BufferView * bv)
{
Buffer * b = bv->buffer();
if (b->undostack.empty()) {
finishNoUndo(bv);
return false;
}
shared_ptr<Undo> undo = b->undostack.top();
b->undostack.pop();
finishUndo();
if (!undo_frozen) {
Paragraph * first = b->getParFromID(undo->number_of_before_par);
if (first && first->next())
@ -405,7 +405,7 @@ bool textUndo(BufferView * bv)
b->redostack.push(u);
}
}
// now we can unlock the inset for saftey because the inset pointer could
// be changed during the undo-function. Anyway if needed we have to lock
// the right inset/position if this is requested.
@ -426,11 +426,11 @@ bool textRedo(BufferView * bv)
finishNoUndo(bv);
return false;
}
shared_ptr<Undo> undo = b->redostack.top();
b->redostack.pop();
finishUndo();
if (!undo_frozen) {
Paragraph * first = bv->buffer()->getParFromID(undo->number_of_before_par);
if (first && first->next())
@ -444,7 +444,7 @@ bool textRedo(BufferView * bv)
bv->buffer()->undostack.push(u);
}
}
// now we can unlock the inset for saftey because the inset pointer could
// be changed during the undo-function. Anyway if needed we have to lock
// the right inset/position if this is requested.