/* Handle mouse events*/
// They come in with m->to = NULL? and just need to be delivered to top box?
if ((numBoxes > 1) && ((m->message == Message::MOUSE_MOVE) || (m->message == Message::MOUSE_LBDOWN)
- || (m->message == Message::MOUSE_ANDROID_SCROLL)))
+ || (m->message == Message::MOUSE_SCROLL)))
{
boxes[numBoxes-1]->processMessage(m);
return;
DrawStyle::SELECTHIGHLIGHT.grad_col[0]=DrawStyle(0xFFa4fd15);
DrawStyle::SELECTHIGHLIGHT.grad_col[1]=DrawStyle(0xFFa4fd15);
DrawStyle::SELECTHIGHLIGHT.grad_col[2]=DrawStyle(0x7D000000);
- DrawStyle::SELECTHIGHLIGHT.grad_pos[0]=0.3;
- DrawStyle::SELECTHIGHLIGHT.grad_pos[1]=0.9;
+ DrawStyle::SELECTHIGHLIGHT.grad_pos[0]=0.3f;
+ DrawStyle::SELECTHIGHLIGHT.grad_pos[1]=0.9f;
DrawStyle::SELECTHIGHLIGHT.num_colors=3;
DrawStyle::SELECTHIGHLIGHT.ft=DrawStyle::GradientLinear;
- DrawStyle::SELECTHIGHLIGHT.x1=0.0;
- DrawStyle::SELECTHIGHLIGHT.y1=0.2;
- DrawStyle::SELECTHIGHLIGHT.x2=1.1;
- DrawStyle::SELECTHIGHLIGHT.y2=0.8;
+ DrawStyle::SELECTHIGHLIGHT.x1=0.0f;
+ DrawStyle::SELECTHIGHLIGHT.y1=0.2f;
+ DrawStyle::SELECTHIGHLIGHT.x2=1.1f;
+ DrawStyle::SELECTHIGHLIGHT.y2=0.8f;
DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(0xFD999999);
DrawStyle::SELECTDARKHIGHLIGHT.grad_col[0]=DrawStyle(0xFF7bbd0f);
DrawStyle::SELECTDARKHIGHLIGHT.grad_col[1]=DrawStyle(0xFF7bbd0f);
DrawStyle::SELECTDARKHIGHLIGHT.grad_col[2]=DrawStyle(0x7D000000);
- DrawStyle::SELECTDARKHIGHLIGHT.grad_pos[0]=0.3;
- DrawStyle::SELECTDARKHIGHLIGHT.grad_pos[1]=0.9;
+ DrawStyle::SELECTDARKHIGHLIGHT.grad_pos[0]=0.3f;
+ DrawStyle::SELECTDARKHIGHLIGHT.grad_pos[1]=0.9f;
DrawStyle::SELECTDARKHIGHLIGHT.num_colors=3;
DrawStyle::SELECTDARKHIGHLIGHT.ft=DrawStyle::GradientLinear;
- DrawStyle::SELECTDARKHIGHLIGHT.x1=0.0;
- DrawStyle::SELECTDARKHIGHLIGHT.y1=0.2;
- DrawStyle::SELECTDARKHIGHLIGHT.x2=1.1;
- DrawStyle::SELECTDARKHIGHLIGHT.y2=0.8;
+ DrawStyle::SELECTDARKHIGHLIGHT.x1=0.0f;
+ DrawStyle::SELECTDARKHIGHLIGHT.y1=0.2f;
+ DrawStyle::SELECTDARKHIGHLIGHT.x2=1.1f;
+ DrawStyle::SELECTDARKHIGHLIGHT.y2=0.8f;
DrawStyle::SELECTBACKGROUND=DrawStyle(0xFE999999);
DrawStyle::SELECTBACKGROUND.grad_col[0]=DrawStyle(0xFF353b50);
DrawStyle::SELECTBACKGROUND.grad_col[1]=DrawStyle(0xFF353b50);
DrawStyle::SELECTBACKGROUND.grad_col[2]=DrawStyle(0x7D000000);
- DrawStyle::SELECTBACKGROUND.grad_pos[0]=0.3;
- DrawStyle::SELECTBACKGROUND.grad_pos[1]=0.9;
+ DrawStyle::SELECTBACKGROUND.grad_pos[0]=0.3f;
+ DrawStyle::SELECTBACKGROUND.grad_pos[1]=0.9f;
DrawStyle::SELECTBACKGROUND.num_colors=3;
DrawStyle::SELECTBACKGROUND.ft=DrawStyle::GradientLinear;
- DrawStyle::SELECTBACKGROUND.x1=0.0;
- DrawStyle::SELECTBACKGROUND.y1=0.2;
- DrawStyle::SELECTBACKGROUND.x2=1.1;
- DrawStyle::SELECTBACKGROUND.y2=0.8;
+ DrawStyle::SELECTBACKGROUND.x1=0.0f;
+ DrawStyle::SELECTBACKGROUND.y1=0.2f;
+ DrawStyle::SELECTBACKGROUND.x2=1.1f;
+ DrawStyle::SELECTBACKGROUND.y2=0.8f;
DrawStyle::TITLEBARBACKGROUND=DrawStyle::SELECTBACKGROUND;
DrawStyle::PROGRAMMEA.grad_col[0]=DrawStyle(0xFF353b50);
DrawStyle::PROGRAMMEA.grad_col[1]=DrawStyle(0xFF353b50);
DrawStyle::PROGRAMMEA.grad_col[2]=DrawStyle(0xFE999999);
- DrawStyle::PROGRAMMEA.grad_pos[0]=0.3;
- DrawStyle::PROGRAMMEA.grad_pos[1]=0.9;
+ DrawStyle::PROGRAMMEA.grad_pos[0]=0.3f;
+ DrawStyle::PROGRAMMEA.grad_pos[1]=0.9f;
DrawStyle::PROGRAMMEA.num_colors=3;
DrawStyle::PROGRAMMEA.ft=DrawStyle::GradientLinear;
- DrawStyle::PROGRAMMEA.x1=0.0;
- DrawStyle::PROGRAMMEA.y1=0.2;
- DrawStyle::PROGRAMMEA.x2=1.0;
- DrawStyle::PROGRAMMEA.y2=0.8;
+ DrawStyle::PROGRAMMEA.x1=0.0f;
+ DrawStyle::PROGRAMMEA.y1=0.2f;
+ DrawStyle::PROGRAMMEA.x2=1.0f;
+ DrawStyle::PROGRAMMEA.y2=0.8f;
DrawStyle::NOPROGRAMME=DrawStyle(0xFF353b50); // no programme details colour
DrawStyle::WALLPAPER.grad_col[0]=DrawStyle(0x0012273f);
DrawStyle::WALLPAPER.num_colors=1;
DrawStyle::WALLPAPER.ft=DrawStyle::GradientLinear;
- DrawStyle::WALLPAPER.x1=0.0;
- DrawStyle::WALLPAPER.y1=0.0;
- DrawStyle::WALLPAPER.x2=0.0;
- DrawStyle::WALLPAPER.y2=1.0;
+ DrawStyle::WALLPAPER.x1=0.0f;
+ DrawStyle::WALLPAPER.y1=0.0f;
+ DrawStyle::WALLPAPER.x2=0.0f;
+ DrawStyle::WALLPAPER.y2=1.0f;
/*
Silly colours
void MILLISLEEP(ULONG a);
long long getTimeMS();
+int getClockRealTime(struct timespec *tp);
+
+
#ifdef WIN32
#define Surface_TYPE SurfaceWin
#define STRCASESTR StrStrI
/* #define STRTOULL _strtoui64 */
#define STRTOUL strtoul
- #define STRTOKR strtok_l
+ #define STRTOKR strtok_s
#define CLOSESOCKET closesocket
#define DEFAULT_TCP_WINDOWSIZE 2048
uint64_t cTimeMs::Now(void)
{
struct timespec tp;
-#ifndef WIN32
- if (clock_gettime(CLOCK_REALTIME, &tp) == 0)
+
+ if (getClockRealTime(&tp) == 0)
return (uint64_t(tp.tv_sec)) * 1000 + tp.tv_nsec / 1000000;
else
Log::getInstance()->log("SUBTITLES", Log::DEBUG, "cTimeMs: clock_gettime(CLOCK_REALTIME) failed");
-#else
- SYSTEMTIME systime;
- __int64 filetime;
- __int64 test;
- GetSystemTime(&systime);
- SystemTimeToFileTime(&systime,(FILETIME*)&filetime);
- tp.tv_sec=(filetime-WINDOWS_TIME_BASE_OFFSET)/(10*1000*1000);
- tp.tv_nsec=((filetime-WINDOWS_TIME_BASE_OFFSET)%(10*1000*1000))*100;
- return (uint64_t(tp.tv_sec)) * 1000 + tp.tv_nsec / 1000000;
-#endif
}
void cTimeMs::Set(int Ms)
{
Log::getInstance()->log("SUBTITLES", Log::DEBUG, "Sleeping for %d and %d", sleeptime.tv_sec, sleeptime.tv_nsec);
struct timespec targetTime;
-#ifndef WIN32
- clock_gettime(CLOCK_REALTIME, &targetTime);
-#else
- SYSTEMTIME systime;
- __int64 filetime;
- __int64 test;
- GetSystemTime(&systime);
- SystemTimeToFileTime(&systime,(FILETIME*)&filetime);
- targetTime.tv_sec=(filetime-WINDOWS_TIME_BASE_OFFSET)/(10*1000*1000);
- targetTime.tv_nsec=((filetime-WINDOWS_TIME_BASE_OFFSET)%(10*1000*1000))*100;
-#endif
+
+ getClockRealTime(&targetTime);
+
targetTime.tv_nsec += sleeptime.tv_nsec;
if (targetTime.tv_nsec > 999999999)
{
void loadinfos(UINT channelid);
ULONG id;
- #ifdef WIN32
- time_t time;
- time_t duration;
- #else
+
ULONG time;
ULONG duration;
- #endif // FIXME sort this out, causes signedness problems under linux
char* title;
char* subtitle;
return ts.tv_sec*1000+ts.tv_nsec/1000000LL;
}
+int getClockRealTime(struct timespec *tp)
+{
+ return clock_gettime(CLOCK_REALTIME, tp);
+}
+
+
int min(UINT a, int b)
{
if (a > b) return b;
const static ULONG TELETEXTUPDATE = 32;
const static ULONG TELETEXTUPDATEFIRSTLINE = 33;
const static ULONG SUBTITLE_CHANGE_CHANNEL = 34;
- const static ULONG MOUSE_ANDROID_SCROLL = 35;
+ const static ULONG MOUSE_SCROLL = 35;
const static ULONG NEW_PICTURE = 36;
const static ULONG NEW_PICTURE_STATIC = 37;
};
*/
#include "mutex.h"
-
+#ifndef WIN32
#include <unistd.h>
#include <sys/syscall.h>
+#endif
Mutex::Mutex() {
#ifndef WIN32
//Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Sleep Picture Reader");
struct timespec target_time;
- clock_gettime(CLOCK_REALTIME,&target_time);
+ getClockRealTime(&target_time);
+
target_time.tv_nsec+=1000000LL*10;
if (target_time.tv_nsec>999999999) {
target_time.tv_nsec-=1000000000L;
}
}
-
+ GdiplusStartup(&gdiptoken, &gdipstartup, NULL);
//Now we will create the Screen
d3d->Release();
if (swapsurf) swapsurf->Release();
if (swappy) swappy->Release();
+ Gdiplus::GdiplusShutdown(gdiptoken);
return 1;
}
/*calculating destination rect */
RECT destrect={0,0,/*video->getScreenWidth()*/ targetdesc.Width,
/*video->getScreenHeight()*/targetdesc.Height};
- UCHAR mode=video->getMode();
- switch (mode) {
- case Video::EIGHTH:
- destrect.right=destrect.right/2;
- destrect.bottom=destrect.bottom/2;
- case Video::QUARTER:
- destrect.right=destrect.right/2+video->getPosx()*2;
- destrect.bottom=destrect.bottom/2+video->getPosy()*2;
- destrect.left=video->getPosx()*2;
- destrect.top=video->getPosy()*2;
- d3ddevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),1.0f,0);
+ const VideoDisplay &vd=video->getVideoDisplay();
+ int addx, addy;
+ addx = addy = 0;
+
+ switch (vd.mode) {
+ case Eighth:
+ destrect.right=destrect.right/2;
+ destrect.bottom=destrect.bottom/2;
+ case Quarter:
+ destrect.right=destrect.right/2;
+ destrect.bottom=destrect.bottom/2;
+ break;
+ case Window:
+ float imageaspect = 720.f / 576.f;
+ float boxaspect = ((float)vd.width) / ((float)vd.height) ;
+ float videoaspect = ((float)targetdesc.Width) / ((float)targetdesc.Height);
+ if (imageaspect > boxaspect) {
+ destrect.right = (int)(((float)destrect.right) * ((float)vd.width) / 720.f);
+ destrect.bottom = (int)(((float)destrect.right)/videoaspect);
+ addy += (((float)vd.height) - ((float)vd.width) / imageaspect)*0.5f / 576.f
+ *((float)targetdesc.Height);
+ }
+ else {
+ destrect.bottom = (int)(((float)destrect.bottom) * ((float)vd.height) / 576.f);
+ destrect.right = (int)(((float)destrect.bottom)*videoaspect);
+ addx += (((float)vd.width) - ((float)vd.height) * imageaspect)*0.5f / 720.f
+ *((float)targetdesc.Width);
+ }
+
+
break;
};
+ switch (vd.mode) {
+ case Quarter:
+ case Eighth:
+ case Window:
+ destrect.left = (int)(((float)vd.x*targetdesc.Width) / 720.f)+addx;
+ destrect.top = (int)(((float)vd.y*targetdesc.Height) / 576.f)+addy;
+ destrect.right += destrect.left;
+ destrect.bottom += destrect.top;
+ break;
+ }
+ d3ddevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
D3DSURFACE_DESC surf_desc;
present->GetDesc(&surf_desc);//for chop sides
RECT sourcerect= {0,0,surf_desc.Width,surf_desc.Height};
#include <winsock2.h>
#include <d3d9.h>
#include <Dxva2api.h>
+#include <gdiplus.h>
struct OSDVERTEX
{
EVR_state evrstate;
bool evrsupported;
HWND window;
+ ULONG_PTR gdiptoken;
+ Gdiplus::GdiplusStartupInput gdipstartup;
UINT dxvatoken;
IDirect3DDeviceManager9 *d3ddevman;
#include "surface.h"
#include <math.h>
+#include <algorithm>
#include "osd.h"
#include "log.h"
#include "video.h"
#include "osdwin.h"
#include "bitmap.h"
#include "log.h"
-#include <D3dx9tex.h>
+#include <gdiplus.h>
SurfaceWin::SurfaceWin(int id)
: Surface(id)
if (temp_text) temp_text->Release();
}
-void SurfaceWin::drawJpeg(const char *fileName,int x, int y,int *width, int *height){
- WaitForSingleObject(event,INFINITE); //since this might be called before surface
- //allocation we will wait in this case, hopefully without deadlocks
- if (!d3dsurface) {
- return ; //why does this happen
- }
- OsdWin* osd=((OsdWin*)(Osd::getInstance()));
+void SurfaceWin::drawJpeg(const char *fileName, int x, int y, int *width, int *height){
+ WaitForSingleObject(event, INFINITE); //since this might be called before surface
+ //allocation we will wait in this case, hopefully without deadlocks
+ if (!d3dsurface) {
+ return; //why does this happen
+ }
+ OsdWin* osd = ((OsdWin*)(Osd::getInstance()));
+ osd->BeginPainting();
+
+ HDC dc;
+ HRESULT hres = d3dsurface->GetDC(&dc);
+ if (hres != D3D_OK) return;
+
+ HRSRC hrc = FindResource(GetModuleHandle(NULL), fileName, RT_RCDATA);
+ DWORD size = SizeofResource(GetModuleHandle(NULL), hrc);
+ void *pointer = LockResource(LoadResource(GetModuleHandle(NULL),hrc));
+ HGLOBAL memhandle=GlobalAlloc(GMEM_MOVEABLE, size);
+ if (!memhandle)
+ {
+ d3dsurface->ReleaseDC(dc);
+ UnlockResource(hrc);
+ return;
+ }
+ void *mempointer = GlobalLock(memhandle);
+ if (!mempointer) {
+ d3dsurface->ReleaseDC(dc);
+ GlobalUnlock(mempointer);
+ GlobalFree(memhandle);
+ UnlockResource(hrc);
+ return;
+ }
+
+ memcpy(mempointer, pointer, size);
+ UnlockResource(hrc);
- D3DXIMAGE_INFO image_inf;
- osd->BeginPainting();
-// D3DXGetImageInfoFromFile(fileName,&image_inf);
- D3DXGetImageInfoFromResource(NULL,fileName,&image_inf);
- RECT dest_rec={x,y,x+image_inf.Width,
- y+image_inf.Height};
-/* if (D3DXLoadSurfaceFromFile(
- d3dsurface,
- NULL,
- &dest_rec,
- fileName,
- NULL,
- D3DX_FILTER_NONE,
- 0,
- &image_inf)!=D3D_OK) {
- Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
-
- }*/
- if (D3DXLoadSurfaceFromResource(
- d3dsurface,
- NULL,
- &dest_rec,
- NULL,
- fileName,
- NULL,
- D3DX_FILTER_NONE,
- 0,
- &image_inf)!=D3D_OK) {
- Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
+ IStream *memstream = NULL;
+ if (CreateStreamOnHGlobal(memhandle, FALSE, &memstream) != S_OK)
+ {
+ GlobalUnlock(mempointer);
+ GlobalFree(memhandle);
+ d3dsurface->ReleaseDC(dc);
+
+ return;
+ }
- }
- osd->EndPainting();
- *width=image_inf.Width;
- *height=image_inf.Height;
-}
+ Gdiplus::Graphics graphics(dc);
+ Gdiplus::Image image(memstream);
+
+ *width = image.GetWidth();
+ *height = image.GetHeight();
-/*
-void SurfaceWin::drawJpeg(char *buffer,ULONG buflength,DWORD x, DWORD y,DWORD *width, DWORD *height){
- WaitForSingleObject(event,INFINITE); //since this might be called before surface
- //allocation we will wait in this case, hopefully without deadlocks
- if (!d3dsurface) {
- return ; //why does this happen
- }
- OsdWin* osd=((OsdWin*)(Osd::getInstance()));
+ graphics.DrawImage(&image, x, y, *width, *height);
+ memstream->Release();
+ GlobalUnlock(mempointer);
+ GlobalFree(memhandle);
+
+ d3dsurface->ReleaseDC(dc);
+ osd->EndPainting();
- D3DXIMAGE_INFO image_inf;
- osd->BeginPainting();
-// D3DXGetImageInfoFromFile(fileName,&image_inf);
- D3DXGetImageInfoFromFileInMemory((void*)buffer,buflength,&image_inf);
- RECT dest_rec={x,y,x+image_inf.Width,
- y+image_inf.Height};
-/* if (D3DXLoadSurfaceFromFile(
- d3dsurface,
- NULL,
- &dest_rec,
- fileName,
- NULL,
- D3DX_FILTER_NONE,
- 0,
- &image_inf)!=D3D_OK) {
- Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
-
- }*/
-/* if (D3DXLoadSurfaceFromResource(
- d3dsurface,
- NULL,
- &dest_rec,
- NULL,
- fileName,
- NULL,
- D3DX_FILTER_NONE,
- 0,
- &image_inf)!=D3D_OK) {
- Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
-
- }*
- if (D3DXLoadSurfaceFromFileInMemory(
- d3dsurface,
- NULL,
- &dest_rec,
- (void*)buffer,
- buflength,
- NULL,
- D3DX_FILTER_NONE,
- 0,
- &image_inf)!=D3D_OK) {
- Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
- }
- osd->EndPainting();
- *width=image_inf.Width;
- *height=image_inf.Height;
+}
+
-}*/
{
struct timespec currentTime;
-#ifndef WIN32
- clock_gettime(CLOCK_REALTIME, ¤tTime);
-#else
- SYSTEMTIME systime;
- __int64 filetime;
- __int64 test;
- GetSystemTime(&systime);
- SystemTimeToFileTime(&systime,(FILETIME*)&filetime);
- currentTime.tv_sec=(filetime-WINDOWS_TIME_BASE_OFFSET)/(10*1000*1000);
- //#error "Hier gibt was zu tun!"
- currentTime.tv_nsec=((filetime-WINDOWS_TIME_BASE_OFFSET)%(10*1000*1000))*100;
-#endif
+ getClockRealTime(¤tTime);
long int requestedTime;
long int requestedTimeNSEC;
#endif
class MovieInfo;
class SeriesInfo;
-struct TVMediaInfo;
+class TVMediaInfo;
using namespace std;
int screenheighthalf=Video::getInstance()->getScreenHeight()/2;
// summaryLines = ((float)screenheighthalf)/((float)fontHeight))-1;
// summaryLowerPadding = screenheighthalf-summaryLines*(fontHeight);
- gridRows = (screenheighthalf-fontHeight*2-40)/fontHeight;
+ gridRows = (screenheighthalf-fontHeight*3-40)/fontHeight;
// initialise variables and pointers
char timeString[9]; // to hold programme start and end time
int length = strlen(event->title); // calculate length of programme title string
char* title = new char[length + 15]; // create string to hold start time, end time and programme title
- btime = localtime((time_t*)&event->time); //get programme start time
+ time_t eventtime = event->time;
+ btime = localtime((time_t*)&eventtime); //get programme start time
#ifndef _MSC_VER
strftime(timeString, 9, "%0H:%0M - ", btime); // and format it as hh:mm -
#else
time_t t;
struct tm* btime;
char timeString[10];
- btime = localtime((time_t*)&event->time);
+ time_t eventtime = event->time;
+ btime = localtime(&eventtime);
#ifndef _MSC_VER
strftime(timeString, 9, "%0H:%0M - ", btime); // and format it as hh:mm -
#else
if (command==Remote::RED)
{
if (!channel) return 2;
+ MessageBox(0, "test", "test", 0);
Log::getInstance()->log("VEpgSummary", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", event->id, event->time, event->duration, event->title);
VEpgSetTimer* vs = new VEpgSetTimer(event, channel);
vs->draw();
{
if (m->message == Message::MOUSE_MOVE)
{
- // todo
+ if (tabbar.mouseMove((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
+ {
+ BoxStack::getInstance()->update(this);
+ }
}
else if (m->message == Message::MOUSE_LBDOWN)
{
int cancel = true;
+ int x = (m->parameter >> 16) - getScreenX();
+ int y = (m->parameter & 0xFFFF) - getScreenY();
+
+ if ((boxRed.getX() <= x) && (boxRed.getX() + (int)boxRed.getWidth() >= x) &&
+ (boxRed.getY() <= y) && (boxRed.getY() + (int)boxRed.getHeight() >= y)) {
+ BoxStack::getInstance()->handleCommand(Remote::RED);
+ cancel = false;
+ }
+
+
+ if (cancel && tabbar.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
+ {
+ BoxStack::getInstance()->update(this);
+ cancel = false;
+ }
if (cancel)
{
//check if press is outside this view! then simulate cancel
BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
}
}
+ } else if (m->message == Message::MOUSE_SCROLL)
+ {
+ if (tabbar.mouseAndroidScroll((m->tag >> 16) - getScreenX(), (m->tag & 0xFFFF) - getScreenY(),
+ (short)(m->parameter >> 16), (short)(m->parameter & 0xFFFF)))
+ {
+ BoxStack::getInstance()->update(this);
+ return;
+ }
}
}
{
return instance;
}
-
+#include <Windows.h>
// For legacy implementations
bool Video::setVideoDisplay(VideoDisplay display)
{
if (display.fallbackMode == None || display.fallbackMode == Window) return false; // No Effect
applyMode=display.fallbackMode;
}
+ MessageBox(0, "videodisplay", "videodisplay", 0);
switch (applyMode) {
case Fullscreen: {
setMode(mode);
} break;
case Quarter: {
setMode(QUARTER);
- setPosition(display.x/2, display.y/2);
+ setPosition(display.x / 2, display.y / 2);
}break;
case Eighth: {
setMode(EIGHTH);
- setPosition(display.x/2, display.y/2);
+ setPosition(display.x / 2, display.y / 2);
} break;
case Window:
case None: return false; break; //Stupid
audioon=true;
audiovolume=0;
pseudotvsize=0;
- videoposx=0;
- videoposy=0;
aud_type=Audio::MPEG2_PES;
iframemode=false;//We are not in Iframe mode at begining
vmrdeinterlacing=2;//Best
videoH264dtsfix=false;
videompeg2dtsfix=false;
+ vd.mode = Fullscreen;
+
initted = 1;
tvsize=Video::ASPECT16X9; //Internally Vomp should think we are a 16:9 TV
- videoposx=0;
- videoposy=0;
+
+ vd.mode = Fullscreen;
initFilterDatabase();
initH264FilterDatabase();
if ((tmode != NORMAL) && (tmode != LETTERBOX) && (tmode != UNKNOWN2) && (tmode != QUARTER) && (tmode != EIGHTH)
&& (tmode != ZOOM) && (tmode != UNKNOWN6)) return 0;
if (tmode==NORMAL || tmode == LETTERBOX) mode = tmode;
- videoposx=0;
- videoposy=0;
AdjustWindow();
return 1;
return 1;
}
-int VideoWin::setPosition(int x, int y)
-{
- if (!initted) return 0;
- if (mode==QUARTER || mode==EIGHTH) {
- videoposx=x;
- videoposy=y;
- }
- return 1;
-}
int VideoWin::sync()
{
int VideoWin::dsreset()
{
if (!initted) return 0;
- videoposx=0;
- videoposy=0;
iframemode=false;//exit iframe mode
CleanupDS();
virtual bool displayIFrame(const UCHAR* buffer, UINT length);
- unsigned int getPosx() {return videoposx;};
- unsigned int getPosy() {return videoposy;};
+ const VideoDisplay & getVideoDisplay() { return vd; };
bool isVideoOn() {return videoon;};
bool isdsinited() {return dsinited;};
int lastAType() {return lastaudiomode;};
int test2();
#endif
protected:
- int setPosition(int x, int y); // legacy api remove
-#error Port the new api
+ bool setVideoDisplay(VideoDisplay display) { vd = display; return true; };
+
+ VideoDisplay vd;
+
private:
int EnterIframePlayback();
UCHAR pseudotvsize;
REFERENCE_TIME lastreftimeRT;
ULLONG lastreftimePTS;
- unsigned int videoposx;
- unsigned int videoposy;
int lastaudiomode;
int audiovolume;
UCHAR aud_type;
break;
}
}
+ if (tabbar.mouseMove((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
+ {
+ BoxStack::getInstance()->update(this);
+ return;
+ }
+ }
+ else if (m->message == Message::MOUSE_SCROLL)
+ {
+ if (tabbar.mouseAndroidScroll((m->tag >> 16) - getScreenX(), (m->tag & 0xFFFF) - getScreenY(),
+ (short)(m->parameter >> 16), (short) (m->parameter & 0xFFFF)))
+ {
+ BoxStack::getInstance()->update(this);
+ return;
+ }
}
else if (m->message == Message::MOUSE_LBDOWN)
{
break;
}
}
+ if (cancel && tabbar.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY()))
+ {
+ BoxStack::getInstance()->update(this);
+ cancel = false;
+ }
if (cancel)
{
//check if press is outside this view! then simulate cancel
ypos += fontheight;
// Start
- tms = localtime((time_t*)&recTimer->startTime);
+ time_t rectime = recTimer->startTime;
+ tms = localtime((time_t*)&rectime);
strftime(buffer, 999, "%d/%m %H:%M", tms);
drawText(buffer, xpos, ypos, DrawStyle::LIGHTTEXT); ypos += fontheight;
// Stop
- tms = localtime((time_t*)&recTimer->stopTime);
+ rectime = recTimer->startTime;
+ tms = localtime((time_t*)&rectime);
strftime(buffer, 999, "%d/%m %H:%M", tms);
drawText(buffer, xpos, ypos, DrawStyle::LIGHTTEXT); ypos += fontheight;
for (UINT i = 0; i < recTimerList->size(); i++)
{
recTimer = (*recTimerList)[i];
-
- btime = localtime((time_t*)&recTimer->startTime);
+ time_t rectime = recTimer->startTime;
+ btime = localtime((time_t*)&rectime);
strftime(strA, 299, "%d/%m %H:%M ", btime);
SNPRINTF(strB, 299, "%s\t%s", strA, recTimer->getName());
sl.addOption(strB, (ULONG)recTimer, first);
{
event = (*eventList)[i];
- //btime = localtime((time_t*)&event->time);
time_t etime = event->time;
btime = localtime(&etime);
#ifndef _MSC_VER
void VVideoLiveTV::displayOSD(bool newNowNextData)
{
- (static_cast<PlayerLiveTV*>(player))->tellSubtitlesOSDVisible(true);
+ PlayerLiveTV* playerlivetv = dynamic_cast<PlayerLiveTV*>(player);
+ if (playerlivetv) playerlivetv->tellSubtitlesOSDVisible(true);
osd.setVisible(true);
if (newNowNextData)
{
draw();
boxstack->update(this);
- (static_cast<PlayerLiveTV*>(player))->tellSubtitlesOSDVisible(false);
+ PlayerLiveTV* playerlivetv = dynamic_cast<PlayerLiveTV*>(player);
+ if (playerlivetv) playerlivetv->tellSubtitlesOSDVisible(false);
}
void VVideoLiveTV::showUnavailable()
else boxstack->update(this, osd.getRegion());
Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 notkey 3.");
- (static_cast<PlayerLiveTV*>(player))->tellSubtitlesOSDVisible(false);
+ PlayerLiveTV* playerlivetv = dynamic_cast<PlayerLiveTV*>(player);
+ if (playerlivetv) playerlivetv->tellSubtitlesOSDVisible(false);
Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Timer Call 1 notkey end.");
}
}
}
+int getClockRealTime(struct timespec *tp){
+ SYSTEMTIME systime;
+ __int64 filetime;
+ __int64 test;
+ GetSystemTime(&systime);
+ SystemTimeToFileTime(&systime, (FILETIME*)&filetime);
+ tp->tv_sec = (filetime - WINDOWS_TIME_BASE_OFFSET) / (10 * 1000 * 1000);
+ tp->tv_nsec = ((filetime - WINDOWS_TIME_BASE_OFFSET) % (10 * 1000 * 1000)) * 100;
+ return 0;
+}
+
DWORD WINAPI commandthreadStart(void *arg)
{
command->run();
command->postMessageFromOuterSpace(mousemes);
}
}break;
+ case WM_MOUSEWHEEL:{
+ POINT mpos = { GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam) };
+ ClientToScreen(wind, &mpos);
+ if (TranslateMousePosition(&mpos)) {
+ Message *mousemes = new Message();
+ mousemes->message = Message::MOUSE_SCROLL;
+ mousemes->from = NULL;
+ mousemes->to = BoxStack::getInstance();
+ mousemes->parameter = (0 & 0xFFFF) << 16 | (GET_WHEEL_DELTA_WPARAM(wparam) &0xFFFF);
+ mousemes->tag = (mpos.x & 0xFFFF) << 16 | (mpos.y & 0xFFFF);
+ command->postMessageFromOuterSpace(mousemes);
+ }
+
+ } break;
default:
return DefWindowProc(wind, msg, wparam, lparam);
}
#include "log.h"
#include <math.h>
+#include <string.h>
WSelectList::WSelectList():
backgroundColour(DrawStyle::VIEWBACKGROUND)
return false;
}
+bool WTabBar::mouseAndroidScroll(int x, int y, int sx, int sy) {
+ if (tabs[visiblePane].pane->mouseAndroidScroll(x, y,sx,sy)) {
+ draw();
+ return true;
+ }
+ return false;
+}
+
bool WTabBar::mouseLBDOWN(int x, int y) {
UINT i;
for (i=0;i<tabs.size();i++) {
int handleCommand(int command);
bool mouseMove(int x, int y) ;
bool mouseLBDOWN(int x, int y);
+ bool mouseAndroidScroll(int x, int y, int sx, int sy);
void activateFocus(bool active);
private:
return 0;
}
+
+bool WTextbox::mouseAndroidScroll(int x, int y, int sx, int sy)
+{
+ if ((x - getRootBoxOffsetX()) >= 0 && (y - getRootBoxOffsetY()) >= 0
+ && (x - getRootBoxOffsetX()) <= (int)area.w && (y - getRootBoxOffsetY()) <= (int)area.h )
+ {
+ int change = -sy /120;
+ if (change < 0) {
+ int rel_change = min(cur_scroll_line, -change);
+ cur_scroll_line-=rel_change;
+ rem_scroll_line+=rel_change;
+ }
+ else if (change > 0) {
+ int rel_change = min(rem_scroll_line, change);
+ cur_scroll_line += rel_change;
+ rem_scroll_line -= rel_change;
+ }
+ return true;
+ }
+ return false;
+
+}
// if added as a pane
int handleCommand(int command);
+ bool mouseAndroidScroll(int x, int y, int sx, int sy);
private: