some small updates to Painter, and make the new painter the default.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@555 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-02-14 22:14:48 +00:00
parent bc4646a58e
commit d6f638ea96
36 changed files with 225 additions and 137 deletions

View File

@ -1,3 +1,14 @@
2000-02-14 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/Painter.C (text(int,int,char,LyXFont)): call text(int, int,
char const *, int, LyXFont)
(text(int, int, string, LyXFont)): ditto
* src/text.C (InsertCharInTable): attempt to fix the double-space
feature in tables too.
(BackspaceInTable): ditto.
(GetVisibleRow): make bottom pagebreak line be a onoff line.
2000-02-11 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/text2.C (owner): only complain if owner_ is set and bv != 0

View File

@ -41,7 +41,6 @@ using std::for_each;
#endif
#include "debug.h"
#include "lyxdraw.h"
#include "lyx_gui_misc.h"
#include "BackStack.h"
#include "lyxtext.h"
@ -53,6 +52,9 @@ using std::for_each;
#include "lyxrc.h"
#include "lyxrow.h"
#include "WorkArea.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
using std::find_if;

View File

@ -4,7 +4,7 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1997 Asger Alstrup
* Copyright 1997 Asger Alstrup
* and the LyX Team.
*
* ====================================================== */

View File

@ -16,6 +16,9 @@
#pragma interface
#endif
#define USE_PAINTER 1
#include FORMS_H_LOCATION
#include "lyxfont.h"
#include "LString.h"

View File

@ -10,8 +10,6 @@
#include <config.h>
#ifdef USE_PAINTER
#ifdef __GNUG__
#pragma implementation
#endif
@ -172,5 +170,3 @@ LColor::color LColor::getFromLyXName(string const & lyxname) const
// The evil global LColor instance
LColor lcolor;
#endif

View File

@ -8,8 +8,6 @@
*
*======================================================*/
#ifdef USE_PAINTER
#ifndef LCOLOR_H
#define LCOLOR_H
@ -206,5 +204,3 @@ private:
extern LColor lcolor;
#endif
#endif

View File

@ -119,8 +119,6 @@ lyx_SOURCES = \
lyx_sty.C \
lyx_sty.h \
lyxcursor.h \
lyxdraw.C \
lyxdraw.h \
lyxfont.C \
lyxfont.h \
lyxfr0.C \

View File

@ -10,8 +10,6 @@
#include <config.h>
#ifdef USE_PAINTER
#ifdef __GNUG__
#pragma implementation
#endif
@ -35,7 +33,7 @@ Painter::Painter(WorkArea & wa)
{
colormap = fl_state[fl_get_vclass()].colormap;
// Clear the GC cache
for (int i=0; i <= LColor::ignore; ++i) {
for (int i = 0; i <= LColor::ignore; ++i) {
colorGCcache[i] = 0;
}
}
@ -43,14 +41,14 @@ Painter::Painter(WorkArea & wa)
Painter::~Painter() {
// Release all the registered GCs
for (int i=0; i <= LColor::ignore; ++i) {
for (int i = 0; i <= LColor::ignore; ++i) {
if (colorGCcache[i] != 0) {
XFreeGC(display, colorGCcache[i]);
}
}
// Iterate over the line cache and Free the GCs
LineGCCache::iterator lit = lineGCcache.begin();
for (; lit != lineGCcache.end(); ++lit) {
for (LineGCCache::iterator lit = lineGCcache.begin();
lit != lineGCcache.end(); ++lit) {
XFreeGC(display, (*lit).second);
}
}
@ -258,18 +256,14 @@ PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap)
PainterBase & Painter::text(int x, int y, string const & s, LyXFont const & f)
{
if (lyxerr.debugging()) {
if (!Lgb_bug_find_hack)
lyxerr << "text not called from "
"workarea::workhandler\n";
lyxerr << "Painter drawable: " << drawable << endl;
}
GC gc = getGCForeground(f.realColor());
XSetFont(display, gc, f.getFontID());
XDrawString(display, drawable, gc, x, y, s.c_str(), s.length());
underline(f, x, y, this->width(s, f));
return *this;
return text(x, y, s.c_str(), s.length(), f);
}
PainterBase & Painter::text(int x, int y, char c, LyXFont const & f)
{
char s[2] = { c, '\0' };
return text(x, y, s, 1, f);
}
@ -291,26 +285,8 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls,
}
PainterBase & Painter::text(int x, int y, char c, LyXFont const & f)
void Painter::underline(LyXFont const & f, int x, int y, int width)
{
if (lyxerr.debugging()) {
if (!Lgb_bug_find_hack)
lyxerr << "text not called from "
"workarea::workhandler\n";
lyxerr << "Painter drawable: " << drawable << endl;
}
GC gc = getGCForeground(f.realColor());
XSetFont(display, gc, f.getFontID());
char s[2];
s[0] = c; s[1] = '\0';
XDrawString(display, drawable, gc, x, y, s, 1);
underline(f, x, y, this->width(c, f));
return *this;
}
void Painter::underline(LyXFont const & f, int x, int y, int width) {
// What about underbars?
if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON) {
int below = f.maxDescent() / 2;
@ -347,9 +323,11 @@ GC Painter::getGCForeground(LColor::color c)
val.foreground = bla;
// Try the exact RGB values first, then the approximate.
} else if (XAllocColor(display, colormap, &xcol) != 0) {
lyxerr << _("LyX: X11 color ") << s
<< _(" allocated for ")
<< lcolor.getGUIName(c) << endl;
if (lyxerr.debugging()) {
lyxerr << _("LyX: X11 color ") << s
<< _(" allocated for ")
<< lcolor.getGUIName(c) << endl;
}
val.foreground = xcol.pixel;
} else if (XAllocColor(display, colormap, &ccol)) {
lyxerr << _("LyX: Using approximated X11 color ") << s
@ -451,5 +429,3 @@ GC Painter::getGCLinepars(enum line_style ls,
GCForeground | GCLineStyle | GCLineWidth |
GCCapStyle | GCJoinStyle | GCFunction, &val);
}
#endif

View File

@ -8,7 +8,7 @@
*
* ======================================================*/
#ifdef USE_PAINTER
#define USE_PAINTER 1
#ifndef PAINTER_H
#define PAINTER_H
@ -33,74 +33,75 @@ class LyXFont;
class WorkArea;
/** An inplementation for the X Window System. Xlib.
Classes similar to this one can be made for gtk+, Qt, etc.
*/
*/
class Painter : public PainterBase {
public:
/// Constructor
Painter(WorkArea &);
/// Destructor
~Painter();
/**@Basic drawing routines */
/// Draw a line from point to point
PainterBase & line(int x1, int y1, int x2, int y2,
LColor::color = LColor::foreground,
enum line_style = line_solid,
enum line_width = line_thin);
/// Here xp and yp are arrays of points
PainterBase & lines(int const * xp, int const * yp, int np,
LColor::color = LColor::foreground,
enum line_style = line_solid,
enum line_width = line_thin);
/// Here xp and yp are arrays of points
PainterBase & fillPolygon(int const * xp, int const * yp, int np,
LColor::color = LColor::foreground);
/// Draw lines from x1,y1 to x2,y2. They are arrays
PainterBase & segments(int const * x1, int const * y1,
int const * x2, int const * y2, int ns,
LColor::color = LColor::foreground,
enum line_style = line_solid,
enum line_width = line_thin);
/// Draw a rectangle
PainterBase & rectangle(int x, int y, int w, int h,
/// Here xp and yp are arrays of points
PainterBase & lines(int const * xp, int const * yp, int np,
LColor::color = LColor::foreground,
enum line_style = line_solid,
enum line_width = line_thin);
/// Here xp and yp are arrays of points
PainterBase & fillPolygon(int const * xp, int const * yp, int np,
LColor::color = LColor::foreground);
/// Draw lines from x1,y1 to x2,y2. They are arrays
PainterBase & segments(int const * x1, int const * y1,
int const * x2, int const * y2, int ns,
LColor::color = LColor::foreground,
enum line_style = line_solid,
enum line_width = line_thin);
/// Draw a rectangle
PainterBase & rectangle(int x, int y, int w, int h,
LColor::color = LColor::foreground,
enum line_style = line_solid,
enum line_width = line_thin);
/// Draw an arc
PainterBase & arc(int x, int y, unsigned int w, unsigned int h,
int a1, int a2,
LColor::color = LColor::foreground);
int a1, int a2,
LColor::color = LColor::foreground);
/// Draw a pixel
PainterBase & point(int x, int y, LColor::color = LColor::foreground);
/// Fill a rectangle
PainterBase & fillRectangle(int x, int y, int w, int h,
LColor::color = LColor::background);
LColor::color = LColor::background);
/**@Image stuff */
/// For the figure inset
PainterBase & pixmap(int x, int y, int w, int h, Pixmap bitmap);
/**@String functions */
/// Draw a string at position x, y (y is the baseline)
PainterBase & text(int x, int y, string const & str, LyXFont const & f);
PainterBase & text(int x, int y,
string const & str, LyXFont const & f);
/** Draw a string at position x, y (y is the baseline)
This is just for fast drawing */
PainterBase & text(int x, int y, char const * str, int l,
LyXFont const & f);
LyXFont const & f);
/// Draw a char at position x, y (y is the baseline)
PainterBase & text(int x, int y, char c, LyXFont const & f);
@ -109,19 +110,19 @@ protected:
friend class WorkArea;
///
PainterBase & setDisplay(Display * d) { display = d; return *this; }
///
PainterBase & setDrawable(Drawable d) { drawable = d; return *this; }
/// Get foreground color in ordinary GC
GC getGCForeground(LColor::color c);
/// Set up GC according to line style
GC getGCLinepars(enum line_style, enum line_width, LColor::color c);
/// Check the font, and if set, draw an underline
void underline(LyXFont const & f, int x, int y, int width);
/**@Low level X parameters */
///
Display * display;
@ -129,7 +130,7 @@ protected:
Drawable drawable;
///
Colormap colormap;
/// Caching of ordinary color GCs
GC colorGCcache[LColor::ignore + 1];
/// Caching of GCs used for lines
@ -138,5 +139,3 @@ protected:
LineGCCache lineGCcache;
};
#endif
#endif

View File

@ -9,8 +9,6 @@
#include <config.h>
#ifdef USE_PAINTER
#ifdef __GNUG__
#pragma implementation
#endif
@ -141,5 +139,3 @@ PainterBase & PainterBase::buttonText(int x, int baseline,
text(x + 4, baseline, str, font);
return *this;
}
#endif

View File

@ -8,8 +8,6 @@
*
*======================================================*/
#ifdef USE_PAINTER
#ifndef PAINTERBASE_H
#define PAINTERBASE_H
@ -202,5 +200,3 @@ private:
};
#endif
#endif

View File

@ -11,7 +11,9 @@
#include "bmtable.h"
#include "support/filetools.h"
#ifdef MONO
extern int mono_video;
#endif
FD_form_bullet *create_form_form_bullet(void)
{
@ -29,15 +31,19 @@ FD_form_bullet *create_form_form_bullet(void)
fl_set_object_callback(obj, BulletBMTableCB, 0);
fl_set_object_lcol(obj, FL_BLUE);
fl_set_object_boxtype(obj, FL_UP_BOX);
#ifdef MONO
if (mono_video) {
fl_set_bmtable_file(obj, 6, 6,
LibFileSearch("images",
"standard.xbm").c_str());
} else {
#endif
fl_set_bmtable_pixmap_file(obj, 6, 6,
LibFileSearch("images",
"standard.xpm").c_str());
#ifdef MONO
}
#endif
fl_set_border_width(-1);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 95, 20, 255, 70, "");

View File

@ -11,7 +11,9 @@
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB + WriteAlert
#ifdef MONO
extern int mono_video;
#endif
extern BufferView * current_view;
FD_form_bullet * fd_form_bullet;
@ -24,7 +26,10 @@ static int current_bullet_depth;
void bulletForm()
{
if (!fd_form_bullet) {
if (!mono_video &&
if (
#ifdef MONO
!mono_video &&
#endif
(XpmVersion < 4
|| (XpmVersion == 4 && XpmRevision < 7))) {
WriteAlert(_("Sorry, your libXpm is too old."),
@ -221,15 +226,19 @@ void BulletPanelCB(FL_OBJECT * /*ob*/, long data)
new_panel = "standard";
break;
}
#ifdef MONO
if (mono_video) {
new_panel += ".xbm";
fl_set_bmtable_file(fd_form_bullet->bmtable_bullet_panel, 6, 6,
LibFileSearch("images", new_panel.c_str()).c_str());
} else {
#endif
new_panel += ".xpm";
fl_set_bmtable_pixmap_file(fd_form_bullet->bmtable_bullet_panel, 6, 6,
LibFileSearch("images", new_panel.c_str()).c_str());
#ifdef MONO
}
#endif
fl_redraw_object(fd_form_bullet->bmtable_bullet_panel);
fl_unfreeze_form(fd_form_bullet->form_bullet);
}

View File

@ -2,7 +2,9 @@
* figinset.C - part of LyX project
*/
#ifdef MONO
extern int reverse_video;
#endif
extern long int background_pixels;
/* Rework of path-handling (Matthias 04.07.1996 )
@ -58,7 +60,9 @@ using std::flush;
#include "support/filetools.h"
#include "LyXView.h" // just because of form_main
#include "debug.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "LaTeXFeatures.h"
#include "lyxrc.h"
#include "gettext.h"
@ -644,15 +648,19 @@ static void runqueue()
}
#ifdef USE_PAINTER
#ifdef MONO
if (reverse_video) {
sprintf(tbuf+1, " %ld %ld", WhitePixelOfScreen(
DefaultScreenOfDisplay(fl_display)),
fl_get_pixel(FL_BLACK));
} else {
#endif
sprintf(tbuf+1, " %ld %ld", BlackPixelOfScreen(
DefaultScreenOfDisplay(fl_display)),
fl_get_pixel(FL_WHITE));
#ifdef MONO
}
#endif
#else
if (reverse_video) {
sprintf(tbuf+1, " %ld %ld", WhitePixelOfScreen(

View File

@ -15,7 +15,9 @@
#endif
#include "insetcommand.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "debug.h"
#include "Painter.h"

View File

@ -15,7 +15,9 @@
#endif
#include "inseterror.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "Painter.h"

View File

@ -19,12 +19,14 @@
#include "insetinfo.h"
#include "lyxparagraph.h"
#include "debug.h"
#include "lyxdraw.h"
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "buffer.h"
#include "support/lstrings.h"
#include "Painter.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
/* Info, used for the Info boxes */

View File

@ -17,7 +17,9 @@
#include "insetlatexaccent.h"
#include "debug.h"
#include "lyxrc.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "support/lstrings.h"
#include "Painter.h"
@ -534,6 +536,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
}
case TILDE: // tilde
{
#if 0
if (hg35 > 2.0) hg35 -= 1.0;
x2 += (hg35 / 2.0);
int xp[4], yp[4];
@ -551,6 +554,11 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
yp[3] = int(y + hg35);
pain.lines(xp, yp, 4);
#else
pain.text(x2 - font.width('~') / 2,
baseline - font.ascent('~'),
"~", 1, font);
#endif
break;
}
case UNDERBAR: // underbar
@ -665,6 +673,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
}
case UMLAUT: // umlaut
{
#if 0
float rad = hg / 2.0;
if (rad <= 1.0) {
pain.point(int(x2 - 4.0 * hg / 7.0),
@ -683,6 +692,10 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
y + hg35,
rad, rad, 0, 360*64);
}
#else
pain.text(x2 - font.width('¨') / 2, baseline,
"¨", 1, font);
#endif
break;
}
case CIRCUMFLEX: // circumflex
@ -964,7 +977,7 @@ void InsetLatexAccent::Draw(LyXFont font,
y + hg35,
rad, rad, 0, 360*64);
}
//scr.drawText(font, "¨", 1, y + hg, x2);
//scr.drawText(font, "¨", 1, baseline, x2);
break;
}
case CIRCUMFLEX: // circumflex

View File

@ -14,10 +14,12 @@
#endif
#include "insetspecialchar.h"
#include "lyxdraw.h"
#include "debug.h"
#include "LaTeXFeatures.h"
#include "Painter.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
InsetSpecialChar::InsetSpecialChar(Kind k)
: kind(k)

View File

@ -16,6 +16,8 @@
#pragma interface
#endif
#define USE_PAINTER 1
#include "gettext.h"
#include "lyxfont.h"
#include "lyxlex.h"

View File

@ -31,7 +31,9 @@
#include "LyXView.h"
#include "buffer.h"
#include "lyxserver.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h"
@ -77,9 +79,11 @@ FL_CMD_OPT cmdopt[] =
{"-height", "*.height", XrmoptionSepArg, "510"},
{"-xpos", "*.xpos", XrmoptionSepArg, "-1"},
{"-ypos", "*.ypos", XrmoptionSepArg, "-1"},
#ifdef MONO
{"-Reverse", "*.Reverse", XrmoptionNoArg, "1"},
{"-Mono", "*.Mono", XrmoptionNoArg, "1"},
{"-FastSelection", "*.FastSelection", XrmoptionNoArg, "1"},
#endif
{"-MathColor", "*.MathColor", XrmoptionSepArg, "blue"},
{"-MathFrameColor", "*.MathFrameColor", XrmoptionSepArg, "magenta"},
{"-FootColor", "*.FootColor", XrmoptionSepArg, "red"},
@ -99,9 +103,11 @@ static int width;
static int height;
static int xpos;
static int ypos;
#ifdef MONO
int reverse_video;
int mono_video;
int fast_selection;
#endif
bool cursor_follows_scrollbar;
char math_color[32];
char math_frame_color[32];
@ -125,9 +131,11 @@ FL_resource res[] =
{"height", "heightClass", FL_INT, &height, "510", 0},
{"xpos", "xposClass", FL_INT, &xpos, "-1", 0},
{"ypos", "yposClass", FL_INT, &ypos, "-1", 0},
#ifdef MONO
{"Reverse", "reverseClass", FL_INT, &reverse_video, "0", 0},
{"Mono", "monoClass", FL_INT, &mono_video, "0", 0},
{"FastSelection", "selectionClass", FL_INT, &fast_selection, "0", 0},
#endif
{"MathColor", "colorClass", FL_STRING, math_color, "blue", 31},
{"MathFrameColor", "colorClass", FL_STRING, math_frame_color, "magenta", 31},
{"FootColor", "colorClass", FL_STRING, foot_color, "red", 31},

View File

@ -1,8 +1,6 @@
#include <config.h>
#ifndef USE_PAINTER
#include "lyxdraw.h"
#include "debug.h"
@ -556,5 +554,3 @@ GC getGC(gc_type typ)
}
return gc;
}
#endif

View File

@ -1,5 +1,4 @@
// -*- C++ -*-
#ifndef USE_PAINTER
#ifndef LYX_DRAW_H
#define LYX_DRAW_H
@ -53,5 +52,3 @@ extern GC GetAccentGC(LyXFont const &f, int line_width);
extern GC GetColorGC(LyXFont::FONT_COLOR color);
#endif
#endif

View File

@ -22,7 +22,9 @@
#include "debug.h"
#include "lyxrc.h"
#include "lyxlex.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "FontLoader.h"
#include "support/lstrings.h"

View File

@ -15,6 +15,8 @@
#pragma interface
#endif
#define USE_PAINTER 1
#include FORMS_H_LOCATION
#include "LString.h"
#include "debug.h"

View File

@ -36,7 +36,10 @@ using std::ios;
// this is crappy... why are those colors command line arguments and
// not in lyxrc?? (Matthias)
// Because nobody put them there. (Asger)
#ifdef MONO
extern int fast_selection;
#endif
extern string background_color;
extern char selection_color[];
extern bool cursor_follows_scrollbar;
@ -97,7 +100,9 @@ enum LyXRCTags {
RC_KBMAP,
RC_KBMAP_PRIMARY,
RC_KBMAP_SECONDARY,
#ifdef MONO
RC_FAST_SELECTION,
#endif
RC_SELECTION_COLOR,
RC_BACKGROUND_COLOR,
RC_FAX_COMMAND,
@ -165,7 +170,9 @@ static keyword_item lyxrcTags[] = {
{ "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
{ "\\escape_chars", RC_ESC_CHARS },
{ "\\exit_confirmation", RC_EXIT_CONFIRMATION },
#ifdef MONO
{ "\\fast_selection", RC_FAST_SELECTION },
#endif
{ "\\fax_command", RC_FAX_COMMAND },
{ "\\fax_program", RC_FAXPROGRAM },
{ "\\font_encoding", RC_FONT_ENCODING },
@ -831,10 +838,12 @@ int LyXRC::read(string const & filename)
cursor_follows_scrollbar = lexrc.GetBool();
break;
#ifdef MONO
case RC_FAST_SELECTION:
if (lexrc.next())
fast_selection = lexrc.GetBool();
break;
#endif
case RC_BACKGROUND_COLOR:
if (lexrc.next())
@ -1167,9 +1176,11 @@ void LyXRC::output(ostream & os) const
case RC_CURSOR_FOLLOWS_SCROLLBAR:
os << "\\cursor_follows_scrollbar "
<< tostr(cursor_follows_scrollbar) << "\n";
#ifdef MONO
case RC_FAST_SELECTION:
os << "\\fast_selection "
<< tostr(static_cast<bool>(fast_selection)) << "\n";
#endif
case RC_BACKGROUND_COLOR:
os << "\\background_color \"" << background_color << "\"\n";
case RC_SELECTION_COLOR:

View File

@ -18,7 +18,12 @@
#include FORMS_H_LOCATION
#include <X11/Xlib.h>
#define USE_PAINTER 1
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
class LyXText;
struct Row;
@ -48,11 +53,13 @@ public:
///
~LyXScreen();
#ifndef USE_PAINTER
/** Return the forground pixmap. This function is a _hack_,
we should be rid of it as soon as possible. But to do that
a lot in the mathcode and the figinset has to be rewritten.
Tasks for 0.13. */
Pixmap getForeground() { return foreground; };
#endif
/** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */
@ -189,7 +196,7 @@ private:
///
Row * screen_refresh_row;
///
friend class InsetFormula;
//friend class InsetFormula;
#ifdef USE_PAINTER
///
GC gc_copy;

View File

@ -31,7 +31,9 @@
#include "minibuffer.h"
#include "BufferView.h"
#include "lyxscreen.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "lyxtext.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
@ -43,11 +45,16 @@
extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
#ifndef USE_PAINTER
extern GC canvasGC, mathGC, mathLineGC, latexGC, cursorGC, mathFrameGC;
#endif
extern char * mathed_label;
#ifdef MONO
extern int mono_video;
extern int fast_selection;
#endif
extern BufferView * current_view;
extern char const * latex_special_chars;
@ -857,8 +864,10 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
static MathSpaceInset * sp= 0;
HideInsetCursor();
#ifdef MONO
if (mathcursor->Selection() && (fast_selection || mono_video))
ToggleInsetSelection();
#endif
if (mathcursor->getLastCode() == LM_TC_TEX) {
varcode = LM_TC_TEX;
@ -1316,7 +1325,11 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
&& action != LFUN_BACKSPACE)
UpdateLocal();
if (sp && !space_on) sp = 0;
if (mathcursor->Selection() || (was_selection && !(fast_selection || mono_video)))
if (mathcursor->Selection() || (was_selection
#ifdef MONO
&& !(fast_selection || mono_video)
#endif
))
ToggleInsetSelection();
if (result)
@ -1336,11 +1349,13 @@ MathFuncInset::draw(Painter & pain, int x, int y)
LyXFont font = WhichFont(LM_TC_TEXTRM, size);
font.setLatex(LyXFont::ON);
x += (font.textWidth("I", 1) + 3) / 4;
#ifdef MONO
if (mono_video) {
int a = font.maxAscent();
int d = font.maxDescent();
pain.fillRectangle(x, y - a, font.textWidth(name, strlen(name)), a + d);
}
#endif
pain.text(x, y, name, font);
}
}

View File

@ -29,7 +29,9 @@
#include "lyx_cb.h"
#include "BufferView.h"
#include "lyxscreen.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#include "gettext.h"
#include "Painter.h"

View File

@ -31,9 +31,13 @@
#include "LColor.h"
#include "Painter.h"
#ifndef USE_PAINTER
extern void mathed_set_font(short type, int style);
#endif
#ifndef USE_PAINTER
extern GC canvasGC, mathGC, latexGC, cursorGC, mathFrameGC;
#endif
static LyxArrayBase * selarray = 0;

View File

@ -24,6 +24,8 @@
#pragma interface
#endif
#define USE_PAINTER 1
#include "support/LIstream.h"
#include "LString.h"

View File

@ -231,7 +231,9 @@ typedef float matriz_data[2][2];
const matriz_data MATIDEN= { {1, 0}, {0, 1}};
#ifndef USE_PAINTER
extern void mathed_set_font(short type, int style);
#endif
extern int mathed_char_width(short type, int style, byte c);
extern int mathed_char_height(short, int, byte, int&, int&);
@ -288,7 +290,9 @@ void Matriz::transf(float xp, float yp, float &x, float &y)
y = m[1][0]*xp + m[1][1]*yp;
}
#ifndef USE_PAINTER
extern GC latexGC, mathGC, mathLineGC, cursorGC;
#endif
static int search_deco(int code)
{

View File

@ -32,8 +32,10 @@ extern int mathed_char_width(short type, int style, byte c);
extern int mathed_string_width(short type, int style, byte const* s, int ls);
extern int mathed_string_height(short, int, byte const*, int, int&, int&);
extern int mathed_char_height(short, int, byte, int&, int&);
#ifndef USE_PAINTER
GC canvasGC= 0, mathGC= 0, mathLineGC= 0, latexGC= 0, cursorGC= 0, mathFrameGC= 0;
#endif
#ifndef USE_PAINTER

View File

@ -47,7 +47,9 @@ ostream & operator<<(ostream & o, MathedMacroFlag mmf)
return o << int(mmf);
}
#ifndef USE_PAINTER
extern GC mathGC, mathFrameGC, latexGC;
#endif
extern int mathed_string_width(short type, int style, byte const* s, int ls);
extern int mathed_string_height(short, int, byte const*, int, int&, int&);
@ -126,7 +128,7 @@ void MathMacro::draw(Painter & pain, int x, int y)
Metrics();
tmplate->update(this);
tmplate->SetStyle(size);
mathGC = latexGC;
//mathGC = latexGC;
tmplate->draw(pain, x, y);
for (int i = 0; i < nargs; ++i)
tmplate->GetMacroXY(i, args[i].x, args[i].y);

View File

@ -15,14 +15,18 @@
#endif
#include "lyxscreen.h"
#include "lyxdraw.h"
#include "lyxtext.h"
#include "lyxrow.h"
#include "BufferView.h"
#include "Painter.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
#ifdef MONO
extern int mono_video;
extern int fast_selection;
#endif
#ifdef USE_PAINTER
static
@ -407,9 +411,11 @@ int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
void LyXScreen::HideManualCursor(long x, long y, int asc, int desc)
{
#ifdef MONO
if (fast_selection || mono_video)
ShowManualCursor(x, y, asc, desc);
else
#endif
HideCursor();
}

View File

@ -21,7 +21,6 @@
#include "lyxtext.h"
#include "support/textutils.h"
#include "lyx_gui_misc.h"
#include "lyxdraw.h"
#include "gettext.h"
#include "bufferparams.h"
#include "buffer.h"
@ -32,15 +31,21 @@
#include "LyXView.h"
#include "lyxrow.h"
#include "Painter.h"
#ifndef USE_PAINTER
#include "lyxdraw.h"
#endif
using std::max;
using std::min;
static const int LYX_PAPER_MARGIN = 20;
#ifdef MONO
extern int mono_video;
extern int reverse_video;
extern int fast_selection;
#endif
extern BufferView * current_view;
extern LyXRC * lyxrc;
@ -2779,16 +2784,17 @@ void LyXText::InsertCharInTable(char c)
jumped_over_space = false;
if (IsLineSeparatorChar(c)) {
#ifndef FIX_DOUBLE_SPACE
/* avoid double blanks but insert the new blank because
* of a possible font change */
if (cursor.pos < lastpos &&
cursor.par->IsLineSeparator(cursor.pos))
{
cursor.par->IsLineSeparator(cursor.pos)) {
cursor.par->Erase(cursor.pos);
jumped_over_space = true;
}
else if ((cursor.pos > 0 &&
} else
#endif
if ((cursor.pos > 0 &&
cursor.par->IsLineSeparator(cursor.pos - 1))
|| (cursor.pos > 0 && cursor.par->IsNewline(cursor.pos - 1))
|| (cursor.pos == 0 &&
@ -2796,8 +2802,7 @@ void LyXText::InsertCharInTable(char c)
&& cursor.par->Previous()->footnoteflag
== LyXParagraph::OPEN_FOOTNOTE)))
return;
}
else if (IsNewlineChar(c)) {
} else if (IsNewlineChar(c)) {
if (!IsEmptyTableCell()) {
TableFeatures(LyXTable::APPEND_CONT_ROW);
CursorDown();
@ -2897,13 +2902,12 @@ void LyXText::BackspaceInTable()
/* no pasting of table paragraphs */
CursorLeft();
}
else {
} else {
/* this is the code for a normal backspace, not pasting
* any paragraphs */
SetUndo(Undo::DELETE,
cursor.par->ParFromPos(cursor.pos)->previous,
cursor.par->ParFromPos(cursor.pos)->next);
SetUndo(Undo::DELETE,
cursor.par->ParFromPos(cursor.pos)->previous,
cursor.par->ParFromPos(cursor.pos)->next);
CursorLeftIntern();
@ -2930,7 +2934,8 @@ void LyXText::BackspaceInTable()
tmprow = tmprow->next;
tmprow->pos--;
}
#ifndef FIX_DOUBLE_SPACE
/* delete superfluous blanks */
if (cursor.pos < cursor.par->Last() - 1 &&
(cursor.par->IsLineSeparator(cursor.pos))) {
@ -2950,6 +2955,7 @@ void LyXText::BackspaceInTable()
cursor.pos--;
}
}
#endif
}
CheckParagraphInTable(cursor.par, cursor.pos);
@ -4106,7 +4112,11 @@ void LyXText::GetVisibleRow(int offset,
pain.fillRectangle(0, offset, paperwidth, row_ptr->height);
// check for NOT FAST SELECTION
if (!fast_selection && !mono_video && selection) {
if (
#ifdef MONO
!fast_selection && !mono_video &&
#endif
selection) {
/* selection code */
if (sel_start_cursor.row == row_ptr &&
sel_end_cursor.row == row_ptr) {
@ -4120,8 +4130,7 @@ void LyXText::GetVisibleRow(int offset,
sel_start_cursor.x - sel_end_cursor.x,
row_ptr->height,
LColor::selection);
}
else if (sel_start_cursor.row == row_ptr) {
} else if (sel_start_cursor.row == row_ptr) {
if (direction == LYX_DIR_LEFT_TO_RIGHT)
pain.fillRectangle(sel_start_cursor.x, offset,
paperwidth - sel_start_cursor.x,
@ -4447,7 +4456,7 @@ void LyXText::GetVisibleRow(int offset,
pain.line(0, offset + y_bottom - 2 * DefaultHeight(),
paperwidth,
offset + y_bottom - 2 * DefaultHeight(),
LColor::pagebreak);
LColor::pagebreak, Painter::line_onoffdash);
y_bottom -= 3 * DefaultHeight();
}