summaryrefslogtreecommitdiff
path: root/src/gui/preview
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/preview')
-rw-r--r--src/gui/preview/PreviewController.cpp12
-rw-r--r--src/gui/preview/PreviewController.h4
-rw-r--r--src/gui/preview/PreviewView.cpp19
-rw-r--r--src/gui/preview/PreviewView.h1
4 files changed, 27 insertions, 9 deletions
diff --git a/src/gui/preview/PreviewController.cpp b/src/gui/preview/PreviewController.cpp
index 3e6dd38..3a7961a 100644
--- a/src/gui/preview/PreviewController.cpp
+++ b/src/gui/preview/PreviewController.cpp
@@ -162,16 +162,24 @@ void PreviewController::OpenInBrowser()
OpenURI(uriStream.str());
}
-void PreviewController::NextCommentPage()
+bool PreviewController::NextCommentPage()
{
if(previewModel->GetCommentsPageNum() < previewModel->GetCommentsPageCount() && previewModel->GetCommentsLoaded())
+ {
previewModel->UpdateComments(previewModel->GetCommentsPageNum()+1);
+ return true;
+ }
+ return false;
}
-void PreviewController::PrevCommentPage()
+bool PreviewController::PrevCommentPage()
{
if(previewModel->GetCommentsPageNum()>1 && previewModel->GetCommentsLoaded())
+ {
previewModel->UpdateComments(previewModel->GetCommentsPageNum()-1);
+ return true;
+ }
+ return false;
}
void PreviewController::Exit()
diff --git a/src/gui/preview/PreviewController.h b/src/gui/preview/PreviewController.h
index e1e429d..c5a4306 100644
--- a/src/gui/preview/PreviewController.h
+++ b/src/gui/preview/PreviewController.h
@@ -36,8 +36,8 @@ public:
void FavouriteSave();
bool SubmitComment(std::string comment);
- void NextCommentPage();
- void PrevCommentPage();
+ bool NextCommentPage();
+ bool PrevCommentPage();
virtual ~PreviewController();
};
diff --git a/src/gui/preview/PreviewView.cpp b/src/gui/preview/PreviewView.cpp
index 590798e..de17531 100644
--- a/src/gui/preview/PreviewView.cpp
+++ b/src/gui/preview/PreviewView.cpp
@@ -376,12 +376,23 @@ void PreviewView::OnMouseWheel(int x, int y, int d)
c->NextCommentPage();
if(commentsPanel->GetScrollLimit() == -1 && d > 0)
{
- prevPage = true;
- c->PrevCommentPage();
+ if (c->PrevCommentPage())
+ prevPage = true;
}
}
+void PreviewView::OnMouseUp(int x, int y, unsigned int button)
+{
+ if(commentsPanel->GetScrollLimit() == 1)
+ c->NextCommentPage();
+ if(commentsPanel->GetScrollLimit() == -1)
+ {
+ if (c->PrevCommentPage())
+ prevPage = true;
+ }
+}
+
void PreviewView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
if ((key == KEY_ENTER || key == KEY_RETURN) && (!addCommentBox || !addCommentBox->IsFocused()))
@@ -558,7 +569,7 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
}
if(showAvatars)
- tempUsername = new ui::Label(ui::Point(31, currentY+3), ui::Point(Size.X-((XRES/2) + 13), 16), comments->at(i)->authorNameFormatted);
+ tempUsername = new ui::Label(ui::Point(31, currentY+3), ui::Point(Size.X-((XRES/2) + 13 + 26), 16), comments->at(i)->authorNameFormatted);
else
tempUsername = new ui::Label(ui::Point(5, currentY+3), ui::Point(Size.X-((XRES/2) + 13), 16), comments->at(i)->authorNameFormatted);
tempUsername->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
@@ -593,8 +604,6 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
{
prevPage = false;
commentsPanel->SetScrollPosition(currentY);
- //update positions of the comments so that it doesn't start at the top for a frame
- commentsPanel->Tick(0);
}
}
}
diff --git a/src/gui/preview/PreviewView.h b/src/gui/preview/PreviewView.h
index 9ddbb71..9975afc 100644
--- a/src/gui/preview/PreviewView.h
+++ b/src/gui/preview/PreviewView.h
@@ -72,6 +72,7 @@ public:
virtual void OnTick(float dt);
virtual void OnTryExit(ExitMethod method);
virtual void OnMouseWheel(int x, int y, int d);
+ virtual void OnMouseUp(int x, int y, unsigned int button);
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
virtual ~PreviewView();
};