src/CutAndPaste.C
src/debug.C
src/exporter.C
-src/ext_l10n.h
src/figure_form.C
src/figureForm.C
src/FontLoader.C
+2001-07-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * text.C (getVisibleRow): adjust
+
+ * font.[Ch] (rectText): new method, metrics
+ (buttonText): new method, metrics
+
+ * PainterBase.[hC]: make rectText and buttonText always draw and take
+ fewer paramteres.
+
2001-07-22 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* ToolbarDefaults.C (read):
}
+#if 0
PainterBase & PainterBase::rectText(int x, int baseline,
string const & str,
LyXFont const & font,
LColor::color frame, bool draw,
int & width, int & ascent, int & descent)
{
+#if 0
static int const d = 2;
width = lyxfont::width(str, font) + d * 2 + 2;
ascent = lyxfont::maxAscent(font) + d;
descent = lyxfont::maxDescent(font) + d;
-
+#else
+ lyxfont::rectText(str, font, width, axcent, descent);
+#endif
if (!draw) return *this;
rectangle(x, baseline - ascent, width, ascent + descent, frame);
fillRectangle(x + 1, baseline - ascent + 1, width - 1,
ascent + descent - 1, back);
+#if 0
text(x + d, baseline, str, font);
+#else
+ text(x + 2, baseline, str, font);
+#endif
return *this;
}
LyXFont const & font, bool draw,
int & width, int & ascent, int & descent)
{
+#if 0
width = lyxfont::width(str, font) + 8;
ascent = lyxfont::maxAscent(font) + 3;
descent = lyxfont::maxDescent(font) + 3;
-
+#else
+ lyxfont::buttonText(str, font, width, ascent, descent);
+#endif
if (!draw) return *this;
button(x, baseline - ascent, width, descent + ascent);
text(x + 4, baseline, str, font);
return *this;
}
+#else
+PainterBase & PainterBase::rectText(int x, int baseline,
+ string const & str,
+ LyXFont const & font,
+ LColor::color back,
+ LColor::color frame)
+{
+ int width;
+ int ascent;
+ int descent;
+
+ lyxfont::rectText(str, font, width, ascent, descent);
+ rectangle(x, baseline - ascent, width, ascent + descent, frame);
+ fillRectangle(x + 1, baseline - ascent + 1, width - 1,
+ ascent + descent - 1, back);
+ text(x + 2, baseline, str, font);
+ return *this;
+}
+
+
+PainterBase & PainterBase::buttonText(int x, int baseline,
+ string const & str,
+ LyXFont const & font)
+{
+ int width;
+ int ascent;
+ int descent;
+
+ lyxfont::buttonText(str, font, width, ascent, descent);
+ button(x, baseline - ascent, width, descent + ascent);
+ text(x + 4, baseline, str, font);
+ return *this;
+}
+#endif
/// Draw a char at position x, y (y is the baseline)
virtual PainterBase & text(int x, int y, char c, LyXFont const & f)=0;
-
+
+#if 0
/** Draws a string and encloses it inside a rectangle. Returns
the size of the rectangle. If draw is false, we only calculate
the size. */
int & width = PainterBase::dummy1,
int & ascent = PainterBase::dummy2,
int & descent = PainterBase::dummy3);
+#else
+ /** Draws a string and encloses it inside a rectangle. Returns
+ the size of the rectangle. If draw is false, we only calculate
+ the size. */
+ PainterBase & rectText(int x, int baseline,
+ string const & string,
+ LyXFont const & font,
+ LColor::color back,
+ LColor::color frame);
+
+ /** Draw a string and encloses it inside a button frame. Returns
+ the size of the frame. If draw is false, we only calculate
+ the size. */
+ PainterBase & buttonText(int x, int baseline, string const & s,
+ LyXFont const & font);
+#endif
protected:
///
WorkArea & owner;
result += ::XTextWidth16(getXFontstruct(smallfont), &c, 1);
} else {
result += ::XTextWidth16(getXFontstruct(f), &s[i], 1);
- }
+ }
}
return result;
}
::XSetFont(display, gc, getFontID(f));
}
+
+void lyxfont::rectText(string const & str, LyXFont const & font,
+ int & width, int & ascent, int & descent)
+{
+ static int const d = 2;
+ width = lyxfont::width(str, font) + d * 2 + 2;
+ ascent = lyxfont::maxAscent(font) + d;
+ descent = lyxfont::maxDescent(font) + d;
+}
+
+
+
+void lyxfont::buttonText(string const & str, LyXFont const & font,
+ int & width, int & ascent, int & descent)
+{
+ width = lyxfont::width(str, font) + 8;
+ ascent = lyxfont::maxAscent(font) + 3;
+ descent = lyxfont::maxDescent(font) + 3;
+}
+
+
//} // end of namespace font
//} // end of namespace lyx
///
static
void XSetFont(Display * display, GC gc, LyXFont const & f);
+ // A couple of more high-level metrics
+ ///
+ static
+ void rectText(string const & str, LyXFont const & font,
+ int & width, int & ascent, int & descent);
+ ///
+ static
+ void buttonText(string const & str, LyXFont const & font,
+ int & width, int & ascent, int & descent);
};
//} // end of namespace font
+2001-07-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * insetcollapsable.C: adjust
+
+ * insetbutton.C: adjust
+
2001-07-23 Juergen Vigna <jug@sad.it>
* insetcollapsable.h: removed widthCollapsed variable, LyXFont
#include "Painter.h"
#include "support/LAssert.h"
#include "lyxfont.h"
+#include "font.h"
using std::ostream;
using std::endl;
int ascent;
int descent;
string const s = getScreenLabel();
-
+
+#if 0
if (editable()) {
bv->painter().buttonText(0, 0, s, font,
false, width, ascent, descent);
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
}
+#else
+ if (editable()) {
+ lyxfont::buttonText(s, font, width, ascent, descent);
+ } else {
+ lyxfont::rectText(s, font, width, ascent, descent);
+ }
+#endif
return ascent;
}
int ascent;
int descent;
string const s = getScreenLabel();
-
+
+#if 0
if (editable()) {
bv->painter().buttonText(0, 0, s, font,
false, width, ascent, descent);
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
}
+#else
+ if (editable()) {
+ lyxfont::buttonText(s, font, width, ascent, descent);
+ } else {
+ lyxfont::rectText(s, font, width, ascent, descent);
+ }
+#endif
return descent;
}
int ascent;
int descent;
string const s = getScreenLabel();
-
+
+#if 0
if (editable()) {
bv->painter().buttonText(0, 0, s, font,
false, width, ascent, descent);
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
}
+#else
+ if (editable()) {
+ lyxfont::buttonText(s, font, width, ascent, descent);
+ } else {
+ lyxfont::rectText(s, font, width, ascent, descent);
+ }
+#endif
return width + 4;
}
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::command).decSize();
- int width;
string const s = getScreenLabel();
+#if 0
+ int width;
if (editable()) {
pain.buttonText(int(x) + 2, baseline, s, font, true, width);
} else {
LColor::commandbg, LColor::commandframe,
true, width);
}
+#else
+ if (editable()) {
+ pain.buttonText(int(x) + 2, baseline, s, font);
+ } else {
+ pain.rectText(int(x) + 2, baseline, s, font,
+ LColor::commandbg, LColor::commandframe);
+ }
+#endif
+#if 0
x += width + 4;
+#else
+ x += width(bv, font);
+#endif
}
#include "support/lstrings.h"
#include "debug.h"
#include "lyxtext.h"
+#include "font.h"
class LyXText;
}
-int InsetCollapsable::ascent_collapsed(Painter & pain) const
+//int InsetCollapsable::ascent_collapsed(Painter & pain) const
+int InsetCollapsable::ascent_collapsed(Painter & /*pain*/) const
{
int width = 0;
int ascent = 0;
int descent = 0;
+#if 0
pain.buttonText(0, 0, draw_label, labelfont, false,
width, ascent, descent);
+#else
+ lyxfont::buttonText(draw_label, labelfont, width, ascent, descent);
+#endif
return ascent;
}
-int InsetCollapsable::descent_collapsed(Painter & pain) const
+//int InsetCollapsable::descent_collapsed(Painter & pain) const
+int InsetCollapsable::descent_collapsed(Painter & /*pain*/) const
{
int width = 0;
int ascent = 0;
int descent = 0;
+#if 0
pain.buttonText(0, 0, draw_label, labelfont, false,
width, ascent, descent);
+#else
+ lyxfont::buttonText(draw_label, labelfont, width, ascent, descent);
+#endif
return descent;
}
-int InsetCollapsable::width_collapsed(Painter & pain) const
+//int InsetCollapsable::width_collapsed(Painter & pain) const
+int InsetCollapsable::width_collapsed(Painter & /*pain*/) const
{
int width;
int ascent;
int descent;
+#if 0
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, draw_label, labelfont, false,
width, ascent, descent);
+#else
+ lyxfont::buttonText(draw_label, labelfont, width, ascent, descent);
+#endif
return width + (2*TEXT_TO_INSET_OFFSET);
}
void InsetCollapsable::draw_collapsed(Painter & pain, int baseline, float & x) const
{
+#if 0
int width = 0;
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
baseline, draw_label, labelfont, true, width);
+#else
+ pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
+ baseline, draw_label, labelfont);
+#endif
+#if 0
x += width + TEXT_TO_INSET_OFFSET;
+#else
+ x += width_collapsed(pain) + TEXT_TO_INSET_OFFSET;
+#endif
}
#include "language.h"
#include "ParagraphParameters.h"
#include "undo_funcs.h"
+#include "font.h"
using std::max;
using std::min;
y_offset + y_top + 2 * defaultHeight(),
LColor::pagebreak,
Painter::line_onoffdash)
+#if 0
.rectText(0,
0,
_("Page Break (top)"),
pb_font,
LColor::background,
LColor::background, false, w, a, d);
+#else
+ ;
+ lyxfont::rectText(_("Page Break (top)"), pb_font,
+ w, a, d);
+#endif
pain.rectText((ww - w)/2,
y_offset + y_top + 2 * defaultHeight() + d,
_("Page Break (top)"),
.line(0, y_place, ww, y_place,
LColor::pagebreak,
Painter::line_onoffdash)
+#if 0
.rectText(0, 0,
_("Page Break (bottom)"),
pb_font,
LColor::background,
LColor::background, false, w, a, d);
+#else
+ ;
+ lyxfont::rectText(_("Page Break (bottom)"), pb_font,
+ w, a, d);
+#endif
pain.rectText((ww - w) / 2, y_place + d,
_("Page Break (bottom)"),
pb_font,