diff --git a/include/colors.cpp b/include/colors.cpp index c86599a3e..201d5a5d6 100755 --- a/include/colors.cpp +++ b/include/colors.cpp @@ -49,7 +49,22 @@ COLOR blend_colors(COLOR col1, COLOR col2, double perc) return RGB2COLOR(r, g, b); } +unsigned int color_distance(COLOR col1, COLOR col2) +{ + if ((col1 & 0x00FFFFFF) == (col2 & 0x00FFFFFF)) + return 0; + const int r1 = XVT_COLOR_GET_RED(col1); + const int g1 = XVT_COLOR_GET_GREEN(col1); + const int b1 = XVT_COLOR_GET_BLUE(col1); + const int r2 = XVT_COLOR_GET_RED(col2); + const int g2 = XVT_COLOR_GET_GREEN(col2); + const int b2 = XVT_COLOR_GET_BLUE(col2); + const int r = abs(r1-r2); + const int g = abs(g1-b2); + const int b = abs(b1-b2); + return (r > g && r > b) ? r : (g > b ? g : b); +} class TColor_row_mask : public TMask { diff --git a/include/colors.h b/include/colors.h index 39faf58fa..1b8bb2dce 100755 --- a/include/colors.h +++ b/include/colors.h @@ -12,6 +12,7 @@ COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue); COLOR choose_color(COLOR col = COLOR_BLACK, WINDOW win = NULL_WIN); COLOR blend_colors(COLOR col1, COLOR col2, double perc = 0.5); +unsigned int color_distance(COLOR col1, COLOR col2); extern COLOR MASK_BACK_COLOR; extern COLOR MASK_LIGHT_COLOR; diff --git a/include/dongle.cpp b/include/dongle.cpp index 627233e37..727bb6d2f 100755 --- a/include/dongle.cpp +++ b/include/dongle.cpp @@ -156,13 +156,7 @@ const TString& TDongle::administrator(TString* pwd) TConfig ini("install.ini", "Main"); _admin = ini.get("Administrator"); if (_admin.empty()) - { -#ifdef XVAGA _admin = "ADMIN"; -#else - _admin = "PRASSI"; -#endif - } else _admin = ::decode(_admin); _admpwd = ini.get("Password"); @@ -367,7 +361,7 @@ bool TDongle::eutron_login(bool test_all_keys) "AGA.CAMPO", "25EBAI" }; TDongleType types[4] = { _aga_dongle, _prassi_dongle, _user_dongle, _developer_dongle }; - for (int k = test_all_keys ? 0 : 3; k < 4; k++) + for (int k = test_all_keys ? 0 : 2; k < 4; k++) { const unsigned char* pwd = (const unsigned char*)::encode(labels[k]); ok = xvt_dongle_sl_login((const unsigned char*)labels[k], pwd) != 0; diff --git a/include/image.cpp b/include/image.cpp index 6236b427a..462d92325 100755 --- a/include/image.cpp +++ b/include/image.cpp @@ -283,8 +283,8 @@ void TImage::convert_transparent_color(COLOR transparent) short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy); for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++) { - const COLOR c = get_pixel(x, y) & 0x00FFFFFF; - if (c == trans) + const COLOR c = get_pixel(x, y); + if (color_distance(c, trans) < 8) set_pixel(x, y, transparent); } } diff --git a/include/progind.cpp b/include/progind.cpp index 2c2a55002..4c5ffccc7 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -1,17 +1,12 @@ +#include "xvt.h" +#include "xinclude.h" + #include #include #include #include #include -#ifndef INCL_XI -extern "C" -{ - void xi_draw_3d_rect (WINDOW win, RCT* rctp, BOOLEAN well, int height, - COLOR color_light, COLOR color_ctrl, COLOR color_dark); -} -#endif - word TIndwin::measure_text(TToken_string& s, word& maxlen) const { word lines = 0; @@ -142,7 +137,7 @@ void TIndwin::update_bar() if (CAMPI_SCAVATI) { // Rettangolo scavato - xi_draw_3d_rect(w, &r, TRUE, 2, + xi_draw_3d_rect((XinWindow)w, (XinRect*)&r, TRUE, 2, MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR); b.left += 2; b.right -= 2; b.top += 2; b.bottom -= 2; @@ -191,11 +186,11 @@ void TIndwin::update_bar() { // Rettangolo in rilievo b.right = b.left + int((r.right-r.left)*prc); - xi_draw_3d_rect(w, &b, FALSE, 2, + xi_draw_3d_rect((XinWindow)w, (XinRect*)&b, FALSE, 2, BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR); // Rettangolo scavato b.left = b.right; b.right = r.right; - xi_draw_3d_rect(w, &b, TRUE, 2, + xi_draw_3d_rect((XinWindow)w, (XinRect*)&b, TRUE, 2, BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR); char n[8]; sprintf(n, "%d%%", int(prc * 100.0 + 0.5)); diff --git a/include/relapp.cpp b/include/relapp.cpp index 51a2dd594..7ef77cc35 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -934,7 +934,7 @@ bool TRelation_application::save(bool check_dirty) static bool was_dirty = FALSE; int pos = _mask->id2pos(DLG_SAVEREC); - if (pos < 0 || !(_mask->fld(pos).shown() && _mask->fld(pos).enabled())) + if (pos < 0 || !_mask->fld(pos).active()) return TRUE; int err = NOERR; @@ -943,11 +943,10 @@ bool TRelation_application::save(bool check_dirty) { const int dirty = _mask->dirty(); - const char* ms = (mode == MODE_MOD) ? "le modifiche" : "i dati inseriti"; - if (mode == MODE_QUERY) { - const bool cont = !dirty || yesno_box("Annullare %s?", ms); + const char* ms = (mode == MODE_MOD) ? TR("Annullare le modifiche?") : TR("Annullare i dati inseriti?"); + const bool cont = !dirty || yesno_box(ms); return cont; } @@ -974,16 +973,15 @@ bool TRelation_application::save(bool check_dirty) if (_mask->field(dirty).is_edit()) w = _mask->efield(dirty).get_warning(); if (w.empty()) - w = "Campo inconsistente"; - w << ": si desidera "; + w = "Campo inconsistente: "; switch (last) { case K_ESC: - w << "annullare?"; break; + w << TR("si desidera annullare?"); break; case K_QUIT: - w << "uscire?"; break; + w << TR("si desidera uscire?"); break; default: - w << "continuare?"; break; + w << TR("si desidera continuare?"); break; } k = yesno_box(w) ? K_NO : K_ESC; if (k == K_ESC) @@ -992,7 +990,7 @@ bool TRelation_application::save(bool check_dirty) else k = K_ESC; } else - k = yesnocancel_box("Registrare %s?", ms); + k = yesnocancel_box("Si desidera registrare?"); if (k == K_ESC || k == K_NO) { @@ -1062,10 +1060,10 @@ bool TRelation_application::save(bool check_dirty) mask2mail(*_mask); break; case _isreinsert: - warning_box("Esiste gia' un elemento con la stessa chiave"); + warning_box(TR("Esiste gia' un elemento con la stessa chiave")); break; default: - error_box("Impossibile registrare i dati: errore %d", err); + error_box(FR("Impossibile registrare i dati: errore %d"), err); break; } return err == NOERR; diff --git a/include/validate.cpp b/include/validate.cpp index 130d4f9cb..fe3084852 100755 --- a/include/validate.cpp +++ b/include/validate.cpp @@ -50,10 +50,10 @@ HIDDEN bool _expr_val(TMask_field& f, KEY) HIDDEN bool _emptycopy_val(TMask_field& f, KEY) { - if (f.get().empty()) + if (f.empty()) { const short id = atoi(get_val_param(0)); - const TFixed_string val(f.mask().get(id)); + const TString& val = f.mask().get(id); if (val.not_empty()) { f.set(val);