From 09186de7a8d8a207a4afa795c454f678135c7819 Mon Sep 17 00:00:00 2001 From: werner Date: Thu, 31 Dec 2009 09:34:17 +0000 Subject: [PATCH] When selecting an expression of an assignment and then selecting another expression, the background of the first expression did not revert to its original color. - gui_style.h (COLOR_CHOICE_SELECTED): made blue a bit lighter, to improve contrast of black foreground text - gui_frame.c (unselect_value): build_assignment uses COLOR_EXPR_PASSIVE for expressions in assignments, so we also have to do the same here. git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5763 99fdad57-331a-0410-800a-d7fa5415bdb3 --- gui_frame.c | 19 ++++++++++++++++++- gui_style.h | 2 +- obj.h | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gui_frame.c b/gui_frame.c index cd98e37..74cfb03 100644 --- a/gui_frame.c +++ b/gui_frame.c @@ -508,8 +508,19 @@ static void unselect_value(void *data) { struct value *value = data; + /* + * This condition is a little cryptic. Here is what it does: + * + * IF table/assignment (not loop) + * AND the current row is the active (selected) row + * AND it's an assignment (not a table). + * + * We need the last condition because the expressions of assignments + * are drawn with COLOR_VAR_PASSIVE. (See build_assignment.) + */ label_in_box_bg(value->widget, - value->row && value->row->table->active_row == value->row ? + value->row && value->row->table->active_row == value->row && + value->row->table->rows->next ? COLOR_CHOICE_SELECTED : COLOR_EXPR_PASSIVE); } @@ -620,6 +631,12 @@ static gboolean assignment_value_select_event(GtkWidget *widget, } +/* + * In tables, expressions in the active row have a COLOR_CHOICE_SELECTED + * background. While expressions in assignments are technically on the active + * (and only) row, we use COLOR_VAR_PASSIVE for better readability. + */ + static void build_assignment(GtkWidget *vbox, struct frame *frame, struct table *table) { diff --git a/gui_style.h b/gui_style.h index 40ca9ff..9481dcf 100644 --- a/gui_style.h +++ b/gui_style.h @@ -83,7 +83,7 @@ #define COLOR_EXPR_PASSIVE "#f0f0ff" #define COLOR_EXPR_EDITING COLOR_EDITING #define COLOR_CHOICE_UNSELECTED COLOR_EXPR_PASSIVE -#define COLOR_CHOICE_SELECTED "#9090ff" +#define COLOR_CHOICE_SELECTED "#a0a0ff" #define COLOR_ROW_UNSELECTED COLOR_CHOICE_UNSELECTED #define COLOR_ROW_SELECTED COLOR_CHOICE_SELECTED diff --git a/obj.h b/obj.h index bcd72be..8774295 100644 --- a/obj.h +++ b/obj.h @@ -42,7 +42,7 @@ struct value { struct expr *expr; struct value *next; - /* back reference */ + /* back reference, NULL if loop */ struct row *row; /* for the GUI */