Commit 8a9e10e92b875e2d7307e6ab63ff15468c13ec9b

Authored by Perry Werneck
1 parent 54e33560
Exists in master and in 1 other branch develop

Adding "default" copy mode.

src/dialogs/settings/widget.c
@@ -97,7 +97,7 @@ static void finalize(GObject *object) @@ -97,7 +97,7 @@ static void finalize(GObject *object)
97 G_OBJECT_CLASS(V3270Settings_parent_class)->finalize(object); 97 G_OBJECT_CLASS(V3270Settings_parent_class)->finalize(object);
98 } 98 }
99 99
100 -static void validity(GtkWidget *widget, gboolean state) 100 +static void validity(GtkWidget G_GNUC_UNUSED(*widget), gboolean G_GNUC_UNUSED(state))
101 { 101 {
102 102
103 } 103 }
src/include/v3270.h
@@ -199,6 +199,8 @@ @@ -199,6 +199,8 @@
199 // Clipboard 199 // Clipboard
200 typedef enum _v3270_copy_mode 200 typedef enum _v3270_copy_mode
201 { 201 {
  202 +
  203 + V3270_COPY_DEFAULT, ///< @brief Detect format based on lib3270's smart past toggle.
202 V3270_COPY_FORMATTED, ///< @brief Copy formatted data; keep attributes. 204 V3270_COPY_FORMATTED, ///< @brief Copy formatted data; keep attributes.
203 V3270_COPY_TEXT, ///< @brief Single text format, ignore attributes. 205 V3270_COPY_TEXT, ///< @brief Single text format, ignore attributes.
204 V3270_COPY_TABLE, ///< @brief Copy as table. 206 V3270_COPY_TABLE, ///< @brief Copy as table.
src/selection/copy.c
@@ -53,6 +53,10 @@ @@ -53,6 +53,10 @@
53 v3270_clear_selection(terminal); 53 v3270_clear_selection(terminal);
54 54
55 // ... and set the new mode. 55 // ... and set the new mode.
  56 + if(mode == V3270_COPY_DEFAULT) {
  57 + mode = (lib3270_get_toggle(v3270_get_session(widget),LIB3270_TOGGLE_SMART_PASTE) ? V3270_COPY_FORMATTED : V3270_COPY_TEXT);
  58 + }
  59 +
56 terminal->selection.format = mode; 60 terminal->selection.format = mode;
57 61
58 } 62 }
src/testprogram/toolbar.c
@@ -162,7 +162,7 @@ @@ -162,7 +162,7 @@
162 162
163 static void copy_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) 163 static void copy_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal)
164 { 164 {
165 - v3270_copy_selection(terminal,V3270_COPY_TEXT,FALSE); 165 + v3270_clipboard_set(terminal,V3270_COPY_TEXT,FALSE);
166 } 166 }
167 167
168 static void color_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) 168 static void color_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal)