Some changes to compile new painter code with compaq cxx

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@551 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-02-11 13:52:44 +00:00
parent cfdd73ea94
commit 391d71dab2
8 changed files with 87 additions and 89 deletions

View File

@ -1,3 +1,19 @@
2000-02-11 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/PainterBase.C (ellipse, circle): do not specify the default
arguments.
* src/LColor.h: add using directive.
* src/Painter.[Ch]: change return type of methods from Painter& to
PainterBase&. Add a using directive.
* src/WorkArea.C: wrap xforms callbacks in C functions
C_WorkArea_xxx.
* lib/layouts/foils.layout: font fix and simplifications from Carl
Ollivier-Gooch.
2000-02-10 Lars Gullik Bjønnes <larsbj@lyx.org>
* a lot of files: The Painter, LColor and WorkArea from the old

View File

@ -53,7 +53,7 @@ Style Foilhead
# standard font definition
Font
Series Bold
Size Larger
Size Large
EndFont
End
@ -61,72 +61,22 @@ End
# Shortfoilhead style definition
Style ShortFoilhead
Margin Static
LatexType Command
LatexName foilhead
CopyStyle Foilhead
LatexParam "[-0.5in]"
LabelSep xxx
ParSkip 0.4
TopSep 1.3
BottomSep 0.7
ParSep 0.7
Align Center
AlignPossible Center
LabelType No_Label
# standard font definition
Font
Series Bold
Size Larger
EndFont
End
# landscape foilhead style definition
Style Rotatefoilhead
Margin Static
LatexType Command
CopyStyle Foilhead
LatexName rotatefoilhead
LabelSep xxx
ParSkip 0.4
TopSep 1.3
BottomSep 0.7
ParSep 0.7
Align Center
AlignPossible Center
LabelType No_Label
# standard font definition
Font
Series Bold
Size Larger
EndFont
End
# ShortRotatefoilhead style definition
Style ShortRotatefoilhead
Margin Static
LatexType Command
LatexName rotatefoilhead
CopyStyle Rotatefoilhead
LatexParam "[-0.5in]"
LabelSep xxx
ParSkip 0.4
TopSep 1.3
BottomSep 0.7
ParSep 0.7
Align Center
AlignPossible Center
LabelType No_Label
# standard font definition
Font
Series Bold
Size Larger
EndFont
End
# then a few lists

View File

@ -18,6 +18,8 @@
#endif
#include <map>
using std::map;
using std::less;
#include "LString.h"

View File

@ -60,7 +60,7 @@ Painter::~Painter() {
extern bool Lgb_bug_find_hack;
Painter & Painter::point(int x, int y, LColor::color c)
PainterBase & Painter::point(int x, int y, LColor::color c)
{
if (lyxerr.debugging()) {
if (!Lgb_bug_find_hack)
@ -74,7 +74,7 @@ Painter & Painter::point(int x, int y, LColor::color c)
}
Painter & Painter::line(int x1, int y1, int x2, int y2,
PainterBase & Painter::line(int x1, int y1, int x2, int y2,
LColor::color col,
enum line_style ls,
enum line_width lw)
@ -92,7 +92,7 @@ Painter & Painter::line(int x1, int y1, int x2, int y2,
}
Painter & Painter::lines(int const * xp, int const * yp, int np,
PainterBase & Painter::lines(int const * xp, int const * yp, int np,
LColor::color col,
enum line_style ls,
enum line_width lw)
@ -124,7 +124,7 @@ Painter & Painter::lines(int const * xp, int const * yp, int np,
}
Painter & Painter::rectangle(int x, int y, int w, int h,
PainterBase & Painter::rectangle(int x, int y, int w, int h,
LColor::color col,
enum line_style ls,
enum line_width lw)
@ -142,7 +142,7 @@ Painter & Painter::rectangle(int x, int y, int w, int h,
}
Painter & Painter::fillRectangle(int x, int y, int w, int h,
PainterBase & Painter::fillRectangle(int x, int y, int w, int h,
LColor::color col)
{
if (lyxerr.debugging()) {
@ -157,7 +157,7 @@ Painter & Painter::fillRectangle(int x, int y, int w, int h,
}
Painter & Painter::fillPolygon(int const * xp, int const * yp, int np,
PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np,
LColor::color col)
{
if (lyxerr.debugging()) {
@ -186,7 +186,7 @@ Painter & Painter::fillPolygon(int const * xp, int const * yp, int np,
}
Painter & Painter::arc(int x, int y,
PainterBase & Painter::arc(int x, int y,
unsigned int w, unsigned int h,
int a1, int a2, LColor::color col)
{
@ -204,7 +204,7 @@ Painter & Painter::arc(int x, int y,
/// Draw lines from x1,y1 to x2,y2. They are arrays
Painter & Painter::segments(int const * x1, int const * y1,
PainterBase & Painter::segments(int const * x1, int const * y1,
int const * x2, int const * y2, int ns,
LColor::color col,
enum line_style ls, enum line_width lw)
@ -236,7 +236,7 @@ Painter & Painter::segments(int const * x1, int const * y1,
}
Painter & Painter::pixmap(int x, int y, Pixmap bitmap)
PainterBase & Painter::pixmap(int x, int y, Pixmap bitmap)
{
if (lyxerr.debugging()) {
if (!Lgb_bug_find_hack)
@ -257,7 +257,7 @@ Painter & Painter::pixmap(int x, int y, Pixmap bitmap)
}
Painter & Painter::text(int x, int y, string const & s, LyXFont const & f)
PainterBase & Painter::text(int x, int y, string const & s, LyXFont const & f)
{
if (lyxerr.debugging()) {
if (!Lgb_bug_find_hack)
@ -274,7 +274,7 @@ Painter & Painter::text(int x, int y, string const & s, LyXFont const & f)
}
Painter & Painter::text(int x, int y, char const * s, int ls,
PainterBase & Painter::text(int x, int y, char const * s, int ls,
LyXFont const & f)
{
if (lyxerr.debugging()) {
@ -292,7 +292,7 @@ Painter & Painter::text(int x, int y, char const * s, int ls,
}
Painter & Painter::text(int x, int y, char c, LyXFont const & f)
PainterBase & Painter::text(int x, int y, char c, LyXFont const & f)
{
if (lyxerr.debugging()) {
if (!Lgb_bug_find_hack)

View File

@ -27,6 +27,8 @@
#include "PainterBase.h"
#include "LColor.h"
using std::less;
class LyXFont;
class WorkArea;
@ -44,72 +46,72 @@ public:
/**@Basic drawing routines */
/// Draw a line from point to point
Painter & line(int x1, int y1, int x2, int y2,
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
Painter & lines(int const * xp, int const * yp, int np,
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
Painter & fillPolygon(int const * xp, int const * yp, int np,
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
Painter & segments(int const * x1, int const * y1,
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
Painter & rectangle(int x, int y, int w, int h,
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
Painter & arc(int x, int y, unsigned int w, unsigned int h,
PainterBase & arc(int x, int y, unsigned int w, unsigned int h,
int a1, int a2,
LColor::color = LColor::foreground);
/// Draw a pixel
Painter & point(int x, int y, LColor::color = LColor::foreground);
PainterBase & point(int x, int y, LColor::color = LColor::foreground);
/// Fill a rectangle
Painter & fillRectangle(int x, int y, int w, int h,
PainterBase & fillRectangle(int x, int y, int w, int h,
LColor::color = LColor::background);
/**@Image stuff */
/// For the figure inset
Painter & pixmap(int x, int y, Pixmap bitmap);
PainterBase & pixmap(int x, int y, Pixmap bitmap);
/**@String functions */
/// Draw a string at position x, y (y is the baseline)
Painter & 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 */
Painter & text(int x, int y, char const * str, int l,
PainterBase & text(int x, int y, char const * str, int l,
LyXFont const & f);
/// Draw a char at position x, y (y is the baseline)
Painter & text(int x, int y, char c, LyXFont const & f);
PainterBase & text(int x, int y, char c, LyXFont const & f);
protected:
/**@Support for X only, by now */
friend class WorkArea;
///
Painter & setDisplay(Display * d) { display = d; return *this; }
PainterBase & setDisplay(Display * d) { display = d; return *this; }
///
Painter & setDrawable(Drawable d) { drawable = d; return *this; }
PainterBase & setDrawable(Drawable d) { drawable = d; return *this; }
/// Get foreground color in ordinary GC
GC getGCForeground(LColor::color c);

View File

@ -55,7 +55,7 @@ int PainterBase::width(char c, LyXFont const & f)
PainterBase & PainterBase::circle(int x, int y, unsigned int d,
LColor::color col = LColor::foreground)
LColor::color col)
{
return ellipse(x, y, d, d, col);
}
@ -63,7 +63,7 @@ PainterBase & PainterBase::circle(int x, int y, unsigned int d,
PainterBase & PainterBase::ellipse(int x, int y,
unsigned int w, unsigned int h,
LColor::color col = LColor::foreground)
LColor::color col)
{
return arc(x, y, w, h, 0, 0, col);
}

View File

@ -32,6 +32,33 @@ void waitForX()
XSync(fl_get_display(), 0);
}
extern "C" {
// Just a bunch of C wrappers around static members of WorkArea
void C_WorkArea_up_cb(FL_OBJECT * ob, long buf)
{
WorkArea::up_cb(ob, buf);
}
void C_WorkArea_down_cb(FL_OBJECT * ob, long buf)
{
WorkArea::down_cb(ob, buf);
}
void C_WorkArea_scroll_cb(FL_OBJECT * ob, long buf)
{
WorkArea::scroll_cb(ob, buf);
}
int C_WorkArea_work_area_handler(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord,
int key, void * xev)
{
return WorkArea::work_area_handler(ob, event,
0, 0, key, xev);
}
}
WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
: owner(o), workareapixmap(0)
@ -88,7 +115,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj,NorthEastGravity, NorthEastGravity);
obj->u_vdata = this;
fl_set_object_callback(obj,up_cb, 0);
fl_set_object_callback(obj,C_WorkArea_up_cb, 0);
fl_set_pixmapbutton_data(obj, const_cast<char**>(up_xpm));
// Remove the blue feedback rectangle
@ -108,7 +135,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
obj->u_vdata = this;
fl_set_object_callback(obj, scroll_cb, 0);
fl_set_object_callback(obj, C_WorkArea_scroll_cb, 0);
fl_set_slider_precision(obj, 0);
// down - scrollbar button
@ -126,7 +153,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
obj->u_vdata = this;
fl_set_object_callback(obj, down_cb, 0);
fl_set_object_callback(obj, C_WorkArea_down_cb, 0);
fl_set_pixmapbutton_data(obj, const_cast<char**>(down_xpm));
fl_set_border_width(-bw);
@ -154,7 +181,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
xpos + bw, ypos + bw,
width - 15 - 2 * bw, // scrollbarwidth
height - 2 * bw, "",
work_area_handler);
C_WorkArea_work_area_handler);
obj->wantkey = FL_KEY_TAB;
obj->u_vdata = this; /* This is how we pass the WorkArea
to the work_area_handler. */

View File

@ -17,6 +17,7 @@
#endif
#include <utility>
using std::pair;
#include FORMS_H_LOCATION
#include "Painter.h"
@ -112,9 +113,6 @@ public:
//Signal3<int, int, unsigned int> trippleclick;
///
//Signal2<Window, XEvent *> selection;
private:
///
void createPixmap(int, int);
/// xforms callback
static int work_area_handler(FL_OBJECT *, int event,
FL_Coord, FL_Coord,
@ -125,6 +123,9 @@ private:
static void down_cb(FL_OBJECT *, long);
/// xforms callback
static void scroll_cb(FL_OBJECT *, long);
private:
///
void createPixmap(int, int);
///
FL_OBJECT * backgroundbox;
///