Patch level : 4.0

Files correlati     : ba0
Ricompilazione Demo : [ ]
Commento            :
Utilizzo alberi nuovi per menu principale


git-svn-id: svn://10.65.10.50/trunk@15861 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2007-12-12 16:14:54 +00:00
parent 076364e945
commit 99e9884241
7 changed files with 117 additions and 71 deletions

View File

@ -567,6 +567,7 @@ protected:
void set_color_entry(const char* name, COLOR col);
const char* cid2name(short cid) const;
COLOR cid2color(short cid) const;
COLOR cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const;
public:
void save_colors();
@ -584,7 +585,7 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
switch (id)
{
case DLG_USER:
case 211:
if (e == fe_button)
{
for (short bid = 101; bid <= 113; bid++)
@ -599,7 +600,21 @@ bool TColor_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
update();
}
break;
case 214:
case 212:
if (e == fe_button)
{
XVT_COLOR_COMPONENT* cc = (XVT_COLOR_COMPONENT*)xvt_vobj_get_attr(NULL_WIN, ATTR_APP_CTL_COLORS);
for (short bid = 101; bid <= 113; bid++)
{
const char* name = cid2name(bid);
const COLOR color = cid2syscolor(bid, cc);
set_color_entry(name, color);
}
xvt_mem_free((DATA_PTR)cc);
update();
}
break;
case DLG_USER:
if (e == fe_button)
{
XVT_FNTID fontid = xvt_default_font();
@ -641,8 +656,8 @@ TColor_mask::TColor_mask()
TConfig color(CONFIG_GUI, "Colors");
_color = color.list_variables();
set(213, CAMPI_SCAVATI ? "X" : "");
set(214, NATIVE_CONTROLS ? "X" : "");
set(215, ADVANCED_GRAPHICS ? "X" : "");
set(216, SMALL_ICONS ? "X" : "");
}
PNT TColor_mask::log2dev(long x, long y) const
@ -730,8 +745,8 @@ void TColor_mask::save_colors()
FOR_EACH_ASSOC_STRING(_color, obj, key, str)
colors.set(key, str);
colors.set("Campi3D", get_bool(213) ? "X" : "");
colors.set("NativeControls", get_bool(214) ? "X" : "");
colors.set("AdvancedGraphics", get_bool(215) ? "X" : "");
colors.set("SmallIcons", get_bool(216) ? "X" : "");
}
COLOR TColor_mask::get_color_entry(const char* name) const
@ -776,7 +791,7 @@ const char* TColor_mask::cid2name(short cid) const
COLOR TColor_mask::cid2color(short cid) const
{
COLOR color[] = { COLOR_LTGRAY, COLOR_WHITE, COLOR_GRAY,
COLOR color[] = { MAKE_COLOR(201,194,188), COLOR_WHITE, COLOR_GRAY,
COLOR_BLACK, COLOR_WHITE, blend_colors(COLOR_WHITE, COLOR_YELLOW, 0.60),
COLOR_BLACK, COLOR_YELLOW,
COLOR_DKGRAY, COLOR_LTGRAY,
@ -787,6 +802,30 @@ COLOR TColor_mask::cid2color(short cid) const
return color[i];
}
COLOR TColor_mask::cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const
{
int entry[] = { XVT_COLOR_BACKGROUND, 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,
XVT_COLOR_BACKGROUND, XVT_COLOR_BLEND, XVT_COLOR_BORDER };
const int component = entry[cid-101];
for (int i = 0; cc[i].type != XVT_COLOR_NULL; i++)
{
if (cc[i].type == component)
{
switch (cid)
{
case 105: return COLOR_WHITE;
case 106: return blend_colors(cid2syscolor(105, cc), cid2syscolor(108, cc), 0.60);
default : return cc[i].color;
}
}
}
return COLOR_BLACK;
}
///////////////////////////////////////////////////////////
// Menu application
///////////////////////////////////////////////////////////

View File

@ -2,7 +2,7 @@
PAGE "Selezione utente" -1 -1 28 6
STRING F_USER 32 16
STRING F_USER 64 16
BEGIN
PROMPT 1 1 "Utente "
USE LF_USER SELECT ISGROUP!="X"
@ -14,7 +14,7 @@ BEGIN
CHECKTYPE SEARCH
END
STRING F_PASSWORD 32 16
STRING F_PASSWORD 64 16
BEGIN
PROMPT 1 3 "Password "
FLAGS "*"

View File

@ -125,9 +125,8 @@ public:
///////////////////////////////////////////////////////////
TMenuitem::TMenuitem(TSubmenu* sm)
: _submenu(sm), _icon(0), _color(NORMAL_COLOR), _exist(-1),
_firm(false), _password(false), _reloadmenu(false)
: _submenu(sm), _icon(0), _exist(-1),
_firm(false), _password(false), _reloadmenu(false)
{ }
TMenuitem::TMenuitem(const TMenuitem& mi)
@ -137,7 +136,6 @@ TMenuitem::TMenuitem(const TMenuitem& mi)
_firm = mi._firm;
_password = mi._password;
_reloadmenu = mi._reloadmenu;
_color = mi._color;
_icon = mi._icon;
_enabled = mi._enabled;
_caption = mi._caption;

View File

@ -32,7 +32,6 @@ class TMenuitem : public TObject
int _icon;
char _type;
COLOR _color;
char _exist : 2;
char _enabled : 2;
char _firm : 2;
@ -52,8 +51,6 @@ public:
bool enabled() const;
bool disabled() const { return !enabled(); }
COLOR color() const { return enabled() ? _color : DISABLED_COLOR; }
bool is_submenu() const { return _type == '[' && _action.not_empty(); }
bool is_program() const { return _type != '[' && _action.not_empty(); }
bool perform() const;

View File

@ -271,26 +271,19 @@ TMenu_tree::TMenu_tree(TMenu& menu)
// Utility
///////////////////////////////////////////////////////////
// Sincronizza l'albero in basa alla list view
void synchronize_tree_field(TTree_field& tf)
{
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
tf.select_current();
TTree& mt = *tf.tree();
TString id; mt.curr_id(id); // Memorizza nodo corrente
mt.shrink_all(); // Collassa tutto l'albero
// Espande il nodo corrente all'indietro fino alla radice
mt.goto_node(id);
do mt.expand(); while (mt.goto_father());
mt.goto_node(id); // Torna al nodo corrente
mt.shrink_all();
mt.goto_node(id);
do
{
mt.expand();
}
while (mt.goto_father());
mt.goto_node(id);
tf.set_tree(&mt); // Azzera origine
TField_window& win = tf.win();
win.force_update();
tf.win().force_update(); // Provoca la rigenerazione dell'albero espanso come sopra
tf.select_current(); // Riporta la selezione a posto
}
bool can_be_transparent(const TImage& i)
@ -299,12 +292,12 @@ bool can_be_transparent(const TImage& i)
const int h = i.height()-1;
const COLOR col = i.get_pixel(0,0);
if (i.get_pixel(w,0) != col)
return FALSE;
return false;
if (i.get_pixel(w,h) != col)
return FALSE;
return false;
if (i.get_pixel(0,h) != col)
return FALSE;
return TRUE;
return false;
return false;
}
///////////////////////////////////////////////////////////
@ -475,15 +468,15 @@ void TMenulist_window::draw_item(int i)
set_opaque_text(TRUE);
const TMenuitem& item = (const TMenuitem&)_sorted[i];
if (i == _selected && item.enabled())
if (item.enabled())
{
//testo nero su sfondo con colore del focus se la voce e' selezionata
set_color(item.color(), FOCUS_BACK_COLOR);
if (i == _selected) //testo nero su sfondo con colore del focus se la voce e' selezionata
set_color(FOCUS_COLOR, FOCUS_BACK_COLOR);
else //testo nero su sfondo trasparente x voci non selezionate
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
}
else
{
set_color(item.color(), NORMAL_BACK_COLOR); //testo nero su sfondo trasparente x voci non selezionate
}
else //testo grigio su sfondo trasparente x voci non selezionate
set_color(DISABLED_COLOR, DISABLED_BACK_COLOR);
const int row = i / MENU_COLS;
const int col = i % MENU_COLS;
@ -492,7 +485,6 @@ void TMenulist_window::draw_item(int i)
const int top = row * height / MENU_ROWS;
// const int bottom = (row+1) * height / MENU_ROWS;
const int maxchars = (right-left)/CHARX - 1;
const int cx = (left+right)/2;
// const int cy = (top+bottom)/2; verificare
@ -514,8 +506,14 @@ void TMenulist_window::draw_item(int i)
if (i == 0 && _can_go_back)
str = "(..)";
// const int maxchars = (right-left)/CHARX - 1;
int maxchars = 24;
const int ll = xvt_dwin_get_text_width(win(), str, -1);
if (ll >= (right-left))
maxchars = (right-left) * str.len() / ll - 1;
TParagraph_string para(str, maxchars);
int y = iy + 32 + CHARY-2;
int y = iy + 32 + CHARY-1;
FOR_EACH_TOKEN(para, line)
{
const int ll = xvt_dwin_get_text_width(win(), line, -1);
@ -567,13 +565,13 @@ void TMenulist_window::draw_menu_caption(COLOR rgb)
void TMenulist_window::update()
{
const bool db = _tree != NULL && ADVANCED_GRAPHICS;
TImage* img = db ? _images.image(_image_name) : NULL; // Delay time before clearing
TField_window::update();
if (_tree == NULL)
return; // Nothing to draw
const bool db = _tree != NULL && ADVANCED_GRAPHICS;
TImage* img = db ? _images.image(_image_name) : NULL; // Delay time before clearing
if (img != NULL)
{
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
@ -591,7 +589,7 @@ void TMenulist_window::update()
logo->draw(win(), x, y);
}
for (int i = 0; i < _sorted.items(); i++)
FOR_EACH_ARRAY_ITEM(_sorted, i, obj)
draw_item(i);
if (ADVANCED_GRAPHICS)
@ -652,7 +650,9 @@ void TMenulist_window::click_on(int index)
if (ti.action() == mi.action())
{
_tree->goto_firstson();
TString cazzo1; _tree->curr_id(cazzo1);
set_menu(*_tree);
TString cazzo2; _tree->curr_id(cazzo2);
synchronize_buddy_tree();
break;
}
@ -830,15 +830,16 @@ void TMenulist_window::set_menu(TMenu_tree& tree)
if (dot > 0)
{
sel = atoi(_curr_node.mid(dot));
_curr_node.overwrite("0", dot);
_curr_node.cut(dot);
_curr_node << '0';
}
_sorted.destroy();
_can_go_back = tree.goto_father();
if (_can_go_back)
if (_can_go_back) // Esiste un livello precedente?
{
_sorted.add(tree.curr_item());
tree.goto_node(_curr_node);
_sorted.add(tree.curr_item()); // Determina il nome del livello precedente
tree.goto_node(_curr_node); // Torna al nodo corrente
}
int folders = _sorted.items();

View File

@ -91,24 +91,39 @@ BEGIN
PROMPT 38 11 "Sfondo"
END
GROUPBOX DLG_NULL 16 4
BEGIN
PROMPT 37 13 "@bTemi predefiniti"
END
BUTTON 211 12
BEGIN
PROMPT 38 14 "Campo"
END
BUTTON 212 12
BEGIN
PROMPT 38 15 "Sistema"
END
BOOLEAN 213
BEGIN
PROMPT 36 13 "Campi 3D"
PROMPT 2 17 "Campi 3D"
END
BOOLEAN 214
BEGIN
PROMPT 15 17 "Bottoni di sistema"
END
BOOLEAN 215
BEGIN
PROMPT 36 14 "Grafica avanzata"
PROMPT 36 17 "Grafica avanzata"
END
BOOLEAN 216
BUTTON DLG_USER 12 2
BEGIN
PROMPT 36 15 "Icone piccole"
END
BUTTON 214 12 2
BEGIN
PROMPT -33 16 "Font"
PROMPT -23 -1 "Font"
END
BUTTON DLG_CANCEL 12 2
@ -116,11 +131,6 @@ BEGIN
PROMPT -13 -1 "Annulla"
END
BUTTON DLG_USER 12 2
BEGIN
PROMPT -23 -1 "A~zzera"
END
BUTTON DLG_OK 12 2
BEGIN
PROMPT -33 -1 ""

View File

@ -7,11 +7,11 @@
#include <progind.h>
#include <utility.h>
#include <limits.h>
#include "ba2200.h"
#include "ba2201.h"
#include <nditte.h>
struct TAFile_info : public TObject
{
TFilename _name;
@ -41,8 +41,8 @@ TArchive_mask::TArchive_mask() : TAutomask("ba2200")
int k = 0;
for (int d = 0; d < 26; d++)
{
str.format("%c:", d+'A');
const bool isrem = xvt_fsys_is_removable_drive(str) != 0;
str.format("%c:", 'A'+d);
const bool isrem = d < 2 && xvt_fsys_is_removable_drive(str) != 0;
const bool isfix = !isrem && xvt_fsys_is_fixed_drive(str);
const bool isnet = !isrem && !isfix && xvt_fsys_is_network_drive(str);
if (isrem || isfix || isnet)
@ -341,8 +341,9 @@ void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, con
TLocalisamfile nditte(LF_NDITTE);
for (int err = nditte.first(); err == NOERR; err = nditte.next())
{
const long f = nditte.get_long("CODDITTA");
ditte.add_long(f);
const long f = nditte.get_long(NDT_CODDITTA);
if (prefix().test(f))
ditte.add_long(f);
}
}
else