summaryrefslogtreecommitdiff
path: root/src/preview/PreviewView.cpp
diff options
context:
space:
mode:
authorBryan Hoyle <starfoxprime@gmail.com>2012-06-22 16:00:17 (GMT)
committer Bryan Hoyle <starfoxprime@gmail.com>2012-06-22 16:00:17 (GMT)
commit6fa05d1930964d0a09093c627b30241d73c69dda (patch)
treeb2d9856f5f0c26529de8eff8fc8b8f39cb234b64 /src/preview/PreviewView.cpp
parent58f3494f6fce58729e6e3fe91e1234a9bd636d55 (diff)
parent55d90a44a8425f70b08d864570e255f4bad8ba4c (diff)
downloadpowder-6fa05d1930964d0a09093c627b30241d73c69dda.zip
powder-6fa05d1930964d0a09093c627b30241d73c69dda.tar.gz
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/preview/PreviewView.cpp')
-rw-r--r--src/preview/PreviewView.cpp44
1 files changed, 37 insertions, 7 deletions
diff --git a/src/preview/PreviewView.cpp b/src/preview/PreviewView.cpp
index cc49f91..69229f0 100644
--- a/src/preview/PreviewView.cpp
+++ b/src/preview/PreviewView.cpp
@@ -21,7 +21,9 @@ PreviewView::PreviewView():
doOpen(false),
commentsOffset(0),
commentsVel(0),
- maxOffset(0)
+ maxOffset(0),
+ commentsBegin(true),
+ commentsEnd(false)
{
class OpenAction: public ui::ButtonAction
{
@@ -112,6 +114,10 @@ PreviewView::PreviewView():
authorDateLabel = new ui::Label(ui::Point(5, (YRES/2)+15+14), ui::Point(100, 16), "");
authorDateLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; authorDateLabel->Appearance.VerticalAlign = ui::Appearance::AlignBottom;
AddComponent(authorDateLabel);
+
+ pageInfo = new ui::Label(ui::Point((XRES/2) + 5, Size.Y-15), ui::Point(Size.X-((XRES/2) + 10), 15), "Page 1 of 1");
+ pageInfo->Appearance.HorizontalAlign = ui::Appearance::AlignCentre; authorDateLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
+ AddComponent(pageInfo);
}
void PreviewView::DoDraw()
@@ -185,12 +191,22 @@ void PreviewView::OnTick(float dt)
{
commentsOffset = 0;
commentsVel = 0;
+ commentsBegin = true;
+ commentsEnd = false;
}
- if(commentsOffset>maxOffset)
+ else if(commentsOffset>maxOffset)
{
commentsOffset = maxOffset;
commentsVel = 0;
+ commentsEnd = true;
+ commentsBegin = false;
+ }
+ else
+ {
+ commentsEnd = false;
+ commentsBegin = false;
}
+
displayComments(commentsOffset);
}
@@ -303,6 +319,13 @@ void PreviewView::displayComments(int yOffset)
}
}
+void PreviewView::NotifyCommentsPageChanged(PreviewModel * sender)
+{
+ std::stringstream pageInfoStream;
+ pageInfoStream << "Page " << sender->GetCommentsPageNum() << " of " << sender->GetCommentsPageCount();
+ pageInfo->SetText(pageInfoStream.str());
+}
+
void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
{
if(sender->GetComments())
@@ -335,6 +358,8 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
maxOffset = (maxY-Size.Y)+16;
+ commentsBegin = true;
+ commentsEnd = false;
commentsOffset = 0;
commentsVel = 0;
displayComments(commentsOffset);
@@ -342,13 +367,18 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
void PreviewView::OnMouseWheel(int x, int y, int d)
{
- commentsVel-=d;
- /*if(!d)
+ if(!d)
return;
+ commentsVel-=d;
+
if(d<0)
- c->NextPage();
- else
- c->PrevPage();*/
+ {
+ if(commentsEnd)
+ c->NextCommentPage();
+ } else {
+ if(commentsBegin)
+ c->PrevCommentPage();
+ }
}
/*void PreviewView::NotifyPreviewChanged(PreviewModel * sender)