Remove warnings about hidden virtual member functions.

This commit is contained in:
ManoloFLTK 2021-03-01 11:20:03 +01:00
parent 49a78bc482
commit 81a4b7329c
8 changed files with 60 additions and 9 deletions

View File

@ -66,6 +66,7 @@ public:
/** Returns the underlying FILE pointer */
FILE *file();
virtual void origin(int x, int y);
virtual void origin(int *x, int *y);
virtual void translate(int x, int y);
virtual void untranslate();
virtual int printable_rect(int *w, int *h);

View File

@ -575,7 +575,10 @@ Fl_Fontsize Fl_Graphics_Driver::size() {return size_; }
double Fl_Graphics_Driver::width(const char *str, int nChars) { return 0; }
/** Compute the width of Unicode character \p c if drawn with current font */
double Fl_Graphics_Driver::width(unsigned int c) { char ch = (char)c; return width(&ch, 1); }
double Fl_Graphics_Driver::width(unsigned int c) {
char buf[4];
return width(buf, fl_utf8encode (c, buf));
}
/** Return the current line height */
int Fl_Graphics_Driver::height() { return size(); }

View File

@ -50,8 +50,6 @@ public:
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
int not_clipped(int x, int y, int w, int h);
void restore_clip();
// --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx
//void transformed_vertex0(double x, double y);
void transformed_vertex(double xf, double yf);
void vertex(double x, double y);
void begin_points();
@ -67,21 +65,21 @@ public:
void end_complex_polygon();
void fixloop();
void circle(double x, double y, double r);
// --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed
// using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end);
// --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
void arc(int x, int y, int w, int h, double a1, double a2);
void arc(double x, double y, double r, double start, double end);
void pie(int x, int y, int w, int h, double a1, double a2);
// --- implementation is in src/fl_line_style.cxx which includes src/cfg_gfx/xxx_line_style.cxx
void line_style(int style, int width=0, char* dashes=0);
// --- implementation is in src/fl_color.cxx which includes src/cfg_gfx/xxx_color.cxx
void color(Fl_Color c);
Fl_Color color() { return color_; }
void color(uchar r, uchar g, uchar b);
// --- implementation is in Fl_OpenGL_Graphics_Driver_font.cxx
void font(Fl_Font face, Fl_Fontsize fsize);
Fl_Font font();
void draw(const char *str, int n, int x, int y);
void draw(const char *str, int n, float x, float y);
void draw(int angle, const char *str, int n, int x, int y);
double width(const char *str, int n);
double width(unsigned int c);
void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
int height();
int descent();

View File

@ -46,6 +46,10 @@ void Fl_OpenGL_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2)
glEnd();
}
void Fl_OpenGL_Graphics_Driver::arc(double x, double y, double r, double start, double end) {
Fl_Graphics_Driver::arc(x, y, r, start, end);
}
void Fl_OpenGL_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
if (w <= 0 || h <= 0) return;
while (a2<a1) a2 += 360.0; // TODO: write a sensible fmod angle alignment here

View File

@ -172,11 +172,22 @@ FL_EXPORT int glutStrokeWidth(void *font, int character);
// use gl_font()/gl_draw() to draw GL text
void Fl_OpenGL_Graphics_Driver::font(Fl_Font face, Fl_Fontsize fsize) {
Fl_Graphics_Driver::font(face, fsize);
Fl_Surface_Device::push_current(Fl_Display_Device::display_device());
gl_font(face, fsize);
Fl_Surface_Device::pop_current();
}
Fl_Font Fl_OpenGL_Graphics_Driver::font() {
return Fl_Graphics_Driver::font();
}
void Fl_OpenGL_Graphics_Driver::draw(const char *str, int n, float x, float y) {
this->draw(str, n, int(x), int(y));
}
void Fl_OpenGL_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y) {}
void Fl_OpenGL_Graphics_Driver::draw(const char* str, int n, int x, int y) {
Fl_Surface_Device::push_current(Fl_Display_Device::display_device());
gl_draw(str, n, x, y);
@ -190,6 +201,8 @@ double Fl_OpenGL_Graphics_Driver::width(const char *str, int n) {
return w;
}
double Fl_OpenGL_Graphics_Driver::width(unsigned int c) { return Fl_Graphics_Driver::width(c); }
int Fl_OpenGL_Graphics_Driver::descent() {
Fl_Surface_Device::push_current(Fl_Display_Device::display_device());
int d = fl_descent();

View File

@ -174,6 +174,8 @@ void Fl_PostScript_Graphics_Driver::font(int f, int s) {
#endif
}
Fl_Font Fl_PostScript_Graphics_Driver::font() { return Fl_Graphics_Driver:: font(); }
double Fl_PostScript_Graphics_Driver::width(const char *s, int n) {
return Fl_Graphics_Driver::default_driver().width(s, n);
}
@ -200,6 +202,8 @@ void Fl_PostScript_Graphics_Driver::color(Fl_Color c) {
color(cr_, cg_, cb_);
}
Fl_Color Fl_PostScript_Graphics_Driver::color() { return Fl_Graphics_Driver::color(); }
void Fl_PostScript_Graphics_Driver::point(int x, int y){
rectf(x,y,1,1);
}

View File

@ -133,6 +133,7 @@ public:
// implementation of drawing methods
void color(Fl_Color c);
void color(uchar r, uchar g, uchar b);
Fl_Color color();
void push_clip(int x, int y, int w, int h);
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
@ -191,6 +192,7 @@ public:
void draw(int angle, const char *str, int n, int x, int y);
void rtl_draw(const char* s, int n, int x, int y);
void font(int face, int size);
Fl_Font font();
double width(const char *, int);
double width(unsigned int u);
void text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h);

View File

@ -78,15 +78,19 @@ protected:
void compute_dasharray(float s, char *dashes=0);
void line_style(int style, int width, char *dashes=0);
void line(int x1, int y1, int x2, int y2);
void line(int x1, int y1, int x2, int y2, int x3, int y3);
void font_(int f, int s);
void font(int f, int s);
Fl_Font font();
void draw(const char *str, int n, int x, int y);
void draw(const char*, int, float, float) ;
void draw(int, const char*, int, int, int) ;
void rtl_draw(const char *str, int n, int x, int y);
void color(uchar r, uchar g, uchar b);
void color(Fl_Color c);
double width(const char*, int) ;
Fl_Color color();
double width(const char*, int);
double width(unsigned int c);
void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
int height() ;
int descent() ;
@ -122,6 +126,7 @@ protected:
void end_complex_polygon();
void circle(double x, double y,double r);
void arc(int x,int y,int w,int h,double a1,double a2);
void arc(double x, double y, double r, double start, double end);
void pie(int x,int y,int w,int h,double a1,double a2);
void arc_pie(char AorP, int x, int y, int w, int h, double a1, double a2);
};
@ -179,6 +184,13 @@ void Fl_SVG_Graphics_Driver::line(int x1, int y1, int x2, int y2) {
x1,y1,x2,y2, red_, green_, blue_, width_, linecap_, linejoin_, dasharray_);
}
void Fl_SVG_Graphics_Driver::line(int x1, int y1, int x2, int y2, int x3, int y3) {
fprintf(out_,
"<path d=\"M %d %d L %d %d L %d %d \" "
"style=\"stroke:rgb(%u,%u,%u);fill:none;stroke-width:%d;stroke-linecap:%s;stroke-linejoin:%s;stroke-dasharray:%s\" />\n",
x1, y1, x2, y2, x3, y3, red_, green_, blue_, width_, linecap_, linejoin_, dasharray_);
}
void Fl_SVG_Graphics_Driver::font_(int ft, int s) {
Fl_Graphics_Driver::font(ft, s);
int famnum = ft/4;
@ -198,6 +210,8 @@ void Fl_SVG_Graphics_Driver::font(int ft, int s) {
font_(ft, s);
}
Fl_Font Fl_SVG_Graphics_Driver::font() { return Fl_Graphics_Driver::font(); }
void Fl_SVG_Graphics_Driver::compute_dasharray(float s, char *dashes) {
if (user_dash_array_ && user_dash_array_ != dashes) {free(user_dash_array_); user_dash_array_ = NULL;}
if (dashes && *dashes) {
@ -288,10 +302,16 @@ void Fl_SVG_Graphics_Driver::color(uchar r, uchar g, uchar b) {
blue_ = b;
}
Fl_Color Fl_SVG_Graphics_Driver::color() { return Fl_Graphics_Driver::color(); }
double Fl_SVG_Graphics_Driver::width(const char* str, int l) {
return Fl_Display_Device::display_device()->driver()->width(str, l);
}
double Fl_SVG_Graphics_Driver::width(unsigned int c) {
return Fl_Display_Device::display_device()->driver()->width(c);
}
void Fl_SVG_Graphics_Driver::text_extents(const char *c, int n, int& dx, int& dy, int& w, int& h) {
Fl::first_window()->make_current(); // to get a valid drawing gc
Fl_Display_Device::display_device()->driver()->text_extents(c, n, dx, dy, w, h);
@ -950,6 +970,10 @@ void Fl_SVG_Graphics_Driver::end_complex_polygon() {
fprintf(out_, " z\" fill=\"rgb(%u,%u,%u)\" />\n", red_, green_, blue_);
}
void Fl_SVG_Graphics_Driver::arc(double x, double y, double r, double start, double end) {
Fl_Graphics_Driver::arc(x, y, r, start, end);
}
void Fl_SVG_Graphics_Driver::arc(int x, int y, int w, int h, double a1, double a2) {
arc_pie('A', x, y, w, h, a1, a2);
}
@ -1018,3 +1042,5 @@ void Fl_SVG_File_Surface::untranslate() {}
int Fl_SVG_File_Surface::printable_rect(int *w, int *h) {return 0;}
#endif // FLTK_USE_SVG
void Fl_SVG_File_Surface::origin(int *x, int *y) { Fl_Widget_Surface::origin(x, y);}