Patch level : 01.00 1370

Files correlati     : ba0.exe ba0100m.msk
Commento:
Corretta la selezione per conto nella stampa mastrini analitica
This commit is contained in:
Alessandro Bonazzi 2024-11-21 15:06:33 +01:00
parent 182663090e
commit 868298b802
3 changed files with 138 additions and 61 deletions

View File

@ -22,6 +22,7 @@
#include "ba0100.h"
#include "ba0100a.h"
#include "ba0100m.h"
#include "ba0400a.h"
#define MEN_FILE "bamenu.men"
@ -104,6 +105,7 @@ public:
TMenu& main_menu() { return _menu; }
TMenu_application(const char* name);
virtual ~TMenu_application() {}
};
inline TMenu_application& app()
@ -160,7 +162,7 @@ void TPicture_mask::update()
img.right = but.left; img.top = lgo.bottom;
}
if (_logo != NULL)
if (_logo != nullptr)
{
xvt_rect_inflate(&lgo, -CHARX, -CHARX);
_logo->draw(win(), lgo, 'C', 'T', '-');
@ -201,7 +203,7 @@ void TPicture_mask::set_current(const TSubmenu& sm)
TPicture_mask::TPicture_mask(const char* name, int dx, int dy,
const TSubmenu& submenu, int x, int y)
: TMask(name, 1, dx, dy, x, y), _submenu(NULL), _logo(NULL)
: TMask(name, 1, dx, dy, x, y), _submenu(nullptr), _logo(nullptr)
{
set_current(submenu);
@ -215,16 +217,12 @@ TPicture_mask::TPicture_mask(const char* name, int dx, int dy,
_logo->convert_transparent_color(MASK_BACK_COLOR);
}
else
{
delete _logo;
_logo = NULL;
}
safe_delete(_logo);
}
TPicture_mask::~TPicture_mask()
{
if (_logo != NULL)
delete _logo;
safe_delete(_logo);
}
///////////////////////////////////////////////////////////
@ -503,28 +501,29 @@ bool TColor_mask::apply_theme()
{
const TList_field& fl = lfield(211);
TToken_string values = fl.get_values();
TString name = values.get(theme);
TFilename thini; find_themes_ini(thini);
TConfig def_themes(thini, name);
TAssoc_array& def_colors = def_themes.list_variables();
name.insert("Theme_");
TConfig usr_themes(CONFIG_GUI, name);
TAssoc_array& usr_colors = usr_themes.list_variables();
TAssoc_array& colors = usr_colors.empty() ? def_colors : usr_colors;
if (!colors.empty())
{
_color = colors;
FOR_EACH_MASK_FIELD((*this), i, f)
{
const TFieldref* fr = f->field();
if (fr != NULL)
if (fr != nullptr)
{
const TString* val = (const TString*)_color.objptr(fr->name());
if (val != NULL)
if (val != nullptr)
f->set(*val);
}
}
@ -675,7 +674,7 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
xvt_font_deserialize(fontid, fd);
else
xvt_font_copy(fontid, xvtil_default_font(), XVT_FA_ALL);
if (xvt_dm_post_font_sel(win(), fontid, NULL, 0))
if (xvt_dm_post_font_sel(win(), fontid, nullptr, 0))
{
xvt_font_serialize(fontid, fd.get_buffer(), fd.size());
set_font_desc(fd);
@ -725,7 +724,8 @@ void TColor_mask::options2mask()
{
TProp_field& pf = options_field();
pf.freeze(true);
FOR_EACH_ASSOC_STRING(_color, obj, key, str) if (pf.has_property(key))
FOR_EACH_ASSOC_STRING(_color, obj, key, str)
if (pf.has_property(key))
pf.set_property(key, str);
pf.freeze(false);
@ -808,7 +808,8 @@ COLOR TColor_mask::get_color_entry(const char* name) const
void TColor_mask::set_color_entry(const char* name, COLOR col)
{
TString* s = (TString*)_color.objptr(name);
if (s == NULL)
if (s == nullptr)
{
s = new TString(15);
_color.add(name, s);
@ -912,7 +913,8 @@ int TMenu_application::do_level()
const int bwidth = 20;
TPicture_mask mask(curr.caption(), 0, 0, curr, 0, 0);
CHECK(_mask == NULL, "Two masks are better than one?");
CHECK(_mask == nullptr, "Two masks are better than one?");
_mask = &mask;
const int ampiezza = 51;
@ -939,16 +941,16 @@ int TMenu_application::do_level()
mask.disable(id);
}
mask.add_static(DLG_NULL, 0, PR("Cerca"), x, -4);
TEdit_field& ef = mask.add_string(DLG_USER, 0, "", x, -3, 50, "", ampiezza - 2);
ef.set_handler(menu_find_handler);
const int bottone = ampiezza / 3;
const int spazio = (ampiezza - bottone * 2) / 3;
const bool top = _menu.at_top();
mask.add_button(DLG_QUIT, 0, PR("Fine"), x + spazio, -1, bottone, 2);
if (!top)
mask.add_button(DLG_CANCEL, 0, PR("Menu precedente"), x + spazio * 2 + bottone, -1, bottone, 2);
@ -976,10 +978,8 @@ int TMenu_application::do_level()
m = _menu.selected() + 1; // Sempre > 0
break;
}
// Azzero solo ora altrimenti il menu normale crede di non poter fare il cambio ditta
_mask = NULL;
_mask = nullptr;
return m;
}
@ -987,6 +987,7 @@ int TMenu_application::do_level()
void TMenu_application::test_temp()
{
TFilename dir; dir.tempdir(); // Directory temporanea
if (count_files(dir, true) > 20 && yesno_box(FR("Cancellare tutti i file temporanei in %s?"), (const char*)dir))
remove_files(dir, true);
}
@ -1050,6 +1051,7 @@ bool TMenu_application::ask_user_password(TString& utente)
}
TMask m("ba0100a");
m.set_handler(user_mask_handler);
if (is_power_station())
@ -1167,6 +1169,7 @@ int TMenu_application::get_user_status(const char* usr) const
if (test_users_file())
{
TLocalisamfile utonti(LF_USER);
utonti.put(USR_USERNAME, usr);
status = utonti.read() == NOERR;
if (status)
@ -1191,6 +1194,7 @@ bool TMenu_application::set_user_status(const char* usr, int status) const
CHECK(usr && *usr, "Utente nullo");
bool ok = false;
if (test_users_file())
{
TLocalisamfile utonti(LF_USER);
@ -1267,11 +1271,10 @@ bool TMenu_application::check_user()
set_perms(); // Aggiorna permessi utente
customize_colors(); // Aggiorna set di colori
reload_images(); // Ritrasparentizza immagini e abilitazioni alberi
xvt_dwin_invalidate_rect(TASK_WIN, NULL); // Ridisegna sfondo
xvt_dwin_invalidate_rect(TASK_WIN, nullptr); // Ridisegna sfondo
load_preferences(); // Aggiorna menu preferiti
test_temp(); // Cancella file temporanei
}
return ok;
}
@ -1364,6 +1367,7 @@ bool TMenu_application::test_programs()
TProgind pi(3, TR("Controllo aggiornamento programmi"), false, true);
TConfig remote_install(remote_name, "Main");
remote_install.write_protect();
TAssoc_array my_modules, his_modules;
@ -1391,11 +1395,11 @@ bool TMenu_application::test_programs()
//const TString4 code = dongle().module_code2name(module);
TToken_string* mytok = (TToken_string*)my_modules.objptr(code);
TToken_string* histok = (TToken_string*)his_modules.objptr(code);
const TString16 v1 = mytok ? mytok->get(0) : "";
const int p1 = mytok ? mytok->get_int() : 0;
const TString16 v2 = histok ? histok->get(0) : "";
const int p2 = histok ? histok->get_int() : 0;
if (!v1.blank() && compare_version(v1, p1, v2, p2) < 0)
{
// Non disabilitare mai il modulo base! Se non funzionasse qualcosa (vedi anno di assistenza)...
@ -1455,7 +1459,7 @@ bool TMenu_application::test_programs()
} //(if(update_needed>0...
} //if(is_client..
TString16 module;
TString module;
TDate expires;
Tdninst dninst;
if (dninst.find_expiring(30, module, expires))
@ -1683,9 +1687,8 @@ bool TMenu_application::choose_colors()
}
// Provoca chiusura forzata del menu
if (update_needed && _mask != NULL)
if (update_needed && _mask != nullptr)
_mask->stop_run(CTLR);
enable_options_menu(true);
return key == K_ENTER;
}
@ -1836,11 +1839,13 @@ void TStudy_mask::list_studies(TString_array& sht, bool firms_count) const
}
}
str.add("*");
SLIST dirs = xvt_fsys_list_files(DIR_TYPE, str, true);
for (SLIST_ELT e = xvt_slist_get_first(dirs); e; e = xvt_slist_get_next(dirs, e))
{
const char* f = xvt_slist_get(dirs, e, NULL);
const char* f = xvt_slist_get(dirs, e, nullptr);
if (is_valid_study(f))
{
if (firms_count)
@ -1848,6 +1853,7 @@ void TStudy_mask::list_studies(TString_array& sht, bool firms_count) const
str = f; str.add("?????A");
SLIST firms = xvt_fsys_list_files(DIR_TYPE, str, true);
const int nf = xvt_slist_count(firms);
xvt_slist_destroy(firms);
if (nf > 0)
{
@ -1964,7 +1970,7 @@ long TMenu_application::handler(WINDOW win, EVENT* ep)
{
long ret = TApplication::handler(win, ep);
if (_mask != NULL)
if (_mask != nullptr)
{
switch (ep->type)
{
@ -2117,9 +2123,11 @@ void TMenu_application::update_preferred()
void TMenu_application::update_preferred_tree()
{
TSubmenu* pref = _menu.find("MENU_PREFERITI");
if (pref != NULL)
if (pref != nullptr)
{
TToken_string node(16, '.');
pref->destroy_items();
FOR_EACH_ARRAY_ROW(_preferred, i, row)
{
@ -2131,16 +2139,18 @@ void TMenu_application::update_preferred_tree()
{
const char* sub = node.get(0);
TSubmenu* sm = _menu.find(sub);
if (sm != NULL)
if (sm != nullptr)
{
const int num = node.get_int(1);
if (num >= 0 && num < sm->items())
pref->add(new TMenuitem(sm->item(num)));
}
}
}
if (_tree_view >= 3 && _mask != NULL)
if (_tree_view >= 3 && _mask != nullptr)
{
FOR_EACH_MASK_FIELD(*_mask, i, f)
{
@ -2158,11 +2168,12 @@ void TMenu_application::update_preferred_tree()
void TMenu_application::load_preferences()
{
TConfig cfg(CONFIG_GUI, "ba0");
_preferred.destroy();
TToken_string row;
for (int i = 0; ; i++)
{
row = cfg.get("Preferred", NULL, i);
row = cfg.get("Preferred", "", i);
if (row.empty_items())
break;
_preferred.add(row);
@ -2170,25 +2181,29 @@ void TMenu_application::load_preferences()
update_preferred();
cfg.set_paragraph("Colors");
TMenuitem::always_run_fullscreen(cfg.get_bool("RunModal"));
_tree_view = cfg.get_int("TreeView", NULL, -1, 3);
_tree_view = cfg.get_int("TreeView", nullptr, -1, 3);
}
void TMenu_application::save_preferences()
{
TConfig cfg(CONFIG_GUI, "ba0");
int i;
for (i = 0; i < _preferred.items(); i++)
cfg.set("Preferred", _preferred.row(i), NULL, true, i);
cfg.set("Preferred", "", NULL, true, i);
cfg.set("Preferred", _preferred.row(i), nullptr, true, i);
cfg.set("Preferred", "", nullptr, true, i);
}
void TMenu_application::add_to_preferred()
{
if (_mask == NULL) // Succede durante il login!
if (_mask == nullptr) // Succede durante il login!
return;
const int max_pref = 32; // Massimo numero di preferiti
if (_preferred.items() < max_pref)
{
TToken_string tok;
@ -2199,6 +2214,7 @@ void TMenu_application::add_to_preferred()
{
const TMask_field& butt = _mask->focus_field();
const int index = butt.dlg() - 101;
if (index >= 0 && index < max_pref)
{
_menu.select(index);
@ -2328,14 +2344,33 @@ void TMenu_application::manage_preferred()
void TMenu_application::manage_mail()
{
TMask m("ba0100m");
bool ok = true;
m.set_handler(106, check_from_field_mail);
TConfig cfg(CONFIG_USER, "Mail");
FOR_EACH_MASK_FIELD(m, i, f) if (f->field())
f->set(f->field()->read(cfg, "Mail"));
if (m.run() == K_ENTER)
while (m.run() == K_ENTER)
{
const TString & order2 = m.get(F_EMAIL2);
ok = true;
if (order2.full() && (order2 == m.get(F_EMAIL1) || order2 == m.get(F_EMAIL3)))
ok = error_box("L'email 2 è già stata specificata");
if (ok)
{
const TString & order3 = m.get(F_EMAIL3);
if (order3.full() && (order3 == m.get(F_EMAIL1) || order3 == m.get(F_EMAIL2)))
ok = error_box("L'email 3 è già stata specificata");
}
if (ok)
{
FOR_EACH_MASK_FIELD(m, i, f) if (f->field())
f->field()->write(cfg, "Mail", f->get());
break;
}
}
}
@ -2346,7 +2381,7 @@ int TMenu_application::do_tree()
_menu.jumpto_root();
const TSubmenu& curr = _menu.current();
TPicture_mask mask(curr.caption(), 0, 0, curr, 0, 0);
CHECK(_mask == NULL, "Two masks are better than one?");
CHECK(_mask == nullptr, "Two masks are better than one?");
_mask = &mask;
const int margin = (mask.columns()-80) / 2;
@ -2375,7 +2410,7 @@ int TMenu_application::do_tree()
mask.first_focus(DLG_TREE);
KEY key = mask.run();
_mask = NULL;
_mask = nullptr;
return key == K_QUIT ? -2 : 0;
}
@ -2383,46 +2418,50 @@ int TMenu_application::do_tree()
int TMenu_application::do_explore()
{
CHECK(_mask == NULL, "Two masks are better than one?");
CHECK(_mask == nullptr, "Two masks are better than one?");
_menu.jumpto_root();
TExplorer_mask mask(_menu);
_mask = &mask;
KEY key = mask.run();
_mask = NULL;
_mask = nullptr;
return key == K_QUIT ? -2 : 0;
}
int TMenu_application::do_outlook()
{
CHECK(_mask == NULL, "Two masks are better than one?");
CHECK(_mask == nullptr, "Two masks are better than one?");
TOutlook_mask mask(_menu);
_mask = &mask;
KEY key = mask.run();
_mask = NULL;
_mask = nullptr;
return key == K_QUIT ? -2 : 0;
}
int TMenu_application::do_metro()
{
CHECK(_mask == NULL, "Two masks are better than one?");
CHECK(_mask == nullptr, "Two masks are better than one?");
TMetro_mask mask(_menu);
_mask = &mask;
KEY key = mask.run();
_mask = NULL;
_mask = nullptr;
return key == K_QUIT ? -2 : 0;
}
bool TMenu_application::firm_change_enabled() const
{
bool yes = _mask != NULL || _tree_view == 0; // Impedisci il cambio ditta durante il login
bool yes = _mask != nullptr || _tree_view == 0; // Impedisci il cambio ditta durante il login
if (yes)
yes &= _options_menu_enabled;
return yes;
@ -2456,6 +2495,7 @@ bool TMenu_application::menu(MENU_TAG mt)
bool ok = false;
const int index = mt - MENU_ITEM_ID(50);
TToken_string node(_preferred.row(index).get(1), '/');
if (_tree_view != 0)
{
TMenu_tree& met = *(TMenu_tree*)tree_field().tree();
@ -2488,7 +2528,7 @@ bool TMenu_application::menu(MENU_TAG mt)
}
TMenu_application::TMenu_application(const char* name)
: _menuname(name), _mask(NULL), _tree_view(3)
: _menuname(name), _mask(nullptr), _tree_view(3)
{ }
int ba0100(int argc, char** argv)

View File

@ -7,3 +7,6 @@
#define F_RETRY 107
#define F_FIRM 108
#define F_CCN 109
#define F_EMAIL1 110
#define F_EMAIL2 111
#define F_EMAIL3 112

View File

@ -1,6 +1,6 @@
#include "ba0100m.h"
PAGE "Configurazione E-Mail utente" -1 -1 63 14
PAGE "Configurazione E-Mail utente" -1 -1 63 19
STRING F_SERVER 260 50
BEGIN
@ -60,7 +60,7 @@ END
LIST F_RETRY 1
BEGIN
PROMPT 21 9 "Tentativi di trasmissione "
PROMPT 1 9 "Tentativi di trasmissione "
ITEM "1|1"
ITEM "2|2"
ITEM "3|3"
@ -69,9 +69,43 @@ BEGIN
FIELD Retry
END
GROUPBOX DLG_NULL 25 5
BEGIN
PROMPT 10 10 "Ordine email"
END
LISTBOX F_EMAIL1 1 9
BEGIN
PROMPT 11 11 "1a email "
ITEM "D|Documenti"
ITEM "P|PEC"
ITEM "N|Normale"
FIELD Email(1)
END
LISTBOX F_EMAIL2 1 9
BEGIN
PROMPT 11 12 "2a email "
ITEM "|Nessuna"
ITEM "D|Documenti"
ITEM "P|PEC"
ITEM "N|Normale"
FIELD Email(2)
END
LISTBOX F_EMAIL3 1 9
BEGIN
PROMPT 11 13 "3a email "
ITEM "|Nessuna"
ITEM "D|Documenti"
ITEM "P|PEC"
ITEM "N|Normale"
FIELD Email(3)
END
MEMO F_FIRM 60 4
BEGIN
PROMPT 1 10 "Saluti / Firma"
PROMPT 1 15 "Saluti / Firma"
FIELD Signature
END