1
0
Fork 0
forked from Miroirs/x49gp

Compare commits

...

2 commits

Author SHA1 Message Date
Gwenhael Le Moine
a00d3ecef7
remove lcd_event_box, move its events to ui->window 2024-11-08 09:52:22 +01:00
Gwenhael Le Moine
8d672658ef
remove unused colors (which have been moved to css) 2024-11-08 09:40:39 +01:00
2 changed files with 25 additions and 54 deletions

View file

@ -821,7 +821,7 @@ char* css_global_49gp = ".main-window {"
" font-weight: bold;"
"}"
"window {"
" background-color: #f0e68c;"
" background-color: #f5deb3;"
"}"
".annunciator {"
" padding: 0px;"
@ -1102,23 +1102,6 @@ static gboolean react_to_button_release( GtkWidget* widget, GdkEventButton* even
return false;
}
static gboolean do_show_context_menu( GtkWidget* widget, GdkEventButton* event, gpointer user_data )
{
x49gp_t* x49gp = user_data;
x49gp_ui_t* ui = x49gp->ui;
gtk_widget_set_sensitive( ui->menu_unmount, s3c2410_sdi_is_mounted( x49gp ) );
if ( ui->menu_debug )
gtk_widget_set_sensitive( ui->menu_debug, !gdbserver_isactive() );
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
gtk_menu_popup_at_widget( GTK_MENU( ui->menu ), ui->lcd_canvas, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL );
return true;
}
return false;
}
static gboolean react_to_button_leave( GtkWidget* widget, GdkEventCrossing* event, gpointer user_data )
{
x49gp_ui_button_t* button = user_data;
@ -1541,13 +1524,31 @@ static gboolean react_to_window_click( GtkWidget* widget, GdkEventButton* event,
gdk_window_focus( gtk_widget_get_window( widget ), event->time );
gdk_window_raise( gtk_widget_get_window( widget ) );
x49gp_t* x49gp = user_data;
x49gp_ui_t* ui = x49gp->ui;
gtk_widget_set_sensitive( ui->menu_unmount, s3c2410_sdi_is_mounted( x49gp ) );
if ( ui->menu_debug )
gtk_widget_set_sensitive( ui->menu_debug, !gdbserver_isactive() );
if ( event->type != GDK_BUTTON_PRESS )
return false;
if ( event->button != 1 )
return false;
gdk_window_begin_move_drag( gtk_widget_get_window( widget ), event->button, event->x_root, event->y_root, event->time );
switch ( event->button ) {
case 1: // left click
gdk_window_begin_move_drag( gtk_widget_get_window( widget ), event->button, event->x_root, event->y_root, event->time );
break;
case 2: // middle click
GtkClipboard* clip = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD );
gchar* text = gtk_clipboard_wait_for_text( clip );
fprintf( stderr, "clipboard: %s\n", text );
break;
case 3: // right click
gtk_menu_popup_at_widget( GTK_MENU( ui->menu ), ui->lcd_canvas, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL );
return true;
default:
break;
}
return false;
}
@ -1674,14 +1675,6 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
// create all colors
{
_ui_load__init_color( &ui->colors[ UI_COLOR_BLACK ], 0x00, 0x00, 0x00 ); /* #000000 */
_ui_load__init_color( &ui->colors[ UI_COLOR_WHITE ], 0xff, 0xff, 0xff ); /* #ffffff */
_ui_load__init_color( &ui->colors[ UI_COLOR_YELLOW ], 0xfa, 0xe8, 0x2c ); /* #fae82c */
_ui_load__init_color( &ui->colors[ UI_COLOR_RED ], 0x8e, 0x25, 0x18 ); /* #8e2518 */
_ui_load__init_color( &ui->colors[ UI_COLOR_GREEN ], 0x14, 0x4d, 0x49 ); /* #144d49 */
_ui_load__init_color( &ui->colors[ UI_COLOR_SILVER ], 0xe0, 0xe0, 0xe0 ); /* #e0e0e0 */
_ui_load__init_color( &ui->colors[ UI_COLOR_ORANGE ], 0xc0, 0x6e, 0x60 ); /* #c06e60 */
_ui_load__init_color( &ui->colors[ UI_COLOR_BLUE ], 0x40, 0x60, 0xa4 ); /* #4060a4 */
_ui_load__init_color( &ui->colors[ UI_COLOR_GRAYSCALE_0 ], 0xab, 0xd2, 0xb4 ); /* #abd2b4 */
_ui_load__init_color( &ui->colors[ UI_COLOR_GRAYSCALE_1 ], 0xa0, 0xc4, 0xa8 ); /* #a0c4a8 */
_ui_load__init_color( &ui->colors[ UI_COLOR_GRAYSCALE_2 ], 0x94, 0xb6, 0x9c ); /* #94b69c */
@ -1698,8 +1691,6 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
_ui_load__init_color( &ui->colors[ UI_COLOR_GRAYSCALE_13 ], 0x17, 0x1c, 0x18 ); /* #171c18 */
_ui_load__init_color( &ui->colors[ UI_COLOR_GRAYSCALE_14 ], 0x0b, 0x03, 0x0c ); /* #0b030c */
_ui_load__init_color( &ui->colors[ UI_COLOR_GRAYSCALE_15 ], 0x00, 0x00, 0x00 ); /* #000000 */
_ui_load__init_color( &ui->colors[ UI_COLOR_FACEPLATE_49GP ], 0xf5, 0xde, 0xb3 ); /* #f5deb3 */
_ui_load__init_color( &ui->colors[ UI_COLOR_FACEPLATE_50G ], 0x27, 0x27, 0x27 ); /* #272727 */
}
/* set calculator type and name */
@ -1795,18 +1786,8 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
gtk_container_add( GTK_CONTAINER( annunciators_container ), ui->ui_ann_busy );
gtk_container_add( GTK_CONTAINER( annunciators_container ), ui->ui_ann_io );
GtkWidget* lcd_event_box = gtk_event_box_new();
gtk_style_context_add_class( gtk_widget_get_style_context( lcd_event_box ), "lcd-box" );
gtk_event_box_set_visible_window( GTK_EVENT_BOX( lcd_event_box ), true );
gtk_event_box_set_above_child( GTK_EVENT_BOX( lcd_event_box ), false );
gtk_widget_set_size_request( lcd_event_box, ui->lcd_width, ui->lcd_height + ANN_HEIGHT );
g_signal_connect( G_OBJECT( lcd_event_box ), "button-press-event", G_CALLBACK( do_show_context_menu ), x49gp );
/* gtk_container_add( GTK_CONTAINER( lcd_event_box ), annunciators_container ); */
gtk_container_add( GTK_CONTAINER( lcd_event_box ), ui->lcd_canvas );
gtk_fixed_put( GTK_FIXED( fixed_widgets_container ), annunciators_container, ui->annunciators_x_offset, ui->annunciators_y_offset );
gtk_fixed_put( GTK_FIXED( fixed_widgets_container ), lcd_event_box, ui->lcd_x_offset, ui->lcd_y_offset );
/* gtk_fixed_put( GTK_FIXED( fixed_widgets_container ), ui->lcd_canvas, ui->lcd_x_offset, ui->lcd_y_offset ); */
gtk_fixed_put( GTK_FIXED( fixed_widgets_container ), ui->lcd_canvas, ui->lcd_x_offset, ui->lcd_y_offset );
}
// keyboard

View file

@ -8,15 +8,7 @@
#include "x49gp_types.h"
typedef enum {
UI_COLOR_BLACK = 0,
UI_COLOR_WHITE,
UI_COLOR_YELLOW,
UI_COLOR_RED,
UI_COLOR_GREEN,
UI_COLOR_SILVER,
UI_COLOR_ORANGE,
UI_COLOR_BLUE,
UI_COLOR_GRAYSCALE_0,
UI_COLOR_GRAYSCALE_0 = 0,
UI_COLOR_GRAYSCALE_1,
UI_COLOR_GRAYSCALE_2,
UI_COLOR_GRAYSCALE_3,
@ -32,8 +24,6 @@ typedef enum {
UI_COLOR_GRAYSCALE_13,
UI_COLOR_GRAYSCALE_14,
UI_COLOR_GRAYSCALE_15,
UI_COLOR_FACEPLATE_49GP,
UI_COLOR_FACEPLATE_50G,
UI_COLOR_MAX,
} x49gp_ui_color_t;