1
0
Fork 0
forked from Miroirs/x49gp

Compare commits

..

2 commits

Author SHA1 Message Date
Gwenhael Le Moine
9cb44cceb8
fonts are implicitly tiny_font or opt.font accordingly 2024-11-02 22:56:16 +01:00
Gwenhael Le Moine
f4626d7400
consistently name bitmap_font tiny_font (it IS tiny) 2024-11-02 22:45:23 +01:00
3 changed files with 86 additions and 106 deletions

View file

@ -3,7 +3,7 @@
#include <stdlib.h>
#include "bitmap_font.h"
#include "tiny_font.h"
#include "bitmaps/tiny_notdef.xbm"
@ -94,7 +94,7 @@
#include "bitmaps/tiny__i.xbm"
const bitmap_font_t tiny_font = {
const tiny_font_t tiny_font = {
7,
-3,
{ GLYPH( tiny, notdef ),

View file

@ -1,8 +1,8 @@
/* $Id: bitmap_font.h,v 1.5 2008/12/11 12:18:17 ecd Exp $
*/
#ifndef _X49GP_BITMAP_FONT_H
#define _X49GP_BITMAP_FONT_H 1
#ifndef _X49GP_TINY_FONT_H
#define _X49GP_TINY_FONT_H 1
typedef struct {
const char* name;
@ -11,13 +11,13 @@ typedef struct {
int ascent;
int descent;
const unsigned char* bits;
} bitmap_glyph_t;
} tiny_glyph_t;
typedef struct {
int ascent;
int descent;
bitmap_glyph_t glyphs[];
} bitmap_font_t;
tiny_glyph_t glyphs[];
} tiny_font_t;
#define GLYPH( font, name ) \
{ #name, \
@ -29,6 +29,6 @@ typedef struct {
#define SPACE( name, width, kern ) { name, width, kern, 0, 0, NULL }
extern const bitmap_font_t tiny_font;
extern const tiny_font_t tiny_font;
#endif /* !(_X49GP_BITMAP_FONT_H) */
#endif /* !(_X49GP_TINY_FONT_H) */

View file

@ -23,7 +23,7 @@
#include "x49gp_ui.h"
#include "s3c2410.h"
#include "bitmaps.h"
#include "bitmap_font.h"
#include "tiny_font.h"
#include "symbol.h"
#include "glyphname.h"
@ -1259,7 +1259,7 @@ static int _regular_font_text_to_ucs4( const char* text, gunichar** ucs4p )
return n;
}
static void _regular_font_vtext_path( cairo_t* cr, const char* family, double size, double x, double y, va_list ap )
static void _regular_font_vtext_path( cairo_t* cr, double size, double x, double y, va_list ap )
{
cairo_text_extents_t extents;
cairo_font_weight_t weight;
@ -1275,7 +1275,7 @@ static void _regular_font_vtext_path( cairo_t* cr, const char* family, double si
weight = va_arg( ap, cairo_font_weight_t );
text = va_arg( ap, const char* );
cairo_select_font_face( cr, family, slant, weight );
cairo_select_font_face( cr, opt.font, slant, weight );
cairo_set_font_size( cr, size );
ucs4 = NULL;
@ -1323,7 +1323,7 @@ static void _regular_font_vtext_path( cairo_t* cr, const char* family, double si
free( ucs4 );
}
static void regular_font_measure_text( cairo_t* cr, const char* family, double size, double* x_bearing, double* y_bearing, double* width,
static void regular_font_measure_text( cairo_t* cr, double size, double* x_bearing, double* y_bearing, double* width,
double* height, double* ascent, double* descent, ... )
{
va_list ap0, ap1;
@ -1336,7 +1336,7 @@ static void regular_font_measure_text( cairo_t* cr, const char* family, double s
va_start( ap0, descent );
va_copy( ap1, ap0 );
_regular_font_vtext_path( cr, family, size, 0.0, 0.0, ap0 );
_regular_font_vtext_path( cr, size, 0.0, 0.0, ap0 );
va_end( ap0 );
@ -1353,7 +1353,7 @@ static void regular_font_measure_text( cairo_t* cr, const char* family, double s
text = va_arg( ap1, const char* );
( void )text;
cairo_select_font_face( cr, family, slant, weight );
cairo_select_font_face( cr, opt.font, slant, weight );
cairo_set_font_size( cr, size );
cairo_font_extents( cr, &font_extents );
@ -1377,7 +1377,7 @@ static void regular_font_measure_text( cairo_t* cr, const char* family, double s
va_end( ap1 );
}
static void regular_font_draw_text( cairo_t* cr, GdkColor* color, const char* family, double size, double line_width, int xoffset,
static void regular_font_draw_text( cairo_t* cr, GdkColor* color, double size, double line_width, int xoffset,
int yoffset, ... )
{
va_list ap;
@ -1388,7 +1388,7 @@ static void regular_font_draw_text( cairo_t* cr, GdkColor* color, const char* fa
cairo_set_source_rgb( cr, ( ( double )color->red ) / 65535.0, ( ( double )color->green ) / 65535.0,
( ( double )color->blue ) / 65535.0 );
_regular_font_vtext_path( cr, family, size, xoffset, yoffset, ap );
_regular_font_vtext_path( cr, size, xoffset, yoffset, ap );
if ( line_width == 0.0 )
cairo_fill( cr );
@ -1398,16 +1398,16 @@ static void regular_font_draw_text( cairo_t* cr, GdkColor* color, const char* fa
va_end( ap );
}
static unsigned char _bitmap_font_lookup_glyph( const bitmap_font_t* font, const char* name, int namelen )
static unsigned char _tiny_font_lookup_glyph( const char* name, int namelen )
{
for ( int i = 0; font->glyphs[ i ].name; i++ )
if ( ( strlen( font->glyphs[ i ].name ) == namelen ) && !strncmp( font->glyphs[ i ].name, name, namelen ) )
for ( int i = 0; tiny_font.glyphs[ i ].name; i++ )
if ( ( strlen( tiny_font.glyphs[ i ].name ) == namelen ) && !strncmp( tiny_font.glyphs[ i ].name, name, namelen ) )
return i;
return 0;
}
static unsigned char _bitmap_font_lookup_ascii( const bitmap_font_t* font, char c )
static unsigned char _tiny_font_lookup_ascii( char c )
{
int namelen = 0;
char* name;
@ -1548,10 +1548,10 @@ static unsigned char _bitmap_font_lookup_ascii( const bitmap_font_t* font, char
if ( 0 == namelen )
namelen = strlen( name );
return _bitmap_font_lookup_glyph( font, name, namelen );
return _tiny_font_lookup_glyph( name, namelen );
}
static inline int _bitmap_font_strlen( const char* text )
static inline int _tiny_font_strlen( const char* text )
{
const char *p, *q;
char c;
@ -1585,7 +1585,7 @@ static inline int _bitmap_font_strlen( const char* text )
return n;
}
static int _bitmap_font_text_to_glyphs( const bitmap_font_t* font, const char* text, unsigned char** glyphp )
static int _tiny_font_text_to_glyphs( const char* text, unsigned char** glyphp )
{
unsigned char* glyphs;
const char *p, *q;
@ -1593,7 +1593,7 @@ static int _bitmap_font_text_to_glyphs( const bitmap_font_t* font, const char* t
int namelen;
int i, n;
n = _bitmap_font_strlen( text );
n = _tiny_font_strlen( text );
if ( n <= 0 )
return n;
@ -1609,7 +1609,7 @@ static int _bitmap_font_text_to_glyphs( const bitmap_font_t* font, const char* t
}
if ( c != '\\' ) {
glyphs[ i++ ] = _bitmap_font_lookup_ascii( font, c );
glyphs[ i++ ] = _tiny_font_lookup_ascii( c );
continue;
}
@ -1620,14 +1620,14 @@ static int _bitmap_font_text_to_glyphs( const bitmap_font_t* font, const char* t
q++;
}
if ( q == p ) {
glyphs[ i++ ] = _bitmap_font_lookup_ascii( font, *p++ );
glyphs[ i++ ] = _tiny_font_lookup_ascii( *p++ );
continue;
}
namelen = q - p;
if ( *q == ' ' )
q++;
glyphs[ i++ ] = _bitmap_font_lookup_glyph( font, p, namelen );
glyphs[ i++ ] = _tiny_font_lookup_glyph( p, namelen );
p = q;
}
@ -1635,9 +1635,9 @@ static int _bitmap_font_text_to_glyphs( const bitmap_font_t* font, const char* t
return n;
}
static void bitmap_font_measure_text( const bitmap_font_t* font, const char* text, int* width, int* height, int* ascent, int* descent )
static void tiny_font_measure_text( const char* text, int* width, int* height, int* ascent, int* descent )
{
const bitmap_glyph_t* glyph;
const tiny_glyph_t* glyph;
unsigned char* glyphs;
int n, w, a, d;
@ -1645,10 +1645,10 @@ static void bitmap_font_measure_text( const bitmap_font_t* font, const char* tex
a = 0;
d = 0;
n = _bitmap_font_text_to_glyphs( font, text, &glyphs );
n = _tiny_font_text_to_glyphs( text, &glyphs );
for ( int i = 0; i < n; i++ ) {
glyph = &font->glyphs[ glyphs[ i ] ];
glyph = &tiny_font.glyphs[ glyphs[ i ] ];
w += glyph->width;
@ -1659,7 +1659,7 @@ static void bitmap_font_measure_text( const bitmap_font_t* font, const char* tex
}
*width = w - 1;
*height = font->ascent - font->descent;
*height = tiny_font.ascent - tiny_font.descent;
*ascent = a;
*descent = d;
@ -1667,9 +1667,9 @@ static void bitmap_font_measure_text( const bitmap_font_t* font, const char* tex
free( glyphs );
}
static void bitmap_font_draw_text( GdkDrawable* drawable, GdkColor* color, const bitmap_font_t* font, int x, int y, const char* text )
static void tiny_font_draw_text( GdkDrawable* drawable, GdkColor* color, int x, int y, const char* text )
{
const bitmap_glyph_t* glyph;
const tiny_glyph_t* glyph;
unsigned char* glyphs;
GdkBitmap* bitmap;
GdkGC* gc;
@ -1678,10 +1678,10 @@ static void bitmap_font_draw_text( GdkDrawable* drawable, GdkColor* color, const
gc = gdk_gc_new( drawable );
gdk_gc_set_rgb_fg_color( gc, color );
n = _bitmap_font_text_to_glyphs( font, text, &glyphs );
n = _tiny_font_text_to_glyphs( text, &glyphs );
for ( int i = 0; i < n; i++ ) {
glyph = &font->glyphs[ glyphs[ i ] ];
glyph = &tiny_font.glyphs[ glyphs[ i ] ];
w = glyph->width - glyph->kern;
h = glyph->ascent - glyph->descent;
@ -1693,11 +1693,11 @@ static void bitmap_font_draw_text( GdkDrawable* drawable, GdkColor* color, const
bitmap = gdk_bitmap_create_from_data( NULL, ( char* )glyph->bits, w, h );
gdk_gc_set_ts_origin( gc, x + glyph->kern, y + font->ascent - glyph->ascent );
gdk_gc_set_ts_origin( gc, x + glyph->kern, y + tiny_font.ascent - glyph->ascent );
gdk_gc_set_stipple( gc, bitmap );
gdk_gc_set_fill( gc, GDK_STIPPLED );
gdk_draw_rectangle( drawable, gc, true, x + glyph->kern, y + font->ascent - glyph->ascent, w, h );
gdk_draw_rectangle( drawable, gc, true, x + glyph->kern, y + tiny_font.ascent - glyph->ascent, w, h );
g_object_unref( bitmap );
@ -1710,7 +1710,7 @@ static void bitmap_font_draw_text( GdkDrawable* drawable, GdkColor* color, const
free( glyphs );
}
static gboolean callback_button_press( GtkWidget* widget, GdkEventButton* event, gpointer user_data )
static gboolean handler_button_press( GtkWidget* widget, GdkEventButton* event, gpointer user_data )
{
x49gp_ui_button_t* button = user_data;
const x49gp_ui_key_t* key = button->key;
@ -1794,7 +1794,7 @@ static void ui_release_all_buttons( x49gp_t* x49gp, x49gp_ui_button_t* cause )
}
}
static gboolean callback_button_release( GtkWidget* widget, GdkEventButton* event, gpointer user_data )
static gboolean handler_button_release( GtkWidget* widget, GdkEventButton* event, gpointer user_data )
{
x49gp_ui_button_t* button = user_data;
x49gp_t* x49gp = button->x49gp;
@ -1838,7 +1838,7 @@ static gboolean do_show_context_menu( GtkWidget* widget, GdkEventButton* event,
return false;
}
static gboolean callback_button_leave( GtkWidget* widget, GdkEventCrossing* event, gpointer user_data )
static gboolean handler_button_leave( GtkWidget* widget, GdkEventCrossing* event, gpointer user_data )
{
x49gp_ui_button_t* button = user_data;
@ -1851,7 +1851,7 @@ static gboolean callback_button_leave( GtkWidget* widget, GdkEventCrossing* even
return true;
}
static gboolean callback_focus_lost( GtkWidget* widget, GdkEventFocus* event, gpointer user_data )
static gboolean handler_focus_lost( GtkWidget* widget, GdkEventFocus* event, gpointer user_data )
{
x49gp_t* x49gp = user_data;
x49gp_ui_t* ui = x49gp->ui;
@ -1923,7 +1923,7 @@ static void do_emulator_reset( GtkMenuItem* menuitem, gpointer user_data )
x49gp_set_idle( x49gp, 0 );
}
static gboolean callback_key_event( GtkWidget* widget, GdkEventKey* event, gpointer user_data )
static gboolean handler_key_event( GtkWidget* widget, GdkEventKey* event, gpointer user_data )
{
x49gp_t* x49gp = user_data;
x49gp_ui_t* ui = x49gp->ui;
@ -2211,7 +2211,7 @@ static gboolean callback_key_event( GtkWidget* widget, GdkEventKey* event, gpoin
switch ( event->type ) {
case GDK_KEY_PRESS:
bev.type = GDK_BUTTON_PRESS;
callback_button_press( button->button, &bev, button );
handler_button_press( button->button, &bev, button );
/* GTK_BUTTON( button->button )->in_button = true; */
gtk_button_pressed( GTK_BUTTON( button->button ) );
/* GTK_BUTTON( button->button )->in_button = save_in; */
@ -2221,7 +2221,7 @@ static gboolean callback_key_event( GtkWidget* widget, GdkEventKey* event, gpoin
/* GTK_BUTTON( button->button )->in_button = true; */
gtk_button_released( GTK_BUTTON( button->button ) );
/* GTK_BUTTON( button->button )->in_button = save_in; */
callback_button_release( button->button, &bev, button );
handler_button_release( button->button, &bev, button );
break;
default:
return false;
@ -2231,7 +2231,7 @@ static gboolean callback_key_event( GtkWidget* widget, GdkEventKey* event, gpoin
}
/* Draw button's pixmap onto window */
static int callback_button_expose( GtkWidget* widget, GdkEventExpose* event, gpointer user_data )
static int handler_button_expose( GtkWidget* widget, GdkEventExpose* event, gpointer user_data )
{
x49gp_ui_button_t* button = user_data;
GtkAllocation widget_allocation;
@ -2251,7 +2251,7 @@ static int callback_button_expose( GtkWidget* widget, GdkEventExpose* event, gpo
}
/* Prepare button's pixmap */
static void callback_button_realize( GtkWidget* widget, gpointer user_data )
static void handler_button_realize( GtkWidget* widget, gpointer user_data )
{
x49gp_ui_button_t* button = user_data;
x49gp_ui_t* ui = button->x49gp->ui;
@ -2300,7 +2300,7 @@ static void callback_button_realize( GtkWidget* widget, gpointer user_data )
cairo_fill( cr );
if ( key->letter ) {
regular_font_measure_text( cr, opt.font, key->letter_size, &xoff, &yoff, &width, &height, &ascent, &descent,
regular_font_measure_text( cr, key->letter_size, &xoff, &yoff, &width, &height, &ascent, &descent,
CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->letter );
switch ( key->layout ) {
@ -2321,23 +2321,23 @@ static void callback_button_realize( GtkWidget* widget, gpointer user_data )
break;
}
regular_font_draw_text( cr, &ui->colors[ UI_COLOR_YELLOW ], opt.font, key->letter_size, 0.0, x + xoffset, y + yoffset,
regular_font_draw_text( cr, &ui->colors[ UI_COLOR_YELLOW ], key->letter_size, 0.0, x + xoffset, y + yoffset,
CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->letter );
}
regular_font_measure_text( cr, opt.font, key->font_size, &xoff, &yoff, &width, &height, &ascent, &descent, CAIRO_FONT_SLANT_NORMAL,
regular_font_measure_text( cr, key->font_size, &xoff, &yoff, &width, &height, &ascent, &descent, CAIRO_FONT_SLANT_NORMAL,
key->font_weight, key->label );
x = ( int )floor( ( w - 1.0 - width ) / 2.0 - xoff + 0.5 );
y = ( int )floor( ( h - 1.0 + ascent ) / 2.0 + 0.5 );
regular_font_draw_text( cr, &gtk_widget_get_style( widget )->text[ 0 ], opt.font, key->font_size, 0.0, x + xoffset, y + yoffset,
regular_font_draw_text( cr, &gtk_widget_get_style( widget )->text[ 0 ], key->font_size, 0.0, x + xoffset, y + yoffset,
CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->label );
cairo_destroy( cr );
}
static int callback_lcd_expose( GtkWidget* widget, GdkEventExpose* event, gpointer user_data )
static int handler_lcd_expose( GtkWidget* widget, GdkEventExpose* event, gpointer user_data )
{
x49gp_t* x49gp = user_data;
x49gp_ui_t* ui = x49gp->ui;
@ -2355,28 +2355,7 @@ static int callback_lcd_expose( GtkWidget* widget, GdkEventExpose* event, gpoint
return false;
}
/* static void draw_xbm(cairo_t *cr, GdkRectangle *rect, int width, int height, unsigned char *bits) */
/* { */
/* double sz = rect->width < rect->height ? rect->width : rect->height; */
/* cairo_surface_t * icon = cairo_image_surface_create_for_data( */
/* bits, */
/* CAIRO_FORMAT_A1, */
/* width,height, */
/* cairo_format_stride_for_width(CAIRO_FORMAT_A1,width)); */
/* cairo_save(cr); */
/* cairo_scale(cr, sz / ((double) width), */
/* sz / ((double) height)); */
/* cairo_mask_surface(cr,icon,(rect->width-sz)/2,(rect->height-sz)/2); */
/* cairo_surface_destroy(icon); */
/* cairo_restore(cr); */
/* } */
static int callback_lcd_draw( GtkWidget* widget, GdkEventConfigure* event, gpointer user_data )
static int handler_lcd_draw( GtkWidget* widget, GdkEventConfigure* event, gpointer user_data )
{
x49gp_t* x49gp = user_data;
x49gp_ui_t* ui = x49gp->ui;
@ -2411,7 +2390,7 @@ static inline unsigned color2rgb( x49gp_ui_t* ui, int color )
return 0x000000 | ( ui->colors[ color ].red << 8 ) | ( ui->colors[ color ].green << 16 ) | ( ui->colors[ color ].blue );
}
static int callback_faceplate_draw( GtkWidget* widget, GdkEventConfigure* event, gpointer user_data )
static int handler_faceplate_draw( GtkWidget* widget, GdkEventConfigure* event, gpointer user_data )
{
x49gp_t* x49gp = user_data;
x49gp_ui_t* ui = x49gp->ui;
@ -2483,19 +2462,19 @@ static int callback_faceplate_draw( GtkWidget* widget, GdkEventConfigure* event,
key = ui->buttons[ i ].key;
if ( key->left ) {
bitmap_font_measure_text( &tiny_font, key->left, &wl, &hl, &a, &dl );
tiny_font_measure_text( key->left, &wl, &hl, &a, &dl );
if ( !key->right ) {
xl = key->x + ( key->width - wl ) / 2;
bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ left_color ], &tiny_font, ui->kb_x_offset + xl,
tiny_font_draw_text( ui->bg_pixmap, &ui->colors[ left_color ], ui->kb_x_offset + xl,
ui->kb_y_offset + key->y - hl + dl + 1, key->left );
}
}
if ( key->right ) {
bitmap_font_measure_text( &tiny_font, key->right, &wr, &hr, &a, &dr );
tiny_font_measure_text( key->right, &wr, &hr, &a, &dr );
if ( !key->left ) {
xr = key->x + ( key->width - wr ) / 2;
bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ right_color ], &tiny_font, ui->kb_x_offset + xr,
tiny_font_draw_text( ui->bg_pixmap, &ui->colors[ right_color ], ui->kb_x_offset + xr,
ui->kb_y_offset + key->y - hr + dr + 1, key->right );
}
}
@ -2509,18 +2488,18 @@ static int callback_faceplate_draw( GtkWidget* widget, GdkEventConfigure* event,
xr -= ( key->width - 4 - ( wl + wr ) ) / 2;
}
bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ left_color ], &tiny_font, ui->kb_x_offset + xl,
tiny_font_draw_text( ui->bg_pixmap, &ui->colors[ left_color ], ui->kb_x_offset + xl,
ui->kb_y_offset + key->y - hl + dl + 1, key->left );
bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ right_color ], &tiny_font, ui->kb_x_offset + xr,
tiny_font_draw_text( ui->bg_pixmap, &ui->colors[ right_color ], ui->kb_x_offset + xr,
ui->kb_y_offset + key->y - hr + dr + 1, key->right );
}
if ( key->below ) {
bitmap_font_measure_text( &tiny_font, key->below, &wl, &hl, &a, &dl );
tiny_font_measure_text( key->below, &wl, &hl, &a, &dl );
xl = key->x + ( key->width - wl ) / 2;
bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ below_color ], &tiny_font, ui->kb_x_offset + xl,
tiny_font_draw_text( ui->bg_pixmap, &ui->colors[ below_color ], ui->kb_x_offset + xl,
ui->kb_y_offset + key->y + key->height + 2, key->below );
}
@ -2535,7 +2514,7 @@ static int callback_faceplate_draw( GtkWidget* widget, GdkEventConfigure* event,
return false;
}
static gboolean callback_window_click( GtkWidget* widget, GdkEventButton* event, gpointer user_data )
static gboolean handler_window_click( GtkWidget* widget, GdkEventButton* event, gpointer user_data )
{
#ifdef DEBUG_X49GP_UI
fprintf( stderr, "%s:%u: type %u, button %u\n", __FUNCTION__, __LINE__, event->type, event->button );
@ -2562,12 +2541,6 @@ static void do_quit( gpointer user_data, GtkWidget* widget, GdkEvent* event )
x49gp->arm_exit++;
}
static void _gui_place_element_at( x49gp_t* x49gp, GtkFixed* fixed, GtkWidget* widget, gint x, gint y, gint width, gint height )
{
gtk_widget_set_size_request( widget, width, height );
gtk_fixed_put( fixed, widget, x, y );
}
static int ui_init( x49gp_module_t* module )
{
x49gp_t* x49gp = module->x49gp;
@ -2701,6 +2674,12 @@ static inline void _ui_load__newrplify_ui_keys()
ui_keys[ 50 ].left = NULL;
}
static void _ui_load___place_ui_element_at( x49gp_t* x49gp, GtkFixed* fixed, GtkWidget* widget, gint x, gint y, gint width, gint height )
{
gtk_widget_set_size_request( widget, width, height );
gtk_fixed_put( fixed, widget, x, y );
}
static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
{
x49gp_t* x49gp = module->x49gp;
@ -2802,7 +2781,7 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
ui->background = gtk_drawing_area_new();
gtk_drawing_area_size( GTK_DRAWING_AREA( ui->background ), ui->width, ui->height );
_gui_place_element_at( x49gp, GTK_FIXED( ui->fixed ), ui->background, 0, 0, ui->width, ui->height );
_ui_load___place_ui_element_at( x49gp, GTK_FIXED( ui->fixed ), ui->background, 0, 0, ui->width, ui->height );
ui->lcd_canvas = gtk_drawing_area_new();
gtk_drawing_area_size( GTK_DRAWING_AREA( ui->lcd_canvas ), ui->lcd_width, ui->lcd_height );
@ -2811,7 +2790,7 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
gtk_event_box_set_visible_window( GTK_EVENT_BOX( screen_box ), true );
gtk_event_box_set_above_child( GTK_EVENT_BOX( screen_box ), false );
gtk_container_add( GTK_CONTAINER( screen_box ), ui->lcd_canvas );
_gui_place_element_at( x49gp, GTK_FIXED( ui->fixed ), screen_box, ui->lcd_x_offset, ui->lcd_y_offset, ui->lcd_width,
_ui_load___place_ui_element_at( x49gp, GTK_FIXED( ui->fixed ), screen_box, ui->lcd_x_offset, ui->lcd_y_offset, ui->lcd_width,
ui->lcd_height );
}
@ -2839,9 +2818,9 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
gtk_widget_set_style( button->label, gtk_widget_get_style( button->button ) );
gtk_container_add( GTK_CONTAINER( button->button ), button->label );
g_signal_connect( G_OBJECT( button->label ), "expose-event", G_CALLBACK( callback_button_expose ), button );
g_signal_connect( G_OBJECT( button->label ), "expose-event", G_CALLBACK( handler_button_expose ), button );
g_signal_connect_after( G_OBJECT( button->label ), "realize", G_CALLBACK( callback_button_realize ), button );
g_signal_connect_after( G_OBJECT( button->label ), "realize", G_CALLBACK( handler_button_realize ), button );
}
button->box = gtk_event_box_new();
@ -2849,12 +2828,12 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
gtk_event_box_set_above_child( GTK_EVENT_BOX( button->box ), false );
gtk_container_add( GTK_CONTAINER( button->box ), button->button );
_gui_place_element_at( x49gp, GTK_FIXED( ui->fixed ), button->box, ui->kb_x_offset + ui_keys[ i ].x,
_ui_load___place_ui_element_at( x49gp, GTK_FIXED( ui->fixed ), button->box, ui->kb_x_offset + ui_keys[ i ].x,
ui->kb_y_offset + ui_keys[ i ].y, ui_keys[ i ].width, ui_keys[ i ].height );
g_signal_connect( G_OBJECT( button->button ), "button-press-event", G_CALLBACK( callback_button_press ), button );
g_signal_connect( G_OBJECT( button->button ), "button-release-event", G_CALLBACK( callback_button_release ), button );
g_signal_connect( G_OBJECT( button->button ), "leave-notify-event", G_CALLBACK( callback_button_leave ), button );
g_signal_connect( G_OBJECT( button->button ), "button-press-event", G_CALLBACK( handler_button_press ), button );
g_signal_connect( G_OBJECT( button->button ), "button-release-event", G_CALLBACK( handler_button_release ), button );
g_signal_connect( G_OBJECT( button->button ), "leave-notify-event", G_CALLBACK( handler_button_leave ), button );
gtk_widget_add_events( button->button, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK );
}
@ -2904,15 +2883,16 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
{
g_signal_connect( G_OBJECT( screen_box ), "button-press-event", G_CALLBACK( do_show_context_menu ), x49gp );
g_signal_connect( G_OBJECT( ui->background ), "configure-event", G_CALLBACK( callback_faceplate_draw ), x49gp );
g_signal_connect( G_OBJECT( ui->background ), "configure-event", G_CALLBACK( handler_faceplate_draw ), x49gp );
g_signal_connect( G_OBJECT( ui->lcd_canvas ), "expose-event", G_CALLBACK( callback_lcd_expose ), x49gp );
g_signal_connect( G_OBJECT( ui->lcd_canvas ), "configure-event", G_CALLBACK( callback_lcd_draw ), x49gp );
g_signal_connect( G_OBJECT( ui->lcd_canvas ), "expose-event", G_CALLBACK( handler_lcd_expose ), x49gp );
g_signal_connect( G_OBJECT( ui->lcd_canvas ), "configure-event", G_CALLBACK( handler_lcd_draw ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "focus-out-event", G_CALLBACK( handler_focus_lost ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "key-press-event", G_CALLBACK( handler_key_event ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "key-release-event", G_CALLBACK( handler_key_event ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "button-press-event", G_CALLBACK( handler_window_click ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "focus-out-event", G_CALLBACK( callback_focus_lost ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "key-press-event", G_CALLBACK( callback_key_event ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "key-release-event", G_CALLBACK( callback_key_event ), x49gp );
g_signal_connect( G_OBJECT( ui->window ), "button-press-event", G_CALLBACK( callback_window_click ), x49gp );
g_signal_connect_swapped( G_OBJECT( ui->window ), "delete-event", G_CALLBACK( do_quit ), x49gp );
g_signal_connect_swapped( G_OBJECT( ui->window ), "destroy", G_CALLBACK( do_quit ), x49gp );