mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
implemented shiftout for views
This commit is contained in:
parent
e9ab094e96
commit
01b09d7424
3
HISTORY
3
HISTORY
@ -319,4 +319,5 @@ Version 0.4.5
|
|||||||
- fixed bug that scrapercontent in displaychannel was not
|
- fixed bug that scrapercontent in displaychannel was not
|
||||||
updated if detached
|
updated if detached
|
||||||
- fixed bug that detached viewelements were not cleared
|
- fixed bug that detached viewelements were not cleared
|
||||||
correctly
|
correctly
|
||||||
|
- implemented shiftout for views
|
||||||
|
@ -424,20 +424,23 @@ void cPixmapContainer::ShiftIn(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cPixmapContainer::ShiftInFromBorder(int frames, int frameTime) {
|
void cPixmapContainer::ShiftOut(void) {
|
||||||
//calculating union rectangle of all pixmaps viewports
|
if (shiftTime < 1)
|
||||||
cRect unionArea;
|
return;
|
||||||
bool isNew = true;
|
|
||||||
for (int i = 0; i < numPixmaps; i++) {
|
int frames = shiftTime * config.framesPerSecond / 1000;
|
||||||
if (!PixmapExists(i))
|
if (frames <= 0) frames = 1;
|
||||||
continue;
|
int frameTime = shiftTime / frames;
|
||||||
if (isNew) {
|
|
||||||
unionArea = ViewPort(i);
|
if (shiftType > stNone) {
|
||||||
isNew = false;
|
ShiftOutToBorder(frames, frameTime);
|
||||||
} else {
|
} else {
|
||||||
unionArea.Combine(ViewPort(i));
|
ShiftOutToPoint(frames, frameTime);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cPixmapContainer::ShiftInFromBorder(int frames, int frameTime) {
|
||||||
|
cRect unionArea = UnionPixmaps();
|
||||||
//shifthing all pixmaps to dedicated start positions
|
//shifthing all pixmaps to dedicated start positions
|
||||||
cPoint startPositions[numPixmaps];
|
cPoint startPositions[numPixmaps];
|
||||||
int osdWidth = osd->Width();
|
int osdWidth = osd->Width();
|
||||||
@ -541,6 +544,80 @@ void cPixmapContainer::ShiftInFromBorder(int frames, int frameTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cPixmapContainer::ShiftOutToBorder(int frames, int frameTime) {
|
||||||
|
cRect unionArea = UnionPixmaps();
|
||||||
|
//calculating end positions
|
||||||
|
cPoint startPositions[numPixmaps];
|
||||||
|
int osdWidth = osd->Width();
|
||||||
|
int osdHeight = osd->Height();
|
||||||
|
for (int i = 0; i < numPixmaps; i++) {
|
||||||
|
if (!PixmapExists(i))
|
||||||
|
continue;
|
||||||
|
cPoint pos;
|
||||||
|
Pos(i, pos);
|
||||||
|
startPositions[i] = pos;
|
||||||
|
}
|
||||||
|
//Calculating total shifting distance
|
||||||
|
int shiftTotal = 0;
|
||||||
|
switch (shiftType) {
|
||||||
|
case stLeft:
|
||||||
|
shiftTotal = unionArea.X() + unionArea.Width();
|
||||||
|
break;
|
||||||
|
case stRight:
|
||||||
|
shiftTotal = unionArea.Width() + (osdWidth - (unionArea.X() + unionArea.Width()));
|
||||||
|
break;
|
||||||
|
case stTop:
|
||||||
|
shiftTotal = unionArea.Y() + unionArea.Height();
|
||||||
|
break;
|
||||||
|
case stBottom:
|
||||||
|
shiftTotal = unionArea.Height() + (osdHeight - (unionArea.Y() + unionArea.Height()));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//Moving Out
|
||||||
|
uint64_t Start = cTimeMs::Now();
|
||||||
|
while (true) {
|
||||||
|
uint64_t Now = cTimeMs::Now();
|
||||||
|
double t = min(double(Now - Start) / shiftTime, 1.0);
|
||||||
|
int xNew = 0;
|
||||||
|
int yNew = 0;
|
||||||
|
for (int i = 0; i < numPixmaps; i++) {
|
||||||
|
if (!PixmapExists(i))
|
||||||
|
continue;
|
||||||
|
cRect r = ViewPort(i);
|
||||||
|
switch (shiftType) {
|
||||||
|
case stLeft:
|
||||||
|
xNew = startPositions[i].X() - t * shiftTotal;
|
||||||
|
r.SetPoint(xNew, r.Y());
|
||||||
|
break;
|
||||||
|
case stRight:
|
||||||
|
xNew = startPositions[i].X() + t * shiftTotal;
|
||||||
|
r.SetPoint(xNew, r.Y());
|
||||||
|
break;
|
||||||
|
case stTop:
|
||||||
|
yNew = startPositions[i].Y() - t * shiftTotal;
|
||||||
|
r.SetPoint(r.X(), yNew);
|
||||||
|
break;
|
||||||
|
case stBottom:
|
||||||
|
yNew = startPositions[i].Y() + t * shiftTotal;
|
||||||
|
r.SetPoint(r.X(), yNew);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SetViewPort(i, r);
|
||||||
|
}
|
||||||
|
DoFlush();
|
||||||
|
int Delta = cTimeMs::Now() - Now;
|
||||||
|
if ((Delta < frameTime)) {
|
||||||
|
cCondWait::SleepMs(frameTime - Delta);
|
||||||
|
}
|
||||||
|
if ((int)(Now - Start) > shiftTime)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cPixmapContainer::ShiftInFromPoint(int frames, int frameTime) {
|
void cPixmapContainer::ShiftInFromPoint(int frames, int frameTime) {
|
||||||
//store original positions of pixmaps and move to StartPosition
|
//store original positions of pixmaps and move to StartPosition
|
||||||
cPoint destPos[numPixmaps];
|
cPoint destPos[numPixmaps];
|
||||||
@ -579,6 +656,25 @@ void cPixmapContainer::ShiftInFromPoint(int frames, int frameTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cPixmapContainer::ShiftOutToPoint(int frames, int frameTime) {
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
cRect cPixmapContainer::UnionPixmaps(void) {
|
||||||
|
cRect unionArea;
|
||||||
|
bool isNew = true;
|
||||||
|
for (int i = 0; i < numPixmaps; i++) {
|
||||||
|
if (!PixmapExists(i))
|
||||||
|
continue;
|
||||||
|
if (isNew) {
|
||||||
|
unionArea = ViewPort(i);
|
||||||
|
isNew = false;
|
||||||
|
} else {
|
||||||
|
unionArea.Combine(ViewPort(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return unionArea;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************
|
/*****************************************
|
||||||
* scrollSpeed: 1 slow
|
* scrollSpeed: 1 slow
|
||||||
|
@ -29,7 +29,10 @@ private:
|
|||||||
cPoint startPos;
|
cPoint startPos;
|
||||||
bool deleteOsdOnExit;
|
bool deleteOsdOnExit;
|
||||||
void ShiftInFromBorder(int frames, int frameTime);
|
void ShiftInFromBorder(int frames, int frameTime);
|
||||||
|
void ShiftOutToBorder(int frames, int frameTime);
|
||||||
void ShiftInFromPoint(int frames, int frameTime);
|
void ShiftInFromPoint(int frames, int frameTime);
|
||||||
|
void ShiftOutToPoint(int frames, int frameTime);
|
||||||
|
cRect UnionPixmaps(void);
|
||||||
protected:
|
protected:
|
||||||
void SetInitFinished(void) { pixContainerInit = false; };
|
void SetInitFinished(void) { pixContainerInit = false; };
|
||||||
bool CreateOsd(int Left, int Top, int Width, int Height);
|
bool CreateOsd(int Left, int Top, int Width, int Height);
|
||||||
@ -72,6 +75,7 @@ protected:
|
|||||||
void FadeIn(void);
|
void FadeIn(void);
|
||||||
void FadeOut(void);
|
void FadeOut(void);
|
||||||
void ShiftIn(void);
|
void ShiftIn(void);
|
||||||
|
void ShiftOut(void);
|
||||||
void ScrollVertical(int num, int scrollDelay, int scrollSpeed);
|
void ScrollVertical(int num, int scrollDelay, int scrollSpeed);
|
||||||
void ScrollHorizontal(int num, int scrollDelay, int scrollSpeed, int scrollMode);
|
void ScrollHorizontal(int num, int scrollDelay, int scrollSpeed, int scrollMode);
|
||||||
void CancelSave(void);
|
void CancelSave(void);
|
||||||
|
@ -18,8 +18,6 @@ cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
cDisplayChannelView::~cDisplayChannelView() {
|
cDisplayChannelView::~cDisplayChannelView() {
|
||||||
CancelSave();
|
|
||||||
FadeOut();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDisplayChannelView::createOsd(void) {
|
bool cDisplayChannelView::createOsd(void) {
|
||||||
|
@ -5,7 +5,6 @@ cDisplayMenuTabView::cDisplayMenuTabView(cTemplateViewTab *tmplTab) : cView(tmpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
cDisplayMenuTabView::~cDisplayMenuTabView() {
|
cDisplayMenuTabView::~cDisplayMenuTabView() {
|
||||||
CancelSave();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDisplayMenuTabView::SetTokens(map < string, int > *intTokens, map < string, string > *stringTokens, map < string, vector< map< string, string > > > *loopTokens) {
|
void cDisplayMenuTabView::SetTokens(map < string, int > *intTokens, map < string, string > *stringTokens, map < string, vector< map< string, string > > > *loopTokens) {
|
||||||
|
@ -17,8 +17,6 @@ cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
cDisplayMenuView::~cDisplayMenuView() {
|
cDisplayMenuView::~cDisplayMenuView() {
|
||||||
CancelSave();
|
|
||||||
FadeOut();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDisplayMenuView::DrawBackground(void) {
|
bool cDisplayMenuView::DrawBackground(void) {
|
||||||
|
@ -7,8 +7,6 @@ cDisplayMessageView::cDisplayMessageView(cTemplateView *tmplView) : cView(tmplVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
cDisplayMessageView::~cDisplayMessageView() {
|
cDisplayMessageView::~cDisplayMessageView() {
|
||||||
CancelSave();
|
|
||||||
FadeOut();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDisplayMessageView::createOsd(void) {
|
bool cDisplayMessageView::createOsd(void) {
|
||||||
|
@ -17,8 +17,6 @@ cDisplayPluginView::cDisplayPluginView(cTemplateView *tmplView, bool isRootView)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cDisplayPluginView::~cDisplayPluginView() {
|
cDisplayPluginView::~cDisplayPluginView() {
|
||||||
CancelSave();
|
|
||||||
FadeOut();
|
|
||||||
if (tabView)
|
if (tabView)
|
||||||
delete tabView;
|
delete tabView;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,6 @@ cDisplayReplayView::~cDisplayReplayView() {
|
|||||||
if (onPauseView) {
|
if (onPauseView) {
|
||||||
delete onPauseView;
|
delete onPauseView;
|
||||||
}
|
}
|
||||||
CancelSave();
|
|
||||||
FadeOut();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDisplayReplayView::createOsd(void) {
|
bool cDisplayReplayView::createOsd(void) {
|
||||||
|
@ -9,8 +9,6 @@ cDisplayVolumeView::cDisplayVolumeView(cTemplateView *tmplView) : cView(tmplView
|
|||||||
}
|
}
|
||||||
|
|
||||||
cDisplayVolumeView::~cDisplayVolumeView() {
|
cDisplayVolumeView::~cDisplayVolumeView() {
|
||||||
CancelSave();
|
|
||||||
FadeOut();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDisplayVolumeView::createOsd(void) {
|
bool cDisplayVolumeView::createOsd(void) {
|
||||||
|
17
views/view.c
17
views/view.c
@ -38,18 +38,29 @@ cView::cView(cTemplateViewTab *tmplTab) : cPixmapContainer(1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cView::~cView() {
|
cView::~cView() {
|
||||||
|
CancelSave();
|
||||||
|
|
||||||
if (tvScaled) {
|
if (tvScaled) {
|
||||||
cDevice::PrimaryDevice()->ScaleVideo(cRect::Null);
|
cDevice::PrimaryDevice()->ScaleVideo(cRect::Null);
|
||||||
}
|
}
|
||||||
|
//clear detached views
|
||||||
for (map<eViewElement,cViewElement*>::iterator dVeIt = detachedViewElements.begin(); dVeIt != detachedViewElements.end(); dVeIt++) {
|
for (map<eViewElement,cViewElement*>::iterator dVeIt = detachedViewElements.begin(); dVeIt != detachedViewElements.end(); dVeIt++) {
|
||||||
cViewElement *ve = dVeIt->second;
|
cViewElement *ve = dVeIt->second;
|
||||||
delete ve;
|
delete ve;
|
||||||
}
|
}
|
||||||
|
//clear animations
|
||||||
for (multimap<int, cAnimation*>::iterator animIt = animations.begin(); animIt != animations.end(); animIt++) {
|
for (multimap<int, cAnimation*>::iterator animIt = animations.begin(); animIt != animations.end(); animIt++) {
|
||||||
cAnimation *anim = animIt->second;
|
cAnimation *anim = animIt->second;
|
||||||
anim->Stop();
|
anim->Stop();
|
||||||
delete anim;
|
delete anim;
|
||||||
}
|
}
|
||||||
|
//shift or fade out
|
||||||
|
if (fadeOut) {
|
||||||
|
if (IsAnimated())
|
||||||
|
ShiftOut();
|
||||||
|
else
|
||||||
|
FadeOut();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cView::DrawDebugGrid(void) {
|
void cView::DrawDebugGrid(void) {
|
||||||
@ -59,6 +70,7 @@ void cView::DrawDebugGrid(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cView::Init(void) {
|
void cView::Init(void) {
|
||||||
|
fadeOut = true;
|
||||||
viewInit = true;
|
viewInit = true;
|
||||||
scrolling = false;
|
scrolling = false;
|
||||||
veScroll = veUndefined;
|
veScroll = veUndefined;
|
||||||
@ -1066,6 +1078,7 @@ cRect cView::CalculateAnimationClip(int numPix, cRect &pos) {
|
|||||||
|
|
||||||
cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) {
|
cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) {
|
||||||
init = true;
|
init = true;
|
||||||
|
fadeOut = false;
|
||||||
ve = veUndefined;
|
ve = veUndefined;
|
||||||
helper = NULL;
|
helper = NULL;
|
||||||
SetTokens = NULL;
|
SetTokens = NULL;
|
||||||
@ -1080,6 +1093,7 @@ cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplVi
|
|||||||
|
|
||||||
cViewElement::cViewElement(cTemplateViewElement *tmplViewElement, cViewHelpers *helper) : cView(tmplViewElement) {
|
cViewElement::cViewElement(cTemplateViewElement *tmplViewElement, cViewHelpers *helper) : cView(tmplViewElement) {
|
||||||
init = true;
|
init = true;
|
||||||
|
fadeOut = false;
|
||||||
ve = veUndefined;
|
ve = veUndefined;
|
||||||
this->helper = helper;
|
this->helper = helper;
|
||||||
SetTokens = NULL;
|
SetTokens = NULL;
|
||||||
@ -1093,7 +1107,6 @@ cViewElement::cViewElement(cTemplateViewElement *tmplViewElement, cViewHelpers *
|
|||||||
}
|
}
|
||||||
|
|
||||||
cViewElement::~cViewElement() {
|
cViewElement::~cViewElement() {
|
||||||
CancelSave();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cViewElement::Render(void) {
|
bool cViewElement::Render(void) {
|
||||||
@ -1148,6 +1161,7 @@ void cViewElement::ClearTokens(void) {
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
cViewListItem::cViewListItem(cTemplateViewElement *tmplItem) : cView(tmplItem) {
|
cViewListItem::cViewListItem(cTemplateViewElement *tmplItem) : cView(tmplItem) {
|
||||||
|
fadeOut = false;
|
||||||
pos = -1;
|
pos = -1;
|
||||||
numTotal = 0;
|
numTotal = 0;
|
||||||
align = alLeft;
|
align = alLeft;
|
||||||
@ -1265,6 +1279,7 @@ void cViewListItem::SetListElementPosition(cTemplatePixmap *pix) {
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
cGrid::cGrid(cTemplateViewElement *tmplGrid) : cView(tmplGrid) {
|
cGrid::cGrid(cTemplateViewElement *tmplGrid) : cView(tmplGrid) {
|
||||||
|
fadeOut = false;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
moved = true;
|
moved = true;
|
||||||
resized = true;
|
resized = true;
|
||||||
|
@ -42,6 +42,8 @@ protected:
|
|||||||
cRect scalingWindow;
|
cRect scalingWindow;
|
||||||
bool tvScaled;
|
bool tvScaled;
|
||||||
bool viewInit;
|
bool viewInit;
|
||||||
|
//do fadeout or shiftout only for views, not for childs
|
||||||
|
bool fadeOut;
|
||||||
//true if view is scrollable in general
|
//true if view is scrollable in general
|
||||||
bool scrolling;
|
bool scrolling;
|
||||||
//true if view is actually starting scrolling
|
//true if view is actually starting scrolling
|
||||||
|
Loading…
x
Reference in New Issue
Block a user