forked from Miroirs/x49gp
Compare commits
2 commits
3e37407a61
...
c9191b6c00
Author | SHA1 | Date | |
---|---|---|---|
|
c9191b6c00 | ||
|
b179f88451 |
3 changed files with 27 additions and 32 deletions
10
src/list.h
10
src/list.h
|
@ -97,8 +97,8 @@ static inline void __list_del( struct list_head* prev, struct list_head* next )
|
||||||
static inline void list_del( struct list_head* entry )
|
static inline void list_del( struct list_head* entry )
|
||||||
{
|
{
|
||||||
__list_del( entry->prev, entry->next );
|
__list_del( entry->prev, entry->next );
|
||||||
entry->next = (struct list_head*)LIST_POISON1;
|
entry->next = ( struct list_head* )LIST_POISON1;
|
||||||
entry->prev = (struct list_head*)LIST_POISON2;
|
entry->prev = ( struct list_head* )LIST_POISON2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -391,8 +391,8 @@ static inline void __hlist_del( struct hlist_node* n )
|
||||||
static inline void hlist_del( struct hlist_node* n )
|
static inline void hlist_del( struct hlist_node* n )
|
||||||
{
|
{
|
||||||
__hlist_del( n );
|
__hlist_del( n );
|
||||||
n->next = (struct hlist_node*)LIST_POISON1;
|
n->next = ( struct hlist_node* )LIST_POISON1;
|
||||||
n->pprev = (struct hlist_node**)LIST_POISON2;
|
n->pprev = ( struct hlist_node** )LIST_POISON2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -417,7 +417,7 @@ static inline void hlist_del( struct hlist_node* n )
|
||||||
static inline void hlist_del_rcu( struct hlist_node* n )
|
static inline void hlist_del_rcu( struct hlist_node* n )
|
||||||
{
|
{
|
||||||
__hlist_del( n );
|
__hlist_del( n );
|
||||||
n->pprev = (struct hlist_node**)LIST_POISON2;
|
n->pprev = ( struct hlist_node** )LIST_POISON2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void hlist_del_init( struct hlist_node* n )
|
static inline void hlist_del_init( struct hlist_node* n )
|
||||||
|
|
|
@ -283,20 +283,20 @@ static int x49gp_get_pixel_color( s3c2410_lcd_t* lcd, int x, int y )
|
||||||
|
|
||||||
void x49gp_draw_rectangle( GdkPixmap* target, int x, int y, int w, int h, GdkColor* color )
|
void x49gp_draw_rectangle( GdkPixmap* target, int x, int y, int w, int h, GdkColor* color )
|
||||||
{
|
{
|
||||||
cairo_t* cr = gdk_cairo_create (target);
|
cairo_t* cr = gdk_cairo_create( target );
|
||||||
cairo_set_source_rgb( cr, color->red, color->green, color->blue );
|
|
||||||
|
|
||||||
cairo_rectangle (cr, x, y, w, h );
|
cairo_set_source_rgb( cr, color->red / 65535.0, color->green / 65535.0, color->blue / 65535.0 );
|
||||||
cairo_fill (cr);
|
cairo_rectangle( cr, x, y, w, h );
|
||||||
|
cairo_fill( cr );
|
||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_destroy( cr );
|
||||||
}
|
}
|
||||||
|
|
||||||
void x49gp_lcd_update( x49gp_t* x49gp )
|
void x49gp_lcd_update( x49gp_t* x49gp )
|
||||||
{
|
{
|
||||||
x49gp_ui_t* ui = x49gp->ui;
|
x49gp_ui_t* ui = x49gp->ui;
|
||||||
s3c2410_lcd_t* lcd = x49gp->s3c2410_lcd;
|
s3c2410_lcd_t* lcd = x49gp->s3c2410_lcd;
|
||||||
//cairo_t* cr;
|
// cairo_t* cr;
|
||||||
|
|
||||||
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,
|
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 );
|
0, ui->lcd_width, ui->lcd_height );
|
||||||
|
@ -308,6 +308,11 @@ void x49gp_lcd_update( x49gp_t* x49gp )
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_left_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
gdk_gc_set_rgb_fg_color( ui->ann_left_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_left_gc, true, 11, 0, 15, 12 );
|
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_left_gc, true, 11, 0, 15, 12 );
|
||||||
|
|
||||||
|
/* cr = gdk_cairo_create( ui->ann_left ); */
|
||||||
|
/* gdk_cairo_set_source_pixbuf( cr, ui->lcd_pixmap, 11, 0 ); */
|
||||||
|
/* cairo_paint( cr ); */
|
||||||
|
/* cairo_destroy( cr ); */
|
||||||
|
|
||||||
color = x49gp_get_pixel_color( lcd, 131, 2 );
|
color = x49gp_get_pixel_color( lcd, 131, 2 );
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_right_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
gdk_gc_set_rgb_fg_color( ui->ann_right_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_right_gc, true, 56, 0, 15, 12 );
|
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_right_gc, true, 56, 0, 15, 12 );
|
||||||
|
@ -328,21 +333,11 @@ void x49gp_lcd_update( x49gp_t* x49gp )
|
||||||
gdk_gc_set_rgb_fg_color( ui->ann_io_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
gdk_gc_set_rgb_fg_color( ui->ann_io_gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) );
|
||||||
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_io_gc, true, 236, 0, 15, 12 );
|
gdk_draw_rectangle( ui->lcd_pixmap, ui->ann_io_gc, true, 236, 0, 15, 12 );
|
||||||
|
|
||||||
GdkGC* gc = gdk_gc_new( gtk_widget_get_window( ui->lcd_canvas ) );
|
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 y = 0; y < ( ui->lcd_height - ui->lcd_annunciators_height ) / LCD_PIXEL_SCALE; y++ ) {
|
x49gp_draw_rectangle( ui->lcd_pixmap, LCD_PIXEL_SCALE * x, LCD_PIXEL_SCALE * y + ui->lcd_annunciators_height,
|
||||||
for ( int x = 0; x < ui->lcd_width / LCD_PIXEL_SCALE; x++ ) {
|
LCD_PIXEL_SCALE, LCD_PIXEL_SCALE,
|
||||||
color = x49gp_get_pixel_color( lcd, x, y );
|
&(ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, x, y ) ]) );
|
||||||
/* gdk_gc_set_rgb_fg_color( gc, &( ui->colors[ UI_COLOR_GRAYSCALE_0 + color ] ) ); */
|
|
||||||
|
|
||||||
/* gdk_draw_rectangle( ui->lcd_pixmap, gc, true, LCD_PIXEL_SCALE * x, LCD_PIXEL_SCALE * y + ui->lcd_annunciators_height, */
|
|
||||||
/* LCD_PIXEL_SCALE, LCD_PIXEL_SCALE ); */
|
|
||||||
|
|
||||||
x49gp_draw_rectangle( ui->lcd_pixmap, LCD_PIXEL_SCALE * x, LCD_PIXEL_SCALE * y + ui->lcd_annunciators_height, LCD_PIXEL_SCALE, LCD_PIXEL_SCALE, &(ui->colors[ UI_COLOR_GRAYSCALE_0 + color ]) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref( gc );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
|
12
src/ui.c
12
src/ui.c
|
@ -3413,15 +3413,15 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
||||||
// {
|
// {
|
||||||
ui->menu = gtk_menu_new();
|
ui->menu = gtk_menu_new();
|
||||||
|
|
||||||
GtkWidget *menu_mount_folder = gtk_menu_item_new_with_label( "Mount SD folder ..." );
|
GtkWidget* menu_mount_folder = gtk_menu_item_new_with_label( "Mount SD folder ..." );
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_mount_folder );
|
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_mount_folder );
|
||||||
g_signal_connect( G_OBJECT( menu_mount_folder ), "activate", G_CALLBACK( x49gp_ui_mount_sd_folder ), x49gp );
|
g_signal_connect( G_OBJECT( menu_mount_folder ), "activate", G_CALLBACK( x49gp_ui_mount_sd_folder ), x49gp );
|
||||||
|
|
||||||
GtkWidget *menu_mount_image = gtk_menu_item_new_with_label( "Mount SD image ..." );
|
GtkWidget* menu_mount_image = gtk_menu_item_new_with_label( "Mount SD image ..." );
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_mount_image );
|
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_mount_image );
|
||||||
g_signal_connect( G_OBJECT( menu_mount_image ), "activate", G_CALLBACK( x49gp_ui_mount_sd_image ), x49gp );
|
g_signal_connect( G_OBJECT( menu_mount_image ), "activate", G_CALLBACK( x49gp_ui_mount_sd_image ), x49gp );
|
||||||
|
|
||||||
GtkWidget *menu_unmount = gtk_menu_item_new_with_label( "Unmount SD" );
|
GtkWidget* menu_unmount = gtk_menu_item_new_with_label( "Unmount SD" );
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_unmount );
|
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_unmount );
|
||||||
g_signal_connect_swapped( G_OBJECT( menu_unmount ), "activate", G_CALLBACK( s3c2410_sdi_unmount ), x49gp );
|
g_signal_connect_swapped( G_OBJECT( menu_unmount ), "activate", G_CALLBACK( s3c2410_sdi_unmount ), x49gp );
|
||||||
ui->menu_unmount = menu_unmount;
|
ui->menu_unmount = menu_unmount;
|
||||||
|
@ -3429,7 +3429,7 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
||||||
if ( x49gp->debug_port != 0 ) {
|
if ( x49gp->debug_port != 0 ) {
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), gtk_separator_menu_item_new() );
|
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), gtk_separator_menu_item_new() );
|
||||||
|
|
||||||
GtkWidget *menu_debug = gtk_menu_item_new_with_label( "Start debugger" );
|
GtkWidget* menu_debug = gtk_menu_item_new_with_label( "Start debugger" );
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_debug );
|
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_debug );
|
||||||
g_signal_connect( G_OBJECT( menu_debug ), "activate", G_CALLBACK( x49gp_ui_debug ), x49gp );
|
g_signal_connect( G_OBJECT( menu_debug ), "activate", G_CALLBACK( x49gp_ui_debug ), x49gp );
|
||||||
ui->menu_debug = menu_debug;
|
ui->menu_debug = menu_debug;
|
||||||
|
@ -3438,11 +3438,11 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile )
|
||||||
|
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), gtk_separator_menu_item_new() );
|
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), gtk_separator_menu_item_new() );
|
||||||
|
|
||||||
GtkWidget *menu_reset = gtk_menu_item_new_with_label( "Reset" );
|
GtkWidget* menu_reset = gtk_menu_item_new_with_label( "Reset" );
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_reset );
|
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_reset );
|
||||||
g_signal_connect( G_OBJECT( menu_reset ), "activate", G_CALLBACK( x49gp_ui_calculator_reset ), x49gp );
|
g_signal_connect( G_OBJECT( menu_reset ), "activate", G_CALLBACK( x49gp_ui_calculator_reset ), x49gp );
|
||||||
|
|
||||||
GtkWidget *menu_quit = gtk_menu_item_new_with_label( "Quit" );
|
GtkWidget* menu_quit = gtk_menu_item_new_with_label( "Quit" );
|
||||||
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_quit );
|
gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_quit );
|
||||||
g_signal_connect_swapped( G_OBJECT( menu_quit ), "activate", G_CALLBACK( x49gp_ui_quit ), x49gp );
|
g_signal_connect_swapped( G_OBJECT( menu_quit ), "activate", G_CALLBACK( x49gp_ui_quit ), x49gp );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue