vdr-plugin-skindesigner/displaymenu.c

184 lines
4.8 KiB
C
Raw Permalink Normal View History

2014-09-27 09:25:14 +02:00
#include "displaymenu.h"
2016-01-26 18:32:38 +01:00
cSDDisplayMenu::cSDDisplayMenu(cViewMenu *menuView) {
view = menuView;
bool ok = false;
if (view)
ok = view->Init();
if (ok) {
SetCurrentRecording();
} else {
esyslog("skindesigner: Error initiating displaymenu view - aborting");
2014-09-27 09:25:14 +02:00
}
}
cSDDisplayMenu::~cSDDisplayMenu() {
2016-01-26 18:32:38 +01:00
if (view)
view->Close();
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::Scroll(bool Up, bool Page) {
2016-01-26 18:32:38 +01:00
if (view)
view->KeyDetailView(Up, Page);
2014-09-27 09:25:14 +02:00
}
int cSDDisplayMenu::MaxItems(void) {
2016-01-26 18:32:38 +01:00
if (view)
return view->NumListItems();
return 0;
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::Clear(void) {
2016-01-26 18:32:38 +01:00
if (view)
view->Clear();
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetMenuCategory(eMenuCategory MenuCat) {
2016-01-26 18:32:38 +01:00
if (view)
view->SetSubView(MenuCat);
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetMenuSortMode(eMenuSortMode MenuSortMode) {
2016-01-26 18:32:38 +01:00
if (view)
view->SetSortMode(MenuSortMode);
}
2015-08-08 11:04:15 +02:00
eMenuOrientation cSDDisplayMenu::MenuOrientation(void) {
2016-01-26 18:32:38 +01:00
if (view)
return view->MenuOrientation();
return moVertical;
2015-08-08 11:04:15 +02:00
}
2016-01-26 18:32:38 +01:00
void cSDDisplayMenu::SetPluginMenu(int plugId, int menuId, int type, bool init) {
if (view)
view->SetPluginMenu(plugId, menuId);
2014-11-15 09:47:22 +01:00
}
2014-09-27 09:25:14 +02:00
void cSDDisplayMenu::SetTitle(const char *Title) {
2016-01-26 18:32:38 +01:00
if (view)
view->SetTitleHeader(Title);
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue) {
2016-01-26 18:32:38 +01:00
if (view)
view->SetMenuButtons(Red, Green, Yellow, Blue);
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetMessage(eMessageType Type, const char *Text) {
2016-01-26 18:32:38 +01:00
if (view)
view->SetMessage(Type, Text);
2014-09-27 09:25:14 +02:00
}
bool cSDDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch) {
2016-01-26 18:32:38 +01:00
if (!view)
2014-09-27 09:25:14 +02:00
return false;
2016-01-26 18:32:38 +01:00
if (Index == 0) {
view->SetChannelHeader(Event);
2014-09-27 09:25:14 +02:00
}
2016-01-26 18:32:38 +01:00
return view->SetItemEvent(Event, Index, Current, Selectable, Channel, WithDate, TimerMatch);
2014-09-27 09:25:14 +02:00
}
bool cSDDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable) {
2016-01-26 18:32:38 +01:00
if (!view)
2014-09-27 09:25:14 +02:00
return false;
2016-01-26 18:32:38 +01:00
return view->SetItemTimer(Timer, Index, Current, Selectable);
2014-09-27 09:25:14 +02:00
}
bool cSDDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool Current, bool Selectable, bool WithProvider) {
2016-01-26 18:32:38 +01:00
if (!view)
2014-09-27 09:25:14 +02:00
return false;
2016-01-26 18:32:38 +01:00
return view->SetItemChannel(Channel, Index, Current, Selectable, WithProvider);
2014-09-27 09:25:14 +02:00
}
bool cSDDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, bool Current, bool Selectable, int Level, int Total, int New) {
2016-01-26 18:32:38 +01:00
if (!view)
2014-09-27 09:25:14 +02:00
return false;
2016-01-26 18:32:38 +01:00
return view->SetItemRecording(Recording, Index, Current, Selectable, Level, Total, New);
2014-11-15 09:47:22 +01:00
}
2014-09-27 09:25:14 +02:00
void cSDDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable) {
2016-01-26 18:32:38 +01:00
if (!view)
2014-09-27 09:25:14 +02:00
return;
2016-01-26 18:32:38 +01:00
view->SetItem(Text, Index, Current, Selectable);
SetEditableWidth(view->GetListWidth() / 2);
}
bool cSDDisplayMenu::SetItemPlugin(skindesignerapi::cTokenContainer *tk, int Index, bool Current, bool Selectable) {
if (!view)
return false;
bool ok = view->SetItemPlugin(tk, Index, Current, Selectable);
return ok;
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5) {
2016-01-26 18:32:38 +01:00
if (view)
view->SetTabs(Tab1, Tab2, Tab3, Tab4, Tab5);
2014-09-27 09:25:14 +02:00
}
int cSDDisplayMenu::GetTextAreaWidth(void) const {
2016-01-26 18:32:38 +01:00
if (view)
return view->GetTextAreaWidth();
return 0;
2014-09-27 09:25:14 +02:00
}
const cFont *cSDDisplayMenu::GetTextAreaFont(bool FixedFont) const {
2016-01-26 18:32:38 +01:00
if (view)
return view->GetTextAreaFont();
return NULL;
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetScrollbar(int Total, int Offset) {
2016-01-26 18:32:38 +01:00
if (view)
view->SetScrollbar(Total, Offset);
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetEvent(const cEvent *Event) {
2016-04-30 06:49:30 +02:00
if (view) {
if (view->MenuCat() != mcEvent)
view->SetSubView(mcEvent);
2016-01-26 18:32:38 +01:00
view->SetEvent(Event);
2016-04-30 06:49:30 +02:00
}
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetRecording(const cRecording *Recording) {
2016-04-30 06:49:30 +02:00
if (view) {
if (view->MenuCat() != mcRecordingInfo)
view->SetSubView(mcRecordingInfo);
2016-01-26 18:32:38 +01:00
view->SetRecording(Recording);
2016-04-30 06:49:30 +02:00
}
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetText(const char *Text, bool FixedFont) {
2016-04-30 06:49:30 +02:00
if (view) {
if (view->MenuCat() != mcText)
view->SetSubView(mcText);
2016-01-26 18:32:38 +01:00
view->SetText(Text);
2016-04-30 06:49:30 +02:00
}
2014-09-27 09:25:14 +02:00
}
2016-01-26 18:32:38 +01:00
bool cSDDisplayMenu::SetPluginText(skindesignerapi::cTokenContainer *tk) {
bool ok = false;
if (view)
ok = view->SetPluginText(tk);
return ok;
2014-11-15 09:47:22 +01:00
}
2014-09-27 09:25:14 +02:00
void cSDDisplayMenu::Flush(void) {
2016-01-26 18:32:38 +01:00
if (view)
2016-07-22 15:21:09 +02:00
view->Flush();
2014-09-27 09:25:14 +02:00
}
void cSDDisplayMenu::SetCurrentRecording(void) {
cControl *control = cControl::Control();
if (!control) {
2016-01-26 18:32:38 +01:00
view->SetCurrentRecording(NULL);
return;
}
const cRecording *recording = control->GetRecording();
if (!recording) {
2016-01-26 18:32:38 +01:00
view->SetCurrentRecording(NULL);
return;
}
2016-01-26 18:32:38 +01:00
view->SetCurrentRecording(recording->FileName());
2016-07-22 15:21:09 +02:00
}