aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow/lllogitechlcd.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llwindow/lllogitechlcd.cpp296
1 files changed, 0 insertions, 296 deletions
diff --git a/linden/indra/llwindow/lllogitechlcd.cpp b/linden/indra/llwindow/lllogitechlcd.cpp
deleted file mode 100644
index 81e97a0..0000000
--- a/linden/indra/llwindow/lllogitechlcd.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
1/**
2 * @file lcd.cpp
3 * @brief cLcd panel class
4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
7 * Copyright (c) 2001-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#include "linden_common.h"
33
34#if LL_LCD_COMPILE
35
36#include "EZ_LCD.h"
37#include "../newview/res/resource.h"
38#include "llcontrol.h"
39extern LLControlGroup gSavedSettings;
40
41#ifndef LL_LOGITECH_LCD_H
42#include "lllogitechlcd.h"
43#endif
44
45#define WAIT_DURATION 7
46#define DEBOUNCE_DURATION 0.3f
47
48LLLCDPageGroup::LLLCDPageGroup(CEzLcd *LCD, int type, HICON SLIcon):
49mType(type),
50mHandle(NULL),
51mSLIcon(SLIcon),
52mDisplayPage(false),
53mLCD(LCD)
54{
55 mPageArray.clear();
56}
57
58LLLCDPageGroup::~LLLCDPageGroup()
59{
60 mPageArray.clear();
61}
62
63void llDefaultPageGroup::UpdateDetails()
64{
65 mLCD->ModifyControlsOnPage(mPageArray[0].mPageIndex);
66}
67
68void llDefaultPageGroup::GetDisplayable()
69{
70
71}
72
73llDefaultPageGroup::llDefaultPageGroup(CEzLcd *LCD, int type, HICON SLIcon)
74:LLLCDPageGroup(LCD, type, SLIcon)
75{
76 // create a new specific page
77 LLLCDSpecificPage newPage;
78 newPage.mPageIndex = mLCD->AddNewPage() - 1;
79 mLCD->ModifyControlsOnPage(newPage.mPageIndex);
80
81 // add in all the display parts for this specific page
82
83 // add in the icon - all pages have this - we don't need to track this because we never update it
84 HANDLE m_rightIcon = mLCD->AddIcon(mSLIcon, 32, 32);
85 mLCD->SetOrigin(m_rightIcon, 0, 0);
86
87 // add Title
88 HANDLE title = mLCD->AddText(LG_STATIC_TEXT, LG_MEDIUM, DT_CENTER, 128);
89 mLCD->SetOrigin(title, 32, 20);
90 mLCD->SetText(title, _T("Second Life Display"));
91 newPage.mDisplayItemArray.push_back(title);
92
93 // and then insert it
94 mPageArray.push_back(newPage);
95}
96
97LLLCD::LLLCD(HINSTANCE instance):
98mInited(false),
99mDisplayTimer(),
100mDebounceTimer(),
101mPageToShow(-1),
102mInstance(instance),
103mDestinationLCD(-1),
104mFirstTimeThru(true),
105mCurrentGroupBeingShown(NULL),
106mSLIcon(NULL)
107{
108 HRESULT res_ = S_OK;
109
110 // Create instance of EzLcd.
111 mLCD = new CEzLcd();
112
113 // Have it initialize itself
114 res_ = mLCD->InitYourself(_T("Second Life"));
115
116 if (res_ != S_OK)
117 {
118 // Something went wrong, when connecting to the LCD Manager software. We need to get out now
119 delete mLCD;
120 return;
121 }
122 mInited = true;
123
124 // preload the Second Life Icon
125 mSLIcon = static_cast<HICON>(LoadImage(mInstance,
126 MAKEINTRESOURCE(IDI_LCD_LL_ICON),
127 IMAGE_ICON,
128 32,
129 32,
130 LR_MONOCHROME));
131
132 // have to do this first so screens are added to the list and updateDisplay actually does something.
133 mLCD->Update();
134}
135
136LLLCD::~LLLCD()
137{
138 // remove the instance of the LCD controller
139 if (mInited == true)
140 {
141 delete mLCD;
142
143 // free up the used pages
144 int loopSize = mPageGroupArray.size();
145 for(int i= 0; i<loopSize; i++)
146 {
147 free (mPageGroupArray[i]);
148 }
149 }
150}
151
152LLLCDPageGroup *LLLCD::GetNextPageToDisplay()
153{
154 // find group with current page in it.
155
156 int groupSize = mPageGroupArray.size();
157 for(int x=1; x< groupSize; x++)
158 {
159 if (mPageGroupArray[x]->mDisplayPage)
160 {
161 // now walk all the pages in the page group we are looking at
162 int numPages = mPageGroupArray[x]->mPageArray.size();
163 for (int zx = 0; zx< numPages; zx++)
164 {
165 // found it.
166 if (mPageToShow == mPageGroupArray[x]->mPageArray[zx].mPageIndex)
167 {
168 // move to the next one
169 if (zx < numPages-1)
170 {
171 mPageToShow = mPageGroupArray[x]->mPageArray[zx+1].mPageIndex;
172 return mPageGroupArray[x];
173 }
174 else
175 {
176 for(int y=x+1; y< groupSize; y++)
177 {
178 if (mPageGroupArray[y]->mDisplayPage)
179 {
180 mPageToShow = mPageGroupArray[y]->mPageArray[0].mPageIndex;
181 return mPageGroupArray[y];
182 }
183 }
184 }
185 }
186 }
187 }
188 }
189
190 // ok, didn't find it. Start again at the beginning and find the first group that's enabled
191 for(int x=1; x< groupSize; x++)
192 {
193 if (mPageGroupArray[x]->mDisplayPage)
194 {
195 mPageToShow = mPageGroupArray[x]->mPageArray[0].mPageIndex;
196 return mPageGroupArray[x];
197 }
198 }
199 // if we got this far, we should display the default screen
200 mPageToShow = mPageGroupArray[0]->mPageArray[0].mPageIndex;
201 return mPageGroupArray[0];
202}
203
204void LLLCD::SetUpDisplayPages()
205{
206 // work out if destination has changed
207 int destinationLCD = gSavedSettings.getS32("LCDDestination");
208 switch(destinationLCD)
209 {
210 case 0:
211 destinationLCD = LGLCD_DEVICE_FAMILY_KEYBOARD_G15;
212 break;
213 case 1:
214 destinationLCD = LGLCD_DEVICE_FAMILY_SPEAKERS_Z10;
215 break;
216 }
217 // set destination if it's changed
218 if (mDestinationLCD != destinationLCD)
219 {
220 mDestinationLCD = destinationLCD;
221 mLCD->SetDeviceFamilyToUse(destinationLCD);
222 }
223 int loopSize = mPageGroupArray.size();
224 for(int i= 0; i<loopSize; i++)
225 {
226 mPageGroupArray[i]->GetDisplayable();
227 }
228}
229
230void LLLCD::UpdateDisplay()
231{
232 if (mInited)
233 {
234 // reset pages if anything has changed
235 SetUpDisplayPages();
236 if (mLCD->IsConnected())
237 {
238 // Switching back and forth between the pages that we've created
239 if (mDisplayTimer.getElapsedTimeF32() > WAIT_DURATION || mFirstTimeThru)
240 {
241 mCurrentGroupBeingShown = GetNextPageToDisplay();
242 mDisplayTimer.reset();
243 mFirstTimeThru = false;
244 }
245
246 // Check if button 1 triggered
247 if ((mLCD->ButtonIsPressed(LG_BUTTON_1)
248 || mLCD->ButtonIsPressed(LG_BUTTON_2)
249 || mLCD->ButtonIsPressed(LG_BUTTON_3)
250 || mLCD->ButtonIsPressed(LG_BUTTON_4)
251 ) && mDebounceTimer.getElapsedTimeF32() > DEBOUNCE_DURATION)
252 {
253 // if so, move us on a page
254 mCurrentGroupBeingShown = GetNextPageToDisplay();
255 mDisplayTimer.reset();
256 mDebounceTimer.reset();
257 }
258
259 // update that which is being show
260 mCurrentGroupBeingShown->UpdateDetails();
261
262 // set which page is shown
263 mLCD->ShowPage(mPageToShow);
264
265 // Must run the following every loop.
266 mLCD->Update();
267 }
268 }
269}
270
271
272// accessor functions
273bool LLLCD::Enabled()
274{
275 return mInited;
276}
277
278BOOL LLLCD::AreZ10Available()
279{
280 if (mInited == true)
281 {
282 return mLCD->AnyDeviceOfThisFamilyPresent(LGLCD_DEVICE_FAMILY_SPEAKERS_Z10);
283 }
284 return false;
285}
286
287BOOL LLLCD::IsG15Available()
288{
289 if (mInited == true)
290 {
291 return mLCD->AnyDeviceOfThisFamilyPresent(LGLCD_DEVICE_FAMILY_KEYBOARD_G15);
292 }
293 return false;
294}
295
296#endif