Commit fb2e29f45fdd0593dbbe5978a639b41a71f10954

Authored by Perry Werneck
1 parent 4af8362c
Exists in master and in 1 other branch develop

Implement clipboard settings dialog.

locale/pt_BR.po
... ... @@ -5,8 +5,8 @@ msgid ""
5 5 msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 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 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português <>\n"
12 12 "Language: pt_BR\n"
... ... @@ -257,7 +257,7 @@ msgstr &quot;Clique para carregar arquivo&quot;
257 257 msgid "Click to save file"
258 258 msgstr "Clique para salvar arquivo"
259 259  
260   -#: src/dialogs/settings/clipboard.c:349
  260 +#: src/dialogs/settings/clipboard.c:365
261 261 msgid "Clipboard"
262 262 msgstr "Área de transferência"
263 263  
... ... @@ -265,7 +265,7 @@ msgstr &quot;Área de transferência&quot;
265 265 msgid "Clipboard name"
266 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 269 msgid "Clipboard properties"
270 270 msgstr "Configuração da área de transferência"
271 271  
... ... @@ -297,7 +297,7 @@ msgstr &quot;Arquivo separado por vírgulas (CSV)&quot;
297 297 msgid "Command to execute"
298 298 msgstr "Comando a executar"
299 299  
300   -#: src/dialogs/settings/clipboard.c:315
  300 +#: src/dialogs/settings/clipboard.c:331
301 301 msgid "Complete with terminal attributes"
302 302 msgstr "Completo incluindo atributos do terminal"
303 303  
... ... @@ -321,7 +321,7 @@ msgstr &quot;Copiar como texto puro&quot;
321 321 msgid "Copy as table"
322 322 msgstr "Copiar como tabela"
323 323  
324   -#: src/dialogs/settings/clipboard.c:184
  324 +#: src/dialogs/settings/clipboard.c:199
325 325 msgid "Copy options"
326 326 msgstr "Opções da cópia"
327 327  
... ... @@ -527,7 +527,7 @@ msgstr &quot;Cinza&quot;
527 527 msgid "Green"
528 528 msgstr "Verde"
529 529  
530   -#: src/dialogs/settings/clipboard.c:186
  530 +#: src/dialogs/settings/clipboard.c:201
531 531 msgid "HTML options"
532 532 msgstr "Opções HTML"
533 533  
... ... @@ -693,11 +693,11 @@ msgstr &quot;Nenhuma transferência&quot;
693 693 msgid "No transfer in progress"
694 694 msgstr "Nenhuma transferência em andamento"
695 695  
696   -#: src/dialogs/settings/clipboard.c:248
  696 +#: src/dialogs/settings/clipboard.c:264
697 697 msgid "None (Don't export color)"
698 698 msgstr "Nenhum (Não exporta cores)"
699 699  
700   -#: src/dialogs/settings/clipboard.c:366
  700 +#: src/dialogs/settings/clipboard.c:382
701 701 msgid "None (Don't export font name)"
702 702 msgstr "Nenhuma (Não exporta fontes)"
703 703  
... ... @@ -801,7 +801,7 @@ msgstr &quot;Colar de um arquivo&quot;
801 801 msgid "Paste from text file"
802 802 msgstr "Colar de um arquivo texto"
803 803  
804   -#: src/dialogs/settings/clipboard.c:185
  804 +#: src/dialogs/settings/clipboard.c:200
805 805 msgid "Paste options"
806 806 msgstr "Opções para colar"
807 807  
... ... @@ -825,7 +825,7 @@ msgstr &quot;Rosa&quot;
825 825 msgid "Plain text"
826 826 msgstr "Texto puro"
827 827  
828   -#: src/dialogs/settings/clipboard.c:314
  828 +#: src/dialogs/settings/clipboard.c:330
829 829 msgid "Plain text only"
830 830 msgstr "Apenas texto puro"
831 831  
... ... @@ -982,7 +982,7 @@ msgstr &quot;&quot;
982 982 "SPACE can be specified in units of TRACKS, CYLINDERS, or AVBLOCK, and only "
983 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 986 msgid "Same of the screen"
987 987 msgstr "Igual ao terminal"
988 988  
... ... @@ -1482,6 +1482,11 @@ msgstr &quot;Documento sem título&quot;
1482 1482 msgid "Use host default record format."
1483 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 1490 #: src/filetransfer/tables.c:86
1486 1491 msgid "Variable"
1487 1492 msgstr "Variável"
... ... @@ -1490,6 +1495,14 @@ msgstr &quot;Variável&quot;
1490 1495 msgid "Western Europe (ISO 8859-1)"
1491 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 1506 #: src/dialogs/settings/colors.c:162
1494 1507 msgid "White"
1495 1508 msgstr "Branco"
... ...
src/dialogs/settings/clipboard.c
... ... @@ -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 146 /*--[ Globals ]--------------------------------------------------------------------------------------*/
133 147  
134 148 typedef struct _V3270ClipboardSettings {
... ... @@ -136,8 +150,9 @@
136 150 V3270Settings parent;
137 151  
138 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 156 } input;
142 157  
143 158  
... ... @@ -231,6 +246,7 @@ static void V3270ClipboardSettings_init(V3270ClipboardSettings *widget) {
231 246  
232 247 v3270_settings_create_toggle_buttons(toggles, G_N_ELEMENTS(toggles), grids, widget->input.toggles);
233 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 251 // Setup combos
236 252 {
... ... @@ -409,6 +425,8 @@ static void load(GtkWidget *w, GtkWidget *t) {
409 425 debug("Plain text: %s",((terminal->selection.options & V3270_SELECTION_PLAIN_TEXT) ? "0" : "1"));
410 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 431 // Set font combo-box
414 432 //
... ... @@ -474,7 +492,12 @@ static void apply(GtkWidget *w, GtkWidget *t) {
474 492 } else {
475 493  
476 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 502 // Get font settings
480 503 switch(get_active_id(widget,0)) {
... ...
src/dialogs/settings/private.h
... ... @@ -74,4 +74,13 @@
74 74  
75 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 86 #endif // PRIVATE_H_INCLUDED
... ...
src/dialogs/settings/tools.c
... ... @@ -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  
... ...