Correzioni per installazione Setup -> SetCmpUp

git-svn-id: svn://10.65.10.50/branches/R_10_00@22682 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-07-02 13:03:23 +00:00
parent 05aa5970c9
commit eb8fef43a1
3 changed files with 908 additions and 881 deletions

View File

@ -327,12 +327,8 @@ bool TMenuitem::perform_program() const
return error_box("Password di servizio errata!\nAccesso negato."); return error_box("Password di servizio errata!\nAccesso negato.");
} }
if (_firm && main_app().get_firm() == 0) if (_firm && main_app().get_firm() <= 0)
{ ok = menu().set_firm(0);
// Forza ditta 1 in demo altrimenti chiedila all'utente
const int cd = dongle().demo() ? 1 : 0;
ok = menu().set_firm(cd);
}
if (ok) if (ok)
{ {
@ -608,7 +604,9 @@ bool TMenu::set_firm(long firm) const
{ {
TPointer_array codes; TPointer_array codes;
const int nditte = prefix().firms(codes); const int nditte = prefix().firms(codes);
if (nditte == 1) if (codes.empty())
return error_box(TR("Non esistono ditte selezionabili"));
if (nditte == 1 || dongle().demo())
firm = codes.get_long(0); firm = codes.get_long(0);
} }
return main_app().set_firm(firm); return main_app().set_firm(firm);
@ -623,7 +621,7 @@ bool TMenu::jumpto(TSubmenu* next)
{ {
if (next->query_firm()) if (next->query_firm())
{ {
if (!set_firm(dongle().demo() ? 1 : 0)) if (!set_firm(0))
next = NULL; next = NULL;
} }
if (next) if (next)

View File

@ -1303,7 +1303,7 @@ const TString& get_logo()
if (currlogo.blank()) if (currlogo.blank())
{ {
//se non trova il logo del producer usa il logo standard //se non trova il logo del producer usa il logo standard
currlogo = "menulogo.jpg"; currlogo = "sirio_logo.jpg";
} }
} }

View File

@ -339,63 +339,92 @@ void TBook_window::erode_antipa()
void TBook_window::set_logo(const char* logo) void TBook_window::set_logo(const char* logo)
{ {
_logo.load(logo); _logo.load(logo);
if (is_power_reseller(true))
if (_logo.ok())
{ {
const short w = _logo.width(); if (is_power_reseller(true))
const short h = _logo.height();
const short h2 = h/4;
XVT_IMAGE big = xvt_image_create(XVT_IMAGE_RGB, w, h+h2, MASK_BACK_COLOR);
RCT rct; xvt_rect_set(&rct, 0, 0, w, h);
xvt_image_transfer(big, _logo.xvt_image(), &rct, &rct);
XVT_IMAGE tile = get_background_texture();
if (tile != NULL)
{ {
short tw, th; xvt_image_get_dimensions(tile, &tw, &th); #ifdef DBG
if (tw > 0 && th > 0) const clock_t start = clock();
#endif
const short w = _logo.width();
const short h = _logo.height();
const short h2 = h/4;
XVT_IMAGE big = xvt_image_create(XVT_IMAGE_RGB, w, h+h2, MASK_BACK_COLOR);
RCT rct; xvt_rect_set(&rct, 0, 0, w, h);
xvt_image_transfer(big, _logo.xvt_image(), &rct, &rct);
XVT_IMAGE tile = get_background_texture();
if (tile != NULL)
{ {
RCT src; xvt_rect_set(&src, 0, 0, tw, th); short tw, th; xvt_image_get_dimensions(tile, &tw, &th);
for (short y = 0; y < h2; y += th) if (tw > 0 && th > 0)
{ {
for (short x = 0; x < w; x += tw) // Elegante ma lento
/* RCT src; xvt_rect_set(&src, 0, 0, tw, th);
for (short y = 0; y < h2; y += th)
{ {
RCT dst; xvt_rect_set(&dst, x, y+h, x+tw, y+th+h); for (short x = 0; x < w; x += tw)
xvt_image_transfer(big, tile, &dst, &src); {
RCT dst; xvt_rect_set(&dst, x, y+h, x+tw, y+th+h);
xvt_image_transfer(big, tile, &dst, &src);
}
}
*/
#ifdef DBG
// #pragma omp parallel for
#endif
// Bovino ma veloce
for (short y = 0; y < h2; y++)
{
for (short x = 0; x < w; x++)
{
const COLOR rgb = xvt_image_get_pixel(tile, x % tw, y % th);
xvt_image_set_pixel(big, x, y+h, rgb);
}
} }
} }
} }
}
for (short y = 0; y < h2; y++) // Copia tutti i pixel non neri/grigi/bianchi
{ #ifdef DBG
const double weight = 0.5+double(y)/double(2*h2); #pragma omp parallel for
const short sy = h-y*h/h2-1; #endif
for (short x = 0; x < w; x++) for (short y = 0; y < h2; y++)
{ {
const short sx = x-2*y; const double weight = 0.5+double(y)/double(2*h2);
if (sx >= 0) const short sy = h-y*h/h2-1;
for (short x = 0; x < w; x++)
{ {
const COLOR src = xvt_image_get_pixel(big, sx, sy); const short sx = x-2*y;
const unsigned char r = XVT_COLOR_GET_RED(src); if (sx >= 0)
const unsigned char g = XVT_COLOR_GET_GREEN(src);
const unsigned char b = XVT_COLOR_GET_BLUE(src);
if (abs(r-g)>8 || abs(g-b)>8) // Non e' grigio, cioe' !(r==g && g==b)
{ {
const COLOR dst = xvt_image_get_pixel(big, x, y+h); const COLOR src = xvt_image_get_pixel(big, sx, sy);
COLOR col = blend_colors(dst, src, weight); const unsigned char r = XVT_COLOR_GET_RED(src);
xvt_image_set_pixel(big, x, y+h, col); const unsigned char g = XVT_COLOR_GET_GREEN(src);
const unsigned char b = XVT_COLOR_GET_BLUE(src);
if (abs(r-g)>8 || abs(g-b)>8) // Non e' grigio, cioe' !(r==g && g==b)
{
const COLOR dst = xvt_image_get_pixel(big, x, y+h);
const COLOR col = blend_colors(dst, src, weight);
xvt_image_set_pixel(big, x, y+h, col);
}
} }
} }
} }
} #ifdef DBG
const clock_t tot = clock() - start;
#endif
_logo.set(big); _logo.set(big);
} }
else else
{ {
if (_logo.ok() && can_be_transparent(_logo)) if (can_be_transparent(_logo))
_logo.convert_transparent_color(NORMAL_BACK_COLOR); _logo.convert_transparent_color(NORMAL_BACK_COLOR);
}
} }
} }