mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-05 08:57:35 +00:00
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:
parent
84480c05b2
commit
bded6fd063
@ -1092,7 +1092,7 @@ void BufferView::Pimpl::update()
|
||||
screen_->update(bv_->text, bv_);
|
||||
bool fitc = false;
|
||||
while (bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
if (bv_->text->fullRebreak(bv_)) {
|
||||
bv_->text->fullRebreak(bv_);
|
||||
st = LyXText::NEED_MORE_REFRESH;
|
||||
bv_->text->setCursor(bv_, bv_->text->cursor.par(),
|
||||
bv_->text->cursor.pos());
|
||||
@ -1105,7 +1105,6 @@ void BufferView::Pimpl::update()
|
||||
bv_->text->selection.end.pos());
|
||||
}
|
||||
fitc = true;
|
||||
}
|
||||
bv_->text->status(bv_, st);
|
||||
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["
|
||||
<< action <<"] arg[" << argument << "]" << endl;
|
||||
|
||||
LyXTextClass const & tclass = textclasslist[buffer_->params.textclass];
|
||||
|
||||
switch (action) {
|
||||
// --- Misc -------------------------------------------
|
||||
case LFUN_APPENDIX:
|
||||
@ -1675,7 +1676,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
InsetCommandParams p;
|
||||
p.setCmdName("tableofcontents");
|
||||
Inset * inset = new InsetTOC(p);
|
||||
if (!insertInset(inset, "Standard"))
|
||||
if (!insertInset(inset, tclass.defaultLayoutName()))
|
||||
delete inset;
|
||||
break;
|
||||
}
|
||||
@ -1802,15 +1803,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
|
||||
// Derive layout number from given argument (string)
|
||||
// and current buffer's textclass (number). */
|
||||
textclass_type tclass = buffer_->params.textclass;
|
||||
bool hasLayout =
|
||||
textclasslist[tclass].hasLayout(argument);
|
||||
bool hasLayout = tclass.hasLayout(argument);
|
||||
string layout = argument;
|
||||
|
||||
// If the entry is obsolete, use the new one instead.
|
||||
if (hasLayout) {
|
||||
string const & obs = textclasslist[tclass][layout]
|
||||
.obsoleted_by();
|
||||
string const & obs = tclass[layout].obsoleted_by();
|
||||
if (!obs.empty())
|
||||
layout = obs;
|
||||
}
|
||||
@ -2488,7 +2486,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
{
|
||||
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) {
|
||||
lt->insertChar(bv_, ' ');
|
||||
@ -3209,7 +3207,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
{
|
||||
InsetCommandParams p("printindex");
|
||||
Inset * inset = new InsetPrintIndex(p);
|
||||
if (!insertInset(inset, "Standard"))
|
||||
if (!insertInset(inset, tclass.defaultLayoutName()))
|
||||
delete inset;
|
||||
}
|
||||
break;
|
||||
@ -3218,7 +3216,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
{
|
||||
InsetCommandParams p("lyxparent", argument);
|
||||
Inset * inset = new InsetParent(p, *buffer_);
|
||||
if (!insertInset(inset, "Standard"))
|
||||
if (!insertInset(inset, tclass.defaultLayoutName()))
|
||||
delete inset;
|
||||
}
|
||||
|
||||
@ -3243,7 +3241,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
case LFUN_FLOAT_LIST:
|
||||
if (floatList.typeExist(argument)) {
|
||||
Inset * inset = new InsetFloatList(argument);
|
||||
if (!insertInset(inset, "Standard"))
|
||||
if (!insertInset(inset, tclass.defaultLayoutName()))
|
||||
delete inset;
|
||||
} else {
|
||||
lyxerr << "Non-existent float type: "
|
||||
|
@ -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>
|
||||
|
||||
* buffer.C (parseSingleLyXformat2Token): reset the font before the
|
||||
|
@ -401,6 +401,9 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
LyXLookupString(ev, dummy, 1, &keysym);
|
||||
#else
|
||||
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
|
||||
if (lyxerr.debugging(Debug::KEY)) {
|
||||
char const * tmp = XKeysymToString(key);
|
||||
|
10
src/buffer.C
10
src/buffer.C
@ -1240,12 +1240,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
// minipage. Currently I am not investing any effort
|
||||
// in fixing those cases.
|
||||
|
||||
//lyxerr << "Call depth: " << call_depth << endl;
|
||||
// lyxerr << "Call depth: " << call_depth << endl;
|
||||
// lyxerr << "Checkminipage: " << checkminipage << endl;
|
||||
|
||||
if (checkminipage && (call_depth == 1)) {
|
||||
checkminipage = false;
|
||||
if (minipar && (minipar != par) &&
|
||||
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE))
|
||||
{
|
||||
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
|
||||
lyxerr << "minipages in a row" << endl;
|
||||
if (par->params().pextraStartMinipage()) {
|
||||
lyxerr << "start new minipage" << endl;
|
||||
@ -1334,8 +1335,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
par->params().depth(depth);
|
||||
minipar = parBeforeMinipage = 0;
|
||||
} else if (!minipar &&
|
||||
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE))
|
||||
{
|
||||
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
|
||||
// par is the first paragraph in a minipage
|
||||
lyxerr << "begin minipage" << endl;
|
||||
// To minimize problems for
|
||||
|
@ -39,7 +39,8 @@ void InsetIndex::edit(BufferView * bv, bool)
|
||||
|
||||
int InsetIndex::docbook(Buffer const *, ostream & os) const
|
||||
{
|
||||
os << "<indexterm><primary>" << getContents() << "</primary></indexterm>";
|
||||
os << "<indexterm><primary>" << getContents()
|
||||
<< "</primary></indexterm>";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -54,6 +55,7 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
|
||||
: InsetCommand(p)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetPrintIndex::getScreenLabel(Buffer const *) const
|
||||
{
|
||||
return _("Index");
|
||||
|
@ -60,13 +60,15 @@ public:
|
||||
///
|
||||
void edit(BufferView *, bool = true) {}
|
||||
///
|
||||
EDITABLE editable() const{ return NOT_EDITABLE; }
|
||||
EDITABLE editable() const { return NOT_EDITABLE; }
|
||||
///
|
||||
bool display() const { return true; }
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
///
|
||||
string const getScreenLabel(Buffer const *) const;
|
||||
///
|
||||
virtual bool needFullRow() const { return true; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -463,12 +463,13 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
int yf = y_offset + first;
|
||||
y = 0;
|
||||
while ((row != 0) && (yf < ph)) {
|
||||
lt->getVisibleRow(bv, y+y_offset+first, int(x), row,
|
||||
y+lt->first_y, cleared);
|
||||
lt->getVisibleRow(bv, y + y_offset + first, int(x),
|
||||
row, y + lt->first_y, cleared);
|
||||
if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
lt->need_break_row = row;
|
||||
if (lt->fullRebreak(bv)) {
|
||||
lt->setCursor(bv, lt->cursor.par(),lt->cursor.pos());
|
||||
lt->fullRebreak(bv);
|
||||
lt->setCursor(bv, lt->cursor.par(),
|
||||
lt->cursor.pos());
|
||||
if (lt->selection.set()) {
|
||||
lt->setCursor(bv, lt->selection.start,
|
||||
lt->selection.start.par(),
|
||||
@ -477,7 +478,6 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
lt->selection.end.par(),
|
||||
lt->selection.end.pos());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
y += row->height();
|
||||
|
@ -177,9 +177,8 @@ public:
|
||||
///
|
||||
void insertInset(BufferView *, Inset * inset);
|
||||
|
||||
/** Completes the insertion with a full rebreak.
|
||||
Returns true if something was broken. */
|
||||
bool fullRebreak(BufferView *);
|
||||
/** Completes the insertion with a full rebreak. */
|
||||
void fullRebreak(BufferView *);
|
||||
|
||||
///
|
||||
mutable Row * need_break_row;
|
||||
|
@ -130,10 +130,10 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
|
||||
x_offset, row, y + text->first_y);
|
||||
internal = internal && (st != LyXText::CHANGED_IN_DRAW);
|
||||
while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
if (text->fullRebreak(bv)) {
|
||||
text->fullRebreak(bv);
|
||||
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->getVisibleRow(bv, y + y_offset,
|
||||
x_offset, row, y + text->first_y);
|
||||
|
@ -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>
|
||||
|
||||
* lstrings.[Ch]: move the getVectorFromString and the vice versa
|
||||
|
@ -1043,7 +1043,7 @@ string const getExtFromContents(string const & filename)
|
||||
break;
|
||||
}
|
||||
|
||||
std::getline(ifs, str);
|
||||
getline(ifs, str);
|
||||
lyxerr[Debug::GRAPHICS] << "Scanstring: " << str << endl;
|
||||
|
||||
string const stamp = str.substr(0,2);
|
||||
@ -1371,10 +1371,9 @@ string const readBB_from_PSFile(string const & file)
|
||||
std::ifstream is(file_.c_str());
|
||||
while (is) {
|
||||
string s;
|
||||
std::getline(is,s);
|
||||
getline(is,s);
|
||||
if (contains(s,"%%BoundingBox:") && !contains(s,"atend"))
|
||||
return (frontStrip(s.substr(14)));
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
|
@ -1732,16 +1732,9 @@ void swap(lyxstring & str1, lyxstring & str2)
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if 0
|
||||
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
|
||||
int w = is.width(0);
|
||||
s.clear();
|
||||
@ -1752,9 +1745,44 @@ istream & operator>>(istream & is, lyxstring & s)
|
||||
if (--w == 1) break;
|
||||
}
|
||||
if (s.empty()) is.setstate(std::ios::failbit);
|
||||
#endif
|
||||
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)
|
||||
|
@ -900,18 +900,17 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
|
||||
}
|
||||
|
||||
|
||||
bool LyXText::fullRebreak(BufferView * bview)
|
||||
void LyXText::fullRebreak(BufferView * bview)
|
||||
{
|
||||
if (!firstrow) {
|
||||
init(bview);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (need_break_row) {
|
||||
breakAgain(bview, need_break_row);
|
||||
need_break_row = 0;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user