Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authoralexwild <alexwild@users.sourceforge.net>2007-08-24 14:15:39 +0400
committeralexwild <alexwild@users.sourceforge.net>2007-08-24 14:15:39 +0400
commite603b7143c322fbfdbe3bcd99b67a20d2168413f (patch)
tree3d743bef77659c6b09a076f9d070aa3e3ab2391f /src/ui
parentbda3da0e5fa8a468af674883d24e32431c449b76 (diff)
Logitech G15 Support, Part 1/2
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@159 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/LCDUI/LCDAnimatedBitmap.cpp163
-rw-r--r--src/ui/LCDUI/LCDAnimatedBitmap.h49
-rw-r--r--src/ui/LCDUI/LCDBase.cpp324
-rw-r--r--src/ui/LCDUI/LCDBase.h84
-rw-r--r--src/ui/LCDUI/LCDBitmap.cpp87
-rw-r--r--src/ui/LCDUI/LCDBitmap.h37
-rw-r--r--src/ui/LCDUI/LCDCollection.cpp196
-rw-r--r--src/ui/LCDUI/LCDCollection.h48
-rw-r--r--src/ui/LCDUI/LCDGfx.cpp342
-rw-r--r--src/ui/LCDUI/LCDGfx.h77
-rw-r--r--src/ui/LCDUI/LCDManager.cpp204
-rw-r--r--src/ui/LCDUI/LCDManager.h49
-rw-r--r--src/ui/LCDUI/LCDOutput.cpp822
-rw-r--r--src/ui/LCDUI/LCDOutput.h101
-rw-r--r--src/ui/LCDUI/LCDProgressBar.cpp270
-rw-r--r--src/ui/LCDUI/LCDProgressBar.h66
-rw-r--r--src/ui/LCDUI/LCDScrollingText.cpp294
-rw-r--r--src/ui/LCDUI/LCDScrollingText.h65
-rw-r--r--src/ui/LCDUI/LCDText.cpp396
-rw-r--r--src/ui/LCDUI/LCDText.h71
-rw-r--r--src/ui/LCDUI/LCDUI.sln25
-rw-r--r--src/ui/LCDUI/LCDUI.vcproj343
22 files changed, 4113 insertions, 0 deletions
diff --git a/src/ui/LCDUI/LCDAnimatedBitmap.cpp b/src/ui/LCDUI/LCDAnimatedBitmap.cpp
new file mode 100644
index 000000000..497fa40dd
--- /dev/null
+++ b/src/ui/LCDUI/LCDAnimatedBitmap.cpp
@@ -0,0 +1,163 @@
+//************************************************************************
+//
+// LCDAnimatedBitmap.cpp
+//
+// The CLCDAnimatedBitmap class draws animated bitmaps onto the LCD.
+// An animated bitmap consists of a tiled bitmap representing the
+// animation. The tile size is set with the SetSubpicWidth.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDAnimatedBitmap.h"
+
+
+//************************************************************************
+//
+// CLCDAnimatedBitmap::CLCDAnimatedBitmap
+//
+//************************************************************************
+
+CLCDAnimatedBitmap::CLCDAnimatedBitmap()
+{
+ m_dwCurrSubpic = m_dwTotalSubpics = 0;
+}
+
+
+//************************************************************************
+//
+// CLCDAnimatedBitmap::CLCDAnimatedBitmap
+//
+//************************************************************************
+
+CLCDAnimatedBitmap::~CLCDAnimatedBitmap()
+{
+
+}
+
+
+//************************************************************************
+//
+// CLCDAnimatedBitmap::Initialize
+//
+//************************************************************************
+
+HRESULT CLCDAnimatedBitmap::Initialize(void)
+{
+ m_dwRate = 250;
+ m_dwElapsedTime = 0;
+ m_dwLastUpdate = GetTickCount();
+
+ return CLCDBitmap::Initialize();
+}
+
+
+//************************************************************************
+//
+// CLCDAnimatedBitmap::ResetUpdate
+//
+//************************************************************************
+
+void CLCDAnimatedBitmap::ResetUpdate(void)
+{
+ m_dwCurrSubpic = 0;
+ m_dwLastUpdate = GetTickCount();
+}
+
+
+//************************************************************************
+//
+// CLCDAnimatedBitmap::SetSubpicWidth
+//
+//************************************************************************
+
+void CLCDAnimatedBitmap::SetSubpicWidth(DWORD dwWidth)
+{
+ m_dwSubpicWidth = dwWidth;
+ LCDUIASSERT(NULL != m_hBitmap);
+ LCDUIASSERT(0 != dwWidth);
+ if((NULL != m_hBitmap) && (0 != dwWidth))
+ {
+ // figure out how many tiles we have
+ BITMAP bitmap;
+ if(GetObject(m_hBitmap, sizeof(bitmap), &bitmap))
+ {
+ m_dwTotalSubpics = bitmap.bmWidth / dwWidth;
+ SetLogicalSize(bitmap.bmWidth, bitmap.bmHeight);
+ }
+ else
+ {
+ m_dwTotalSubpics = 0;
+ }
+ }
+ else
+ {
+ m_dwTotalSubpics = 0;
+ }
+}
+
+//************************************************************************
+//
+// CLCDAnimatedBitmap::SetAnimationRate
+//
+//************************************************************************
+
+void CLCDAnimatedBitmap::SetAnimationRate(DWORD dwRate)
+{
+ m_dwRate = dwRate;
+}
+
+
+//************************************************************************
+//
+// CLCDAnimatedBitmap::OnUpdate
+//
+//************************************************************************
+
+void CLCDAnimatedBitmap::OnUpdate(DWORD dwTimestamp)
+{
+ m_dwElapsedTime = (dwTimestamp - m_dwLastUpdate);
+}
+
+
+//************************************************************************
+//
+// CLCDAnimatedBitmap::OnDraw
+//
+//************************************************************************
+
+void CLCDAnimatedBitmap::OnDraw(CLCDGfx &rGfx)
+{
+ if(m_dwTotalSubpics > 0)
+ {
+ int xoffs = m_dwCurrSubpic * m_dwSubpicWidth;
+
+ DWORD increment = m_dwElapsedTime / m_dwRate;
+ if(increment > 0)
+ {
+ m_dwCurrSubpic += increment;
+ m_dwCurrSubpic %= m_dwTotalSubpics;
+ m_dwElapsedTime %= m_dwRate;
+ m_dwLastUpdate = GetTickCount();
+ }
+
+ // stolen from: CLCDBitmap::OnDraw(rGfx);
+ if(m_hBitmap)
+ {
+ HDC hCompatibleDC = CreateCompatibleDC(rGfx.GetHDC());
+ HBITMAP hOldBitmap = (HBITMAP)SelectObject(hCompatibleDC, m_hBitmap);
+
+ // get
+ BitBlt(rGfx.GetHDC(), 0, 0, m_Size.cx, m_Size.cy, hCompatibleDC, xoffs, 0, m_dwROP);
+
+ // restores
+ SelectObject(hCompatibleDC, hOldBitmap);
+ DeleteDC(hCompatibleDC);
+ }
+ }
+}
+
+
+//** end of LCDAnimatedBitmap.cpp ****************************************
diff --git a/src/ui/LCDUI/LCDAnimatedBitmap.h b/src/ui/LCDUI/LCDAnimatedBitmap.h
new file mode 100644
index 000000000..492959cd1
--- /dev/null
+++ b/src/ui/LCDUI/LCDAnimatedBitmap.h
@@ -0,0 +1,49 @@
+//************************************************************************
+//
+// LCDAnimatedBitmap.h
+//
+// The CLCDAnimatedBitmap class draws animated bitmaps onto the LCD.
+// An animated bitmap consists of a tiled bitmap representing the
+// animation. The tile size is set with the SetSubpicWidth.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDANIMATEDBITMAP_H_INCLUDED_
+#define _LCDANIMATEDBITMAP_H_INCLUDED_
+
+#include "LCDBase.h"
+#include "LCDBitmap.h"
+
+class CLCDAnimatedBitmap : public CLCDBitmap
+{
+public:
+ CLCDAnimatedBitmap();
+ virtual ~CLCDAnimatedBitmap();
+
+ virtual HRESULT Initialize(void);
+ virtual void ResetUpdate(void);
+
+ void SetSubpicWidth(DWORD dwWidth);
+ void SetAnimationRate(DWORD dwRate); // milliseconds/subpicture
+
+protected:
+ virtual void OnUpdate(DWORD dwTimestamp);
+ virtual void OnDraw(CLCDGfx &rGfx);
+
+private:
+ DWORD m_dwElapsedTime; // elapsed time in state
+ DWORD m_dwRate; // milliseconds per subpicture
+ DWORD m_dwLastUpdate; // milliseconds
+
+ DWORD m_dwSubpicWidth;
+ DWORD m_dwCurrSubpic;
+ DWORD m_dwTotalSubpics;
+};
+
+
+#endif // !_LCDANIMATEDBITMAP_H_INCLUDED_
+
+//** end of LCDBitmap.h **************************************************
diff --git a/src/ui/LCDUI/LCDBase.cpp b/src/ui/LCDUI/LCDBase.cpp
new file mode 100644
index 000000000..4b4c585d9
--- /dev/null
+++ b/src/ui/LCDUI/LCDBase.cpp
@@ -0,0 +1,324 @@
+//************************************************************************
+//
+// LCDBase.cpp
+//
+// The CLCDBase class is the generic base class for all lcd ui objects
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDBase.h"
+
+
+//************************************************************************
+//
+// CLCDBase::CLCDBase
+//
+//************************************************************************
+
+CLCDBase::CLCDBase(void)
+{
+ m_Size.cx = 0;
+ m_Size.cy = 0;
+ m_Origin.x = 0;
+ m_Origin.y = 0;
+ m_bVisible = TRUE;
+ m_bInverted = FALSE;
+ ZeroMemory(&m_ptLogical, sizeof(m_ptLogical));
+ ZeroMemory(&m_sizeLogical, sizeof(m_sizeLogical));
+ m_nBkMode = TRANSPARENT;
+ m_objectType = LG_UNKNOWN;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::~CLCDBase
+//
+//************************************************************************
+
+CLCDBase::~CLCDBase(void)
+{
+}
+
+
+//************************************************************************
+//
+// CLCDBase::Initialize
+//
+//************************************************************************
+
+HRESULT CLCDBase::Initialize(void)
+{
+ return S_OK;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::Shutdown
+//
+//************************************************************************
+
+void CLCDBase::Shutdown(void)
+{
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetOrigin
+//
+//************************************************************************
+
+void CLCDBase::SetOrigin(POINT pt)
+{
+ m_Origin = pt;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetOrigin
+//
+//************************************************************************
+
+void CLCDBase::SetOrigin(int nX, int nY)
+{
+ POINT pt = { nX, nY };
+ SetOrigin(pt);
+}
+
+
+//************************************************************************
+//
+// CLCDBase::GetOrigin
+//
+//************************************************************************
+
+POINT& CLCDBase::GetOrigin(void)
+{
+ return m_Origin;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetSize
+//
+//************************************************************************
+
+void CLCDBase::SetSize(SIZE& size)
+{
+ m_Size = size;
+ SetLogicalSize(m_Size);
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetSize
+//
+//************************************************************************
+
+void CLCDBase::SetSize(int nCX, int nCY)
+{
+ SIZE size = { nCX, nCY };
+ SetSize(size);
+}
+
+
+//************************************************************************
+//
+// CLCDBase::GetSize
+//
+//************************************************************************
+
+SIZE& CLCDBase::GetSize(void)
+{
+ return m_Size;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetLogicalOrigin
+//
+//************************************************************************
+
+void CLCDBase::SetLogicalOrigin(POINT& pt)
+{
+ m_ptLogical = pt;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetLogicalOrigin
+//
+//************************************************************************
+
+void CLCDBase::SetLogicalOrigin(int nX, int nY)
+{
+ m_ptLogical.x = nX;
+ m_ptLogical.y = nY;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::GetLogicalOrigin
+//
+//************************************************************************
+
+POINT& CLCDBase::GetLogicalOrigin(void)
+{
+ return m_ptLogical;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetLogicalSize
+//
+//************************************************************************
+
+void CLCDBase::SetLogicalSize(SIZE& size)
+{
+ m_sizeLogical = size;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetLogicalSize
+//
+//************************************************************************
+
+void CLCDBase::SetLogicalSize(int nCX, int nCY)
+{
+ m_sizeLogical.cx = nCX;
+ m_sizeLogical.cy = nCY;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::GetLogicalSize
+//
+//************************************************************************
+
+SIZE& CLCDBase::GetLogicalSize(void)
+{
+ return m_sizeLogical;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::Show
+//
+//************************************************************************
+
+void CLCDBase::Show(BOOL bShow)
+{
+ m_bVisible = bShow;
+}
+
+
+//************************************************************************
+//
+// BOOL CLCDBase::
+//
+//************************************************************************
+
+BOOL CLCDBase::IsVisible(void)
+{
+ return m_bVisible;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::Invert
+//
+//************************************************************************
+
+void CLCDBase::Invert(BOOL bEnable)
+{
+ m_bInverted = bEnable;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::ResetUpdate
+//
+//************************************************************************
+
+void CLCDBase::ResetUpdate(void)
+{
+ // do nothing
+}
+
+
+//************************************************************************
+//
+// CLCDBase::OnUpdate
+//
+//************************************************************************
+
+void CLCDBase::OnUpdate(DWORD dwTimestamp)
+{
+ UNREFERENCED_PARAMETER(dwTimestamp);
+}
+
+
+//************************************************************************
+//
+// CLCDBase::SetBackgroundMode
+//
+//************************************************************************
+
+void CLCDBase::SetBackgroundMode(int nMode)
+{
+ m_nBkMode = nMode;
+}
+
+
+//************************************************************************
+//
+// CLCDBase::GetBackgroundMode
+//
+//************************************************************************
+
+int CLCDBase::GetBackgroundMode()
+{
+ return m_nBkMode;
+}
+
+//************************************************************************
+//
+// CLCDBase::GetObjectType
+//
+//************************************************************************
+
+const LGObjectType CLCDBase::GetObjectType()
+{
+ return m_objectType;
+}
+
+//************************************************************************
+//
+// CLCDBase::SetObjectType
+//
+//************************************************************************
+
+void CLCDBase::SetObjectType(const LGObjectType type)
+{
+ m_objectType = type;
+}
+
+//** end of LCDBase.cpp **************************************************
diff --git a/src/ui/LCDUI/LCDBase.h b/src/ui/LCDUI/LCDBase.h
new file mode 100644
index 000000000..dbf677cc7
--- /dev/null
+++ b/src/ui/LCDUI/LCDBase.h
@@ -0,0 +1,84 @@
+//************************************************************************
+//
+// LCDBase.h
+//
+// The CLCDBase class is the generic base class for all lcd ui objects
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDBASE_H_INCLUDED_
+#define _LCDBASE_H_INCLUDED_
+
+#include "LCDGfx.h"
+
+
+typedef enum
+{
+ LG_SCROLLING_TEXT, LG_STATIC_TEXT, LG_ICON, LG_PROGRESS_BAR, LG_UNKNOWN
+} LGObjectType;
+
+class CLCDBase
+{
+public:
+ CLCDBase(void);
+ virtual ~CLCDBase(void);
+
+public:
+ virtual HRESULT Initialize(void);
+ virtual void Shutdown(void);
+
+ virtual void SetOrigin(POINT pt);
+ virtual void SetOrigin(int nX, int nY);
+ virtual POINT& GetOrigin(void);
+
+ virtual void SetSize(SIZE& size);
+ virtual void SetSize(int nCX, int nCY);
+ virtual SIZE& GetSize(void);
+
+ virtual int GetWidth(void) { return GetSize().cx; }
+ virtual int GetHeight(void) { return GetSize().cy; };
+
+ virtual void Show(BOOL bShow);
+ virtual BOOL IsVisible();
+
+ virtual void Invert(BOOL bEnable);
+ virtual void ResetUpdate(void);
+
+ // local coordinates
+ virtual void SetLogicalOrigin(POINT& rLogical);
+ virtual void SetLogicalOrigin(int nX, int nY);
+ virtual POINT& GetLogicalOrigin(void);
+ virtual void SetLogicalSize(SIZE& size);
+ virtual void SetLogicalSize(int nCX, int nCY);
+ virtual SIZE& GetLogicalSize(void);
+
+ virtual void SetBackgroundMode(int nMode);
+ virtual int GetBackgroundMode();
+
+ virtual const LGObjectType GetObjectType();
+ virtual void SetObjectType(const LGObjectType type);
+
+public:
+ virtual void OnDraw(CLCDGfx &rGfx) = 0;
+ virtual void OnUpdate(DWORD dwTimestamp);
+
+protected:
+ SIZE m_Size;
+ POINT m_Origin;
+ BOOL m_bVisible;
+ BOOL m_bInverted;
+
+ POINT m_ptLogical;
+ SIZE m_sizeLogical;
+ int m_nBkMode;
+
+ LGObjectType m_objectType;
+};
+
+
+#endif // !_LCDBASE_H_INCLUDED_
+
+//** end of LCDBase.h ****************************************************
diff --git a/src/ui/LCDUI/LCDBitmap.cpp b/src/ui/LCDUI/LCDBitmap.cpp
new file mode 100644
index 000000000..559a88a5b
--- /dev/null
+++ b/src/ui/LCDUI/LCDBitmap.cpp
@@ -0,0 +1,87 @@
+//************************************************************************
+//
+// LCDBitmap.cpp
+//
+// The CLCDBitmap class draws bitmaps onto the LCD.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDBitmap.h"
+
+
+//************************************************************************
+//
+// CLCDBitmap::CLCDBitmap
+//
+//************************************************************************
+
+CLCDBitmap::CLCDBitmap()
+{
+ m_hBitmap = NULL;
+ m_dwROP = SRCCOPY;
+}
+
+
+//************************************************************************
+//
+// CLCDBitmap::CLCDBitmap
+//
+//************************************************************************
+
+CLCDBitmap::~CLCDBitmap()
+{
+
+}
+
+
+//************************************************************************
+//
+// CLCDBitmap::SetBitmap
+//
+//************************************************************************
+
+void CLCDBitmap::SetBitmap(HBITMAP hBitmap)
+{
+ LCDUIASSERT(NULL != hBitmap);
+ m_hBitmap = hBitmap;
+}
+
+
+//************************************************************************
+//
+// CLCDBitmap::SetBitmap
+//
+//************************************************************************
+
+void CLCDBitmap::SetROP(DWORD dwROP)
+{
+ m_dwROP = dwROP;
+}
+
+
+//************************************************************************
+//
+// CLCDBitmap::OnDraw
+//
+//************************************************************************
+
+void CLCDBitmap::OnDraw(CLCDGfx &rGfx)
+{
+ if(m_hBitmap)
+ {
+ HDC hCompatibleDC = CreateCompatibleDC(rGfx.GetHDC());
+ HBITMAP hOldBitmap = (HBITMAP)SelectObject(hCompatibleDC, m_hBitmap);
+
+ BitBlt(rGfx.GetHDC(), 0, 0, m_Size.cx, m_Size.cy, hCompatibleDC, m_ptLogical.x, m_ptLogical.y, m_dwROP);
+
+ // restores
+ SelectObject(hCompatibleDC, hOldBitmap);
+ DeleteDC(hCompatibleDC);
+ }
+}
+
+
+//** end of LCDBitmap.cpp ************************************************
diff --git a/src/ui/LCDUI/LCDBitmap.h b/src/ui/LCDUI/LCDBitmap.h
new file mode 100644
index 000000000..1ac1a6103
--- /dev/null
+++ b/src/ui/LCDUI/LCDBitmap.h
@@ -0,0 +1,37 @@
+//************************************************************************
+//
+// LCDBitmap.h
+//
+// The CLCDBitmap class draws bitmaps onto the LCD.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDBITMAP_H_INCLUDED_
+#define _LCDBITMAP_H_INCLUDED_
+
+#include "LCDBase.h"
+
+class CLCDBitmap : public CLCDBase
+{
+public:
+ CLCDBitmap();
+ virtual ~CLCDBitmap();
+
+ void SetBitmap(HBITMAP hBitmap);
+ void SetROP(DWORD dwROP);
+
+protected:
+ virtual void OnDraw(CLCDGfx &rGfx);
+ HBITMAP m_hBitmap;
+ DWORD m_dwROP;
+
+private:
+};
+
+
+#endif // !_LCDBITMAP_H_INCLUDED_
+
+//** end of LCDBitmap.h **************************************************
diff --git a/src/ui/LCDUI/LCDCollection.cpp b/src/ui/LCDUI/LCDCollection.cpp
new file mode 100644
index 000000000..edba28599
--- /dev/null
+++ b/src/ui/LCDUI/LCDCollection.cpp
@@ -0,0 +1,196 @@
+//************************************************************************
+//
+// LCDCollection.cpp
+//
+// The CLCDCollection class is a generic collection of CLCDBase objects.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDCollection.h"
+
+
+//************************************************************************
+//
+// CLCDCollection::CLCDCollection
+//
+//************************************************************************
+
+CLCDCollection::CLCDCollection(void)
+{
+}
+
+
+//************************************************************************
+//
+// CLCDCollection::~CLCDCollection
+//
+//************************************************************************
+
+CLCDCollection::~CLCDCollection(void)
+{
+}
+
+
+//************************************************************************
+//
+// CLCDCollection::AddObject
+//
+//************************************************************************
+
+BOOL CLCDCollection::AddObject(CLCDBase* pObject)
+{
+ //TODO: handle addition of same object twice...
+ m_Objects.push_back(pObject);
+ return TRUE;
+}
+
+
+//************************************************************************
+//
+// CLCDCollection::RemoveObject
+//
+//************************************************************************
+
+BOOL CLCDCollection::RemoveObject(CLCDBase* pObject)
+{
+ LCD_OBJECT_LIST::iterator it = m_Objects.begin();
+ while(it != m_Objects.end())
+ {
+ if (*it == pObject)
+ {
+ m_Objects.erase(it);
+ break;
+ }
+ ++it;
+ }
+ return FALSE;
+}
+
+
+//************************************************************************
+//
+// CLCDCollection::OnDraw
+//
+//************************************************************************
+
+void CLCDCollection::OnDraw(CLCDGfx &rGfx)
+{
+ LCD_OBJECT_LIST::iterator it = m_Objects.begin();
+ while(it != m_Objects.end())
+ {
+ CLCDBase *pObject = *it;
+ LCDUIASSERT(NULL != pObject);
+
+ if (!pObject->IsVisible())
+ {
+ ++it;
+ continue;
+ }
+
+ // create the clip region
+ HRGN hRgn = CreateRectRgn(pObject->GetOrigin().x, pObject->GetOrigin().y,
+ pObject->GetOrigin().x + pObject->GetWidth(),
+ pObject->GetOrigin().y + pObject->GetHeight());
+
+ // ensure that controls only draw within their specified region
+ SelectClipRgn(rGfx.GetHDC(), hRgn);
+
+ // free the region (a copy is used in the call above)
+ DeleteObject(hRgn);
+
+ // offset the control at its origin so controls use (0,0)
+ POINT ptPrevViewportOrg = { 0, 0 };
+ SetViewportOrgEx(rGfx.GetHDC(),
+ pObject->GetOrigin().x,
+ pObject->GetOrigin().y,
+ &ptPrevViewportOrg);
+
+ // allow controls to supply additional translation
+ // this allows controls to move freely within the confined viewport
+ OffsetViewportOrgEx(rGfx.GetHDC(),
+ pObject->GetLogicalOrigin().x,
+ pObject->GetLogicalOrigin().y,
+ NULL);
+
+ pObject->OnDraw(rGfx);
+
+ // set the clipping region to nothing
+ SelectClipRgn(rGfx.GetHDC(), NULL);
+
+ // restore the viewport origin
+ SetViewportOrgEx(rGfx.GetHDC(),
+ ptPrevViewportOrg.x,
+ ptPrevViewportOrg.y,
+ NULL);
+
+ // restore the viewport origin offset
+ OffsetViewportOrgEx(rGfx.GetHDC(), 0, 0, NULL);
+
+ ++it;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDCollection::OnUpdate
+//
+//************************************************************************
+
+void CLCDCollection::OnUpdate(DWORD dwTimestamp)
+{
+ LCD_OBJECT_LIST::iterator it = m_Objects.begin();
+ while(it != m_Objects.end())
+ {
+ CLCDBase *pObject = *it;
+ LCDUIASSERT(NULL != pObject);
+ pObject->OnUpdate(dwTimestamp);
+ ++it;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDCollection::ResetUpdate
+//
+//************************************************************************
+
+void CLCDCollection::ResetUpdate(void)
+{
+ LCD_OBJECT_LIST::iterator it = m_Objects.begin();
+ while(it != m_Objects.end())
+ {
+ CLCDBase *pObject = *it;
+ LCDUIASSERT(NULL != pObject);
+ pObject->ResetUpdate();
+ ++it;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDCollection::Show
+//
+//************************************************************************
+
+void CLCDCollection::Show(BOOL bShow)
+{
+ LCD_OBJECT_LIST::iterator it = m_Objects.begin();
+ while(it != m_Objects.end())
+ {
+ CLCDBase *pObject = *it;
+ LCDUIASSERT(NULL != pObject);
+ pObject->Show(bShow);
+ ++it;
+ }
+
+ CLCDBase::Show(bShow);
+}
+
+
+//** end of LCDCollection.cpp ********************************************
diff --git a/src/ui/LCDUI/LCDCollection.h b/src/ui/LCDUI/LCDCollection.h
new file mode 100644
index 000000000..0f4547222
--- /dev/null
+++ b/src/ui/LCDUI/LCDCollection.h
@@ -0,0 +1,48 @@
+//************************************************************************
+//
+// LCDCollection.h
+//
+// The CLCDCollection class is a generic collection of CLCDBase objects.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDCOLLECTION_H_INCLUDED_
+#define _LCDCOLLECTION_H_INCLUDED_
+
+#include "LCDBase.h"
+
+
+#include <list>
+using namespace std;
+typedef list <CLCDBase*> LCD_OBJECT_LIST;
+typedef LCD_OBJECT_LIST::iterator LCD_OBJECT_LIST_ITER;
+
+
+class CLCDCollection : public CLCDBase
+{
+public:
+ CLCDCollection();
+ virtual ~CLCDCollection();
+
+ // collection objects use relative origin
+ BOOL AddObject(CLCDBase* pObject);
+ BOOL RemoveObject(CLCDBase* pObject);
+
+ virtual void ResetUpdate(void);
+ virtual void Show(BOOL bShow);
+
+public:
+ virtual void OnDraw(CLCDGfx &rGfx);
+ virtual void OnUpdate(DWORD dwTimestamp);
+
+protected:
+ LCD_OBJECT_LIST m_Objects;
+};
+
+
+#endif // !_LCDCOLLECTION_H_INCLUDED_
+
+//** end of LCDCollection.h **********************************************
diff --git a/src/ui/LCDUI/LCDGfx.cpp b/src/ui/LCDUI/LCDGfx.cpp
new file mode 100644
index 000000000..480a27793
--- /dev/null
+++ b/src/ui/LCDUI/LCDGfx.cpp
@@ -0,0 +1,342 @@
+//************************************************************************
+//
+// LCDGfx.cpp
+//
+// The CLCDGfx class abstracts GDI/bitmap details. It is used in the
+// OnDraw event.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDGfx.h"
+
+
+//************************************************************************
+//
+// CLCDGfx::CLCDGfx
+//
+//************************************************************************
+
+CLCDGfx::CLCDGfx(void)
+: m_nWidth(0),
+ m_nHeight(0),
+ m_pLCDScreen(NULL),
+ m_pBitmapInfo(NULL),
+ m_hDC(NULL),
+ m_hBitmap(NULL),
+ m_hPrevBitmap(NULL),
+ m_pBitmapBits(NULL)
+{
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::~CLCDGfx
+//
+//************************************************************************
+
+CLCDGfx::~CLCDGfx(void)
+{
+ Shutdown();
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::Initialize
+//
+//************************************************************************
+
+HRESULT CLCDGfx::Initialize(int nWidth, int nHeight)
+{
+ m_nWidth = nWidth;
+ m_nHeight = nHeight;
+
+ m_hDC = CreateCompatibleDC(NULL);
+ if(NULL == m_hDC)
+ {
+ LCDUITRACE(_T("CLCDGfx::Initialize(): failed to create compatible DC.\n"));
+ Shutdown();
+ return E_FAIL;
+ }
+
+ int nBMISize = sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD);
+ m_pBitmapInfo = (BITMAPINFO *) new BYTE [nBMISize];
+ if(NULL == m_pBitmapInfo)
+ {
+ LCDUITRACE(_T("CLCDGfx::Initialize(): failed to allocate bitmap info.\n"));
+ Shutdown();
+ return E_OUTOFMEMORY;
+ }
+
+ ZeroMemory(m_pBitmapInfo, nBMISize);
+ m_pBitmapInfo->bmiHeader.biSize = sizeof(m_pBitmapInfo->bmiHeader);
+ m_pBitmapInfo->bmiHeader.biWidth = m_nWidth;
+ m_pBitmapInfo->bmiHeader.biHeight = -m_nHeight;
+ m_pBitmapInfo->bmiHeader.biPlanes = 1;
+ m_pBitmapInfo->bmiHeader.biBitCount = 8;
+ m_pBitmapInfo->bmiHeader.biCompression = BI_RGB;
+ m_pBitmapInfo->bmiHeader.biSizeImage =
+ (m_nWidth *
+ m_nHeight *
+ m_pBitmapInfo->bmiHeader.biBitCount) / 8;
+ m_pBitmapInfo->bmiHeader.biXPelsPerMeter = 3200;
+ m_pBitmapInfo->bmiHeader.biYPelsPerMeter = 3200;
+ m_pBitmapInfo->bmiHeader.biClrUsed = 256;
+ m_pBitmapInfo->bmiHeader.biClrImportant = 256;
+
+ for(int nColor = 0; nColor < 256; ++nColor)
+ {
+ m_pBitmapInfo->bmiColors[nColor].rgbRed = (BYTE)((nColor > 128) ? 255 : 0);
+ m_pBitmapInfo->bmiColors[nColor].rgbGreen = (BYTE)((nColor > 128) ? 255 : 0);
+ m_pBitmapInfo->bmiColors[nColor].rgbBlue = (BYTE)((nColor > 128) ? 255 : 0);
+ m_pBitmapInfo->bmiColors[nColor].rgbReserved = 0;
+ }
+
+ m_hBitmap = CreateDIBSection(m_hDC, m_pBitmapInfo, DIB_RGB_COLORS, (PVOID *) &m_pBitmapBits, NULL, 0);
+ if(NULL == m_hBitmap)
+ {
+ LCDUITRACE(_T("CLCDGfx::Initialize(): failed to create bitmap.\n"));
+ Shutdown();
+ return E_FAIL;
+ }
+
+ m_pLCDScreen = new lgLcdBitmap160x43x1;
+ if(NULL == m_pLCDScreen)
+ {
+ LCDUITRACE(_T("CLCDGfx::Initialize(): failed to allocate the lcd screen structure.\n"));
+ Shutdown();
+ return E_OUTOFMEMORY;
+ }
+
+ return S_OK;
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::Shutdown
+//
+//************************************************************************
+
+void CLCDGfx::Shutdown(void)
+{
+ if(NULL != m_pLCDScreen)
+ {
+ delete m_pLCDScreen;
+ m_pLCDScreen = NULL;
+ }
+
+ if(NULL != m_hBitmap)
+ {
+ DeleteObject(m_hBitmap);
+ m_hBitmap = NULL;
+ m_pBitmapBits = NULL;
+ }
+
+ LCDUIASSERT(NULL == m_hPrevBitmap);
+ m_hPrevBitmap = NULL;
+
+ if(NULL != m_pBitmapInfo)
+ {
+ delete [] m_pBitmapInfo;
+ m_pBitmapInfo = NULL;
+ }
+
+ if(NULL != m_hDC)
+ {
+ DeleteDC(m_hDC);
+ m_hDC = NULL;
+ }
+
+ m_nWidth = 0;
+ m_nHeight = 0;
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::BeginDraw
+//
+//************************************************************************
+
+void CLCDGfx::BeginDraw(void)
+{
+ LCDUIASSERT(NULL != m_hBitmap);
+ LCDUIASSERT(NULL == m_hPrevBitmap);
+ if(NULL == m_hPrevBitmap)
+ {
+ m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hBitmap);
+ SetTextColor(m_hDC, RGB(255, 255, 255));
+ SetBkColor(m_hDC, RGB(0, 0, 0));
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::ClearScreen
+//
+//************************************************************************
+
+void CLCDGfx::ClearScreen(void)
+{
+ // this means, we're inside BeginDraw()/EndDraw()
+ LCDUIASSERT(NULL != m_hPrevBitmap);
+ RECT rc = { 0, 0, m_nWidth, m_nHeight };
+ FillRect(m_hDC, &rc, (HBRUSH) GetStockObject(BLACK_BRUSH));
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::SetPixel
+//
+//************************************************************************
+
+void CLCDGfx::SetPixel(int nX, int nY, BYTE bValue)
+{
+ // this means, we're inside BeginDraw()/EndDraw()
+ LCDUIASSERT(NULL != m_hPrevBitmap);
+ ::SetPixel(m_hDC, nX, nY, bValue ? RGB(255, 255, 255) : RGB(0, 0, 0));
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::DrawLine
+//
+//************************************************************************
+
+void CLCDGfx::DrawLine(int nX1, int nY1, int nX2, int nY2)
+{
+ // this means, we're inside BeginDraw()/EndDraw()
+ LCDUIASSERT(NULL != m_hPrevBitmap);
+
+ HPEN hPrevPen = (HPEN) SelectObject(m_hDC, GetStockObject(WHITE_PEN));
+ ::MoveToEx(m_hDC, nX1, nY1, NULL);
+ ::LineTo(m_hDC, nX2, nY2);
+ SelectObject(m_hDC, hPrevPen);
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::DrawFilledRect
+//
+//************************************************************************
+
+void CLCDGfx::DrawFilledRect(int nX, int nY, int nWidth, int nHeight)
+{
+ // this means, we're inside BeginDraw()/EndDraw()
+ LCDUIASSERT(NULL != m_hPrevBitmap);
+
+ HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH));
+ RECT r = { nX, nY, nX + nWidth, nY + nHeight };
+ ::FillRect(m_hDC, &r, hPrevBrush);
+ SelectObject(m_hDC, hPrevBrush);
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::DrawText
+//
+//************************************************************************
+
+void CLCDGfx::DrawText(int nX, int nY, LPCTSTR sText)
+{
+ // map mode text, with transparency
+ int nOldMapMode = SetMapMode(m_hDC, MM_TEXT);
+ int nOldBkMode = SetBkMode(m_hDC, TRANSPARENT);
+
+ ::TextOut(m_hDC, nX, nY, sText, (int)_tcslen(sText));
+
+ // restores
+ SetMapMode(m_hDC, nOldMapMode);
+ SetBkMode(m_hDC, nOldBkMode);
+
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::EndDraw
+//
+//************************************************************************
+
+void CLCDGfx::EndDraw(void)
+{
+ LCDUIASSERT(NULL != m_hPrevBitmap);
+ if(NULL != m_hPrevBitmap)
+ {
+ GdiFlush();
+ m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hPrevBitmap);
+ LCDUIASSERT(m_hPrevBitmap == m_hBitmap);
+ m_hPrevBitmap = NULL;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::GetHDC
+//
+//************************************************************************
+
+HDC CLCDGfx::GetHDC(void)
+{
+ LCDUIASSERT(NULL != m_hDC);
+ return m_hDC;
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::GetLCDScreen
+//
+//************************************************************************
+
+lgLcdBitmap160x43x1 *CLCDGfx::GetLCDScreen(void)
+{
+ LCDUIASSERT(NULL != m_pLCDScreen);
+ if(NULL != m_pLCDScreen)
+ {
+ m_pLCDScreen->hdr.Format = LGLCD_BMP_FORMAT_160x43x1;
+ memcpy(m_pLCDScreen->pixels, m_pBitmapBits, m_nWidth * m_nHeight);
+ }
+
+ return m_pLCDScreen;
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::GetBitmapInfo
+//
+//************************************************************************
+
+BITMAPINFO *CLCDGfx::GetBitmapInfo(void)
+{
+ LCDUIASSERT(NULL != m_pBitmapInfo);
+ return m_pBitmapInfo;
+}
+
+
+//************************************************************************
+//
+// CLCDGfx::GetHBITMAP
+//
+//************************************************************************
+
+HBITMAP CLCDGfx::GetHBITMAP(void)
+{
+ LCDUIASSERT(NULL != m_hBitmap);
+ return m_hBitmap;
+}
+
+
+//** end of LCDGfx.cpp ***************************************************
diff --git a/src/ui/LCDUI/LCDGfx.h b/src/ui/LCDUI/LCDGfx.h
new file mode 100644
index 000000000..09bde311b
--- /dev/null
+++ b/src/ui/LCDUI/LCDGfx.h
@@ -0,0 +1,77 @@
+//************************************************************************
+//
+// LCDGfx.h
+//
+// The CLCDGfx class abstracts GDI/bitmap details. It is used in the
+// OnDraw event.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDGFX_H_INCLUDED_
+#define _LCDGFX_H_INCLUDED_
+
+#include <windows.h>
+#include <tchar.h>
+#include <lglcd/lglcd.h>
+
+
+#ifndef LCDUITRACE
+ // .NET compiler uses __noop intrinsic
+ #if _MSC_VER > 1300
+ #define LCDUITRACE __noop
+ #else
+ #define LCDUITRACE (void)0
+ #endif
+#endif
+
+#ifndef LCDUIASSERT
+ // .NET compiler uses __noop intrinsic
+ #if _MSC_VER > 1300
+ #define LCDUIASSERT __noop
+ #else
+ #define LCDUIASSERT (void)0
+ #endif
+#endif
+
+
+
+class CLCDGfx
+{
+public:
+ CLCDGfx(void);
+ virtual ~CLCDGfx(void);
+
+ HRESULT Initialize(int nWidth, int nHeight);
+ void Shutdown(void);
+
+ void BeginDraw(void);
+ void ClearScreen(void);
+ void SetPixel(int nX, int nY, BYTE bValue);
+ void DrawLine(int nX1, int nY1, int nX2, int nY2);
+ void DrawFilledRect(int nX, int nY, int nWidth, int nHeight);
+ void DrawText(int nX, int nY, LPCTSTR sText);
+ void EndDraw(void);
+
+ HDC GetHDC(void);
+ lgLcdBitmap160x43x1 *GetLCDScreen(void);
+ BITMAPINFO *GetBitmapInfo(void);
+ HBITMAP GetHBITMAP(void);
+
+protected:
+ int m_nWidth;
+ int m_nHeight;
+ lgLcdBitmap160x43x1 *m_pLCDScreen;
+ BITMAPINFO *m_pBitmapInfo;
+ HDC m_hDC;
+ HBITMAP m_hBitmap;
+ HBITMAP m_hPrevBitmap;
+ PBYTE m_pBitmapBits;
+};
+
+
+#endif // !_LCDGFX_H_INCLUDED_
+
+//** end of LCDGfx.h *****************************************************
diff --git a/src/ui/LCDUI/LCDManager.cpp b/src/ui/LCDUI/LCDManager.cpp
new file mode 100644
index 000000000..3d83b9165
--- /dev/null
+++ b/src/ui/LCDUI/LCDManager.cpp
@@ -0,0 +1,204 @@
+//************************************************************************
+//
+// LCDManager.cpp
+//
+// The CLCDManager class is the representation of a "Screen". LCD UI class
+// objects are added here.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDManager.h"
+
+
+//************************************************************************
+//
+// CLCDManager::CLCDManager
+//
+//************************************************************************
+
+CLCDManager::CLCDManager(void)
+{
+ m_dwElapsedTime = 0;
+ m_dwExpirationTime = 0;
+ m_dwStartTime = 0;
+}
+
+
+//************************************************************************
+//
+// CLCDManager::~CLCDManager
+//
+//************************************************************************
+
+CLCDManager::~CLCDManager(void)
+{
+ Shutdown();
+}
+
+
+//************************************************************************
+//
+// CLCDManager::Initialize
+//
+//************************************************************************
+
+HRESULT CLCDManager::Initialize(void)
+{
+ HRESULT hRes = CLCDCollection::Initialize();
+ if(FAILED(hRes))
+ {
+ LCDUITRACE(_T("CLCDManager::Initialize(): failed to initialize base class.\n"));
+ Shutdown();
+ return hRes;
+ }
+
+ SetOrigin(0, 0);
+ SetSize(LGLCD_BMP_WIDTH, LGLCD_BMP_HEIGHT);
+
+ hRes = m_Gfx.Initialize(GetWidth(), GetHeight());
+ if(FAILED(hRes))
+ {
+ LCDUITRACE(_T("CLCDManager::Initialize(): failed to initialize graphics component.\n"));
+ Shutdown();
+ return hRes;
+ }
+
+ return S_OK;
+}
+
+
+//************************************************************************
+//
+// CLCDManager::Shutdown
+//
+//************************************************************************
+
+void CLCDManager::Shutdown(void)
+{
+ m_Gfx.Shutdown();
+}
+
+
+//************************************************************************
+//
+// CLCDManager::GetLCDScreen
+//
+//************************************************************************
+
+lgLcdBitmap160x43x1 *CLCDManager::GetLCDScreen(void)
+{
+ return m_Gfx.GetLCDScreen();
+}
+
+
+//************************************************************************
+//
+// CLCDManager::GetBitmapInfo
+//
+//************************************************************************
+
+BITMAPINFO *CLCDManager::GetBitmapInfo(void)
+{
+ return m_Gfx.GetBitmapInfo();
+}
+
+
+//************************************************************************
+//
+// CLCDManager::Draw
+//
+//************************************************************************
+
+HRESULT CLCDManager::Draw(void)
+{
+ LCDUIASSERT(NULL != m_Gfx.GetHDC());
+ LCDUIASSERT(NULL != m_Gfx.GetHBITMAP());
+ if((NULL == m_Gfx.GetHDC()) || (NULL == m_Gfx.GetHBITMAP()))
+ {
+ LCDUITRACE(_T("CLCDManager::Draw(): trying to draw without successful Initialize() first.!\n"));
+ return E_FAIL;
+ }
+
+ // select our bitmap into the Gfx DC
+ m_Gfx.BeginDraw();
+
+ m_Gfx.ClearScreen();
+
+ // invoke LCD UI Elements
+ OnDraw(m_Gfx);
+
+ // select it back out of it
+ m_Gfx.EndDraw();
+
+ return S_OK;
+}
+
+
+//************************************************************************
+//
+// CLCDManager::Update
+//
+//************************************************************************
+
+void CLCDManager::Update(DWORD dwTimestamp)
+{
+ LCDUIASSERT(m_dwStartTime != 0);
+ m_dwElapsedTime = (dwTimestamp - m_dwStartTime);
+ CLCDCollection::OnUpdate(dwTimestamp);
+}
+
+
+//************************************************************************
+//
+// CLCDManager::SetExpiration
+//
+//************************************************************************
+
+void CLCDManager::SetExpiration(DWORD dwMilliseconds)
+{
+ m_dwStartTime = GetTickCount();
+ m_dwElapsedTime = 0;
+ m_dwExpirationTime = dwMilliseconds;
+}
+
+
+//************************************************************************
+//
+// CLCDManager::HasExpired
+//
+//************************************************************************
+
+BOOL CLCDManager::HasExpired(void)
+{
+ return (!m_dwStartTime || (m_dwElapsedTime > m_dwExpirationTime));
+}
+
+
+//************************************************************************
+//
+// CLCDManager::OnLCDButtonDown
+//
+//************************************************************************
+
+void CLCDManager::OnLCDButtonDown(int nButton)
+{
+ UNREFERENCED_PARAMETER(nButton);
+}
+
+
+//************************************************************************
+//
+// CLCDManager::OnLCDButtonUp
+//
+//************************************************************************
+
+void CLCDManager::OnLCDButtonUp(int nButton)
+{
+ UNREFERENCED_PARAMETER(nButton);
+}
+
+
+//** end of LCDManager.cpp ***********************************************
diff --git a/src/ui/LCDUI/LCDManager.h b/src/ui/LCDUI/LCDManager.h
new file mode 100644
index 000000000..c564b74da
--- /dev/null
+++ b/src/ui/LCDUI/LCDManager.h
@@ -0,0 +1,49 @@
+//************************************************************************
+//
+// LCDManager.h
+//
+// The CLCDManager class is the representation of a "Screen". LCD UI class
+// objects are added here.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDMANAGER_H_INCLUDED_
+#define _LCDMANAGER_H_INCLUDED_
+
+#include "LCDCollection.h"
+
+
+class CLCDManager : public CLCDCollection
+{
+public:
+ CLCDManager();
+ virtual ~CLCDManager();
+
+ virtual HRESULT Initialize(void);
+ virtual void Shutdown(void);
+
+ lgLcdBitmap160x43x1 *GetLCDScreen(void);
+ BITMAPINFO *GetBitmapInfo(void);
+
+ virtual HRESULT Draw(void);
+ virtual void Update(DWORD dwTimestamp);
+
+ virtual void OnLCDButtonDown(int nButton);
+ virtual void OnLCDButtonUp(int nButton);
+
+ void SetExpiration(DWORD dwMilliseconds);
+ virtual BOOL HasExpired(void);
+
+private:
+ CLCDGfx m_Gfx;
+
+ DWORD m_dwStartTime, m_dwElapsedTime, m_dwExpirationTime;
+};
+
+
+#endif // !_LCDMANAGER_H_INCLUDED_
+
+//** end of LCDManager.h *************************************************
diff --git a/src/ui/LCDUI/LCDOutput.cpp b/src/ui/LCDUI/LCDOutput.cpp
new file mode 100644
index 000000000..e63cf1264
--- /dev/null
+++ b/src/ui/LCDUI/LCDOutput.cpp
@@ -0,0 +1,822 @@
+//************************************************************************
+//
+// LCDOutput.cpp
+//
+// The CLCDOutput class manages LCD hardware enumeration and screen
+// management.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDOutput.h"
+
+#pragma comment(lib, "lgLcd.lib")
+
+// to keep track of clients that use multiple CLCDOutput instances
+// within the same app
+static LONG lInitCount = 0;
+
+//************************************************************************
+//
+// CLCDOutput::CLCDOutput
+//
+//************************************************************************
+
+CLCDOutput::CLCDOutput()
+{
+ m_pActiveScreen = NULL;
+ m_bLocked = FALSE;
+ m_hDevice = LGLCD_INVALID_DEVICE;
+ m_hConnection = LGLCD_INVALID_CONNECTION;
+ m_nPriority = LGLCD_PRIORITY_NORMAL;
+ ZeroMemory(&m_lcdConnectCtxEx, sizeof(m_lcdConnectCtxEx));
+ m_bDisplayLocked = FALSE;
+ m_bSetAsForeground = FALSE;
+
+ // Setup default device families
+ m_dwDeviceFamiliesSupported = LGLCD_DEVICE_FAMILY_KEYBOARD_G15 |
+ LGLCD_DEVICE_FAMILY_JACKBOX |
+ LGLCD_DEVICE_FAMILY_SPEAKERS_Z10;
+ m_dwDeviceFamiliesSupportedReserved1 = 0;
+}
+
+//************************************************************************
+//
+// CLCDOutput::~CLCDOutput
+//
+//************************************************************************
+
+CLCDOutput::~CLCDOutput()
+{
+
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::Initialize
+//
+//************************************************************************
+
+HRESULT CLCDOutput::Initialize()
+{
+ return Initialize((lgLcdConnectContext *)NULL, FALSE);
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::Initialize
+//
+// NOTE: Initialize should always return S_OK
+//************************************************************************
+
+HRESULT CLCDOutput::Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow)
+{
+
+ UNREFERENCED_PARAMETER(bUseWindow);
+
+ DWORD res = ERROR_SUCCESS;
+
+ CLCDManager::Initialize();
+
+ // initialize our screens
+ LCD_MGR_LIST::iterator it = m_LCDMgrList.begin();
+ while(it != m_LCDMgrList.end())
+ {
+ CLCDManager *pMgr = *it;
+ LCDUIASSERT(NULL != pMgr);
+
+ pMgr->Initialize();
+ ++it;
+ }
+
+ // LCD Stuff
+ LCDUIASSERT(lInitCount >= 0);
+ if(1 == InterlockedIncrement(&lInitCount))
+ {
+ // need to call lgLcdInit once
+ res = lgLcdInit();
+ if (ERROR_SUCCESS != res)
+ {
+ InterlockedDecrement(&lInitCount);
+ LCDUITRACE(_T("WARNING: lgLcdInit failed\n"));
+ return E_FAIL;
+ }
+ }
+
+ m_lcdConnectCtxEx.appFriendlyName = _T("My App");
+ m_lcdConnectCtxEx.isPersistent = FALSE;
+ m_lcdConnectCtxEx.isAutostartable = FALSE;
+ m_lcdConnectCtxEx.connection = LGLCD_INVALID_CONNECTION;
+
+ // Initialize the added version 3.0 API fields
+ m_lcdConnectCtxEx.dwAppletCapabilitiesSupported = LGLCD_APPLET_CAP_BASIC;
+ m_lcdConnectCtxEx.dwReserved1 = 0;
+ m_lcdConnectCtxEx.onNotify.notificationCallback = NULL;
+ m_lcdConnectCtxEx.onNotify.notifyContext = NULL;
+
+ // if user passed in the context, fill it up
+ if (NULL != pContext)
+ {
+ memcpy(&m_lcdConnectCtxEx, pContext, sizeof(lgLcdConnectContext));
+ }
+
+ return S_OK;
+}
+
+//************************************************************************
+//
+// CLCDOutput::Initialize
+//
+// NOTE: Initialize should always return S_OK
+//************************************************************************
+
+HRESULT CLCDOutput::Initialize(lgLcdConnectContextEx* pContextEx, BOOL bUseWindow)
+{
+
+ UNREFERENCED_PARAMETER(bUseWindow);
+
+ DWORD res = ERROR_SUCCESS;
+
+ CLCDManager::Initialize();
+
+ // initialize our screens
+ LCD_MGR_LIST::iterator it = m_LCDMgrList.begin();
+ while(it != m_LCDMgrList.end())
+ {
+ CLCDManager *pMgr = *it;
+ LCDUIASSERT(NULL != pMgr);
+
+ pMgr->Initialize();
+ ++it;
+ }
+
+ // LCD Stuff
+ LCDUIASSERT(lInitCount >= 0);
+ if(1 == InterlockedIncrement(&lInitCount))
+ {
+ // need to call lgLcdInit once
+ res = lgLcdInit();
+ if (ERROR_SUCCESS != res)
+ {
+ InterlockedDecrement(&lInitCount);
+ LCDUITRACE(_T("WARNING: lgLcdInit failed\n"));
+ return E_FAIL;
+ }
+ }
+
+
+ m_lcdConnectCtxEx.appFriendlyName = _T("My App");
+ m_lcdConnectCtxEx.isPersistent = FALSE;
+ m_lcdConnectCtxEx.isAutostartable = FALSE;
+ m_lcdConnectCtxEx.connection = LGLCD_INVALID_CONNECTION;
+
+ // if user passed in the context, fill it up
+ if (NULL != pContextEx)
+ {
+ memcpy(&m_lcdConnectCtxEx, pContextEx, sizeof(lgLcdConnectContextEx));
+ }
+
+ return S_OK;
+}
+
+//************************************************************************
+//
+// CLCDOutput::Shutdown
+//
+//************************************************************************
+
+void CLCDOutput::Shutdown(void)
+{
+ CloseAndDisconnect();
+ if(0 == InterlockedDecrement(&lInitCount))
+ {
+ lgLcdDeInit();
+ }
+ LCDUIASSERT(lInitCount >= 0);
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::Draw
+//
+//************************************************************************
+
+HRESULT CLCDOutput::Draw()
+{
+ DWORD dwPriorityToUse;
+
+ if (m_pActiveScreen)
+ {
+ m_pActiveScreen->Draw();
+ dwPriorityToUse = LGLCD_ASYNC_UPDATE(m_nPriority);
+ }
+ else
+ {
+ dwPriorityToUse = LGLCD_ASYNC_UPDATE(LGLCD_PRIORITY_IDLE_NO_SHOW);
+ }
+
+ lgLcdBitmap160x43x1* pScreen = GetLCDScreen();
+ if (pScreen && (LGLCD_INVALID_DEVICE != m_hDevice) && (LGLCD_PRIORITY_IDLE_NO_SHOW != dwPriorityToUse))
+ {
+ DWORD res = ERROR_SUCCESS;
+ res = lgLcdUpdateBitmap(m_hDevice, &pScreen->hdr, dwPriorityToUse);
+
+ HandleErrorFromAPI(res);
+
+ // read the soft buttons
+ ReadButtons();
+ }
+
+ return S_OK;
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::Update
+//
+//************************************************************************
+
+void CLCDOutput::Update(DWORD dwTimestamp)
+{
+ if (m_pActiveScreen)
+ {
+ m_pActiveScreen->Update(dwTimestamp);
+ }
+
+ // check for expiration
+ if (m_pActiveScreen && m_pActiveScreen->HasExpired())
+ {
+ m_pActiveScreen = NULL;
+ //m_nPriority = LGLCD_PRIORITY_FYI; -> needs to go so that if a
+ // program sets priority to LGLCD_PRIORITY_BACKGROUND, that
+ // priority sticks.
+
+ OnScreenExpired(m_pActiveScreen);
+
+ // find the next active screen
+ LCD_MGR_LIST::iterator it = m_LCDMgrList.begin();
+ while(it != m_LCDMgrList.end())
+ {
+ CLCDManager *pMgr = *it;
+ LCDUIASSERT(NULL != pMgr);
+
+ if (!pMgr->HasExpired())
+ {
+ ActivateScreen(pMgr);
+ //m_nPriority = LGLCD_PRIORITY_FYI; -> needs to go so that if a
+ // program sets priority to LGLCD_PRIORITY_BACKGROUND, that
+ // priority sticks.
+ break;
+ }
+
+ ++it;
+ }
+
+ // if no screen found, empty the screen at idle priority
+ if (NULL == m_pActiveScreen)
+ {
+ if (LGLCD_INVALID_DEVICE != m_hDevice)
+ {
+ lgLcdUpdateBitmap(m_hDevice, &CLCDManager::GetLCDScreen()->hdr,
+ LGLCD_ASYNC_UPDATE(LGLCD_PRIORITY_IDLE_NO_SHOW));
+ }
+ }
+ }
+
+ // check for lcd devices
+ if (LGLCD_INVALID_DEVICE == m_hDevice)
+ {
+ EnumerateDevices();
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::HasHardwareChanged
+//
+//************************************************************************
+
+BOOL CLCDOutput::HasHardwareChanged(void)
+{
+ if(LGLCD_INVALID_DEVICE != m_hDevice)
+ {
+ // ping to see whether we're still alive
+ DWORD dwButtonState = 0;
+
+ DWORD res = lgLcdReadSoftButtons(m_hDevice, &dwButtonState);
+
+ HandleErrorFromAPI(res);
+ }
+
+ // check for lcd devices
+ if (LGLCD_INVALID_DEVICE == m_hDevice)
+ {
+ EnumerateDevices();
+ }
+ else
+ {
+ // we still have our device;
+ return FALSE;
+ }
+
+ // we got a new device
+ return LGLCD_INVALID_DEVICE != m_hDevice;
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::GetLCDScreen
+//
+//************************************************************************
+
+lgLcdBitmap160x43x1 *CLCDOutput::GetLCDScreen(void)
+{
+ return m_pActiveScreen ? m_pActiveScreen->GetLCDScreen() : CLCDManager::GetLCDScreen();
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::GetBitmapInfo
+//
+//************************************************************************
+
+BITMAPINFO *CLCDOutput::GetBitmapInfo(void)
+{
+ return m_pActiveScreen ? m_pActiveScreen->GetBitmapInfo() : CLCDManager::GetBitmapInfo();
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::ReadButtons
+//
+//************************************************************************
+
+void CLCDOutput::ReadButtons()
+{
+ if(IsOpened())
+ {
+ DWORD dwButtonState = 0;
+
+ DWORD res = lgLcdReadSoftButtons(m_hDevice, &dwButtonState);
+ if (ERROR_SUCCESS != res)
+ {
+ LCDUITRACE(_T("lgLcdReadSoftButtons failed: unplug?\n"));
+ HandleErrorFromAPI(res);
+ }
+
+ if (m_dwButtonState == dwButtonState)
+ return;
+
+ // handle the buttons
+ HandleButtonState(dwButtonState, LGLCDBUTTON_BUTTON0);
+ HandleButtonState(dwButtonState, LGLCDBUTTON_BUTTON1);
+ HandleButtonState(dwButtonState, LGLCDBUTTON_BUTTON2);
+ HandleButtonState(dwButtonState, LGLCDBUTTON_BUTTON3);
+
+ m_dwButtonState = dwButtonState;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::HandleButtonState
+//
+//************************************************************************
+
+void CLCDOutput::HandleButtonState(DWORD dwButtonState, DWORD dwButton)
+{
+ if ( (m_dwButtonState & dwButton) && !(dwButtonState & dwButton) )
+ {
+ LCDUITRACE(_T("Button 0x%x released\n"), dwButton);
+ OnLCDButtonUp(dwButton);
+ }
+ if ( !(m_dwButtonState & dwButton) && (dwButtonState & dwButton) )
+ {
+ LCDUITRACE(_T("Button 0x%x pressed\n"), dwButton);
+ OnLCDButtonDown(dwButton);
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::OnLCDButtonDown
+//
+//************************************************************************
+
+void CLCDOutput::OnLCDButtonDown(int nButton)
+{
+ if (m_pActiveScreen)
+ {
+ m_pActiveScreen->OnLCDButtonDown(nButton);
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::OnLCDButtonUp
+//
+//************************************************************************
+
+void CLCDOutput::OnLCDButtonUp(int nButton)
+{
+ if (m_pActiveScreen)
+ {
+ m_pActiveScreen->OnLCDButtonUp(nButton);
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::ActivateScreen
+//
+//************************************************************************
+
+void CLCDOutput::ActivateScreen(CLCDManager* pScreen)
+{
+ if (m_bLocked)
+ return;
+ m_pActiveScreen = pScreen;
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::LockScreen
+//
+//************************************************************************
+
+void CLCDOutput::LockScreen(CLCDManager* pScreen)
+{
+ if (m_bLocked)
+ return;
+
+ m_pActiveScreen = pScreen;
+ m_bLocked = TRUE;
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::UnlockScreen
+//
+//************************************************************************
+
+void CLCDOutput::UnlockScreen()
+{
+ m_bLocked = FALSE;
+ m_pActiveScreen = NULL;
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::IsLocked
+//
+//************************************************************************
+
+BOOL CLCDOutput::IsLocked()
+{
+ return m_bLocked;
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::AddScreen
+//
+//************************************************************************
+
+void CLCDOutput::AddScreen(CLCDManager* pScreen)
+{
+ m_LCDMgrList.push_back(pScreen);
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::AnyDeviceOfThisFamilyPresent
+//
+//************************************************************************
+
+BOOL CLCDOutput::AnyDeviceOfThisFamilyPresent(DWORD dwDeviceFamilyWanted, DWORD dwReserved1)
+{
+ lgLcdDeviceDescEx descEx;
+
+ if (LGLCD_INVALID_CONNECTION == m_hConnection)
+ {
+ if (ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
+ {
+ // make sure we don't work with a stale device handle
+ m_hConnection = m_lcdConnectCtxEx.connection;
+ m_hDevice = LGLCD_INVALID_CONNECTION;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+ // Setup the device family to use next time
+ lgLcdSetDeviceFamiliesToUse(m_hConnection, dwDeviceFamilyWanted, dwReserved1);
+
+ ZeroMemory(&descEx, sizeof(lgLcdDeviceDescEx));
+ DWORD res = ERROR_SUCCESS;
+
+ res = lgLcdEnumerateEx(m_hConnection, 0, &descEx);
+
+ if (ERROR_SUCCESS != res)
+ {
+ if(ERROR_NO_MORE_ITEMS != res)
+ {
+ // something happened. Let's close this.
+ CloseAndDisconnect();
+ return FALSE;
+ }
+
+ // Go back to the previous device family we were using
+ lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported,
+ m_dwDeviceFamiliesSupportedReserved1);
+
+ return FALSE;
+ }
+
+ // Go back to what was being used
+ lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported,
+ m_dwDeviceFamiliesSupportedReserved1);
+
+ return TRUE;
+}
+
+//************************************************************************
+//
+// CLCDOutput::SetDeviceFamiliesSupported
+//
+//************************************************************************
+
+void CLCDOutput::SetDeviceFamiliesSupported(DWORD dwDeviceFamiliesSupported, DWORD dwReserved1)
+{
+ m_dwDeviceFamiliesSupported = dwDeviceFamiliesSupported;
+ m_dwDeviceFamiliesSupportedReserved1 = dwReserved1;
+
+ if (LGLCD_INVALID_CONNECTION == m_hConnection)
+ {
+ if (ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
+ {
+ // make sure we don't work with a stale device handle
+ m_hConnection = m_lcdConnectCtxEx.connection;
+ m_hDevice = LGLCD_INVALID_CONNECTION;
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ // close the lcd device before we open up another
+ if (LGLCD_INVALID_DEVICE != m_hDevice)
+ {
+ lgLcdClose(m_hDevice);
+ m_hDevice = LGLCD_INVALID_DEVICE;
+
+ }
+
+ // Setup the device family to use next time
+ lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported, m_dwDeviceFamiliesSupportedReserved1);
+}
+
+//************************************************************************
+//
+// CLCDOutput::EnumerateDevices
+//
+//************************************************************************
+
+void CLCDOutput::EnumerateDevices()
+{
+ lgLcdDeviceDescEx descEx;
+
+ if (LGLCD_INVALID_CONNECTION == m_hConnection)
+ {
+ if (ERROR_SUCCESS == lgLcdConnectEx(&m_lcdConnectCtxEx))
+ {
+ // make sure we don't work with a stale device handle
+ m_hConnection = m_lcdConnectCtxEx.connection;
+ m_hDevice = LGLCD_INVALID_CONNECTION;
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ // close the lcd device before we open up another
+ if (LGLCD_INVALID_DEVICE != m_hDevice)
+ {
+ lgLcdClose(m_hDevice);
+ m_hDevice = LGLCD_INVALID_DEVICE;
+
+ }
+
+ // Setup the device family to use next time
+ lgLcdSetDeviceFamiliesToUse(m_hConnection, m_dwDeviceFamiliesSupported, m_dwDeviceFamiliesSupportedReserved1);
+
+ ZeroMemory(&descEx, sizeof(lgLcdDeviceDescEx));
+ DWORD res = ERROR_SUCCESS;
+
+ res = lgLcdEnumerateEx(m_hConnection, 0, &descEx);
+ if (ERROR_SUCCESS != res)
+ {
+ if(ERROR_NO_MORE_ITEMS != res)
+ {
+ // something happened. Let's close this.
+ CloseAndDisconnect();
+ }
+ return;
+ }
+// ERROR_NO_MORE_ITEMS
+ lgLcdOpenContext open_ctx;
+ ZeroMemory(&open_ctx, sizeof(open_ctx));
+
+ open_ctx.connection = m_hConnection;
+ open_ctx.index = 0;
+ res = lgLcdOpen(&open_ctx);
+ if (ERROR_SUCCESS != res)
+ return;
+ m_hDevice = open_ctx.device;
+ m_dwButtonState = 0;
+
+ // restores
+ SetAsForeground(m_bSetAsForeground);
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::HandleErrorFromAPI
+//
+//************************************************************************
+void CLCDOutput::HandleErrorFromAPI(DWORD dwRes)
+{
+ switch(dwRes)
+ {
+ // all is well
+ case ERROR_SUCCESS:
+ break;
+ // we lost our device
+ case ERROR_DEVICE_NOT_CONNECTED:
+ LCDUITRACE(_T("lgLcdAPI returned with ERROR_DEVICE_NOT_CONNECTED, closing device\n"));
+ OnClosingDevice(m_hDevice);
+ break;
+ default:
+ LCDUITRACE(_T("lgLcdAPI returned with other error (0x%08x) closing device and connection\n"));
+ OnClosingDevice(m_hDevice);
+ OnDisconnecting(m_hConnection);
+ // something else happened, such as LCDMon that was terminated
+ break;
+ }
+}
+
+//************************************************************************
+//
+// CLCDOutput::SetScreenPriority
+//
+//************************************************************************
+void CLCDOutput::SetScreenPriority(DWORD priority)
+{
+ m_nPriority = priority;
+ if (LGLCD_PRIORITY_IDLE_NO_SHOW == m_nPriority)
+ {
+ // send an empty bitmap at idle priority
+ if (LGLCD_INVALID_DEVICE != m_hDevice)
+ {
+ lgLcdUpdateBitmap(m_hDevice, &CLCDManager::GetLCDScreen()->hdr,
+ LGLCD_ASYNC_UPDATE(LGLCD_PRIORITY_IDLE_NO_SHOW));
+ }
+ }
+}
+
+//************************************************************************
+//
+// CLCDOutput::GetScreenPriority
+//
+//************************************************************************
+DWORD CLCDOutput::GetScreenPriority()
+{
+ return m_nPriority;
+}
+
+//************************************************************************
+//
+// CLCDOutput::GetDeviceHandle
+//
+//************************************************************************
+INT CLCDOutput::GetDeviceHandle()
+{
+ return m_hDevice;
+}
+
+//************************************************************************
+//
+// CLCDOutput::CloseAndDisconnect
+//
+//************************************************************************
+
+void CLCDOutput::CloseAndDisconnect()
+{
+ OnClosingDevice(m_hDevice);
+ OnDisconnecting(m_hConnection);
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::OnScreenExpired
+//
+//************************************************************************
+
+void CLCDOutput::OnScreenExpired(CLCDManager* pScreen)
+{
+ UNREFERENCED_PARAMETER(pScreen);
+ UnlockScreen();
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::OnClosingDevice
+//
+//************************************************************************
+
+void CLCDOutput::OnClosingDevice(int hDevice)
+{
+ UNREFERENCED_PARAMETER(hDevice);
+ LCDUITRACE(_T("CLCDOutput::OnClosingDevice\n"));
+ if (IsOpened())
+ {
+ lgLcdClose(m_hDevice);
+ m_hDevice = LGLCD_INVALID_DEVICE;
+ }
+}
+
+//************************************************************************
+//
+// CLCDOutput::OnDisconnecting
+//
+//************************************************************************
+
+void CLCDOutput::OnDisconnecting(int hConnection)
+{
+ UNREFERENCED_PARAMETER(hConnection);
+ LCDUITRACE(_T("CLCDOutput::OnDisconnecting\n"));
+ // let's hope our device is already gone
+ LCDUIASSERT(!IsOpened());
+
+ if (LGLCD_INVALID_CONNECTION != m_hConnection)
+ {
+ lgLcdDisconnect(m_hConnection);
+ m_hConnection = LGLCD_INVALID_CONNECTION;
+ }
+}
+
+//************************************************************************
+//
+// CLCDOutput::IsOpened
+//
+//************************************************************************
+
+BOOL CLCDOutput::IsOpened()
+{
+ return (LGLCD_INVALID_DEVICE != m_hDevice);
+}
+
+
+//************************************************************************
+//
+// CLCDOutput::SetAsForeground
+//
+//************************************************************************
+
+void CLCDOutput::SetAsForeground(BOOL bSetAsForeground)
+{
+ /*DWORD dwSet = */bSetAsForeground ? LGLCD_LCD_FOREGROUND_APP_YES : LGLCD_LCD_FOREGROUND_APP_NO;
+ m_bSetAsForeground = bSetAsForeground;
+ if (LGLCD_INVALID_DEVICE != m_hDevice)
+ {
+ lgLcdSetAsLCDForegroundApp(m_hDevice, bSetAsForeground);
+ }
+}
+
+//** end of LCDOutput.cpp ************************************************
diff --git a/src/ui/LCDUI/LCDOutput.h b/src/ui/LCDUI/LCDOutput.h
new file mode 100644
index 000000000..0b447157b
--- /dev/null
+++ b/src/ui/LCDUI/LCDOutput.h
@@ -0,0 +1,101 @@
+//************************************************************************
+//
+// LCDOutput.h
+//
+// The CLCDOutput class manages LCD hardware enumeration and screen
+// management.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _CLCDOUTPUT_H_INCLUDED_
+#define _CLCDOUTPUT_H_INCLUDED_
+
+#include "LCDManager.h"
+#include <lglcd/lglcd.h>
+#include "vector"
+
+using namespace std;
+
+typedef vector <CLCDManager*> LCD_MGR_LIST;
+typedef LCD_MGR_LIST::iterator LCD_MGR_LIST_ITER;
+
+class CLCDOutput : public CLCDManager
+{
+
+public:
+ CLCDOutput();
+ virtual ~CLCDOutput();
+
+ void AddScreen(CLCDManager* pScreen);
+
+ void LockScreen(CLCDManager* pScreen);
+ void UnlockScreen();
+ BOOL IsLocked();
+
+ BOOL IsOpened();
+ void SetAsForeground(BOOL bSetAsForeground);
+ BOOL AnyDeviceOfThisFamilyPresent(DWORD dwDeviceFamilyWanted, DWORD dwReserved1);
+ void SetDeviceFamiliesSupported(DWORD dwDeviceFamiliesSupported, DWORD dwReserved1);
+
+ void SetScreenPriority(DWORD priority);
+ DWORD GetScreenPriority();
+
+ INT GetDeviceHandle();
+
+ HRESULT Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow = FALSE);
+ HRESULT Initialize(lgLcdConnectContextEx* pContextEx, BOOL bUseWindow = FALSE);
+
+ // returns TRUE if a new display was enumerated
+ BOOL HasHardwareChanged(void);
+
+ // CLCDBase
+ virtual HRESULT Initialize();
+ virtual HRESULT Draw();
+ virtual void Update(DWORD dwTimestamp);
+ virtual void Shutdown(void);
+
+ // CLCDManager
+ lgLcdBitmap160x43x1 *GetLCDScreen(void);
+ BITMAPINFO *GetBitmapInfo(void);
+
+protected:
+ void ActivateScreen(CLCDManager* pScreen);
+ void ReadButtons();
+ void HandleButtonState(DWORD dwButtonState, DWORD dwButton);
+ void HandleErrorFromAPI(DWORD dwRes);
+ void CloseAndDisconnect();
+
+ virtual void OnLCDButtonDown(int nButton);
+ virtual void OnLCDButtonUp(int nButton);
+
+protected:
+ virtual void OnScreenExpired(CLCDManager* pScreen);
+ virtual void OnClosingDevice(int hDevice);
+ virtual void OnDisconnecting(int hConnection);
+
+protected:
+ CLCDManager* m_pActiveScreen;
+
+ // list
+ LCD_MGR_LIST m_LCDMgrList;
+
+ void EnumerateDevices();
+ int m_hConnection;
+ int m_hDevice;
+ DWORD m_nPriority;
+ BOOL m_bLocked, m_bDisplayLocked;
+ DWORD m_dwButtonState;
+ BOOL m_bSetAsForeground;
+
+// lgLcdConnectContext m_lcdConnectCtx;
+ lgLcdConnectContextEx m_lcdConnectCtxEx;
+ DWORD m_dwDeviceFamiliesSupported;
+ DWORD m_dwDeviceFamiliesSupportedReserved1;
+};
+
+#endif // !_CLCDOUTPUT_H_INCLUDED_
+
+//** end of CLCDOutput.h *************************************************
diff --git a/src/ui/LCDUI/LCDProgressBar.cpp b/src/ui/LCDUI/LCDProgressBar.cpp
new file mode 100644
index 000000000..978cb2558
--- /dev/null
+++ b/src/ui/LCDUI/LCDProgressBar.cpp
@@ -0,0 +1,270 @@
+//************************************************************************
+//
+// LCDProgressBar.cpp
+//
+// The CLCDProgressBar class draws a progress bar onto the LCD.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDProgressBar.h"
+
+//************************************************************************
+//
+// CLCDProgressBar::CLCDProgressBar
+//
+//************************************************************************
+
+CLCDProgressBar::CLCDProgressBar()
+{
+ m_Pos = 0;
+ m_eStyle = STYLE_CURSOR;
+ m_Range.nMin = 0;
+ m_Range.nMax = 100;
+ m_nCursorWidth = 5;
+ m_hPen = NULL;
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::~CLCDProgressBar
+//
+//************************************************************************
+
+CLCDProgressBar::~CLCDProgressBar()
+{
+ if (m_hPen != NULL)
+ {
+ ::DeleteObject(m_hPen);
+ m_hPen = NULL;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar:Initialize
+//
+//************************************************************************
+
+HRESULT CLCDProgressBar::Initialize()
+{
+
+ m_hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH);
+ m_hPen = ::CreatePen(PS_DOT, 1, RGB(255, 255, 255));
+
+ return CLCDBase::Initialize();
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::OnDraw
+//
+//************************************************************************
+
+void CLCDProgressBar::OnDraw(CLCDGfx &rGfx)
+{
+ HPEN hOldPen;
+
+ rGfx.ClearScreen();
+
+ // draw the border
+ RECT r = { 0, 0, GetWidth(), GetHeight() };
+
+ FrameRect(rGfx.GetHDC(), &r, m_hBrush);
+
+ // draw the progress
+ switch(m_eStyle)
+ {
+ case STYLE_CURSOR:
+ {
+ int nCursorPos = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
+ (float)1, (float)(GetWidth() - m_nCursorWidth-1),
+ m_Pos);
+ r.left = nCursorPos;
+ r.right = r.left + m_nCursorWidth;
+ FillRect(rGfx.GetHDC(), &r, m_hBrush);
+ }
+ break;
+ case STYLE_FILLED_V:
+ case STYLE_FILLED_H:
+ {
+ int nBar = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
+ 0.0f, (m_eStyle == STYLE_FILLED_H ? (float)GetWidth() : (float)GetHeight())-4,
+ m_Pos);
+ r.left = r.left+2;
+ r.bottom = r.bottom-2;
+ if (m_eStyle == STYLE_FILLED_H)
+ {
+ r.right = nBar+2;
+ r.top = r.top+2;
+ }
+ else
+ {
+ r.right = r.right-2;
+ r.top = r.bottom-nBar;
+ }
+
+ FillRect(rGfx.GetHDC(), &r, m_hBrush);
+ }
+ break;
+ case STYLE_DASHED_CURSOR:
+ {
+ int nCursorPos = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
+ (float)1, (float)(GetWidth() - m_nCursorWidth-1),
+ m_Pos);
+ r.left = nCursorPos;
+ r.right = r.left + m_nCursorWidth;
+ FillRect(rGfx.GetHDC(), &r, m_hBrush);
+ hOldPen = (HPEN)::SelectObject(rGfx.GetHDC(), m_hPen);
+
+ ::MoveToEx(rGfx.GetHDC(), 0, (r.bottom - r.top)/2, NULL);
+ ::LineTo(rGfx.GetHDC(), nCursorPos, (r.bottom - r.top)/2);
+ ::SelectObject(rGfx.GetHDC(), hOldPen);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::ResetUpdate
+//
+//************************************************************************
+
+void CLCDProgressBar::ResetUpdate()
+{
+
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::SetRange
+//
+//************************************************************************
+
+void CLCDProgressBar::SetRange(__int64 nMin, __int64 nMax)
+{
+ m_Range.nMin = nMin;
+ m_Range.nMax = nMax;
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::SetRange
+//
+//************************************************************************
+
+void CLCDProgressBar::SetRange(RANGE& Range)
+{
+ m_Range = Range;
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::GetRange
+//
+//************************************************************************
+
+RANGE& CLCDProgressBar::GetRange()
+{
+ return m_Range;
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::SetPos
+//
+//************************************************************************
+
+__int64 CLCDProgressBar::SetPos(__int64 Pos)
+{
+ return ( m_Pos = max(m_Range.nMin, min(Pos, m_Range.nMax)) );
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::GetPos
+//
+//************************************************************************
+
+__int64 CLCDProgressBar::GetPos()
+{
+ return m_Pos;
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::EnableCursor
+//
+//************************************************************************
+
+void CLCDProgressBar::EnableCursor(BOOL bEnable)
+{
+ m_eStyle = bEnable ? STYLE_CURSOR : STYLE_FILLED_H;
+}
+
+//************************************************************************
+//
+// CLCDProgressBar::SetProgressStyle
+//
+//************************************************************************
+
+void CLCDProgressBar::SetProgressStyle(ePROGRESS_STYLE eStyle)
+{
+ m_eStyle = eStyle;
+}
+
+//************************************************************************
+//
+// CLCDProgressBar::Scalef
+//
+//************************************************************************
+
+float CLCDProgressBar::Scalef(float fFromMin, float fFromMax,
+ float fToMin, float fToMax, __int64 fFromValue)
+{
+
+ // normalize the input
+ float fFromValueN = (fFromValue - fFromMin) / (fFromMax - fFromMin);
+
+ // now scale to the output
+ float fToRange = fToMax - fToMin;
+
+ return ( fToMin + (fFromValueN * fToRange) );
+}
+
+
+//************************************************************************
+//
+// CLCDProgressBar::Scale
+//
+//************************************************************************
+
+int CLCDProgressBar::Scale(int nFromMin, int nFromMax,
+ int nToMin, int nToMax, __int64 nFromValue)
+{
+ return (int)Scalef(
+ (float)nFromMin,
+ (float)nFromMax,
+ (float)nToMin,
+ (float)nToMax,
+ nFromValue
+ );
+}
+
+
+//** end of LCDProgressBar.cpp *******************************************
diff --git a/src/ui/LCDUI/LCDProgressBar.h b/src/ui/LCDUI/LCDProgressBar.h
new file mode 100644
index 000000000..346bf6c2b
--- /dev/null
+++ b/src/ui/LCDUI/LCDProgressBar.h
@@ -0,0 +1,66 @@
+//************************************************************************
+//
+// LCDProgressBar.h
+//
+// The CLCDProgressBar class draws a progress bar onto the LCD.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDPROGRESSBAR_H_INCLUDED_
+#define _LCDPROGRESSBAR_H_INCLUDED_
+
+#include "LCDBase.h"
+
+typedef struct RANGE
+{
+ __int64 nMin;
+ __int64 nMax;
+
+}RANGE, *LPRANGE;
+
+enum ePROGRESS_STYLE { STYLE_FILLED_H, STYLE_FILLED_V, STYLE_CURSOR, STYLE_DASHED_CURSOR };
+
+class CLCDProgressBar : public CLCDBase
+{
+public:
+ enum ePROGRESS_STYLE { STYLE_FILLED_H, STYLE_FILLED_V, STYLE_CURSOR, STYLE_DASHED_CURSOR };
+
+ CLCDProgressBar();
+ virtual ~CLCDProgressBar();
+
+ // CLCDBase
+ virtual HRESULT Initialize(void);
+ virtual void OnDraw(CLCDGfx &rGfx);
+ virtual void ResetUpdate(void);
+
+ // CLCDProgressBar
+ virtual void SetRange(__int64 nMin, __int64 nMax);
+ virtual void SetRange(RANGE& Range);
+ virtual RANGE& GetRange(void);
+ virtual __int64 SetPos(__int64 fPos);
+ virtual __int64 GetPos(void);
+ virtual void EnableCursor(BOOL bEnable);
+ virtual void SetProgressStyle(ePROGRESS_STYLE eStyle);
+
+protected:
+ float Scalef(float fFromMin, float fFromMax,
+ float fToMin, float fToMax, __int64 fFromValue);
+ int Scale(int nFromMin, int nFromMax,
+ int nToMin, int nToMax, __int64 nFromValue);
+
+private:
+ RANGE m_Range;
+ __int64 m_Pos;
+ ePROGRESS_STYLE m_eStyle;
+ HBRUSH m_hBrush;
+ HPEN m_hPen;
+ int m_nCursorWidth;
+};
+
+
+#endif // !_LCDPROGRESSBAR_H_INCLUDED_
+
+//** end of LCDProgressBar.h *********************************************
diff --git a/src/ui/LCDUI/LCDScrollingText.cpp b/src/ui/LCDUI/LCDScrollingText.cpp
new file mode 100644
index 000000000..880fc505a
--- /dev/null
+++ b/src/ui/LCDUI/LCDScrollingText.cpp
@@ -0,0 +1,294 @@
+//************************************************************************
+//
+// LCDScrollingText.cpp
+//
+// The CLCDScrollingText class draws scrolling text onto the LCD.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDScrollingText.h"
+
+
+//************************************************************************
+//
+// CLCDScrollingText::CLCDScrollingText
+//
+//************************************************************************
+
+CLCDScrollingText::CLCDScrollingText()
+{
+ m_eState = STATE_START_DELAY;
+ m_eScrollDir = SCROLL_HORZ;
+ m_bRepeat = TRUE;
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::~CLCDScrollingText
+//
+//************************************************************************
+
+CLCDScrollingText::~CLCDScrollingText()
+{
+
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::Initialize
+//
+//************************************************************************
+
+HRESULT CLCDScrollingText::Initialize(void)
+{
+ m_dwStartDelay = 1000;
+ m_dwSpeed = 20;
+ m_nScrollingDistance = -1;
+ m_dwLastUpdate = 0;
+ m_dwEllapsedTime = 0;
+ m_dwLastUpdate = GetTickCount();
+ m_fTotalDistance = 0;
+ m_eScrollDir = SCROLL_HORZ;
+ m_dwEndDelay = 1000;
+ m_bRepeat = TRUE;
+
+ return CLCDText::Initialize();
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::ResetUpdate
+//
+//************************************************************************
+
+void CLCDScrollingText::ResetUpdate(void)
+{
+ m_eState = STATE_START_DELAY;
+ m_dwEllapsedTime = 0;
+ m_dwLastUpdate = GetTickCount();
+ m_nScrollingDistance = -1;
+ m_fTotalDistance = 0;
+ SetLeftMargin(0);
+ SetLogicalOrigin(0, 0);
+
+ CLCDText::ResetUpdate();
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::SetStartDelay
+//
+//************************************************************************
+
+void CLCDScrollingText::SetStartDelay(DWORD dwMilliseconds)
+{
+ m_dwStartDelay = dwMilliseconds;
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::SetEndDelay
+//
+//************************************************************************
+
+void CLCDScrollingText::SetEndDelay(DWORD dwMilliseconds)
+{
+ m_dwEndDelay = dwMilliseconds;
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::SetSpeed
+//
+//************************************************************************
+
+void CLCDScrollingText::SetSpeed(DWORD dwSpeed)
+{
+ m_dwSpeed = dwSpeed;
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::SetScrollDirection
+//
+//************************************************************************
+
+void CLCDScrollingText::SetScrollDirection(eSCROLL_DIR eScrollDir)
+{
+ m_eScrollDir = eScrollDir;
+ SetWordWrap(eScrollDir == SCROLL_VERT);
+ ResetUpdate();
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::GetScrollDirection
+//
+//************************************************************************
+
+CLCDScrollingText::eSCROLL_DIR CLCDScrollingText::GetScrollDirection()
+{
+ return m_eScrollDir;
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::SetText
+//
+//************************************************************************
+
+void CLCDScrollingText::SetText(LPCTSTR szText)
+{
+ if (_tcscmp(szText, m_sText.c_str()))
+ {
+ ResetUpdate();
+ }
+
+ CLCDText::SetText(szText);
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::IsScrollingDone
+//
+//************************************************************************
+
+BOOL CLCDScrollingText::IsScrollingDone()
+{
+ return (STATE_DONE == m_eState);
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::EnableRepeat
+//
+//************************************************************************
+
+void CLCDScrollingText::EnableRepeat(BOOL bEnable)
+{
+ m_bRepeat = bEnable;
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::OnUpdate
+//
+//************************************************************************
+
+void CLCDScrollingText::OnUpdate(DWORD dwTimestamp)
+{
+ m_dwEllapsedTime = (dwTimestamp - m_dwLastUpdate);
+}
+
+
+//************************************************************************
+//
+// CLCDScrollingText::OnDraw
+//
+//************************************************************************
+
+void CLCDScrollingText::OnDraw(CLCDGfx &rGfx)
+{
+ if (!m_nTextLength)
+ return;
+
+ // calculate the scrolling distance
+ if (-1 == m_nScrollingDistance)
+ {
+ CLCDText::OnDraw(rGfx);
+
+ if (SCROLL_VERT == m_eScrollDir)
+ {
+ // determine how far we have to travel until scrolling stops
+ m_nScrollingDistance = ((GetHeight()) >= GetVExtent().cy) ?
+ 0 : (GetVExtent().cy - GetHeight());
+ SetLogicalSize(GetVExtent().cx, GetVExtent().cy);
+ }
+ else
+ {
+ // determine how far we have to travel until scrolling stops
+ m_nScrollingDistance = ((GetWidth()) >= GetHExtent().cx) ?
+ 0 : (GetHExtent().cx - GetWidth());
+ SetLogicalSize(max(GetSize().cx, GetHExtent().cx), GetHExtent().cy);
+ }
+ }
+
+ switch(m_eState)
+ {
+ case STATE_START_DELAY:
+ if (m_dwEllapsedTime > m_dwStartDelay)
+ {
+ m_eState = STATE_SCROLL;
+ m_dwEllapsedTime = 0;
+ m_dwLastUpdate = GetTickCount();
+ }
+ break;
+ case STATE_END_DELAY:
+ if (m_dwEllapsedTime > m_dwEndDelay)
+ {
+ if (m_bRepeat)
+ {
+ ResetUpdate();
+ break;
+ }
+ m_dwEllapsedTime = 0;
+ m_dwLastUpdate = GetTickCount();
+ m_eState = STATE_DONE;
+ }
+ break;
+ case STATE_SCROLL:
+ {
+ // TODO: add some anti-aliasing on the movement
+
+ // how much time has ellapsed?
+ // given the speed, what is the total displacement?
+ float fDistance = (float)(m_dwSpeed * m_dwEllapsedTime) / 1000.0f;
+ m_fTotalDistance += fDistance;
+
+ // we dont want the total distnace exceed our scrolling distance
+ int nTotalOffset = min((int)m_fTotalDistance, m_nScrollingDistance);
+
+ if (SCROLL_VERT == m_eScrollDir)
+ {
+ SetLogicalOrigin(GetLogicalOrigin().x, -1 * nTotalOffset);
+ }
+ else
+ {
+ SetLogicalOrigin(-1 * nTotalOffset, GetLogicalOrigin().y);
+ }
+
+ m_dwLastUpdate = GetTickCount();
+
+ if (nTotalOffset == m_nScrollingDistance)
+ {
+ m_eState = STATE_END_DELAY;
+ }
+ }
+ break;
+ case STATE_DONE:
+ break;
+
+ default:
+ break;
+ }
+
+ CLCDText::OnDraw(rGfx);
+}
+
+
+//** end of LCDScrollingText.cpp *****************************************
diff --git a/src/ui/LCDUI/LCDScrollingText.h b/src/ui/LCDUI/LCDScrollingText.h
new file mode 100644
index 000000000..8438c3952
--- /dev/null
+++ b/src/ui/LCDUI/LCDScrollingText.h
@@ -0,0 +1,65 @@
+//************************************************************************
+//
+// LCDScrollingText.h
+//
+// The CLCDScrollingText class draws scrolling text onto the LCD.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDSCROLLINGTEXT_H_INCLUDED_
+#define _LCDSCROLLINGTEXT_H_INCLUDED_
+
+#include "LCDBase.h"
+#include "LCDText.h"
+
+class CLCDScrollingText : public CLCDText
+{
+public:
+ CLCDScrollingText();
+ virtual ~CLCDScrollingText();
+
+ // CLCDBase
+ virtual HRESULT Initialize(void);
+ virtual void ResetUpdate(void);
+
+ // CLCDText
+ virtual void SetText(LPCTSTR szText);
+
+ void SetStartDelay(DWORD dwMilliseconds);
+ void SetEndDelay(DWORD dwMilliseconds);
+ void EnableRepeat(BOOL bEnable);
+ void SetSpeed(DWORD dwSpeed);
+
+ enum eSCROLL_DIR { SCROLL_HORZ, SCROLL_VERT};
+ void SetScrollDirection(eSCROLL_DIR eScrollDir);
+ eSCROLL_DIR GetScrollDirection();
+ BOOL IsScrollingDone();
+
+protected:
+ virtual void OnUpdate(DWORD dwTimestamp);
+ virtual void OnDraw(CLCDGfx &rGfx);
+
+private:
+ enum eSCROLL_STATES { STATE_START_DELAY, STATE_SCROLL, STATE_END_DELAY, STATE_DONE};
+
+ DWORD m_dwEllapsedTime; // ellapsed time in state
+ DWORD m_dwStartDelay; // milliseconds
+ DWORD m_dwEndDelay; // milliseconds
+ DWORD m_dwSpeed; // pixels/second
+ DWORD m_dwLastUpdate; // milliseconds
+ BOOL m_bRepeat; // repeat
+
+ int m_nScrollingDistance;
+ float m_fTotalDistance;
+
+ eSCROLL_DIR m_eScrollDir;
+ eSCROLL_STATES m_eState;
+};
+
+
+#endif // !_LCDSCROLLINGTEXT_H_INCLUDED_
+
+//** end of LCDScrollingText.h *******************************************
diff --git a/src/ui/LCDUI/LCDText.cpp b/src/ui/LCDUI/LCDText.cpp
new file mode 100644
index 000000000..e9441d77a
--- /dev/null
+++ b/src/ui/LCDUI/LCDText.cpp
@@ -0,0 +1,396 @@
+//************************************************************************
+//
+// LCDText.cpp
+//
+// The CLCDText class draws simple text onto the LCD.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#include "LCDText.h"
+
+
+//************************************************************************
+//
+// CLCDText::CLCDText
+//
+//************************************************************************
+
+CLCDText::CLCDText()
+{
+ m_nTextLength = 0;
+ m_hFont = NULL;
+ m_sText.clear();
+ m_crColor = RGB(255, 255, 255); // white
+ m_bRecalcExtent = TRUE;
+ ZeroMemory(&m_dtp, sizeof(DRAWTEXTPARAMS));
+ m_dtp.cbSize = sizeof(DRAWTEXTPARAMS);
+ m_nTextFormat = m_nTextAlignment = (DT_LEFT | DT_NOPREFIX);
+ m_nTextAlignment = DT_LEFT;
+ ZeroMemory(&m_sizeVExtent, sizeof(m_sizeVExtent));
+ ZeroMemory(&m_sizeHExtent, sizeof(m_sizeHExtent));
+}
+
+
+//************************************************************************
+//
+// CLCDText::~CLCDText
+//
+//************************************************************************
+
+CLCDText::~CLCDText()
+{
+
+ if (m_hFont)
+ {
+ DeleteObject(m_hFont);
+ m_hFont = NULL;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDText::Initialize
+//
+//************************************************************************
+
+HRESULT CLCDText::Initialize()
+{
+
+ m_hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
+ if(NULL != m_hFont)
+ {
+ SetFontPointSize(DEFAULT_POINTSIZE);
+ }
+
+ return (NULL != m_hFont) ? S_OK : E_OUTOFMEMORY;
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetFont
+//
+//************************************************************************
+
+void CLCDText::SetFont(LOGFONT& lf)
+{
+ if (m_hFont)
+ {
+ DeleteObject(m_hFont);
+ m_hFont = NULL;
+ }
+
+ m_hFont = CreateFontIndirect(&lf);
+ m_bRecalcExtent = TRUE;
+}
+
+
+//************************************************************************
+//
+// CLCDText::GetFont
+//
+//************************************************************************
+
+HFONT CLCDText::GetFont()
+{
+ return m_hFont;
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetFontFaceName
+//
+//************************************************************************
+
+void CLCDText::SetFontFaceName(LPCTSTR szFontName)
+{
+ // if NULL, uses the default gui font
+ if (NULL == szFontName)
+ return;
+
+ LOGFONT lf;
+ ZeroMemory(&lf, sizeof(lf));
+ GetObject(m_hFont, sizeof(LOGFONT), &lf);
+
+ _tcsncpy(lf.lfFaceName, szFontName, LF_FACESIZE);
+
+ SetFont(lf);
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetFontPointSize
+//
+//************************************************************************
+
+void CLCDText::SetFontPointSize(int nPointSize)
+{
+ LOGFONT lf;
+ ZeroMemory(&lf, sizeof(lf));
+ GetObject(m_hFont, sizeof(LOGFONT), &lf);
+
+ lf.lfHeight = -MulDiv(nPointSize, DEFAULT_DPI, 72);
+
+ SetFont(lf);
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetFontWeight
+//
+//************************************************************************
+
+void CLCDText::SetFontWeight(int nWeight)
+{
+ LOGFONT lf;
+ ZeroMemory(&lf, sizeof(lf));
+ GetObject(m_hFont, sizeof(LOGFONT), &lf);
+
+ lf.lfWeight = nWeight;
+
+ SetFont(lf);
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetText
+//
+//************************************************************************
+
+void CLCDText::SetText(LPCTSTR szText)
+{
+ LCDUIASSERT(NULL != szText);
+ if(szText && _tcscmp(m_sText.c_str(), szText))
+ {
+ m_sText.assign(szText);
+ m_nTextLength = m_sText.size();
+ m_dtp.iLeftMargin = 0;
+ m_dtp.iRightMargin = 0;
+ m_bRecalcExtent = TRUE;
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDText::GetText
+//
+//************************************************************************
+
+LPCTSTR CLCDText::GetText()
+{
+ return m_sText.c_str();
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetWordWrap
+//
+//************************************************************************
+
+void CLCDText::SetWordWrap(BOOL bEnable)
+{
+ if (bEnable)
+ {
+ m_nTextFormat |= DT_WORDBREAK;
+ }
+ else
+ {
+ m_nTextFormat &= ~DT_WORDBREAK;
+ }
+ m_bRecalcExtent = TRUE;
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetLeftMargin
+//
+//************************************************************************
+
+void CLCDText::SetLeftMargin(int nLeftMargin)
+{
+ m_dtp.iLeftMargin = nLeftMargin;
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetRightMargin
+//
+//************************************************************************
+
+void CLCDText::SetRightMargin(int nRightMargin)
+{
+ m_dtp.iRightMargin = nRightMargin;
+}
+
+
+//************************************************************************
+//
+// CLCDText::GetLeftMargin
+//
+//************************************************************************
+
+int CLCDText::GetLeftMargin(void)
+{
+ return m_dtp.iLeftMargin;
+}
+
+
+//************************************************************************
+//
+// CLCDText::GetRightMargin
+//
+//************************************************************************
+
+int CLCDText::GetRightMargin(void)
+{
+ return m_dtp.iRightMargin;
+}
+
+
+//************************************************************************
+//
+// CLCDText::GetVExtent
+//
+//************************************************************************
+
+SIZE& CLCDText::GetVExtent()
+{
+ return m_sizeVExtent;
+}
+
+
+//************************************************************************
+//
+// CLCDText::GetHExtent
+//
+//************************************************************************
+
+SIZE& CLCDText::GetHExtent()
+{
+ return m_sizeHExtent;
+}
+
+
+//************************************************************************
+//
+// CLCDText::SetAlignment
+//
+//************************************************************************
+
+void CLCDText::SetAlignment(int nAlignment)
+{
+ m_nTextFormat &= ~m_nTextAlignment;
+ m_nTextFormat |= nAlignment;
+ m_nTextAlignment = nAlignment;
+}
+
+
+//************************************************************************
+//
+// CLCDText::DrawText
+//
+//************************************************************************
+
+void CLCDText::DrawText(CLCDGfx &rGfx)
+{
+ // draw the text
+ RECT rBoundary = { 0, 0,0 + GetLogicalSize().cx, 0 + GetLogicalSize().cy };
+ DrawTextEx(rGfx.GetHDC(), (LPTSTR)m_sText.c_str(), static_cast<int>(m_nTextLength), &rBoundary, m_nTextFormat, &m_dtp);
+
+// LCDUITRACE(_T("Drawing %s at (%d,%d)-(%d-%d) lmargin=%d, rmargin=%d\n"),
+// m_sText.c_str(), m_Origin.x, m_Origin.y, GetWidth(), GetHeight(),
+// m_dtp.iLeftMargin, m_dtp.iRightMargin);
+
+ if (m_bInverted)
+ {
+ InvertRect(rGfx.GetHDC(), &rBoundary);
+ }
+}
+
+
+//************************************************************************
+//
+// CLCDText::OnDraw
+//
+//************************************************************************
+
+void CLCDText::OnDraw(CLCDGfx &rGfx)
+{
+
+ if (GetBackgroundMode() == OPAQUE)
+ {
+ // clear the clipped area
+ RECT rcClp = { 0, 0, m_Size.cx, m_Size.cy };
+ FillRect(rGfx.GetHDC(), &rcClp, (HBRUSH) GetStockObject(BLACK_BRUSH));
+
+ // clear the logical area
+ RECT rcLog = { 0, 0, m_sizeLogical.cx, m_sizeLogical.cy };
+ FillRect(rGfx.GetHDC(), &rcLog, (HBRUSH) GetStockObject(BLACK_BRUSH));
+ }
+
+ if (m_nTextLength)
+ {
+
+ // map mode text, with transparency
+ int nOldMapMode = SetMapMode(rGfx.GetHDC(), MM_TEXT);
+ int nOldBkMode = SetBkMode(rGfx.GetHDC(), GetBackgroundMode());
+
+ // select current font
+ HFONT hOldFont = (HFONT)SelectObject(rGfx.GetHDC(), m_hFont);
+
+ // select color
+ COLORREF crOldTextColor = SetTextColor(rGfx.GetHDC(), m_crColor);
+
+ if (m_bRecalcExtent)
+ {
+ int nTextFormat;
+
+ RECT rExtent;
+ // calculate vertical extent with word wrap
+ nTextFormat = (m_nTextFormat | DT_WORDBREAK | DT_CALCRECT);
+ rExtent.left = rExtent.top = 0;
+ rExtent.right = GetWidth();
+ rExtent.bottom = GetHeight();
+ DrawTextEx(rGfx.GetHDC(), (LPTSTR)m_sText.c_str(), static_cast<int>(m_nTextLength), &rExtent, nTextFormat, &m_dtp);
+ m_sizeVExtent.cx = rExtent.right;
+ m_sizeVExtent.cy = rExtent.bottom;
+
+ // calculate horizontal extent w/o word wrap
+ nTextFormat = (m_nTextFormat | DT_CALCRECT);
+ rExtent.left = rExtent.top = 0;
+ rExtent.right = GetWidth();
+ rExtent.bottom = GetHeight();
+ DrawTextEx(rGfx.GetHDC(), (LPTSTR)m_sText.c_str(), static_cast<int>(m_nTextLength), &rExtent, nTextFormat, &m_dtp);
+ m_sizeHExtent.cx = rExtent.right;
+ m_sizeHExtent.cy = rExtent.bottom;
+
+ m_bRecalcExtent = FALSE;
+ }
+
+ if (IsVisible())
+ {
+ DrawText(rGfx);
+ }
+
+ // restores
+ SetMapMode(rGfx.GetHDC(), nOldMapMode);
+ SetTextColor(rGfx.GetHDC(), crOldTextColor);
+ SetBkMode(rGfx.GetHDC(), nOldBkMode);
+ SelectObject(rGfx.GetHDC(), hOldFont);
+ }
+}
+
+//** end of LCDText.cpp **************************************************
+
diff --git a/src/ui/LCDUI/LCDText.h b/src/ui/LCDUI/LCDText.h
new file mode 100644
index 000000000..3a74f746f
--- /dev/null
+++ b/src/ui/LCDUI/LCDText.h
@@ -0,0 +1,71 @@
+//************************************************************************
+//
+// LCDText.h
+//
+// The CLCDText class draws simple text onto the LCD.
+//
+// Logitech LCD SDK
+//
+// Copyright 2005 Logitech Inc.
+//************************************************************************
+
+#ifndef _LCDTEXT_H_INCLUDED_
+#define _LCDTEXT_H_INCLUDED_
+
+#include "LCDBase.h"
+
+#include <string>
+using namespace std;
+
+class CLCDText : public CLCDBase
+{
+
+public:
+ CLCDText();
+ virtual ~CLCDText();
+
+ virtual HRESULT Initialize(void);
+
+ virtual void SetFont(LOGFONT& lf);
+ virtual void SetFontFaceName(LPCTSTR szFontName);
+ virtual void SetFontPointSize(int nPointSize);
+ virtual void SetFontWeight(int nWeight);
+
+ virtual HFONT GetFont();
+ virtual void SetText(LPCTSTR szText);
+ virtual LPCTSTR GetText();
+ virtual void SetWordWrap(BOOL bEnable);
+ virtual SIZE& GetVExtent();
+ virtual SIZE& GetHExtent();
+ virtual void SetLeftMargin(int nLeftMargin);
+ virtual int GetLeftMargin(void);
+ virtual void SetRightMargin(int nRightMargin);
+ virtual int GetRightMargin(void);
+ virtual void SetAlignment(int nAlignment = DT_LEFT);
+
+ virtual void OnDraw(CLCDGfx &rGfx);
+
+ enum { DEFAULT_DPI = 96, DEFAULT_POINTSIZE = 8 };
+
+protected:
+ void DrawText(CLCDGfx &rGfx);
+
+#ifdef UNICODE
+ std::wstring m_sText;
+#else
+ std::string m_sText;
+#endif
+ HFONT m_hFont;
+ COLORREF m_crColor;
+ basic_string <TCHAR>::size_type m_nTextLength;
+ UINT m_nTextFormat;
+ BOOL m_bRecalcExtent;
+ DRAWTEXTPARAMS m_dtp;
+ int m_nTextAlignment;
+ SIZE m_sizeVExtent, m_sizeHExtent;
+};
+
+
+#endif // !_LCDTEXT_H_INCLUDED_
+
+//** end of LCDText.h ****************************************************
diff --git a/src/ui/LCDUI/LCDUI.sln b/src/ui/LCDUI/LCDUI.sln
new file mode 100644
index 000000000..1440c1439
--- /dev/null
+++ b/src/ui/LCDUI/LCDUI.sln
@@ -0,0 +1,25 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LCDUI", "LCDUI.vcproj", "{476B97B4-F079-4A44-AF89-52CA30C35E28}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug Unicode|Win32 = Debug Unicode|Win32
+ Debug|Win32 = Debug|Win32
+ Release Unicode|Win32 = Release Unicode|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {476B97B4-F079-4A44-AF89-52CA30C35E28}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {476B97B4-F079-4A44-AF89-52CA30C35E28}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {476B97B4-F079-4A44-AF89-52CA30C35E28}.Debug|Win32.ActiveCfg = Debug|Win32
+ {476B97B4-F079-4A44-AF89-52CA30C35E28}.Debug|Win32.Build.0 = Debug|Win32
+ {476B97B4-F079-4A44-AF89-52CA30C35E28}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {476B97B4-F079-4A44-AF89-52CA30C35E28}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {476B97B4-F079-4A44-AF89-52CA30C35E28}.Release|Win32.ActiveCfg = Release|Win32
+ {476B97B4-F079-4A44-AF89-52CA30C35E28}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/ui/LCDUI/LCDUI.vcproj b/src/ui/LCDUI/LCDUI.vcproj
new file mode 100644
index 000000000..cd9a656a9
--- /dev/null
+++ b/src/ui/LCDUI/LCDUI.vcproj
@@ -0,0 +1,343 @@
+<?xml version="1.0" encoding="Windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="LCDUI"
+ ProjectGUID="{476B97B4-F079-4A44-AF89-52CA30C35E28}"
+ RootNamespace="LCDUI"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\common.vsprops;..\..\debug.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\lib$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\common.vsprops;..\..\release.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\lib$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\common.vsprops;..\..\debug.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\lib$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\common.vsprops;..\..\release.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\lib$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\LCDAnimatedBitmap.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDBase.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDBitmap.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDGfx.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDOutput.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDProgressBar.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDScrollingText.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDText.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\LCDAnimatedBitmap.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDBase.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDBitmap.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDCollection.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDGfx.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDManager.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDOutput.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDProgressBar.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDScrollingText.h"
+ >
+ </File>
+ <File
+ RelativePath=".\LCDText.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>