Impedito cambio da voce di menu Scelta contabilità durante esecuzione programmi

git-svn-id: svn://10.65.10.50/branches/R_10_00@22914 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2014-01-14 16:07:36 +00:00
parent eaf1f1a1a0
commit 0dff96647c
3 changed files with 23 additions and 9 deletions

View File

@ -1594,10 +1594,14 @@ void TMenu_application::main_loop()
}
}
static bool _options_menu_enabled = false;
void enable_options_menu(bool on)
{
_options_menu_enabled = on;
const WINDOW tw = TASK_WIN;
xvt_menu_set_item_enabled(tw, M_FILE_NEW, on); // Cambio ditta
xvt_menu_set_item_enabled(tw, M_FILE_NEW, on); // Cambio ditta
xvt_menu_set_item_enabled(tw, M_FILE_PG_SETUP, on); // Imposta Stampante
for (int i = 2; i <= 7; i++) // Menu opzioni
xvt_menu_set_item_enabled(tw, MENU_ITEM_ID(i), on);
@ -1605,16 +1609,17 @@ void enable_options_menu(bool on)
}
bool TMenu_application::choose_colors()
{
{
const KEY CTLR = K_CTRL+'R';
enable_options_menu(false);
bool update_needed = false;
KEY key = K_CTRL+'R';
while (key == K_CTRL+'R')
KEY key = CTLR;
while (key == CTLR)
{
TColor_mask cm;
key = cm.run();
if (key == K_ENTER || key == K_CTRL+'R') // Salva o Applica
if (key == K_ENTER || key == CTLR) // Salva o Applica
{
_tree_view = cm.get_int(216); // Aggiorna stile menu
cm.save_colors(); // Aggiorna config
@ -1630,7 +1635,7 @@ bool TMenu_application::choose_colors()
// Provoca chiusura forzata del menu
if (update_needed && _mask != NULL)
_mask->stop_run(K_CTRL + 'R');
_mask->stop_run(CTLR);
enable_options_menu(true);
return key == K_ENTER;
@ -2281,7 +2286,10 @@ int TMenu_application::do_outlook()
bool TMenu_application::firm_change_enabled() const
{
return _mask != NULL || _tree_view == 0; // Impedisci il cambio ditta durante il login
bool yes = _mask != NULL || _tree_view == 0; // Impedisci il cambio ditta durante il login
if (yes)
yes &= _options_menu_enabled;
return yes;
}
void TMenu_application::on_firm_change()

View File

@ -600,6 +600,7 @@ bool TMenu::read(const char* name)
bool TMenu::set_firm(long firm) const
{
TApplication& a = main_app();
if (firm <= 0)
{
TPointer_array codes;
@ -608,8 +609,13 @@ bool TMenu::set_firm(long firm) const
return error_box(TR("Non esistono ditte selezionabili"));
if (nditte == 1 || dongle().demo())
firm = codes.get_long(0);
else
{
if (!a.firm_change_enabled())
firm = a.get_firm();
}
}
return main_app().set_firm(firm);
return a.set_firm(firm);
}
bool TMenu::jumpto(TSubmenu* next)

View File

@ -126,9 +126,9 @@ public:
// Utilities
void synchronize_tree_field(TTree_field& tf);
void enable_options_menu(bool on);
bool can_be_transparent(const TImage& i);
void draw_spider(WINDOW win, int mode, const PNT& mouse);
void enable_options_menu(bool on);
const TString& get_logo();
int fast_hypot(int x, int y);