Commit aba9cdef1e2254dc64fc2ffe22ca920830257a18

Authored by perry.werneck@gmail.com
1 parent 4ffa4f37

Incluindo funcoes para obtenção das bordas de palavra e campo para uso no compon…

…ente de acessibilidade
@@ -174,6 +174,9 @@ @@ -174,6 +174,9 @@
174 <Unit filename="src/lib3270/aplc.h" /> 174 <Unit filename="src/lib3270/aplc.h" />
175 <Unit filename="src/lib3270/appres.h" /> 175 <Unit filename="src/lib3270/appres.h" />
176 <Unit filename="src/lib3270/arpa_telnet.h" /> 176 <Unit filename="src/lib3270/arpa_telnet.h" />
  177 + <Unit filename="src/lib3270/bounds.c">
  178 + <Option compilerVar="CC" />
  179 + </Unit>
177 <Unit filename="src/lib3270/cg.h" /> 180 <Unit filename="src/lib3270/cg.h" />
178 <Unit filename="src/lib3270/charset.c"> 181 <Unit filename="src/lib3270/charset.c">
179 <Option compilerVar="CC" /> 182 <Option compilerVar="CC" />
src/gtk/v3270/accessible.c
@@ -506,7 +506,34 @@ static gboolean v3270_accessible_set_selection(AtkText *text, gint selection_num @@ -506,7 +506,34 @@ static gboolean v3270_accessible_set_selection(AtkText *text, gint selection_num
506 return FALSE; 506 return FALSE;
507 } 507 }
508 508
509 -/* 509 +static AtkAttributeSet *add_attribute(AtkAttributeSet * attributes, AtkTextAttribute attr, const gchar *value)
  510 +{
  511 + AtkAttribute *at = g_new(AtkAttribute, 1);
  512 +
  513 + at->name = g_strdup (atk_text_attribute_get_name (attr));
  514 + at->value = g_strdup (value);
  515 +
  516 + return g_slist_prepend (attributes, at);
  517 +}
  518 +
  519 +static AtkAttributeSet * v3270_accessible_get_default_attributes (AtkText *text)
  520 +{
  521 + GtkWidget * widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
  522 + AtkAttributeSet * attributes = NULL;
  523 +
  524 + if(!widget)
  525 + return NULL;
  526 +
  527 + trace("%s is incomplete ***********************",__FUNCTION__);
  528 +
  529 + // http://developer.gnome.org/atk/stable/AtkText.html#AtkTextAttribute
  530 +
  531 + // The direction of the text, if set. Values are "none", "ltr" or "rtl"
  532 + attributes = add_attribute(attributes, ATK_TEXT_ATTR_DIRECTION,atk_text_attribute_get_value(ATK_TEXT_ATTR_DIRECTION,gtk_widget_get_direction(widget)));
  533 +
  534 + return attributes;
  535 +}
  536 +
510 static AtkAttributeSet * v3270_accessible_get_run_attributes(AtkText *text, gint offset, gint * start_offset, gint * end_offset) 537 static AtkAttributeSet * v3270_accessible_get_run_attributes(AtkText *text, gint offset, gint * start_offset, gint * end_offset)
511 { 538 {
512 GtkWidget * widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); 539 GtkWidget * widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
@@ -519,14 +546,33 @@ static AtkAttributeSet * v3270_accessible_get_run_attributes(AtkText *text, gint @@ -519,14 +546,33 @@ static AtkAttributeSet * v3270_accessible_get_run_attributes(AtkText *text, gint
519 546
520 // http://developer.gnome.org/atk/stable/AtkText.html#AtkTextAttribute 547 // http://developer.gnome.org/atk/stable/AtkText.html#AtkTextAttribute
521 548
522 - attributes = add_attribute (attributes, ATK_TEXT_ATTR_DIRECTION,  
523 - atk_text_attribute_get_value (ATK_TEXT_ATTR_DIRECTION,  
524 - gtk_widget_get_direction(widget))); 549 + // The direction of the text, if set. Values are "none", "ltr" or "rtl"
  550 + attributes = add_attribute(attributes, ATK_TEXT_ATTR_DIRECTION,atk_text_attribute_get_value(ATK_TEXT_ATTR_DIRECTION,gtk_widget_get_direction(widget)));
  551 +
  552 +
  553 + // ATK_TEXT_ATTR_LEFT_MARGIN
  554 + // The pixel width of the left margin
525 555
  556 + // ATK_TEXT_ATTR_RIGHT_MARGIN
  557 + // The pixel width of the right margin
  558 +
  559 + // ATK_TEXT_ATTR_INVISIBLE
  560 + // Either "true" or "false" indicating whether text is visible or not
  561 +
  562 + // Either "true" or "false" indicating whether text is editable or not
  563 + // ATK_TEXT_ATTR_EDITABLE
  564 +
  565 + // The background color. The value is an RGB value of the format "u,u,u"
  566 + // ATK_TEXT_ATTR_BG_COLOR
  567 +
  568 + // The foreground color. The value is an RGB value of the format "u,u,u"
  569 + // ATK_TEXT_ATTR_FG_COLOR
  570 +
  571 + // The font family name
  572 + // ATK_TEXT_ATTR_FAMILY_NAME
526 573
527 return attributes; 574 return attributes;
528 } 575 }
529 -*/  
530 576
531 static void atk_text_interface_init(AtkTextIface *iface) 577 static void atk_text_interface_init(AtkTextIface *iface)
532 { 578 {
@@ -547,6 +593,9 @@ static void atk_text_interface_init(AtkTextIface *iface) @@ -547,6 +593,9 @@ static void atk_text_interface_init(AtkTextIface *iface)
547 iface->remove_selection = v3270_accessible_remove_selection; 593 iface->remove_selection = v3270_accessible_remove_selection;
548 iface->set_selection = v3270_accessible_set_selection; 594 iface->set_selection = v3270_accessible_set_selection;
549 iface->get_selection = v3270_accessible_get_selection; 595 iface->get_selection = v3270_accessible_get_selection;
  596 + iface->get_run_attributes = v3270_accessible_get_run_attributes;
  597 + iface->get_default_attributes = v3270_accessible_get_default_attributes;
  598 +
550 599
551 /* 600 /*
552 http://git.gnome.org/browse/gtk+/tree/gtk/a11y/gtklabelaccessible.c 601 http://git.gnome.org/browse/gtk+/tree/gtk/a11y/gtklabelaccessible.c
@@ -556,8 +605,6 @@ http://git.gnome.org/browse/gtk+/tree/gtk/a11y/gtklabelaccessible.c @@ -556,8 +605,6 @@ http://git.gnome.org/browse/gtk+/tree/gtk/a11y/gtklabelaccessible.c
556 iface->get_text_after_offset = gtk_label_accessible_get_text_after_offset; 605 iface->get_text_after_offset = gtk_label_accessible_get_text_after_offset;
557 606
558 607
559 - iface->get_run_attributes = gtk_label_accessible_get_run_attributes;  
560 - iface->get_default_attributes = gtk_label_accessible_get_default_attributes;  
561 */ 608 */
562 } 609 }
563 610
src/gtk/v3270/mouse.c
@@ -87,11 +87,13 @@ static void button_1_press(GtkWidget *widget, GdkEventType type, int baddr) @@ -87,11 +87,13 @@ static void button_1_press(GtkWidget *widget, GdkEventType type, int baddr)
87 break; 87 break;
88 88
89 case GDK_2BUTTON_PRESS: // Double click - Select word 89 case GDK_2BUTTON_PRESS: // Double click - Select word
90 - lib3270_select_word(GTK_V3270(widget)->host,baddr); 90 + if(lib3270_select_word_at(GTK_V3270(widget)->host,baddr));
  91 + lib3270_ring_bell(GTK_V3270(widget)->host);
91 break; 92 break;
92 93
93 case GDK_3BUTTON_PRESS: // Triple clock - Select field 94 case GDK_3BUTTON_PRESS: // Triple clock - Select field
94 - lib3270_select_field_at(GTK_V3270(widget)->host,baddr); 95 + if(lib3270_select_field_at(GTK_V3270(widget)->host,baddr))
  96 + lib3270_ring_bell(GTK_V3270(widget)->host);
95 break; 97 break;
96 98
97 #ifdef DEBUG 99 #ifdef DEBUG
src/include/lib3270.h
@@ -695,6 +695,22 @@ @@ -695,6 +695,22 @@
695 */ 695 */
696 LIB3270_EXPORT int lib3270_get_element(H3270 *h, int baddr, unsigned char *c, unsigned short *attr); 696 LIB3270_EXPORT int lib3270_get_element(H3270 *h, int baddr, unsigned char *c, unsigned short *attr);
697 697
  698 + /**
  699 + * Get field region
  700 + *
  701 + * @param h Session handle.
  702 + * @param baddr Reference position to get the field start/stop offsets.
  703 + * @param start return location for start of selection, as a character offset.
  704 + * @param end return location for end of selection, as a character offset.
  705 + *
  706 + * @return Non 0 if invalid
  707 + *
  708 + */
  709 + LIB3270_EXPORT int lib3270_get_field_bounds(H3270 *hSession, int baddr, int *start, int *end);
  710 +
  711 + LIB3270_EXPORT int lib3270_get_word_bounds(H3270 *hSession, int baddr, int *start, int *end);
  712 +
  713 +
698 LIB3270_EXPORT int lib3270_set_model(H3270 *session, int model); 714 LIB3270_EXPORT int lib3270_set_model(H3270 *session, int model);
699 LIB3270_EXPORT int lib3270_get_model(H3270 *session); 715 LIB3270_EXPORT int lib3270_get_model(H3270 *session);
700 716
src/include/lib3270/selection.h
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 35
36 LIB3270_EXPORT void lib3270_clear_selection(H3270 *session); 36 LIB3270_EXPORT void lib3270_clear_selection(H3270 *session);
37 LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr); 37 LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr);
38 - LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr); 38 + LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr);
39 LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr); 39 LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr);
40 40
41 /** 41 /**
src/include/lib3270/session.h
@@ -76,7 +76,8 @@ @@ -76,7 +76,8 @@
76 #endif 76 #endif
77 77
78 // flags 78 // flags
79 - int selected : 1; 79 + int selected : 1; /**< Has selected region? */
  80 + int rectsel : 1; /**< Selected region is a rectangle ? */
80 81
81 struct lib3270_toggle toggle[LIB3270_TOGGLE_COUNT]; 82 struct lib3270_toggle toggle[LIB3270_TOGGLE_COUNT];
82 83
src/lib3270/Makefile.in
@@ -95,7 +95,7 @@ SOURCES = XtGlue.c init.c actions.c ansi.c charset.c ctlr.c \ @@ -95,7 +95,7 @@ SOURCES = XtGlue.c init.c actions.c ansi.c charset.c ctlr.c \
95 print.c printer.c proxy.c resources.c rpq.c screen.c see.c \ 95 print.c printer.c proxy.c resources.c rpq.c screen.c see.c \
96 sf.c tables.c telnet.c toggles.c trace_ds.c utf8.c util.c \ 96 sf.c tables.c telnet.c toggles.c trace_ds.c utf8.c util.c \
97 xio.c resolver.c log.c paste.c macros.c fallbacks.c version.c \ 97 xio.c resolver.c log.c paste.c macros.c fallbacks.c version.c \
98 - selection.c 98 + selection.c bounds.c
99 99
100 #---[ Misc targets ]----------------------------------------------------------- 100 #---[ Misc targets ]-----------------------------------------------------------
101 101
src/lib3270/bounds.c 0 → 100644
@@ -0,0 +1,94 @@ @@ -0,0 +1,94 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
  19 + * Place, Suite 330, Boston, MA, 02111-1307, USA
  20 + *
  21 + * Este programa está nomeado como bounds.c e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)
  30 + *
  31 + */
  32 +
  33 +#include "globals.h"
  34 +
  35 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  36 +
  37 +LIB3270_EXPORT int lib3270_get_field_bounds(H3270 *session, int baddr, int *start, int *end)
  38 +{
  39 + int first;
  40 +
  41 + CHECK_SESSION_HANDLE(session);
  42 +
  43 + if(!lib3270_connected(session))
  44 + return -1;
  45 +
  46 + first = lib3270_field_addr(session,baddr);
  47 +
  48 + if(first < 0)
  49 + return -1;
  50 +
  51 + first++;
  52 +
  53 + if(start)
  54 + *start = first;
  55 +
  56 + if(end)
  57 + {
  58 + int maxlen = (session->rows * session->cols)-1;
  59 + *end = first + lib3270_field_length(session,first);
  60 + if(*end > maxlen)
  61 + *end = maxlen;
  62 + }
  63 +
  64 + return 0;
  65 +}
  66 +
  67 +LIB3270_EXPORT int lib3270_get_word_bounds(H3270 *session, int baddr, int *start, int *end)
  68 +{
  69 + int pos;
  70 +
  71 + CHECK_SESSION_HANDLE(session);
  72 +
  73 + if(!lib3270_connected(session) || isspace(session->text[baddr].chr))
  74 + return -1;
  75 +
  76 + if(start)
  77 + {
  78 + for(pos = baddr; pos > 0 && !isspace(session->text[pos].chr);pos--);
  79 +
  80 + *start = pos > 0 ? pos+1 : 0;
  81 + }
  82 +
  83 + if(end)
  84 + {
  85 + int maxlen = session->rows * session->cols;
  86 + for(pos = baddr; pos < maxlen && !isspace(session->text[pos].chr);pos++);
  87 +
  88 + *end = pos < maxlen ? pos-1 : maxlen;
  89 + }
  90 +
  91 + return 0;
  92 +}
  93 +
  94 +
src/lib3270/selection.c
@@ -34,13 +34,16 @@ @@ -34,13 +34,16 @@
34 #include <lib3270/session.h> 34 #include <lib3270/session.h>
35 #include <lib3270/selection.h> 35 #include <lib3270/selection.h>
36 36
37 - #define SELECTION_LEFT 0x01  
38 - #define SELECTION_TOP 0x02  
39 - #define SELECTION_RIGHT 0x04  
40 - #define SELECTION_BOTTOM 0x08  
41 - #define SELECTION_ACTIVE 0x10 37 + #define SELECTION_LEFT 0x01
  38 + #define SELECTION_TOP 0x02
  39 + #define SELECTION_RIGHT 0x04
  40 + #define SELECTION_BOTTOM 0x08
  41 + #define SELECTION_SINGLE_ROW 0x10
  42 + #define SELECTION_SINGLE_COL 0x20
42 43
43 - static void select_region(H3270 *h, int start, int end); 44 + #define SELECTION_ACTIVE 0x80
  45 +
  46 + static void do_select(H3270 *h, int start, int end, int rect);
44 47
45 /*--[ Implement ]------------------------------------------------------------------------------------*/ 48 /*--[ Implement ]------------------------------------------------------------------------------------*/
46 49
@@ -212,7 +215,7 @@ LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr) @@ -212,7 +215,7 @@ LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr)
212 215
213 cursor_move(session,end = baddr); 216 cursor_move(session,end = baddr);
214 217
215 - select_region(session,start,end); 218 + do_select(session,start,end,lib3270_get_toggle(session,LIB3270_TOGGLE_RECTANGLE_SELECT));
216 219
217 } 220 }
218 221
@@ -231,12 +234,12 @@ LIB3270_EXPORT void lib3270_select_region(H3270 *h, int start, int end) @@ -231,12 +234,12 @@ LIB3270_EXPORT void lib3270_select_region(H3270 *h, int start, int end)
231 if(start < 0 || start > maxlen || end < 0 || end > maxlen || start > end) 234 if(start < 0 || start > maxlen || end < 0 || end > maxlen || start > end)
232 return; 235 return;
233 236
234 - select_region(h,start,end); 237 + do_select(h,start,end,lib3270_get_toggle(h,LIB3270_TOGGLE_RECTANGLE_SELECT));
235 cursor_move(h,h->select.end); 238 cursor_move(h,h->select.end);
236 239
237 } 240 }
238 241
239 -static void select_region(H3270 *h, int start, int end) 242 +static void do_select(H3270 *h, int start, int end, int rect)
240 { 243 {
241 244
242 // Do we really need to change selection? 245 // Do we really need to change selection?
@@ -246,10 +249,16 @@ static void select_region(H3270 *h, int start, int end) @@ -246,10 +249,16 @@ static void select_region(H3270 *h, int start, int end)
246 h->select.start = start; 249 h->select.start = start;
247 h->select.end = end; 250 h->select.end = end;
248 251
249 - if(lib3270_get_toggle(h,LIB3270_TOGGLE_RECTANGLE_SELECT)) 252 + if(rect)
  253 + {
  254 + h->rectsel = 1;
250 update_selected_rectangle(h); 255 update_selected_rectangle(h);
  256 + }
251 else 257 else
  258 + {
  259 + h->rectsel = 0;
252 update_selected_region(h); 260 update_selected_region(h);
  261 + }
253 262
254 if(!h->selected) 263 if(!h->selected)
255 { 264 {
@@ -275,6 +284,12 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba @@ -275,6 +284,12 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba
275 col = baddr % hSession->cols; 284 col = baddr % hSession->cols;
276 rc |= SELECTION_ACTIVE; 285 rc |= SELECTION_ACTIVE;
277 286
  287 + if( (hSession->select.start % hSession->cols) == (hSession->select.end % hSession->cols) )
  288 + rc |= SELECTION_SINGLE_COL;
  289 +
  290 + if( (hSession->select.start / hSession->cols) == (hSession->select.end / hSession->cols) )
  291 + rc |= SELECTION_SINGLE_ROW;
  292 +
278 if( (col == 0) || !(hSession->text[baddr-1].attr & LIB3270_ATTR_SELECTED) ) 293 if( (col == 0) || !(hSession->text[baddr-1].attr & LIB3270_ATTR_SELECTED) )
279 rc |= SELECTION_LEFT; 294 rc |= SELECTION_LEFT;
280 295
@@ -290,57 +305,28 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba @@ -290,57 +305,28 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba
290 return rc; 305 return rc;
291 } 306 }
292 307
293 -LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr) 308 +LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr)
294 { 309 {
295 - int pos, len, start, end;  
296 -  
297 - CHECK_SESSION_HANDLE(session); 310 + int start, end;
298 311
299 - if(!lib3270_connected(session) || isspace(session->text[baddr].chr))  
300 - {  
301 - lib3270_ring_bell(session);  
302 - return;  
303 - } 312 + if(lib3270_get_word_bounds(session,baddr,&start,&end))
  313 + return -1;
304 314
305 - start = session->select.start;  
306 - for(pos = baddr; pos > 0 && !isspace(session->text[pos].chr);pos--);  
307 - start = pos > 0 ? pos+1 : 0; 315 + trace("%s: baddr=%d start=%d end=%d",__FUNCTION__,baddr,start,end);
308 316
309 - len = session->rows * session->cols;  
310 - for(pos = baddr; pos < len && !isspace(session->text[pos].chr);pos++);  
311 - end = pos < len ? pos-1 : len; 317 + do_select(session,start,end,0);
312 318
313 - select_region(session,start,end); 319 + return 0;
314 } 320 }
315 321
316 LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr) 322 LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr)
317 { 323 {
318 - int start, end,len;  
319 -  
320 - CHECK_SESSION_HANDLE(session);  
321 -  
322 - if(!lib3270_connected(session))  
323 - {  
324 - lib3270_ring_bell(session);  
325 - return -1;  
326 - }  
327 -  
328 - start = lib3270_field_addr(session,baddr); 324 + int start, end;
329 325
330 - if(start < 0)  
331 - {  
332 - lib3270_ring_bell(session); 326 + if(lib3270_get_field_bounds(session,baddr,&start,&end))
333 return -1; 327 return -1;
334 - }  
335 -  
336 - start++;  
337 328
338 - len = (session->rows * session->cols)-1;  
339 - end = start + lib3270_field_length(session,start);  
340 - if(end > len)  
341 - end = len;  
342 -  
343 - select_region(session,start,end); 329 + do_select(session,start,end,0);
344 330
345 return 0; 331 return 0;
346 } 332 }
@@ -358,21 +344,8 @@ LIB3270_ACTION( selectall ) @@ -358,21 +344,8 @@ LIB3270_ACTION( selectall )
358 344
359 CHECK_SESSION_HANDLE(hSession); 345 CHECK_SESSION_HANDLE(hSession);
360 346
361 - select_region(hSession,0,hSession->rows*hSession->cols);  
362 -/*  
363 - len = hSession->rows*hSession->cols;  
364 -  
365 - for(baddr = 0; baddr < len; baddr++)  
366 - {  
367 - if(!(hSession->text[baddr].attr & LIB3270_ATTR_SELECTED))  
368 - {  
369 - hSession->text[baddr].attr |= LIB3270_ATTR_SELECTED;  
370 - hSession->update(hSession,baddr,hSession->text[baddr].chr,hSession->text[baddr].attr,baddr == hSession->cursor_addr);  
371 - }  
372 - } 347 + do_select(hSession,0,hSession->rows*hSession->cols,0);
373 348
374 - set_selected(hSession);  
375 -*/  
376 return 0; 349 return 0;
377 } 350 }
378 351
@@ -385,7 +358,7 @@ LIB3270_ACTION( reselect ) @@ -385,7 +358,7 @@ LIB3270_ACTION( reselect )
385 if(!lib3270_connected(hSession) || hSession->select.start == hSession->select.end || hSession->selected) 358 if(!lib3270_connected(hSession) || hSession->select.start == hSession->select.end || hSession->selected)
386 return 0; 359 return 0;
387 360
388 - select_region(hSession, hSession->select.start,hSession->select.end); 361 + do_select(hSession, hSession->select.start,hSession->select.end,lib3270_get_toggle(hSession,LIB3270_TOGGLE_RECTANGLE_SELECT));
389 362
390 return 0; 363 return 0;
391 } 364 }
@@ -589,9 +562,9 @@ LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) @@ -589,9 +562,9 @@ LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to)
589 cols = hSession->cols - ((pos[f] % hSession->cols)+1); 562 cols = hSession->cols - ((pos[f] % hSession->cols)+1);
590 } 563 }
591 564
592 - step = (rows * hSession->cols) + cols; 565 + step = (rows * hSession->cols) + cols;
593 566
594 - select_region(hSession,hSession->select.start + step,hSession->select.end + step); 567 + do_select(hSession,hSession->select.start + step,hSession->select.end + step,hSession->rectsel);
595 cursor_move(hSession,hSession->select.end); 568 cursor_move(hSession,hSession->select.end);
596 569
597 return from+step; 570 return from+step;
@@ -604,8 +577,6 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig @@ -604,8 +577,6 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig
604 if(!lib3270_get_selection_bounds(h,&first,&last)) 577 if(!lib3270_get_selection_bounds(h,&first,&last))
605 return origin; 578 return origin;
606 579
607 - flag &= 0x1f;  
608 -  
609 trace("%s: flag=%04x",__FUNCTION__,flag); 580 trace("%s: flag=%04x",__FUNCTION__,flag);
610 581
611 if(!flag) 582 if(!flag)
@@ -629,9 +600,9 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig @@ -629,9 +600,9 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig
629 origin = last = (row*h->cols) + (last%h->cols); 600 origin = last = (row*h->cols) + (last%h->cols);
630 601
631 if(first < last) 602 if(first < last)
632 - select_region(h,first,last); 603 + do_select(h,first,last,h->rectsel);
633 else 604 else
634 - select_region(h,last,first); 605 + do_select(h,last,first,h->rectsel);
635 606
636 cursor_move(h,h->select.end); 607 cursor_move(h,h->select.end);
637 608
@@ -683,7 +654,7 @@ LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir @@ -683,7 +654,7 @@ LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir
683 return -1; 654 return -1;
684 } 655 }
685 656
686 - select_region(hSession,start,end); 657 + do_select(hSession,start,end,hSession->rectsel);
687 cursor_move(hSession,hSession->select.end); 658 cursor_move(hSession,hSession->select.end);
688 659
689 return 0; 660 return 0;