Patch level : 10.0
Files correlati : Ricompilazione Demo : [ ] Commento : Rimessi a posto file commitatti per sbaglio git-svn-id: svn://10.65.10.50/trunk@16600 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ea6c590474
commit
0c2f2e95a0
254
ba/ba0100.cpp
254
ba/ba0100.cpp
@ -1,5 +1,3 @@
|
||||
#include <xinclude.h>
|
||||
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <controls.h>
|
||||
@ -9,7 +7,6 @@
|
||||
#include <execp.h>
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
#include <msksheet.h>
|
||||
#include <progind.h>
|
||||
#include <sheet.h>
|
||||
#include <utility.h>
|
||||
@ -261,10 +258,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", NULL };
|
||||
const char* const ext[] = { "jpg", "png", "gif", "bmp", "jpeg", NULL };
|
||||
for (int i = 0; ext[i]; i++)
|
||||
{
|
||||
logoname = "logo."; logoname << ext[i];
|
||||
logoname = "logo"; logoname.ext(ext[i]);
|
||||
if (logoname.custom_path())
|
||||
break;
|
||||
}
|
||||
@ -288,17 +285,31 @@ TPicture_mask::~TPicture_mask()
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TColor_mask : public TAutomask
|
||||
{
|
||||
{
|
||||
class TPreview_panel : public TWindow
|
||||
{
|
||||
TColor_mask* _owner;
|
||||
protected:
|
||||
COLOR get_color_entry(const char* name) const;
|
||||
virtual void update();
|
||||
public:
|
||||
TPreview_panel(short x, short y, short dx, short dy, TColor_mask* owner);
|
||||
} *_preview;
|
||||
class TPreview_icons : public TWindow
|
||||
{
|
||||
TColor_mask* _owner;
|
||||
protected:
|
||||
virtual void update();
|
||||
public:
|
||||
TPreview_icons(short x, short y, short dx, short dy, TColor_mask* owner);
|
||||
} *_icons;
|
||||
|
||||
TAssoc_array _color;
|
||||
|
||||
protected: // TMask
|
||||
virtual void update();
|
||||
virtual bool stop_run(KEY key) { return TWindow::stop_run(key); }
|
||||
virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly);
|
||||
|
||||
// @cmember Converte le coordinate logiche (caratteri) in coordinate fisiche (pixel)
|
||||
virtual PNT log2dev(long x, long y) const;
|
||||
|
||||
protected:
|
||||
COLOR get_color_entry(const char* c) const;
|
||||
void set_color_entry(const char* name, COLOR col);
|
||||
@ -315,6 +326,84 @@ public:
|
||||
virtual ~TColor_mask() { }
|
||||
};
|
||||
|
||||
COLOR TColor_mask::TPreview_panel::get_color_entry(const char* name) const
|
||||
{ return _owner->get_color_entry(name); }
|
||||
|
||||
TColor_mask::TPreview_panel::TPreview_panel(short x, short y, short dx, short dy, TColor_mask* owner)
|
||||
: _owner(owner)
|
||||
{ create(x, y, dx, dy, "", 0, W_PLAIN, owner->page_win(0)); }
|
||||
|
||||
void TColor_mask::TPreview_panel::update()
|
||||
{
|
||||
COLOR p, b;
|
||||
|
||||
const int x = 0;
|
||||
const int y = 0;
|
||||
const int w = columns();
|
||||
const int h = rows();
|
||||
|
||||
b = get_color_entry("MaskBack");
|
||||
clear(b);
|
||||
|
||||
set_pen(p = get_color_entry("MaskLight"));
|
||||
line(x+1, y, x+w-2, y);
|
||||
line(x+1, y, x+1, y+h-1);
|
||||
|
||||
set_pen(p = get_color_entry("MaskDark"));
|
||||
line(x+1, y+h-1, x+w-2, y+h-1);
|
||||
line(x+w-2, y+h-1, x+w-2, y);
|
||||
|
||||
set_opaque_text(false);
|
||||
set_pen(p = get_color_entry("Normal"));
|
||||
set_brush(b = get_color_entry("NormalBack"));
|
||||
frame(x+3, y+1, x+w-3, y+2, 0);
|
||||
set_color(p, b);
|
||||
stringat(x+4, y+1, "Campo normale");
|
||||
|
||||
set_pen(p = get_color_entry("Normal")); // Stesso inchiostro del normale
|
||||
set_brush(b = get_color_entry("RequiredBack"));
|
||||
frame(x+3, y+3, x+w-3, y+4, 0);
|
||||
set_color(p, b);
|
||||
stringat(x+4, y+3, "Campo obbligatorio");
|
||||
|
||||
set_pen(p = get_color_entry("Focus"));
|
||||
set_brush(b = get_color_entry("FocusBack"));
|
||||
frame(x+3, y+5, x+w-3, y+6, 0);
|
||||
set_color(p, b);
|
||||
stringat(x+4, y+5, "Campo attivo");
|
||||
|
||||
set_pen(p = get_color_entry("Disabled"));
|
||||
set_brush(b = get_color_entry("DisabledBack"));
|
||||
frame(x+3, y+7, x+w-3, y+8, 0);
|
||||
set_color(p, b);
|
||||
stringat(x+4, y+7, "Campo disabilitato");
|
||||
|
||||
set_pen(p = get_color_entry("ButtonLight"));
|
||||
set_brush(b = get_color_entry("ButtonBack"));
|
||||
frame(x+3, y+9, x+w-3, y+10, 0);
|
||||
set_color(get_color_entry("Normal"), b);
|
||||
stringat(x+4, y+9, "Bottone normale");
|
||||
}
|
||||
|
||||
void TColor_mask::TPreview_icons::update()
|
||||
{
|
||||
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
|
||||
clear(MASK_BACK_COLOR);
|
||||
set_pen(MASK_DARK_COLOR);
|
||||
xvt_dwin_draw_rect(win(), &rct);
|
||||
|
||||
const int s = _owner->get_int(217);
|
||||
const int sz = 16 + s*8;
|
||||
const int y = (rct.bottom - sz)/2;
|
||||
int x = (rct.right - 3*sz)/2;
|
||||
for (short id = 201; id <= 203; id++, x += sz)
|
||||
xvt_dwin_draw_tool(win(), x, y, id, sz);
|
||||
}
|
||||
|
||||
TColor_mask::TPreview_icons::TPreview_icons(short x, short y, short dx, short dy, TColor_mask* owner)
|
||||
: _owner(owner)
|
||||
{ create(x, y, dx, dy, "", 0, W_PLAIN, owner->page_win(1)); }
|
||||
|
||||
bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
{
|
||||
const short id = f.dlg();
|
||||
@ -351,6 +440,10 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
update();
|
||||
}
|
||||
break;
|
||||
case 217:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
_icons->force_update();
|
||||
break;
|
||||
case DLG_USER:
|
||||
if (e == fe_button)
|
||||
{
|
||||
@ -395,18 +488,13 @@ TColor_mask::TColor_mask()
|
||||
set(213, CAMPI_SCAVATI ? "X" : "");
|
||||
set(214, NATIVE_CONTROLS ? "X" : "");
|
||||
set(215, ADVANCED_GRAPHICS ? "X" : "");
|
||||
}
|
||||
set(216, color.get_int("TreeView"));
|
||||
|
||||
PNT TColor_mask::log2dev(long x, long y) const
|
||||
{
|
||||
PNT p = { int(y * XI_FU_MULTIPLE), int(x * XI_FU_MULTIPLE) };
|
||||
_preview = new TPreview_panel(1, 5, 33, 7, this);
|
||||
_icons = new TPreview_icons(1, 10, -2, -2, this);
|
||||
|
||||
XI_OBJ* itf = xi_get_itf((XinWindow)win());
|
||||
xi_fu_to_pu(itf, (XinPoint*)&p, 1);
|
||||
|
||||
p.v = int(y * ROWY);
|
||||
p.h += XI_FU_MULTIPLE / 2;
|
||||
return p;
|
||||
const int sz = color.get_int("ToolSize");
|
||||
set(217, (sz-16)/8);
|
||||
}
|
||||
|
||||
KEY TColor_mask::run()
|
||||
@ -417,60 +505,6 @@ KEY TColor_mask::run()
|
||||
return k;
|
||||
}
|
||||
|
||||
|
||||
void TColor_mask::update()
|
||||
{
|
||||
COLOR p, b;
|
||||
|
||||
const int x = 1;
|
||||
const int y = 5;
|
||||
const int w = 33;
|
||||
const int h = 11;
|
||||
|
||||
set_pen(COLOR_BLACK);
|
||||
set_brush(b = get_color_entry("MaskBack"));
|
||||
frame(x+0, y+0, x+w, y+h, 0);
|
||||
|
||||
set_pen(p = get_color_entry("MaskLight"));
|
||||
line(x+1, y, x+w-2, y);
|
||||
line(x+1, y, x+1, y+h-1);
|
||||
|
||||
set_pen(p = get_color_entry("MaskDark"));
|
||||
line(x+1, y+h-1, x+w-2, y+h-1);
|
||||
line(x+w-2, y+h-1, x+w-2, y);
|
||||
|
||||
set_opaque_text(false);
|
||||
set_pen(p = get_color_entry("Normal"));
|
||||
set_brush(b = get_color_entry("NormalBack"));
|
||||
frame(x+3, y+1, x+w-3, y+2, 0);
|
||||
set_color(p, b);
|
||||
stringat(x+4, y+1, "Campo normale");
|
||||
|
||||
set_pen(p = get_color_entry("Normal")); // Stesso inchiostro del normale
|
||||
set_brush(b = get_color_entry("RequiredBack"));
|
||||
frame(x+3, y+3, x+w-3, y+4, 0);
|
||||
set_color(p, b);
|
||||
stringat(x+4, y+3, "Campo obbligatorio");
|
||||
|
||||
set_pen(p = get_color_entry("Focus"));
|
||||
set_brush(b = get_color_entry("FocusBack"));
|
||||
frame(x+3, y+5, x+w-3, y+6, 0);
|
||||
set_color(p, b);
|
||||
stringat(x+4, y+5, "Campo attivo");
|
||||
|
||||
set_pen(p = get_color_entry("Disabled"));
|
||||
set_brush(b = get_color_entry("DisabledBack"));
|
||||
frame(x+3, y+7, x+w-3, y+8, 0);
|
||||
set_color(p, b);
|
||||
stringat(x+4, y+7, "Campo disabilitato");
|
||||
|
||||
set_pen(p = get_color_entry("ButtonLight"));
|
||||
set_brush(b = get_color_entry("ButtonBack"));
|
||||
frame(x+3, y+9, x+w-3, y+10, 0);
|
||||
set_color(get_color_entry("Normal"), b);
|
||||
stringat(x+4, y+9, "Bottone normale");
|
||||
}
|
||||
|
||||
void TColor_mask::save_colors()
|
||||
{
|
||||
TConfig colors(CONFIG_GUI, "Colors");
|
||||
@ -479,6 +513,9 @@ void TColor_mask::save_colors()
|
||||
colors.set("Campi3D", get_bool(213) ? "X" : "");
|
||||
colors.set("NativeControls", get_bool(214) ? "X" : "");
|
||||
colors.set("AdvancedGraphics", get_bool(215) ? "X" : "");
|
||||
colors.set("TreeView", get_int(216));
|
||||
const int sz = get_int(217);
|
||||
colors.set("ToolSize", 16+sz*8);
|
||||
}
|
||||
|
||||
COLOR TColor_mask::get_color_entry(const char* name) const
|
||||
@ -536,7 +573,7 @@ COLOR TColor_mask::cid2color(short cid) const
|
||||
|
||||
COLOR TColor_mask::cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const
|
||||
{
|
||||
int entry[] = { XVT_COLOR_BACKGROUND, XVT_COLOR_BLEND, XVT_COLOR_BORDER,
|
||||
int entry[] = { XVT_COLOR_TROUGH, XVT_COLOR_BLEND, XVT_COLOR_BORDER,
|
||||
XVT_COLOR_FOREGROUND, XVT_COLOR_BACKGROUND, XVT_COLOR_BACKGROUND,
|
||||
XVT_COLOR_HIGHLIGHT, XVT_COLOR_SELECT,
|
||||
XVT_COLOR_BLEND, XVT_COLOR_BORDER,
|
||||
@ -557,12 +594,10 @@ COLOR TColor_mask::cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const
|
||||
return COLOR_BLACK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Menu application
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
bool TMenu_application::test_assistance_year() const
|
||||
{
|
||||
return true;
|
||||
@ -846,7 +881,7 @@ int TMenu_application::get_user_status(const char* usr) const
|
||||
CHECK(usr && *usr, "Utente nullo");
|
||||
|
||||
int status = 0;
|
||||
if (prefix_valid() && prefix().name()[0] != '.')
|
||||
if (prefix_valid())
|
||||
{
|
||||
TLocalisamfile utonti(LF_USER);
|
||||
utonti.put(USR_USERNAME, usr);
|
||||
@ -873,7 +908,7 @@ bool TMenu_application::set_user_status(const char* usr, int status) const
|
||||
CHECK(usr && *usr, "Utente nullo");
|
||||
|
||||
bool ok = false;
|
||||
if (prefix_valid() && prefix().name()[0] != '.')
|
||||
if (prefix_valid())
|
||||
{
|
||||
TLocalisamfile utonti(LF_USER);
|
||||
utonti.put(USR_USERNAME, usr);
|
||||
@ -1141,19 +1176,11 @@ 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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
warning_box(TR("ATTENZIONE\nQuesto programma č in versione dimostrativa.\n"
|
||||
"Esso funzionera' per circa due ore al giorno con un numero limitato di registrazioni."));
|
||||
|
||||
if (!check_user())
|
||||
return false;
|
||||
@ -1220,13 +1247,15 @@ void TMenu_application::main_loop()
|
||||
bool TMenu_application::choose_colors()
|
||||
{
|
||||
disable_menu_item(OPTIONS_MENU);
|
||||
TColor_mask * cm = new TColor_mask();
|
||||
if (cm->run() == K_ENTER)
|
||||
TColor_mask* cm = new TColor_mask();
|
||||
const bool ok = cm->run() == K_ENTER;
|
||||
if (ok)
|
||||
{
|
||||
cm->save_colors(); // Aggiorna config
|
||||
customize_colors(); // Aggiorna set di colori
|
||||
_tree_view = cm->get_int(216); // Aggiorna stile menu
|
||||
cm->save_colors(); // Aggiorna config
|
||||
customize_colors(); // Aggiorna set di colori
|
||||
|
||||
reload_images(); // Aggiorna bitmaps del menu
|
||||
reload_images(); // Aggiorna bitmaps del menu
|
||||
|
||||
// Ridisegna sfondo
|
||||
TTemp_window tw(TASK_WIN);
|
||||
@ -1236,9 +1265,9 @@ bool TMenu_application::choose_colors()
|
||||
if (_mask != NULL)
|
||||
_mask->stop_run(K_CTRL + 'R');
|
||||
}
|
||||
enable_menu_item(OPTIONS_MENU);
|
||||
delete cm;
|
||||
return true;
|
||||
enable_menu_item(OPTIONS_MENU);
|
||||
return ok;
|
||||
}
|
||||
|
||||
HIDDEN bool browse_file_handler(TMask_field& f, KEY k)
|
||||
@ -1547,7 +1576,7 @@ void TMenu_application::update_preferred()
|
||||
}
|
||||
}
|
||||
|
||||
xvt_menu_set_tree(TASK_WIN, mm);
|
||||
xvt_menu_set_tree(TASK_WIN, mm);
|
||||
xvt_menu_update(TASK_WIN);
|
||||
xvt_res_free_menu_tree(mm);
|
||||
|
||||
@ -1585,22 +1614,17 @@ void TMenu_application::update_preferred_tree()
|
||||
void TMenu_application::load_preferences()
|
||||
{
|
||||
TConfig cfg(CONFIG_GUI, "ba0");
|
||||
_tree_view = cfg.get_int("TreeView", NULL, -1, 3);
|
||||
|
||||
_preferred.destroy();
|
||||
TToken_string row;
|
||||
|
||||
int i;
|
||||
for (i = 0; ; i++)
|
||||
for (int i = 0; ; i++)
|
||||
{
|
||||
row = cfg.get("Preferred", NULL, i);
|
||||
TToken_string row = cfg.get("Preferred", NULL, i);
|
||||
if (row.empty_items())
|
||||
break;
|
||||
_preferred.add(row);
|
||||
}
|
||||
|
||||
if (i > 0)
|
||||
update_preferred();
|
||||
update_preferred();
|
||||
|
||||
_tree_view = cfg.get_int("TreeView", "Colors", -1, 3);
|
||||
}
|
||||
|
||||
void TMenu_application::save_preferences()
|
||||
@ -1610,7 +1634,8 @@ void TMenu_application::save_preferences()
|
||||
for (i = 0; i < _preferred.items(); i++)
|
||||
cfg.set("Preferred", _preferred.row(i), NULL, true, i);
|
||||
cfg.set("Preferred", "", NULL, true, i);
|
||||
cfg.set("TreeView", _tree_view);
|
||||
|
||||
cfg.set("TreeView", _tree_view, "Colors");
|
||||
}
|
||||
|
||||
void TMenu_application::add_to_preferred()
|
||||
@ -1655,7 +1680,7 @@ void TMenu_application::add_to_preferred()
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (tok.not_empty() && _preferred.find(tok) < 0)
|
||||
if (tok.full() && _preferred.find(tok) < 0)
|
||||
{
|
||||
_preferred.add(tok);
|
||||
save_preferences();
|
||||
@ -1738,7 +1763,6 @@ bool TPreferred_mask::on_field_event(TOperable_field& o, TField_event e, long jo
|
||||
void TMenu_application::manage_preferred()
|
||||
{
|
||||
TPreferred_mask* m = new TPreferred_mask;
|
||||
m->set(F_PREF_TREE, _tree_view);
|
||||
|
||||
TSheet_field& sf = m->sfield(F_PREF_SHEET);
|
||||
sf.rows_array() = _preferred;
|
||||
@ -1748,18 +1772,8 @@ void TMenu_application::manage_preferred()
|
||||
if (m->run() == K_ENTER)
|
||||
{
|
||||
_preferred = sf.rows_array();
|
||||
|
||||
const int old_tv = _tree_view;
|
||||
_tree_view = m->get_int(F_PREF_TREE);
|
||||
|
||||
save_preferences();
|
||||
update_preferred();
|
||||
|
||||
if (_tree_view != old_tv && _mask != NULL)
|
||||
{
|
||||
reload_images();
|
||||
_mask->TWindow::stop_run(K_CTRL + 'R'); // Provoca chiusura forzata del menu
|
||||
}
|
||||
}
|
||||
delete m;
|
||||
}
|
||||
|
159
ba/ba0102.cpp
159
ba/ba0102.cpp
@ -1,13 +1,17 @@
|
||||
#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
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -299,6 +303,8 @@ void synchronize_tree_field(TTree_field& tf)
|
||||
|
||||
tf.win().force_update(); // Provoca la rigenerazione dell'albero espanso come sopra
|
||||
|
||||
tf.on_key(K_SPACE);
|
||||
|
||||
_sincronaising = false;
|
||||
}
|
||||
|
||||
@ -462,11 +468,10 @@ 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(COLOR rgb);
|
||||
void draw_menu_caption();
|
||||
void click_on(int index);
|
||||
void select(int s, int direction);
|
||||
|
||||
@ -549,7 +554,7 @@ void TMenulist_window::draw_item(int i)
|
||||
}
|
||||
|
||||
//scrive la voce di menu corrente a video
|
||||
void TMenulist_window::draw_menu_caption(COLOR rgb)
|
||||
void TMenulist_window::draw_menu_caption()
|
||||
{
|
||||
const char* caption = "";
|
||||
if (_sorted.items() > 1)
|
||||
@ -563,26 +568,7 @@ void TMenulist_window::draw_menu_caption(COLOR rgb)
|
||||
const TMenuitem& mi = (const TMenuitem&)_sorted[0];
|
||||
caption = mi.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);
|
||||
|
||||
xvt_pane_set_title(win(), caption);
|
||||
statbar_set_title(TASK_WIN, caption);
|
||||
}
|
||||
|
||||
@ -592,7 +578,7 @@ void TMenulist_window::update()
|
||||
if (_tree == NULL)
|
||||
return; // Nothing to draw
|
||||
|
||||
const bool db = _tree != NULL && ADVANCED_GRAPHICS;
|
||||
const bool db = ADVANCED_GRAPHICS;
|
||||
TImage* img = db ? _images.image(_image_name) : NULL; // Delay time before clearing
|
||||
|
||||
if (img != NULL)
|
||||
@ -615,29 +601,7 @@ void TMenulist_window::update()
|
||||
FOR_EACH_ARRAY_ITEM(_sorted, i, obj)
|
||||
draw_item(i);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
draw_menu_caption();
|
||||
}
|
||||
|
||||
void TMenulist_window::click_on(int index)
|
||||
@ -945,7 +909,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 && w != NULL_WIN)
|
||||
if (_spider && xvt_vobj_is_focusable(w))
|
||||
{
|
||||
RCT client; xvt_vobj_get_client_rect(w, &client);
|
||||
|
||||
@ -1088,7 +1052,7 @@ bool TSpidey_mask::stop_run(KEY k)
|
||||
}
|
||||
}
|
||||
// Butto via le immagini dopo averle disegnate tutte
|
||||
for (i = 2; i >= 0; i--)
|
||||
for (i = 3; i >= 0; i--)
|
||||
xvt_image_destroy(image[i]);
|
||||
|
||||
if (installing()) //se e' stata lanciata la installazione moduli...
|
||||
@ -1102,7 +1066,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;
|
||||
}
|
||||
@ -1121,7 +1085,7 @@ bool TSpidey_mask::on_key(KEY k)
|
||||
return TMask::on_key(k);
|
||||
}
|
||||
|
||||
TSpidey_mask::TSpidey_mask() : TAutomask ("", 1, 0, 0, 0, 0)
|
||||
TSpidey_mask::TSpidey_mask() : TAutomask ("Menu", 1, 0, 0, 0, 0)
|
||||
{ }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -1156,16 +1120,6 @@ 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);
|
||||
@ -1181,16 +1135,24 @@ bool TExplorer_mask::on_field_event(TOperable_field& o, TField_event e, long jol
|
||||
switch(o.dlg())
|
||||
{
|
||||
case DLG_TREE:
|
||||
if (e == fe_modify && !_sincronaising)
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TTree_field& tf = (TTree_field&)o;
|
||||
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
|
||||
const TMenuitem& mi = mt.curr_item();
|
||||
if (mi.perform() && mt.goto_firstson())
|
||||
{
|
||||
TMenulist_field& mf = (TMenulist_field&)field(DLG_LIST);
|
||||
mf.set_menu(mt);
|
||||
}
|
||||
if (!_sincronaising)
|
||||
{
|
||||
const TMenuitem& mi = mt.curr_item();
|
||||
if (mi.perform() && mt.goto_firstson())
|
||||
{
|
||||
TMenulist_field& mf = (TMenulist_field&)field(DLG_LIST);
|
||||
mf.set_menu(mt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TMenulist_field& mf = (TMenulist_field&)field(DLG_LIST);
|
||||
mf.set_menu(mt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DLG_SHRINK:
|
||||
@ -1202,21 +1164,28 @@ bool TExplorer_mask::on_field_event(TOperable_field& o, TField_event e, long jol
|
||||
mt.goto_root();
|
||||
select_tree_current();
|
||||
}
|
||||
case DLG_USER:
|
||||
if (e == fe_modify && !o.empty())
|
||||
break;
|
||||
case DLG_FINDREC:
|
||||
if (e == fe_button)
|
||||
{
|
||||
const TString& v = o.get();
|
||||
TTree_field& tf = tfield(DLG_TREE);
|
||||
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
|
||||
if (mt.find_string(v))
|
||||
TString80 str = _last_search_string;
|
||||
const char* s = xvt_dm_post_string_prompt(TR("Testo"), str.get_buffer(), str.size());
|
||||
if (s && *s)
|
||||
{
|
||||
select_tree_current();
|
||||
_last_search_string = v;
|
||||
_last_search_string = s;
|
||||
send_key(K_F3, 0);
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -1227,7 +1196,12 @@ bool TExplorer_mask::on_key(KEY k)
|
||||
{
|
||||
if (k == K_F3 || k == K_F8)
|
||||
{
|
||||
set(DLG_USER, _last_search_string, true);
|
||||
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();
|
||||
return true;
|
||||
}
|
||||
return TSpidey_mask::on_key(k);
|
||||
@ -1235,12 +1209,16 @@ bool TExplorer_mask::on_key(KEY k)
|
||||
|
||||
TExplorer_mask::TExplorer_mask(TMenu& menu) : _tree(menu)
|
||||
{
|
||||
// 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);
|
||||
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);
|
||||
|
||||
// Tree view
|
||||
TTree_field& trifola = add_tree(DLG_TREE, 0, 0, 0, 32, 0);
|
||||
@ -1249,13 +1227,12 @@ TExplorer_mask::TExplorer_mask(TMenu& menu) : _tree(menu)
|
||||
|
||||
// List view
|
||||
TMenulist_field* mf = new TMenulist_field(this);
|
||||
mf->create(DLG_LIST, 21, 0, 0, 0, win());
|
||||
mf->create(DLG_LIST, 48, 0, 0, 0, panel);
|
||||
mf->set_menu(*(TMenu_tree*)trifola.tree());
|
||||
add_field(mf);
|
||||
|
||||
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);
|
||||
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
|
||||
set_handlers();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user