Patch level :10.0

Files correlati     :ba0.exe
Ricompilazione Demo : [ ]
Commento            :corretto problema del suicidio di ba0 che dava un errore non bloccante (ma inquietante) al lancio installazione moduli


git-svn-id: svn://10.65.10.50/trunk@16592 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2008-05-09 09:34:54 +00:00
parent 933f3353f8
commit ea6c590474
3 changed files with 99 additions and 67 deletions

View File

@ -261,10 +261,10 @@ TPicture_mask::TPicture_mask(const char* name, int dx, int dy,
{
set_current(submenu);
TFilename logoname;
const char* const ext[] = { "jpg", "png", "gif", "bmp", "jpeg", NULL };
const char* const ext[] = { "jpg", "png", "gif", "bmp", NULL };
for (int i = 0; ext[i]; i++)
{
logoname = "logo"; logoname.ext(ext[i]);
logoname = "logo."; logoname << ext[i];
if (logoname.custom_path())
break;
}
@ -368,10 +368,6 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
}
}
break;
case DLG_EDIT:
if (e == fe_button)
dispatch_e_menu(TASK_WIN, MENU_ITEM(2));
break;
default:
if (id >= 101 && id <= 113 && e == fe_button)
{
@ -405,13 +401,8 @@ PNT TColor_mask::log2dev(long x, long y) const
{
PNT p = { int(y * XI_FU_MULTIPLE), int(x * XI_FU_MULTIPLE) };
#ifdef XI_R4
XI_OBJ* itf = xi_get_itf((XinWindow)win());
xi_fu_to_pu(itf, (XinPoint*)&p, 1);
#else
XI_OBJ* itf = xi_get_itf(win());
xi_fu_to_pu(itf, &p, 1);
#endif
p.v = int(y * ROWY);
p.h += XI_FU_MULTIPLE / 2;
@ -855,7 +846,7 @@ int TMenu_application::get_user_status(const char* usr) const
CHECK(usr && *usr, "Utente nullo");
int status = 0;
if (prefix_valid())
if (prefix_valid() && prefix().name()[0] != '.')
{
TLocalisamfile utonti(LF_USER);
utonti.put(USR_USERNAME, usr);
@ -882,7 +873,7 @@ bool TMenu_application::set_user_status(const char* usr, int status) const
CHECK(usr && *usr, "Utente nullo");
bool ok = false;
if (prefix_valid())
if (prefix_valid() && prefix().name()[0] != '.')
{
TLocalisamfile utonti(LF_USER);
utonti.put(USR_USERNAME, usr);
@ -1150,11 +1141,19 @@ bool TMenu_application::test_programs()
bool TMenu_application::user_create()
{
disable_menu_item(M_FILE_PRINT); // Questa voce di menu non serve per ora
if (dongle().type() == _no_dongle)
warning_box(TR("ATTENZIONE\nQuesto programma è in versione dimostrativa.\n"
"Esso funzionera' per circa due ore al giorno con un numero limitato di registrazioni."));
{
TMask w(TR("ATTENZIONE"), 1, 68, 10);
w.add_static(DLG_NULL, 0 , PR("@bATTENZIONE") , 30 , 1);
w.add_static(DLG_NULL, 0 , TR("Questo programma è in versione dimostrativa.") , 1 , 3);
w.add_static(DLG_NULL, 0 , TR("Il programma funziona circa per due ore ogni giorno.") , 1 , 5);
w.add_static(DLG_NULL, 0 , TR("Il numero di registrazioni è stato limitato ad un migliaio.") , 1 , 7);
w.add_button(DLG_OK, 0, "", -11, -1, 10, 2);
w.run();
}
if (!check_user())
return false;

View File

@ -292,7 +292,6 @@ bool TMenuitem::perform_program() const
if (ok)
{
TCurrency::force_cache_update(); // Chiude cache valute
prefix().set(NULL); // Chiude prefix
TExternal_app a(_action);
const bool install_app = _action.starts_with("ba1 -6", true);
@ -304,6 +303,7 @@ bool TMenuitem::perform_program() const
}
else
{
prefix().set(NULL); // Chiude prefix
if (submenu().menu().mask_mode() == 3)
a.run(true, 3, false); //e' un programma asincrono
else

View File

@ -1,17 +1,13 @@
#include <controls.h>
#include <diction.h>
#include <mask.h>
#include <prefix.h>
#include <statbar.h>
#include <toolfld.h>
#include <urldefid.h>
#include <utility.h>
#include "ba0102.h"
#define F_OPTIONS 201
#define F_STAR 204
#define F_ADDSTAR 205
///////////////////////////////////////////////////////////
// TMenu_tree
///////////////////////////////////////////////////////////
@ -466,10 +462,11 @@ protected:
virtual void update();
virtual void handler(WINDOW win, EVENT* ep);
virtual bool on_key(KEY k);
virtual void on_idle();
void synchronize_buddy_tree() const;
void draw_item(int i);
void draw_menu_caption();
void draw_menu_caption(COLOR rgb);
void click_on(int index);
void select(int s, int direction);
@ -552,7 +549,7 @@ void TMenulist_window::draw_item(int i)
}
//scrive la voce di menu corrente a video
void TMenulist_window::draw_menu_caption()
void TMenulist_window::draw_menu_caption(COLOR rgb)
{
const char* caption = "";
if (_sorted.items() > 1)
@ -566,7 +563,26 @@ void TMenulist_window::draw_menu_caption()
const TMenuitem& mi = (const TMenuitem&)_sorted[0];
caption = mi.caption();
}
xvt_pane_set_title(win(), caption);
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
const int x = rct.left+2;
int y = rct.bottom-CHARY;
if (ADVANCED_GRAPHICS)
{
const TImage* logo = _images.image("logo");
if (logo != NULL)
y -= logo->height() + ROWY; //+ROWY per staccare scritta dal logo
}
XVT_FNTID font_menu = xvt_font_create();
xvt_font_copy(font_menu, xvt_default_font(true), XVT_FA_ALL);
const int size = xvt_font_get_size(font_menu);
xvt_font_set_size(font_menu, 130 * size / 100); //altezza font il 30% maggiore di quello di menu
xvt_dwin_set_font(win(), font_menu);
set_color(rgb, NORMAL_BACK_COLOR);
xvt_dwin_draw_text(win(), x, y, caption, -1);
xvt_font_destroy(font_menu);
statbar_set_title(TASK_WIN, caption);
}
@ -576,7 +592,7 @@ void TMenulist_window::update()
if (_tree == NULL)
return; // Nothing to draw
const bool db = ADVANCED_GRAPHICS;
const bool db = _tree != NULL && ADVANCED_GRAPHICS;
TImage* img = db ? _images.image(_image_name) : NULL; // Delay time before clearing
if (img != NULL)
@ -599,7 +615,29 @@ void TMenulist_window::update()
FOR_EACH_ARRAY_ITEM(_sorted, i, obj)
draw_item(i);
draw_menu_caption();
if (ADVANCED_GRAPHICS)
_last_update = clock();
else
draw_menu_caption(NORMAL_COLOR);
}
void TMenulist_window::on_idle()
{
if (ADVANCED_GRAPHICS)
{
#ifdef LINUX
const clock_t max_clock = (3*CLOCKS_PER_SEC) / 10;
#else
const clock_t max_clock = 3*CLOCKS_PER_SEC;
#endif
const clock_t elapsed = clock() - _last_update;
if (elapsed <= max_clock)
{
const double perc = double(elapsed) / double(max_clock);
const COLOR rgb = blend_colors(NORMAL_COLOR, NORMAL_BACK_COLOR, perc);
draw_menu_caption(rgb);
}
}
}
void TMenulist_window::click_on(int index)
@ -907,7 +945,7 @@ void draw_spider(WINDOW w, int mode, const PNT& mouse)
if (_spider < 0)
_spider = ADVANCED_GRAPHICS && is_power_station(); // Attiva eventuale ragno
if (_spider && xvt_vobj_is_focusable(w))
if (_spider && w != NULL_WIN)
{
RCT client; xvt_vobj_get_client_rect(w, &client);
@ -1050,7 +1088,7 @@ bool TSpidey_mask::stop_run(KEY k)
}
}
// Butto via le immagini dopo averle disegnate tutte
for (i = 3; i >= 0; i--)
for (i = 2; i >= 0; i--)
xvt_image_destroy(image[i]);
if (installing()) //se e' stata lanciata la installazione moduli...
@ -1064,7 +1102,7 @@ bool TSpidey_mask::stop_run(KEY k)
for (i = 0; i < 3; i++)
{
if (window[i] != NULL)
xvt_dwin_invalidate_rect(window[i], NULL);
xvt_dwin_invalidate_rect(window[i], NULL);
}
return false;
}
@ -1083,7 +1121,7 @@ bool TSpidey_mask::on_key(KEY k)
return TMask::on_key(k);
}
TSpidey_mask::TSpidey_mask() : TAutomask ("Menu", 1, 0, 0, 0, 0)
TSpidey_mask::TSpidey_mask() : TAutomask ("", 1, 0, 0, 0, 0)
{ }
///////////////////////////////////////////////////////////
@ -1118,6 +1156,16 @@ void TExplorer_mask::handler(WINDOW win, EVENT* ep)
TSpidey_mask::handler(win, ep);
}
void TExplorer_mask::on_idle()
{
if (ADVANCED_GRAPHICS)
{
TWindowed_field& lf = (TWindowed_field&)field(DLG_LIST);
lf.win().on_idle();
}
}
void TExplorer_mask::select_tree_current()
{
TTree_field& tf = tfield(DLG_TREE);
@ -1154,28 +1202,21 @@ bool TExplorer_mask::on_field_event(TOperable_field& o, TField_event e, long jol
mt.goto_root();
select_tree_current();
}
break;
case DLG_FINDREC:
if (e == fe_button)
case DLG_USER:
if (e == fe_modify && !o.empty())
{
TString80 str = _last_search_string;
const char* s = xvt_dm_post_string_prompt(TR("Testo"), str.get_buffer(), str.size());
if (s && *s)
const TString& v = o.get();
TTree_field& tf = tfield(DLG_TREE);
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
if (mt.find_string(v))
{
_last_search_string = s;
send_key(K_F3, 0);
select_tree_current();
_last_search_string = v;
}
else
beep();
}
break;
case TOOL_CONFIG:
dispatch_e_menu(TASK_WIN, MENU_ITEM(2));
break;
case TOOL_PREF:
dispatch_e_menu(TASK_WIN, MENU_ITEM(6));
break;
case TOOL_ADDPREF:
dispatch_e_menu(TASK_WIN, MENU_ITEM(5));
break;
default:
break;
}
@ -1186,12 +1227,7 @@ bool TExplorer_mask::on_key(KEY k)
{
if (k == K_F3 || k == K_F8)
{
TTree_field& tf = tfield(DLG_TREE);
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
if (_last_search_string.full() && mt.find_string(_last_search_string))
select_tree_current();
else
beep();
set(DLG_USER, _last_search_string, true);
return true;
}
return TSpidey_mask::on_key(k);
@ -1199,16 +1235,12 @@ bool TExplorer_mask::on_key(KEY k)
TExplorer_mask::TExplorer_mask(TMenu& menu) : _tree(menu)
{
add_button_tool(DLG_SHRINK, TR("Menu Principale"), TOOL_FIRSTREC);
add_button_tool(DLG_FINDREC, TR("Ricerca"), TOOL_LENTE);
add_button_tool(TOOL_CONFIG, TR("Opzioni"), TOOL_CONFIG);
add_button_tool(TOOL_PREF, TR("Preferiti"), TOOL_PREF);
add_button_tool(TOOL_ADDPREF,TR("Aggiungi ai Preferiti"), TOOL_ADDPREF);
add_button_tool(DLG_INFO, TR("Info"), TOOL_INFO);
add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP);
add_button_tool(DLG_QUIT, TR("Fine"), TOOL_QUIT);
WINDOW panel = page_win(0);
// Bottom Toolbar
insert_page("4", -1); // Crea toolbar di "4" righe
add_button(DLG_QUIT, -1, "", -12, -2, 18, 2);
add_button(DLG_SHRINK, -1, PR("Menu Principale"), -22, -2, 18, 2);
add_string(DLG_USER, -1, PR("Cerca "), 11, -4, 50);
// Tree view
TTree_field& trifola = add_tree(DLG_TREE, 0, 0, 0, 32, 0);
@ -1217,12 +1249,13 @@ TExplorer_mask::TExplorer_mask(TMenu& menu) : _tree(menu)
// List view
TMenulist_field* mf = new TMenulist_field(this);
mf->create(DLG_LIST, 48, 0, 0, 0, panel);
mf->create(DLG_LIST, 21, 0, 0, 0, win());
mf->set_menu(*(TMenu_tree*)trifola.tree());
add_field(mf);
xvt_pane_add(panel, dlg2win(DLG_LIST), "Main", 0, 0); // Right pane
xvt_pane_change_flags(dlg2win(DLG_LIST), 1<<10,0);
xvt_pane_add(panel, dlg2win(DLG_TREE), "Menu", 1, 0); // Left pane
xvt_win_add_pane(win(), dlg2win(DLG_LIST), "Main", 0, 0); // Main pane
xvt_win_add_pane(win(), dlg2win(DLG_TREE), "Menu", 1, 0); // Left pane
first_focus(DLG_LIST);
set_handlers();
}