|
|
|
@ -717,11 +717,11 @@ int TreeMapItemList::compareItems ( Item item1, Item item2 )
|
|
|
|
|
bool ascending;
|
|
|
|
|
int result;
|
|
|
|
|
|
|
|
|
|
TreeMapItem* tqparent = ((TreeMapItem*)item1)->tqparent();
|
|
|
|
|
TreeMapItem* parent = ((TreeMapItem*)item1)->parent();
|
|
|
|
|
// shouldn't happen
|
|
|
|
|
if (!tqparent) return 0;
|
|
|
|
|
if (!parent) return 0;
|
|
|
|
|
|
|
|
|
|
int textNo = tqparent->sorting(&ascending);
|
|
|
|
|
int textNo = parent->sorting(&ascending);
|
|
|
|
|
|
|
|
|
|
if (textNo < 0) {
|
|
|
|
|
double diff = ((TreeMapItem*)item1)->value() -
|
|
|
|
@ -738,22 +738,22 @@ int TreeMapItemList::compareItems ( Item item1, Item item2 )
|
|
|
|
|
|
|
|
|
|
TreeMapItem* TreeMapItemList::commonParent()
|
|
|
|
|
{
|
|
|
|
|
TreeMapItem* tqparent, *item;
|
|
|
|
|
tqparent = first();
|
|
|
|
|
if (tqparent)
|
|
|
|
|
TreeMapItem* parent, *item;
|
|
|
|
|
parent = first();
|
|
|
|
|
if (parent)
|
|
|
|
|
while( (item = next()) != 0)
|
|
|
|
|
tqparent = tqparent->commonParent(item);
|
|
|
|
|
parent = parent->commonParent(item);
|
|
|
|
|
|
|
|
|
|
return tqparent;
|
|
|
|
|
return parent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TreeMapItem
|
|
|
|
|
|
|
|
|
|
TreeMapItem::TreeMapItem(TreeMapItem* tqparent, double value)
|
|
|
|
|
TreeMapItem::TreeMapItem(TreeMapItem* parent, double value)
|
|
|
|
|
{
|
|
|
|
|
_value = value;
|
|
|
|
|
_parent = tqparent;
|
|
|
|
|
_parent = parent;
|
|
|
|
|
|
|
|
|
|
_sum = 0;
|
|
|
|
|
_tqchildren = 0;
|
|
|
|
@ -764,7 +764,7 @@ TreeMapItem::TreeMapItem(TreeMapItem* tqparent, double value)
|
|
|
|
|
_freeRects = 0;
|
|
|
|
|
|
|
|
|
|
if (_parent) {
|
|
|
|
|
// take sorting from tqparent
|
|
|
|
|
// take sorting from parent
|
|
|
|
|
_sortTextNo = _parent->sorting(&_sortAscending);
|
|
|
|
|
_parent->addItem(this);
|
|
|
|
|
}
|
|
|
|
@ -775,12 +775,12 @@ TreeMapItem::TreeMapItem(TreeMapItem* tqparent, double value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TreeMapItem::TreeMapItem(TreeMapItem* tqparent, double value,
|
|
|
|
|
TreeMapItem::TreeMapItem(TreeMapItem* parent, double value,
|
|
|
|
|
TQString text1, TQString text2,
|
|
|
|
|
TQString text3, TQString text4)
|
|
|
|
|
{
|
|
|
|
|
_value = value;
|
|
|
|
|
_parent = tqparent;
|
|
|
|
|
_parent = parent;
|
|
|
|
|
|
|
|
|
|
// this resizes the text vector only if needed
|
|
|
|
|
if (!text4.isEmpty()) setText(3, text4);
|
|
|
|
@ -829,7 +829,7 @@ bool TreeMapItem::isChildOf(TreeMapItem* item)
|
|
|
|
|
TreeMapItem* TreeMapItem::commonParent(TreeMapItem* item)
|
|
|
|
|
{
|
|
|
|
|
while (item && !isChildOf(item)) {
|
|
|
|
|
item = item->tqparent();
|
|
|
|
|
item = item->parent();
|
|
|
|
|
}
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
@ -1103,8 +1103,8 @@ void TreeMapTip::maybeTip( const TQPoint& pos )
|
|
|
|
|
// TreeMapWidget
|
|
|
|
|
|
|
|
|
|
TreeMapWidget::TreeMapWidget(TreeMapItem* base,
|
|
|
|
|
TQWidget* tqparent, const char* name)
|
|
|
|
|
: TQWidget(tqparent, name)
|
|
|
|
|
TQWidget* parent, const char* name)
|
|
|
|
|
: TQWidget(parent, name)
|
|
|
|
|
{
|
|
|
|
|
_base = base;
|
|
|
|
|
_base->setWidget(this);
|
|
|
|
@ -1446,9 +1446,9 @@ void TreeMapWidget::deletingItem(TreeMapItem* i)
|
|
|
|
|
|
|
|
|
|
// don't redraw a deleted item
|
|
|
|
|
if (_needsRefresh == i) {
|
|
|
|
|
// we can savely redraw the tqparent, as deleting order is
|
|
|
|
|
// from child to tqparent; i.e. i->tqparent() is existing.
|
|
|
|
|
_needsRefresh = i->tqparent();
|
|
|
|
|
// we can savely redraw the parent, as deleting order is
|
|
|
|
|
// from child to parent; i.e. i->parent() is existing.
|
|
|
|
|
_needsRefresh = i->parent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1468,7 +1468,7 @@ TQString TreeMapWidget::tipString(TreeMapItem* i) const
|
|
|
|
|
|
|
|
|
|
tip += itemTip;
|
|
|
|
|
}
|
|
|
|
|
i = i->tqparent();
|
|
|
|
|
i = i->parent();
|
|
|
|
|
}
|
|
|
|
|
return tip;
|
|
|
|
|
}
|
|
|
|
@ -1530,7 +1530,7 @@ TreeMapItem* TreeMapWidget::possibleSelection(TreeMapItem* i) const
|
|
|
|
|
if (_maxSelectDepth>=0) {
|
|
|
|
|
int depth = i->depth();
|
|
|
|
|
while(i && depth > _maxSelectDepth) {
|
|
|
|
|
i = i->tqparent();
|
|
|
|
|
i = i->parent();
|
|
|
|
|
depth--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1544,7 +1544,7 @@ TreeMapItem* TreeMapWidget::visibleItem(TreeMapItem* i) const
|
|
|
|
|
/* Must have a visible area */
|
|
|
|
|
while(i && ((i->tqitemRect().width() <1) ||
|
|
|
|
|
(i->tqitemRect().height() <1))) {
|
|
|
|
|
TreeMapItem* p = i->tqparent();
|
|
|
|
|
TreeMapItem* p = i->parent();
|
|
|
|
|
if (!p) break;
|
|
|
|
|
int idx = p->tqchildren()->findRef(i);
|
|
|
|
|
idx--;
|
|
|
|
@ -1644,13 +1644,13 @@ TreeMapItem* TreeMapWidget::setTmpSelected(TreeMapItem* item, bool selected)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool TreeMapWidget::clearSelection(TreeMapItem* tqparent)
|
|
|
|
|
bool TreeMapWidget::clearSelection(TreeMapItem* parent)
|
|
|
|
|
{
|
|
|
|
|
TreeMapItemList old = _selection;
|
|
|
|
|
|
|
|
|
|
TreeMapItem* i=_selection.first();
|
|
|
|
|
while (i) {
|
|
|
|
|
if (i->isChildOf(tqparent)) {
|
|
|
|
|
if (i->isChildOf(parent)) {
|
|
|
|
|
_selection.remove();
|
|
|
|
|
i = _selection.current();
|
|
|
|
|
}
|
|
|
|
@ -1738,11 +1738,11 @@ TreeMapItem* TreeMapWidget::setTmpRangeSelection(TreeMapItem* i1,
|
|
|
|
|
TreeMapItem* commonParent = i1;
|
|
|
|
|
while (commonParent && !i2->isChildOf(commonParent)) {
|
|
|
|
|
i1 = commonParent;
|
|
|
|
|
commonParent = commonParent->tqparent();
|
|
|
|
|
commonParent = commonParent->parent();
|
|
|
|
|
}
|
|
|
|
|
if (!commonParent) return changed;
|
|
|
|
|
while (i2 && i2->tqparent() != commonParent)
|
|
|
|
|
i2 = i2->tqparent();
|
|
|
|
|
while (i2 && i2->parent() != commonParent)
|
|
|
|
|
i2 = i2->parent();
|
|
|
|
|
if (!i2) return changed;
|
|
|
|
|
|
|
|
|
|
TreeMapItemList* list = commonParent->tqchildren();
|
|
|
|
@ -1935,7 +1935,7 @@ void TreeMapWidget::mouseDoubleClickEvent( TQMouseEvent* e )
|
|
|
|
|
/* returns -1 if nothing visible found */
|
|
|
|
|
int nextVisible(TreeMapItem* i)
|
|
|
|
|
{
|
|
|
|
|
TreeMapItem* p = i->tqparent();
|
|
|
|
|
TreeMapItem* p = i->parent();
|
|
|
|
|
if (!p || p->tqitemRect().isEmpty()) return -1;
|
|
|
|
|
|
|
|
|
|
int idx = p->tqchildren()->findRef(i);
|
|
|
|
@ -1953,7 +1953,7 @@ int nextVisible(TreeMapItem* i)
|
|
|
|
|
/* returns -1 if nothing visible found */
|
|
|
|
|
int prevVisible(TreeMapItem* i)
|
|
|
|
|
{
|
|
|
|
|
TreeMapItem* p = i->tqparent();
|
|
|
|
|
TreeMapItem* p = i->parent();
|
|
|
|
|
if (!p || p->tqitemRect().isEmpty()) return -1;
|
|
|
|
|
|
|
|
|
|
int idx = p->tqchildren()->findRef(i);
|
|
|
|
@ -2024,7 +2024,7 @@ void TreeMapWidget::keyPressEvent( TQKeyEvent* e )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TreeMapItem* old = _current, *newItem;
|
|
|
|
|
TreeMapItem* p = _current->tqparent();
|
|
|
|
|
TreeMapItem* p = _current->parent();
|
|
|
|
|
|
|
|
|
|
bool goBack;
|
|
|
|
|
if (_current->sorting(&goBack) == -1) {
|
|
|
|
@ -2184,7 +2184,7 @@ void TreeMapWidget::drawItem(TQPainter* p,
|
|
|
|
|
TreeMapItem* i;
|
|
|
|
|
|
|
|
|
|
if (_markNo>0) {
|
|
|
|
|
for(i = item;i;i=i->tqparent())
|
|
|
|
|
for(i = item;i;i=i->parent())
|
|
|
|
|
if (i->isMarked(_markNo)) break;
|
|
|
|
|
|
|
|
|
|
isSelected = (i!=0);
|
|
|
|
@ -2906,7 +2906,7 @@ void TreeMapWidget::selectionActivated(int id)
|
|
|
|
|
TreeMapItem* i = _menuItem;
|
|
|
|
|
id -= _selectionID;
|
|
|
|
|
while (id>0 && i) {
|
|
|
|
|
i=i->tqparent();
|
|
|
|
|
i=i->parent();
|
|
|
|
|
id--;
|
|
|
|
|
}
|
|
|
|
|
if (i)
|
|
|
|
@ -2928,7 +2928,7 @@ void TreeMapWidget::addSelectionItems(TQPopupMenu* popup,
|
|
|
|
|
TQString name = i->text(0);
|
|
|
|
|
if (name.isEmpty()) break;
|
|
|
|
|
popup->insertItem(i->text(0), id++);
|
|
|
|
|
i = i->tqparent();
|
|
|
|
|
i = i->parent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2939,7 +2939,7 @@ void TreeMapWidget::fieldStopActivated(int id)
|
|
|
|
|
TreeMapItem* i = _menuItem;
|
|
|
|
|
id -= _fieldStopID+1;
|
|
|
|
|
while (id>0 && i) {
|
|
|
|
|
i=i->tqparent();
|
|
|
|
|
i=i->parent();
|
|
|
|
|
id--;
|
|
|
|
|
}
|
|
|
|
|
if (i)
|
|
|
|
@ -2971,7 +2971,7 @@ void TreeMapWidget::addFieldStopItems(TQPopupMenu* popup,
|
|
|
|
|
popup->setItemChecked(id, true);
|
|
|
|
|
foundFieldStop = true;
|
|
|
|
|
}
|
|
|
|
|
i = i->tqparent();
|
|
|
|
|
i = i->parent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|