Commit 20612e428d968635600c32f3701a556947746661

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

Allowing image formats on clipboard.

src/dialogs/settings/clipboard.c
@@ -163,11 +163,22 @@ @@ -163,11 +163,22 @@
163 .label = N_("Smart copy"), 163 .label = N_("Smart copy"),
164 .tooltip = N_("When set the first copy operation after the selection will set the clipboard contents and the next ones will append"), 164 .tooltip = N_("When set the first copy operation after the selection will set the clipboard contents and the next ones will append"),
165 .left = 1, 165 .left = 1,
  166 + .top = 4,
  167 + .width = 1,
  168 + .height = 1,
  169 + .grid = COPY_SETTINGS
  170 + },
  171 +
  172 + {
  173 + .label = N_("Image copy"),
  174 + .tooltip = N_("When set allow image formats on clipboard"),
  175 + .left = 1,
166 .top = 3, 176 .top = 3,
167 .width = 1, 177 .width = 1,
168 .height = 1, 178 .height = 1,
169 .grid = COPY_SETTINGS 179 .grid = COPY_SETTINGS
170 } 180 }
  181 +
171 }; 182 };
172 183
173 /*--[ Globals ]--------------------------------------------------------------------------------------*/ 184 /*--[ Globals ]--------------------------------------------------------------------------------------*/
@@ -472,6 +483,7 @@ static void load(GtkWidget *w, GtkWidget *t) { @@ -472,6 +483,7 @@ static void load(GtkWidget *w, GtkWidget *t) {
472 gtk_toggle_button_set_active(widget->input.checkboxes[0],(terminal->selection.options & V3270_SELECTION_NON_BREAKABLE_SPACE) != 0); 483 gtk_toggle_button_set_active(widget->input.checkboxes[0],(terminal->selection.options & V3270_SELECTION_NON_BREAKABLE_SPACE) != 0);
473 gtk_toggle_button_set_active(widget->input.checkboxes[1],(terminal->selection.options & V3270_SELECTION_SCREEN_PASTE) != 0); 484 gtk_toggle_button_set_active(widget->input.checkboxes[1],(terminal->selection.options & V3270_SELECTION_SCREEN_PASTE) != 0);
474 gtk_toggle_button_set_active(widget->input.checkboxes[2],(terminal->selection.options & V3270_SELECTION_SMART_COPY) != 0); 485 gtk_toggle_button_set_active(widget->input.checkboxes[2],(terminal->selection.options & V3270_SELECTION_SMART_COPY) != 0);
  486 + gtk_toggle_button_set_active(widget->input.checkboxes[3],(terminal->selection.options & V3270_SELECTION_PIXBUFF) != 0);
475 487
476 // 488 //
477 // Set font combo-box 489 // Set font combo-box
@@ -559,6 +571,12 @@ static void apply(GtkWidget *w, GtkWidget *t) { @@ -559,6 +571,12 @@ static void apply(GtkWidget *w, GtkWidget *t) {
559 terminal->selection.options &= ~V3270_SELECTION_SMART_COPY; 571 terminal->selection.options &= ~V3270_SELECTION_SMART_COPY;
560 } 572 }
561 573
  574 + if(gtk_toggle_button_get_active(widget->input.checkboxes[3])) {
  575 + terminal->selection.options |= V3270_SELECTION_PIXBUFF;
  576 + } else {
  577 + terminal->selection.options &= ~V3270_SELECTION_PIXBUFF;
  578 + }
  579 +
562 // Get font settings 580 // Get font settings
563 switch(get_active_id(widget,0)) { 581 switch(get_active_id(widget,0)) {
564 case '0': 582 case '0':
src/include/clipboard.h
@@ -45,7 +45,8 @@ @@ -45,7 +45,8 @@
45 CLIPBOARD_TYPE_TEXT, 45 CLIPBOARD_TYPE_TEXT,
46 CLIPBOARD_TYPE_CSV, 46 CLIPBOARD_TYPE_CSV,
47 CLIPBOARD_TYPE_HTML, 47 CLIPBOARD_TYPE_HTML,
48 - CLIPBOARD_TYPE_V3270_FORMATTED 48 + CLIPBOARD_TYPE_V3270_FORMATTED,
  49 + CLIPBOARD_TYPE_PIXBUFF
49 }; 50 };
50 51
51 /// @brief Column from selection. 52 /// @brief Column from selection.
src/include/terminal.h
@@ -127,6 +127,7 @@ G_BEGIN_DECLS @@ -127,6 +127,7 @@ G_BEGIN_DECLS
127 V3270_SELECTION_SCREEN_PASTE = 0x08, ///< @brief Enable screen paste. 127 V3270_SELECTION_SCREEN_PASTE = 0x08, ///< @brief Enable screen paste.
128 V3270_SELECTION_SMART_COPY = 0x10, ///< @brief Enable copy/append based on current selection state. 128 V3270_SELECTION_SMART_COPY = 0x10, ///< @brief Enable copy/append based on current selection state.
129 V3270_SELECTION_DIALOG_STATE = 0x20, ///< @brief Used for settings dialog. 129 V3270_SELECTION_DIALOG_STATE = 0x20, ///< @brief Used for settings dialog.
  130 + V3270_SELECTION_PIXBUFF = 0x40, ///< @brief Allow pixbuf formats.
130 131
131 } V3270SelectionOption; 132 } V3270SelectionOption;
132 133
src/selection/linux/copy.c
@@ -104,6 +104,20 @@ static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionDa @@ -104,6 +104,20 @@ static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionDa
104 } 104 }
105 break; 105 break;
106 106
  107 + case CLIPBOARD_TYPE_PIXBUFF:
  108 + {
  109 + GdkPixbuf * pixbuff = v3270_get_selection_as_pixbuf(terminal, terminal->selection.blocks, FALSE);
  110 +
  111 + debug("%s: pixbuff=%p (blocks=%p)",__FUNCTION__,pixbuff,terminal->selection.blocks);
  112 +
  113 + if(pixbuff)
  114 + {
  115 + gtk_selection_data_set_pixbuf(selection,pixbuff);
  116 + g_object_unref(pixbuff);
  117 + }
  118 + }
  119 + break;
  120 +
107 default: 121 default:
108 g_warning("Unexpected clipboard type %d\n",target); 122 g_warning("Unexpected clipboard type %d\n",target);
109 } 123 }
@@ -143,6 +157,11 @@ void v3270_update_system_clipboard(GtkWidget *widget) @@ -143,6 +157,11 @@ void v3270_update_system_clipboard(GtkWidget *widget)
143 157
144 } 158 }
145 159
  160 + if(terminal->selection.options & V3270_SELECTION_PIXBUFF)
  161 + {
  162 + gtk_target_list_add_image_targets(list,CLIPBOARD_TYPE_PIXBUFF,TRUE);
  163 + }
  164 +
146 int n_targets; 165 int n_targets;
147 GtkTargetEntry * targets = gtk_target_table_new_from_list(list, &n_targets); 166 GtkTargetEntry * targets = gtk_target_table_new_from_list(list, &n_targets);
148 167
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <Option makefile_is_custom="1" /> 6 <Option makefile_is_custom="1" />
7 <Option pch_mode="2" /> 7 <Option pch_mode="2" />
8 <Option compiler="gcc" /> 8 <Option compiler="gcc" />
9 - <Option virtualFolders="src/selection/" />  
10 <Build> 9 <Build>
11 <Target title="Debug"> 10 <Target title="Debug">
12 <Option output=".bin/Debug/libv3270" prefix_auto="1" extension_auto="1" /> 11 <Option output=".bin/Debug/libv3270" prefix_auto="1" extension_auto="1" />
@@ -214,7 +213,6 @@ @@ -214,7 +213,6 @@
214 </Unit> 213 </Unit>
215 <Unit filename="src/selection/linux/copy.c"> 214 <Unit filename="src/selection/linux/copy.c">
216 <Option compilerVar="CC" /> 215 <Option compilerVar="CC" />
217 - <Option virtualFolder="src/selection/" />  
218 </Unit> 216 </Unit>
219 <Unit filename="src/selection/linux/paste.c"> 217 <Unit filename="src/selection/linux/paste.c">
220 <Option compilerVar="CC" /> 218 <Option compilerVar="CC" />