Corretto disegno alberi

git-svn-id: svn://10.65.10.50/trunk@6158 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-02-10 09:25:41 +00:00
parent 35ed35349b
commit c3401d2370

View File

@ -800,10 +800,12 @@ struct TUpdate_info
const int TABX = 3; const int TABX = 3;
bool TTree_window::callback_draw_node(TTree& node, void* jolly, word) bool TTree_window::callback_draw_node(TTree& node, void* jolly, word when)
{ {
TUpdate_info* ui = (TUpdate_info*)jolly; TUpdate_info* ui = (TUpdate_info*)jolly;
if (when == SCAN_PRE_ORDER)
{
if (ui->_y >= ui->_firsty && ui->_y < ui->_lasty) if (ui->_y >= ui->_firsty && ui->_y < ui->_lasty)
{ {
node.curr_id(ui->_str); node.curr_id(ui->_str);
@ -858,15 +860,12 @@ bool TTree_window::callback_draw_node(TTree& node, void* jolly, word)
} }
ui->_y++; ui->_y++;
if (node.expanded())
{
ui->_x += TABX; ui->_x += TABX;
if (ui->_x > ui->_jolly) if (ui->_x > ui->_jolly)
ui->_jolly = ui->_x; ui->_jolly = ui->_x;
} } else
else if (when == SCAN_IN_ORDER)
{ {
if (!node.has_rbrother())
ui->_x -= TABX; ui->_x -= TABX;
} }
@ -947,13 +946,16 @@ void TTree_window::update()
} }
_node_info.reset(); _node_info.reset();
_tree->scan_depth_first(callback_draw_node, &ui, SCAN_IGNORING_UNEXPANDED);
const word flags = SCAN_IGNORING_UNEXPANDED | SCAN_PRE_ORDER | SCAN_IN_ORDER;
_tree->scan_depth_first(callback_draw_node, &ui, flags);
while (ui._y < ui._lasty) while (ui._y < ui._lasty)
{ {
if (_tree->goto_father()) if (_tree->goto_father())
{ {
ui._x -= TABX;
if (_tree->goto_rbrother()) if (_tree->goto_rbrother())
_tree->scan_depth_first(callback_draw_node, &ui, SCAN_IGNORING_UNEXPANDED); _tree->scan_depth_first(callback_draw_node, &ui, flags);
} }
else else
break; break;