diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 66213b13d..5f2bd7ce5 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -646,18 +646,24 @@ int TSpreadsheet::rec2row(int record) // Retrieves the corresponding field of the mask from a spredsheet cell TOperable_field* TSpreadsheet::test_field(int pos) const { - int num; - XI_OBJ** column = xi_get_member_list(_obj, &num); - CHECKD(pos >= 0 && pos < num, "Bad column number", pos); - TOperable_field* good = NULL; - for (short id = column[pos]->cid; ; id += 100) + if (pos > 0) { - TOperable_field* f = field(id); - if (f == NULL) break; // Search failed - good = f; // We've found a field with the proper ID ... - if (f->active()) break; // ... and it's active: end of search - } + int num; + XI_OBJ** column = xi_get_member_list(_obj, &num); + CHECKD(pos >= 0 && pos < num, "Bad column number", pos); + + for (short id = column[pos]->cid; ; id += 100) + { + TOperable_field* f = field(id); + if (f == NULL) break; // Search failed + good = f; // We've found a field with the proper ID ... + if (f->active()) break; // ... and it's active: end of search + } + } + else + good = field(DLG_USER); + return good; } diff --git a/include/postman.cpp b/include/postman.cpp index d78c53f7a..d6fceda93 100755 --- a/include/postman.cpp +++ b/include/postman.cpp @@ -394,4 +394,13 @@ bool user_can_write(const TRelation* rel) return user_can_read(rel) && postman().user_can("Scrittura", rel); } +bool user_can_delete(const TRelation* rel) +{ + return user_can_write(rel) && postman().user_can("Eliminazione", rel); +} + +bool user_can_do(const char* azione, const TRelation* rel) +{ + return postman().user_can(azione, rel); +} diff --git a/include/postman.h b/include/postman.h index c2fe9b226..9eb784efe 100755 --- a/include/postman.h +++ b/include/postman.h @@ -1,16 +1,8 @@ #ifndef __POSTMAN_H #define __POSTMAN_H -#ifndef __ISAM_H -class TRectype; -#endif - #ifndef __RELATION_H -class TRelation; -#endif - -#ifndef __STRINGS_H -class TFilename; +#include #endif // Mail management @@ -24,6 +16,8 @@ const char* get_user_write_filter(); bool user_can_read(const TRelation* rel); bool user_can_write(const TRelation* rel); +bool user_can_delete(const TRelation* rel); +bool user_can_do(const char* azione, const TRelation* rel); #endif diff --git a/include/relapp.cpp b/include/relapp.cpp index 53da952db..2fbac8336 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -1201,9 +1201,9 @@ bool TRelation_application::relation_remove() bool TRelation_application::protected_record(TRelation &r) { - if (user_can_write(&r)) + if (user_can_delete(&r)) return protected_record(r.curr()); - return TRUE; + return true; } bool TRelation_application::remove() diff --git a/include/reprint.cpp b/include/reprint.cpp index 23a1fc7ee..d832bd7d0 100755 --- a/include/reprint.cpp +++ b/include/reprint.cpp @@ -384,23 +384,51 @@ const TReport_link* TPrint_preview_window::find_link(const PNT& pnt) const void TPrint_preview_window::handler(WINDOW win, EVENT* ep) { + static PNT ptPan; + switch (ep->type) { case E_MOUSE_MOVE: - if (find_link(ep->v.mouse.where) != NULL) - xvt_win_set_cursor(win, 8004); // Ditino - else - xvt_win_set_cursor(win, CURSOR_ARROW); // Freccia + switch (ep->v.mouse.button) + { + case 2: + { + const PNT& ptCur = ep->v.mouse.where; + TPoint orig = origin(); + orig.x += ptPan.h - ptCur.h; + orig.y += ptPan.v - ptCur.v; + update_thumb(orig.x, orig.y); + force_update(); + ptPan = ptCur; + } + break; + default: + if (find_link(ep->v.mouse.where) != NULL) + xvt_win_set_cursor(win, 8004); // Ditino + else + xvt_win_set_cursor(win, CURSOR_ARROW); // Freccia + break; + } break; case E_MOUSE_DOWN: - if (ep->v.mouse.button == 0) + switch (ep->v.mouse.button) { - const TReport_link* lnk = find_link(ep->v.mouse.where); - if (lnk != NULL && _book != NULL) - _book->on_link(*lnk); - } - else + case 0: + { + const TReport_link* lnk = find_link(ep->v.mouse.where); + if (lnk != NULL && _book != NULL) + _book->on_link(*lnk); + } + break; + case 1: popup_menu(ep); + break; + case 2: + ptPan = ep->v.mouse.where; + break; + default: + break; + } break; case E_COMMAND: { diff --git a/include/strings.cpp b/include/strings.cpp index 3b7f7dcb3..f19df2458 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -1823,7 +1823,7 @@ TAuto_token_string& TAuto_token_string::create(const char* ts) // Calcola il separatore for (const char* s = ts; s && *s; s++) { - if (strchr("|?\t\n^;,!&+", *s) != NULL) + if (strchr("|¦?\t\n^;,!&+", *s) != NULL) { separator(*s); break;