From 67471cd984cebc743d1634a4d6d9d2246c6a2fc2 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Thu, 29 Mar 2012 18:11:00 +0000 Subject: [PATCH] Implementando controle de cores --- src/gtk/colors.c | 126 ++++++++++++++++++++++++------------------------------------------------------------------------------------------------------ src/gtk/v3270/v3270.h | 1 + src/gtk/v3270/widget.c | 6 ++++++ 3 files changed, 31 insertions(+), 102 deletions(-) diff --git a/src/gtk/colors.c b/src/gtk/colors.c index 33ad7df..be9595f 100644 --- a/src/gtk/colors.c +++ b/src/gtk/colors.c @@ -32,106 +32,6 @@ /*--[ Implement ]------------------------------------------------------------------------------------*/ -/* - void load_color_schemes(GtkWidget *widget, gchar *active) - { - - else - { - gchar ** group; - GKeyFile * conf = g_key_file_new(); - int f = 0; - gboolean found = FALSE; - -#if !GTK_CHECK_VERSION(3,0,0) - GtkTreeModel * model = (GtkTreeModel *) gtk_list_store_new(2,G_TYPE_STRING,G_TYPE_STRING); - GtkCellRenderer * renderer = gtk_cell_renderer_text_new(); - GtkTreeIter iter; - - gtk_combo_box_set_model(GTK_COMBO_BOX(widget),model); - - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget), renderer, "text", 0, NULL); - -#endif // !GTK(3,0,0) - - g_key_file_load_from_file(conf,filename,G_KEY_FILE_NONE,NULL); - - group = g_key_file_get_groups(conf,NULL); - - for(f=0;group[f];f++) - { - gchar *str = g_strjoin( ",", g_key_file_get_string(conf,group[f],"Terminal",NULL), - g_key_file_get_string(conf,group[f],"BaseAttributes",NULL), - g_key_file_get_string(conf,group[f],"SelectedText",NULL), - g_key_file_get_string(conf,group[f],"Cursor",NULL), - g_key_file_get_string(conf,group[f],"OIA",NULL), - NULL - ); -#if GTK_CHECK_VERSION(3,0,0) - - gtk_combo_box_text_insert( GTK_COMBO_BOX_TEXT(widget), - f, - str, - g_key_file_get_locale_string(conf,group[f],"Label",NULL,NULL)); - - - if(active && !g_strcasecmp(active,str)) - { - found = TRUE; - gtk_combo_box_set_active(GTK_COMBO_BOX(widget),f); - } -#else - - gtk_list_store_append((GtkListStore *) model,&iter); - gtk_list_store_set((GtkListStore *) model, &iter, - 0, g_key_file_get_locale_string(conf,group[f],"Label",NULL,NULL), - 1, str, - -1); - - if(active && !g_strcasecmp(active,str)) - { - found = TRUE; - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&iter); - } - -#endif // GTK(3,0,0) - - g_free(str); - } - - g_strfreev(group); - g_key_file_free(conf); - - if(active && !found) - { -#if GTK_CHECK_VERSION(3,0,0) - - gtk_combo_box_text_insert( GTK_COMBO_BOX_TEXT(widget), - 0, - active, - _( "Custom colors") ); - gtk_combo_box_set_active(GTK_COMBO_BOX(widget),0); - -#else - - gtk_list_store_append((GtkListStore *) model,&iter); - gtk_list_store_set((GtkListStore *) model, &iter, - 0, _( "Custom colors" ), - 1, active, - -1); - - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&iter); -#endif - } - - gtk_widget_set_sensitive(widget,TRUE); - - } - - g_free(filename); - } -*/ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) { @@ -294,13 +194,28 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) } + static gboolean compare_colors(const GdkColor *colora, const GdkColor *colorb) + { + int f; + + for(f=0;fcolor+id; } +const GdkColor * v3270_get_color_table(GtkWidget *widget) +{ + g_return_val_if_fail(GTK_IS_V3270(widget),NULL); + return GTK_V3270(widget)->color; +} + void v3270_set_color_table(GdkColor *table, const gchar *colors) { gchar **clr; -- libgit2 0.21.2