summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-08-08 11:04:15 +0200
committerlouis <louis.braun@gmx.de>2015-08-08 11:04:15 +0200
commitea758f955655ee48b0c3b0f277c21e8cbc045316 (patch)
tree1326c86deede899b6d8394c611a09831ff1858fe /views
parentb5c587b2567e4ac838a33363d02ad228d94b9b14 (diff)
downloadvdr-plugin-skindesigner-ea758f955655ee48b0c3b0f277c21e8cbc045316.tar.gz
vdr-plugin-skindesigner-ea758f955655ee48b0c3b0f277c21e8cbc045316.tar.bz2
implemented horizontal menus
Diffstat (limited to 'views')
-rw-r--r--views/displaymenulistview.c9
-rw-r--r--views/displaymenulistview.h1
-rw-r--r--views/displaymenurootview.c7
-rw-r--r--views/displaymenurootview.h1
-rw-r--r--views/displaymenuview.c2
-rw-r--r--views/view.c17
6 files changed, 33 insertions, 4 deletions
diff --git a/views/displaymenulistview.c b/views/displaymenulistview.c
index 29927b2..b96bdc2 100644
--- a/views/displaymenulistview.c
+++ b/views/displaymenulistview.c
@@ -81,6 +81,15 @@ int cDisplayMenuListView::GetListWidth(void) {
return 1920;
}
+eMenuOrientation cDisplayMenuListView::MenuOrientation(void) {
+ if (!tmplList) {
+ return moVertical;
+ }
+ eOrientation orientation = tmplList->GetOrientation();
+ if (orientation == orHorizontal)
+ return moHorizontal;
+ return moVertical;
+}
void cDisplayMenuListView::Clear(void) {
for (int i=0; i<itemCount; i++) {
diff --git a/views/displaymenulistview.h b/views/displaymenulistview.h
index c7aba12..3acba56 100644
--- a/views/displaymenulistview.h
+++ b/views/displaymenulistview.h
@@ -26,6 +26,7 @@ public:
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
int GetMaxItems(void) { return itemCount; };
int GetListWidth(void);
+ eMenuOrientation MenuOrientation(void);
void AddDefaultMenuItem(int index, string *tabTexts, bool current, bool selectable);
string AddMainMenuItem(int index, const char *itemText, bool current, bool selectable);
void AddSetupMenuItem(int index, const char *itemText, bool current, bool selectable);
diff --git a/views/displaymenurootview.c b/views/displaymenurootview.c
index bf3981f..2d4e457 100644
--- a/views/displaymenurootview.c
+++ b/views/displaymenurootview.c
@@ -226,6 +226,13 @@ void cDisplayMenuRootView::SetSortMode(eMenuSortMode sortMode) {
view->SetSortMode(sortMode);
}
+eMenuOrientation cDisplayMenuRootView::MenuOrientation(void) {
+ if (!listView) {
+ return moVertical;
+ }
+ return listView->MenuOrientation();
+}
+
void cDisplayMenuRootView::CorrectDefaultMenu(void) {
if (viewType > svMenuDefault && viewType != svMenuPlugin) {
SetMenu(mcUnknown, true);
diff --git a/views/displaymenurootview.h b/views/displaymenurootview.h
index cec7708..294b6ee 100644
--- a/views/displaymenurootview.h
+++ b/views/displaymenurootview.h
@@ -55,6 +55,7 @@ public:
void SetMenu(eMenuCategory menuCat, bool menuInit);
void SetSelectedPluginMainMenu(string name) { selectedPluginMainMenu = name; };
void SetSortMode(eMenuSortMode sortMode);
+ eMenuOrientation MenuOrientation(void);
void SetCurrentRecording(string rec) { currentRecording = rec; };
void CorrectDefaultMenu(void);
void SetPluginMenu(string name, int menu, int type);
diff --git a/views/displaymenuview.c b/views/displaymenuview.c
index 9f732e2..53ab558 100644
--- a/views/displaymenuview.c
+++ b/views/displaymenuview.c
@@ -221,6 +221,8 @@ void cDisplayMenuView::DrawScrollbar(int numMax, int numDisplayed, int offset) {
intTokens.insert(pair<string, int>("height", barHeight));
intTokens.insert(pair<string, int>("offset", barOffset));
+ intTokens.insert(pair<string, int>("hasprev", (offset == 0) ? 0 : 1));
+ intTokens.insert(pair<string, int>("hasnext", (offset + numMax == numDisplayed) ? 0 : 1));
ClearViewElement(veScrollbar);
DrawViewElement(veScrollbar, &stringTokens, &intTokens);
diff --git a/views/view.c b/views/view.c
index ad1635c..c2cfea9 100644
--- a/views/view.c
+++ b/views/view.c
@@ -284,7 +284,6 @@ void cView::DestroyDetachedViewElement(eViewElement ve) {
detachedViewElements.erase(hit);
}
-
void cView::ClearAnimations(int cat) {
//stop and delete all animated elements from this viewelement
if (animations.size() == 0)
@@ -746,6 +745,7 @@ void cView::DoDrawTextBox(int num, cTemplateFunction *func, int x0, int y0) {
string fontName = func->GetFontName();
int fontSize = func->GetNumericParameter(ptFontSize);
int align = func->GetNumericParameter(ptAlign);
+ int valign = func->GetNumericParameter(ptValign);
int maxLines = func->GetNumericParameter(ptMaxLines);
tColor clr = func->GetColorParameter(ptColor);
tColor clrBack = clrTransparent;
@@ -759,6 +759,14 @@ void cView::DoDrawTextBox(int num, cTemplateFunction *func, int x0, int y0) {
int fontHeight = fontManager->Height(fontName, fontSize);
int lines = wrapper.Lines();
int yLine = y;
+
+ if (height > 0 && valign == alCenter) {
+ int totalHeight = lines * fontHeight;
+ if (totalHeight < height) {
+ yLine += (height - totalHeight) / 2;
+ }
+ }
+
for (int line=0; line < lines; line++) {
int xLine = x;
if (align == alCenter) {
@@ -771,15 +779,16 @@ void cView::DoDrawTextBox(int num, cTemplateFunction *func, int x0, int y0) {
cPoint pos(xLine, yLine);
if (maxLines > 0 && line == maxLines-1) {
string lastLine = wrapper.GetLine(line);
- if (lines > maxLines) {
+ if (lines > maxLines) {
lastLine += "...";
}
- DrawText(num, pos, lastLine.c_str(), clr, clrBack, fontName, fontSize);
+ DrawText(num, pos, lastLine.c_str(), clr, clrBack, fontName, fontSize);
break;
- } else if (height > 0 && yLine - y + 2*fontHeight > height) {
+ } else if (line != (lines-1) && height > 0 && yLine - y + 2*fontHeight > height) {
DrawText(num, pos, "...", clr, clrBack, fontName, fontSize);
break;
}
+ esyslog("skindesigner: drawing regular line yLine %d", yLine);
DrawText(num, pos, wrapper.GetLine(line), clr, clrBack, fontName, fontSize);
yLine += fontHeight;
}