forked from Miroirs/x49gp
annunciators are GtkLabel()s
This commit is contained in:
parent
a524adfe73
commit
3704e4c5cc
10 changed files with 84 additions and 384 deletions
|
@ -1,5 +0,0 @@
|
||||||
#define ann_alpha_width 15
|
|
||||||
#define ann_alpha_height 12
|
|
||||||
static unsigned char ann_alpha_bits[] = {
|
|
||||||
0xe0, 0x03, 0x18, 0x44, 0x0c, 0x4c, 0x06, 0x2c, 0x07, 0x2c, 0x07, 0x1c,
|
|
||||||
0x07, 0x0c, 0x07, 0x0c, 0x07, 0x0e, 0x0e, 0x4d, 0xf8, 0x38, 0x00, 0x00};
|
|
|
@ -1,5 +0,0 @@
|
||||||
#define ann_battery_width 15
|
|
||||||
#define ann_battery_height 12
|
|
||||||
static unsigned char ann_battery_bits[] = {
|
|
||||||
0x04, 0x10, 0x02, 0x20, 0x12, 0x24, 0x09, 0x48, 0xc9, 0x49, 0xc9, 0x49,
|
|
||||||
0xc9, 0x49, 0x09, 0x48, 0x12, 0x24, 0x02, 0x20, 0x04, 0x10, 0x00, 0x00};
|
|
|
@ -1,5 +0,0 @@
|
||||||
#define ann_busy_width 15
|
|
||||||
#define ann_busy_height 12
|
|
||||||
static unsigned char ann_busy_bits[] = {
|
|
||||||
0xfc, 0x1f, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,
|
|
||||||
0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0xc8, 0x09, 0xe8, 0x0b, 0xfc, 0x1f};
|
|
|
@ -1,5 +0,0 @@
|
||||||
#define ann_io_width 15
|
|
||||||
#define ann_io_height 12
|
|
||||||
static unsigned char ann_io_bits[] = {
|
|
||||||
0x0c, 0x00, 0x1e, 0x00, 0x33, 0x0c, 0x61, 0x18, 0xcc, 0x30, 0xfe, 0x7f,
|
|
||||||
0xfe, 0x7f, 0xcc, 0x30, 0x61, 0x18, 0x33, 0x0c, 0x1e, 0x00, 0x0c, 0x00};
|
|
|
@ -1,5 +0,0 @@
|
||||||
#define ann_left_width 15
|
|
||||||
#define ann_left_height 12
|
|
||||||
static unsigned char ann_left_bits[] = {
|
|
||||||
0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78,
|
|
||||||
0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33};
|
|
|
@ -1,5 +0,0 @@
|
||||||
#define ann_right_width 15
|
|
||||||
#define ann_right_height 12
|
|
||||||
static unsigned char ann_right_bits[] = {
|
|
||||||
0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60,
|
|
||||||
0x07, 0x60, 0xe7, 0x73, 0xe7, 0x79, 0xe7, 0x7c, 0xe7, 0x7f, 0xe6, 0x3f};
|
|
181
src/x49gpng/ui.c
181
src/x49gpng/ui.c
|
@ -19,7 +19,6 @@
|
||||||
#include "x49gp.h"
|
#include "x49gp.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "s3c2410.h"
|
#include "s3c2410.h"
|
||||||
#include "ui_bitmaps.h"
|
|
||||||
|
|
||||||
#include "gdbstub.h"
|
#include "gdbstub.h"
|
||||||
|
|
||||||
|
@ -1571,24 +1570,6 @@ static int redraw_lcd( GtkWidget* widget, GdkEventExpose* event, gpointer user_d
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget* create_annunciator_widget( x49gp_ui_t* ui, const char* label )
|
|
||||||
{
|
|
||||||
GtkWidget* ui_ann = gtk_label_new( NULL );
|
|
||||||
|
|
||||||
PangoAttrList* pango_attributes = ui_load__pango_attrs_common_new();
|
|
||||||
pango_attr_list_insert( pango_attributes, pango_attr_size_new( ( 12.0 / 1.8 ) * PANGO_SCALE ) );
|
|
||||||
pango_attr_list_insert( pango_attributes, pango_attr_weight_new( PANGO_WEIGHT_BOLD ) );
|
|
||||||
GdkColor* fgcolor = &( ui->colors[ UI_COLOR_BLACK ] );
|
|
||||||
pango_attr_list_insert( pango_attributes, pango_attr_foreground_new( fgcolor->red, fgcolor->green, fgcolor->blue ) );
|
|
||||||
|
|
||||||
gtk_label_set_attributes( GTK_LABEL( ui_ann ), pango_attributes );
|
|
||||||
|
|
||||||
gtk_label_set_use_markup( GTK_LABEL( ui_ann ), true );
|
|
||||||
gtk_label_set_markup( GTK_LABEL( ui_ann ), label );
|
|
||||||
|
|
||||||
return ui_ann;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int draw_lcd( GtkWidget* widget, GdkEventConfigure* event, gpointer user_data )
|
static int draw_lcd( GtkWidget* widget, GdkEventConfigure* event, gpointer user_data )
|
||||||
{
|
{
|
||||||
x49gp_t* x49gp = user_data;
|
x49gp_t* x49gp = user_data;
|
||||||
|
@ -1597,24 +1578,6 @@ static int draw_lcd( GtkWidget* widget, GdkEventConfigure* event, gpointer user_
|
||||||
if ( NULL != ui->lcd_pixmap )
|
if ( NULL != ui->lcd_pixmap )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* FIXME: render this using unicode labels too */
|
|
||||||
const cairo_format_t cairo_fmt = CAIRO_FORMAT_A1;
|
|
||||||
int stride = cairo_format_stride_for_width( cairo_fmt, 12 );
|
|
||||||
ui->ann_left_surface = cairo_image_surface_create_for_data( ann_left_bits, cairo_fmt, ann_left_width, ann_left_height, stride );
|
|
||||||
ui->ann_right_surface = cairo_image_surface_create_for_data( ann_right_bits, cairo_fmt, ann_right_width, ann_right_height, stride );
|
|
||||||
ui->ann_alpha_surface = cairo_image_surface_create_for_data( ann_alpha_bits, cairo_fmt, ann_alpha_width, ann_alpha_height, stride );
|
|
||||||
ui->ann_battery_surface =
|
|
||||||
cairo_image_surface_create_for_data( ann_battery_bits, cairo_fmt, ann_battery_width, ann_battery_height, stride );
|
|
||||||
ui->ann_busy_surface = cairo_image_surface_create_for_data( ann_busy_bits, cairo_fmt, ann_busy_width, ann_busy_height, stride );
|
|
||||||
ui->ann_io_surface = cairo_image_surface_create_for_data( ann_io_bits, cairo_fmt, ann_io_width, ann_io_height, stride );
|
|
||||||
|
|
||||||
ui->ui_ann_left = create_annunciator_widget( ui, "⮢" );
|
|
||||||
ui->ui_ann_right = create_annunciator_widget( ui, "⮣" );
|
|
||||||
ui->ui_ann_alpha = create_annunciator_widget( ui, "α" );
|
|
||||||
ui->ui_ann_battery = create_annunciator_widget( ui, "🪫" );
|
|
||||||
ui->ui_ann_busy = create_annunciator_widget( ui, "⌛" );
|
|
||||||
ui->ui_ann_io = create_annunciator_widget( ui, "⇄" );
|
|
||||||
|
|
||||||
ui->lcd_pixmap = gdk_pixmap_new( gtk_widget_get_window( ui->lcd_canvas ), 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 );
|
||||||
|
|
||||||
cairo_t* cr = gdk_cairo_create( ui->lcd_pixmap );
|
cairo_t* cr = gdk_cairo_create( ui->lcd_pixmap );
|
||||||
|
@ -1770,6 +1733,24 @@ static void ui_load__style_button( x49gp_ui_t* ui, x49gp_ui_button_t* button )
|
||||||
gtk_widget_set_style( button->button, style );
|
gtk_widget_set_style( button->button, style );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkWidget* _ui_load__create_annunciator_widget( x49gp_ui_t* ui, const char* label )
|
||||||
|
{
|
||||||
|
GtkWidget* ui_ann = gtk_label_new( NULL );
|
||||||
|
|
||||||
|
PangoAttrList* pango_attributes = ui_load__pango_attrs_common_new();
|
||||||
|
pango_attr_list_insert( pango_attributes, pango_attr_size_new( ( 12.0 / 1.8 ) * PANGO_SCALE ) );
|
||||||
|
pango_attr_list_insert( pango_attributes, pango_attr_weight_new( PANGO_WEIGHT_BOLD ) );
|
||||||
|
GdkColor* fgcolor = &( ui->colors[ UI_COLOR_GRAYSCALE_0 ] );
|
||||||
|
pango_attr_list_insert( pango_attributes, pango_attr_foreground_new( fgcolor->red, fgcolor->green, fgcolor->blue ) );
|
||||||
|
|
||||||
|
gtk_label_set_attributes( GTK_LABEL( ui_ann ), pango_attributes );
|
||||||
|
|
||||||
|
gtk_label_set_use_markup( GTK_LABEL( ui_ann ), true );
|
||||||
|
gtk_label_set_markup( GTK_LABEL( ui_ann ), label );
|
||||||
|
|
||||||
|
return ui_ann;
|
||||||
|
}
|
||||||
|
|
||||||
static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
||||||
{
|
{
|
||||||
x49gp_t* x49gp = module->x49gp;
|
x49gp_t* x49gp = module->x49gp;
|
||||||
|
@ -1829,22 +1810,26 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set coordinates of LCD and keyboard */
|
/* set coordinates of LCD and keyboard */
|
||||||
|
int annunciator_height = 16;
|
||||||
{
|
{
|
||||||
ui->lcd_annunciators_height = 16;
|
|
||||||
ui->lcd_width = 131 * LCD_PIXEL_SCALE;
|
ui->lcd_width = 131 * LCD_PIXEL_SCALE;
|
||||||
ui->lcd_height = ( 80 * LCD_PIXEL_SCALE ) + ui->lcd_annunciators_height;
|
ui->lcd_height = 80 * LCD_PIXEL_SCALE;
|
||||||
ui->lcd_x_offset = ui->lcd_y_offset = 20;
|
ui->lcd_x_offset = ui->annunciators_x_offset = ui->annunciators_y_offset = 20;
|
||||||
|
|
||||||
ui->kb_x_offset = 10;
|
ui->kb_x_offset = 10;
|
||||||
ui->kb_y_offset = ui->lcd_height + ( 3 * ui->lcd_y_offset );
|
|
||||||
|
|
||||||
ui->width = ui->lcd_width + ( 2 * ui->lcd_x_offset );
|
|
||||||
ui->height = ui->kb_y_offset + ui_keys[ NB_KEYS - 1 ].y + KB_LINE_HEIGHT;
|
|
||||||
int kb_width = ( ui->kb_x_offset ) + ( 5 * KB_COLUMN_WIDTH_5_KEYS );
|
int kb_width = ( ui->kb_x_offset ) + ( 5 * KB_COLUMN_WIDTH_5_KEYS );
|
||||||
if ( ui->width < kb_width ) {
|
if ( ui->width < kb_width ) {
|
||||||
ui->width = kb_width;
|
ui->width = kb_width;
|
||||||
ui->lcd_x_offset = ui->lcd_y_offset = ( ui->width - ui->lcd_width ) / 2;
|
ui->lcd_x_offset = ui->annunciators_x_offset = ui->annunciators_y_offset = ( ui->width - ui->lcd_width ) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->lcd_y_offset = ui->annunciators_y_offset + annunciator_height;
|
||||||
|
|
||||||
|
ui->kb_y_offset = ui->lcd_height + ( 2 * ui->lcd_y_offset );
|
||||||
|
|
||||||
|
ui->width = ui->lcd_width + ( 2 * ui->lcd_x_offset );
|
||||||
|
ui->height = ui->kb_y_offset + ui_keys[ NB_KEYS - 1 ].y + KB_LINE_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create window and widgets/stuff
|
// create window and widgets/stuff
|
||||||
|
@ -1867,22 +1852,56 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
||||||
gtk_widget_modify_bg( ui->window, GTK_STATE_NORMAL, &( ui->colors[ faceplate_color ] ) );
|
gtk_widget_modify_bg( ui->window, GTK_STATE_NORMAL, &( ui->colors[ faceplate_color ] ) );
|
||||||
gtk_container_add( GTK_CONTAINER( ui->window ), fixed_widgets_container );
|
gtk_container_add( GTK_CONTAINER( ui->window ), fixed_widgets_container );
|
||||||
|
|
||||||
|
g_signal_connect( G_OBJECT( ui->window ), "focus-out-event", G_CALLBACK( react_to_focus_lost ), x49gp );
|
||||||
|
g_signal_connect( G_OBJECT( ui->window ), "key-press-event", G_CALLBACK( react_to_key_event ), x49gp );
|
||||||
|
g_signal_connect( G_OBJECT( ui->window ), "key-release-event", G_CALLBACK( react_to_key_event ), x49gp );
|
||||||
|
g_signal_connect( G_OBJECT( ui->window ), "button-press-event", G_CALLBACK( react_to_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 );
|
||||||
|
gtk_widget_add_events( ui->window, GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK );
|
||||||
|
|
||||||
ui->lcd_canvas = gtk_drawing_area_new();
|
ui->lcd_canvas = gtk_drawing_area_new();
|
||||||
gtk_drawing_area_size( GTK_DRAWING_AREA( ui->lcd_canvas ), ui->lcd_width, ui->lcd_height );
|
gtk_widget_set_size_request( ui->lcd_canvas, ui->lcd_width, ui->lcd_height );
|
||||||
|
g_signal_connect( G_OBJECT( ui->lcd_canvas ), "expose-event", G_CALLBACK( redraw_lcd ), x49gp );
|
||||||
GtkStyle* lcd_canvas_style = gtk_style_new();
|
g_signal_connect( G_OBJECT( ui->lcd_canvas ), "configure-event", G_CALLBACK( draw_lcd ), x49gp );
|
||||||
|
|
||||||
for ( int i = 0; i < 5; i++ ) {
|
|
||||||
lcd_canvas_style->bg[ i ] = ui->colors[ UI_COLOR_GRAYSCALE_0 ];
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_set_style( ui->lcd_canvas, lcd_canvas_style );
|
|
||||||
|
|
||||||
gtk_event_box_set_visible_window( GTK_EVENT_BOX( lcd_canvas_container ), true );
|
gtk_event_box_set_visible_window( GTK_EVENT_BOX( lcd_canvas_container ), true );
|
||||||
gtk_event_box_set_above_child( GTK_EVENT_BOX( lcd_canvas_container ), false );
|
gtk_event_box_set_above_child( GTK_EVENT_BOX( lcd_canvas_container ), false );
|
||||||
gtk_container_add( GTK_CONTAINER( lcd_canvas_container ), ui->lcd_canvas );
|
gtk_container_add( GTK_CONTAINER( lcd_canvas_container ), ui->lcd_canvas );
|
||||||
gtk_widget_set_size_request( lcd_canvas_container, ui->lcd_width, ui->lcd_height );
|
gtk_widget_set_size_request( lcd_canvas_container, ui->lcd_width, ui->lcd_height );
|
||||||
gtk_fixed_put( GTK_FIXED( fixed_widgets_container ), lcd_canvas_container, ui->lcd_x_offset, ui->lcd_y_offset );
|
gtk_fixed_put( GTK_FIXED( fixed_widgets_container ), lcd_canvas_container, ui->lcd_x_offset, ui->lcd_y_offset );
|
||||||
|
g_signal_connect( G_OBJECT( lcd_canvas_container ), "button-press-event", G_CALLBACK( do_show_context_menu ), x49gp );
|
||||||
|
|
||||||
|
ui->ui_ann_left = _ui_load__create_annunciator_widget( ui, "⮢" );
|
||||||
|
ui->ui_ann_right = _ui_load__create_annunciator_widget( ui, "⮣" );
|
||||||
|
ui->ui_ann_alpha = _ui_load__create_annunciator_widget( ui, "α" );
|
||||||
|
ui->ui_ann_battery = _ui_load__create_annunciator_widget( ui, "🪫" );
|
||||||
|
ui->ui_ann_busy = _ui_load__create_annunciator_widget( ui, "⌛" );
|
||||||
|
ui->ui_ann_io = _ui_load__create_annunciator_widget( ui, "⇄" );
|
||||||
|
|
||||||
|
GtkWidget* fixed_annunciators_container = gtk_fixed_new();
|
||||||
|
gtk_widget_modify_bg( fixed_annunciators_container, GTK_STATE_NORMAL, &( ui->colors[ UI_COLOR_GRAYSCALE_0 ] ) );
|
||||||
|
gtk_widget_set_size_request( fixed_annunciators_container, ui->lcd_width, annunciator_height );
|
||||||
|
gtk_fixed_put( GTK_FIXED( fixed_widgets_container ), fixed_annunciators_container, ui->annunciators_x_offset,
|
||||||
|
ui->annunciators_y_offset );
|
||||||
|
|
||||||
|
gtk_widget_set_size_request( ui->ui_ann_left, 15, annunciator_height );
|
||||||
|
gtk_fixed_put( GTK_FIXED( fixed_annunciators_container ), ui->ui_ann_left, 11, 0 );
|
||||||
|
|
||||||
|
gtk_widget_set_size_request( ui->ui_ann_right, 15, annunciator_height );
|
||||||
|
gtk_fixed_put( GTK_FIXED( fixed_annunciators_container ), ui->ui_ann_right, 56, 0 );
|
||||||
|
|
||||||
|
gtk_widget_set_size_request( ui->ui_ann_alpha, 15, annunciator_height );
|
||||||
|
gtk_fixed_put( GTK_FIXED( fixed_annunciators_container ), ui->ui_ann_alpha, 101, 0 );
|
||||||
|
|
||||||
|
gtk_widget_set_size_request( ui->ui_ann_battery, 15, annunciator_height );
|
||||||
|
gtk_fixed_put( GTK_FIXED( fixed_annunciators_container ), ui->ui_ann_battery, 146, 0 );
|
||||||
|
|
||||||
|
gtk_widget_set_size_request( ui->ui_ann_busy, 15, annunciator_height );
|
||||||
|
gtk_fixed_put( GTK_FIXED( fixed_annunciators_container ), ui->ui_ann_busy, 191, 0 );
|
||||||
|
|
||||||
|
gtk_widget_set_size_request( ui->ui_ann_io, 15, annunciator_height );
|
||||||
|
gtk_fixed_put( GTK_FIXED( fixed_annunciators_container ), ui->ui_ann_io, 236, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// keyboard
|
// keyboard
|
||||||
|
@ -2103,23 +2122,6 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
||||||
gtk_widget_show_all( ui->menu );
|
gtk_widget_show_all( ui->menu );
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup signals and events
|
|
||||||
{
|
|
||||||
g_signal_connect( G_OBJECT( ui->lcd_canvas ), "expose-event", G_CALLBACK( redraw_lcd ), x49gp );
|
|
||||||
g_signal_connect( G_OBJECT( ui->lcd_canvas ), "configure-event", G_CALLBACK( draw_lcd ), x49gp );
|
|
||||||
|
|
||||||
g_signal_connect( G_OBJECT( ui->window ), "focus-out-event", G_CALLBACK( react_to_focus_lost ), x49gp );
|
|
||||||
g_signal_connect( G_OBJECT( ui->window ), "key-press-event", G_CALLBACK( react_to_key_event ), x49gp );
|
|
||||||
g_signal_connect( G_OBJECT( ui->window ), "key-release-event", G_CALLBACK( react_to_key_event ), x49gp );
|
|
||||||
g_signal_connect( G_OBJECT( ui->window ), "button-press-event", G_CALLBACK( react_to_window_click ), x49gp );
|
|
||||||
|
|
||||||
g_signal_connect( G_OBJECT( lcd_canvas_container ), "button-press-event", G_CALLBACK( do_show_context_menu ), 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 );
|
|
||||||
|
|
||||||
gtk_widget_add_events( ui->window, GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK );
|
|
||||||
}
|
|
||||||
|
|
||||||
// finally show the window
|
// finally show the window
|
||||||
gtk_widget_show_all( ui->window );
|
gtk_widget_show_all( ui->window );
|
||||||
|
|
||||||
|
@ -2139,16 +2141,6 @@ static void _draw_pixel( GdkPixmap* target, int x, int y, int w, int h, GdkColor
|
||||||
cairo_destroy( cr );
|
cairo_destroy( cr );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _draw_annunciator( GdkPixmap* target, cairo_surface_t* surface, int x, int y, int w, int h, GdkColor* color )
|
|
||||||
{
|
|
||||||
cairo_t* cr = gdk_cairo_create( target );
|
|
||||||
|
|
||||||
cairo_set_source_rgb( cr, color->red / 65535.0, color->green / 65535.0, color->blue / 65535.0 );
|
|
||||||
cairo_mask_surface( cr, surface, x, y );
|
|
||||||
|
|
||||||
cairo_destroy( cr );
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************/
|
/********************/
|
||||||
/* Public functions */
|
/* Public functions */
|
||||||
/********************/
|
/********************/
|
||||||
|
@ -2159,29 +2151,16 @@ void gui_update_lcd( x49gp_t* x49gp )
|
||||||
s3c2410_lcd_t* lcd = x49gp->s3c2410_lcd;
|
s3c2410_lcd_t* lcd = x49gp->s3c2410_lcd;
|
||||||
|
|
||||||
if ( lcd->lcdcon1 & 1 ) {
|
if ( lcd->lcdcon1 & 1 ) {
|
||||||
GdkColor color;
|
gtk_widget_set_visible( ui->ui_ann_left, x49gp_get_pixel_color( lcd, 131, 1 ) > 0 );
|
||||||
|
gtk_widget_set_visible( ui->ui_ann_right, x49gp_get_pixel_color( lcd, 131, 2 ) > 0 );
|
||||||
|
gtk_widget_set_visible( ui->ui_ann_alpha, x49gp_get_pixel_color( lcd, 131, 3 ) > 0 );
|
||||||
|
gtk_widget_set_visible( ui->ui_ann_battery, x49gp_get_pixel_color( lcd, 131, 4 ) > 0 );
|
||||||
|
gtk_widget_set_visible( ui->ui_ann_busy, x49gp_get_pixel_color( lcd, 131, 5 ) > 0 );
|
||||||
|
gtk_widget_set_visible( ui->ui_ann_io, x49gp_get_pixel_color( lcd, 131, 0 ) > 0 );
|
||||||
|
|
||||||
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 1 ) ];
|
for ( int y = 0; y < ( ui->lcd_height / LCD_PIXEL_SCALE ); y++ )
|
||||||
_draw_annunciator( ui->lcd_pixmap, ui->ann_left_surface, 11, 0, 15, 12, &color );
|
|
||||||
|
|
||||||
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 2 ) ];
|
|
||||||
_draw_annunciator( ui->lcd_pixmap, ui->ann_right_surface, 56, 0, 15, 12, &color );
|
|
||||||
|
|
||||||
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 3 ) ];
|
|
||||||
_draw_annunciator( ui->lcd_pixmap, ui->ann_alpha_surface, 101, 0, 15, 12, &color );
|
|
||||||
|
|
||||||
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 4 ) ];
|
|
||||||
_draw_annunciator( ui->lcd_pixmap, ui->ann_battery_surface, 146, 0, 15, 12, &color );
|
|
||||||
|
|
||||||
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 5 ) ];
|
|
||||||
_draw_annunciator( ui->lcd_pixmap, ui->ann_busy_surface, 191, 0, 15, 12, &color );
|
|
||||||
|
|
||||||
color = ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, 131, 0 ) ];
|
|
||||||
_draw_annunciator( ui->lcd_pixmap, ui->ann_io_surface, 236, 0, 15, 12, &color );
|
|
||||||
|
|
||||||
for ( int y = 0; y < ( ( ui->lcd_height - ui->lcd_annunciators_height ) / LCD_PIXEL_SCALE ); y++ )
|
|
||||||
for ( int x = 0; x < ( ui->lcd_width / LCD_PIXEL_SCALE ); x++ )
|
for ( int x = 0; x < ( ui->lcd_width / LCD_PIXEL_SCALE ); x++ )
|
||||||
_draw_pixel( ui->lcd_pixmap, LCD_PIXEL_SCALE * x, LCD_PIXEL_SCALE * y + ui->lcd_annunciators_height, LCD_PIXEL_SCALE,
|
_draw_pixel( ui->lcd_pixmap, LCD_PIXEL_SCALE * x, LCD_PIXEL_SCALE * y, LCD_PIXEL_SCALE,
|
||||||
LCD_PIXEL_SCALE, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, x, y ) ] ) );
|
LCD_PIXEL_SCALE, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, x, y ) ] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,13 +94,7 @@ struct __x49gp_ui_s__ {
|
||||||
|
|
||||||
GtkWidget* lcd_canvas;
|
GtkWidget* lcd_canvas;
|
||||||
GdkPixmap* lcd_pixmap; /* FIXME */
|
GdkPixmap* lcd_pixmap; /* FIXME */
|
||||||
|
cairo_surface_t* lcd_surface;
|
||||||
cairo_surface_t* ann_left_surface;
|
|
||||||
cairo_surface_t* ann_right_surface;
|
|
||||||
cairo_surface_t* ann_alpha_surface;
|
|
||||||
cairo_surface_t* ann_battery_surface;
|
|
||||||
cairo_surface_t* ann_busy_surface;
|
|
||||||
cairo_surface_t* ann_io_surface;
|
|
||||||
|
|
||||||
GtkWidget* ui_ann_left;
|
GtkWidget* ui_ann_left;
|
||||||
GtkWidget* ui_ann_right;
|
GtkWidget* ui_ann_right;
|
||||||
|
@ -115,11 +109,13 @@ struct __x49gp_ui_s__ {
|
||||||
gint kb_x_offset;
|
gint kb_x_offset;
|
||||||
gint kb_y_offset;
|
gint kb_y_offset;
|
||||||
|
|
||||||
|
gint annunciators_x_offset;
|
||||||
|
gint annunciators_y_offset;
|
||||||
|
|
||||||
gint lcd_x_offset;
|
gint lcd_x_offset;
|
||||||
gint lcd_y_offset;
|
gint lcd_y_offset;
|
||||||
gint lcd_width;
|
gint lcd_width;
|
||||||
gint lcd_height;
|
gint lcd_height;
|
||||||
gint lcd_annunciators_height;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void gui_update_lcd( x49gp_t* x49gp );
|
void gui_update_lcd( x49gp_t* x49gp );
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef _X49GP_BITMAPS_H
|
|
||||||
#define _X49GP_BITMAPS_H 1
|
|
||||||
|
|
||||||
#include "bitmaps/ann_left.xbm"
|
|
||||||
#include "bitmaps/ann_right.xbm"
|
|
||||||
#include "bitmaps/ann_alpha.xbm"
|
|
||||||
#include "bitmaps/ann_battery.xbm"
|
|
||||||
#include "bitmaps/ann_busy.xbm"
|
|
||||||
#include "bitmaps/ann_io.xbm"
|
|
||||||
|
|
||||||
#endif /* !(_X49GP_BITMAPS_H) */
|
|
|
@ -1,234 +0,0 @@
|
||||||
#ifndef _X49GP_GLYPHNAME_H
|
|
||||||
#define _X49GP_GLYPHNAME_H 1
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const char* name;
|
|
||||||
gunichar unichar;
|
|
||||||
} x49gp_glyph_t;
|
|
||||||
|
|
||||||
static const x49gp_glyph_t x49gp_glyphs[] = {
|
|
||||||
{"exclamdown", 0x00a1},
|
|
||||||
{"cent", 0x00a2},
|
|
||||||
{"sterling", 0x00a3},
|
|
||||||
{"fraction", 0x2044},
|
|
||||||
{"yen", 0x00a5},
|
|
||||||
{"florin", 0x0192},
|
|
||||||
{"section", 0x00a7},
|
|
||||||
{"currency", 0x00a4},
|
|
||||||
{"quotesingle", 0x0027},
|
|
||||||
{"quotedblleft", 0x201c},
|
|
||||||
{"guillemotleft", 0x00ab},
|
|
||||||
{"guilsinglleft", 0x2039},
|
|
||||||
{"guilsinglright", 0x203a},
|
|
||||||
{"fi", 0xfb01},
|
|
||||||
{"fl", 0xfb02},
|
|
||||||
{"endash", 0x2013},
|
|
||||||
{"dagger", 0x2020},
|
|
||||||
{"daggerdbl", 0x2021},
|
|
||||||
{"periodcentered", 0x00b7},
|
|
||||||
{"paragraph", 0x00b6},
|
|
||||||
{"bullet", 0x2022},
|
|
||||||
{"quotesinglbase", 0x201a},
|
|
||||||
{"quotedblbase", 0x201e},
|
|
||||||
{"quotedblright", 0x201d},
|
|
||||||
{"guillemotright", 0x00bb},
|
|
||||||
{"ellipsis", 0x2026},
|
|
||||||
{"perthousand", 0x2030},
|
|
||||||
{"questiondown", 0x00bf},
|
|
||||||
{"grave", 0x0060},
|
|
||||||
{"acute", 0x00b4},
|
|
||||||
{"circumflex", 0x02c6},
|
|
||||||
{"tilde", 0x02dc},
|
|
||||||
{"macron", 0x00af},
|
|
||||||
{"breve", 0x02d8},
|
|
||||||
{"dotaccent", 0x02d9},
|
|
||||||
{"dieresis", 0x00a8},
|
|
||||||
{"ring", 0x02da},
|
|
||||||
{"cedilla", 0x00b8},
|
|
||||||
{"hungarumlaut", 0x02dd},
|
|
||||||
{"ogonek", 0x02db},
|
|
||||||
{"caron", 0x02c7},
|
|
||||||
{"emdash", 0x2014},
|
|
||||||
{"AE", 0x00c6},
|
|
||||||
{"ordfeminine", 0x00aa},
|
|
||||||
{"Lslash", 0x0141},
|
|
||||||
{"Oslash", 0x00d8},
|
|
||||||
{"OE", 0x0152},
|
|
||||||
{"ordmasculine", 0x00ba},
|
|
||||||
{"ae", 0x00e6},
|
|
||||||
{"dotlessi", 0x0131},
|
|
||||||
{"lslash", 0x0142},
|
|
||||||
{"oslash", 0x00f8},
|
|
||||||
{"oe", 0x0153},
|
|
||||||
{"germandbls", 0x00df},
|
|
||||||
{"Udieresis", 0x00dc},
|
|
||||||
{"Uacute", 0x00da},
|
|
||||||
{"Scedilla", 0x015e},
|
|
||||||
{"Tcaron", 0x0164},
|
|
||||||
{"Scaron", 0x0160},
|
|
||||||
{"Rcaron", 0x0158},
|
|
||||||
{"Racute", 0x0154},
|
|
||||||
{"Sacute", 0x015a},
|
|
||||||
{"Otilde", 0x00d5},
|
|
||||||
{"ucircumflex", 0x00fb},
|
|
||||||
{"Ohungarumlaut", 0x0150},
|
|
||||||
{"Uhungarumlaut", 0x0170},
|
|
||||||
{"Yacute", 0x00dd},
|
|
||||||
{"Eth", 0x00d0},
|
|
||||||
{"Dcroat", 0x0110},
|
|
||||||
{"Zacute", 0x0179},
|
|
||||||
{"Uring", 0x016e},
|
|
||||||
{"gbreve", 0x011f},
|
|
||||||
{"eogonek", 0x0119},
|
|
||||||
{"edotaccent", 0x0117},
|
|
||||||
{"ecaron", 0x011b},
|
|
||||||
{"Ugrave", 0x00d9},
|
|
||||||
{"Thorn", 0x00de},
|
|
||||||
{"eacute", 0x00e9},
|
|
||||||
{"edieresis", 0x00eb},
|
|
||||||
{"dcaron", 0x010f},
|
|
||||||
{"ccedilla", 0x00e7},
|
|
||||||
{"ccaron", 0x010d},
|
|
||||||
{"cacute", 0x0107},
|
|
||||||
{"aogonek", 0x0105},
|
|
||||||
{"aring", 0x00e5},
|
|
||||||
{"atilde", 0x00e3},
|
|
||||||
{"abreve", 0x0103},
|
|
||||||
{"egrave", 0x00e8},
|
|
||||||
{"agrave", 0x00e0},
|
|
||||||
{"aacute", 0x00e1},
|
|
||||||
{"adieresis", 0x00e4},
|
|
||||||
{"Uogonek", 0x0172},
|
|
||||||
{"ugrave", 0x00f9},
|
|
||||||
{"uacute", 0x00fa},
|
|
||||||
{"udieresis", 0x00fc},
|
|
||||||
{"tcaron", 0x0165},
|
|
||||||
{"scommaaccent", 0x0219},
|
|
||||||
{"Zcaron", 0x017d},
|
|
||||||
{"ecircumflex", 0x00ea},
|
|
||||||
{"Ucircumflex", 0x00db},
|
|
||||||
{"acircumflex", 0x00e2},
|
|
||||||
{"Zdotaccent", 0x017b},
|
|
||||||
{"scaron", 0x0161},
|
|
||||||
{"Amacron", 0x0100},
|
|
||||||
{"sacute", 0x015b},
|
|
||||||
{"Tcommaaccent", 0x0162},
|
|
||||||
{"Ydieresis", 0x0178},
|
|
||||||
{"thorn", 0x00fe},
|
|
||||||
{"Emacron", 0x0112},
|
|
||||||
{"Ograve", 0x00d2},
|
|
||||||
{"Oacute", 0x00d3},
|
|
||||||
{"Odieresis", 0x00d6},
|
|
||||||
{"Ntilde", 0x00d1},
|
|
||||||
{"Ncaron", 0x0147},
|
|
||||||
{"Nacute", 0x0143},
|
|
||||||
{"Lcaron", 0x013d},
|
|
||||||
{"Lacute", 0x0139},
|
|
||||||
{"Idotaccent", 0x0130},
|
|
||||||
{"racute", 0x0155},
|
|
||||||
{"Icircumflex", 0x00ce},
|
|
||||||
{"ohungarumlaut", 0x0151},
|
|
||||||
{"otilde", 0x00f5},
|
|
||||||
{"Euro", 0x20ac},
|
|
||||||
{"ocircumflex", 0x00f4},
|
|
||||||
{"onesuperior", 0x00b9},
|
|
||||||
{"twosuperior", 0x00b2},
|
|
||||||
{"threesuperior", 0x00b3},
|
|
||||||
{"Igrave", 0x00cc},
|
|
||||||
{"Iacute", 0x00cd},
|
|
||||||
{"Imacron", 0x012a},
|
|
||||||
{"Iogonek", 0x012e},
|
|
||||||
{"Idieresis", 0x00cf},
|
|
||||||
{"Gbreve", 0x011e},
|
|
||||||
{"Umacron", 0x016a},
|
|
||||||
{"Kcommaaccent", 0x0136},
|
|
||||||
{"ograve", 0x00f2},
|
|
||||||
{"Scommaaccent", 0x0218},
|
|
||||||
{"Eogonek", 0x0118},
|
|
||||||
{"oacute", 0x00f3},
|
|
||||||
{"Edotaccent", 0x0116},
|
|
||||||
{"iogonek", 0x012f},
|
|
||||||
{"gcommaaccent", 0x0123},
|
|
||||||
{"odieresis", 0x00f6},
|
|
||||||
{"ntilde", 0x00f1},
|
|
||||||
{"ncaron", 0x0148},
|
|
||||||
{"Ecaron", 0x011a},
|
|
||||||
{"Ecircumflex", 0x00ca},
|
|
||||||
{"scedilla", 0x015f},
|
|
||||||
{"rcaron", 0x0159},
|
|
||||||
{"Egrave", 0x00c8},
|
|
||||||
{"Eacute", 0x00c9},
|
|
||||||
{"Gcommaaccent", 0x0122},
|
|
||||||
{"Rcommaaccent", 0x0156},
|
|
||||||
{"Edieresis", 0x00cb},
|
|
||||||
{"nacute", 0x0144},
|
|
||||||
{"uogonek", 0x0173},
|
|
||||||
{"umacron", 0x016b},
|
|
||||||
{"Dcaron", 0x010e},
|
|
||||||
{"lcaron", 0x013e},
|
|
||||||
{"Ccaron", 0x010c},
|
|
||||||
{"Cacute", 0x0106},
|
|
||||||
{"Ccedilla", 0x00c7},
|
|
||||||
{"degree", 0x00b0},
|
|
||||||
{"Aogonek", 0x0104},
|
|
||||||
{"minus", 0x2212},
|
|
||||||
{"multiply", 0x00d7},
|
|
||||||
{"divide", 0x00f7},
|
|
||||||
{"Aring", 0x00c5},
|
|
||||||
{"trademark", 0x2122},
|
|
||||||
{"rcommaaccent", 0x0157},
|
|
||||||
{"lacute", 0x013a},
|
|
||||||
{"omacron", 0x014d},
|
|
||||||
{"Atilde", 0x00c3},
|
|
||||||
{"icircumflex", 0x00ee},
|
|
||||||
{"igrave", 0x00ec},
|
|
||||||
{"ncommaaccent", 0x0146},
|
|
||||||
{"lcommaaccent", 0x013c},
|
|
||||||
{"plusminus", 0x00b1},
|
|
||||||
{"onehalf", 0x00bd},
|
|
||||||
{"onequarter", 0x00bc},
|
|
||||||
{"threequarters", 0x00be},
|
|
||||||
{"iacute", 0x00ed},
|
|
||||||
{"Abreve", 0x0102},
|
|
||||||
{"kcommaaccent", 0x0137},
|
|
||||||
{"Omacron", 0x014c},
|
|
||||||
{"imacron", 0x012b},
|
|
||||||
{"emacron", 0x0113},
|
|
||||||
{"amacron", 0x0101},
|
|
||||||
{"tcommaaccent", 0x0163},
|
|
||||||
{"ydieresis", 0x00ff},
|
|
||||||
{"zdotaccent", 0x017c},
|
|
||||||
{"zcaron", 0x017e},
|
|
||||||
{"zacute", 0x017a},
|
|
||||||
{"yacute", 0x00fd},
|
|
||||||
{"uhungarumlaut", 0x0171},
|
|
||||||
{"eth", 0x00f0},
|
|
||||||
{"uring", 0x016f},
|
|
||||||
{"Ocircumflex", 0x00d4},
|
|
||||||
{"commaaccent", 0xf6c3},
|
|
||||||
{"copyright", 0x00a9},
|
|
||||||
{"registered", 0x00ae},
|
|
||||||
{"Acircumflex", 0x00c2},
|
|
||||||
{"idieresis", 0x00ef},
|
|
||||||
{"lozenge", 0x25ca},
|
|
||||||
{"Delta", 0x2206},
|
|
||||||
{"notequal", 0x2260},
|
|
||||||
{"radical", 0x221a},
|
|
||||||
{"Agrave", 0x00c0},
|
|
||||||
{"Aacute", 0x00c1},
|
|
||||||
{"lessequal", 0x2264},
|
|
||||||
{"greaterequal", 0x2265},
|
|
||||||
{"logicalnot", 0x00ac},
|
|
||||||
{"summation", 0x2211},
|
|
||||||
{"partialdiff", 0x2202},
|
|
||||||
{"Ncommaaccent", 0x0145},
|
|
||||||
{"dcroat", 0x0111},
|
|
||||||
{"brokenbar", 0x00a6},
|
|
||||||
{"Lcommaaccent", 0x013b},
|
|
||||||
{"Adieresis", 0x00c4},
|
|
||||||
{"mu", 0x00b5}
|
|
||||||
};
|
|
||||||
|
|
||||||
#define NR_GLYPHNAMES ( sizeof( x49gp_glyphs ) / sizeof( x49gp_glyphs[ 0 ] ) )
|
|
||||||
|
|
||||||
#endif /* !(_X49GP_GLYPHNAME_H) */
|
|
Loading…
Reference in a new issue