From 0dff96647c41232b8560446859bf1ebd8fb5f9ff Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 14 Jan 2014 16:07:36 +0000 Subject: [PATCH] =?UTF-8?q?Impedito=20cambio=20da=20voce=20di=20menu=20Sce?= =?UTF-8?q?lta=20contabilit=C3=A0=20durante=20esecuzione=20programmi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.65.10.50/branches/R_10_00@22914 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0100.cpp | 22 +++++++++++++++------- ba/ba0101.cpp | 8 +++++++- ba/ba0102.h | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index 0806028c4..c874f7a84 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -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() diff --git a/ba/ba0101.cpp b/ba/ba0101.cpp index 87048d619..21fc65f9d 100755 --- a/ba/ba0101.cpp +++ b/ba/ba0101.cpp @@ -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) diff --git a/ba/ba0102.h b/ba/ba0102.h index 3cd1c7c14..db603ec87 100755 --- a/ba/ba0102.h +++ b/ba/ba0102.h @@ -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);