Patch level : 2.0 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento : Correzioni al menu principale ed alla gestione dei codici uffici in agagrafica git-svn-id: svn://10.65.10.50/trunk@10901 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8faed1fa70
commit
601b3f546b
@ -113,7 +113,7 @@ inline TMenu_application& app()
|
||||
|
||||
class TPicture_mask : public TMask
|
||||
{
|
||||
TImage* _image;
|
||||
TSubmenu* _submenu;
|
||||
|
||||
protected: // TMask
|
||||
virtual void update();
|
||||
@ -122,28 +122,12 @@ protected: // TMask
|
||||
|
||||
public:
|
||||
virtual bool stop_run(KEY key);
|
||||
void set_current(const TSubmenu& sm);
|
||||
|
||||
void set_image(TImage* image);
|
||||
|
||||
TPicture_mask(const char* name, int dx, int dy, TImage* image, int x = -1, int y = -1);
|
||||
TPicture_mask(const char* name, int dx, int dy, const TSubmenu& sm, int x = -1, int y = -1);
|
||||
virtual ~TPicture_mask();
|
||||
};
|
||||
|
||||
void TPicture_mask::set_image(TImage* image)
|
||||
{
|
||||
if (image && image->ok())
|
||||
{
|
||||
if (image != _image)
|
||||
{
|
||||
_image = image;
|
||||
_image->set_palette(win());
|
||||
force_update();
|
||||
}
|
||||
}
|
||||
else
|
||||
_image = NULL;
|
||||
}
|
||||
|
||||
bool TPicture_mask::stop_run(KEY key)
|
||||
{
|
||||
if (key == K_FORCE_CLOSE)
|
||||
@ -153,7 +137,8 @@ bool TPicture_mask::stop_run(KEY key)
|
||||
|
||||
void TPicture_mask::update()
|
||||
{
|
||||
if (_image && _image->ok())
|
||||
TImage& image = _submenu->image();
|
||||
if (image.ok())
|
||||
{
|
||||
int x = 1, y = 1, maxx = 640, maxy = 480; // Default values
|
||||
|
||||
@ -166,12 +151,12 @@ void TPicture_mask::update()
|
||||
maxx = client.right - rctree.right - 12;
|
||||
maxy = client.bottom - 4 * ROWY;
|
||||
|
||||
const double ratiox = double(maxx) / _image->width();
|
||||
const double ratioy = double(maxy) / _image->height();
|
||||
const double ratiox = double(maxx) / image.width();
|
||||
const double ratioy = double(maxy) / image.height();
|
||||
const double ratio = min(ratiox, ratioy);
|
||||
|
||||
maxx = int(ratio * _image->width());
|
||||
maxy = int(ratio * _image->height());
|
||||
maxx = int(ratio * image.width());
|
||||
maxy = int(ratio * image.height());
|
||||
|
||||
x = client.right - maxx - 4;
|
||||
y = (client.bottom - maxy) / 2;
|
||||
@ -183,12 +168,12 @@ void TPicture_mask::update()
|
||||
maxx = rctbut.left - CHARX;
|
||||
maxy = client.bottom - 4 * ROWY;
|
||||
|
||||
const double ratiox = double(maxx) / _image->width();
|
||||
const double ratioy = double(maxy) / _image->height();
|
||||
const double ratiox = double(maxx) / image.width();
|
||||
const double ratioy = double(maxy) / image.height();
|
||||
const double ratio = min(ratiox, ratioy);
|
||||
|
||||
maxx = int(ratio * _image->width());
|
||||
maxy = int(ratio * _image->height());
|
||||
maxx = int(ratio * image.width());
|
||||
maxy = int(ratio * image.height());
|
||||
x = 1;
|
||||
y = 1;
|
||||
}
|
||||
@ -196,7 +181,7 @@ void TPicture_mask::update()
|
||||
RCT dst;
|
||||
::xvt_rect_set(&dst, x, y, x+maxx, y+maxy);
|
||||
if (::xvt_dwin_is_update_needed(win(), &dst))
|
||||
_image->draw(win(), dst);
|
||||
image.draw(win(), dst);
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,11 +217,16 @@ void TPicture_mask::on_firm_change()
|
||||
force_update();
|
||||
}
|
||||
|
||||
void TPicture_mask::set_current(const TSubmenu& sm)
|
||||
{
|
||||
_submenu = (TSubmenu*)&sm;
|
||||
}
|
||||
|
||||
TPicture_mask::TPicture_mask(const char* name, int dx, int dy,
|
||||
TImage* image, int x, int y)
|
||||
: TMask(name, 1, dx, dy, x, y)
|
||||
const TSubmenu& submenu, int x, int y)
|
||||
: TMask(name, 1, dx, dy, x, y), _submenu(NULL)
|
||||
{
|
||||
set_image(image);
|
||||
set_current(submenu);
|
||||
}
|
||||
|
||||
TPicture_mask::~TPicture_mask()
|
||||
@ -490,7 +480,7 @@ const char* TColor_mask::cid2name(short cid) const
|
||||
COLOR TColor_mask::cid2color(short cid) const
|
||||
{
|
||||
COLOR color[] = { COLOR_LTGRAY, COLOR_WHITE, COLOR_GRAY,
|
||||
COLOR_BLACK, COLOR_WHITE, blend_colors(COLOR_WHITE, COLOR_YELLOW, 85),
|
||||
COLOR_BLACK, COLOR_WHITE, blend_colors(COLOR_WHITE, COLOR_YELLOW, 0.85),
|
||||
COLOR_BLACK, COLOR_YELLOW,
|
||||
COLOR_DKGRAY, COLOR_LTGRAY,
|
||||
COLOR_LTGRAY, COLOR_WHITE, COLOR_GRAY };
|
||||
@ -551,9 +541,7 @@ int TMenu_application::do_level()
|
||||
const TSubmenu& curr = _menu.current();
|
||||
const int bwidth = 20;
|
||||
|
||||
TImage& image = _menu.image(curr.picture());
|
||||
|
||||
TPicture_mask mask(curr.caption(), -4, -4, &image);
|
||||
TPicture_mask mask(curr.caption(), -4, -4, curr);
|
||||
CHECK(_mask == NULL, "Two masks are better than one?");
|
||||
_mask = &mask;
|
||||
|
||||
@ -661,6 +649,10 @@ void TMenu_application::reload_images()
|
||||
|
||||
bool TMenu_application::check_user()
|
||||
{
|
||||
// Disabilita le voci di personalizzazione
|
||||
for (int mi = 2; mi <= 6; mi++)
|
||||
disable_menu_item(MENU_ITEM(mi));
|
||||
|
||||
TString utente(user());
|
||||
|
||||
#ifdef _DEMO_
|
||||
@ -778,8 +770,9 @@ bool TMenu_application::check_user()
|
||||
prawin.set("User", utente);
|
||||
}
|
||||
|
||||
enable_menu_item(OPTIONS_MENU);
|
||||
enable_menu_item(PREFERRED_MENU);
|
||||
// Abilita le voci di personalizzazione
|
||||
for (int mi = 2; mi <= 6; mi++)
|
||||
enable_menu_item(MENU_ITEM(mi));
|
||||
|
||||
customize_colors(); // Aggiorna set di colori
|
||||
reload_images(); // Ritrasparentizza immagini
|
||||
@ -1167,9 +1160,8 @@ bool TMenu_application::tree_handler(TMask_field& f, KEY k)
|
||||
if (mi.is_submenu() && mt.expanded())
|
||||
{
|
||||
TMenu& menu = mt.curr_submenu().menu();
|
||||
TImage& image = menu.image(menu.current().picture());
|
||||
TPicture_mask& pm = (TPicture_mask&)f.mask();
|
||||
pm.set_image(&image);
|
||||
TPicture_mask& pm = (TPicture_mask&)f.mask();
|
||||
pm.set_current(menu.current());
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -1456,9 +1448,7 @@ int TMenu_application::do_tree()
|
||||
{
|
||||
_menu.jumpto_root();
|
||||
const TSubmenu& curr = _menu.current();
|
||||
|
||||
TImage& image = _menu.image(curr.picture());
|
||||
TPicture_mask mask(curr.caption(), 0, 0, &image, 0, 0);
|
||||
TPicture_mask mask(curr.caption(), 0, 0, curr, 0, 0);
|
||||
CHECK(_mask == NULL, "Two masks are better than one?");
|
||||
_mask = &mask;
|
||||
|
||||
@ -1575,13 +1565,10 @@ int ba0100(int argc, char** argv)
|
||||
if (user().blank())
|
||||
{
|
||||
TConfig prawin(CONFIG_INSTALL, "Main");
|
||||
user() = prawin.get("User");
|
||||
if (user().blank() || user() == dongle().administrator())
|
||||
{
|
||||
char name[32];
|
||||
if (aga_get_user_name(name, 32))
|
||||
user() = name;
|
||||
}
|
||||
TString16 u = prawin.get("User");
|
||||
if (u.blank())
|
||||
u = dongle().administrator();
|
||||
user() = u;
|
||||
}
|
||||
|
||||
TFilename menu = (argc < 2) ? MEN_FILE : argv[1];
|
||||
|
@ -402,7 +402,9 @@ bool TMenu::read(const char* name, TString& root)
|
||||
TString str(255);
|
||||
bool first = TRUE;
|
||||
|
||||
TScanner scanner(name);
|
||||
TFilename menuname = name;
|
||||
menuname.custom_path();
|
||||
TScanner scanner(menuname);
|
||||
while (scanner.ok())
|
||||
{
|
||||
const TString& line = first ? scanner.line() : scanner.pop();
|
||||
@ -572,16 +574,18 @@ bool TMenu::can_be_transparent(const TImage& i) const
|
||||
}
|
||||
|
||||
TImage& TMenu::image(const char* name)
|
||||
{
|
||||
{
|
||||
TTimed_image* image = (TTimed_image*)_images.objptr(name);
|
||||
if (image == NULL)
|
||||
{
|
||||
if (fexist(name))
|
||||
TFilename realname = name;
|
||||
realname.custom_path();
|
||||
if (realname.exist())
|
||||
{
|
||||
if (_images.items() == 0)
|
||||
_default_bmp = name; // Store default bitmap name
|
||||
|
||||
image = new TTimed_image(name);
|
||||
image = new TTimed_image(realname);
|
||||
if (can_be_transparent(*image))
|
||||
image->convert_transparent_color(MASK_BACK_COLOR);
|
||||
_images.add(name, image);
|
||||
@ -590,7 +594,7 @@ TImage& TMenu::image(const char* name)
|
||||
{
|
||||
image = (TTimed_image*)_images.objptr(_default_bmp);
|
||||
if (image == NULL)
|
||||
fatal_box("%s %s", TR("Impossibile trovare l'immagine"), (const char*)_default_bmp);
|
||||
fatal_box(FR("Impossibile trovare l'immagine %s"), (const char*)_default_bmp);
|
||||
}
|
||||
|
||||
if (_images.items() > 3)
|
||||
|
@ -325,19 +325,6 @@ bool TMenulist_images::can_be_transparent(const TImage& i) const
|
||||
|
||||
inline int fast_hypot(int x, int y)
|
||||
{
|
||||
// return (int)sqrt(double(x*x + y*y)); // Pitagora
|
||||
|
||||
/*
|
||||
const int s = x*x + y*y;
|
||||
int h = 0;
|
||||
for (int i = 512; i > 0; i /= 2)
|
||||
{
|
||||
const int k = h+i;
|
||||
if (k*k <= s)
|
||||
h = k;
|
||||
}
|
||||
return h;
|
||||
*/
|
||||
// loop unrolled
|
||||
#define TEST(s, h, i) { const int k = h+i; if (k*k <= s) h = k; }
|
||||
const int s = x*x + y*y;
|
||||
@ -352,10 +339,12 @@ TObject* TMenulist_images::key2obj(const char* key)
|
||||
{
|
||||
TImage* img = NULL;
|
||||
|
||||
if (fexist(key))
|
||||
TFilename name = key;
|
||||
name.custom_path();
|
||||
if (name.exist())
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
TImage image(key);
|
||||
TImage image(name);
|
||||
if (can_be_transparent(image))
|
||||
image.convert_transparent_color(NORMAL_BACK_COLOR);
|
||||
|
||||
@ -368,15 +357,16 @@ TObject* TMenulist_images::key2obj(const char* key)
|
||||
{
|
||||
for (int x = w-1; x >= 0; x--)
|
||||
{
|
||||
int perc = 0;
|
||||
const int r = fast_hypot(x-w/2, y-h/2);
|
||||
if (r < radius)
|
||||
{
|
||||
perc = 75 - (75 * r / radius);
|
||||
}
|
||||
COLOR col = image.get_pixel(x, y);
|
||||
COLOR bri = blend_colors(col, NORMAL_BACK_COLOR, perc);
|
||||
image.set_pixel(x, y, bri);
|
||||
{
|
||||
const double perc = 0.8 - (0.8 * r / radius);
|
||||
COLOR col = image.get_pixel(x, y);
|
||||
COLOR bri = blend_colors(col, NORMAL_BACK_COLOR, perc);
|
||||
image.set_pixel(x, y, bri);
|
||||
}
|
||||
else
|
||||
image.set_pixel(x, y, NORMAL_BACK_COLOR);
|
||||
}
|
||||
}
|
||||
const clock_t stop_timer = clock()-start_timer;
|
||||
|
@ -271,7 +271,7 @@ bool gest_uff_imp(TMask_field& f, KEY key)
|
||||
if (!f.to_check(key, TRUE))
|
||||
return TRUE;
|
||||
|
||||
TString cod_com;
|
||||
TString8 cod_com;
|
||||
|
||||
if ( giuridica )
|
||||
{
|
||||
@ -292,26 +292,34 @@ bool gest_uff_imp(TMask_field& f, KEY key)
|
||||
if (cod_com.empty())
|
||||
return TRUE;
|
||||
|
||||
TString16 cod("|"); cod<< cod_com;
|
||||
TString8 cod("|"); cod<< cod_com;
|
||||
|
||||
const TRectype & comune = cache().get(LF_COMUNI, cod);
|
||||
|
||||
msk.set(F_IMP_DENCOM, comune.get("DENCOM"));
|
||||
msk.set(F_IMP_PROVCOM, comune.get("PROVCOM"));
|
||||
msk.set(F_UFFUUE, comune.get("CODUUE1"),TRUE);
|
||||
msk.set(F_UFFUUE, comune.get("CODUUE1"));
|
||||
msk.check_field(F_UFFUUE);
|
||||
|
||||
TString80 s(comune.get(N_IMPDIR1)) ;
|
||||
if (s.empty()) s = comune.get(N_IMPDIR2) ;
|
||||
if (s.empty()) s = comune.get(N_IMPDIR3) ;
|
||||
if (msk.get(F_UFFIIDD).empty() || msk.is_running())
|
||||
msk.set(F_UFFIIDD, s, TRUE);
|
||||
{
|
||||
msk.set(F_UFFIIDD, s);
|
||||
msk.check_field(F_UFFIIDD);
|
||||
}
|
||||
|
||||
s = comune.get(N_IVA1);
|
||||
if (s.empty()) s = comune.get(N_IVA2) ;
|
||||
if (s.empty()) s = comune.get(N_IVA3) ;
|
||||
if (msk.get(F_UFFIVA).empty() || msk.is_running())
|
||||
msk.set(F_UFFIVA, s, TRUE);
|
||||
msk.set(F_UFFREG, comune.get("UFFREG"), TRUE);
|
||||
{
|
||||
msk.set(F_UFFIVA, s);
|
||||
msk.check_field(F_UFFIVA);
|
||||
}
|
||||
msk.set(F_UFFREG, comune.get("UFFREG"));
|
||||
msk.check_field(F_UFFREG);
|
||||
if (msk.get_bool(F_TITCF))
|
||||
{
|
||||
if (msk.get(F_UFFCONC).empty() || msk.is_running())
|
||||
@ -320,9 +328,15 @@ bool gest_uff_imp(TMask_field& f, KEY key)
|
||||
}
|
||||
const bool fisica = ! giuridica;
|
||||
if (fisica && (msk.get(F_CODREG96).empty() || msk.is_running()))
|
||||
msk.set(F_CODREG96, comune.get("CODREG"), TRUE);
|
||||
msk.set(F_UFFCONC_P, comune.get("UFFCONC"), TRUE);
|
||||
msk.set(F_UFFSERV, comune.get("UFFCSERV"), TRUE);
|
||||
{
|
||||
msk.set(F_CODREG96, comune.get("CODREG"));
|
||||
msk.check_field(F_CODREG96);
|
||||
}
|
||||
msk.set(F_UFFCONC_P, comune.get("UFFCONC"));
|
||||
msk.check_field(F_UFFCONC_P);
|
||||
|
||||
msk.set(F_UFFSERV, comune.get("UFFCSERV"));
|
||||
msk.check_field(F_UFFSERV);
|
||||
|
||||
msk.set(F_CODCONTR_EP, comune.get("UFFESPROV").mid(1, 2));
|
||||
msk.set(F_CODCONTR_EC, comune.get("UFFESCOM"));
|
||||
@ -399,12 +413,11 @@ bool cod_reg(TMask_field& f, KEY key)
|
||||
if (cod_com.empty())
|
||||
cod_com = msk.get(giuridica ? FLD_AG2_COMRES : FLD_AF1_COMRES) ;
|
||||
|
||||
if (cod_com.not_empty())
|
||||
if (cod_com.not_empty() && !msk.field(F_CODREG96).empty())
|
||||
{
|
||||
TString16 key("|"); key << cod_com;
|
||||
const TRectype & comune = cache().get(LF_COMUNI, key);
|
||||
|
||||
app.set_reset_codreg((!comune.empty()) && msk.get(F_CODREG96) == comune.get("CODREG"));
|
||||
app.set_reset_codreg(msk.get(F_CODREG96) == comune.get("CODREG"));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -541,7 +554,6 @@ bool TPersone_app::user_create()
|
||||
_msk[MSKG] = NULL;
|
||||
_rel[MSKG] = new TRelation(LF_ANAG);
|
||||
_rel[MSKG]->add(LF_ANAGGIU, "CODANAGR=CODANAGR", 1);
|
||||
|
||||
|
||||
if (argc() > 3)
|
||||
{
|
||||
|
@ -902,19 +902,19 @@ FIELD LF_ANAG->RFDIVERSA
|
||||
HELP "Dire se il domicilio fiscale e' diverso della sede legale"
|
||||
END
|
||||
|
||||
NUMBER F_CODREG96 2
|
||||
STRING F_CODREG96 2
|
||||
BEGIN
|
||||
PROMPT 2 9 "Cod.regione al 1 Gennaio "
|
||||
FIELD LF_ANAGFIS->CODREG96
|
||||
FLAGS "RZ"
|
||||
USE %RGI
|
||||
INPUT CODTAB F_CODREG96
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Denominazione@50" S0
|
||||
OUTPUT F_CODREG96 CODTAB
|
||||
OUTPUT F_DESREG96 S0
|
||||
CHECKTYPE NORMAL
|
||||
WARNING "Regione assente"
|
||||
PROMPT 2 9 "Cod.regione al 1 Gennaio "
|
||||
FIELD LF_ANAGFIS->CODREG96
|
||||
FLAGS "Z"
|
||||
USE %RGI
|
||||
INPUT CODTAB F_CODREG96
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Denominazione@50" S0
|
||||
OUTPUT F_CODREG96 CODTAB
|
||||
OUTPUT F_DESREG96 S0
|
||||
CHECKTYPE NORMAL
|
||||
WARNING "Regione assente"
|
||||
END
|
||||
|
||||
STRING F_DESREG96 50 40
|
||||
|
Loading…
x
Reference in New Issue
Block a user