Commit fb2e29f45fdd0593dbbe5978a639b41a71f10954
1 parent
4af8362c
Exists in
master
and in
1 other branch
Implement clipboard settings dialog.
Showing
4 changed files
with
77 additions
and
15 deletions
Show diff stats
locale/pt_BR.po
@@ -5,8 +5,8 @@ msgid "" | @@ -5,8 +5,8 @@ msgid "" | ||
5 | msgstr "" | 5 | msgstr "" |
6 | "Project-Id-Version: pw3270 5.0\n" | 6 | "Project-Id-Version: pw3270 5.0\n" |
7 | "Report-Msgid-Bugs-To: \n" | 7 | "Report-Msgid-Bugs-To: \n" |
8 | -"POT-Creation-Date: 2020-01-23 09:01-0300\n" | ||
9 | -"PO-Revision-Date: 2020-01-23 09:05-0300\n" | 8 | +"POT-Creation-Date: 2020-01-23 09:02-0300\n" |
9 | +"PO-Revision-Date: 2020-01-23 09:52-0300\n" | ||
10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
11 | "Language-Team: Português <>\n" | 11 | "Language-Team: Português <>\n" |
12 | "Language: pt_BR\n" | 12 | "Language: pt_BR\n" |
@@ -257,7 +257,7 @@ msgstr "Clique para carregar arquivo" | @@ -257,7 +257,7 @@ msgstr "Clique para carregar arquivo" | ||
257 | msgid "Click to save file" | 257 | msgid "Click to save file" |
258 | msgstr "Clique para salvar arquivo" | 258 | msgstr "Clique para salvar arquivo" |
259 | 259 | ||
260 | -#: src/dialogs/settings/clipboard.c:349 | 260 | +#: src/dialogs/settings/clipboard.c:365 |
261 | msgid "Clipboard" | 261 | msgid "Clipboard" |
262 | msgstr "Área de transferência" | 262 | msgstr "Área de transferência" |
263 | 263 | ||
@@ -265,7 +265,7 @@ msgstr "Área de transferência" | @@ -265,7 +265,7 @@ msgstr "Área de transferência" | ||
265 | msgid "Clipboard name" | 265 | msgid "Clipboard name" |
266 | msgstr "Nome da área de transferência" | 266 | msgstr "Nome da área de transferência" |
267 | 267 | ||
268 | -#: src/dialogs/settings/clipboard.c:348 | 268 | +#: src/dialogs/settings/clipboard.c:364 |
269 | msgid "Clipboard properties" | 269 | msgid "Clipboard properties" |
270 | msgstr "Configuração da área de transferência" | 270 | msgstr "Configuração da área de transferência" |
271 | 271 | ||
@@ -297,7 +297,7 @@ msgstr "Arquivo separado por vírgulas (CSV)" | @@ -297,7 +297,7 @@ msgstr "Arquivo separado por vírgulas (CSV)" | ||
297 | msgid "Command to execute" | 297 | msgid "Command to execute" |
298 | msgstr "Comando a executar" | 298 | msgstr "Comando a executar" |
299 | 299 | ||
300 | -#: src/dialogs/settings/clipboard.c:315 | 300 | +#: src/dialogs/settings/clipboard.c:331 |
301 | msgid "Complete with terminal attributes" | 301 | msgid "Complete with terminal attributes" |
302 | msgstr "Completo incluindo atributos do terminal" | 302 | msgstr "Completo incluindo atributos do terminal" |
303 | 303 | ||
@@ -321,7 +321,7 @@ msgstr "Copiar como texto puro" | @@ -321,7 +321,7 @@ msgstr "Copiar como texto puro" | ||
321 | msgid "Copy as table" | 321 | msgid "Copy as table" |
322 | msgstr "Copiar como tabela" | 322 | msgstr "Copiar como tabela" |
323 | 323 | ||
324 | -#: src/dialogs/settings/clipboard.c:184 | 324 | +#: src/dialogs/settings/clipboard.c:199 |
325 | msgid "Copy options" | 325 | msgid "Copy options" |
326 | msgstr "Opções da cópia" | 326 | msgstr "Opções da cópia" |
327 | 327 | ||
@@ -527,7 +527,7 @@ msgstr "Cinza" | @@ -527,7 +527,7 @@ msgstr "Cinza" | ||
527 | msgid "Green" | 527 | msgid "Green" |
528 | msgstr "Verde" | 528 | msgstr "Verde" |
529 | 529 | ||
530 | -#: src/dialogs/settings/clipboard.c:186 | 530 | +#: src/dialogs/settings/clipboard.c:201 |
531 | msgid "HTML options" | 531 | msgid "HTML options" |
532 | msgstr "Opções HTML" | 532 | msgstr "Opções HTML" |
533 | 533 | ||
@@ -693,11 +693,11 @@ msgstr "Nenhuma transferência" | @@ -693,11 +693,11 @@ msgstr "Nenhuma transferência" | ||
693 | msgid "No transfer in progress" | 693 | msgid "No transfer in progress" |
694 | msgstr "Nenhuma transferência em andamento" | 694 | msgstr "Nenhuma transferência em andamento" |
695 | 695 | ||
696 | -#: src/dialogs/settings/clipboard.c:248 | 696 | +#: src/dialogs/settings/clipboard.c:264 |
697 | msgid "None (Don't export color)" | 697 | msgid "None (Don't export color)" |
698 | msgstr "Nenhum (Não exporta cores)" | 698 | msgstr "Nenhum (Não exporta cores)" |
699 | 699 | ||
700 | -#: src/dialogs/settings/clipboard.c:366 | 700 | +#: src/dialogs/settings/clipboard.c:382 |
701 | msgid "None (Don't export font name)" | 701 | msgid "None (Don't export font name)" |
702 | msgstr "Nenhuma (Não exporta fontes)" | 702 | msgstr "Nenhuma (Não exporta fontes)" |
703 | 703 | ||
@@ -801,7 +801,7 @@ msgstr "Colar de um arquivo" | @@ -801,7 +801,7 @@ msgstr "Colar de um arquivo" | ||
801 | msgid "Paste from text file" | 801 | msgid "Paste from text file" |
802 | msgstr "Colar de um arquivo texto" | 802 | msgstr "Colar de um arquivo texto" |
803 | 803 | ||
804 | -#: src/dialogs/settings/clipboard.c:185 | 804 | +#: src/dialogs/settings/clipboard.c:200 |
805 | msgid "Paste options" | 805 | msgid "Paste options" |
806 | msgstr "Opções para colar" | 806 | msgstr "Opções para colar" |
807 | 807 | ||
@@ -825,7 +825,7 @@ msgstr "Rosa" | @@ -825,7 +825,7 @@ msgstr "Rosa" | ||
825 | msgid "Plain text" | 825 | msgid "Plain text" |
826 | msgstr "Texto puro" | 826 | msgstr "Texto puro" |
827 | 827 | ||
828 | -#: src/dialogs/settings/clipboard.c:314 | 828 | +#: src/dialogs/settings/clipboard.c:330 |
829 | msgid "Plain text only" | 829 | msgid "Plain text only" |
830 | msgstr "Apenas texto puro" | 830 | msgstr "Apenas texto puro" |
831 | 831 | ||
@@ -982,7 +982,7 @@ msgstr "" | @@ -982,7 +982,7 @@ msgstr "" | ||
982 | "SPACE can be specified in units of TRACKS, CYLINDERS, or AVBLOCK, and only " | 982 | "SPACE can be specified in units of TRACKS, CYLINDERS, or AVBLOCK, and only " |
983 | "one option can be used." | 983 | "one option can be used." |
984 | 984 | ||
985 | -#: src/dialogs/settings/clipboard.c:249 src/dialogs/settings/clipboard.c:367 | 985 | +#: src/dialogs/settings/clipboard.c:265 src/dialogs/settings/clipboard.c:383 |
986 | msgid "Same of the screen" | 986 | msgid "Same of the screen" |
987 | msgstr "Igual ao terminal" | 987 | msgstr "Igual ao terminal" |
988 | 988 | ||
@@ -1482,6 +1482,11 @@ msgstr "Documento sem título" | @@ -1482,6 +1482,11 @@ msgstr "Documento sem título" | ||
1482 | msgid "Use host default record format." | 1482 | msgid "Use host default record format." |
1483 | msgstr "Utilizar o formato de registro padrão do servidor." | 1483 | msgstr "Utilizar o formato de registro padrão do servidor." |
1484 | 1484 | ||
1485 | +# Tradução copiada do libre-office | ||
1486 | +#: src/dialogs/settings/clipboard.c:135 | ||
1487 | +msgid "Use non-breaking Spaces" | ||
1488 | +msgstr "Usar espaço inseparável" | ||
1489 | + | ||
1485 | #: src/filetransfer/tables.c:86 | 1490 | #: src/filetransfer/tables.c:86 |
1486 | msgid "Variable" | 1491 | msgid "Variable" |
1487 | msgstr "Variável" | 1492 | msgstr "Variável" |
@@ -1490,6 +1495,14 @@ msgstr "Variável" | @@ -1490,6 +1495,14 @@ msgstr "Variável" | ||
1490 | msgid "Western Europe (ISO 8859-1)" | 1495 | msgid "Western Europe (ISO 8859-1)" |
1491 | msgstr "Europa ocidental (ISO 8859-1)" | 1496 | msgstr "Europa ocidental (ISO 8859-1)" |
1492 | 1497 | ||
1498 | +#: src/dialogs/settings/clipboard.c:136 | ||
1499 | +msgid "" | ||
1500 | +"When set the terminal spaces are exported as non-breaking spaces to prevent " | ||
1501 | +"line breaks" | ||
1502 | +msgstr "" | ||
1503 | +"Quando selecionada os espaços do terminal são exportados como inseparáveis " | ||
1504 | +"para prevenir quebras de linha" | ||
1505 | + | ||
1493 | #: src/dialogs/settings/colors.c:162 | 1506 | #: src/dialogs/settings/colors.c:162 |
1494 | msgid "White" | 1507 | msgid "White" |
1495 | msgstr "Branco" | 1508 | msgstr "Branco" |
src/dialogs/settings/clipboard.c
@@ -129,6 +129,20 @@ | @@ -129,6 +129,20 @@ | ||
129 | 129 | ||
130 | }; | 130 | }; |
131 | 131 | ||
132 | + static const struct CheckBoxDefinition checkboxes[] = { | ||
133 | + | ||
134 | + { | ||
135 | + .label = N_("Use non-breaking Spaces"), | ||
136 | + .tooltip = N_("When set the terminal spaces are exported as non-breaking spaces to prevent line breaks"), | ||
137 | + .left = 1, | ||
138 | + .top = 2, | ||
139 | + .width = 1, | ||
140 | + .height = 1, | ||
141 | + .grid = 2 | ||
142 | + } | ||
143 | + | ||
144 | + }; | ||
145 | + | ||
132 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 146 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
133 | 147 | ||
134 | typedef struct _V3270ClipboardSettings { | 148 | typedef struct _V3270ClipboardSettings { |
@@ -136,8 +150,9 @@ | @@ -136,8 +150,9 @@ | ||
136 | V3270Settings parent; | 150 | V3270Settings parent; |
137 | 151 | ||
138 | struct { | 152 | struct { |
139 | - GtkToggleButton * toggles[G_N_ELEMENTS(toggles)]; ///< @brief Toggle checks. | ||
140 | - GtkComboBox * combos[G_N_ELEMENTS(combos)]; ///< @brief Combo-boxes. | 153 | + GtkToggleButton * toggles[G_N_ELEMENTS(toggles)]; ///< @brief Toggle checks. |
154 | + GtkComboBox * combos[G_N_ELEMENTS(combos)]; ///< @brief Combo-boxes. | ||
155 | + GtkToggleButton * checkboxes[G_N_ELEMENTS(checkboxes)]; ///< @brief Checkboxes. | ||
141 | } input; | 156 | } input; |
142 | 157 | ||
143 | 158 | ||
@@ -231,6 +246,7 @@ static void V3270ClipboardSettings_init(V3270ClipboardSettings *widget) { | @@ -231,6 +246,7 @@ static void V3270ClipboardSettings_init(V3270ClipboardSettings *widget) { | ||
231 | 246 | ||
232 | v3270_settings_create_toggle_buttons(toggles, G_N_ELEMENTS(toggles), grids, widget->input.toggles); | 247 | v3270_settings_create_toggle_buttons(toggles, G_N_ELEMENTS(toggles), grids, widget->input.toggles); |
233 | v3270_settings_create_combos(combos, G_N_ELEMENTS(combos), grids, widget->input.combos); | 248 | v3270_settings_create_combos(combos, G_N_ELEMENTS(combos), grids, widget->input.combos); |
249 | + v3270_settings_create_checkboxes(checkboxes, G_N_ELEMENTS(checkboxes), grids, widget->input.checkboxes); | ||
234 | 250 | ||
235 | // Setup combos | 251 | // Setup combos |
236 | { | 252 | { |
@@ -409,6 +425,8 @@ static void load(GtkWidget *w, GtkWidget *t) { | @@ -409,6 +425,8 @@ static void load(GtkWidget *w, GtkWidget *t) { | ||
409 | debug("Plain text: %s",((terminal->selection.options & V3270_SELECTION_PLAIN_TEXT) ? "0" : "1")); | 425 | debug("Plain text: %s",((terminal->selection.options & V3270_SELECTION_PLAIN_TEXT) ? "0" : "1")); |
410 | gtk_combo_box_set_active_id(widget->input.combos[2],(terminal->selection.options & (V3270_SELECTION_ENABLE_HTML|V3270_SELECTION_DIALOG_STATE)) == 0 ? "0" : "1"); | 426 | gtk_combo_box_set_active_id(widget->input.combos[2],(terminal->selection.options & (V3270_SELECTION_ENABLE_HTML|V3270_SELECTION_DIALOG_STATE)) == 0 ? "0" : "1"); |
411 | 427 | ||
428 | + gtk_toggle_button_set_active(widget->input.checkboxes[0],(terminal->selection.options & V3270_SELECTION_NON_BREAKABLE_SPACE) != 0); | ||
429 | + | ||
412 | // | 430 | // |
413 | // Set font combo-box | 431 | // Set font combo-box |
414 | // | 432 | // |
@@ -474,7 +492,12 @@ static void apply(GtkWidget *w, GtkWidget *t) { | @@ -474,7 +492,12 @@ static void apply(GtkWidget *w, GtkWidget *t) { | ||
474 | } else { | 492 | } else { |
475 | 493 | ||
476 | terminal->selection.options |= V3270_SELECTION_DIALOG_STATE; | 494 | terminal->selection.options |= V3270_SELECTION_DIALOG_STATE; |
477 | - terminal->selection.options |= V3270_SELECTION_NON_BREAKABLE_SPACE; // TODO: Use a checkbox to enable-it | 495 | + |
496 | + if(gtk_toggle_button_get_active(widget->input.checkboxes[0])) { | ||
497 | + terminal->selection.options |= V3270_SELECTION_NON_BREAKABLE_SPACE; | ||
498 | + } else { | ||
499 | + terminal->selection.options &= ~V3270_SELECTION_NON_BREAKABLE_SPACE; | ||
500 | + } | ||
478 | 501 | ||
479 | // Get font settings | 502 | // Get font settings |
480 | switch(get_active_id(widget,0)) { | 503 | switch(get_active_id(widget,0)) { |
src/dialogs/settings/private.h
@@ -74,4 +74,13 @@ | @@ -74,4 +74,13 @@ | ||
74 | 74 | ||
75 | G_GNUC_INTERNAL void v3270_settings_create_combos(const struct ComboBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkComboBox **combos); | 75 | G_GNUC_INTERNAL void v3270_settings_create_combos(const struct ComboBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkComboBox **combos); |
76 | 76 | ||
77 | + /// @brief Checkbox factory | ||
78 | + struct CheckBoxDefinition { | ||
79 | + ENTRY_FIELD_HEAD | ||
80 | + | ||
81 | + unsigned short grid; | ||
82 | + }; | ||
83 | + | ||
84 | + G_GNUC_INTERNAL void v3270_settings_create_checkboxes(const struct CheckBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **buttons); | ||
85 | + | ||
77 | #endif // PRIVATE_H_INCLUDED | 86 | #endif // PRIVATE_H_INCLUDED |
src/dialogs/settings/tools.c
@@ -131,4 +131,21 @@ | @@ -131,4 +131,21 @@ | ||
131 | 131 | ||
132 | } | 132 | } |
133 | 133 | ||
134 | + void v3270_settings_create_checkboxes(const struct CheckBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **buttons) { | ||
135 | + | ||
136 | + size_t checkbox; | ||
137 | + | ||
138 | + for(checkbox = 0; checkbox < length; checkbox++) { | ||
139 | + | ||
140 | + buttons[checkbox] = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label(definitions[checkbox].label)); | ||
141 | + | ||
142 | + if(definitions[checkbox].tooltip) | ||
143 | + gtk_widget_set_tooltip_text(GTK_WIDGET(buttons[checkbox]),definitions[checkbox].tooltip); | ||
144 | + | ||
145 | + gtk_widget_set_halign(GTK_WIDGET(buttons[checkbox]),GTK_ALIGN_START); | ||
146 | + gtk_grid_attach(GTK_GRID(grids[definitions[checkbox].grid]),GTK_WIDGET(buttons[checkbox]),definitions[checkbox].left,definitions[checkbox].top,definitions[checkbox].width,1); | ||
147 | + | ||
148 | + } | ||
149 | + | ||
150 | + } | ||
134 | 151 |