Commit 96c566b7c6b92aff026efecc0c8af9e323d7ddda
1 parent
ae8854de
Exists in
master
and in
5 other branches
Iniciando reimplementacao do dialogo de configuracao de cor
Showing
9 changed files
with
191 additions
and
40 deletions
Show diff stats
bootstrap.sh
| ... | ... | @@ -10,27 +10,30 @@ if test -e revision ; then |
| 10 | 10 | . revision |
| 11 | 11 | fi |
| 12 | 12 | |
| 13 | -PACKAGE_REVISION=`date +%y%m%d` | |
| 13 | +SVN=`which svn 2> /dev/null` | |
| 14 | 14 | |
| 15 | -if test -d ".svn" ; then | |
| 15 | +if test -x "$SVN" ; then | |
| 16 | 16 | |
| 17 | - SVN=`which svn 2> /dev/null` | |
| 17 | + TEMPFILE=.bootstrap.tmp | |
| 18 | + LANG="EN_US" | |
| 19 | + "$SVN" info > $TEMPFILE 2>&1 | |
| 18 | 20 | |
| 19 | - if test -x "$SVN" ; then | |
| 20 | - | |
| 21 | - TEMPFILE=.bootstrap.tmp | |
| 22 | - LANG="EN_US" | |
| 23 | - "$SVN" info > $TEMPFILE 2>&1 | |
| 24 | - | |
| 25 | - if [ "$?" == "0" ]; then | |
| 26 | - PACKAGE_REVISION=$(cat $TEMPFILE | grep "^Revision: " | cut -d" " -f2) | |
| 27 | - PACKAGE_SOURCE=$(cat $TEMPFILE | grep "^URL: " | cut -d" " -f2) | |
| 28 | - fi | |
| 29 | - | |
| 30 | - rm -f $TEMPFILE | |
| 21 | + if [ "$?" == "0" ]; then | |
| 22 | + PACKAGE_REVISION=$(cat $TEMPFILE | grep "^Revision: " | cut -d" " -f2) | |
| 23 | + PACKAGE_SOURCE=$(cat $TEMPFILE | grep "^URL: " | cut -d" " -f2) | |
| 31 | 24 | fi |
| 32 | 25 | |
| 26 | + rm -f $TEMPFILE | |
| 27 | +fi | |
| 28 | + | |
| 29 | +if test -z $PACKAGE_REVISION ; then | |
| 30 | + echo "Can´t detect package revision, using current date" | |
| 31 | + PACKAGE_REVISION=`date +%y%m%d` | |
| 32 | +fi | |
| 33 | 33 | |
| 34 | +if test -z $PACKAGE_SOURCE ; then | |
| 35 | + echo "Can´t detect package source, using default one" | |
| 36 | + PACKAGE_SOURCE="http://www.softwarepublico.gov.br/dotlrn/clubs/pw3270" | |
| 34 | 37 | fi |
| 35 | 38 | |
| 36 | 39 | echo "PACKAGE_REVISION=$PACKAGE_REVISION" > $out/revision | ... | ... |
pw3270.cbp
| ... | ... | @@ -4,14 +4,16 @@ |
| 4 | 4 | <Project> |
| 5 | 5 | <Option title="pw3270" /> |
| 6 | 6 | <Option makefile_is_custom="1" /> |
| 7 | + <Option execution_dir="." /> | |
| 7 | 8 | <Option pch_mode="2" /> |
| 8 | 9 | <Option compiler="gcc" /> |
| 9 | 10 | <Build> |
| 10 | 11 | <Target title="Debug"> |
| 11 | 12 | <Option output=".bin\Debug\pw3270" prefix_auto="1" extension_auto="1" /> |
| 12 | 13 | <Option object_output=".obj\Debug\" /> |
| 13 | - <Option type="0" /> | |
| 14 | + <Option type="1" /> | |
| 14 | 15 | <Option compiler="gcc" /> |
| 16 | + <Option use_console_runner="0" /> | |
| 15 | 17 | <Compiler> |
| 16 | 18 | <Add option="-g" /> |
| 17 | 19 | <Add option="-DDEBUG=1" /> |
| ... | ... | @@ -323,7 +325,7 @@ |
| 323 | 325 | <Extensions> |
| 324 | 326 | <code_completion /> |
| 325 | 327 | <debugger /> |
| 326 | - <envvars /> | |
| 328 | + <envvars set="default" /> | |
| 327 | 329 | <DoxyBlocks> |
| 328 | 330 | <comment_style block="0" line="0" /> |
| 329 | 331 | <doxyfile_project /> | ... | ... |
src/gtk/actions.c
| ... | ... | @@ -153,7 +153,8 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const |
| 153 | 153 | { "reload", reload_action }, |
| 154 | 154 | { "connect", connect_action }, |
| 155 | 155 | { "disconnect", disconnect_action }, |
| 156 | - { "hostname", hostname_action } | |
| 156 | + { "hostname", hostname_action }, | |
| 157 | + { "editcolors", editcolors_action }, | |
| 157 | 158 | }; |
| 158 | 159 | |
| 159 | 160 | int f; | ... | ... |
src/gtk/colors.c
| ... | ... | @@ -137,4 +137,159 @@ |
| 137 | 137 | g_free(filename); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | + static void color_selected(GtkTreeSelection *selection, GtkWidget *widget) | |
| 141 | + { | |
| 142 | + GtkTreeModel * model; | |
| 143 | + GtkTreeIter iter; | |
| 144 | + GValue value = { 0, }; | |
| 145 | + int id; | |
| 146 | + | |
| 147 | + gtk_widget_set_sensitive(widget,FALSE); | |
| 148 | + | |
| 149 | + if(!gtk_tree_selection_get_selected(selection,&model,&iter)) | |
| 150 | + return; | |
| 151 | + | |
| 152 | + gtk_tree_model_get_value(model,&iter,1,&value); | |
| 153 | + | |
| 154 | + id = g_value_get_int(&value); | |
| 155 | + | |
| 156 | + if(id < 0 || id >= V3270_COLOR_COUNT) | |
| 157 | + return; | |
| 158 | + | |
| 159 | + | |
| 160 | + gtk_widget_set_sensitive(widget,TRUE); | |
| 161 | + } | |
| 162 | + | |
| 163 | + void editcolors_action(GtkAction *action, GtkWidget *widget) | |
| 164 | + { | |
| 165 | + static const gchar *custom = N_( "Custom colors" ); | |
| 166 | + | |
| 167 | + static const struct _node | |
| 168 | + { | |
| 169 | + int id; | |
| 170 | + const char *text; | |
| 171 | + } node[] = | |
| 172 | + { | |
| 173 | + { V3270_COLOR_BACKGROUND, N_( "Terminal" ) }, | |
| 174 | + { V3270_COLOR_FIELD, N_( "Fields" ) }, | |
| 175 | + { V3270_COLOR_SELECTED_BG, N_( "Other" ) }, | |
| 176 | + | |
| 177 | + }; | |
| 178 | + | |
| 179 | + static const gchar *color_name[V3270_COLOR_COUNT] = | |
| 180 | + { | |
| 181 | + N_( "Background" ), // V3270_COLOR_BACKGROUND | |
| 182 | + N_( "Blue" ), // V3270_COLOR_BLUE | |
| 183 | + N_( "Red" ), // V3270_COLOR_RED | |
| 184 | + N_( "Pink" ), // V3270_COLOR_PINK | |
| 185 | + N_( "Green" ), // V3270_COLOR_GREEN | |
| 186 | + N_( "Turquoise" ), // V3270_COLOR_TURQUOISE | |
| 187 | + N_( "Yellow" ), // V3270_COLOR_YELLOW | |
| 188 | + N_( "White" ), // V3270_COLOR_WHITE | |
| 189 | + N_( "Black" ), // V3270_COLOR_BLACK | |
| 190 | + N_( "Dark Blue" ), // V3270_COLOR_DARK_BLUE | |
| 191 | + N_( "Orange" ), // V3270_COLOR_ORANGE | |
| 192 | + N_( "Purple" ), // V3270_COLOR_PURPLE | |
| 193 | + N_( "Dark Green" ), // V3270_COLOR_DARK_GREEN | |
| 194 | + N_( "Turquoise" ), // V3270_COLOR_DARK_TURQUOISE | |
| 195 | + N_( "Mustard" ), // V3270_COLOR_MUSTARD | |
| 196 | + N_( "Gray" ), // V3270_COLOR_GRAY | |
| 197 | + | |
| 198 | + N_( "Normal/Unprotected" ), // V3270_COLOR_FIELD | |
| 199 | + N_( "Intensified/Unprotected" ), // V3270_COLOR_FIELD_INTENSIFIED | |
| 200 | + N_( "Normal/Protected" ), // V3270_COLOR_FIELD_PROTECTED | |
| 201 | + N_( "Intensified/Protected" ), // V3270_COLOR_FIELD_PROTECTED_INTENSIFIED | |
| 202 | + | |
| 203 | + N_( "Selection background" ), // TERMINAL_COLOR_SELECTED_BG | |
| 204 | + N_( "Selection foreground" ), // TERMINAL_COLOR_SELECTED_FG | |
| 205 | + | |
| 206 | + N_( "Cross-hair cursor" ), // TERMINAL_COLOR_CROSS_HAIR | |
| 207 | + | |
| 208 | + // Oia Colors | |
| 209 | + N_( "OIA background" ), // TERMINAL_COLOR_OIA_BACKGROUND | |
| 210 | + N_( "OIA foreground" ), // TERMINAL_COLOR_OIA_FOREGROUND | |
| 211 | + N_( "OIA separator" ), // TERMINAL_COLOR_OIA_SEPARATOR | |
| 212 | + N_( "OIA status ok" ), // TERMINAL_COLOR_OIA_STATUS_OK | |
| 213 | + N_( "OIA status invalid" ), // TERMINAL_COLOR_OIA_STATUS_INVALID | |
| 214 | + | |
| 215 | + }; | |
| 216 | + | |
| 217 | + const gchar * title = g_object_get_data(G_OBJECT(action),"title"); | |
| 218 | + GtkWidget * dialog = gtk_dialog_new_with_buttons ( gettext(title ? title : N_( "Color setup") ), | |
| 219 | + GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
| 220 | + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 221 | + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, | |
| 222 | + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, | |
| 223 | + NULL ); | |
| 224 | + GtkWidget * panned = gtk_hbox_new(FALSE,2); | |
| 225 | + GtkWidget * tree; | |
| 226 | + GtkWidget * color; | |
| 227 | + | |
| 228 | + { | |
| 229 | + // Color dialog setup | |
| 230 | + color = gtk_color_selection_new(); | |
| 231 | + gtk_widget_set_sensitive(color,0); | |
| 232 | + gtk_color_selection_set_has_opacity_control(GTK_COLOR_SELECTION(color),FALSE); | |
| 233 | + gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(color),TRUE); | |
| 234 | + gtk_box_pack_end(GTK_BOX(panned),color,TRUE,TRUE,0); | |
| 235 | + } | |
| 236 | + | |
| 237 | + // Tree view with all available colors | |
| 238 | + { | |
| 239 | + GtkTreeModel * model = (GtkTreeModel *) gtk_tree_store_new(2,G_TYPE_STRING,G_TYPE_INT); | |
| 240 | + GtkWidget * box; | |
| 241 | + GtkTreeIter iter; | |
| 242 | + GtkTreeIter parent; | |
| 243 | + GtkTreeSelection * select; | |
| 244 | + int f; | |
| 245 | + int title = 0; | |
| 246 | + | |
| 247 | + tree = gtk_tree_view_new_with_model(model); | |
| 248 | + | |
| 249 | + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree),FALSE); | |
| 250 | + gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(tree), | |
| 251 | + -1, | |
| 252 | + "color",gtk_cell_renderer_text_new(),"text", | |
| 253 | + 0, NULL ); | |
| 254 | + | |
| 255 | + gtk_tree_store_append((GtkTreeStore *) model,&parent,NULL); | |
| 256 | + gtk_tree_store_set((GtkTreeStore *) model, &parent, 0, gettext(node[title++].text), 1, V3270_COLOR_COUNT, -1); | |
| 257 | + | |
| 258 | + | |
| 259 | + select = gtk_tree_view_get_selection(GTK_TREE_VIEW (tree)); | |
| 260 | + gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); | |
| 261 | + g_signal_connect(G_OBJECT (select),"changed",G_CALLBACK(color_selected),color); | |
| 262 | + | |
| 263 | + for(f=0;f<V3270_COLOR_COUNT;f++) | |
| 264 | + { | |
| 265 | + if(f == node[title].id) | |
| 266 | + { | |
| 267 | + gtk_tree_store_append((GtkTreeStore *) model,&parent,NULL); | |
| 268 | + gtk_tree_store_set((GtkTreeStore *) model, &parent, 0, gettext(node[title++].text), 1, V3270_COLOR_COUNT, -1); | |
| 269 | + } | |
| 270 | + gtk_tree_store_append((GtkTreeStore *) model,&iter,&parent); | |
| 271 | + gtk_tree_store_set((GtkTreeStore *) model, &iter, 0, gettext(color_name[f]), 1, f, -1); | |
| 272 | + } | |
| 273 | + | |
| 274 | + gtk_tree_view_expand_all(GTK_TREE_VIEW(tree)); | |
| 275 | + | |
| 276 | + box = gtk_scrolled_window_new(NULL,NULL); | |
| 277 | + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(box),GTK_POLICY_NEVER,GTK_POLICY_ALWAYS); | |
| 278 | + gtk_container_add(GTK_CONTAINER(box),tree); | |
| 279 | + gtk_box_pack_start(GTK_BOX(panned),box,TRUE,TRUE,0); | |
| 280 | + | |
| 281 | + | |
| 282 | + } | |
| 283 | + | |
| 284 | + // Run dialog | |
| 285 | + gtk_widget_show_all(panned); | |
| 286 | + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(panned),TRUE,TRUE,2); | |
| 287 | + | |
| 288 | + gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 289 | + | |
| 290 | + | |
| 291 | + gtk_widget_destroy(dialog); | |
| 292 | + | |
| 293 | + } | |
| 294 | + | |
| 140 | 295 | ... | ... |
src/gtk/globals.h
| ... | ... | @@ -71,4 +71,5 @@ |
| 71 | 71 | G_GNUC_INTERNAL void print_all_action(GtkAction *action, GtkWidget *widget); |
| 72 | 72 | G_GNUC_INTERNAL void print_selected_action(GtkAction *action, GtkWidget *widget); |
| 73 | 73 | G_GNUC_INTERNAL void print_copy_action(GtkAction *action, GtkWidget *widget); |
| 74 | + G_GNUC_INTERNAL void editcolors_action(GtkAction *action, GtkWidget *widget); | |
| 74 | 75 | ... | ... |
src/gtk/mainwindow.c
| ... | ... | @@ -299,7 +299,12 @@ |
| 299 | 299 | gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER); |
| 300 | 300 | gtk_window_set_role(GTK_WINDOW(window),"toplevel"); |
| 301 | 301 | |
| 302 | - ui_parse_xml_folder(GTK_WINDOW(window),path,groupname,popupname,terminal,widget_setup); | |
| 302 | + if(ui_parse_xml_folder(GTK_WINDOW(window),path,groupname,popupname,terminal,widget_setup)) | |
| 303 | + { | |
| 304 | + g_object_unref(terminal); | |
| 305 | + g_object_unref(window); | |
| 306 | + return NULL; | |
| 307 | + } | |
| 303 | 308 | group = g_object_get_data(G_OBJECT(window),"action_groups"); |
| 304 | 309 | popup = g_object_get_data(G_OBJECT(window),"popup_menus"); |
| 305 | 310 | ... | ... |
src/gtk/v3270/v3270.h
src/gtk/v3270/widget.c
| ... | ... | @@ -834,9 +834,7 @@ void v3270_set_colors(GtkWidget *widget, const gchar *colors) |
| 834 | 834 | |
| 835 | 835 | "#404040," // V3270_COLOR_SELECTED_BG |
| 836 | 836 | "#FFFFFF," // V3270_COLOR_SELECTED_FG, |
| 837 | - "#FFFF00," // V3270_COLOR_SELECTED_BORDER | |
| 838 | 837 | |
| 839 | - "#00FF00," // V3270_COLOR_CURSOR | |
| 840 | 838 | "#00FF00," // V3270_COLOR_CROSS_HAIR |
| 841 | 839 | |
| 842 | 840 | "#000000," // V3270_COLOR_OIA_BACKGROUND |
| ... | ... | @@ -864,27 +862,15 @@ void v3270_set_color_table(GdkColor *table, const gchar *colors) |
| 864 | 862 | cnt = g_strv_length(clr); |
| 865 | 863 | switch(cnt) |
| 866 | 864 | { |
| 867 | - case 0: | |
| 868 | - case 1: | |
| 869 | - break; | |
| 870 | - | |
| 871 | - case 29: | |
| 872 | - for(f=0;f < V3270_COLOR_SELECTED_BORDER;f++) | |
| 873 | - v3270_set_color_entry(table,f,clr[f]); | |
| 874 | - | |
| 875 | - v3270_set_color_entry(table,V3270_COLOR_SELECTED_BORDER,clr[V3270_COLOR_SELECTED_BG]); | |
| 876 | - | |
| 877 | - for(f=V3270_COLOR_SELECTED_BORDER+1;f < V3270_COLOR_COUNT;f++) | |
| 878 | - v3270_set_color_entry(table,f,clr[f-1]); | |
| 879 | - | |
| 880 | - break; | |
| 881 | - | |
| 882 | 865 | case V3270_COLOR_COUNT: // Complete string |
| 883 | 866 | for(f=0;f < V3270_COLOR_COUNT;f++) |
| 884 | 867 | v3270_set_color_entry(table,f,clr[f]); |
| 885 | 868 | break; |
| 886 | 869 | |
| 887 | 870 | default: |
| 871 | + | |
| 872 | + g_warning("Color table has %d elements; should be %d.",cnt,V3270_COLOR_COUNT); | |
| 873 | + | |
| 888 | 874 | for(f=0;f < cnt;f++) |
| 889 | 875 | v3270_set_color_entry(table,f,clr[f]); |
| 890 | 876 | for(f=cnt; f < V3270_COLOR_COUNT;f++) | ... | ... |
ui/00default.xml
| ... | ... | @@ -104,7 +104,7 @@ |
| 104 | 104 | </menu> |
| 105 | 105 | |
| 106 | 106 | <menu name='SettingsMenu' label='Settings' sysmenu='yes' > |
| 107 | - <menuitem action='SelectColors' icon='select-color' label='Colors' /> | |
| 107 | + <menuitem action='editcolors' icon='select-color' label='Colors' /> | |
| 108 | 108 | |
| 109 | 109 | <!--- Special action - The fontselect menu will be populated with all available monospaced fonts ---> |
| 110 | 110 | <menuitem name='fontselect' icon='select-font' label='Select font' /> |
| ... | ... | @@ -155,7 +155,7 @@ |
| 155 | 155 | <separator/> |
| 156 | 156 | <toolitem action='set' toggle='fullscreen' icon='fullscreen' label='Full Screen' /> |
| 157 | 157 | <toolitem action='reset' toggle='fullscreen' icon='leave-fullscreen' label='Window' /> |
| 158 | - <toolitem action='SelectColors' /> | |
| 158 | + <toolitem action='editcolors' /> | |
| 159 | 159 | <toolitem action='print' src='all' /> |
| 160 | 160 | <toolitem action='Quit' /> |
| 161 | 161 | </toolbar> | ... | ... |