Commit 9b94498cb19867ee6d9edf7ed904fdbe8ecd9f50

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

Updating print dialog.

Showing 1 changed file with 28 additions and 2 deletions   Show diff stats
src/dialogs/print/print.c
... ... @@ -264,18 +264,20 @@ V3270PrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_PRINT
264 264 case LIB3270_PRINT_SELECTED:
265 265 {
266 266 int row, col;
  267 + int baddr = 0;
267 268  
268 269 GdkRectangle rect;
269 270 memset(&rect,0,sizeof(rect));
270 271 rect.x = lib3270_get_width(operation->session);
271 272 rect.y = lib3270_get_height(operation->session);
272 273  
273   - int baddr = 0;
  274 + // Get regions
  275 +
274 276 for(row = 0; row < lib3270_get_height(operation->session); row++)
275 277 {
276 278 for(col = 0; col < lib3270_get_width(operation->session); col++)
277 279 {
278   - if(lib3270_is_selected(operation->session,baddr))
  280 + if(lib3270_is_selected(operation->session,baddr++))
279 281 {
280 282 rect.x = MIN(rect.x,col);
281 283 rect.width = MAX(rect.width,col);
... ... @@ -289,6 +291,30 @@ V3270PrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_PRINT
289 291 operation->contents.height = rect.height - rect.y;
290 292 operation->contents.width = rect.width - rect.x;
291 293  
  294 + // Get contents
  295 + int r = 0;
  296 + column * text;
  297 +
  298 + operation->contents.text = g_new0(column *, operation->contents.height+1);
  299 +
  300 + for(row = rect.y; row < rect.width; row++)
  301 + {
  302 + int c = 0;
  303 + operation->contents.text[r++] = text = g_new0(column, operation->contents.width);
  304 +
  305 + for(col = rect.x; col < rect.height; col++)
  306 + {
  307 + lib3270_get_element(operation->session,lib3270_translate_to_address(operation->session,row,col),&text[c].c,&text[c].attr);
  308 + if(!(text[c].attr & LIB3270_ATTR_SELECTED))
  309 + {
  310 + text[c].c = 0;
  311 + text[c].attr = 0;
  312 + }
  313 + c++;
  314 + }
  315 +
  316 + }
  317 +
292 318 }
293 319 break;
294 320  
... ...