Commit 3d6c125da7b98e4907e683e6fb6bb4bc73feee57

Authored by Perry Werneck
1 parent a87f5185

- Ajustes para facilitar a criação de novos templates de pallete.

- Incluindo tema de cores "selenized"
(https://github.com/jan-warchol/selenized)
conf/colors.conf
1 1 #
2   -# Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   -# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  2 +# Software pw3270; desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 +# (Paul Mattes Paul.Mattes@usa.net); de emulação de terminal 3270 para acesso a
4 4 # aplicativos mainframe. Registro no INPI sob o nome G3270.
5 5 #
6 6 # Copyright (C) <2008> <Banco do Brasil S.A.>
7 7 #
8 8 # Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   -# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  9 +# os termos da GPL v.2 - Licença Pública Geral GNU; conforme publicado pela
10 10 # Free Software Foundation.
11 11 #
12   -# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  12 +# Este programa é distribuído na expectativa de ser útil; mas SEM QUALQUER
13 13 # GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14 14 # A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15 15 # obter mais detalhes.
16 16 #
17 17 # Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   -# programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   -# St, Fifth Floor, Boston, MA 02110-1301 USA
  18 +# programa; se não; escreva para a Free Software Foundation; Inc.; 51 Franklin
  19 +# St; Fifth Floor; Boston; MA 02110-1301 USA
20 20 #
21 21 #
22 22 # Contatos:
... ... @@ -28,20 +28,20 @@
28 28 [default]
29 29 label=PW3270 default
30 30  
31   -base=#000000,#7890F0,#FF0000,#FF00FF,#00FF00,#00FFFF,#FFFF00,#FFFFFF,#000000,#000080,#FFA200,#800080,#008000,#008080,#A0A000,#C0C0C0
32   -field=#00FF00,#FF0000,#00FFFF,#FFFFFF
33   -selection=#404040,#ffffff
34   -OIA=#000000,#00FF00,#7890F0,#FFFFFF,#FF0000
  31 +base=#000000;#7890F0;#FF0000;#FF00FF;#00FF00;#00FFFF;#FFFF00;#FFFFFF;#000000;#000080;#FFA200;#800080;#008000;#008080;#A0A000;#C0C0C0
  32 +field=#00FF00;#FF0000;#00FFFF;#FFFFFF
  33 +selection=#404040;#ffffff
  34 +OIA=#000000;#00FF00;#7890F0;#FFFFFF;#FF0000
35 35  
36 36 cross-hair=#00FF00
37 37  
38 38 [X3270]
39 39 label=X3270
40 40  
41   -base=black,deepSkyBlue,red,pink,green,turquoise,yellow,white,black,blue3,orange,purple,paleGreen,paleTurquoise2,grey,white
42   -field=green,red,deepSkyBlue,white
43   -selection=dimGrey,black
44   -OIA=black,turquoise,turquoise,white,red
  41 +base=black;deepSkyBlue;red;pink;green;turquoise;yellow;white;black;blue3;orange;purple;paleGreen;paleTurquoise2;grey;white
  42 +field=green;red;deepSkyBlue;white
  43 +selection=dimGrey;black
  44 +OIA=black;turquoise;turquoise;white;red
45 45  
46 46 cross-hair=white
47 47  
... ... @@ -49,9 +49,9 @@ cross-hair=white
49 49 label=Reverse
50 50 label[pt_BR]=Invertido
51 51  
52   -base=white,blue,firebrick,pink,green4,cadetBlue,goldenrod,black,white,blue3,orange,purple,paleGreen,darkTurquoise,grey,black
53   -selection=dimGrey,black
54   -OIA=white,blue,blue,black,black
  52 +base=white;blue;firebrick;pink;green4;cadetBlue;goldenrod;black;white;blue3;orange;purple;paleGreen;darkTurquoise;grey;black
  53 +selection=dimGrey;black
  54 +OIA=white;blue;blue;black;black
55 55  
56 56 cross-hair=black
57 57  
... ... @@ -59,17 +59,17 @@ cross-hair=black
59 59 label=Bright
60 60 label[pt_BR]=Cores fortes
61 61  
62   -base=black,blue,red,magenta,green,turquoise,yellow,white,black,blue3,orange,purple,paleGreen,cyan,grey,white
63   -selection=dimGrey,black
64   -OIA=black,blue,blue,white,red
  62 +base=black;blue;red;magenta;green;turquoise;yellow;white;black;blue3;orange;purple;paleGreen;cyan;grey;white
  63 +selection=dimGrey;black
  64 +OIA=black;blue;blue;white;red
65 65  
66 66 cross-hair=white
67 67  
68 68 [CPE]
69 69 label=CPE
70   -base=black,LightBlue1,PaleVioletRed1,pink,green,turquoise,yellow,white,black,LightBlue3,orange,MediumPurple1,paleGreen,paleTurquoise2,grey80,white
71   -selection=dimGrey,black
72   -OIA=black,turquoise,turquoise,white,red
  70 +base=black;LightBlue1;PaleVioletRed1;pink;green;turquoise;yellow;white;black;LightBlue3;orange;MediumPurple1;paleGreen;paleTurquoise2;grey80;white
  71 +selection=dimGrey;black
  72 +OIA=black;turquoise;turquoise;white;red
73 73  
74 74 cross-hair=white
75 75  
... ... @@ -77,17 +77,27 @@ cross-hair=white
77 77 label=Green
78 78 label[pt_BR]=Verde
79 79  
80   -base=black,green
  80 +base=black;green
81 81  
82 82 [WB]
83 83 label=White on Black
84 84 label[pt_BR]=Branco com fundo preto
85 85  
86   -base=black,white
  86 +base=black;white
87 87  
88 88 [BW]
89 89 label=Black on White
90 90 label[pt_BR]=Preto com fundo branco
  91 +base=white;black
91 92  
92   -base=white,black
  93 +[selenized]
  94 +
  95 +# https://github.com/jan-warchol/selenized
  96 +label=Selenized color palette by Jan Warchoł
  97 +
  98 +base=rgb(24,24,24);rgb(79,156,254);rgb(237,74,70);rgb(235,110,183);rgb(131,199,70);rgb(86,216,201);rgb(239,197,65);rgb(222,222,222);rgb(59,59,59);rgb(54,142,171);rgb(250,145,83);rgb(165,128,226);rgb(112,180,51);rgb(65,199,185);rgb(219,179,45);rgb(119,119,119)
  99 +field=rgb(131,199,70);rgb(237,74,70);rgb(65,199,185);rgb(250,145,83)
  100 +selection=rgb(37,37,37);rgb(222,222,222)
  101 +OIA=rgb(24,24,24);rgb(222,222,222);rgb(79,156,254);rgb(131,199,70);rgb(239,197,65)
  102 +cross-hair=rgb(222,222,222)
93 103  
... ...
locale/pt_BR.po
... ... @@ -5,7 +5,7 @@ msgid &quot;&quot;
5 5 msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 7 "Report-Msgid-Bugs-To: \n"
8   -"POT-Creation-Date: 2018-10-22 14:37-0300\n"
  8 +"POT-Creation-Date: 2018-10-22 16:40-0300\n"
9 9 "PO-Revision-Date: 2018-10-22 14:38-0300\n"
10 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português <>\n"
... ... @@ -419,10 +419,6 @@ msgstr &quot;Não foi possível conectar a %s&quot;
419 419 msgid "Can't connect to %s:%s"
420 420 msgstr "Não foi possível conectar a %s:%s"
421 421  
422   -#: main.c:70
423   -msgid "Can't connect to DBUS server"
424   -msgstr "Não foi possível conectar ao servidor DBUS"
425   -
426 422 #: selection.c:466
427 423 #, c-format
428 424 msgid "Can't convert line %d from %s to %s"
... ... @@ -437,10 +433,6 @@ msgstr &quot;Recortar não permitido em seleção retangular&quot;
437 433 msgid "Can't determine value for environment variable \"%s\" "
438 434 msgstr "Não consigo determinar o valor da variável de ambiente \"%s\" "
439 435  
440   -#: main.c:115
441   -msgid "Can't get DBUS object name"
442   -msgstr "Não foi possível obter o nome do objeto DBUS"
443   -
444 436 #: ft.c:413
445 437 msgid "Can't get file size"
446 438 msgstr "Não foi possível obter o tamanho do arquivo"
... ... @@ -675,10 +667,6 @@ msgstr &quot;Configurar host&quot;
675 667 msgid "Connect on startup"
676 668 msgstr "Conectar ao iniciar"
677 669  
678   -#: gobject.c:205
679   -msgid "Connecting to host"
680   -msgstr "Conectando ao servidor"
681   -
682 670 #: connect.c:215 connect.c:311 connect.c:320 connect.c:382 connect.c:397
683 671 #: connect.c:413 connect.c:427 connect.c:447 connect.c:461 connect.c:477
684 672 #: connect.c:573
... ... @@ -1954,11 +1942,6 @@ msgstr &quot;Iniciar transferência de arquivo&quot;
1954 1942 msgid "Starting"
1955 1943 msgstr "Iniciando"
1956 1944  
1957   -#: gobject.c:193
1958   -#, c-format
1959   -msgid "State %04d can't accept requests"
1960   -msgstr "Não é possível receber requisições no estado %04d"
1961   -
1962 1945 #: security.c:237
1963 1946 msgid "Subject issuer mismatch"
1964 1947 msgstr "Divergência na identidade do emissor"
... ... @@ -2471,11 +2454,6 @@ msgstr &quot;Valor de cor inválido ou inesperado: \&quot;%s\&quot;&quot;
2471 2454 msgid "Unexpected or unknown security status"
2472 2455 msgstr "Estado de segurança inesperado ou desconhecido."
2473 2456  
2474   -#: gobject.c:208
2475   -#, c-format
2476   -msgid "Unexpected state %04d"
2477   -msgstr "Estado inesperado %04d"
2478   -
2479 2457 #: actions.c:391
2480 2458 #, c-format
2481 2459 msgid "Unexpected target \"%s\""
... ... @@ -2880,6 +2858,12 @@ msgstr &quot;translator-credits&quot;
2880 2858 #~ "32768. Valores maiores trazem maior performance, porem, nem todos os "
2881 2859 #~ "hosts podem suportá-los."
2882 2860  
  2861 +#~ msgid "Can't connect to DBUS server"
  2862 +#~ msgstr "Não foi possível conectar ao servidor DBUS"
  2863 +
  2864 +#~ msgid "Can't get DBUS object name"
  2865 +#~ msgstr "Não foi possível obter o nome do objeto DBUS"
  2866 +
2883 2867 #~ msgid "Can't start download."
2884 2868 #~ msgstr "Não foi possível iniciar o download."
2885 2869  
... ... @@ -2916,6 +2900,9 @@ msgstr &quot;translator-credits&quot;
2916 2900 #~ msgid "Complete"
2917 2901 #~ msgstr "Completo"
2918 2902  
  2903 +#~ msgid "Connecting to host"
  2904 +#~ msgstr "Conectando ao servidor"
  2905 +
2919 2906 #~ msgid "Copiar tudo"
2920 2907 #~ msgstr "Copiar tudo"
2921 2908  
... ... @@ -3244,6 +3231,9 @@ msgstr &quot;translator-credits&quot;
3244 3231 #~ msgid "Start upload."
3245 3232 #~ msgstr "Iniciar envio."
3246 3233  
  3234 +#~ msgid "State %04d can't accept requests"
  3235 +#~ msgstr "Não é possível receber requisições no estado %04d"
  3236 +
3247 3237 #~ msgid "Status"
3248 3238 #~ msgstr "Situação"
3249 3239  
... ... @@ -3278,6 +3268,9 @@ msgstr &quot;translator-credits&quot;
3278 3268 #~ msgid "Unexpected element <%s>"
3279 3269 #~ msgstr "Elemento <%s> inesperado"
3280 3270  
  3271 +#~ msgid "Unexpected state %04d"
  3272 +#~ msgstr "Estado inesperado %04d"
  3273 +
3281 3274 #~ msgid ""
3282 3275 #~ "Unknown host:\n"
3283 3276 #~ "%s"
... ...
locale/pw3270.pot
... ... @@ -9,7 +9,7 @@ msgstr &quot;&quot;
9 9 "#-#-#-#-# lib3270.pot (PACKAGE VERSION) #-#-#-#-#\n"
10 10 "Project-Id-Version: PACKAGE VERSION\n"
11 11 "Report-Msgid-Bugs-To: \n"
12   -"POT-Creation-Date: 2018-10-22 14:37-0300\n"
  12 +"POT-Creation-Date: 2018-10-22 16:50-0300\n"
13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14 14 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15 15 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -20,7 +20,7 @@ msgstr &quot;&quot;
20 20 "#-#-#-#-# pw3270.pot (PACKAGE VERSION) #-#-#-#-#\n"
21 21 "Project-Id-Version: PACKAGE VERSION\n"
22 22 "Report-Msgid-Bugs-To: \n"
23   -"POT-Creation-Date: 2018-10-22 14:37-0300\n"
  23 +"POT-Creation-Date: 2018-10-22 16:50-0300\n"
24 24 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
25 25 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
26 26 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -39,17 +39,6 @@ msgstr &quot;&quot;
39 39 "MIME-Version: 1.0\n"
40 40 "Content-Type: text/plain; charset=CHARSET\n"
41 41 "Content-Transfer-Encoding: 8bit\n"
42   -"#-#-#-#-# dbus3270.pot (PACKAGE VERSION) #-#-#-#-#\n"
43   -"Project-Id-Version: PACKAGE VERSION\n"
44   -"Report-Msgid-Bugs-To: \n"
45   -"POT-Creation-Date: 2018-10-22 14:37-0300\n"
46   -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
47   -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
48   -"Language-Team: LANGUAGE <LL@li.org>\n"
49   -"Language: \n"
50   -"MIME-Version: 1.0\n"
51   -"Content-Type: text/plain; charset=CHARSET\n"
52   -"Content-Transfer-Encoding: 8bit\n"
53 42  
54 43 #: window.c:329
55 44 #, c-format
... ... @@ -435,10 +424,6 @@ msgstr &quot;&quot;
435 424 msgid "Can't connect to %s:%s"
436 425 msgstr ""
437 426  
438   -#: main.c:70
439   -msgid "Can't connect to DBUS server"
440   -msgstr ""
441   -
442 427 #: selection.c:466
443 428 #, c-format
444 429 msgid "Can't convert line %d from %s to %s"
... ... @@ -453,10 +438,6 @@ msgstr &quot;&quot;
453 438 msgid "Can't determine value for environment variable \"%s\" "
454 439 msgstr ""
455 440  
456   -#: main.c:115
457   -msgid "Can't get DBUS object name"
458   -msgstr ""
459   -
460 441 #: ft.c:413
461 442 msgid "Can't get file size"
462 443 msgstr ""
... ... @@ -679,10 +660,6 @@ msgstr &quot;&quot;
679 660 msgid "Connect on startup"
680 661 msgstr ""
681 662  
682   -#: gobject.c:205
683   -msgid "Connecting to host"
684   -msgstr ""
685   -
686 663 #: connect.c:215 connect.c:311 connect.c:320 connect.c:382 connect.c:397
687 664 #: connect.c:413 connect.c:427 connect.c:447 connect.c:461 connect.c:477
688 665 #: connect.c:573
... ... @@ -1913,11 +1890,6 @@ msgstr &quot;&quot;
1913 1890 msgid "Starting"
1914 1891 msgstr ""
1915 1892  
1916   -#: gobject.c:193
1917   -#, c-format
1918   -msgid "State %04d can't accept requests"
1919   -msgstr ""
1920   -
1921 1893 #: security.c:237
1922 1894 msgid "Subject issuer mismatch"
1923 1895 msgstr ""
... ... @@ -2372,11 +2344,6 @@ msgstr &quot;&quot;
2372 2344 msgid "Unexpected or unknown security status"
2373 2345 msgstr ""
2374 2346  
2375   -#: gobject.c:208
2376   -#, c-format
2377   -msgid "Unexpected state %04d"
2378   -msgstr ""
2379   -
2380 2347 #: actions.c:391
2381 2348 #, c-format
2382 2349 msgid "Unexpected target \"%s\""
... ...
src/pw3270/colors.c
... ... @@ -29,6 +29,10 @@
29 29  
30 30 #include <gtk/gtk.h>
31 31 #include "globals.h"
  32 + #include <lib3270/trace.h>
  33 +
  34 + #define V3270_COLOR_BASE V3270_COLOR_GRAY+1
  35 +
32 36  
33 37 //#if defined(DEBUG) && GTK_CHECK_VERSION(3,4,0)
34 38 // #define USE_GTK_COLOR_CHOOSER 1
... ... @@ -36,10 +40,65 @@
36 40  
37 41 /*--[ Implement ]------------------------------------------------------------------------------------*/
38 42  
39   -static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
  43 +static void store_color_scheme(GtkWidget *widget)
40 44 {
41   - #define V3270_COLOR_BASE V3270_COLOR_GRAY+1
  45 + int f;
  46 +
  47 + GString *text = g_string_new("");
  48 + // Base colors
  49 + // base=#000000,#7890F0,#FF0000,#FF00FF,#00FF00,#00FFFF,#FFFF00,#FFFFFF,#000000,#000080,#FFA200,#800080,#008000,#008080,#A0A000,#C0C0C0
  50 + for(f=0;f<V3270_COLOR_BASE;f++)
  51 + {
  52 + if(f)
  53 + g_string_append_c(text,';');
  54 + g_string_append_printf(text,"%s",gdk_rgba_to_string(v3270_get_color(widget,f)));
  55 + }
  56 + set_string_to_config("color-scheme","base","%s",text->str);
  57 + g_string_truncate(text,0);
  58 +
  59 + // Field colors.
  60 + // field=#00FF00,#FF0000,#00FFFF,#FFFFFF
  61 + for(f=0;f<4;f++)
  62 + {
  63 + if(f)
  64 + g_string_append_c(text,';');
  65 + g_string_append_printf(text,"%s",gdk_rgba_to_string(v3270_get_color(widget,V3270_COLOR_FIELD+f)));
  66 + }
  67 + set_string_to_config("color-scheme","field","%s",text->str);
  68 + g_string_truncate(text,0);
  69 +
  70 + // Selection colors
  71 + // selection=#404040,#ffffff
  72 + for(f=0;f<2;f++)
  73 + {
  74 + if(f)
  75 + g_string_append_c(text,';');
  76 + g_string_append_printf(text,"%s",gdk_rgba_to_string(v3270_get_color(widget,V3270_COLOR_SELECTED_BG+f)));
  77 + }
  78 + set_string_to_config("color-scheme","selection","%s",text->str);
  79 + g_string_truncate(text,0);
  80 +
  81 + // OIA colors
  82 + // OIA=#000000,#00FF00,#7890F0,#FFFFFF,#FF0000
  83 + for(f=0;f<5;f++)
  84 + {
  85 + if(f)
  86 + g_string_append_c(text,';');
  87 + g_string_append_printf(text,"%s",gdk_rgba_to_string(v3270_get_color(widget,V3270_COLOR_OIA_BACKGROUND+f)));
  88 + }
  89 + set_string_to_config("color-scheme","OIA","%s",text->str);
  90 + g_string_truncate(text,0);
  91 +
  92 + // Cross-hair
  93 + g_string_append_printf(text,"%s",gdk_rgba_to_string(v3270_get_color(widget,V3270_COLOR_CROSS_HAIR)));
  94 +
  95 + set_string_to_config("color-scheme","cross-hair","%s",text->str);
  96 + g_string_free(text,TRUE);
42 97  
  98 +}
  99 +
  100 +static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
  101 +{
43 102 const gchar * val;
44 103 int f;
45 104  
... ... @@ -48,7 +107,7 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
48 107 if(val)
49 108 {
50 109 // Process base colors
51   - gchar **str = g_strsplit(val,",",V3270_COLOR_BASE);
  110 + gchar **str = g_strsplit(val,";",V3270_COLOR_BASE);
52 111  
53 112 switch(g_strv_length(str))
54 113 {
... ... @@ -102,7 +161,7 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
102 161 val = g_key_file_get_string(conf,group,"field",NULL);
103 162 if(val)
104 163 {
105   - gchar **str = g_strsplit(val,",",5);
  164 + gchar **str = g_strsplit(val,";",5);
106 165  
107 166 for(f=0;f< MIN(g_strv_length(str),4); f++)
108 167 gdk_rgba_parse(clr+V3270_COLOR_FIELD+f,str[f]);
... ... @@ -116,7 +175,7 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
116 175 val = g_key_file_get_string(conf,group,"selection",NULL);
117 176 if(val)
118 177 {
119   - gchar **str = g_strsplit(val,",",3);
  178 + gchar **str = g_strsplit(val,";",3);
120 179  
121 180 for(f=0;f< MIN(g_strv_length(str),2); f++)
122 181 gdk_rgba_parse(clr+V3270_COLOR_SELECTED_BG+f,str[f]);
... ... @@ -135,7 +194,7 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
135 194 val = g_key_file_get_string(conf,group,"OIA",NULL);
136 195 if(val)
137 196 {
138   - gchar **str = g_strsplit(val,",",6);
  197 + gchar **str = g_strsplit(val,";",6);
139 198  
140 199 // 0 = V3270_COLOR_OIA_BACKGROUND,
141 200 // 1 = V3270_COLOR_OIA_FOREGROUND,
... ... @@ -590,6 +649,8 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
590 649 }
591 650 set_string_to_config("terminal","colors","%s",str->str);
592 651 g_string_free(str,TRUE);
  652 +
  653 + store_color_scheme(widget);
593 654 }
594 655 else
595 656 {
... ...