mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
A couple of minor bug fixes and cleanups
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4574 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
52d30225b8
commit
0a8631ad44
@ -1,3 +1,12 @@
|
|||||||
|
2002-07-09 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* lengthcommon.h: whitespace
|
||||||
|
|
||||||
|
* lyxfunc.C: update scrollbar after goto paragraph
|
||||||
|
|
||||||
|
* lyxtext.h: factor out page break drawing, and fix it so
|
||||||
|
page break/added space paints as selected nicely
|
||||||
|
|
||||||
2002-07-09 John Levon <moz@compsoc.man.ac.uk>
|
2002-07-09 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* BufferView_pimpl.C: add FIXMEs, clean up a little
|
* BufferView_pimpl.C: add FIXMEs, clean up a little
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2002-07-09 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* Painter.C:
|
||||||
|
* Painter.h: make frame/background painting optional
|
||||||
|
for rectText
|
||||||
|
|
||||||
2002-07-05 Angus Leeming <leeming@lyx.org>
|
2002-07-05 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* lyx_gui.h (hexname): new function.
|
* lyx_gui.h (hexname): new function.
|
||||||
|
@ -67,9 +67,15 @@ Painter & Painter::rectText(int x, int baseline,
|
|||||||
|
|
||||||
font_metrics::rectText(str, font, width, ascent, descent);
|
font_metrics::rectText(str, font, width, ascent, descent);
|
||||||
|
|
||||||
rectangle(x, baseline - ascent, width, ascent + descent, frame);
|
if (frame != LColor::none) {
|
||||||
fillRectangle(x + 1, baseline - ascent + 1, width - 1,
|
rectangle(x, baseline - ascent, width, ascent + descent, frame);
|
||||||
ascent + descent - 1, back);
|
}
|
||||||
|
|
||||||
|
if (back != LColor::none) {
|
||||||
|
fillRectangle(x + 1, baseline - ascent + 1, width - 1,
|
||||||
|
ascent + descent - 1, back);
|
||||||
|
}
|
||||||
|
|
||||||
text(x + 3, baseline, str, font);
|
text(x + 3, baseline, str, font);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -151,12 +151,17 @@ public:
|
|||||||
virtual Painter & text(int x, int y,
|
virtual Painter & text(int x, int y,
|
||||||
char c, LyXFont const & f) = 0;
|
char c, LyXFont const & f) = 0;
|
||||||
|
|
||||||
/// draw a string and enclose it inside a rectangle
|
/**
|
||||||
|
* Draw a string and enclose it inside a rectangle. If
|
||||||
|
* back color is specified, the background is cleared with
|
||||||
|
* the given color. If frame is specified, a thin frame is drawn
|
||||||
|
* around the text with the given color.
|
||||||
|
*/
|
||||||
Painter & rectText(int x, int baseline,
|
Painter & rectText(int x, int baseline,
|
||||||
string const & string,
|
string const & string,
|
||||||
LyXFont const & font,
|
LyXFont const & font,
|
||||||
LColor::color back,
|
LColor::color back = LColor::none,
|
||||||
LColor::color frame);
|
LColor::color frame = LColor::none);
|
||||||
|
|
||||||
/// draw a string and enclose it inside a button frame
|
/// draw a string and enclose it inside a button frame
|
||||||
Painter & buttonText(int x,
|
Painter & buttonText(int x,
|
||||||
|
@ -110,7 +110,7 @@ public:
|
|||||||
* @param bv the bufferview
|
* @param bv the bufferview
|
||||||
* @return true if a change was necessary
|
* @return true if a change was necessary
|
||||||
*
|
*
|
||||||
* Scrolls the screen so that the cursor is visible,
|
* Scrolls the screen so that the cursor is visible
|
||||||
*/
|
*/
|
||||||
virtual bool fitCursor(LyXText *, BufferView *);
|
virtual bool fitCursor(LyXText *, BufferView *);
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-07-09 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* xscreen.C: add const
|
||||||
|
|
||||||
2002-07-09 Angus Leeming <leeming@lyx.org>
|
2002-07-09 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* xformsImage.C (scale): use boost::tie.
|
* xformsImage.C (scale): use boost::tie.
|
||||||
|
@ -206,7 +206,7 @@ void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
|
|||||||
if (cursor_visible_) hideCursor();
|
if (cursor_visible_) hideCursor();
|
||||||
|
|
||||||
int const old_first = text->first_y;
|
int const old_first = text->first_y;
|
||||||
bool internal = (text == bv->text);
|
bool const internal = (text == bv->text);
|
||||||
text->first_y = y;
|
text->first_y = y;
|
||||||
|
|
||||||
// is any optimization possible?
|
// is any optimization possible?
|
||||||
|
@ -14,7 +14,7 @@ extern int const num_units;
|
|||||||
*
|
*
|
||||||
* FIXME: I am not sure if "mu" should be possible to select (Lgb)
|
* FIXME: I am not sure if "mu" should be possible to select (Lgb)
|
||||||
*/
|
*/
|
||||||
extern char const *unit_name[];
|
extern char const * unit_name[];
|
||||||
|
|
||||||
/// return the unit given a string representation such as "cm"
|
/// return the unit given a string representation such as "cm"
|
||||||
LyXLength::UNIT unitFromString(string const & data);
|
LyXLength::UNIT unitFromString(string const & data);
|
||||||
|
@ -1393,11 +1393,11 @@ string const LyXFunc::dispatch(kb_action action, string argument)
|
|||||||
owner->view()->buffer(bufferlist.loadLyXFile(s));
|
owner->view()->buffer(bufferlist.loadLyXFile(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the cursor
|
|
||||||
owner->view()->setCursorFromRow(row);
|
owner->view()->setCursorFromRow(row);
|
||||||
|
|
||||||
// Recenter screen
|
|
||||||
owner->view()->center();
|
owner->view()->center();
|
||||||
|
// see BufferView_pimpl::center()
|
||||||
|
owner->view()->updateScrollbar();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1427,8 +1427,9 @@ string const LyXFunc::dispatch(kb_action action, string argument)
|
|||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
owner->showState();
|
owner->showState();
|
||||||
|
|
||||||
// Recenter screen
|
|
||||||
owner->view()->center();
|
owner->view()->center();
|
||||||
|
// see BufferView_pimpl::center()
|
||||||
|
owner->view()->updateScrollbar();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -589,6 +589,9 @@ private:
|
|||||||
/// paint appendix marker
|
/// paint appendix marker
|
||||||
void paintRowAppendix(DrawRowParams & p);
|
void paintRowAppendix(DrawRowParams & p);
|
||||||
|
|
||||||
|
/// paint page break marker. Returns its height.
|
||||||
|
int paintPageBreak(string const & label, int y, DrawRowParams & p);
|
||||||
|
|
||||||
/// paint env depth bar
|
/// paint env depth bar
|
||||||
void paintRowDepthBar(DrawRowParams & p);
|
void paintRowDepthBar(DrawRowParams & p);
|
||||||
|
|
||||||
|
65
src/text.C
65
src/text.C
@ -3308,9 +3308,7 @@ int LyXText::drawLengthMarker(DrawRowParams & p, string const & prefix,
|
|||||||
|
|
||||||
p.pain->rectText(leftx + 2 * arrow_size + 5,
|
p.pain->rectText(leftx + 2 * arrow_size + 5,
|
||||||
start + ((end - start) / 2) + d,
|
start + ((end - start) / 2) + d,
|
||||||
str, font,
|
str, font);
|
||||||
backgroundColor(),
|
|
||||||
backgroundColor());
|
|
||||||
|
|
||||||
// top arrow
|
// top arrow
|
||||||
p.pain->line(leftx, ty1, midx, ty2, LColor::added_space);
|
p.pain->line(leftx, ty1, midx, ty2, LColor::added_space);
|
||||||
@ -3327,6 +3325,30 @@ int LyXText::drawLengthMarker(DrawRowParams & p, string const & prefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int LyXText::paintPageBreak(string const & label, int y, DrawRowParams & p)
|
||||||
|
{
|
||||||
|
LyXFont pb_font;
|
||||||
|
pb_font.setColor(LColor::pagebreak).decSize();
|
||||||
|
|
||||||
|
int w = 0;
|
||||||
|
int a = 0;
|
||||||
|
int d = 0;
|
||||||
|
font_metrics::rectText(label, pb_font, w, a, d);
|
||||||
|
|
||||||
|
int const text_start = p.xo + ((p.width - w) / 2);
|
||||||
|
int const text_end = text_start + w;
|
||||||
|
|
||||||
|
p.pain->rectText(text_start, y + d, label, pb_font);
|
||||||
|
|
||||||
|
p.pain->line(p.xo, y, text_start, y,
|
||||||
|
LColor::pagebreak, Painter::line_onoffdash);
|
||||||
|
p.pain->line(text_end, y, p.xo + p.width, y,
|
||||||
|
LColor::pagebreak, Painter::line_onoffdash);
|
||||||
|
|
||||||
|
return 3 * defaultHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::paintFirstRow(DrawRowParams & p)
|
void LyXText::paintFirstRow(DrawRowParams & p)
|
||||||
{
|
{
|
||||||
Paragraph * par = p.row->par();
|
Paragraph * par = p.row->par();
|
||||||
@ -3345,22 +3367,8 @@ void LyXText::paintFirstRow(DrawRowParams & p)
|
|||||||
|
|
||||||
// draw a top pagebreak
|
// draw a top pagebreak
|
||||||
if (parparams.pagebreakTop()) {
|
if (parparams.pagebreakTop()) {
|
||||||
int const y = p.yo + y_top + 2*defaultHeight();
|
y_top += paintPageBreak(_("Page Break (top)"),
|
||||||
p.pain->line(p.xo, y, p.xo + p.width, y,
|
p.yo + y_top + 2 * defaultHeight(), p);
|
||||||
LColor::pagebreak, Painter::line_onoffdash);
|
|
||||||
|
|
||||||
int w = 0;
|
|
||||||
int a = 0;
|
|
||||||
int d = 0;
|
|
||||||
|
|
||||||
LyXFont pb_font;
|
|
||||||
pb_font.setColor(LColor::pagebreak).decSize();
|
|
||||||
font_metrics::rectText(_("Page Break (top)"), pb_font, w, a, d);
|
|
||||||
p.pain->rectText((p.width - w)/2, y + d,
|
|
||||||
_("Page Break (top)"), pb_font,
|
|
||||||
backgroundColor(),
|
|
||||||
backgroundColor());
|
|
||||||
y_top += 3 * defaultHeight();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the additional space if needed:
|
// draw the additional space if needed:
|
||||||
@ -3523,22 +3531,8 @@ void LyXText::paintLastRow(DrawRowParams & p)
|
|||||||
|
|
||||||
// draw a bottom pagebreak
|
// draw a bottom pagebreak
|
||||||
if (parparams.pagebreakBottom()) {
|
if (parparams.pagebreakBottom()) {
|
||||||
LyXFont pb_font;
|
y_bottom -= paintPageBreak(_("Page Break (bottom)"),
|
||||||
pb_font.setColor(LColor::pagebreak).decSize();
|
p.yo + y_bottom - 2 * defaultHeight(), p);
|
||||||
int const y = p.yo + y_bottom - 2 * defaultHeight();
|
|
||||||
|
|
||||||
p.pain->line(p.xo, y, p.xo + p.width, y, LColor::pagebreak,
|
|
||||||
Painter::line_onoffdash);
|
|
||||||
|
|
||||||
int w = 0;
|
|
||||||
int a = 0;
|
|
||||||
int d = 0;
|
|
||||||
font_metrics::rectText(_("Page Break (bottom)"), pb_font, w, a, d);
|
|
||||||
p.pain->rectText((ww - w) / 2, y + d,
|
|
||||||
_("Page Break (bottom)"),
|
|
||||||
pb_font, backgroundColor(), backgroundColor());
|
|
||||||
|
|
||||||
y_bottom -= 3 * defaultHeight();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the additional space if needed:
|
// draw the additional space if needed:
|
||||||
@ -3611,6 +3605,7 @@ void LyXText::paintLastRow(DrawRowParams & p)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::paintRowText(DrawRowParams & p)
|
void LyXText::paintRowText(DrawRowParams & p)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user