Commit 016a9ca1e1cafa6c01eed0b29eaab6cc541e1462

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

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

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