Patch level : 10.0

Files correlati     : ba0.0
Ricompilazione Demo : [ ]
Commento            :
0000938: Aggiungi preferiti: non funziona più
Se tento di aggiungere una voce mi inserisce sempre "Archivi e Tabelle di BASE"


git-svn-id: svn://10.65.10.50/trunk@17472 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-10-24 15:41:41 +00:00
parent 30403d38c6
commit 0238fb2229

View File

@ -89,6 +89,7 @@ protected:
bool copy_setup(const TString& remote_path); bool copy_setup(const TString& remote_path);
public: public:
TTree_field& tree_field() const;
void select_tree_current(); void select_tree_current();
static bool tree_find_handler(TMask_field& f, KEY k); static bool tree_find_handler(TMask_field& f, KEY k);
static bool tree_shrink_handler(TMask_field& f, KEY k); static bool tree_shrink_handler(TMask_field& f, KEY k);
@ -150,7 +151,7 @@ void TPicture_mask::update()
if (tree_view) // TreeView == 1 if (tree_view) // TreeView == 1
{ {
RCT rctree; field(DLG_TREE).get_rect(rctree); RCT rctree; tfield(DLG_TREE).get_rect(rctree);
const int maxx = client.right - rctree.right - 2 * CHARX; const int maxx = client.right - rctree.right - 2 * CHARX;
const int maxy = client.bottom - 10 * ROWY; const int maxy = client.bottom - 10 * ROWY;
@ -224,6 +225,7 @@ bool TPicture_mask::on_key(KEY k)
case K_F8: case K_F8:
set(DLG_USER, app().main_menu().last_search_string(), true); set(DLG_USER, app().main_menu().last_search_string(), true);
return true; return true;
/* Obsoleto coi nuovi alberi
case K_ENTER: case K_ENTER:
case K_UP: case K_UP:
case K_DOWN: case K_DOWN:
@ -235,6 +237,7 @@ bool TPicture_mask::on_key(KEY k)
return tf.win().on_key(k); return tf.win().on_key(k);
} }
break; break;
*/
default: default:
break; break;
} }
@ -840,7 +843,6 @@ int TMenu_application::do_level()
const TSubmenu& curr = _menu.current(); const TSubmenu& curr = _menu.current();
const int bwidth = 20; const int bwidth = 20;
//TPicture_mask mask(curr.caption(), -4, -4, curr);
TPicture_mask mask(curr.caption(), 0, 0, curr, 0, 0); TPicture_mask mask(curr.caption(), 0, 0, curr, 0, 0);
CHECK(_mask == NULL, "Two masks are better than one?"); CHECK(_mask == NULL, "Two masks are better than one?");
_mask = &mask; _mask = &mask;
@ -1704,9 +1706,15 @@ bool TMenu_application::tree_handler(TMask_field& f, KEY k)
return true; return true;
} }
TTree_field& TMenu_application::tree_field() const
{
CHECK(_tree_view > 0, "No menu tree");
return _mask->tfield(_tree_view == 3 ? 101 : 301);
}
void TMenu_application::select_tree_current() void TMenu_application::select_tree_current()
{ {
TTree_field& tf = _mask->tfield(DLG_TREE); TTree_field& tf = tree_field();
synchronize_tree_field(tf); synchronize_tree_field(tf);
tf.set_focus(); tf.set_focus();
} }
@ -1716,7 +1724,7 @@ bool TMenu_application::tree_find_handler(TMask_field&f, KEY k)
if (k == K_TAB && f.focusdirty() && !f.empty()) if (k == K_TAB && f.focusdirty() && !f.empty())
{ {
const TString& v = f.get(); const TString& v = f.get();
TTree_field& tf = f.mask().tfield(DLG_TREE); TTree_field& tf = app().tree_field();
TMenu_tree& mt = *(TMenu_tree*)tf.tree(); TMenu_tree& mt = *(TMenu_tree*)tf.tree();
if (mt.find_string(v)) if (mt.find_string(v))
app().select_tree_current(); app().select_tree_current();
@ -1730,7 +1738,7 @@ bool TMenu_application::tree_shrink_handler(TMask_field&f, KEY k)
{ {
if (k == K_SPACE) if (k == K_SPACE)
{ {
TTree_field& tf = f.mask().tfield(DLG_TREE); TTree_field& tf = app().tree_field();
TMenu_tree& mt = (TMenu_tree&)*tf.tree(); TMenu_tree& mt = (TMenu_tree&)*tf.tree();
mt.shrink_all(); mt.shrink_all();
mt.goto_root(); mt.goto_root();
@ -1836,39 +1844,20 @@ void TMenu_application::save_preferences()
for (i = 0; i < _preferred.items(); i++) for (i = 0; i < _preferred.items(); i++)
cfg.set("Preferred", _preferred.row(i), NULL, true, i); cfg.set("Preferred", _preferred.row(i), NULL, true, i);
cfg.set("Preferred", "", NULL, true, i); cfg.set("Preferred", "", NULL, true, i);
cfg.set("TreeView", _tree_view, "Colors");
} }
void TMenu_application::add_to_preferred() void TMenu_application::add_to_preferred()
{ {
const int maxpref = 16;
if (_mask == NULL) // Succede durante il login! if (_mask == NULL) // Succede durante il login!
return; return;
if (_preferred.items() < maxpref) if (_preferred.items() < 16) // Massimo numero di preferiti
{ {
TToken_string tok; TToken_string tok;
switch (_tree_view) switch (_tree_view)
{ {
case 1: case 0:
{
TTree_field& tf = _mask->tfield(DLG_TREE);
tf.goto_selected();
tf.tree()->get_description(tok);
TString id; tf.tree()->curr_id(id);
tok.add(id);
}
break;
case 2:
{
TMenulist_field& mf = (TMenulist_field&)_mask->field(DLG_LIST);
mf.curr_item(tok);
}
break;
default:
{ {
const TMask_field& butt = _mask->focus_field(); const TMask_field& butt = _mask->focus_field();
const int index = butt.dlg() - 101; const int index = butt.dlg() - 101;
@ -1881,6 +1870,21 @@ void TMenu_application::add_to_preferred()
} }
} }
break; break;
case 2:
{
TMenulist_field& mf = (TMenulist_field&)_mask->field(DLG_LIST);
mf.curr_item(tok);
}
break;
default:
{
TTree_field& tf = tree_field();
tf.goto_selected();
tf.tree()->get_description(tok);
TString id; tf.tree()->curr_id(id);
tok.add(id);
}
break;
} }
if (tok.full() && _preferred.find(tok) < 0) if (tok.full() && _preferred.find(tok) < 0)
{ {
@ -1890,7 +1894,7 @@ void TMenu_application::add_to_preferred()
} }
} }
else else
error_box(TR("Non e' possibile memorizzare piu' di %d preferenze"), maxpref); error_box(TR("Non e' possibile memorizzare piu' di %d preferenze"), _preferred.items());
} }
class TPreferred_mask : public TAutomask class TPreferred_mask : public TAutomask
@ -1900,7 +1904,6 @@ protected:
public: public:
TPreferred_mask() : TAutomask("ba0400a") { } TPreferred_mask() : TAutomask("ba0400a") { }
virtual ~TPreferred_mask() { }
}; };
bool TPreferred_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) bool TPreferred_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
@ -2079,10 +2082,14 @@ bool TMenu_application::menu(MENU_TAG mt)
TToken_string node(_preferred.row(index).get(1), '/'); TToken_string node(_preferred.row(index).get(1), '/');
if (_tree_view != 0) if (_tree_view != 0)
{ {
TMenu_tree& met = *(TMenu_tree*)_mask->tfield(DLG_TREE).tree(); TMenu_tree& met = *(TMenu_tree*)tree_field().tree();
ok = node.items() == 1 ? met.find_leaf(node) : met.goto_node(node); ok = node.items() == 1 ? met.find_leaf(node) : met.goto_node(node);
if (ok) if (ok)
{
select_tree_current(); select_tree_current();
if (met.curr_item().is_program())
tree_field().on_key(K_CTRL+K_SPACE); // Esegue subito il programma
}
} }
else else
{ {
@ -2096,7 +2103,8 @@ bool TMenu_application::menu(MENU_TAG mt)
_mask->stop_run(K_CTRL + 'R'); _mask->stop_run(K_CTRL + 'R');
} }
} }
if (!ok) beep(); if (!ok)
beep();
} }
break; break;
} }