forked from vdr-projects/vdr-plugin-skinflatplus
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdisplaymenu.h
More file actions
196 lines (154 loc) · 8.69 KB
/
Copy pathdisplaymenu.h
File metadata and controls
196 lines (154 loc) · 8.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
* Skin flatPlus: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#pragma once
#include <vdr/skins.h>
#include <vdr/channels.h>
#include <vdr/epg.h>
#include <vdr/font.h>
#include <vdr/recording.h>
#include <vdr/timers.h>
#include <vdr/tools.h>
#include <string>
#include <vector>
#include "./baserender.h"
#include "./complexcontent.h"
class cFlatDisplayMenu : public cFlatBaseRender, public cSkinDisplayMenu {
public:
#ifdef DEPRECATED_SKIN_SETITEMEVENT
using cSkinDisplayMenu::SetItemEvent;
#endif
cFlatDisplayMenu();
~cFlatDisplayMenu() override;
void Scroll(bool Up, bool Page) override;
int MaxItems() override;
void Clear() override;
void SetMenuCategory(eMenuCategory MenuCategory) override;
// void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0) override;
void SetTitle(const char *Title) override;
void SetButtons(const char *Red, const char *Green = nullptr, const char *Yellow = nullptr,
const char *Blue = nullptr) override;
void SetMessage(eMessageType Type, const char *Text) override;
void SetItem(const char *Text, int Index, bool Current, bool Selectable) override;
bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel,
bool WithDate, eTimerMatch TimerMatch, bool TimerActive) override;
bool SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable) override;
bool SetItemChannel(const cChannel *Channel, int Index, bool Current, bool Selectable, bool WithProvider) override;
bool SetItemRecording(const cRecording *Recording, int Index, bool Current, bool Selectable, int Level, int Total,
int New) override;
void SetMenuSortMode(eMenuSortMode MenuSortMode) override;
void SetScrollbar(int Total, int Offset) override;
void SetEvent(const cEvent *Event) override;
void SetRecording(const cRecording *Recording) override;
void SetText(const char *Text, bool FixedFont) override;
int GetTextAreaWidth() const override;
const cFont *GetTextAreaFont(bool FixedFont) const override;
void Flush() override;
void PreLoadImages();
private:
cPixmap *MenuPixmap {nullptr};
cPixmap *MenuIconsPixmap {nullptr};
cPixmap *MenuIconsBgPixmap {nullptr}; // Background for icons/logos
cPixmap *MenuIconsOvlPixmap {nullptr}; // Overlay for icons/logos
int m_MenuTop {0}, m_MenuWidth {0};
int m_MenuItemWidth {0};
int m_MenuItemLastHeight {0};
bool m_MenuFullOsdIsDrawn {false};
eMenuCategory m_MenuCategory {mcUndefined};
const cRecording *m_Recording {nullptr}; // Current recording
const cEvent *m_Event {nullptr}; // Current event
uint16_t m_LastTimerActiveCount {0}, m_LastTimerCount {0};
cString m_LastTitle {""};
cString m_RecCounts {""}; // Number of recordings and new recordings (35*/53)
int m_chLeft {0}, m_chTop {0}, m_chWidth {0}, m_chHeight {0}; // Content head
cPixmap *ContentHeadPixmap {nullptr};
cPixmap *ContentHeadIconsPixmap {nullptr};
int m_cLeft {0}, m_cTop {0}, m_cWidth {0}, m_cHeight {0}; // Content
cPixmap *ScrollbarPixmap {nullptr};
int m_ScrollBarTop {0}, m_ScrollBarHeight {0};
int m_WidthScrollBar {0}; //* 'm_WidthScrollBar' to avoid nameconflict with cFlatBaseRender::m_ScrollBarWidth
int m_ItemHeight {0}, m_ItemChannelHeight {0}, m_ItemTimerHeight {0};
int m_ItemEventHeight {0}, m_ItemRecordingHeight {0};
std::vector<sDecorBorder> ItemsBorder;
// sDecorBorder EventBorder, RecordingBorder, TextBorder;
bool m_IsScrolling {false};
// bool m_IsGroup {false};
bool m_ShowEvent {false};
bool m_ShowRecording {false};
bool m_ShowText {false};
bool m_RecordingInfoDrawn {false};
bool m_EventInfoDrawn {false};
cComplexContent ComplexContent;
// Content for Widgets
cComplexContent ContentWidget;
// TextScroller
cTextScrollers MenuItemScroller;
cString m_ItemEventLastChannelName {""};
cString m_RecFolder {""};
int m_LastItemRecordingLevel {-1};
void ItemBorderInsertUnique(const sDecorBorder &ib);
void ItemBorderDrawAllWithScrollbar();
void ItemBorderDrawAllWithoutScrollbar();
void ItemBorderClear();
cString MainMenuText(const cString &Text) const;
cString GetIconName(const cString &element) const;
cString GetMenuIconName() const;
cString GetRecordingName(const cRecording *Recording, int Level) const;
cString GetRecCounts() const; // Get number of recordings and new recordings (35*/53)
void UpdateTimerCounts(uint16_t &TimerActiveCount, uint16_t &TimerCount) const; // NOLINT
bool IsRecordingOld(const cRecording *Recording, int Level) const;
const char *GetGenreIcon(uchar genre) const;
void InsertGenreInfo(const cEvent *Event, cString &Text) const; // NOLINT
void InsertGenreInfo(const cEvent *Event, cString &Text, std::vector<std::string> &GenreIcons) const; // NOLINT
void InsertTSErrors(const cRecordingInfo *RecInfo, cString &Text) const; // NOLINT
int AddExtraInfo(const char *Title, const cString &Text, cComplexContent &ComplexContent, // NOLINT
bool IsEvent = false); // NOLINT
time_t GetLastRecTimeFromFolder(const cRecording *Recording, int Level) const;
void DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown,
bool IsContent = false);
int ItemsHeight();
bool CheckProgressBar(const char *text) const;
void DrawProgressBarFromText(const cRect &rec, const cRect &recBg, const char *bar, tColor ColorFg,
tColor ColorBarFg, tColor ColorBg);
void DrawItemExtraEvent(const cEvent *Event, const cString EmptyText);
void DrawItemExtraRecording(const cRecording *Recording, const cString EmptyText);
void AddActors(cComplexContent &ComplexContent, std::vector<sActor> &Actors, int NumActors, // NOLINT
bool IsEvent = false); // Add Actors to complexcontent
void DrawEventInfo(const cEvent *Event);
void DrawRecordingInfo(const cRecording *Recording);
void DrawRecordingStateIcon(const cRecording *Recording, int Left, int Top, bool Current);
void DrawRecordingFormatIcon(const cRecording *Recording, int Left, int Top);
void DrawRecordingErrorIcon(const cRecording *Recording, int Left, int Top, bool Current);
int DrawRecordingIcon(const char *IconName, int Left, int Top, bool Current, bool Small = false); // NOLINT
int DrawContentHeadFskGenre(const cString &Fsk, std::vector<std::string> &GenreIcons); // NOLINT
void DrawMainMenuWidgets();
int DrawMainMenuWidgetDVBDevices(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
int DrawMainMenuWidgetActiveTimers(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
int DrawMainMenuWidgetLastRecordings(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
int DrawMainMenuWidgetTimerConflicts(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
int DrawMainMenuWidgetSystemInformation(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
int DrawMainMenuWidgetSystemUpdates(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
int DrawMainMenuWidgetTemperatures(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
int DrawMainMenuWidgetCommand(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
int DrawMainMenuWidgetWeather(int wLeft, int wWidth, int ContentTop, int MenuPixmapViewPortHeight);
// Helper functions
// Add Text to ComplexContent in SetText()
void ComplexContentAddText(const char *Text, bool FixedFont, int Width, int Height) {
if (FixedFont) {
ComplexContent.AddText(Text, true,
cRect(m_MarginItem, m_MarginItem, Width - m_MarginItem2, Height - m_MarginItem2),
Theme.Color(clrMenuTextFixedFont), Theme.Color(clrMenuTextBg), m_FontFixed);
ComplexContent.SetScrollSize(m_FontFixedHeight);
} else {
ComplexContent.AddText(Text, true,
cRect(m_MarginItem, m_MarginItem, Width - m_MarginItem2, Height - m_MarginItem2),
Theme.Color(clrMenuTextFixedFont), Theme.Color(clrMenuTextBg), m_Font);
ComplexContent.SetScrollSize(m_FontHeight);
}
}
int AddWidgetHeader(const char *Icon, const char *Title, int ContentTop, int wWidth);
};