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