Patch level : 10.0

Files correlati     : ba0.exe ba0200a.msk ba4200b.msk
Ricompilazione Demo : [ ]
Commento            :
Aggiunta possibilita' di kill dei sottoprocessi del menu principale
Riallineati alcuni campi delle maschere ba0200a e ba4200b


git-svn-id: svn://10.65.10.50/trunk@20083 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-02-09 10:08:20 +00:00
parent 30d9f89bf3
commit 6fb77b6d8b
7 changed files with 206 additions and 44 deletions

View File

@ -699,6 +699,12 @@ TColor_mask::TColor_mask()
set(220, ENTER_AS_TAB ? "X" : "");
set(221, TMenuitem::always_run_fullscreen() ? "X" : "");
set(222, INTERLINE);
if (is_power_reseller())
{
show(223); // Hidden by default
set(223, ANIMATED_BOXES ? "X" : "");
}
}
void TColor_mask::save_colors(TConfig& colors)
@ -712,11 +718,12 @@ void TColor_mask::save_colors(TConfig& colors)
colors.set("TreeView", get_int(216));
const int sz = get_int(217);
colors.set("ToolSize", 16+sz*8);
colors.set("EasyRider", get_bool(218) ? "X" : "");
colors.set("ToolText", get_bool(219) ? "X" : "");
colors.set("EnterAsTab", get_bool(220) ? "X" : "");
colors.set("RunModal", get_bool(221) ? "X" : "");
colors.set("InterLine", get_int(222));
colors.set("EasyRider", get_bool(218) ? "X" : "");
colors.set("ToolText", get_bool(219) ? "X" : "");
colors.set("EnterAsTab", get_bool(220) ? "X" : "");
colors.set("RunModal", get_bool(221) ? "X" : "");
colors.set("InterLine", get_int(222));
colors.set("AnimatedBoxes", get_bool(223) ? "X" : "");
}
void TColor_mask::save_colors()
@ -1753,10 +1760,22 @@ bool TMenu_application::choose_study()
long TMenu_application::handler(WINDOW win, EVENT* ep)
{
long ret = TApplication::handler(win, ep);
if (ep->type == E_FONT)
if (_mask != NULL)
{
if (_mask != NULL)
_mask->stop_run(K_CTRL + 'R');
switch (ep->type)
{
case E_FONT: // Sono cambiate le opzioni di visualizzazione
_mask->stop_run(K_CTRL + 'R');
break;
case E_PROCESS: // Notifica nascita e morte processi
if (_tree_view == 3)
{
TOutlook_mask& m = (TOutlook_mask&)*_mask;
m.handler(m.win(), ep);
}
default : break;
}
}
return ret;
}

View File

@ -236,7 +236,7 @@ bool TMenuitem::enabled() const
{
n = name; n.ext(ext[e]);
if (n.custom_path())
break;
break;
}
yes = ext[e] != NULL;
}

View File

@ -33,24 +33,28 @@ public:
class TBook_window : public TControl_host_window
{
TImage _logo;
TImage _logo, _back;
TAssoc_array _alfano;
protected:
virtual void update();
virtual long handler(WINDOW win, EVENT* ep);
void force_page(short page);
void erode_antipa();
public:
virtual long handler(WINDOW win, EVENT* ep); // Used by E_PROCESS
WINDOW notebook() const { return _ctrl; }
short pages() const;
short curr_page() const;
WINDOW page_win(short pg);
WINDOW page_win(short pg) const;
short find_page(WINDOW win) const;
short add_page(const TMenuitem& mi);
void set_page_caption(short page, const TString& caption, int icon);
bool remove_page(WINDOW page);
void set_logo(const char* logo);
void set_back(const TString& back);
void kill_processes();
TBook_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner);
~TBook_window();
@ -64,6 +68,7 @@ long TApp_window::handler(WINDOW win, EVENT* ep)
{
switch (ep->type)
{
/*
case E_TIMER:
if (xvt_vobj_is_focusable(win))
{
@ -81,6 +86,7 @@ long TApp_window::handler(WINDOW win, EVENT* ep)
}
}
break;
*/
case E_DESTROY:
xvt_sys_close_children(win);
break;
@ -93,7 +99,7 @@ long TApp_window::handler(WINDOW win, EVENT* ep)
TApp_window::TApp_window(TBook_window* owner, const char* appname) : _owner(owner), _appname(appname)
{
WINDOW w = create(0, 0, -1, -1, __MAGIC_CAPTION__, WSF_NONE, W_PLAIN, owner->notebook());
xvt_timer_create(w, 1000); // Ogni tanto controllo che l'applicazione sia ancora viva
//xvt_timer_create(w, 1000); // Ogni tanto controllo che l'applicazione sia ancora viva
}
TApp_window::~TApp_window()
@ -108,16 +114,25 @@ TApp_window::~TApp_window()
void TBook_window::update()
{
// Disegno lo sfondo solo se non esiste nessun notebook che occupa tutto lo spazio!
if (_ctrl == NULL_WIN)
if (_ctrl == NULL_WIN && ADVANCED_GRAPHICS)
{
WINDOW w = win();
clear(NORMAL_BACK_COLOR);
RCT rctw; xvt_vobj_get_client_rect(win(), &rctw);
RCT rctw; xvt_vobj_get_client_rect(w, &rctw);
if (rctw.right >= 64 && rctw.bottom >= 64)
{
if (_logo.ok())
_logo.draw(win(), rctw, 'C', 'B', '-'); // Disegna logo riducendolo al centro in basso
{
const RCT& r = _logo.draw(w, rctw, 'R', 'B', '-'); // Disegna logo basso a destra in basso
if (_back.ok())
{
rctw.bottom = r.top;
_back.draw(w, rctw, 'R', 'T', '*'); // Disegna sfondo in alto
}
}
const PNT pnt = { 0, 0 };
draw_spider(win(), 0x3, pnt);
draw_spider(w, 0x3, pnt);
}
}
}
@ -129,7 +144,7 @@ short TBook_window::pages() const
short TBook_window::curr_page() const
{
return _ctrl == NULL_WIN ? 0 : xvt_notebk_get_front_page(_ctrl);
return _ctrl == NULL_WIN ? -1 : xvt_notebk_get_front_page(_ctrl);
}
static BOOLEAN hell_riser(WINDOW child, long data)
@ -142,7 +157,7 @@ static BOOLEAN hell_riser(WINDOW child, long data)
void TBook_window::force_page(short page)
{
if (page < pages()) // Implies _ctrl != NULL_WIN too
if (page >= 0 && page < pages()) // Implies _ctrl != NULL_WIN too
{
xvt_notebk_set_front_page(_ctrl, page);
WINDOW w = xvt_notebk_get_page(_ctrl, page);
@ -170,13 +185,38 @@ long TBook_window::handler(WINDOW win, EVENT* ep)
if (pages() > 0)
dispatch_e_menu(cur_win(), 8883); // Notifica un ridimensionamento indesiderato
break;
case E_PROCESS:
{
TString8 pid; pid << ep->v.process.pid;
switch (ep->v.process.msg_id)
{
case 0:
{
TString16 pg; pg << (long)page_win(pages()-1);
_alfano.add(pid, pg); // Memorizza la pagina che ospita il processo
}
break;
default:
{
const TString* pg = (const TString*)_alfano.objptr(pid);
if (pg != NULL)
{
WINDOW pw = atol(*pg); // Converte pg
_alfano.remove(pid); // Distrugge pg
remove_page(pw); // Elimina pagina
}
}
}
break;
}
break;
default:
break;
}
return TControl_host_window::handler(win, ep);
}
WINDOW TBook_window::page_win(short pg)
WINDOW TBook_window::page_win(short pg) const
{
WINDOW win = NULL_WIN;
if (_ctrl != NULL_WIN)
@ -188,6 +228,15 @@ WINDOW TBook_window::page_win(short pg)
return win;
}
short TBook_window::find_page(WINDOW win) const
{
short pg = -1;
for (pg = pages()-1; pg >= 0; pg--)
if (xvt_notebk_get_page(_ctrl, pg) == win)
break;
return pg;
}
short TBook_window::add_page(const TMenuitem& mi)
{
if (_ctrl == NULL_WIN)
@ -324,9 +373,63 @@ void TBook_window::set_logo(const char* logo)
}
}
void TBook_window::set_back(const TString& back)
{
if (ADVANCED_GRAPHICS && is_power_station())
{
TFilename str = back;
str.ext("png");
bool ok = str.custom_path();
if (!ok)
{
str.ext("jpg");
ok = str.custom_path();
}
if (!ok)
{
str.ext("gif");
str.custom_path();
}
if (ok && _back.load(back))
{
TWait_cursor hourglass;
const short w = _back.width();
const short h = _back.height();
for (short y = 0; y < h; y++)
{
for (short x = 0; x < w; x++)
{
const COLOR rgb = _back.get_pixel(x, y);
if (rgb != NORMAL_BACK_COLOR)
{
const unsigned char r = XVT_COLOR_GET_RED(rgb);
const unsigned char g = XVT_COLOR_GET_GREEN(rgb);
const unsigned char b = XVT_COLOR_GET_BLUE(rgb);
const COLOR col = blend_colors(NORMAL_BACK_COLOR, rgb, 0.9);
if (col != rgb)
_back.set_pixel(x, y, col);
}
}
}
force_update();
}
}
}
void TBook_window::kill_processes()
{
TString_array pid;
_alfano.get_keys(pid);
for (int i = pid.last(); i >= 0; i--)
{
const long p = atol(pid.row(i));
xvt_sys_kill(p);
}
}
TBook_window::TBook_window(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner)
: TControl_host_window(x, y, dx, dy, parent, owner), _logo("")
: TControl_host_window(x, y, dx, dy, parent, owner), _logo(""), _back("")
{
set_logo(get_logo());
}
@ -349,8 +452,11 @@ public:
short pages() const;
short add_page(const TMenuitem& mi);
void set_page_caption(short page, const TString& caption, int icon);
void set_back(const TString& image);
WINDOW page_win(short page);
void remove_all_pages();
void kill_processes() { ((TBook_window&)win()).kill_processes(); }
TBook_field(TMask* m) : TWindowed_field(m) {}
};
@ -372,6 +478,12 @@ void TBook_field::set_page_caption(short page, const TString& caption, int icon)
bw.set_page_caption(page, caption, icon);
}
void TBook_field::set_back(const TString& image)
{
TBook_window& bw = (TBook_window&)win();
bw.set_back(image);
}
WINDOW TBook_field::page_win(short page)
{
TBook_window& bw = (TBook_window&)win();
@ -436,23 +548,34 @@ void TOutlook_mask::load_perspective(int per)
xvt_pane_manager_load_perspective(bf.win().win(), str);
}
TBook_field& TOutlook_mask::book_field() const
{ return (TBook_field&)field(DLG_MAIN); }
bool TOutlook_mask::can_be_closed() const
{
const bool yes = !is_running();
if (!yes)
{
TBook_field& bf = (TBook_field&)field(DLG_MAIN);
TBook_field& bf = book_field();
if (bf.pages() > 0)
{
TMask cm(TR("Chiusura applicazioni"), 1, 50, 7);
cm.add_radio(DLG_USER, 0, TR("Azione"), 1, 0, 48, "0|1",
TR("Non chiudere le applicazioni in esecuzione|Chiusura forzata (solo in caso d'emergenza)"));
cm.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
cm.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
if (cm.run() == K_ENTER && cm.get_bool(DLG_USER))
bf.kill_processes();
}
if (bf.pages() == 0)
((TOutlook_mask*)this)->send_key(K_FORCE_CLOSE, 0);
else
warning_box(TR("E' necessario chiudere tutte le applicazioni attive"));
}
return yes;
}
short TOutlook_mask::add_page(const TMenuitem& mi)
{
TBook_field& bf = (TBook_field&)field(DLG_MAIN);
TBook_field& bf = book_field();
if (bf.pages() == 0)
save_perspective(2); // Save temporary perspective
return bf.add_page(mi);
@ -460,7 +583,7 @@ short TOutlook_mask::add_page(const TMenuitem& mi)
void TOutlook_mask::set_page_caption(short page, const TString& caption, int icon)
{
TBook_field& bf = (TBook_field&)field(DLG_MAIN);
TBook_field& bf = book_field();
bf.set_page_caption(page, caption, icon);
}
@ -501,7 +624,13 @@ long TOutlook_mask::handler(WINDOW w, EVENT* ep)
}
break;
default : break;
}
}
} else
if (ep->type == E_PROCESS)
{
TBook_field& bf = book_field();
TBook_window& bw = (TBook_window&)bf.win();
bw.handler(bw.win(), ep);
}
return TSpidey_mask::handler(w, ep);
}
@ -523,7 +652,7 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
}
else
{
TBook_field& bf = (TBook_field&)field(DLG_MAIN);
TBook_field& bf = book_field();
// ba1 e ba2 sono programmi di manutenzione da eseguire in modo esclusivo
if (mi.run_modal())
{
@ -557,8 +686,8 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
if (ico <= 0 || ico == ICON_RSRC)
{
const int area = get_int(DLG_LOOK);
if (area > 0 && area < 16)
ico = _icon[area];
if (area > 0 && area < _icon.items())
ico = _icon.get_int(area);
else
ico = ICON_RSRC;
}
@ -596,6 +725,7 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
tf.win().force_update();
tf.on_key(K_SPACE);
}
book_field().set_back(_picture.row(sel));
main_app().enable_menu_item(30005, id.find("MENU_PREFERITI") < 0);
} else
if (e == fe_init)
@ -604,10 +734,9 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
of.clear();
TString caption;
int i = 0;
int ico = 10219;
of.add_item(ico, TR("Menu principale"), 0);
_icon[i++] = ico;
_icon.add_long(ico);
TToken_string id("MENU_000", '/');
_tree.change_root(id); // Torna alla radice standard
for (bool ok = _tree.goto_root(); ok; ok = _tree.goto_rbrother())
@ -618,11 +747,15 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
_tree.get_description(caption);
const int ico = mi.icon();
of.add_item(ico, caption, 0);
_icon[i++] = ico; // Memorizza icona per orecchie
_icon.add_long(ico); // Memorizza icona per orecchie
if (_picture.empty())
_picture.add(mi.submenu().picture());
_picture.add(mi.child_submenu()->picture());
}
}
if (atoi(of.get()) >= of.items()-1) // Se sono sui preferiti ...
set(o.dlg(), "", true); // ... torna al menu principale
book_field().set_back(_picture.row(0));
}
break;
default: break;
@ -681,6 +814,4 @@ TOutlook_mask::~TOutlook_mask()
save_perspective(1); // Salva custom
// Ricostruisci status bar tornata utile
xvtil_create_statbar();
// Ammazza eventuali processi dormienti in background
xvt_sys_close_siblings(TASK_WIN);
}

View File

@ -9,20 +9,23 @@
// TOutlook_mask
///////////////////////////////////////////////////////////
class TBook_field;
class TOutlook_mask : public TSpidey_mask
{
TMenu_tree _tree;
int _icon[16];
TPointer_array _icon;
TString_array _picture;
TString _per_def, _per_tmp;
bool _locked;
TString _last_search;
protected:
virtual long handler(WINDOW w, EVENT* ep);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
virtual bool can_be_closed() const;
TBook_field& book_field() const;
short add_page(const TMenuitem& mi);
void set_page_caption(short page, const TString& caption, int icon);
@ -30,6 +33,8 @@ protected:
void load_perspective(int per);
public:
virtual long handler(WINDOW w, EVENT* ep); // Used by E_PROCESS
TOutlook_mask(TMenu& menu);
~TOutlook_mask();
};

View File

@ -78,9 +78,16 @@ BEGIN
FIELD AlwaysFullScreen
END
BOOLEAN 223
BEGIN
PROMPT 1 8 "Messaggi d'errore animati"
FIELD AnimatedBoxes
FLAGS "H" // OEM=0 Only
END
LIST 222 2 10
BEGIN
PROMPT 1 8 "Interlinea "
PROMPT 1 9 "Interlinea "
ITEM "-1|Automatica"
ITEM "0|Minima"
ITEM "4|Normale"

View File

@ -138,7 +138,7 @@ bool TDictionary::read(const char* fname)
if (line.empty())
break;
if (c % 100 == 0)
pi.setstatus(scan.tellg());
pi.setstatus((long)scan.tellg());
line.trim();
if (line.starts_with("<ita>"))
{

View File

@ -95,7 +95,7 @@ MESSAGE COPY,3@
CHECKTYPE REQUIRED
END
RADIOBUTTON LST_AF1_SESSO 1 12
RADIOBUTTON LST_AF1_SESSO 1 16
BEGIN
PROMPT 0 5 "Sesso"
FIELD LF_ANAGFIS->SESSO
@ -104,14 +104,14 @@ ITEM "M|Maschio"
ITEM "F|Femmina"
END
GROUPBOX DLG_NULL 31 4
GROUPBOX DLG_NULL 25 4
BEGIN
PROMPT 12 5 "Partita IVA "
PROMPT 17 5 "Partita IVA "
END
STRING FLD_AF1_STATOPAIV 2
BEGIN
PROMPT 13 6 "Stato "
PROMPT 18 6 "Stato "
FIELD LF_ANAG->STATOPAIV
HELP "Codice dello stato cui si riferisce la partita IVA"
FLAGS "U"
@ -125,7 +125,7 @@ END
STRING FLD_AF1_PAIV 12
BEGIN
PROMPT 13 7 "Codice "
PROMPT 18 7 "Codice "
FIELD LF_ANAG->PAIV
HELP "Partita IVA della persona"
VALIDATE XTZPI_FUNC FLD_AF1_STATOPAIV FLD_AF2_COMRF FLD_AF1_COMRES