Patch level : 10.0

Files correlati     : ba0 ba8
Ricompilazione Demo : [ ]
Commento            :
Aggiornato uso alberi corretti in menu e report
Sistemata interazione tra menu e programmi di manutenzione


git-svn-id: svn://10.65.10.50/trunk@16616 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-05-14 09:34:11 +00:00
parent 06f1cf32e3
commit 49950ba913
8 changed files with 115 additions and 62 deletions

View File

@ -303,15 +303,15 @@ bool TMenuitem::perform_program() const
} }
else else
{ {
prefix().set(NULL); // Chiude prefix if (submenu().menu().mask_mode() == 3 && !_action.starts_with("ba1 -"))
if (submenu().menu().mask_mode() == 3)
a.run(true, 3, false); //e' un programma asincrono a.run(true, 3, false); //e' un programma asincrono
else else
{ {
a.run(false, 3); //e' un programma sincrono prefix().set(NULL); // Chiude prefix
printer_destroy(); // Forza rilettura parametri della stampante a.run(false, 3); // e' un programma sincrono
printer_destroy(); // Forza rilettura parametri della stampante
prefix().set("DEF"); // Riapre prefix
} }
prefix().set("DEF"); // Riapre prefix
} }
} }

View File

@ -271,12 +271,19 @@ long TMenu_tree::find_node(const TString& id)
return data._count; return data._count;
} }
void TMenu_tree::change_root(const char* rid)
{
_root_id = rid;
const int dot = _root_id.find('.');
if (dot > 0)
_root_id.cut(dot);
goto_root();
}
TMenu_tree::TMenu_tree(TMenu& menu) TMenu_tree::TMenu_tree(TMenu& menu)
: _menu(&menu), _curr_id(128, '/') : _menu(&menu), _curr_id(128, '/')
{ {
// _root_id = _menu->current().name(); change_root("MENU_000");
_root_id = "MENU_000"; // Triste necessita' per sicurezza
goto_root();
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////

View File

@ -54,6 +54,7 @@ public:
bool find_leaf(const TString& str); bool find_leaf(const TString& str);
bool find_string(const TString& str); bool find_string(const TString& str);
long find_node(const TString& id); long find_node(const TString& id);
void change_root(const char* id);
TMenu_tree(TMenu& menu); TMenu_tree(TMenu& menu);
virtual ~TMenu_tree() { } virtual ~TMenu_tree() { }

View File

@ -1,6 +1,7 @@
#include "ba0103.h" #include "ba0103.h"
#include <defmask.h> #include <defmask.h>
#include <prefix.h>
#include <xvtility.h> #include <xvtility.h>
enum { DLG_TREE = 101, DLG_LOOK = 102, DLG_MAIN = 103 }; enum { DLG_TREE = 101, DLG_LOOK = 102, DLG_MAIN = 103 };
@ -199,11 +200,12 @@ bool TBook_window::remove_page(WINDOW page)
for (int p = pages()-1; p >= 0; p--) for (int p = pages()-1; p >= 0; p--)
{ {
WINDOW win = xvt_notebk_get_page(_ctrl, p); WINDOW win = xvt_notebk_get_page(_ctrl, p);
if (win == page) if (win == page || page == NULL_WIN)
{ {
xvt_notebk_rem_page(_ctrl, p); xvt_notebk_rem_page(_ctrl, p);
bFound = true; bFound = true;
break; if (page != NULL_WIN)
break;
} }
} }
if (bFound) if (bFound)
@ -257,6 +259,7 @@ public:
short add_page(const TString& caption); short add_page(const TString& caption);
void set_page_caption(short page, const TString& caption); void set_page_caption(short page, const TString& caption);
void remove_all_pages();
TBook_field(TMask* m) : TWindowed_field(m) {} TBook_field(TMask* m) : TWindowed_field(m) {}
}; };
@ -272,6 +275,12 @@ void TBook_field::set_page_caption(short page, const TString& caption)
bw.set_page_caption(page, caption); bw.set_page_caption(page, caption);
} }
void TBook_field::remove_all_pages()
{
TBook_window& bw = (TBook_window&)win();
bw.remove_page(NULL_WIN);
}
TField_window* TBook_field::create_window(int x, int y, int dx, int dy, WINDOW parent) TField_window* TBook_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{ {
return new TBook_window(x, y, dx, dy, parent, this); return new TBook_window(x, y, dx, dy, parent, this);
@ -304,7 +313,7 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
switch (o.dlg()) switch (o.dlg())
{ {
case DLG_TREE: case DLG_TREE:
if (e == fe_modify) if (e == fe_button)
{ {
const TMenuitem& mi = _tree.curr_item(); const TMenuitem& mi = _tree.curr_item();
if (mi.enabled()) if (mi.enabled())
@ -316,21 +325,25 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
} }
else else
{ {
if (mi.action() != "ba1 -5") const bool manu = mi.action().starts_with("ba1 -");
if (manu) // Manutenzione di qualsiasi cosa
{ {
const short pg = add_page(mi.caption()); TBook_field& bf = (TBook_field&)field(DLG_MAIN);
if (pg >= 0) bf.remove_all_pages(); // Chiude tutti i programmi in corso
{ mi.perform(); // Esegui in sincrono e a tutto schermo
mi.perform(); if (installing()) // when ba1 -6
xvt_sys_sleep(1000); stop_run(K_FORCE_CLOSE);
set_page_caption(pg, mi.caption());
}
} }
else else
{ {
mi.perform(); // Crea una pagina per accogliere la nuova applicazione asincrona
if (installing()) // Always true const short pg = add_page(mi.caption());
stop_run(K_FORCE_CLOSE); if (pg >= 0)
{
mi.perform(); // Esegui in asincrono in pagina nuova
xvt_sys_sleep(1000);
set_page_caption(pg, mi.caption());
}
} }
} }
} }
@ -339,10 +352,14 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
case DLG_LOOK: case DLG_LOOK:
if (e == fe_modify) if (e == fe_modify)
{ {
TToken_string id("MENU_000", '/');
_tree.change_root(id); // Torna alla radice standard
const int sel = atoi(o.get()); const int sel = atoi(o.get());
_tree.goto_root();
for (int i = 0; i < sel; i++) for (int i = 0; i < sel; i++)
_tree.goto_rbrother(); _tree.goto_rbrother(); // Seglie l'opportuno ramo principale
_tree.goto_firstson();
_tree.curr_id(id);
_tree.change_root(id.get(1)); // Imposta una nuova radice
synchronize_tree_field(tfield(DLG_TREE)); synchronize_tree_field(tfield(DLG_TREE));
} }
break; break;

View File

@ -1,4 +1,4 @@
PAGE "Colori" -1 -1 54 19 PAGE "Colori" -1 -1 54 17
GROUPBOX DLG_NULL 16 5 GROUPBOX DLG_NULL 16 5
BEGIN BEGIN
@ -60,7 +60,6 @@ BEGIN
PROMPT 38 3 "Obbligatorio" PROMPT 38 3 "Obbligatorio"
END END
GROUPBOX DLG_NULL 16 4 GROUPBOX DLG_NULL 16 4
BEGIN BEGIN
PROMPT 37 5 "@bAttivo" PROMPT 37 5 "@bAttivo"
@ -91,34 +90,24 @@ BEGIN
PROMPT 38 11 "Sfondo" PROMPT 38 11 "Sfondo"
END END
GROUPBOX DLG_NULL 16 4 GROUPBOX DLG_NULL 32 3
BEGIN BEGIN
PROMPT 37 13 "@bTemi predefiniti" PROMPT 1 12 "@bTemi predefiniti"
END END
BUTTON 211 12 BUTTON 211 12
BEGIN BEGIN
PROMPT 38 14 "Campo" PROMPT 2 13 "Campo"
END END
BUTTON 212 12 BUTTON 212 12
BEGIN BEGIN
PROMPT 38 15 "Sistema" PROMPT 18 13 "Sistema"
END END
BOOLEAN 213 BUTTON DLG_USER 12 2
BEGIN BEGIN
PROMPT 2 17 "Campi 3D" PROMPT -33 13 "Font"
END
BOOLEAN 214
BEGIN
PROMPT 15 17 "Bottoni di sistema"
END
BOOLEAN 215
BEGIN
PROMPT 36 17 "Grafica avanzata"
END END
BUTTON DLG_OK 12 2 BUTTON DLG_OK 12 2
@ -126,10 +115,53 @@ BEGIN
PROMPT -13 -1 "" PROMPT -13 -1 ""
END END
BUTTON DLG_EDIT 12 2 BUTTON DLG_CANCEL 12 2
BEGIN BEGIN
PROMPT -23 -1 "Font" PROMPT -33 -1 ""
PICTURE 116 END
ENDPAGE
PAGE "Avanzate" -1 -1 54 17
BOOLEAN 213
BEGIN
PROMPT 1 1 "Campi 3D"
END
BOOLEAN 214
BEGIN
PROMPT 1 2 "Bottoni di sistema"
END
BOOLEAN 215
BEGIN
PROMPT 1 3 "Grafica avanzata"
END
RADIOBUTTON 216 1 16
BEGIN
PROMPT 24 0 "Tipo di Menu"
ITEM "0|Normale"
ITEM "1|Albero"
ITEM "2|Explorer"
ITEM "3|Outlook"
END
TEXT DLG_NULL
BEGIN
PROMPT -11 8 "Dimensione barra degli strumenti"
END
SLIDER 217 50 1
BEGIN
PROMPT 1 9 "Dimensione icone"
RANGE 0 14
END
BUTTON DLG_OK 12 2
BEGIN
PROMPT -13 -1 ""
END END
BUTTON DLG_CANCEL 12 2 BUTTON DLG_CANCEL 12 2

View File

@ -1,4 +1,3 @@
#define F_PREF_TREE 200
#define F_PREF_SHEET 201 #define F_PREF_SHEET 201
#define F_PREF_UP 202 #define F_PREF_UP 202
#define F_PREF_DN 203 #define F_PREF_DN 203

View File

@ -2,15 +2,6 @@
PAGE "Preferiti" -1 -1 70 16 PAGE "Preferiti" -1 -1 70 16
LIST F_PREF_TREE 1 10
BEGIN
PROMPT 1 0 "Tipo di Menu"
ITEM " |Normale"
ITEM "1|Albero"
ITEM "2|Explorer"
ITEM "3|Outlook"
END
SPREADSHEET F_PREF_SHEET 63 -3 SPREADSHEET F_PREF_SHEET 63 -3
BEGIN BEGIN
PROMPT 1 1 "" PROMPT 1 1 ""

View File

@ -459,8 +459,8 @@ protected:
protected: protected:
bool select_report(); bool select_report();
void select_section(); void select_section(bool rebuild_tree = false);
void update_report() const; void update_report(bool rebuild_tree = false) const;
TReport_section& curr_section(); TReport_section& curr_section();
void add_field(); void add_field();
@ -586,7 +586,7 @@ bool TReport_mask::load_report()
TTree_field& sections = tfield(F_SECTIONS); TTree_field& sections = tfield(F_SECTIONS);
_tree.goto_node('B', 1); _tree.goto_node('B', 1);
sections.select_current(); sections.select_current();
select_section(); select_section(true);
xvt_notebk_set_tab_title(notebook(), 0, path); // Mette il titolo nel tab button xvt_notebk_set_tab_title(notebook(), 0, path); // Mette il titolo nel tab button
} }
} }
@ -633,7 +633,7 @@ TReport_section& TReport_mask::curr_section()
return *_curr_section; return *_curr_section;
} }
void TReport_mask::select_section() void TReport_mask::select_section(bool rebuild)
{ {
TTree_field& tf = tfield(F_SECTIONS); TTree_field& tf = tfield(F_SECTIONS);
tf.select_current(); tf.select_current();
@ -699,13 +699,19 @@ void TReport_mask::select_section()
TReport_drawer& rdh = (TReport_drawer&)field(F_REPORTH); TReport_drawer& rdh = (TReport_drawer&)field(F_REPORTH);
rdh.set_report_section(_report.section(htype, hlevel)); rdh.set_report_section(_report.section(htype, hlevel));
update_report(); update_report(rebuild);
} }
void TReport_mask::update_report() const void TReport_mask::update_report(bool rebuild) const
{ {
TTree_field& tf = tfield(F_SECTIONS); TTree_field& tf = tfield(F_SECTIONS);
tf.win().TWindow::force_update(); // Redraw only, not rebuild if (rebuild)
{
tf.tree()->goto_root();
tf.win().force_update(); // Rebuild tree
}
else
tf.win().TWindow::force_update(); // Redraw only, do NOT rebuild
TReport_drawer& rdh = (TReport_drawer&)field(F_REPORTH); TReport_drawer& rdh = (TReport_drawer&)field(F_REPORTH);
rdh.win().force_update(); rdh.win().force_update();