[dasher] Rename IsNodeVisible to IsSpaceAroundNode, and make it's meaning consistent!
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] Rename IsNodeVisible to IsSpaceAroundNode, and make it's meaning consistent!
- Date: Wed, 9 Jun 2010 12:50:21 +0000 (UTC)
commit c4a51bd43a54ab835b401e88dcd1bc5fa55c1fde
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Tue Jun 1 17:38:16 2010 +0100
Rename IsNodeVisible to IsSpaceAroundNode, and make it's meaning consistent!
Src/DasherCore/DasherModel.cpp | 5 ++++-
Src/DasherCore/DasherView.h | 2 +-
Src/DasherCore/DasherViewSquare.cpp | 7 +++----
Src/DasherCore/DasherViewSquare.h | 5 +++--
4 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index 0dc3a75..5430cb8 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -306,8 +306,11 @@ void CDasherModel::InitialiseAtOffset(int iOffset, CDasherView *pView) {
m_iDisplayOffset = 0;
//now (re)create parents, while they show on the screen
+ // - if we were lazy, we could leave this to NewFrame,
+ // and one node around the root would be recreated per frame,
+ // but we'll do it properly here.
if(pView) {
- while(pView->IsNodeVisible(m_Rootmin,m_Rootmax)) {
+ while(pView->IsSpaceAroundNode(m_Rootmin,m_Rootmax)) {
CDasherNode *pOldRoot = m_Root;
Reparent_root();
if(m_Root == pOldRoot)
diff --git a/Src/DasherCore/DasherView.h b/Src/DasherCore/DasherView.h
index 28416f7..9ef110a 100644
--- a/Src/DasherCore/DasherView.h
+++ b/Src/DasherCore/DasherView.h
@@ -104,7 +104,7 @@ public:
///
virtual void Dasher2Polar(myint iDasherX, myint iDasherY, double &r, double &theta) = 0;
- virtual bool IsNodeVisible(myint y1, myint y2) { return true; };
+ virtual bool IsSpaceAroundNode(myint y1, myint y2)=0;
virtual void VisibleRegion( myint &iDasherMinX, myint &iDasherMinY, myint &iDasherMaxX, myint &iDasherMaxY ) = 0;
diff --git a/Src/DasherCore/DasherViewSquare.cpp b/Src/DasherCore/DasherViewSquare.cpp
index 9ae0fce..966ad52 100644
--- a/Src/DasherCore/DasherViewSquare.cpp
+++ b/Src/DasherCore/DasherViewSquare.cpp
@@ -372,8 +372,7 @@ void CDasherViewSquare::RecursiveRender(CDasherNode *pRender, myint y1, myint y2
DasherDrawText(y2-y1, y1, y2-y1, y2, sDisplayText, mostleft, pRender->GetDisplayInfo()->bShove);
}
-
- pRender->SetFlag(NF_SUPER, (y1 < iDasherMinY) && (y2 > iDasherMaxY) && ((y2 - y1) > iDasherMaxX));
+ pRender->SetFlag(NF_SUPER, !IsSpaceAroundNode(y1,y2));
// If there are no children then we still need to render the parent
if(pRender->ChildCount() == 0) {
@@ -479,7 +478,7 @@ void CDasherViewSquare::RecursiveRender(CDasherNode *pRender, myint y1, myint y2
// }
}
-bool CDasherViewSquare::IsNodeVisible(myint y1, myint y2) {
+bool CDasherViewSquare::IsSpaceAroundNode(myint y1, myint y2) {
myint iDasherMinX;
myint iDasherMinY;
myint iDasherMaxX;
@@ -487,7 +486,7 @@ bool CDasherViewSquare::IsNodeVisible(myint y1, myint y2) {
VisibleRegion(iDasherMinX, iDasherMinY, iDasherMaxX, iDasherMaxY);
- return ((y2 - y1) < iDasherMaxX) || ((y1 > iDasherMinY) && (y2 < iDasherMaxY));
+ return ((y2 - y1) < iDasherMaxX) || (y1 > iDasherMinY) || (y2 < iDasherMaxY);
}
// Draw the outline of a node
diff --git a/Src/DasherCore/DasherViewSquare.h b/Src/DasherCore/DasherViewSquare.h
index 79140ad..433c477 100644
--- a/Src/DasherCore/DasherViewSquare.h
+++ b/Src/DasherCore/DasherViewSquare.h
@@ -86,10 +86,11 @@ public:
virtual void Dasher2Polar(myint iDasherX, myint iDasherY, double &r, double &theta);
///
- /// Return true if a node spanning y1 to y2 is entirely enclosed by
+ /// Return true if there is any space around a node spanning y1 to y2
+ /// and the screen boundary; return false if such a node entirely encloses
/// the screen boundary
///
- bool IsNodeVisible(myint y1, myint y2);
+ bool IsSpaceAroundNode(myint y1, myint y2);
///
/// Get the bounding box of the visible region.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]