Commit 981fa508 authored by Claes Sjofors's avatar Claes Sjofors

Ge rotation of texts implemented

parent 80a2266d
...@@ -1607,13 +1607,14 @@ int GlowDrawGtk::polyline_erase( GlowWind *wind, glow_sPointX *points, int point ...@@ -1607,13 +1607,14 @@ int GlowDrawGtk::polyline_erase( GlowWind *wind, glow_sPointX *points, int point
int GlowDrawGtk::text( GlowWind *wind, int x, int y, char *text, int len, int GlowDrawGtk::text( GlowWind *wind, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, glow_eDrawType gc_type, glow_eDrawType color, int idx,
int highlight, int line, glow_eFont font_idx, double size) int highlight, int line, glow_eFont font_idx, double size,
int rot)
{ {
if ( ctx->nodraw) return 1; if ( ctx->nodraw) return 1;
DrawWindGtk *w = (DrawWindGtk *) wind->window; DrawWindGtk *w = (DrawWindGtk *) wind->window;
if ( !((GrowCtx *)ctx)->bitmap_fonts) if ( !((GrowCtx *)ctx)->bitmap_fonts)
return text_pango( wind, x, y, text, len, gc_type, color, idx, highlight, line, font_idx, size); return text_pango( wind, x, y, text, len, gc_type, color, idx, highlight, line, font_idx, size, rot);
if ( font_idx > glow_eFont_Courier) if ( font_idx > glow_eFont_Courier)
font_idx = glow_eFont_Helvetica; font_idx = glow_eFont_Helvetica;
...@@ -1674,10 +1675,10 @@ int GlowDrawGtk::text_cursor( GlowWind *wind, int x, int y, char *text, int len, ...@@ -1674,10 +1675,10 @@ int GlowDrawGtk::text_cursor( GlowWind *wind, int x, int y, char *text, int len,
int theight, tdescent, width, height, descent; int theight, tdescent, width, height, descent;
get_text_extent( "A", 1, gc_type, idx, font, get_text_extent( "A", 1, gc_type, idx, font,
&width, &height, &descent, size); &width, &height, &descent, size, 0);
if ( pos != 0) if ( pos != 0)
get_text_extent( text, pos, gc_type, idx, font, get_text_extent( text, pos, gc_type, idx, font,
&width, &theight, &tdescent, size); &width, &theight, &tdescent, size, 0);
else else
width = 0; width = 0;
...@@ -1702,13 +1703,13 @@ int GlowDrawGtk::text_cursor( GlowWind *wind, int x, int y, char *text, int len, ...@@ -1702,13 +1703,13 @@ int GlowDrawGtk::text_cursor( GlowWind *wind, int x, int y, char *text, int len,
int GlowDrawGtk::text_erase( GlowWind *wind, int x, int y, char *text, int len, int GlowDrawGtk::text_erase( GlowWind *wind, int x, int y, char *text, int len,
glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx, glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx,
double size) double size, int rot)
{ {
if ( ctx->nodraw) return 1; if ( ctx->nodraw) return 1;
DrawWindGtk *w = (DrawWindGtk *) wind->window; DrawWindGtk *w = (DrawWindGtk *) wind->window;
if ( !((GrowCtx *)ctx)->bitmap_fonts) if ( !((GrowCtx *)ctx)->bitmap_fonts)
return text_erase_pango( wind, x, y, text, len, gc_type, idx, line, font_idx, size); return text_erase_pango( wind, x, y, text, len, gc_type, idx, line, font_idx, size, rot);
if ( font_idx > glow_eFont_Courier) if ( font_idx > glow_eFont_Courier)
font_idx = glow_eFont_Helvetica; font_idx = glow_eFont_Helvetica;
...@@ -1962,12 +1963,13 @@ void GlowDrawGtk::set_cursor( GlowWind *wind, glow_eDrawCursor cursor) ...@@ -1962,12 +1963,13 @@ void GlowDrawGtk::set_cursor( GlowWind *wind, glow_eDrawCursor cursor)
int GlowDrawGtk::get_text_extent( const char *text, int len, int GlowDrawGtk::get_text_extent( const char *text, int len,
glow_eDrawType gc_type, int idx, glow_eFont font_idx, glow_eDrawType gc_type, int idx, glow_eFont font_idx,
int *width, int *height, int *descent, double size) int *width, int *height, int *descent, double size,
int rot)
{ {
int text_width, text_ascent, text_descent, text_lbearing, text_rbearing; int text_width, text_ascent, text_descent, text_lbearing, text_rbearing;
if ( !((GrowCtx *)ctx)->bitmap_fonts) if ( !((GrowCtx *)ctx)->bitmap_fonts)
return get_text_extent_pango( text, len, gc_type, idx, font_idx, width, height, descent, size); return get_text_extent_pango( text, len, gc_type, idx, font_idx, width, height, descent, size, rot);
if ( font_idx > glow_eFont_Courier) if ( font_idx > glow_eFont_Courier)
font_idx = glow_eFont_Helvetica; font_idx = glow_eFont_Helvetica;
...@@ -3448,7 +3450,8 @@ static char *font_string( int font_idx, int font_type, double size) ...@@ -3448,7 +3450,8 @@ static char *font_string( int font_idx, int font_type, double size)
int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len, int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, glow_eDrawType gc_type, glow_eDrawType color, int idx,
int highlight, int line, glow_eFont font_idx, double size) int highlight, int line, glow_eFont font_idx, double size,
int rot)
{ {
if ( ctx->nodraw) return 1; if ( ctx->nodraw) return 1;
DrawWindGtk *w = (DrawWindGtk *) wind->window; DrawWindGtk *w = (DrawWindGtk *) wind->window;
...@@ -3469,7 +3472,6 @@ int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len, ...@@ -3469,7 +3472,6 @@ int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len,
gdk_gc_set_values( get_gc( this, gc_type, idx), &xgcv, gdk_gc_set_values( get_gc( this, gc_type, idx), &xgcv,
GDK_GC_FOREGROUND); GDK_GC_FOREGROUND);
} }
PangoRenderer *pr = gdk_pango_renderer_get_default( screen); PangoRenderer *pr = gdk_pango_renderer_get_default( screen);
gdk_pango_renderer_set_gc( GDK_PANGO_RENDERER(pr), get_gc( this, gc_type, idx)); gdk_pango_renderer_set_gc( GDK_PANGO_RENDERER(pr), get_gc( this, gc_type, idx));
...@@ -3496,6 +3498,17 @@ int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len, ...@@ -3496,6 +3498,17 @@ int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len,
else else
layout = gtk_widget_create_pango_layout( w->toplevel, text); layout = gtk_widget_create_pango_layout( w->toplevel, text);
if ( rot != 0) {
rot = 360 - rot;
PangoContext *pc = pango_layout_get_context( layout);
pango_context_set_base_gravity( pc, PANGO_GRAVITY_SOUTH);
PangoMatrix lpm = PANGO_MATRIX_INIT;
pango_matrix_rotate( &lpm, (double)rot);
pango_context_set_matrix( pc, &lpm);
pango_layout_context_changed( layout);
// pango_context_set_matrix( pc, 0);
}
PangoFontDescription *desc = pango_font_description_from_string( font_string( font_idx, font_type, size)); PangoFontDescription *desc = pango_font_description_from_string( font_string( font_idx, font_type, size));
pango_layout_set_font_description( layout, desc); pango_layout_set_font_description( layout, desc);
pango_font_description_free( desc); pango_font_description_free( desc);
...@@ -3503,8 +3516,30 @@ int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len, ...@@ -3503,8 +3516,30 @@ int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len,
int width, height; int width, height;
pango_layout_get_size( layout, &width, &height); pango_layout_get_size( layout, &width, &height);
height *= 0.9; height *= 0.9;
pango_renderer_draw_layout( pr, layout, PANGO_SCALE * x, PANGO_SCALE * y - (1.0-FONT_DESCENT)*height);
int px, py;
if ( rot == 180) {
px = -PANGO_SCALE * x - width;
py = -PANGO_SCALE * y - FONT_DESCENT*height;
}
else if ( rot == 90) {
px = -PANGO_SCALE * y - width + height/2;
py = PANGO_SCALE * x;
}
else if ( rot == 270) {
px = PANGO_SCALE * y - width;
py = -PANGO_SCALE * x - height;
}
else {
px = PANGO_SCALE * x;
py = PANGO_SCALE * y - (1.0-FONT_DESCENT)*height;
}
pango_renderer_draw_layout( pr, layout, px, py);
if ( rot != 0) {
PangoContext *pc = pango_layout_get_context( layout);
pango_context_set_matrix( pc, 0);
}
g_object_unref( layout); g_object_unref( layout);
} }
gdk_pango_renderer_set_drawable( GDK_PANGO_RENDERER(pr), 0); gdk_pango_renderer_set_drawable( GDK_PANGO_RENDERER(pr), 0);
...@@ -3528,10 +3563,11 @@ int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len, ...@@ -3528,10 +3563,11 @@ int GlowDrawGtk::text_pango( GlowWind *wind, int x, int y, char *text, int len,
int GlowDrawGtk::text_erase_pango( GlowWind *wind, int x, int y, char *text, int len, int GlowDrawGtk::text_erase_pango( GlowWind *wind, int x, int y, char *text, int len,
glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx, glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx,
double size) double size, int rot)
{ {
if ( ctx->nodraw) return 1; if ( ctx->nodraw) return 1;
DrawWindGtk *w = (DrawWindGtk *) wind->window; DrawWindGtk *w = (DrawWindGtk *) wind->window;
int px, py, pw, ph;
if ( font_idx >= glow_eFont__) if ( font_idx >= glow_eFont__)
font_idx = glow_eFont_Helvetica; font_idx = glow_eFont_Helvetica;
...@@ -3566,16 +3602,34 @@ int GlowDrawGtk::text_erase_pango( GlowWind *wind, int x, int y, char *text, int ...@@ -3566,16 +3602,34 @@ int GlowDrawGtk::text_erase_pango( GlowWind *wind, int x, int y, char *text, int
int width, height; int width, height;
pango_layout_get_size( layout, &width, &height); pango_layout_get_size( layout, &width, &height);
height *= 0.9; height *= 0.9;
if ( rot == 90) {
px = x;// - height/PANGO_SCALE/2;
py = y - width/PANGO_SCALE;
ph = width / PANGO_SCALE;
pw = height / PANGO_SCALE;
}
else if ( rot == 270) {
px = x;// - height/PANGO_SCALE/2;
py = y - height/PANGO_SCALE/2;
ph = width / PANGO_SCALE;
pw = height / PANGO_SCALE;
}
else {
px = x;
py = y - (1.0-FONT_DESCENT)*height/PANGO_SCALE;
pw = width / PANGO_SCALE;
ph = height / PANGO_SCALE;
}
if ( !w->draw_buffer_only) if ( !w->draw_buffer_only)
gdk_draw_rectangle( w->window, gdk_draw_rectangle( w->window,
get_gc( this, gc_type, idx), 1, get_gc( this, gc_type, idx), 1,
x, y - (1.0 - FONT_DESCENT) * height / PANGO_SCALE, px, py, pw, ph);
width / PANGO_SCALE, height / PANGO_SCALE);
if ( w->double_buffer_on) if ( w->double_buffer_on)
gdk_draw_rectangle( w->buffer, gdk_draw_rectangle( w->buffer,
get_gc( this, gc_type, idx), 1, get_gc( this, gc_type, idx), 1,
x, y - (1.0 - FONT_DESCENT) * height / PANGO_SCALE, px, py, pw, ph);
width / PANGO_SCALE, height / PANGO_SCALE);
g_object_unref( layout); g_object_unref( layout);
gdk_pango_renderer_set_drawable( GDK_PANGO_RENDERER(pr), 0); gdk_pango_renderer_set_drawable( GDK_PANGO_RENDERER(pr), 0);
...@@ -3589,7 +3643,8 @@ int GlowDrawGtk::text_erase_pango( GlowWind *wind, int x, int y, char *text, int ...@@ -3589,7 +3643,8 @@ int GlowDrawGtk::text_erase_pango( GlowWind *wind, int x, int y, char *text, int
int GlowDrawGtk::get_text_extent_pango( const char *text, int len, int GlowDrawGtk::get_text_extent_pango( const char *text, int len,
glow_eDrawType gc_type, int idx, glow_eFont font_idx, glow_eDrawType gc_type, int idx, glow_eFont font_idx,
int *width, int *height, int *descent, double size) int *width, int *height, int *descent, double size,
int rot)
{ {
DrawWindGtk *w = &m_wind; DrawWindGtk *w = &m_wind;
...@@ -3624,14 +3679,21 @@ int GlowDrawGtk::get_text_extent_pango( const char *text, int len, ...@@ -3624,14 +3679,21 @@ int GlowDrawGtk::get_text_extent_pango( const char *text, int len,
pango_layout_get_size( layout, &lwidth, &lheight); pango_layout_get_size( layout, &lwidth, &lheight);
lheight *= 0.9; lheight *= 0.9;
*width = lwidth / PANGO_SCALE; if ( rot == 90 || rot == 270) {
*height = lheight / PANGO_SCALE; *height = lwidth / PANGO_SCALE;
*width = lheight / PANGO_SCALE;
}
else {
*width = lwidth / PANGO_SCALE;
*height = lheight / PANGO_SCALE;
}
*descent = FONT_DESCENT * lheight / PANGO_SCALE; *descent = FONT_DESCENT * lheight / PANGO_SCALE;
g_object_unref( layout); g_object_unref( layout);
gdk_pango_renderer_set_drawable( GDK_PANGO_RENDERER(pr), 0); gdk_pango_renderer_set_drawable( GDK_PANGO_RENDERER(pr), 0);
gdk_pango_renderer_set_gc( GDK_PANGO_RENDERER(pr), 0); gdk_pango_renderer_set_gc( GDK_PANGO_RENDERER(pr), 0);
return 1; return 1;
} }
......
...@@ -140,13 +140,13 @@ class GlowDrawGtk : public GlowDraw { ...@@ -140,13 +140,13 @@ class GlowDrawGtk : public GlowDraw {
int idx); int idx);
virtual int text( GlowWind *w, int x, int y, char *text, int len, virtual int text( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, int highlight, glow_eDrawType gc_type, glow_eDrawType color, int idx, int highlight,
int line, glow_eFont font_idx, double size); int line, glow_eFont font_idx, double size, int rot);
virtual int text_cursor( GlowWind *w, int x, int y, char *text, int len, virtual int text_cursor( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, glow_eDrawType gc_type, glow_eDrawType color, int idx,
int highlight, int pos, glow_eFont font, double size); int highlight, int pos, glow_eFont font, double size);
virtual int text_erase( GlowWind *w, int x, int y, char *text, int len, virtual int text_erase( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx, glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx,
double size); double size, int rot);
virtual int fill_rect( GlowWind *w, int x, int y, int width, int height, virtual int fill_rect( GlowWind *w, int x, int y, int width, int height,
glow_eDrawType gc_type); glow_eDrawType gc_type);
virtual int pixmaps_create( GlowWind *w, glow_sPixmapData *pixmap_data, virtual int pixmaps_create( GlowWind *w, glow_sPixmapData *pixmap_data,
...@@ -164,7 +164,7 @@ class GlowDrawGtk : public GlowDraw { ...@@ -164,7 +164,7 @@ class GlowDrawGtk : public GlowDraw {
virtual void set_cursor( GlowWind *w, glow_eDrawCursor cursor); virtual void set_cursor( GlowWind *w, glow_eDrawCursor cursor);
virtual int get_text_extent( const char *text, int len, virtual int get_text_extent( const char *text, int len,
glow_eDrawType gc_type, int idx, glow_eFont font_idx, glow_eDrawType gc_type, int idx, glow_eFont font_idx,
int *width, int *height, int *descent, double size); int *width, int *height, int *descent, double size, int rot);
virtual void copy_area( GlowWind *w, int x, int y); virtual void copy_area( GlowWind *w, int x, int y);
virtual void clear_area( GlowWind *w, int ll_x, int ur_x, int ll_y, int ur_y); virtual void clear_area( GlowWind *w, int ll_x, int ur_x, int ll_y, int ur_y);
virtual void set_inputfocus( GlowWind *w); virtual void set_inputfocus( GlowWind *w);
...@@ -237,13 +237,13 @@ class GlowDrawGtk : public GlowDraw { ...@@ -237,13 +237,13 @@ class GlowDrawGtk : public GlowDraw {
glow_eGradient gradient); glow_eGradient gradient);
int text_pango( GlowWind *wind, int x, int y, char *text, int len, int text_pango( GlowWind *wind, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, glow_eDrawType gc_type, glow_eDrawType color, int idx,
int highlight, int line, glow_eFont font_idx, double size); int highlight, int line, glow_eFont font_idx, double size, int rot);
int text_erase_pango( GlowWind *wind, int x, int y, char *text, int len, int text_erase_pango( GlowWind *wind, int x, int y, char *text, int len,
glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx, glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx,
double size); double size, int rot);
int get_text_extent_pango( const char *text, int len, int get_text_extent_pango( const char *text, int len,
glow_eDrawType gc_type, int idx, glow_eFont font_idx, glow_eDrawType gc_type, int idx, glow_eFont font_idx,
int *width, int *height, int *descent, double size); int *width, int *height, int *descent, double size, int rot);
void log_event( GdkEvent *event); void log_event( GdkEvent *event);
virtual void event_exec( void *event, unsigned int size); virtual void event_exec( void *event, unsigned int size);
......
...@@ -1649,7 +1649,8 @@ int GlowDrawXLib::polyline_erase( GlowWind *wind, glow_sPointX *points, int poin ...@@ -1649,7 +1649,8 @@ int GlowDrawXLib::polyline_erase( GlowWind *wind, glow_sPointX *points, int poin
int GlowDrawXLib::text( GlowWind *wind, int x, int y, char *text, int len, int GlowDrawXLib::text( GlowWind *wind, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, glow_eDrawType gc_type, glow_eDrawType color, int idx,
int highlight, int line, glow_eFont font_idx, double size) int highlight, int line, glow_eFont font_idx, double size,
int rot)
{ {
if ( ctx->nodraw) return 1; if ( ctx->nodraw) return 1;
DrawWindXLib *w = (DrawWindXLib *) wind->window; DrawWindXLib *w = (DrawWindXLib *) wind->window;
...@@ -1732,7 +1733,7 @@ int GlowDrawXLib::text_cursor( GlowWind *wind, int x, int y, char *text, int len ...@@ -1732,7 +1733,7 @@ int GlowDrawXLib::text_cursor( GlowWind *wind, int x, int y, char *text, int len
int GlowDrawXLib::text_erase( GlowWind *wind, int x, int y, char *text, int len, int GlowDrawXLib::text_erase( GlowWind *wind, int x, int y, char *text, int len,
glow_eDrawType gc_type, int idx, int line, glow_eDrawType gc_type, int idx, int line,
glow_eFont font_idx, double size) glow_eFont font_idx, double size, int rot)
{ {
if ( ctx->nodraw) return 1; if ( ctx->nodraw) return 1;
DrawWindXLib *w = (DrawWindXLib *) wind->window; DrawWindXLib *w = (DrawWindXLib *) wind->window;
...@@ -2079,7 +2080,8 @@ void GlowDrawXLib::set_cursor( GlowWind *wind, glow_eDrawCursor cursor) ...@@ -2079,7 +2080,8 @@ void GlowDrawXLib::set_cursor( GlowWind *wind, glow_eDrawCursor cursor)
int GlowDrawXLib::get_text_extent( const char *text, int len, int GlowDrawXLib::get_text_extent( const char *text, int len,
glow_eDrawType gc_type, int idx, glow_eFont font_idx, glow_eDrawType gc_type, int idx, glow_eFont font_idx,
int *width, int *height, int *descent, double size) int *width, int *height, int *descent, double size,
int rot)
{ {
int text_direction, text_ascent, text_descent; int text_direction, text_ascent, text_descent;
XCharStruct char_struct; XCharStruct char_struct;
......
...@@ -169,13 +169,13 @@ class GlowDrawXLib : public GlowDraw { ...@@ -169,13 +169,13 @@ class GlowDrawXLib : public GlowDraw {
int idx); int idx);
virtual int text( GlowWind *w, int x, int y, char *text, int len, virtual int text( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, int highlight, glow_eDrawType gc_type, glow_eDrawType color, int idx, int highlight,
int line, glow_eFont font_idx, double size); int line, glow_eFont font_idx, double size, int rot);
virtual int text_cursor( GlowWind *w, int x, int y, char *text, int len, virtual int text_cursor( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, glow_eDrawType gc_type, glow_eDrawType color, int idx,
int highlight, int pos, glow_eFont font_idx, double size); int highlight, int pos, glow_eFont font_idx, double size);
virtual int text_erase( GlowWind *w, int x, int y, char *text, int len, virtual int text_erase( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx, glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx,
double size); double size, int rot);
virtual int fill_rect( GlowWind *w, int x, int y, int width, int height, virtual int fill_rect( GlowWind *w, int x, int y, int width, int height,
glow_eDrawType gc_type); glow_eDrawType gc_type);
virtual int pixmaps_create( GlowWind *w, glow_sPixmapData *pixmap_data, virtual int pixmaps_create( GlowWind *w, glow_sPixmapData *pixmap_data,
...@@ -193,7 +193,7 @@ class GlowDrawXLib : public GlowDraw { ...@@ -193,7 +193,7 @@ class GlowDrawXLib : public GlowDraw {
virtual void set_cursor( GlowWind *w, glow_eDrawCursor cursor); virtual void set_cursor( GlowWind *w, glow_eDrawCursor cursor);
virtual int get_text_extent( const char *text, int len, virtual int get_text_extent( const char *text, int len,
glow_eDrawType gc_type, int idx, glow_eFont font_idx, glow_eDrawType gc_type, int idx, glow_eFont font_idx,
int *width, int *height, int *descent, double size); int *width, int *height, int *descent, double size, int rot);
virtual void copy_area( GlowWind *w, int x, int y); virtual void copy_area( GlowWind *w, int x, int y);
virtual void clear_area( GlowWind *w, int ll_x, int ur_x, int ll_y, int ur_y); virtual void clear_area( GlowWind *w, int ll_x, int ur_x, int ll_y, int ur_y);
virtual void set_inputfocus( GlowWind *w); virtual void set_inputfocus( GlowWind *w);
......
...@@ -1465,6 +1465,7 @@ typedef enum { ...@@ -1465,6 +1465,7 @@ typedef enum {
glow_eSave_GrowText_original_color_drawtype = 3008, glow_eSave_GrowText_original_color_drawtype = 3008,
glow_eSave_GrowText_trf = 3009, glow_eSave_GrowText_trf = 3009,
glow_eSave_GrowText_font = 3010, glow_eSave_GrowText_font = 3010,
glow_eSave_GrowText_adjustment = 3011,
glow_eSave_GrowBar_max_value = 3100, glow_eSave_GrowBar_max_value = 3100,
glow_eSave_GrowBar_min_value = 3101, glow_eSave_GrowBar_min_value = 3101,
glow_eSave_GrowBar_bar_value = 3102, glow_eSave_GrowBar_bar_value = 3102,
......
...@@ -110,7 +110,7 @@ void glow_measure_annot_text( GrowCtx *ctx, char *text, glow_eDrawType draw_type ...@@ -110,7 +110,7 @@ void glow_measure_annot_text( GrowCtx *ctx, char *text, glow_eDrawType draw_type
case glow_eAnnotType_OneLine: case glow_eAnnotType_OneLine:
ctx->gdraw->get_text_extent( text, strlen(text), draw_type, text_size, ctx->gdraw->get_text_extent( text, strlen(text), draw_type, text_size,
font, &z_width, &z_height, &z_descent, font, &z_width, &z_height, &z_descent,
ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size)); ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size), 0);
*rows = 1; *rows = 1;
break; break;
case glow_eAnnotType_MultiLine: case glow_eAnnotType_MultiLine:
...@@ -129,7 +129,7 @@ void glow_measure_annot_text( GrowCtx *ctx, char *text, glow_eDrawType draw_type ...@@ -129,7 +129,7 @@ void glow_measure_annot_text( GrowCtx *ctx, char *text, glow_eDrawType draw_type
{ {
ctx->gdraw->get_text_extent( line, len, draw_type, text_size, font, ctx->gdraw->get_text_extent( line, len, draw_type, text_size, font,
&l_width, &l_height, &l_descent, &l_width, &l_height, &l_descent,
ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size)); ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size), 0);
z_width = max( z_width, l_width); z_width = max( z_width, l_width);
} }
len = 0; len = 0;
...@@ -143,7 +143,7 @@ void glow_measure_annot_text( GrowCtx *ctx, char *text, glow_eDrawType draw_type ...@@ -143,7 +143,7 @@ void glow_measure_annot_text( GrowCtx *ctx, char *text, glow_eDrawType draw_type
{ {
ctx->gdraw->get_text_extent( line, len, draw_type, text_size, ctx->gdraw->get_text_extent( line, len, draw_type, text_size,
font, &l_width, &l_height, &l_descent, font, &l_width, &l_height, &l_descent,
ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size)); ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size), 0);
z_width = max( z_width, l_width); z_width = max( z_width, l_width);
line_cnt++; line_cnt++;
} }
......
...@@ -93,13 +93,13 @@ class GlowDraw { ...@@ -93,13 +93,13 @@ class GlowDraw {
int idx) {return 1;} int idx) {return 1;}
virtual int text( GlowWind *w, int x, int y, char *text, int len, virtual int text( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, int highlight, glow_eDrawType gc_type, glow_eDrawType color, int idx, int highlight,
int line, glow_eFont font_idx, double size) {return 1;} int line, glow_eFont font_idx, double size, int rot) {return 1;}
virtual int text_cursor( GlowWind *w, int x, int y, char *text, int len, virtual int text_cursor( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, glow_eDrawType color, int idx, glow_eDrawType gc_type, glow_eDrawType color, int idx,
int highlight, int pos, glow_eFont font, double size) {return 1;} int highlight, int pos, glow_eFont font, double size) {return 1;}
virtual int text_erase( GlowWind *w, int x, int y, char *text, int len, virtual int text_erase( GlowWind *w, int x, int y, char *text, int len,
glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx, glow_eDrawType gc_type, int idx, int line, glow_eFont font_idx,
double size) {return 1;} double size, int rot) {return 1;}
virtual int fill_rect( GlowWind *w, int x, int y, int width, int height, virtual int fill_rect( GlowWind *w, int x, int y, int width, int height,
glow_eDrawType gc_type) {return 1;} glow_eDrawType gc_type) {return 1;}
virtual int pixmaps_create( GlowWind *w, glow_sPixmapData *pixmap_data, virtual int pixmaps_create( GlowWind *w, glow_sPixmapData *pixmap_data,
...@@ -118,7 +118,7 @@ class GlowDraw { ...@@ -118,7 +118,7 @@ class GlowDraw {
virtual void set_nav_cursor( glow_eDrawCursor cursor) {} virtual void set_nav_cursor( glow_eDrawCursor cursor) {}
virtual int get_text_extent( const char *text, int len, virtual int get_text_extent( const char *text, int len,
glow_eDrawType gc_type, int idx, glow_eFont font_idx, glow_eDrawType gc_type, int idx, glow_eFont font_idx,
int *width, int *height, int *descent, double size) {return 1;} int *width, int *height, int *descent, double size, int rot) {return 1;}
virtual void copy_area( GlowWind *w, int x, int y) {} virtual void copy_area( GlowWind *w, int x, int y) {}
virtual void clear_area( GlowWind *w, int ll_x, int ur_x, int ll_y, int ur_y) {} virtual void clear_area( GlowWind *w, int ll_x, int ur_x, int ll_y, int ur_y) {}
virtual void set_inputfocus( GlowWind *w) {} virtual void set_inputfocus( GlowWind *w) {}
......
...@@ -166,7 +166,7 @@ void GrowAnnot::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -166,7 +166,7 @@ void GrowAnnot::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
ctx->gdraw->get_text_extent( ((GlowNode *) node)->annotv[number], ctx->gdraw->get_text_extent( ((GlowNode *) node)->annotv[number],
strlen(((GlowNode *) node)->annotv[number]), strlen(((GlowNode *) node)->annotv[number]),
ldraw_type, idx, lfont, ldraw_type, idx, lfont,
&width, &height, &descent, tsize); &width, &height, &descent, tsize, 0);
switch ( adjustment) { switch ( adjustment) {
case glow_eAdjustment_Left: case glow_eAdjustment_Left:
...@@ -189,22 +189,42 @@ void GrowAnnot::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -189,22 +189,42 @@ void GrowAnnot::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
} }
else { else {
// Text is rotated, adjust the coordinates // Text is rotated, adjust the coordinates
if ( 45 <= rot && rot < 135) { if ( adjustment == glow_eAdjustment_Center) {
y1 += height - descent; // Only center adjustment supports text rotation
} if ( 45 <= rot && rot < 135) {
else if ( 135 <= rot && rot < 225) { x1 += width/2;
x1 -= width; y1 += width/2;
y1 += height - descent; }
else if ( 135 <= rot && rot < 225) {
y1 += height - descent;
}
else if ( 225 <= rot && rot < 315) {
x1 += width/2 - height + descent;
y1 -= width/2 - height + descent;
}
else {
x1 -= width;
}
} }
else { else {
x1 -= width; if ( 45 <= rot && rot < 135) {
y1 += height - descent;
}
else if ( 135 <= rot && rot < 225) {
x1 -= width;
y1 += height - descent;
}
else {
x1 -= width;
}
rot = 0;
} }
} }
ctx->gdraw->text( w, x1, y1, ctx->gdraw->text( w, x1, y1,
((GlowNode *) node)->annotv[number], ((GlowNode *) node)->annotv[number],
strlen(((GlowNode *) node)->annotv[number]), ldraw_type, color, idx, strlen(((GlowNode *) node)->annotv[number]), ldraw_type, color, idx,
highlight, 0, lfont, tsize); highlight, 0, lfont, tsize, rot);
if ( ((GlowNode *) node)->annotv_inputmode[number]) if ( ((GlowNode *) node)->annotv_inputmode[number])
ctx->gdraw->text_cursor( w, x1, y1, ctx->gdraw->text_cursor( w, x1, y1,
((GlowNode *) node)->annotv[number], ((GlowNode *) node)->annotv[number],
...@@ -223,13 +243,13 @@ void GrowAnnot::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -223,13 +243,13 @@ void GrowAnnot::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
highlight, (GrowNode *)colornode, 2); highlight, (GrowNode *)colornode, 2);
ctx->gdraw->get_text_extent( "", 0, ldraw_type, idx, lfont, &z_width, &z_height, ctx->gdraw->get_text_extent( "", 0, ldraw_type, idx, lfont, &z_width, &z_height,
&z_descent, tsize); &z_descent, tsize, 0);
for ( s = ((GlowNode *) node)->annotv[number]; *s; s++) { for ( s = ((GlowNode *) node)->annotv[number]; *s; s++) {
if ( *s == 10) { if ( *s == 10) {
if ( len) { if ( len) {
*s = 0; *s = 0;
ctx->gdraw->text( w, x1, y1 + line_cnt * z_height, line, ctx->gdraw->text( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, color, idx, highlight, 0, lfont, tsize); len, ldraw_type, color, idx, highlight, 0, lfont, tsize, 0);
*s = 10; *s = 10;
} }
len = 0; len = 0;
...@@ -241,7 +261,7 @@ void GrowAnnot::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -241,7 +261,7 @@ void GrowAnnot::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
} }
if ( len) if ( len)
ctx->gdraw->text( w, x1, y1 + line_cnt * z_height, line, ctx->gdraw->text( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, color, idx, highlight, 0, lfont, tsize); len, ldraw_type, color, idx, highlight, 0, lfont, tsize, 0);
break; break;
} }
} }
...@@ -306,7 +326,7 @@ void GrowAnnot::erase( GlowWind *w, GlowTransform *t, int hot, void *node) ...@@ -306,7 +326,7 @@ void GrowAnnot::erase( GlowWind *w, GlowTransform *t, int hot, void *node)
ctx->gdraw->get_text_extent( ((GlowNode *) node)->annotv[number], ctx->gdraw->get_text_extent( ((GlowNode *) node)->annotv[number],
strlen(((GlowNode *) node)->annotv[number]), strlen(((GlowNode *) node)->annotv[number]),
ldraw_type, idx, lfont, ldraw_type, idx, lfont,
&width, &height, &descent, tsize); &width, &height, &descent, tsize, 0);
switch ( adjustment) { switch ( adjustment) {
case glow_eAdjustment_Left: case glow_eAdjustment_Left:
...@@ -325,22 +345,42 @@ void GrowAnnot::erase( GlowWind *w, GlowTransform *t, int hot, void *node) ...@@ -325,22 +345,42 @@ void GrowAnnot::erase( GlowWind *w, GlowTransform *t, int hot, void *node)
if ( !(rot < 45 || rot >= 315)) { if ( !(rot < 45 || rot >= 315)) {
// Text is rotated, adjust the coordinates // Text is rotated, adjust the coordinates
if ( 45 <= rot && rot < 135) { if ( adjustment == glow_eAdjustment_Center) {
y1 += height - descent; // Only center adjustment supports text rotation
} if ( 45 <= rot && rot < 135) {
else if ( 135 <= rot && rot < 225) { x1 += width/2;
x1 -= width; y1 += width/2;
y1 += height - descent; }
else if ( 135 <= rot && rot < 225) {
y1 += height - descent;
}
else if ( 225 <= rot && rot < 315) {
x1 += width/2 - height + descent;
y1 -= width/2 - height + descent;
}
else {
x1 -= width;
}
} }
else { else {
x1 -= width; if ( 45 <= rot && rot < 135) {
y1 += height - descent;
}
else if ( 135 <= rot && rot < 225) {
x1 -= width;
y1 += height - descent;
}
else {
x1 -= width;
}
rot = 0;
} }
} }
ctx->gdraw->text_erase( w, x1, y1, ctx->gdraw->text_erase( w, x1, y1,
((GlowNode *) node)->annotv[number], ((GlowNode *) node)->annotv[number],
strlen(((GlowNode *) node)->annotv[number]), ldraw_type, idx, 0, lfont, strlen(((GlowNode *) node)->annotv[number]), ldraw_type, idx, 0, lfont,
tsize); tsize, rot);
break; break;
} }
case glow_eAnnotType_MultiLine: case glow_eAnnotType_MultiLine:
...@@ -351,13 +391,13 @@ void GrowAnnot::erase( GlowWind *w, GlowTransform *t, int hot, void *node) ...@@ -351,13 +391,13 @@ void GrowAnnot::erase( GlowWind *w, GlowTransform *t, int hot, void *node)
char *line = ((GlowNode *) node)->annotv[number]; char *line = ((GlowNode *) node)->annotv[number];
char *s; char *s;
ctx->gdraw->get_text_extent( "", 0, ldraw_type, idx, lfont, &z_width, &z_height, ctx->gdraw->get_text_extent( "", 0, ldraw_type, idx, lfont, &z_width, &z_height,
&z_descent, tsize); &z_descent, tsize, 0);
for ( s = ((GlowNode *) node)->annotv[number]; *s; s++) { for ( s = ((GlowNode *) node)->annotv[number]; *s; s++) {
if ( *s == 10) { if ( *s == 10) {
if ( len) { if ( len) {
*s = 0; *s = 0;
ctx->gdraw->text_erase( w, x1, y1 + line_cnt * z_height, line, ctx->gdraw->text_erase( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, idx, 0, lfont, tsize); len, ldraw_type, idx, 0, lfont, tsize, 0);
*s = 10; *s = 10;
} }
len = 0; len = 0;
...@@ -369,7 +409,7 @@ void GrowAnnot::erase( GlowWind *w, GlowTransform *t, int hot, void *node) ...@@ -369,7 +409,7 @@ void GrowAnnot::erase( GlowWind *w, GlowTransform *t, int hot, void *node)
} }
if ( len) if ( len)
ctx->gdraw->text_erase( w, x1, y1 + line_cnt * z_height, line, ctx->gdraw->text_erase( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, idx, 0, lfont, tsize); len, ldraw_type, idx, 0, lfont, tsize, 0);
break; break;
} }
} }
...@@ -427,7 +467,7 @@ void GrowAnnot::erase_background( GlowWind *w, GlowTransform *t, int hot, void * ...@@ -427,7 +467,7 @@ void GrowAnnot::erase_background( GlowWind *w, GlowTransform *t, int hot, void *
ctx->gdraw->text_erase( w, x1, y1, ctx->gdraw->text_erase( w, x1, y1,
((GlowNode *) node)->annotv[number], ((GlowNode *) node)->annotv[number],
strlen(((GlowNode *) node)->annotv[number]), ldraw_type, idx, 0, strlen(((GlowNode *) node)->annotv[number]), ldraw_type, idx, 0,
lfont, tsize); lfont, tsize, 0);
break; break;
} }
case glow_eAnnotType_MultiLine: { case glow_eAnnotType_MultiLine: {
...@@ -437,13 +477,13 @@ void GrowAnnot::erase_background( GlowWind *w, GlowTransform *t, int hot, void * ...@@ -437,13 +477,13 @@ void GrowAnnot::erase_background( GlowWind *w, GlowTransform *t, int hot, void *
char *line = ((GlowNode *) node)->annotv[number]; char *line = ((GlowNode *) node)->annotv[number];
char *s; char *s;
ctx->gdraw->get_text_extent( "", 0, ldraw_type, idx, lfont, &z_width, &z_height, ctx->gdraw->get_text_extent( "", 0, ldraw_type, idx, lfont, &z_width, &z_height,
&z_descent, tsize); &z_descent, tsize, 0);
for ( s = ((GlowNode *) node)->annotv[number]; *s; s++) { for ( s = ((GlowNode *) node)->annotv[number]; *s; s++) {
if ( *s == 10) { if ( *s == 10) {
if ( len) { if ( len) {
*s = 0; *s = 0;
ctx->gdraw->text_erase( w, x1, y1 + line_cnt * z_height, line, ctx->gdraw->text_erase( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, idx, 0, lfont, tsize); len, ldraw_type, idx, 0, lfont, tsize, 0);
*s = 10; *s = 10;
} }
len = 0; len = 0;
...@@ -455,7 +495,7 @@ void GrowAnnot::erase_background( GlowWind *w, GlowTransform *t, int hot, void * ...@@ -455,7 +495,7 @@ void GrowAnnot::erase_background( GlowWind *w, GlowTransform *t, int hot, void *
} }
if ( len) if ( len)
ctx->gdraw->text_erase( w, x1, y1 + line_cnt * z_height, line, ctx->gdraw->text_erase( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, idx, 0, lfont, tsize); len, ldraw_type, idx, 0, lfont, tsize, 0);
break; break;
} }
} }
......
...@@ -1614,6 +1614,11 @@ int grow_GetObjectAttrInfo( grow_tObject object, char *transtab, ...@@ -1614,6 +1614,11 @@ int grow_GetObjectAttrInfo( grow_tObject object, char *transtab,
attrinfo[i].type = glow_eType_String; attrinfo[i].type = glow_eType_String;
attrinfo[i++].size = sizeof( op->text); attrinfo[i++].size = sizeof( op->text);
strcpy( attrinfo[i].name, "Adjustment");
attrinfo[i].value_p = &op->adjustment;
attrinfo[i].type = glow_eType_Adjustment;
attrinfo[i++].size = sizeof( op->adjustment);
strcpy( attrinfo[i].name, "Dynamic"); strcpy( attrinfo[i].name, "Dynamic");
op->get_dynamic( &dynamic, &dynsize); op->get_dynamic( &dynamic, &dynsize);
attrinfo[i].value_p = malloc( 1024); attrinfo[i].value_p = malloc( 1024);
......
...@@ -297,7 +297,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -297,7 +297,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
format_text( text, format, max_value - i * increment); format_text( text, format, max_value - i * increment);
ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype, ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype,
max( 0, text_idx), glow_eFont_Helvetica, max( 0, text_idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
if ( max_z_width < z_width) if ( max_z_width < z_width)
max_z_width = z_width; max_z_width = z_width;
} }
...@@ -333,7 +333,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -333,7 +333,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
y_text = y + (z_height-z_descent)/2; y_text = y + (z_height-z_descent)/2;
ctx->gdraw->text( w, ll_x, y_text, ctx->gdraw->text( w, ll_x, y_text,
text, strlen(text), text_drawtype, text_color_drawtype, text, strlen(text), text_drawtype, text_color_drawtype,
text_idx, highlight, 0, glow_eFont_Helvetica, tsize); text_idx, highlight, 0, glow_eFont_Helvetica, tsize, 0);
} }
} }
} }
...@@ -347,7 +347,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -347,7 +347,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
if ( draw_text) { if ( draw_text) {
ctx->gdraw->get_text_extent( "0", 1, text_drawtype, ctx->gdraw->get_text_extent( "0", 1, text_drawtype,
max( 0, text_idx), glow_eFont_Helvetica, max( 0, text_idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
line_length = ur_y - ll_y - z_height; line_length = ur_y - ll_y - z_height;
if ( line_length < 3) if ( line_length < 3)
...@@ -370,7 +370,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -370,7 +370,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
format_text( text, format, max_value - i * increment); format_text( text, format, max_value - i * increment);
ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype, ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype,
max( 0, text_idx), glow_eFont_Helvetica, max( 0, text_idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
if ( text_idx >= 0 && z_height < ur_y - ll_y ) { if ( text_idx >= 0 && z_height < ur_y - ll_y ) {
if ( i == lines - 1) if ( i == lines - 1)
...@@ -381,7 +381,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -381,7 +381,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
x_text = x - (z_width)/2; x_text = x - (z_width)/2;
ctx->gdraw->text( w, x_text, ll_y + z_height - z_descent, ctx->gdraw->text( w, x_text, ll_y + z_height - z_descent,
text, strlen(text), text_drawtype, text_color_drawtype, text, strlen(text), text_drawtype, text_color_drawtype,
text_idx, highlight, 0, glow_eFont_Helvetica, tsize); text_idx, highlight, 0, glow_eFont_Helvetica, tsize, 0);
} }
} }
} }
...@@ -398,7 +398,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -398,7 +398,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
format_text( text, format, max_value - i * increment); format_text( text, format, max_value - i * increment);
ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype, ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype,
max( 0, text_idx), glow_eFont_Helvetica, max( 0, text_idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
if ( max_z_width < z_width) if ( max_z_width < z_width)
max_z_width = z_width; max_z_width = z_width;
} }
...@@ -434,7 +434,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -434,7 +434,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
y_text = y + (z_height-z_descent)/2; y_text = y + (z_height-z_descent)/2;
ctx->gdraw->text( w, x_text, y_text, ctx->gdraw->text( w, x_text, y_text,
text, strlen(text), text_drawtype, text_color_drawtype, text, strlen(text), text_drawtype, text_color_drawtype,
text_idx, highlight, 0, glow_eFont_Helvetica, tsize); text_idx, highlight, 0, glow_eFont_Helvetica, tsize, 0);
} }
} }
} }
...@@ -447,7 +447,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -447,7 +447,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
if ( draw_text) { if ( draw_text) {
ctx->gdraw->get_text_extent( "0", 1, text_drawtype, ctx->gdraw->get_text_extent( "0", 1, text_drawtype,
max( 0, text_idx), glow_eFont_Helvetica, max( 0, text_idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
line_length = ur_y - ll_y - (z_height - z_descent); line_length = ur_y - ll_y - (z_height - z_descent);
if ( line_length < 3) if ( line_length < 3)
...@@ -469,7 +469,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -469,7 +469,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
format_text( text, format, max_value - i * increment); format_text( text, format, max_value - i * increment);
ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype, ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype,
max( 0, text_idx), glow_eFont_Helvetica, max( 0, text_idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
if ( text_idx >= 0 && z_height - z_descent < ur_y - ll_y) { if ( text_idx >= 0 && z_height - z_descent < ur_y - ll_y) {
if ( i == lines - 1) if ( i == lines - 1)
...@@ -480,7 +480,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -480,7 +480,7 @@ void GrowAxis::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
x_text = x - (z_width)/2; x_text = x - (z_width)/2;
ctx->gdraw->text( w, x_text, ur_y, ctx->gdraw->text( w, x_text, ur_y,
text, strlen(text), text_drawtype, text_color_drawtype, text, strlen(text), text_drawtype, text_color_drawtype,
text_idx, highlight, 0, glow_eFont_Helvetica, tsize); text_idx, highlight, 0, glow_eFont_Helvetica, tsize, 0);
} }
} }
} }
...@@ -666,7 +666,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node, ...@@ -666,7 +666,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node,
format_text( text, format, max_value - i * increment); format_text( text, format, max_value - i * increment);
ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype, ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype,
max( 0, idx), glow_eFont_Helvetica, max( 0, idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
if ( max_z_width < z_width) if ( max_z_width < z_width)
max_z_width = z_width; max_z_width = z_width;
} }
...@@ -681,7 +681,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node, ...@@ -681,7 +681,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node,
if ( draw_text) { if ( draw_text) {
ctx->gdraw->get_text_extent( "0", 1, text_drawtype, ctx->gdraw->get_text_extent( "0", 1, text_drawtype,
max( 0, idx), glow_eFont_Helvetica, max( 0, idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
line_length = int(ur_y - ll_y) - (z_height - z_descent); line_length = int(ur_y - ll_y) - (z_height - z_descent);
} }
...@@ -696,7 +696,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node, ...@@ -696,7 +696,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node,
format_text( text, format, max_value - i * increment); format_text( text, format, max_value - i * increment);
ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype, ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype,
max( 0, idx), glow_eFont_Helvetica, max( 0, idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
if ( max_z_width < z_width) if ( max_z_width < z_width)
max_z_width = z_width; max_z_width = z_width;
} }
...@@ -711,7 +711,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node, ...@@ -711,7 +711,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node,
if ( draw_text) { if ( draw_text) {
ctx->gdraw->get_text_extent( "0", 1, text_drawtype, ctx->gdraw->get_text_extent( "0", 1, text_drawtype,
max( 0, idx), glow_eFont_Helvetica, max( 0, idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
line_length = int(ur_y - ll_y) - (z_height - z_descent); line_length = int(ur_y - ll_y) - (z_height - z_descent);
} }
......
...@@ -287,7 +287,7 @@ void GrowAxisArc::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, v ...@@ -287,7 +287,7 @@ void GrowAxisArc::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, v
format_text( text, format, min_value + increment); format_text( text, format, min_value + increment);
ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype, ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype,
max( 0, text_idx), glow_eFont_Helvetica, max( 0, text_idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
// z_descent=0; // z_descent=0;
double line_angle = (double)angle2 / (lines - 1); double line_angle = (double)angle2 / (lines - 1);
...@@ -318,7 +318,7 @@ void GrowAxisArc::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, v ...@@ -318,7 +318,7 @@ void GrowAxisArc::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, v
format_text( text, format, min_value + i * increment); format_text( text, format, min_value + i * increment);
ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype, ctx->gdraw->get_text_extent( text, strlen(text), text_drawtype,
max( 0, text_idx), glow_eFont_Helvetica, max( 0, text_idx), glow_eFont_Helvetica,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
if ( i == lines - 1 && angle1 == 0 && angle2 == 180) { if ( i == lines - 1 && angle1 == 0 && angle2 == 180) {
//yt = yt - (z_height-z_descent)/2; //yt = yt - (z_height-z_descent)/2;
...@@ -334,7 +334,7 @@ void GrowAxisArc::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, v ...@@ -334,7 +334,7 @@ void GrowAxisArc::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, v
} }
ctx->gdraw->text( w, xt, yt, ctx->gdraw->text( w, xt, yt,
text, strlen(text), text_drawtype, text_color_drawtype, text, strlen(text), text_drawtype, text_color_drawtype,
text_idx, highlight, 0, glow_eFont_Helvetica, tsize); text_idx, highlight, 0, glow_eFont_Helvetica, tsize, 0);
} }
} }
} }
......
...@@ -3825,7 +3825,7 @@ void GrowCtx::get_text_extent( char *text, int len, glow_eDrawType draw_type, ...@@ -3825,7 +3825,7 @@ void GrowCtx::get_text_extent( char *text, int len, glow_eDrawType draw_type,
double tsize = mw.zoom_factor_y / mw.base_zoom_factor * (8+2*text_size); double tsize = mw.zoom_factor_y / mw.base_zoom_factor * (8+2*text_size);
gdraw->get_text_extent( text, len, draw_type, text_size, font, gdraw->get_text_extent( text, len, draw_type, text_size, font,
&z_width, &z_height, &z_descent, tsize); &z_width, &z_height, &z_descent, tsize, 0);
*width = double( z_width) / mw.zoom_factor_y; *width = double( z_width) / mw.zoom_factor_y;
*height = double( z_height) / mw.zoom_factor_y; *height = double( z_height) / mw.zoom_factor_y;
......
...@@ -445,7 +445,7 @@ void GrowFolder::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, vo ...@@ -445,7 +445,7 @@ void GrowFolder::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, vo
if ( text_idx >= 0) { if ( text_idx >= 0) {
ctx->gdraw->text( w, x + h/2, ll_y + h - 2, ctx->gdraw->text( w, x + h/2, ll_y + h - 2,
folder_text[i], strlen(folder_text[i]), text_drawtype, text_color_drawtype, folder_text[i], strlen(folder_text[i]), text_drawtype, text_color_drawtype,
text_idx, highlight, 0, glow_eFont_Helvetica, tsize); text_idx, highlight, 0, glow_eFont_Helvetica, tsize, 0);
} }
if ( i == current_folder) if ( i == current_folder)
break; break;
......
...@@ -182,7 +182,7 @@ void GrowMenu::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -182,7 +182,7 @@ void GrowMenu::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
if ( info.item[i].occupied) { if ( info.item[i].occupied) {
ctx->gdraw->get_text_extent( info.item[i].text, strlen(info.item[i].text), text_drawtype, ctx->gdraw->get_text_extent( info.item[i].text, strlen(info.item[i].text), text_drawtype,
max( 0, text_idx), font, &z_width, &z_height, max( 0, text_idx), font, &z_width, &z_height,
&z_descent, tsize); &z_descent, tsize, 0);
if ( z_width > max_z_width) if ( z_width > max_z_width)
max_z_width = z_width; max_z_width = z_width;
tot_z_height += int( 1.6 * z_height); tot_z_height += int( 1.6 * z_height);
...@@ -237,10 +237,10 @@ void GrowMenu::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void ...@@ -237,10 +237,10 @@ void GrowMenu::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void
} }
if ( info.item[i].type == glow_eMenuItem_ButtonDisabled) if ( info.item[i].type == glow_eMenuItem_ButtonDisabled)
ctx->gdraw->text( w, x_text, y_text, info.item[i].text, strlen(info.item[i].text), text_drawtype, ctx->gdraw->text( w, x_text, y_text, info.item[i].text, strlen(info.item[i].text), text_drawtype,
text_color_disabled, text_idx, highlight, 0, font, tsize); text_color_disabled, text_idx, highlight, 0, font, tsize, 0);
else else
ctx->gdraw->text( w, x_text, y_text, info.item[i].text, strlen(info.item[i].text), text_drawtype, ctx->gdraw->text( w, x_text, y_text, info.item[i].text, strlen(info.item[i].text), text_drawtype,
text_color, text_idx, highlight, 0, font, tsize); text_color, text_idx, highlight, 0, font, tsize, 0);
if ( info.item[i].type == glow_eMenuItem_PulldownMenu) { if ( info.item[i].type == glow_eMenuItem_PulldownMenu) {
// Draw arrow // Draw arrow
glow_sPointX p[4]; glow_sPointX p[4];
......
...@@ -451,7 +451,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -451,7 +451,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
if ( header_text_idx >= 0 && strcmp( header_text[i], "") != 0) { if ( header_text_idx >= 0 && strcmp( header_text[i], "") != 0) {
ctx->gdraw->text( w, int(x + text_offs), int(y + header_h - 4), ctx->gdraw->text( w, int(x + text_offs), int(y + header_h - 4),
header_text[i], strlen(header_text[i]), header_text_drawtype, header_text_color, header_text[i], strlen(header_text[i]), header_text_drawtype, header_text_color,
header_text_idx, highlight, 0, font, header_tsize); header_text_idx, highlight, 0, font, header_tsize, 0);
} }
x += column_width[i] * w->zoom_factor_x; x += column_width[i] * w->zoom_factor_x;
if ( x > ur_x) if ( x > ur_x)
...@@ -477,7 +477,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -477,7 +477,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
if ( header_text_idx >= 0 && strcmp( header_text[0], "") != 0) if ( header_text_idx >= 0 && strcmp( header_text[0], "") != 0)
ctx->gdraw->text( w, int(x + text_offs), int(y + header_h - 4), ctx->gdraw->text( w, int(x + text_offs), int(y + header_h - 4),
header_text[0], strlen(header_text[0]), header_text_drawtype, header_text_color, header_text[0], strlen(header_text[0]), header_text_drawtype, header_text_color,
header_text_idx, highlight, 0, font, tsize); header_text_idx, highlight, 0, font, tsize, 0);
} }
} }
...@@ -531,7 +531,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -531,7 +531,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
int width, height, descent; int width, height, descent;
ctx->gdraw->get_text_extent( cell_value + offs, strlen(cell_value + offs), ctx->gdraw->get_text_extent( cell_value + offs, strlen(cell_value + offs),
text_drawtype, text_idx, font, text_drawtype, text_idx, font,
&width, &height, &descent, tsize); &width, &height, &descent, tsize, 0);
switch ( column_adjustment[0]) { switch ( column_adjustment[0]) {
case glow_eAdjustment_Left: case glow_eAdjustment_Left:
...@@ -546,7 +546,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -546,7 +546,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
} }
ctx->gdraw->text( w, text_x, int(y - 2), ctx->gdraw->text( w, text_x, int(y - 2),
cell_value + offs, strlen(cell_value + offs), text_drawtype, text_color_drawtype, cell_value + offs, strlen(cell_value + offs), text_drawtype, text_color_drawtype,
text_idx, highlight, 0, font, tsize); text_idx, highlight, 0, font, tsize, 0);
} }
} }
} }
...@@ -657,7 +657,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -657,7 +657,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
int width, height, descent; int width, height, descent;
ctx->gdraw->get_text_extent( cell_value + offs, strlen(cell_value + offs), ctx->gdraw->get_text_extent( cell_value + offs, strlen(cell_value + offs),
text_drawtype, text_idx, font, text_drawtype, text_idx, font,
&width, &height, &descent, tsize); &width, &height, &descent, tsize, 0);
switch ( column_adjustment[i]) { switch ( column_adjustment[i]) {
case glow_eAdjustment_Left: case glow_eAdjustment_Left:
...@@ -673,7 +673,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi ...@@ -673,7 +673,7 @@ void GrowTable::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
ctx->gdraw->text( w, text_x, int(y - 2), ctx->gdraw->text( w, text_x, int(y - 2),
cell_value + offs, strlen(cell_value + offs), text_drawtype, text_color_drawtype, cell_value + offs, strlen(cell_value + offs), text_drawtype, text_color_drawtype,
text_idx, highlight, 0, font, tsize); text_idx, highlight, 0, font, tsize, 0);
} }
} }
} }
......
This diff is collapsed.
...@@ -318,6 +318,7 @@ class GrowText : public GlowText { ...@@ -318,6 +318,7 @@ class GrowText : public GlowText {
char last_group[32]; //!< The last group the object was a member of. char last_group[32]; //!< The last group the object was a member of.
glow_eDrawType original_color_drawtype; //!< The original color, i.e. color drawn at edit time. glow_eDrawType original_color_drawtype; //!< The original color, i.e. color drawn at edit time.
glow_eFont font; //!< Text font glow_eFont font; //!< Text font
glow_eAdjustment adjustment; //!< Text adjustment.
//! Set user data. //! Set user data.
/*! /*!
......
...@@ -120,7 +120,7 @@ void GlowText::draw( GlowWind *w, void *pos, int highlight, int hot, void *node) ...@@ -120,7 +120,7 @@ void GlowText::draw( GlowWind *w, void *pos, int highlight, int hot, void *node)
ctx->gdraw->text( w, p.z_x + ((GlowPoint *)pos)->z_x - w->offset_x, ctx->gdraw->text( w, p.z_x + ((GlowPoint *)pos)->z_x - w->offset_x,
p.z_y + ((GlowPoint *)pos)->z_y - w->offset_y, text, strlen(text), p.z_y + ((GlowPoint *)pos)->z_y - w->offset_y, text, strlen(text),
draw_type, color_drawtype, idx, highlight, 0, glow_eFont_Helvetica, draw_type, color_drawtype, idx, highlight, 0, glow_eFont_Helvetica,
w->zoom_factor_y / w->base_zoom_factor * (8+2*text_size)); w->zoom_factor_y / w->base_zoom_factor * (8+2*text_size), 0);
} }
void GlowText::erase( GlowWind *w, void *pos, int hot, void *node) void GlowText::erase( GlowWind *w, void *pos, int hot, void *node)
...@@ -132,7 +132,7 @@ void GlowText::erase( GlowWind *w, void *pos, int hot, void *node) ...@@ -132,7 +132,7 @@ void GlowText::erase( GlowWind *w, void *pos, int hot, void *node)
ctx->gdraw->text_erase( w, p.z_x + ((GlowPoint *)pos)->z_x - w->offset_x, ctx->gdraw->text_erase( w, p.z_x + ((GlowPoint *)pos)->z_x - w->offset_x,
p.z_y + ((GlowPoint *)pos)->z_y - w->offset_y, text, strlen(text), p.z_y + ((GlowPoint *)pos)->z_y - w->offset_y, text, strlen(text),
draw_type, idx, 0, glow_eFont_Helvetica, draw_type, idx, 0, glow_eFont_Helvetica,
w->zoom_factor_y / w->base_zoom_factor * (8+2*text_size)); w->zoom_factor_y / w->base_zoom_factor * (8+2*text_size), 0);
} }
int GlowText::event_handler( GlowWind *w, void *pos, glow_eEvent event, int x, int y, int GlowText::event_handler( GlowWind *w, void *pos, glow_eEvent event, int x, int y,
......
...@@ -72,7 +72,7 @@ void GlowTipText::draw_text( GlowArrayElem *e, char *text, int x, int y) ...@@ -72,7 +72,7 @@ void GlowTipText::draw_text( GlowArrayElem *e, char *text, int x, int y)
ctx->gdraw->get_text_extent( text, strlen(text), glow_eDrawType_TextHelvetica, text_size, ctx->gdraw->get_text_extent( text, strlen(text), glow_eDrawType_TextHelvetica, text_size,
glow_eFont_Helvetica, &z_width, &z_height, &z_descent, glow_eFont_Helvetica, &z_width, &z_height, &z_descent,
ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size)); ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size), 0);
text_x = x; text_x = x;
text_y = y; text_y = y;
...@@ -106,7 +106,7 @@ void GlowTipText::draw() ...@@ -106,7 +106,7 @@ void GlowTipText::draw()
ctx->gdraw->text( &ctx->mw, text_x + 2, text_y + text_height - text_descent - 2, tiptext, ctx->gdraw->text( &ctx->mw, text_x + 2, text_y + text_height - text_descent - 2, tiptext,
strlen(tiptext), glow_eDrawType_TextHelvetica, glow_eDrawType_Line, text_size, strlen(tiptext), glow_eDrawType_TextHelvetica, glow_eDrawType_Line, text_size,
0, 0, glow_eFont_Helvetica, 0, 0, glow_eFont_Helvetica,
ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size)); ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8+2*text_size), 0);
if ( ctx->mw.double_buffer_on() && !ctx->mw.draw_buffer_only()) if ( ctx->mw.double_buffer_on() && !ctx->mw.draw_buffer_only())
ctx->gdraw->copy_buffer( &ctx->mw, text_x, text_y, text_x + text_width, text_y + text_height); ctx->gdraw->copy_buffer( &ctx->mw, text_x, text_y, text_x + text_width, text_y + text_height);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment