Commit 638607c5e8143029c2630fd0db602efb1292767a

Authored by perry.werneck@gmail.com
1 parent 73a8eff3
Exists in master and in 1 other branch develop

Implementando sinal e callback para impressão do conteúdo da tela

Showing 3 changed files with 20 additions and 49 deletions   Show diff stats
@@ -79,10 +79,10 @@ @@ -79,10 +79,10 @@
79 { GDK_KP_Add, GDK_NUMLOCK_MASK, NULL, NULL }, 79 { GDK_KP_Add, GDK_NUMLOCK_MASK, NULL, NULL },
80 { GDK_KP_Subtract, GDK_NUMLOCK_MASK, NULL, NULL }, 80 { GDK_KP_Subtract, GDK_NUMLOCK_MASK, NULL, NULL },
81 81
82 - { GDK_3270_PrintScreen, 0, NULL, NULL }, 82 + { GDK_3270_PrintScreen, 0, lib3270_print, NULL },
83 { GDK_Sys_Req, 0, lib3270_sysreq, NULL }, 83 { GDK_Sys_Req, 0, lib3270_sysreq, NULL },
84 84
85 - { GDK_Print, GDK_CONTROL_MASK, NULL, NULL }, 85 + { GDK_Print, GDK_CONTROL_MASK, lib3270_print, NULL },
86 { GDK_Print, GDK_SHIFT_MASK, lib3270_sysreq, NULL }, 86 { GDK_Print, GDK_SHIFT_MASK, lib3270_sysreq, NULL },
87 { GDK_Control_R, 0, NULL, NULL }, 87 { GDK_Control_R, 0, NULL, NULL },
88 { GDK_Control_L, 0, NULL, NULL }, 88 { GDK_Control_L, 0, NULL, NULL },
@@ -81,6 +81,7 @@ G_BEGIN_DECLS @@ -81,6 +81,7 @@ G_BEGIN_DECLS
81 SIGNAL_CHANGED, 81 SIGNAL_CHANGED,
82 SIGNAL_MESSAGE, 82 SIGNAL_MESSAGE,
83 SIGNAL_FIELD, 83 SIGNAL_FIELD,
  84 + SIGNAL_PRINT,
84 85
85 LAST_SIGNAL 86 LAST_SIGNAL
86 }; 87 };
@@ -165,18 +165,6 @@ static gboolean v3270_popup_menu(GtkWidget * widget) @@ -165,18 +165,6 @@ static gboolean v3270_popup_menu(GtkWidget * widget)
165 165
166 #if GTK_CHECK_VERSION(3,0,0) 166 #if GTK_CHECK_VERSION(3,0,0)
167 167
168 -/*  
169 -static GtkSizeRequestMode get_request_mode(GtkWidget *widget)  
170 -{  
171 - int rows, cols;  
172 -  
173 - lib3270_get_screen_size(GTK_V3270(widget)->host,&rows,&cols);  
174 -  
175 - return rows > cols ? GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT : GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;  
176 -  
177 -}  
178 -*/  
179 -  
180 void get_preferred_height(GtkWidget *widget, gint *minimum_height, gint *natural_height) 168 void get_preferred_height(GtkWidget *widget, gint *minimum_height, gint *natural_height)
181 { 169 {
182 int height = GTK_V3270(widget)->minimum_height; 170 int height = GTK_V3270(widget)->minimum_height;
@@ -200,31 +188,6 @@ void get_preferred_width(GtkWidget *widget, gint *minimum_width, gint *natural_w @@ -200,31 +188,6 @@ void get_preferred_width(GtkWidget *widget, gint *minimum_width, gint *natural_w
200 *natural_width = 600; 188 *natural_width = 600;
201 } 189 }
202 190
203 -/*  
204 -void get_preferred_height_for_width(GtkWidget *widget, gint width, gint *minimum_height, gint *natural_height)  
205 -{  
206 - trace("%s",__FUNCTION__);  
207 -  
208 - if(minimum_height)  
209 - *minimum_height = 10;  
210 -  
211 - if(natural_height)  
212 - *natural_height = 10;  
213 -}  
214 -  
215 -static void get_preferred_width_for_height(GtkWidget *widget,gint height, gint *minimum_width, gint *natural_width)  
216 -{  
217 - trace("%s",__FUNCTION__);  
218 -  
219 - if(minimum_width)  
220 - *minimum_width = 10;  
221 -  
222 - if(natural_width)  
223 - *natural_width = 10;  
224 -  
225 -}  
226 -*/  
227 -  
228 #endif // GTK(3,0,0) 191 #endif // GTK(3,0,0)
229 192
230 void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *title, const gchar *message, const gchar *text) 193 void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *title, const gchar *message, const gchar *text)
@@ -276,14 +239,6 @@ void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *t @@ -276,14 +239,6 @@ void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *t
276 239
277 gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_tooltip, GtkTooltip *tooltip) 240 gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_tooltip, GtkTooltip *tooltip)
278 { 241 {
279 -/*  
280 - if(!lib3270_connected(GTK_V3270(widget)->host))  
281 - {  
282 - gtk_tooltip_set_text(tooltip,_( "Disconnected" ) );  
283 - return TRUE;  
284 - }  
285 -*/  
286 -  
287 if(y >= GTK_V3270(widget)->oia_rect->y) 242 if(y >= GTK_V3270(widget)->oia_rect->y)
288 { 243 {
289 GdkRectangle *rect = GTK_V3270(widget)->oia_rect; 244 GdkRectangle *rect = GTK_V3270(widget)->oia_rect;
@@ -369,8 +324,6 @@ static void v3270_class_init(v3270Class *klass) @@ -369,8 +324,6 @@ static void v3270_class_init(v3270Class *klass)
369 324
370 widget_class->get_preferred_height = get_preferred_height; 325 widget_class->get_preferred_height = get_preferred_height;
371 widget_class->get_preferred_width = get_preferred_width; 326 widget_class->get_preferred_width = get_preferred_width;
372 -// widget_class->get_preferred_width_for_height = get_preferred_width_for_height;  
373 -// widget_class->get_preferred_height_for_width = get_preferred_height_for_width;  
374 327
375 widget_class->destroy = v3270_destroy; 328 widget_class->destroy = v3270_destroy;
376 widget_class->draw = v3270_draw; 329 widget_class->draw = v3270_draw;
@@ -589,6 +542,16 @@ static void v3270_class_init(v3270Class *klass) @@ -589,6 +542,16 @@ static void v3270_class_init(v3270Class *klass)
589 pw3270_BOOL__VOID_BOOL_UINT_POINTER, 542 pw3270_BOOL__VOID_BOOL_UINT_POINTER,
590 G_TYPE_BOOLEAN, 3, G_TYPE_BOOLEAN, G_TYPE_UINT, G_TYPE_POINTER); 543 G_TYPE_BOOLEAN, 3, G_TYPE_BOOLEAN, G_TYPE_UINT, G_TYPE_POINTER);
591 544
  545 +
  546 + v3270_widget_signal[SIGNAL_PRINT] =
  547 + g_signal_new( "print",
  548 + G_OBJECT_CLASS_TYPE (gobject_class),
  549 + G_SIGNAL_RUN_FIRST,
  550 + 0,
  551 + NULL, NULL,
  552 + pw3270_VOID__VOID,
  553 + G_TYPE_NONE, 0);
  554 +
592 } 555 }
593 556
594 void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height) 557 void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height)
@@ -865,6 +828,12 @@ static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const @@ -865,6 +828,12 @@ static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const
865 828
866 } 829 }
867 830
  831 +static int emit_print_signal(H3270 *session)
  832 +{
  833 + g_signal_emit(GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_PRINT], 0);
  834 + return 0;
  835 +}
  836 +
868 static void v3270_init(v3270 *widget) 837 static void v3270_init(v3270 *widget)
869 { 838 {
870 widget->host = lib3270_session_new(""); 839 widget->host = lib3270_session_new("");
@@ -899,6 +868,7 @@ static void v3270_init(v3270 *widget) @@ -899,6 +868,7 @@ static void v3270_init(v3270 *widget)
899 widget->host->ctlr_done = ctlr_done; 868 widget->host->ctlr_done = ctlr_done;
900 widget->host->message = message; 869 widget->host->message = message;
901 widget->host->update_ssl = v3270_update_ssl; 870 widget->host->update_ssl = v3270_update_ssl;
  871 + widget->host->print = emit_print_signal;
902 872
903 // Setup input method 873 // Setup input method
904 widget->input_method = gtk_im_multicontext_new(); 874 widget->input_method = gtk_im_multicontext_new();