diff options
-rw-r--r-- | plugins/MirandaG15/LCDFramework/src/CLCDConnectionLogitech.cpp | 12 | ||||
-rw-r--r-- | plugins/MirandaG15/LCDFramework/src/CLCDInput.cpp | 6 | ||||
-rw-r--r-- | plugins/MirandaG15/src/CAppletManager.cpp | 24 | ||||
-rw-r--r-- | plugins/MirandaG15/src/CConfig.cpp | 25 | ||||
-rw-r--r-- | plugins/MirandaG15/src/CContactList.cpp | 2 | ||||
-rw-r--r-- | plugins/MirandaG15/src/Miranda.cpp | 38 | ||||
-rw-r--r-- | plugins/MirandaG15/src/Miranda.h | 1 |
7 files changed, 40 insertions, 68 deletions
diff --git a/plugins/MirandaG15/LCDFramework/src/CLCDConnectionLogitech.cpp b/plugins/MirandaG15/LCDFramework/src/CLCDConnectionLogitech.cpp index 7cbc355c99..a36b897e2d 100644 --- a/plugins/MirandaG15/LCDFramework/src/CLCDConnectionLogitech.cpp +++ b/plugins/MirandaG15/LCDFramework/src/CLCDConnectionLogitech.cpp @@ -244,7 +244,7 @@ bool CLCDConnectionLogitech::Connect(int iIndex) // check if the specified device exists
m_pConnectedDevice = GetAttachedDevice(iIndex);
if(m_pConnectedDevice == NULL) {
- iIndex = (!iIndex || iIndex == LGLCD_DEVICE_BW) ? LGLCD_DEVICE_QVGA : LGLCD_DEVICE_BW;
+ iIndex = (!iIndex || iIndex == LGLCD_DEVICE_BW) ? LGLCD_DEVICE_BW : LGLCD_DEVICE_QVGA;
m_pConnectedDevice = GetAttachedDevice(iIndex);
if(m_pConnectedDevice == NULL) {
return false;
@@ -259,8 +259,8 @@ bool CLCDConnectionLogitech::Connect(int iIndex) // Now lets open the LCD. We must initialize the g_OpenContext structure.
ZeroMemory(&OpenContext, sizeof(OpenContext));
OpenContext.connection = m_hConnection;
- OpenContext.deviceType = LGLCD_DEVICE_QVGA;
- OpenContext.device = LGLCD_INVALID_DEVICE;
+ OpenContext.deviceType = m_pConnectedDevice->GetIndex();//LGLCD_DEVICE_QVGA;
+ OpenContext.device = LGLCD_INVALID_DEVICE;
// softbutton callbacks are not needed
OpenContext.onSoftbuttonsChanged.softbuttonsChangedCallback = softButtonCallback;
@@ -364,13 +364,13 @@ void CLCDConnectionLogitech::OnNotificationCB( DWORD notificationCode, DWORD not int *counter = notifyParm1 == LGLCD_DEVICE_QVGA ? &m_iNumQVGADevices : &m_iNumBWDevices;
if(*counter == 0) {
SIZE size;
- if(LGLCD_DEVICE_QVGA) {
+ if(notifyParm1 == LGLCD_DEVICE_QVGA) {
size.cx = 320;
size.cy = 240;
device = new CLgLCDDevice(notifyParm1,size,7,4);
} else {
- size.cx = 320;
- size.cy = 240;
+ size.cx = 160;
+ size.cy = 43;
device = new CLgLCDDevice(notifyParm1,size,4,1);
}
m_lcdDevices.push_back(device);
diff --git a/plugins/MirandaG15/LCDFramework/src/CLCDInput.cpp b/plugins/MirandaG15/LCDFramework/src/CLCDInput.cpp index ab5350ec86..d482099de3 100644 --- a/plugins/MirandaG15/LCDFramework/src/CLCDInput.cpp +++ b/plugins/MirandaG15/LCDFramework/src/CLCDInput.cpp @@ -689,7 +689,7 @@ void CLCDInput::UpdateOffsets(int iModified) }
}
- iChar += iMaxChars;
+ //iChar += iMaxChars;
if(m_strText[iChar] == '\n' || sizeLine.cx > GetWidth())
{
@@ -755,11 +755,13 @@ void CLCDInput::UpdateOffsets(int iModified) }
break;
}
+
+ iChar += iMaxChars;
}
// Update line's width
if(iMaxChars > 0)
{
- if(m_strText[iChar] == '\n' && iMaxChars >= 2)
+ if(m_strText[iChar-1] == '\n' && iMaxChars >= 2)
m_vLineOffsets[iLine].iWidth = piWidths[iMaxChars-2];
else
m_vLineOffsets[iLine].iWidth = piWidths[iMaxChars-1];
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 8eb965f0a3..5307d78765 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -663,22 +663,20 @@ bool CAppletManager::IsUtfSendAvailable(HANDLE hContact) { //************************************************************************
char *CAppletManager::GetMessageServiceName(HANDLE hContact,bool bIsUnicode)
{
- if(g_bUnicode) {
- char szServiceName[100];
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char szServiceName[100];
+ char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if(szProto == NULL)
- return NULL;
-
- if (!bIsUnicode)
- return PSS_MESSAGE;
+ if(szProto == NULL)
+ return NULL;
- _snprintf(szServiceName, sizeof(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
- if (ServiceExists(szServiceName))
- return PSS_MESSAGE "W";
- } else {
+ if (!bIsUnicode)
return PSS_MESSAGE;
- }
+
+ _snprintf(szServiceName, sizeof(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
+ if (ServiceExists(szServiceName))
+ return PSS_MESSAGE "W";
+
+ return NULL;
}
//************************************************************************
diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp index 76cfc68444..c41e3d8029 100644 --- a/plugins/MirandaG15/src/CConfig.cpp +++ b/plugins/MirandaG15/src/CConfig.cpp @@ -380,8 +380,6 @@ int CConfig::GetSampleField(int iFont) INT_PTR CALLBACK CConfig::AppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- char buf[128];
-
switch (uMsg)
{
case WM_INITDIALOG:
@@ -759,8 +757,6 @@ INT_PTR CALLBACK CConfig::NotificationsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM w INT_PTR CALLBACK CConfig::ContactlistDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- char buf[128];
-
switch (uMsg)
{
case WM_INITDIALOG:
@@ -919,23 +915,26 @@ void CConfig::ClearTree(HWND hTree) void CConfig::FillDeviceBox(HWND hBox) {
CLCDConnection *connection = CAppletManager::GetInstance()->GetLCDConnection();
- CLCDDevice *device = NULL;
- int i = 0;
SendMessage(hBox,CB_RESETCONTENT,0,0);
- while((device = connection->GetAttachedDevice(i++)) != NULL) {
- SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)device->GetDisplayName().c_str());
+ int count = 0;
+ for (int i = 0; i < 10; i++) {
+ CLCDDevice *device = connection->GetAttachedDevice(i);
+ if (device != NULL) {
+ SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)device->GetDisplayName().c_str());
+ count++;
+ }
}
-
- if(i == 1) {
- SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)_T("No device attached"));
+
+ if (!count) {
+ SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)TranslateT("No device attached"));
}
int iDevice = CConfig::GetIntSetting(DEVICE);
- if( iDevice >= i)
+ if (iDevice >= count)
iDevice = 0;
- SendMessage(hBox,CB_SETCURSEL ,iDevice,0);
+ SendMessage(hBox, CB_SETCURSEL, iDevice, 0);
}
void CConfig::FillTree(HWND hTree,bool bCList)
diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index c2ba33e529..280c9e66bc 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -535,6 +535,8 @@ bool CContactList::CompareEntries(CListEntry<CContactListEntry*,CContactListGrou else
return _tcsicmp(pGroup1->strName.c_str(),pGroup2->strName.c_str())<0;
}
+
+ return false;
}
//************************************************************************
diff --git a/plugins/MirandaG15/src/Miranda.cpp b/plugins/MirandaG15/src/Miranda.cpp index 6776c397ef..c6dca99adb 100644 --- a/plugins/MirandaG15/src/Miranda.cpp +++ b/plugins/MirandaG15/src/Miranda.cpp @@ -62,7 +62,6 @@ // Variables
//************************************************************************
bool g_bInitialized;
-bool g_bUnicode;
// AppletManager object
CAppletManager* g_AppletManager;
@@ -71,13 +70,10 @@ bool g_bUnicode; HINSTANCE hInstance;
int hLangpack;
-// Initialization Hook
-static HANDLE hMIHookModulesLoaded;
-
// {58D63981-14C1-4099-A3F7-F4FAA4C8FC59}
#define MIID_G15APPLET { 0x58d63981, 0x14c1, 0x4099, { 0xa3, 0xf7, 0xf4, 0xfa, 0xa4, 0xc8, 0xfc, 0x59 } }
-static const MUUID interfaces[] = {MIID_G15APPLET, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_G15APPLET, MIID_LAST};
static PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -88,7 +84,7 @@ static PLUGININFOEX pluginInfo = { "mail@mkleinhans.de",
"© 2009 Martin Kleinhans",
"http://www.mkleinhans.de",
- 0, // not transient
+ UNICODE_AWARE, // not transient
// {798221E1-E47A-4dc8-9077-1E576F9C4307}
{ 0x798221e1, 0xe47a, 0x4dc8, { 0x90, 0x77, 0x1e, 0x57, 0x6f, 0x9c, 0x43, 0x7 } }
};
@@ -97,28 +93,15 @@ static PLUGININFOEX pluginInfo = { int Init(WPARAM,LPARAM);
void UnInit();
-
-
//************************************************************************
// Exported Functions
//************************************************************************
extern "C" {
- __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void)
- {
- return interfaces;
- }
-
__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- // Are we running under Unicode Windows version ?
- g_bUnicode = (GetVersion() & 0x80000000) == 0;
- if (g_bUnicode) {
- pluginInfo.flags = 1; // UNICODE_AWARE
- }
return &pluginInfo;
}
-
// Called by Miranda to load the plugin.
// We defer initialization until Miranda's module loading process completed and return 0 to
// mark success, everything else will cause the plugin to be freed right away.
@@ -128,15 +111,7 @@ extern "C" { InitDebug();
TRACE(_T("Plugin loaded\n"));
// Schedule actual initialization for later
- // (We don't really need the handle but want to be able to release it properly later ...)
- hMIHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, Init);
- if(hMIHookModulesLoaded == 0)
- {
- tstring text = _T("Failed to initialize the Applet.\nThe plugin will not be loaded. ");
- tstring title = _T(APP_SHORTNAME);
- MessageBox(NULL, text.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION);
- return 1;
- }
+ HookEvent(ME_SYSTEM_MODULESLOADED, Init);
return 0;
}
@@ -151,7 +126,6 @@ extern "C" { UnInit();
TRACE(_T("Unloading successful\n"));
TRACE(_T("Cleaning up: "));
- UnhookEvent(hMIHookModulesLoaded); // just to be really correct ...
UnInitDebug();
TRACE(_T("OK!\n"));
return 0;
@@ -165,7 +139,6 @@ extern "C" { //************************************************************************
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
-
hInstance = hinstDLL;
return TRUE;
}
@@ -190,14 +163,14 @@ int Init(WPARAM wParam,LPARAM lParam) CConfig::Initialize();
// Initialize the output object
- if(!g_AppletManager->Initialize(toTstring(APP_SHORTNAME)))
+ if(!g_AppletManager->Initialize(toTstring(APP_SHORTNAME)))
{
if(CConfig::GetBoolSetting(SKIP_DRIVER_ERROR)) {
tstring text = _T("Failed to initialize the LCD connection\n Make sure you have the newest Logitech drivers installed (>=1.03).\n");
tstring title = _T(APP_SHORTNAME);
MessageBox(NULL, text.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION);
}
-
+
TRACE(_T("Initialization failed!.\n"));
return 0;
}
@@ -215,7 +188,6 @@ void UnInit(void) {
g_AppletManager->Shutdown();
delete g_AppletManager;
- UnhookEvent(hMIHookModulesLoaded);
//#ifdef _DEBUG
// _CrtDumpMemoryLeaks();
diff --git a/plugins/MirandaG15/src/Miranda.h b/plugins/MirandaG15/src/Miranda.h index 851da133cb..5b35db47cd 100644 --- a/plugins/MirandaG15/src/Miranda.h +++ b/plugins/MirandaG15/src/Miranda.h @@ -1,4 +1,3 @@ extern HINSTANCE hInstance;
extern char *MsgServiceName(HANDLE hContact,bool bIsUnicode);
-extern bool g_bUnicode;
|