forked from Miroirs/x49gp
[gtk] use accessor functions to get values
as part of modernizing gtk code before upgrading gtk
This commit is contained in:
parent
c09f925e32
commit
d300afe3c7
3 changed files with 76 additions and 73 deletions
2
Makefile
2
Makefile
|
@ -13,7 +13,7 @@ DEBUG_CFLAGS = -g # -pg
|
||||||
OPTIM = 2
|
OPTIM = 2
|
||||||
|
|
||||||
# GTK
|
# GTK
|
||||||
GTK_CFLAGS = $(shell pkg-config --cflags gtk+-2.0)
|
GTK_CFLAGS = $(shell pkg-config --cflags gtk+-2.0) -DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE
|
||||||
GTK_LDLIBS = $(shell pkg-config --libs gtk+-2.0) -lz -lm
|
GTK_LDLIBS = $(shell pkg-config --libs gtk+-2.0) -lz -lm
|
||||||
|
|
||||||
# Embedded qemu
|
# Embedded qemu
|
||||||
|
|
|
@ -110,12 +110,12 @@ void x49gp_lcd_update( x49gp_t* x49gp )
|
||||||
int color, x, y;
|
int color, x, y;
|
||||||
|
|
||||||
if ( !( lcd->lcdcon1 & 1 ) ) {
|
if ( !( lcd->lcdcon1 & 1 ) ) {
|
||||||
gdk_draw_drawable( ui->lcd_pixmap, ui->window->style->bg_gc[ 0 ], ui->bg_pixmap, ui->lcd_x_offset, ui->lcd_y_offset, 0, 0,
|
gdk_draw_drawable( ui->lcd_pixmap, gtk_widget_get_style( ui->window )->bg_gc[ 0 ], ui->bg_pixmap, ui->lcd_x_offset, ui->lcd_y_offset, 0, 0,
|
||||||
ui->lcd_width, ui->lcd_height );
|
ui->lcd_width, ui->lcd_height );
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_draw_drawable( ui->lcd_pixmap, ui->window->style->bg_gc[ 0 ], ui->bg_pixmap, ui->lcd_x_offset, ui->lcd_y_offset, 0, 0,
|
gdk_draw_drawable( ui->lcd_pixmap, gtk_widget_get_style( ui->window )->bg_gc[ 0 ], ui->bg_pixmap, ui->lcd_x_offset, ui->lcd_y_offset, 0, 0,
|
||||||
ui->lcd_width, ui->lcd_height );
|
ui->lcd_width, ui->lcd_height );
|
||||||
|
|
||||||
color = x49gp_get_pixel_color( lcd, 131, 0 );
|
color = x49gp_get_pixel_color( lcd, 131, 0 );
|
||||||
|
@ -142,7 +142,7 @@ void x49gp_lcd_update( x49gp_t* x49gp )
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_busy_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
gdk_gc_set_rgb_fg_color( ui->ann_busy_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_busy_gc, TRUE, 191, 0, 15, 12 );
|
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_busy_gc, TRUE, 191, 0, 15, 12 );
|
||||||
|
|
||||||
gc = gdk_gc_new( ui->lcd_canvas->window );
|
gc = gdk_gc_new( gtk_widget_get_window( ui->lcd_canvas ) );
|
||||||
|
|
||||||
for ( y = 0; y < ( ui->lcd_height - ui->lcd_top_margin ) / 2; y++ ) {
|
for ( y = 0; y < ( ui->lcd_height - ui->lcd_top_margin ) / 2; y++ ) {
|
||||||
for ( x = 0; x < ui->lcd_width / 2; x++ ) {
|
for ( x = 0; x < ui->lcd_width / 2; x++ ) {
|
||||||
|
@ -160,7 +160,7 @@ done:
|
||||||
rect.width = ui->lcd_width;
|
rect.width = ui->lcd_width;
|
||||||
rect.height = ui->lcd_height;
|
rect.height = ui->lcd_height;
|
||||||
|
|
||||||
gdk_window_invalidate_rect( ui->lcd_canvas->window, &rect, false );
|
gdk_window_invalidate_rect( gtk_widget_get_window( ui->lcd_canvas ), &rect, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t s3c2410_lcd_read( void* opaque, target_phys_addr_t offset )
|
static uint32_t s3c2410_lcd_read( void* opaque, target_phys_addr_t offset )
|
||||||
|
|
139
src/ui.c
139
src/ui.c
|
@ -1602,7 +1602,7 @@ static int x49gp_ui_button_pixmaps_init( x49gp_t* x49gp, x49gp_ui_button_t* butt
|
||||||
x49gp_ui_style_init( style, button->button, &ui->colors[ button->key->color ], &ui->colors[ UI_COLOR_BLACK ] );
|
x49gp_ui_style_init( style, button->button, &ui->colors[ button->key->color ], &ui->colors[ UI_COLOR_BLACK ] );
|
||||||
|
|
||||||
for ( int i = 0; i < 5; i++ ) {
|
for ( int i = 0; i < 5; i++ ) {
|
||||||
style->bg_pixmap[ i ] = gdk_pixmap_new( ui->window->window, button->key->width, button->key->height, -1 );
|
style->bg_pixmap[ i ] = gdk_pixmap_new( gtk_widget_get_window( ui->window ), button->key->width, button->key->height, -1 );
|
||||||
|
|
||||||
if ( i == GTK_STATE_ACTIVE ) {
|
if ( i == GTK_STATE_ACTIVE ) {
|
||||||
if ( color == UI_COLOR_SILVER ) {
|
if ( color == UI_COLOR_SILVER ) {
|
||||||
|
@ -1625,7 +1625,7 @@ static int x49gp_ui_button_pixmaps_init( x49gp_t* x49gp, x49gp_ui_button_t* butt
|
||||||
src = gdk_pixbuf_new_subpixbuf( ui->bg_pixbuf, ui->kb_x_offset + button->key->x, ui->kb_y_offset + button->key->y,
|
src = gdk_pixbuf_new_subpixbuf( ui->bg_pixbuf, ui->kb_x_offset + button->key->x, ui->kb_y_offset + button->key->y,
|
||||||
button->key->width, button->key->height );
|
button->key->width, button->key->height );
|
||||||
|
|
||||||
gdk_draw_pixbuf( style->bg_pixmap[ i ], ui->window->style->black_gc, src, 0, 0, 0, 0, button->key->width, button->key->height,
|
gdk_draw_pixbuf( style->bg_pixmap[ i ], gtk_widget_get_style( ui->window )->black_gc, src, 0, 0, 0, 0, button->key->width, button->key->height,
|
||||||
GDK_RGB_DITHER_NORMAL, 0, 0 );
|
GDK_RGB_DITHER_NORMAL, 0, 0 );
|
||||||
|
|
||||||
g_object_unref( src );
|
g_object_unref( src );
|
||||||
|
@ -2476,10 +2476,13 @@ static gboolean x49gp_ui_focus_lost( GtkWidget* widget, GdkEventFocus* event, gp
|
||||||
static void x49gp_ui_popup_at_widget( GtkMenu* menu, gint* x, gint* y, gboolean* push_in, gpointer user_data )
|
static void x49gp_ui_popup_at_widget( GtkMenu* menu, gint* x, gint* y, gboolean* push_in, gpointer user_data )
|
||||||
{
|
{
|
||||||
GtkWidget* widget = GTK_WIDGET( user_data );
|
GtkWidget* widget = GTK_WIDGET( user_data );
|
||||||
|
GtkAllocation widget_allocation;
|
||||||
|
|
||||||
gdk_window_get_origin( widget->window, x, y );
|
gtk_widget_get_allocation( widget, &widget_allocation);
|
||||||
*x += widget->allocation.x;
|
|
||||||
*y += widget->allocation.y;
|
gdk_window_get_origin( gtk_widget_get_window( widget ), x, y );
|
||||||
|
*x += widget_allocation.x;
|
||||||
|
*y += widget_allocation.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void x49gp_ui_mount_sd_folder( GtkMenuItem* menuitem, gpointer user_data )
|
static void x49gp_ui_mount_sd_folder( GtkMenuItem* menuitem, gpointer user_data )
|
||||||
|
@ -2828,15 +2831,18 @@ static gboolean x49gp_ui_key_event( GtkWidget* widget, GdkEventKey* event, gpoin
|
||||||
static int x49gp_button_expose_event( GtkWidget* widget, GdkEventExpose* event, gpointer user_data )
|
static int x49gp_button_expose_event( GtkWidget* widget, GdkEventExpose* event, gpointer user_data )
|
||||||
{
|
{
|
||||||
x49gp_ui_button_t* button = user_data;
|
x49gp_ui_button_t* button = user_data;
|
||||||
|
GtkAllocation widget_allocation;
|
||||||
|
|
||||||
int x = widget->allocation.x;
|
gtk_widget_get_allocation( widget, &widget_allocation);
|
||||||
int y = widget->allocation.y;
|
|
||||||
|
|
||||||
if ( GTK_WIDGET_STATE( widget ) == GTK_STATE_ACTIVE )
|
int x = widget_allocation.x;
|
||||||
|
int y = widget_allocation.y;
|
||||||
|
|
||||||
|
if ( gtk_widget_get_state( widget ) == GTK_STATE_ACTIVE )
|
||||||
y -= 1;
|
y -= 1;
|
||||||
|
|
||||||
gdk_draw_drawable( widget->window, widget->style->black_gc, button->pixmap, 0, 0, x, y, widget->allocation.width,
|
gdk_draw_drawable( gtk_widget_get_window( widget ), gtk_widget_get_style( widget )->black_gc, button->pixmap, 0, 0, x, y, widget_allocation.width,
|
||||||
widget->allocation.height );
|
widget_allocation.height );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2850,15 +2856,18 @@ static void x49gp_button_realize( GtkWidget* widget, gpointer user_data )
|
||||||
double xoff, yoff, width, height, ascent, descent;
|
double xoff, yoff, width, height, ascent, descent;
|
||||||
unsigned int w, h;
|
unsigned int w, h;
|
||||||
int xoffset, yoffset, x, y;
|
int xoffset, yoffset, x, y;
|
||||||
|
GtkAllocation widget_allocation;
|
||||||
|
|
||||||
xoffset = widget->allocation.x;
|
gtk_widget_get_allocation( widget, &widget_allocation);
|
||||||
yoffset = widget->allocation.y;
|
|
||||||
w = widget->allocation.width;
|
|
||||||
h = widget->allocation.height;
|
|
||||||
|
|
||||||
button->pixmap = gdk_pixmap_new( widget->style->bg_pixmap[ 0 ], w, h, -1 );
|
xoffset = widget_allocation.x;
|
||||||
|
yoffset = widget_allocation.y;
|
||||||
|
w = widget_allocation.width;
|
||||||
|
h = widget_allocation.height;
|
||||||
|
|
||||||
gdk_draw_drawable( button->pixmap, widget->style->black_gc, widget->style->bg_pixmap[ 0 ], xoffset, yoffset, 0, 0, button->key->width,
|
button->pixmap = gdk_pixmap_new( gtk_widget_get_style( widget )->bg_pixmap[ 0 ], w, h, -1 );
|
||||||
|
|
||||||
|
gdk_draw_drawable( button->pixmap, gtk_widget_get_style( widget )->black_gc, gtk_widget_get_style( widget )->bg_pixmap[ 0 ], xoffset, yoffset, 0, 0, button->key->width,
|
||||||
button->key->height );
|
button->key->height );
|
||||||
|
|
||||||
xoffset += 2;
|
xoffset += 2;
|
||||||
|
@ -2913,7 +2922,7 @@ static void x49gp_button_realize( GtkWidget* widget, gpointer user_data )
|
||||||
x = ( int )floor( ( w - 1.0 - width ) / 2.0 - xoff + 0.5 );
|
x = ( int )floor( ( w - 1.0 - width ) / 2.0 - xoff + 0.5 );
|
||||||
y = ( int )floor( ( h - 1.0 + ascent ) / 2.0 + 0.5 );
|
y = ( int )floor( ( h - 1.0 + ascent ) / 2.0 + 0.5 );
|
||||||
|
|
||||||
x49gp_ui_draw_text( cr, &widget->style->text[ 0 ], X49GP_UI_NORMAL_FONT, key->font_size, 0.0, x + xoffset, y + yoffset, 1,
|
x49gp_ui_draw_text( cr, >k_widget_get_style( widget )->text[ 0 ], X49GP_UI_NORMAL_FONT, key->font_size, 0.0, x + xoffset, y + yoffset, 1,
|
||||||
CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->label );
|
CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->label );
|
||||||
|
|
||||||
cairo_destroy( cr );
|
cairo_destroy( cr );
|
||||||
|
@ -2928,7 +2937,7 @@ static int x49gp_lcd_expose_event( GtkWidget* widget, GdkEventExpose* event, gpo
|
||||||
|
|
||||||
gdk_region_get_rectangles( event->region, &rects, &n );
|
gdk_region_get_rectangles( event->region, &rects, &n );
|
||||||
for ( int i = 0; i < n; i++ ) {
|
for ( int i = 0; i < n; i++ ) {
|
||||||
gdk_draw_drawable( widget->window, widget->style->black_gc, ui->lcd_pixmap, rects[ i ].x, rects[ i ].y, rects[ i ].x, rects[ i ].y,
|
gdk_draw_drawable( gtk_widget_get_window(widget), gtk_widget_get_style( widget )->black_gc, ui->lcd_pixmap, rects[ i ].x, rects[ i ].y, rects[ i ].x, rects[ i ].y,
|
||||||
rects[ i ].width, rects[ i ].height );
|
rects[ i ].width, rects[ i ].height );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2945,71 +2954,68 @@ static int x49gp_lcd_configure_event( GtkWidget* widget, GdkEventConfigure* even
|
||||||
if ( NULL != ui->lcd_pixmap )
|
if ( NULL != ui->lcd_pixmap )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ui->ann_left = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_left_bits, ann_left_width, ann_left_height );
|
ui->ann_left = gdk_bitmap_create_from_data( gtk_widget_get_window( ui->lcd_canvas ), ( char* )ann_left_bits, ann_left_width, ann_left_height );
|
||||||
ui->ann_right = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_right_bits, ann_right_width, ann_right_height );
|
ui->ann_right = gdk_bitmap_create_from_data( gtk_widget_get_window( ui->lcd_canvas ), ( char* )ann_right_bits, ann_right_width, ann_right_height );
|
||||||
ui->ann_alpha = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_alpha_bits, ann_alpha_width, ann_alpha_height );
|
ui->ann_alpha = gdk_bitmap_create_from_data( gtk_widget_get_window( ui->lcd_canvas ), ( char* )ann_alpha_bits, ann_alpha_width, ann_alpha_height );
|
||||||
ui->ann_battery =
|
ui->ann_battery =
|
||||||
gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_battery_bits, ann_battery_width, ann_battery_height );
|
gdk_bitmap_create_from_data( gtk_widget_get_window( ui->lcd_canvas ), ( char* )ann_battery_bits, ann_battery_width, ann_battery_height );
|
||||||
ui->ann_busy = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_busy_bits, ann_busy_width, ann_busy_height );
|
ui->ann_busy = gdk_bitmap_create_from_data( gtk_widget_get_window( ui->lcd_canvas ), ( char* )ann_busy_bits, ann_busy_width, ann_busy_height );
|
||||||
ui->ann_io = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_io_bits, ann_io_width, ann_io_height );
|
ui->ann_io = gdk_bitmap_create_from_data( gtk_widget_get_window( ui->lcd_canvas ), ( char* )ann_io_bits, ann_io_width, ann_io_height );
|
||||||
|
|
||||||
ui->ann_left_gc = gdk_gc_new( ui->lcd_canvas->window );
|
ui->ann_left_gc = gdk_gc_new( gtk_widget_get_window( ui->lcd_canvas ) );
|
||||||
gdk_gc_copy( ui->ann_left_gc, widget->style->black_gc );
|
gdk_gc_copy( ui->ann_left_gc, gtk_widget_get_style( widget )->black_gc );
|
||||||
gdk_gc_set_ts_origin( ui->ann_left_gc, 11, 0 );
|
gdk_gc_set_ts_origin( ui->ann_left_gc, 11, 0 );
|
||||||
gdk_gc_set_stipple( ui->ann_left_gc, ui->ann_left );
|
gdk_gc_set_stipple( ui->ann_left_gc, ui->ann_left );
|
||||||
gdk_gc_set_fill( ui->ann_left_gc, GDK_STIPPLED );
|
gdk_gc_set_fill( ui->ann_left_gc, GDK_STIPPLED );
|
||||||
|
|
||||||
ui->ann_right_gc = gdk_gc_new( ui->lcd_canvas->window );
|
ui->ann_right_gc = gdk_gc_new( gtk_widget_get_window( ui->lcd_canvas ) );
|
||||||
gdk_gc_copy( ui->ann_right_gc, widget->style->black_gc );
|
gdk_gc_copy( ui->ann_right_gc, gtk_widget_get_style( widget )->black_gc );
|
||||||
gdk_gc_set_ts_origin( ui->ann_right_gc, 56, 0 );
|
gdk_gc_set_ts_origin( ui->ann_right_gc, 56, 0 );
|
||||||
gdk_gc_set_stipple( ui->ann_right_gc, ui->ann_right );
|
gdk_gc_set_stipple( ui->ann_right_gc, ui->ann_right );
|
||||||
gdk_gc_set_fill( ui->ann_right_gc, GDK_STIPPLED );
|
gdk_gc_set_fill( ui->ann_right_gc, GDK_STIPPLED );
|
||||||
|
|
||||||
ui->ann_alpha_gc = gdk_gc_new( ui->lcd_canvas->window );
|
ui->ann_alpha_gc = gdk_gc_new( gtk_widget_get_window( ui->lcd_canvas ) );
|
||||||
gdk_gc_copy( ui->ann_alpha_gc, widget->style->black_gc );
|
gdk_gc_copy( ui->ann_alpha_gc, gtk_widget_get_style( widget )->black_gc );
|
||||||
gdk_gc_set_ts_origin( ui->ann_alpha_gc, 101, 0 );
|
gdk_gc_set_ts_origin( ui->ann_alpha_gc, 101, 0 );
|
||||||
gdk_gc_set_stipple( ui->ann_alpha_gc, ui->ann_alpha );
|
gdk_gc_set_stipple( ui->ann_alpha_gc, ui->ann_alpha );
|
||||||
gdk_gc_set_fill( ui->ann_alpha_gc, GDK_STIPPLED );
|
gdk_gc_set_fill( ui->ann_alpha_gc, GDK_STIPPLED );
|
||||||
|
|
||||||
ui->ann_battery_gc = gdk_gc_new( ui->lcd_canvas->window );
|
ui->ann_battery_gc = gdk_gc_new( gtk_widget_get_window( ui->lcd_canvas ) );
|
||||||
gdk_gc_copy( ui->ann_battery_gc, widget->style->black_gc );
|
gdk_gc_copy( ui->ann_battery_gc, gtk_widget_get_style( widget )->black_gc );
|
||||||
gdk_gc_set_ts_origin( ui->ann_battery_gc, 146, 0 );
|
gdk_gc_set_ts_origin( ui->ann_battery_gc, 146, 0 );
|
||||||
gdk_gc_set_stipple( ui->ann_battery_gc, ui->ann_battery );
|
gdk_gc_set_stipple( ui->ann_battery_gc, ui->ann_battery );
|
||||||
gdk_gc_set_fill( ui->ann_battery_gc, GDK_STIPPLED );
|
gdk_gc_set_fill( ui->ann_battery_gc, GDK_STIPPLED );
|
||||||
|
|
||||||
ui->ann_busy_gc = gdk_gc_new( ui->lcd_canvas->window );
|
ui->ann_busy_gc = gdk_gc_new( gtk_widget_get_window( ui->lcd_canvas ) );
|
||||||
gdk_gc_copy( ui->ann_busy_gc, widget->style->black_gc );
|
gdk_gc_copy( ui->ann_busy_gc, gtk_widget_get_style( widget )->black_gc );
|
||||||
gdk_gc_set_ts_origin( ui->ann_busy_gc, 191, 0 );
|
gdk_gc_set_ts_origin( ui->ann_busy_gc, 191, 0 );
|
||||||
gdk_gc_set_stipple( ui->ann_busy_gc, ui->ann_busy );
|
gdk_gc_set_stipple( ui->ann_busy_gc, ui->ann_busy );
|
||||||
gdk_gc_set_fill( ui->ann_busy_gc, GDK_STIPPLED );
|
gdk_gc_set_fill( ui->ann_busy_gc, GDK_STIPPLED );
|
||||||
|
|
||||||
ui->ann_io_gc = gdk_gc_new( ui->lcd_canvas->window );
|
ui->ann_io_gc = gdk_gc_new( gtk_widget_get_window( ui->lcd_canvas ) );
|
||||||
gdk_gc_copy( ui->ann_io_gc, widget->style->black_gc );
|
gdk_gc_copy( ui->ann_io_gc, gtk_widget_get_style( widget )->black_gc );
|
||||||
gdk_gc_set_ts_origin( ui->ann_io_gc, 236, 0 );
|
gdk_gc_set_ts_origin( ui->ann_io_gc, 236, 0 );
|
||||||
gdk_gc_set_stipple( ui->ann_io_gc, ui->ann_io );
|
gdk_gc_set_stipple( ui->ann_io_gc, ui->ann_io );
|
||||||
gdk_gc_set_fill( ui->ann_io_gc, GDK_STIPPLED );
|
gdk_gc_set_fill( ui->ann_io_gc, GDK_STIPPLED );
|
||||||
|
|
||||||
ui->lcd_pixmap = gdk_pixmap_new( ui->lcd_canvas->window, ui->lcd_width, ui->lcd_height, -1 );
|
ui->lcd_pixmap = gdk_pixmap_new( gtk_widget_get_window( ui->lcd_canvas ), ui->lcd_width, ui->lcd_height, -1 );
|
||||||
|
|
||||||
#if DEBUG_LAYOUT /* Debug Symbols on LCD screen ;) */
|
#if DEBUG_LAYOUT /* Debug Symbols on LCD screen ;) */
|
||||||
{
|
{
|
||||||
cairo_t *cr;
|
cairo_t* cr;
|
||||||
|
|
||||||
cr = gdk_cairo_create(ui->bg_pixmap);
|
cr = gdk_cairo_create( ui->bg_pixmap );
|
||||||
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
|
cairo_set_line_cap( cr, CAIRO_LINE_CAP_BUTT );
|
||||||
cairo_set_line_join(cr, CAIRO_LINE_JOIN_MITER);
|
cairo_set_line_join( cr, CAIRO_LINE_JOIN_MITER );
|
||||||
|
|
||||||
x49gp_ui_draw_text(cr, &widget->style->black,
|
x49gp_ui_draw_text( cr, >k_widget_get_style( widget )->black, X49GP_UI_NORMAL_FONT, 100.0, 1.0, ui->lcd_x_offset + 10, ui->lcd_y_offset + 160, 1,
|
||||||
X49GP_UI_NORMAL_FONT, 100.0, 1.0,
|
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD, "\\arrowleftdblfull" );
|
||||||
ui->lcd_x_offset + 10, ui->lcd_y_offset + 160,
|
|
||||||
1, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD,
|
|
||||||
"\\arrowleftdblfull");
|
|
||||||
|
|
||||||
cairo_destroy(cr);
|
cairo_destroy( cr );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gdk_draw_drawable( ui->lcd_pixmap, widget->style->black_gc, ui->bg_pixmap, ui->lcd_x_offset, ui->lcd_y_offset, 0, 0, ui->lcd_width,
|
gdk_draw_drawable( ui->lcd_pixmap, gtk_widget_get_style( widget )->black_gc, ui->bg_pixmap, ui->lcd_x_offset, ui->lcd_y_offset, 0, 0, ui->lcd_width,
|
||||||
ui->lcd_height );
|
ui->lcd_height );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -3032,9 +3038,9 @@ static int x49gp_window_configure_event( GtkWidget* widget, GdkEventConfigure* e
|
||||||
if ( NULL != ui->bg_pixmap )
|
if ( NULL != ui->bg_pixmap )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ui->bg_pixmap = gdk_pixmap_new( widget->window, ui->width, ui->height, -1 );
|
ui->bg_pixmap = gdk_pixmap_new( gtk_widget_get_window( widget ), ui->width, ui->height, -1 );
|
||||||
|
|
||||||
gdk_draw_pixbuf( ui->bg_pixmap, widget->style->black_gc, ui->bg_pixbuf, 0, 0, 0, 0, ui->width, ui->height, GDK_RGB_DITHER_NORMAL, 0,
|
gdk_draw_pixbuf( ui->bg_pixmap, gtk_widget_get_style( widget )->black_gc, ui->bg_pixbuf, 0, 0, 0, 0, ui->width, ui->height, GDK_RGB_DITHER_NORMAL, 0,
|
||||||
0 );
|
0 );
|
||||||
|
|
||||||
cr = gdk_cairo_create( ui->bg_pixmap );
|
cr = gdk_cairo_create( ui->bg_pixmap );
|
||||||
|
@ -3044,14 +3050,14 @@ static int x49gp_window_configure_event( GtkWidget* widget, GdkEventConfigure* e
|
||||||
switch ( ui->calculator ) {
|
switch ( ui->calculator ) {
|
||||||
case UI_CALCULATOR_HP49GP:
|
case UI_CALCULATOR_HP49GP:
|
||||||
case UI_CALCULATOR_HP49GP_NEWRPL:
|
case UI_CALCULATOR_HP49GP_NEWRPL:
|
||||||
x49gp_ui_draw_text( cr, &widget->style->black, X49GP_UI_NORMAL_FONT, 15.0, 0.0, 14 /* 38 */, 20 /* 42 */, 2,
|
x49gp_ui_draw_text( cr, >k_widget_get_style( widget )->black, X49GP_UI_NORMAL_FONT, 15.0, 0.0, 14 /* 38 */, 20 /* 42 */, 2,
|
||||||
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD, "hp", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL,
|
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD, "hp", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL,
|
||||||
" 49g+" );
|
" 49g+" );
|
||||||
|
|
||||||
x49gp_ui_draw_text( cr, &widget->style->black, X49GP_UI_NORMAL_FONT, 13.0, 0.0, 14 /* 38 */, 34 /* 56 */, 1,
|
x49gp_ui_draw_text( cr, >k_widget_get_style( widget )->black, X49GP_UI_NORMAL_FONT, 13.0, 0.0, 14 /* 38 */, 34 /* 56 */, 1,
|
||||||
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "graphing calculator" );
|
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "graphing calculator" );
|
||||||
|
|
||||||
x49gp_ui_draw_symbol( cr, &widget->style->black, 10.0, 0.0, true, 114 /* 138 */, 8 /* 25 */,
|
x49gp_ui_draw_symbol( cr, >k_widget_get_style( widget )->black, 10.0, 0.0, true, 114 /* 138 */, 8 /* 25 */,
|
||||||
symbol_get_by_name( "triangleup" ) );
|
symbol_get_by_name( "triangleup" ) );
|
||||||
|
|
||||||
left_color = UI_COLOR_GREEN;
|
left_color = UI_COLOR_GREEN;
|
||||||
|
@ -3065,14 +3071,14 @@ static int x49gp_window_configure_event( GtkWidget* widget, GdkEventConfigure* e
|
||||||
|
|
||||||
case UI_CALCULATOR_HP50G:
|
case UI_CALCULATOR_HP50G:
|
||||||
case UI_CALCULATOR_HP50G_NEWRPL:
|
case UI_CALCULATOR_HP50G_NEWRPL:
|
||||||
x49gp_ui_draw_text( cr, &widget->style->white, X49GP_UI_NORMAL_FONT, 15.0, 0.0, 14 /* 38 */, 20 /* 42 */, 2,
|
x49gp_ui_draw_text( cr, >k_widget_get_style( widget )->white, X49GP_UI_NORMAL_FONT, 15.0, 0.0, 14 /* 38 */, 20 /* 42 */, 2,
|
||||||
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "HP", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL,
|
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "HP", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL,
|
||||||
" 50g" );
|
" 50g" );
|
||||||
|
|
||||||
x49gp_ui_draw_text( cr, &widget->style->white, X49GP_UI_NORMAL_FONT, 13.0, 0.0, 14 /* 38 */, 34 /* 56 */, 1,
|
x49gp_ui_draw_text( cr, >k_widget_get_style( widget )->white, X49GP_UI_NORMAL_FONT, 13.0, 0.0, 14 /* 38 */, 34 /* 56 */, 1,
|
||||||
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "Graphing Calculator" );
|
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "Graphing Calculator" );
|
||||||
|
|
||||||
x49gp_ui_draw_symbol( cr, &widget->style->white, 10.0, 0.0, true, 134 /* 168 */, 8 /* 25 */,
|
x49gp_ui_draw_symbol( cr, >k_widget_get_style( widget )->white, 10.0, 0.0, true, 134 /* 168 */, 8 /* 25 */,
|
||||||
symbol_get_by_name( "triangleup" ) );
|
symbol_get_by_name( "triangleup" ) );
|
||||||
|
|
||||||
left_color = UI_COLOR_WHITE;
|
left_color = UI_COLOR_WHITE;
|
||||||
|
@ -3129,15 +3135,12 @@ static int x49gp_window_configure_event( GtkWidget* widget, GdkEventConfigure* e
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG_LAYOUT /* Debug Button Layout */
|
#if DEBUG_LAYOUT /* Debug Button Layout */
|
||||||
gdk_draw_rectangle(ui->bg_pixmap, ui->window->style->white_gc,
|
gdk_draw_rectangle( ui->bg_pixmap, gtk_widget_get_style( ui->window )->white_gc, false, ui->kb_x_offset + key->x, ui->kb_y_offset + key->y,
|
||||||
false,
|
key->width, key->height );
|
||||||
ui->kb_x_offset + key->x,
|
|
||||||
ui->kb_y_offset + key->y,
|
|
||||||
key->width, key->height);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_window_set_back_pixmap( widget->window, ui->bg_pixmap, false );
|
gdk_window_set_back_pixmap( gtk_widget_get_window( widget ), ui->bg_pixmap, false );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3148,8 +3151,8 @@ static gboolean x49gp_window_button_press( GtkWidget* widget, GdkEventButton* ev
|
||||||
fprintf( stderr, "%s:%u: type %u, button %u\n", __FUNCTION__, __LINE__, event->type, event->button );
|
fprintf( stderr, "%s:%u: type %u, button %u\n", __FUNCTION__, __LINE__, event->type, event->button );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gdk_window_focus( widget->window, event->time );
|
gdk_window_focus( gtk_widget_get_window( widget ), event->time );
|
||||||
gdk_window_raise( widget->window );
|
gdk_window_raise( gtk_widget_get_window( widget ) );
|
||||||
|
|
||||||
if ( event->type != GDK_BUTTON_PRESS )
|
if ( event->type != GDK_BUTTON_PRESS )
|
||||||
return false;
|
return false;
|
||||||
|
@ -3157,7 +3160,7 @@ static gboolean x49gp_window_button_press( GtkWidget* widget, GdkEventButton* ev
|
||||||
if ( event->button != 1 )
|
if ( event->button != 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gdk_window_begin_move_drag( widget->window, event->button, event->x_root, event->y_root, event->time );
|
gdk_window_begin_move_drag( gtk_widget_get_window( widget ), event->button, event->x_root, event->y_root, event->time );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3367,7 +3370,7 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
||||||
|
|
||||||
if ( key->label ) {
|
if ( key->label ) {
|
||||||
button->label = gtk_label_new( "" );
|
button->label = gtk_label_new( "" );
|
||||||
gtk_widget_set_style( button->label, button->button->style );
|
gtk_widget_set_style( button->label, gtk_widget_get_style( button->button ) );
|
||||||
gtk_container_add( GTK_CONTAINER( button->button ), button->label );
|
gtk_container_add( GTK_CONTAINER( button->button ), button->label );
|
||||||
|
|
||||||
g_signal_connect( G_OBJECT( button->label ), "expose-event", G_CALLBACK( x49gp_button_expose_event ), button );
|
g_signal_connect( G_OBJECT( button->label ), "expose-event", G_CALLBACK( x49gp_button_expose_event ), button );
|
||||||
|
|
Loading…
Reference in a new issue