remove return arg from fullRebreak, fix last "Standards", new operaotr>> for lyxstring (might need more work), some ws changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4108 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-05-01 22:17:09 +00:00
parent 84480c05b2
commit bded6fd063
15 changed files with 241 additions and 191 deletions

View File

@ -1092,20 +1092,19 @@ void BufferView::Pimpl::update()
screen_->update(bv_->text, bv_); screen_->update(bv_->text, bv_);
bool fitc = false; bool fitc = false;
while (bv_->text->status() == LyXText::CHANGED_IN_DRAW) { while (bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
if (bv_->text->fullRebreak(bv_)) { bv_->text->fullRebreak(bv_);
st = LyXText::NEED_MORE_REFRESH; st = LyXText::NEED_MORE_REFRESH;
bv_->text->setCursor(bv_, bv_->text->cursor.par(), bv_->text->setCursor(bv_, bv_->text->cursor.par(),
bv_->text->cursor.pos()); bv_->text->cursor.pos());
if (bv_->text->selection.set()) { if (bv_->text->selection.set()) {
bv_->text->setCursor(bv_, bv_->text->selection.start, bv_->text->setCursor(bv_, bv_->text->selection.start,
bv_->text->selection.start.par(), bv_->text->selection.start.par(),
bv_->text->selection.start.pos()); bv_->text->selection.start.pos());
bv_->text->setCursor(bv_, bv_->text->selection.end, bv_->text->setCursor(bv_, bv_->text->selection.end,
bv_->text->selection.end.par(), bv_->text->selection.end.par(),
bv_->text->selection.end.pos()); bv_->text->selection.end.pos());
}
fitc = true;
} }
fitc = true;
bv_->text->status(bv_, st); bv_->text->status(bv_, st);
screen_->update(bv_->text, bv_); screen_->update(bv_->text, bv_);
} }
@ -1655,6 +1654,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch: action[" lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch: action["
<< action <<"] arg[" << argument << "]" << endl; << action <<"] arg[" << argument << "]" << endl;
LyXTextClass const & tclass = textclasslist[buffer_->params.textclass];
switch (action) { switch (action) {
// --- Misc ------------------------------------------- // --- Misc -------------------------------------------
case LFUN_APPENDIX: case LFUN_APPENDIX:
@ -1675,7 +1676,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
InsetCommandParams p; InsetCommandParams p;
p.setCmdName("tableofcontents"); p.setCmdName("tableofcontents");
Inset * inset = new InsetTOC(p); Inset * inset = new InsetTOC(p);
if (!insertInset(inset, "Standard")) if (!insertInset(inset, tclass.defaultLayoutName()))
delete inset; delete inset;
break; break;
} }
@ -1802,15 +1803,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
// Derive layout number from given argument (string) // Derive layout number from given argument (string)
// and current buffer's textclass (number). */ // and current buffer's textclass (number). */
textclass_type tclass = buffer_->params.textclass; bool hasLayout = tclass.hasLayout(argument);
bool hasLayout =
textclasslist[tclass].hasLayout(argument);
string layout = argument; string layout = argument;
// If the entry is obsolete, use the new one instead. // If the entry is obsolete, use the new one instead.
if (hasLayout) { if (hasLayout) {
string const & obs = textclasslist[tclass][layout] string const & obs = tclass[layout].obsoleted_by();
.obsoleted_by();
if (!obs.empty()) if (!obs.empty())
layout = obs; layout = obs;
} }
@ -2488,7 +2486,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
{ {
LyXText * lt = bv_->getLyXText(); LyXText * lt = bv_->getLyXText();
LyXLayout const & style = textclasslist[buffer_->params.textclass][lt->cursor.par()->layout()]; LyXLayout const & style = tclass[lt->cursor.par()->layout()];
if (style.free_spacing) { if (style.free_spacing) {
lt->insertChar(bv_, ' '); lt->insertChar(bv_, ' ');
@ -3209,7 +3207,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
{ {
InsetCommandParams p("printindex"); InsetCommandParams p("printindex");
Inset * inset = new InsetPrintIndex(p); Inset * inset = new InsetPrintIndex(p);
if (!insertInset(inset, "Standard")) if (!insertInset(inset, tclass.defaultLayoutName()))
delete inset; delete inset;
} }
break; break;
@ -3218,7 +3216,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
{ {
InsetCommandParams p("lyxparent", argument); InsetCommandParams p("lyxparent", argument);
Inset * inset = new InsetParent(p, *buffer_); Inset * inset = new InsetParent(p, *buffer_);
if (!insertInset(inset, "Standard")) if (!insertInset(inset, tclass.defaultLayoutName()))
delete inset; delete inset;
} }
@ -3243,7 +3241,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_FLOAT_LIST: case LFUN_FLOAT_LIST:
if (floatList.typeExist(argument)) { if (floatList.typeExist(argument)) {
Inset * inset = new InsetFloatList(argument); Inset * inset = new InsetFloatList(argument);
if (!insertInset(inset, "Standard")) if (!insertInset(inset, tclass.defaultLayoutName()))
delete inset; delete inset;
} else { } else {
lyxerr << "Non-existent float type: " lyxerr << "Non-existent float type: "

View File

@ -1,3 +1,19 @@
2002-05-02 Lars Gullik Bjønnes <larsbj@birdstep.com>
* screen.C (drawFromTo): change sine fullRebreak always return
true.
* buffer.C (parseSingleLyXformat2Token): reindent some
* BufferView_pimpl.C (update): change since fullRebreak always
return true.
(Dispatch): git rid of the last hardcoded "Standard"s.
2002-05-01 Lars Gullik Bjønnes <larsbj@birdstep.com>
* text2.[Ch] (fullRebreak): make it return void now that we always
returned true.
2002-04-30 Juergen Vigna <jug@sad.it> 2002-04-30 Juergen Vigna <jug@sad.it>
* buffer.C (parseSingleLyXformat2Token): reset the font before the * buffer.C (parseSingleLyXformat2Token): reset the font before the
@ -5,14 +21,14 @@
2002-04-29 Dekel Tsur <dekelts@tau.ac.il> 2002-04-29 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (parseSingleLyXformat2Token): Fix reading of old format * buffer.C (parseSingleLyXformat2Token): Fix reading of old format
minipages: use col% instead of p%, and also use the current font. minipages: use col% instead of p%, and also use the current font.
(makeLaTeXFile): Fix use babel condition. (makeLaTeXFile): Fix use babel condition.
(parseSingleLyXformat2Token): Correct font when reading old floats. (parseSingleLyXformat2Token): Correct font when reading old floats.
2002-04-28 Dekel Tsur <dekelts@tau.ac.il> 2002-04-28 Dekel Tsur <dekelts@tau.ac.il>
* BufferView_pimpl.C (Dispatch): Check that float type exists when * BufferView_pimpl.C (Dispatch): Check that float type exists when
inserting list of floats. inserting list of floats.
2002-04-25 Herbert Voss <voss@lyx.org> 2002-04-25 Herbert Voss <voss@lyx.org>
@ -39,11 +55,11 @@
2002-04-23 Mike Ressler <mike.ressler@alum.mit.edu> 2002-04-23 Mike Ressler <mike.ressler@alum.mit.edu>
* lyxtextclass.[Ch]: add layout keyword ProvidesNatbib. * lyxtextclass.[Ch]: add layout keyword ProvidesNatbib.
* LaTeXFeatures.C: do not add \usepackage{natbib} to tex file if * LaTeXFeatures.C: do not add \usepackage{natbib} to tex file if
natbib is provided by the LaTeX class. natbib is provided by the LaTeX class.
2002-04-23 Juergen Vigna <jug@sad.it> 2002-04-23 Juergen Vigna <jug@sad.it>
* BufferView_pimpl.[Ch]: remove use of wrong and unneeded insetSleep/ * BufferView_pimpl.[Ch]: remove use of wrong and unneeded insetSleep/
@ -84,7 +100,7 @@
* tabular.C (OldFormatRead): check also for \\end_inset as Lars * tabular.C (OldFormatRead): check also for \\end_inset as Lars
changed the read and substituted \\end_float with \\end_inset! changed the read and substituted \\end_float with \\end_inset!
* BufferView_pimpl.C (cursorPrevious): * BufferView_pimpl.C (cursorPrevious):
(cursorNext): fixed to make it work with rows heigher than the work (cursorNext): fixed to make it work with rows heigher than the work
area without moving the cursor only the draw of the row. area without moving the cursor only the draw of the row.
(workAreaMotionNotify): fix jumping over high rows. (workAreaMotionNotify): fix jumping over high rows.

View File

@ -401,6 +401,9 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
LyXLookupString(ev, dummy, 1, &keysym); LyXLookupString(ev, dummy, 1, &keysym);
#else #else
XLookupString(xke, dummy, 1, &keysym, 0); XLookupString(xke, dummy, 1, &keysym, 0);
// int num_keys = XLookupString(xke, dummy, 10, &keysym, &xcs);
// lyxerr << "We have " << num_keys << " keys in the returned buffer" << endl;
// lyxerr << "Our dummy string is " << dummy << endl;
#endif #endif
if (lyxerr.debugging(Debug::KEY)) { if (lyxerr.debugging(Debug::KEY)) {
char const * tmp = XKeysymToString(key); char const * tmp = XKeysymToString(key);

View File

@ -488,7 +488,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
font = LyXFont(LyXFont::ALL_INHERIT, params.language); font = LyXFont(LyXFont::ALL_INHERIT, params.language);
if (file_format < 216 && params.language->lang() == "hebrew") if (file_format < 216 && params.language->lang() == "hebrew")
font.setLanguage(default_language); font.setLanguage(default_language);
#ifndef NO_COMPABILITY #ifndef NO_COMPABILITY
if (compare_no_case(layoutname, "latex") == 0) { if (compare_no_case(layoutname, "latex") == 0) {
ert_comp.active = true; ert_comp.active = true;
@ -1240,19 +1240,86 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
// minipage. Currently I am not investing any effort // minipage. Currently I am not investing any effort
// in fixing those cases. // in fixing those cases.
//lyxerr << "Call depth: " << call_depth << endl; // lyxerr << "Call depth: " << call_depth << endl;
if (checkminipage && (call_depth == 1)) { // lyxerr << "Checkminipage: " << checkminipage << endl;
checkminipage = false;
if (minipar && (minipar != par) &&
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE))
{
lyxerr << "minipages in a row" << endl;
if (par->params().pextraStartMinipage()) {
lyxerr << "start new minipage" << endl;
// minipages in a row
par->previous()->next(0);
par->previous(0);
if (checkminipage && (call_depth == 1)) {
checkminipage = false;
if (minipar && (minipar != par) &&
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
lyxerr << "minipages in a row" << endl;
if (par->params().pextraStartMinipage()) {
lyxerr << "start new minipage" << endl;
// minipages in a row
par->previous()->next(0);
par->previous(0);
Paragraph * tmp = minipar;
while (tmp) {
tmp->params().pextraType(0);
tmp->params().pextraWidth(string());
tmp->params().pextraWidthp(string());
tmp->params().pextraAlignment(0);
tmp->params().pextraHfill(false);
tmp->params().pextraStartMinipage(false);
tmp = tmp->next();
}
// create a new paragraph to insert the
// minipages in the following case
if (par->params().pextraStartMinipage() &&
!par->params().pextraHfill()) {
Paragraph * p = new Paragraph;
p->layout(textclasslist[params.textclass].defaultLayoutName());
p->previous(parBeforeMinipage);
parBeforeMinipage->next(p);
p->next(0);
p->params().depth(parBeforeMinipage->params().depth());
parBeforeMinipage = p;
}
InsetMinipage * mini = new InsetMinipage(params);
mini->pos(static_cast<InsetMinipage::Position>(par->params().pextraAlignment()));
mini->pageWidth(LyXLength(par->params().pextraWidth()));
if (!par->params().pextraWidthp().empty()) {
lyxerr << "WP:" << mini->pageWidth().asString() << endl;
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
}
Paragraph * op = mini->firstParagraph();
mini->inset.paragraph(par);
//
// and free the old ones!
//
while(op) {
Paragraph * pp = op->next();
delete op;
op = pp;
}
// Insert the minipage last in the
// previous paragraph.
if (par->params().pextraHfill()) {
parBeforeMinipage->insertChar
(parBeforeMinipage->size(),
Paragraph::META_HFILL, font);
}
parBeforeMinipage->insertInset
(parBeforeMinipage->size(), mini, font);
minipar = par;
} else {
lyxerr << "new minipage par" << endl;
//nothing to do just continue reading
}
} else if (minipar && (minipar != par)) {
lyxerr << "last minipage par read" << endl;
// The last paragraph read was not part of a
// minipage but the par linked list is...
// So we need to remove the last par from the
// rest
if (par->previous())
par->previous()->next(0);
par->previous(parBeforeMinipage);
parBeforeMinipage->next(par);
Paragraph * tmp = minipar; Paragraph * tmp = minipar;
while (tmp) { while (tmp) {
tmp->params().pextraType(0); tmp->params().pextraType(0);
@ -1263,28 +1330,44 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
tmp->params().pextraStartMinipage(false); tmp->params().pextraStartMinipage(false);
tmp = tmp->next(); tmp = tmp->next();
} }
// create a new paragraph to insert the depth = parBeforeMinipage->params().depth();
// minipages in the following case // and set this depth on the par as it has not been set already
if (par->params().pextraStartMinipage() && par->params().depth(depth);
!par->params().pextraHfill()) { minipar = parBeforeMinipage = 0;
Paragraph * p = new Paragraph; } else if (!minipar &&
p->layout(textclasslist[params.textclass].defaultLayoutName()); (par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
// par is the first paragraph in a minipage
lyxerr << "begin minipage" << endl;
// To minimize problems for
// the users we will insert
// the first minipage in
// a sequence of minipages
// in its own paragraph.
Paragraph * p = new Paragraph;
p->layout(textclasslist[params.textclass].defaultLayoutName());
p->previous(par->previous());
p->next(0);
p->params().depth(depth);
par->params().depth(0);
depth = 0;
if (par->previous())
par->previous()->next(p);
par->previous(0);
parBeforeMinipage = p;
minipar = par;
if (!first_par || (first_par == par))
first_par = p;
p->previous(parBeforeMinipage);
parBeforeMinipage->next(p);
p->next(0);
p->params().depth(parBeforeMinipage->params().depth());
parBeforeMinipage = p;
}
InsetMinipage * mini = new InsetMinipage(params); InsetMinipage * mini = new InsetMinipage(params);
mini->pos(static_cast<InsetMinipage::Position>(par->params().pextraAlignment())); mini->pos(static_cast<InsetMinipage::Position>(minipar->params().pextraAlignment()));
mini->pageWidth(LyXLength(par->params().pextraWidth())); mini->pageWidth(LyXLength(minipar->params().pextraWidth()));
if (!par->params().pextraWidthp().empty()) { if (!par->params().pextraWidthp().empty()) {
lyxerr << "WP:" << mini->pageWidth().asString() << endl; lyxerr << "WP:" << mini->pageWidth().asString() << endl;
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%")); mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
} }
Paragraph * op = mini->firstParagraph(); Paragraph * op = mini->firstParagraph();
mini->inset.paragraph(par); mini->inset.paragraph(minipar);
// //
// and free the old ones! // and free the old ones!
// //
@ -1293,100 +1376,17 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
delete op; delete op;
op = pp; op = pp;
} }
// Insert the minipage last in the // Insert the minipage last in the
// previous paragraph. // previous paragraph.
if (par->params().pextraHfill()) { if (minipar->params().pextraHfill()) {
parBeforeMinipage->insertChar parBeforeMinipage->insertChar
(parBeforeMinipage->size(), (parBeforeMinipage->size(),
Paragraph::META_HFILL, font); Paragraph::META_HFILL, font);
} }
parBeforeMinipage->insertInset parBeforeMinipage->insertInset
(parBeforeMinipage->size(), mini, font); (parBeforeMinipage->size(), mini, font);
minipar = par;
} else {
lyxerr << "new minipage par" << endl;
//nothing to do just continue reading
} }
} else if (minipar && (minipar != par)) {
lyxerr << "last minipage par read" << endl;
// The last paragraph read was not part of a
// minipage but the par linked list is...
// So we need to remove the last par from the
// rest
if (par->previous())
par->previous()->next(0);
par->previous(parBeforeMinipage);
parBeforeMinipage->next(par);
Paragraph * tmp = minipar;
while (tmp) {
tmp->params().pextraType(0);
tmp->params().pextraWidth(string());
tmp->params().pextraWidthp(string());
tmp->params().pextraAlignment(0);
tmp->params().pextraHfill(false);
tmp->params().pextraStartMinipage(false);
tmp = tmp->next();
}
depth = parBeforeMinipage->params().depth();
// and set this depth on the par as it has not been set already
par->params().depth(depth);
minipar = parBeforeMinipage = 0;
} else if (!minipar &&
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE))
{
// par is the first paragraph in a minipage
lyxerr << "begin minipage" << endl;
// To minimize problems for
// the users we will insert
// the first minipage in
// a sequence of minipages
// in its own paragraph.
Paragraph * p = new Paragraph;
p->layout(textclasslist[params.textclass].defaultLayoutName());
p->previous(par->previous());
p->next(0);
p->params().depth(depth);
par->params().depth(0);
depth = 0;
if (par->previous())
par->previous()->next(p);
par->previous(0);
parBeforeMinipage = p;
minipar = par;
if (!first_par || (first_par == par))
first_par = p;
InsetMinipage * mini = new InsetMinipage(params);
mini->pos(static_cast<InsetMinipage::Position>(minipar->params().pextraAlignment()));
mini->pageWidth(LyXLength(minipar->params().pextraWidth()));
if (!par->params().pextraWidthp().empty()) {
lyxerr << "WP:" << mini->pageWidth().asString() << endl;
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
}
Paragraph * op = mini->firstParagraph();
mini->inset.paragraph(minipar);
//
// and free the old ones!
//
while(op) {
Paragraph * pp = op->next();
delete op;
op = pp;
}
// Insert the minipage last in the
// previous paragraph.
if (minipar->params().pextraHfill()) {
parBeforeMinipage->insertChar
(parBeforeMinipage->size(),
Paragraph::META_HFILL, font);
}
parBeforeMinipage->insertInset
(parBeforeMinipage->size(), mini, font);
}
} }
// End of pextra_minipage compability // End of pextra_minipage compability
--call_depth; --call_depth;
@ -3712,7 +3712,7 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
string const opt = par->bibkey->getOptions(); string const opt = par->bibkey->getOptions();
string const ref = par->asString(this, false); string const ref = par->asString(this, false);
string const info = opt + "TheBibliographyRef" + ref; string const info = opt + "TheBibliographyRef" + ref;
keys.push_back(StringPair(key, info)); keys.push_back(StringPair(key, info));
} }
par = par->next(); par = par->next();

View File

@ -1,10 +1,10 @@
2002-04-30 Rob Lahaye <lahaye@users.sourceforge.net> 2002-04-30 Rob Lahaye <lahaye@users.sourceforge.net>
* FormDocument.C: "USletter" -> "US letter" etc. * FormDocument.C: "USletter" -> "US letter" etc.
"Other" -> "Custom". "Other" -> "Custom".
* FormParagraph.C: "Other" -> "Custom" * FormParagraph.C: "Other" -> "Custom"
* FormPreferences.C: "USletter" -> "US letter" etc. * FormPreferences.C: "USletter" -> "US letter" etc.
* forms/form_document.fd: 'Papersize" -> "Paper size" * forms/form_document.fd: 'Papersize" -> "Paper size"
style consistency style consistency
* forms/form_preferences.fd: style consistency * forms/form_preferences.fd: style consistency
2002-04-30 Angus Leeming <a.leeming@ic.ac.uk> 2002-04-30 Angus Leeming <a.leeming@ic.ac.uk>
@ -34,7 +34,7 @@
* FormBibtex.C: * FormBibtex.C:
* FormCitation.C: fix two typos * FormCitation.C: fix two typos
2002-04-29 Angus Leeming <a.leeming@ic.ac.uk> 2002-04-29 Angus Leeming <a.leeming@ic.ac.uk>
* FormCharacter.h: * FormCharacter.h:
@ -53,7 +53,7 @@
* FormMathsPanel.C: translate Close * FormMathsPanel.C: translate Close
* FormGraphics.C: a little more translation * FormGraphics.C: a little more translation
2002-04-22 Angus Leeming <a.leeming@ic.ac.uk> 2002-04-22 Angus Leeming <a.leeming@ic.ac.uk>
* FormCitation.C (apply, input): ensure that the choice is always valid. * FormCitation.C (apply, input): ensure that the choice is always valid.

View File

@ -109,7 +109,7 @@ string floatname(string const & type)
return _(it->second.name()); return _(it->second.name());
} }
} // namespace anon } // namespace anon

View File

@ -39,8 +39,9 @@ void InsetIndex::edit(BufferView * bv, bool)
int InsetIndex::docbook(Buffer const *, ostream & os) const int InsetIndex::docbook(Buffer const *, ostream & os) const
{ {
os << "<indexterm><primary>" << getContents() << "</primary></indexterm>"; os << "<indexterm><primary>" << getContents()
return 0; << "</primary></indexterm>";
return 0;
} }
@ -54,6 +55,7 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
: InsetCommand(p) : InsetCommand(p)
{} {}
string const InsetPrintIndex::getScreenLabel(Buffer const *) const string const InsetPrintIndex::getScreenLabel(Buffer const *) const
{ {
return _("Index"); return _("Index");

View File

@ -60,13 +60,15 @@ public:
/// ///
void edit(BufferView *, bool = true) {} void edit(BufferView *, bool = true) {}
/// ///
EDITABLE editable() const{ return NOT_EDITABLE; } EDITABLE editable() const { return NOT_EDITABLE; }
/// ///
bool display() const { return true; } bool display() const { return true; }
/// ///
Inset::Code lyxCode() const; Inset::Code lyxCode() const;
/// ///
string const getScreenLabel(Buffer const *) const; string const getScreenLabel(Buffer const *) const;
///
virtual bool needFullRow() const { return true; }
}; };
#endif #endif

View File

@ -463,20 +463,20 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
int yf = y_offset + first; int yf = y_offset + first;
y = 0; y = 0;
while ((row != 0) && (yf < ph)) { while ((row != 0) && (yf < ph)) {
lt->getVisibleRow(bv, y+y_offset+first, int(x), row, lt->getVisibleRow(bv, y + y_offset + first, int(x),
y+lt->first_y, cleared); row, y + lt->first_y, cleared);
if (bv->text->status() == LyXText::CHANGED_IN_DRAW) { if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
lt->need_break_row = row; lt->need_break_row = row;
if (lt->fullRebreak(bv)) { lt->fullRebreak(bv);
lt->setCursor(bv, lt->cursor.par(),lt->cursor.pos()); lt->setCursor(bv, lt->cursor.par(),
if (lt->selection.set()) { lt->cursor.pos());
lt->setCursor(bv, lt->selection.start, if (lt->selection.set()) {
lt->selection.start.par(), lt->setCursor(bv, lt->selection.start,
lt->selection.start.pos()); lt->selection.start.par(),
lt->setCursor(bv, lt->selection.end, lt->selection.start.pos());
lt->selection.end.par(), lt->setCursor(bv, lt->selection.end,
lt->selection.end.pos()); lt->selection.end.par(),
} lt->selection.end.pos());
} }
break; break;
} }

View File

@ -177,9 +177,8 @@ public:
/// ///
void insertInset(BufferView *, Inset * inset); void insertInset(BufferView *, Inset * inset);
/** Completes the insertion with a full rebreak. /** Completes the insertion with a full rebreak. */
Returns true if something was broken. */ void fullRebreak(BufferView *);
bool fullRebreak(BufferView *);
/// ///
mutable Row * need_break_row; mutable Row * need_break_row;

View File

@ -130,10 +130,10 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
x_offset, row, y + text->first_y); x_offset, row, y + text->first_y);
internal = internal && (st != LyXText::CHANGED_IN_DRAW); internal = internal && (st != LyXText::CHANGED_IN_DRAW);
while (internal && text->status() == LyXText::CHANGED_IN_DRAW) { while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
if (text->fullRebreak(bv)) { text->fullRebreak(bv);
st = LyXText::NEED_MORE_REFRESH; st = LyXText::NEED_MORE_REFRESH;
text->setCursor(bv, text->cursor.par(), text->cursor.pos()); text->setCursor(bv, text->cursor.par(),
} text->cursor.pos());
text->status(bv, st); text->status(bv, st);
text->getVisibleRow(bv, y + y_offset, text->getVisibleRow(bv, y + y_offset,
x_offset, row, y + text->first_y); x_offset, row, y + text->first_y);

View File

@ -1,3 +1,7 @@
2002-05-02 Lars Gullik Bjønnes <larsbj@birdstep.com>
* lyxstring.C (operator>>): try a new version of the operator>>
2002-04-14 Herbert Voss <voss@perce.de> 2002-04-14 Herbert Voss <voss@perce.de>
* lstrings.[Ch]: move the getVectorFromString and the vice versa * lstrings.[Ch]: move the getVectorFromString and the vice versa
@ -11,7 +15,7 @@
2002-04-08 Herbert Voss <voss@perce.de> 2002-04-08 Herbert Voss <voss@perce.de>
* filetools.C (getExtFromContents): get tgif run * filetools.C (getExtFromContents): get tgif run
2002-04-08 Angus Leeming <a.leeming@ic.ac.uk> 2002-04-08 Angus Leeming <a.leeming@ic.ac.uk>

View File

@ -1043,7 +1043,7 @@ string const getExtFromContents(string const & filename)
break; break;
} }
std::getline(ifs, str); getline(ifs, str);
lyxerr[Debug::GRAPHICS] << "Scanstring: " << str << endl; lyxerr[Debug::GRAPHICS] << "Scanstring: " << str << endl;
string const stamp = str.substr(0,2); string const stamp = str.substr(0,2);
@ -1103,7 +1103,7 @@ string const getExtFromContents(string const & filename)
format = "xwd"; format = "xwd";
} }
} }
firstLine = false; firstLine = false;
} }
@ -1362,7 +1362,7 @@ string const readBB_from_PSFile(string const & file)
// end of the file. Than we have in the header: // end of the file. Than we have in the header:
// %%BoundingBox: (atend) // %%BoundingBox: (atend)
// In this case we must check the end. // In this case we must check the end.
string const file_ = zippedFile(file) ? string const file_ = zippedFile(file) ?
string(unzipFile(file)) : string(file); string(unzipFile(file)) : string(file);
string const format = getExtFromContents(file_); string const format = getExtFromContents(file_);
if (format != "eps" && format != "ps") if (format != "eps" && format != "ps")
@ -1371,10 +1371,9 @@ string const readBB_from_PSFile(string const & file)
std::ifstream is(file_.c_str()); std::ifstream is(file_.c_str());
while (is) { while (is) {
string s; string s;
std::getline(is,s); getline(is,s);
if (contains(s,"%%BoundingBox:") && !contains(s,"atend")) if (contains(s,"%%BoundingBox:") && !contains(s,"atend"))
return (frontStrip(s.substr(14))); return (frontStrip(s.substr(14)));
} }
return string(); return string();
} }

View File

@ -1732,16 +1732,9 @@ void swap(lyxstring & str1, lyxstring & str2)
#include <iostream> #include <iostream>
#if 0
istream & operator>>(istream & is, lyxstring & s) istream & operator>>(istream & is, lyxstring & s)
{ {
#if 0
// very bad solution
char * nome = new char[1024];
is >> nome;
lyxstring tmp(nome);
delete [] nome;
if (!tmp.empty()) s = tmp;
#else
// better solution // better solution
int w = is.width(0); int w = is.width(0);
s.clear(); s.clear();
@ -1752,9 +1745,44 @@ istream & operator>>(istream & is, lyxstring & s)
if (--w == 1) break; if (--w == 1) break;
} }
if (s.empty()) is.setstate(std::ios::failbit); if (s.empty()) is.setstate(std::ios::failbit);
#endif
return is; return is;
} }
#else
istream & operator>>(istream & is, lyxstring & str)
{
typedef istream istream_type;
typedef int int_type;
typedef std::streambuf streambuf_type;
typedef string string_type;
typedef string::size_type size_type;
size_type extracted = 0;
// istream_type::sentry cerb(is, false);
// if (cerb) {
str.erase();
std::streamsize w = is.width();
size_type n;
n = w > 0 ? static_cast<size_type>(w) : str.max_size();
int_type const eof = EOF;
streambuf_type * sb = is.rdbuf();
int_type c = sb->sgetc();
while (extracted < n
&& c != eof && !isspace(c)) {
str += c;
++extracted;
c = sb->snextc();
}
if (c == eof)
is.setstate(std::ios::eofbit);
is.width(0);
// }
if (!extracted)
is.setstate(std::ios::failbit);
return is;
}
#endif
ostream & operator<<(ostream & o, lyxstring const & s) ostream & operator<<(ostream & o, lyxstring const & s)

View File

@ -900,18 +900,17 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
} }
bool LyXText::fullRebreak(BufferView * bview) void LyXText::fullRebreak(BufferView * bview)
{ {
if (!firstrow) { if (!firstrow) {
init(bview); init(bview);
return true; return;
} }
if (need_break_row) { if (need_break_row) {
breakAgain(bview, need_break_row); breakAgain(bview, need_break_row);
need_break_row = 0; need_break_row = 0;
return true; return;
} }
return true;
} }