Commit 016a9ca1e1cafa6c01eed0b29eaab6cc541e1462

Authored by perry.werneck@gmail.com
1 parent 0c22bc87

Implementando mudança do ponteiro do mouse de acordo com o campo

@@ -271,7 +271,7 @@ @@ -271,7 +271,7 @@
271 271
272 /* Screen processing */ 272 /* Screen processing */
273 273
274 - #define CURSOR_MODE_NORMAL LIB3270_CURSOR_NORMAL 274 + #define CURSOR_MODE_NORMAL LIB3270_CURSOR_EDITABLE
275 #define CURSOR_MODE_WAITING LIB3270_CURSOR_WAITING 275 #define CURSOR_MODE_WAITING LIB3270_CURSOR_WAITING
276 #define CURSOR_MODE_LOCKED LIB3270_CURSOR_LOCKED 276 #define CURSOR_MODE_LOCKED LIB3270_CURSOR_LOCKED
277 277
@@ -380,7 +380,6 @@ int lib3270_field_length(H3270 *h, int baddr) @@ -380,7 +380,6 @@ int lib3270_field_length(H3270 *h, int baddr)
380 */ 380 */
381 unsigned char get_field_attribute(H3270 *h, int baddr) 381 unsigned char get_field_attribute(H3270 *h, int baddr)
382 { 382 {
383 - CHECK_SESSION_HANDLE(h);  
384 return h->ea_buf[find_field_attribute(h,baddr)].fa; 383 return h->ea_buf[find_field_attribute(h,baddr)].fa;
385 } 384 }
386 385
@@ -435,20 +434,19 @@ fa2ea(int baddr) @@ -435,20 +434,19 @@ fa2ea(int baddr)
435 * unprotected attribute byte, or 0 if no nonzero-width unprotected field 434 * unprotected attribute byte, or 0 if no nonzero-width unprotected field
436 * can be found. 435 * can be found.
437 */ 436 */
438 -int  
439 -next_unprotected(int baddr0) 437 +int next_unprotected(H3270 *session, int baddr0)
440 { 438 {
441 register int baddr, nbaddr; 439 register int baddr, nbaddr;
442 440
443 nbaddr = baddr0; 441 nbaddr = baddr0;
444 - do { 442 + do
  443 + {
445 baddr = nbaddr; 444 baddr = nbaddr;
446 INC_BA(nbaddr); 445 INC_BA(nbaddr);
447 - if (h3270.ea_buf[baddr].fa &&  
448 - !FA_IS_PROTECTED(h3270.ea_buf[baddr].fa) &&  
449 - !h3270.ea_buf[nbaddr].fa) 446 + if(session->ea_buf[baddr].fa &&!FA_IS_PROTECTED(session->ea_buf[baddr].fa) &&!session->ea_buf[nbaddr].fa)
450 return nbaddr; 447 return nbaddr;
451 } while (nbaddr != baddr0); 448 } while (nbaddr != baddr0);
  449 +
452 return 0; 450 return 0;
453 } 451 }
454 452
@@ -1287,7 +1285,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1287,7 +1285,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1287 * Otherwise, advance to the first position of the 1285 * Otherwise, advance to the first position of the
1288 * next unprotected field. 1286 * next unprotected field.
1289 */ 1287 */
1290 - baddr = next_unprotected(h3270.buffer_addr); 1288 + baddr = next_unprotected(&h3270,h3270.buffer_addr);
1291 if (baddr < h3270.buffer_addr) 1289 if (baddr < h3270.buffer_addr)
1292 baddr = 0; 1290 baddr = 0;
1293 /* 1291 /*
@@ -53,7 +53,7 @@ LIB3270_INTERNAL struct ea *fa2ea(int baddr); @@ -53,7 +53,7 @@ LIB3270_INTERNAL struct ea *fa2ea(int baddr);
53 LIB3270_INTERNAL Boolean get_bounded_field_attribute(register int baddr, register int bound, unsigned char *fa_out); 53 LIB3270_INTERNAL Boolean get_bounded_field_attribute(register int baddr, register int bound, unsigned char *fa_out);
54 LIB3270_INTERNAL void mdt_clear(int baddr); 54 LIB3270_INTERNAL void mdt_clear(int baddr);
55 LIB3270_INTERNAL void mdt_set(int baddr); 55 LIB3270_INTERNAL void mdt_set(int baddr);
56 -LIB3270_INTERNAL int next_unprotected(int baddr0); 56 +LIB3270_INTERNAL int next_unprotected(H3270 *session, int baddr0);
57 LIB3270_INTERNAL enum pds process_ds(unsigned char *buf, int buflen); 57 LIB3270_INTERNAL enum pds process_ds(unsigned char *buf, int buflen);
58 LIB3270_INTERNAL void ps_process(void); 58 LIB3270_INTERNAL void ps_process(void);
59 59
@@ -962,7 +962,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -962,7 +962,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
962 if (skipped != NULL) 962 if (skipped != NULL)
963 *skipped = True; 963 *skipped = True;
964 if (FA_IS_SKIP(h3270.ea_buf[baddr].fa)) 964 if (FA_IS_SKIP(h3270.ea_buf[baddr].fa))
965 - baddr = next_unprotected(baddr); 965 + baddr = next_unprotected(&h3270,baddr);
966 else 966 else
967 INC_BA(baddr); 967 INC_BA(baddr);
968 } 968 }
@@ -1269,7 +1269,7 @@ retry: @@ -1269,7 +1269,7 @@ retry:
1269 if (skipped != NULL) 1269 if (skipped != NULL)
1270 *skipped = True; 1270 *skipped = True;
1271 if (FA_IS_SKIP(ea_buf[baddr].fa)) 1271 if (FA_IS_SKIP(ea_buf[baddr].fa))
1272 - baddr = next_unprotected(baddr); 1272 + baddr = next_unprotected(&h3270,baddr);
1273 else 1273 else
1274 INC_BA(baddr); 1274 INC_BA(baddr);
1275 } 1275 }
@@ -1387,7 +1387,7 @@ LIB3270_KEY_ACTION( tab ) @@ -1387,7 +1387,7 @@ LIB3270_KEY_ACTION( tab )
1387 return 0; 1387 return 0;
1388 } 1388 }
1389 #endif /*]*/ 1389 #endif /*]*/
1390 - cursor_move(&h3270,next_unprotected(h3270.cursor_addr)); 1390 + cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr));
1391 return 0; 1391 return 0;
1392 } 1392 }
1393 1393
@@ -1550,7 +1550,7 @@ LIB3270_ACTION( firstfield ) @@ -1550,7 +1550,7 @@ LIB3270_ACTION( firstfield )
1550 cursor_move(hSession,0); 1550 cursor_move(hSession,0);
1551 return 0; 1551 return 0;
1552 } 1552 }
1553 - cursor_move(hSession,next_unprotected(hSession->rows*hSession->cols-1)); 1553 + cursor_move(hSession,next_unprotected(hSession,hSession->rows*hSession->cols-1));
1554 1554
1555 return 0; 1555 return 0;
1556 } 1556 }
@@ -2240,7 +2240,7 @@ LIB3270_CURSOR_ACTION( newline ) @@ -2240,7 +2240,7 @@ LIB3270_CURSOR_ACTION( newline )
2240 if (faddr != baddr && !FA_IS_PROTECTED(fa)) 2240 if (faddr != baddr && !FA_IS_PROTECTED(fa))
2241 cursor_move(hSession,baddr); 2241 cursor_move(hSession,baddr);
2242 else 2242 else
2243 - cursor_move(hSession,next_unprotected(baddr)); 2243 + cursor_move(hSession,next_unprotected(hSession,baddr));
2244 2244
2245 return 0; 2245 return 0;
2246 } 2246 }
@@ -2263,7 +2263,7 @@ LIB3270_ACTION( dup ) @@ -2263,7 +2263,7 @@ LIB3270_ACTION( dup )
2263 if (key_Character(EBC_dup, False, False, NULL)) 2263 if (key_Character(EBC_dup, False, False, NULL))
2264 { 2264 {
2265 screen_disp(hSession); 2265 screen_disp(hSession);
2266 - cursor_move(hSession,next_unprotected(hSession->cursor_addr)); 2266 + cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr));
2267 } 2267 }
2268 } 2268 }
2269 2269
@@ -2931,7 +2931,7 @@ remargin(int lmargin) @@ -2931,7 +2931,7 @@ remargin(int lmargin)
2931 faddr = find_field_attribute(&h3270,baddr); 2931 faddr = find_field_attribute(&h3270,baddr);
2932 fa = h3270.ea_buf[faddr].fa; 2932 fa = h3270.ea_buf[faddr].fa;
2933 if (faddr == baddr || FA_IS_PROTECTED(fa)) { 2933 if (faddr == baddr || FA_IS_PROTECTED(fa)) {
2934 - baddr = next_unprotected(baddr); 2934 + baddr = next_unprotected(&h3270,baddr);
2935 if (baddr <= b0) 2935 if (baddr <= b0)
2936 return False; 2936 return False;
2937 } 2937 }
@@ -3354,7 +3354,7 @@ kybd_prime(void) @@ -3354,7 +3354,7 @@ kybd_prime(void)
3354 * The cursor is not in an unprotected field. Find the 3354 * The cursor is not in an unprotected field. Find the
3355 * next one. 3355 * next one.
3356 */ 3356 */
3357 - baddr = next_unprotected(h3270.cursor_addr); 3357 + baddr = next_unprotected(&h3270,h3270.cursor_addr);
3358 3358
3359 /* If there isn't any, give up. */ 3359 /* If there isn't any, give up. */
3360 if (!baddr) 3360 if (!baddr)
@@ -122,7 +122,7 @@ @@ -122,7 +122,7 @@
122 fa = session->ea_buf[faddr].fa; 122 fa = session->ea_buf[faddr].fa;
123 if (faddr == baddr || FA_IS_PROTECTED(fa)) 123 if (faddr == baddr || FA_IS_PROTECTED(fa))
124 { 124 {
125 - baddr = next_unprotected(baddr); 125 + baddr = next_unprotected(session,baddr);
126 if (baddr <= b0) 126 if (baddr <= b0)
127 return 0; 127 return 0;
128 } 128 }
@@ -212,7 +212,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) @@ -212,7 +212,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str)
212 if (faddr != baddr && !FA_IS_PROTECTED(fa)) 212 if (faddr != baddr && !FA_IS_PROTECTED(fa))
213 cursor_move(h,baddr); 213 cursor_move(h,baddr);
214 else 214 else
215 - cursor_move(h,next_unprotected(baddr)); 215 + cursor_move(h,next_unprotected(h,baddr));
216 data.row = BA_TO_ROW(h->cursor_addr); 216 data.row = BA_TO_ROW(h->cursor_addr);
217 } 217 }
218 last = ' '; 218 last = ' ';
@@ -768,3 +768,18 @@ LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , con @@ -768,3 +768,18 @@ LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , con
768 popup_handler(session,id,title ? title : _( "3270 Error" ), message,fmt,args); 768 popup_handler(session,id,title ? title : _( "3270 Error" ), message,fmt,args);
769 va_end(args); 769 va_end(args);
770 } 770 }
  771 +
  772 +LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr)
  773 +{
  774 + unsigned char fa;
  775 +
  776 + CHECK_SESSION_HANDLE(h);
  777 +
  778 + if(baddr > (h->rows * h->cols))
  779 + return -1;
  780 +
  781 + fa = get_field_attribute(h,baddr);
  782 +
  783 + return FA_IS_PROTECTED(fa);
  784 +}
  785 +
@@ -606,6 +606,8 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig @@ -606,6 +606,8 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig
606 606
607 flag &= 0x1f; 607 flag &= 0x1f;
608 608
  609 + trace("%s: flag=%04x",__FUNCTION__,flag);
  610 +
609 if(!flag) 611 if(!flag)
610 return origin; 612 return origin;
611 else if(flag == SELECTION_ACTIVE) 613 else if(flag == SELECTION_ACTIVE)