maskfld.cpp Corretta cornice delle TField_window
tree.cpp Corretta gestione nodi espansi ma senza figli Aggiunto tasto K_ENTER per espandere i nodi Corretta gestione tasti su' e giu' git-svn-id: svn://10.65.10.50/trunk@6203 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a177471ae5
commit
9cd0090e05
@ -4236,7 +4236,7 @@ void TField_window::update()
|
||||
if (CAMPI_SCAVATI)
|
||||
{
|
||||
RCT rct; xvt_vobj_get_outer_rect(me, &rct);
|
||||
rct.left -= 2; rct.top -= 2; rct.right += 3; rct.bottom += 3;
|
||||
rct.left -= 2; rct.top -= 2; rct.right += 2; rct.bottom += 2;
|
||||
xi_draw_3d_rect(pa, &rct, TRUE, 2,
|
||||
MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR);
|
||||
}
|
||||
|
@ -701,15 +701,17 @@ bool TString_tree::get_description(TString& str) const
|
||||
class TNode_info : public TSortable
|
||||
{
|
||||
public:
|
||||
bool _valid : 1;
|
||||
bool _expandable : 1;
|
||||
bool _expanded : 1;
|
||||
TString _id;
|
||||
long _plusx;
|
||||
long _startx;
|
||||
long _endx;
|
||||
bool _expandable;
|
||||
bool _expanded;
|
||||
|
||||
const TNode_info& operator =(const TNode_info& ni)
|
||||
{
|
||||
_valid = ni._valid;
|
||||
_id = ni._id;
|
||||
_startx = ni._startx;
|
||||
_endx = ni._endx;
|
||||
@ -725,10 +727,10 @@ public:
|
||||
return _id.compare(ni._id);
|
||||
}
|
||||
|
||||
virtual bool ok() const { return _id.not_empty(); }
|
||||
void reset() { _id.cut(0); }
|
||||
virtual bool ok() const { return _valid; }
|
||||
void reset() { _valid = FALSE; }
|
||||
|
||||
TNode_info() : _plusx(0), _startx(0), _endx(0) { }
|
||||
TNode_info() : _valid(FALSE) { }
|
||||
};
|
||||
|
||||
class TNode_info_array : public TObject
|
||||
@ -759,13 +761,13 @@ TNode_info& TNode_info_array::operator[](int index)
|
||||
void TNode_info_array::reset()
|
||||
{
|
||||
for (int i = _data.last(); i >= 0; i = _data.pred(i))
|
||||
(*this)[i].reset();
|
||||
((TNode_info*)_data.objptr(i))->reset();
|
||||
}
|
||||
|
||||
int TNode_info_array::last() const
|
||||
{
|
||||
for (int i = _data.last(); i >= 0; i = _data.pred(i))
|
||||
if ((*this)[i].ok())
|
||||
if (_data[i].ok())
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
@ -774,7 +776,7 @@ int TNode_info_array::find(const TNode_info& ni) const
|
||||
{
|
||||
for (int i = last(); i >= 0; i = _data.pred(i))
|
||||
{
|
||||
if ((*this)[i] == ni)
|
||||
if (((TNode_info*)_data.objptr(i))->compare(ni) == 0)
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
@ -883,6 +885,7 @@ bool TTree_window::callback_draw_node(TTree& node, void* jolly, word when)
|
||||
|
||||
TNode_info& ni = (*ui->_node_info)[ry];
|
||||
node.curr_id(ni._id);
|
||||
ni._valid = TRUE;
|
||||
ni._startx = ui->_x;
|
||||
ni._endx = ui->_x + text_len + 2;
|
||||
ni._expandable = node.has_son();
|
||||
@ -1035,7 +1038,7 @@ bool TTree_window::index2info(long index, TNode_info& ni)
|
||||
{
|
||||
bool ok = FALSE;
|
||||
const int last = _node_info.last();
|
||||
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
if (index2info(0, ni) && _tree->goto_node(ni._id))
|
||||
@ -1050,18 +1053,25 @@ bool TTree_window::index2info(long index, TNode_info& ni)
|
||||
_tree->curr_id(ni._id);
|
||||
}
|
||||
} else
|
||||
if (index == last+1)
|
||||
if (index == last+1 && last >= 0)
|
||||
{
|
||||
if (index2info(last, ni) && _tree->goto_node(ni._id))
|
||||
{
|
||||
ok = _tree->expanded() && _tree->goto_firstson();
|
||||
if (ok && _hide_leaves && !_tree->has_son())
|
||||
{
|
||||
_tree->goto_node(ni._id); // Ritorno al padre perche' ignoro le foglie
|
||||
ok = FALSE;
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
ok = _tree->goto_rbrother();
|
||||
ni._startx += TABX;
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
_tree->curr_id(ni._id);
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (index >= 0 && index <= last)
|
||||
@ -1099,7 +1109,8 @@ bool TTree_window::on_key(KEY key)
|
||||
}
|
||||
else
|
||||
{
|
||||
ok = index2info(0, ni) && _tree->goto_node(ni._id);
|
||||
const int index = key == K_UP ? 0 : _node_info.last();
|
||||
ok = index2info(index, ni) && _tree->goto_node(ni._id);
|
||||
}
|
||||
|
||||
if (ok && _curr_info != ni)
|
||||
@ -1115,13 +1126,13 @@ bool TTree_window::on_key(KEY key)
|
||||
|
||||
if (key == K_ENTER)
|
||||
{
|
||||
if (_curr_info._expandable && _tree->goto_node(_curr_info._id))
|
||||
if (_tree->goto_node(_curr_info._id))
|
||||
{
|
||||
bool ok;
|
||||
if (_curr_info._expanded)
|
||||
ok = _tree->expand();
|
||||
else
|
||||
if (_tree->expanded())
|
||||
ok = _tree->shrink();
|
||||
else
|
||||
ok = _tree->expand();
|
||||
if (ok)
|
||||
force_update();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user