diff options
Diffstat (limited to 'gps+/options.cpp')
-rw-r--r-- | gps+/options.cpp | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/gps+/options.cpp b/gps+/options.cpp deleted file mode 100644 index c152fdd..0000000 --- a/gps+/options.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/*
- GPS+: Service plugin for Miranda IM
- Copyright 2007-2008 persei
-
- persei@miranda.im
- http://persei.miranda.im
- http://svn.miranda.im/mainrepo/gps+
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "common.h"
-
-extern HINSTANCE hInst;
-
-BOOL CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch ( msg ) {
- case WM_INITDIALOG:
- {
- DWORD Ports_MemSize = 0;
- DWORD Ports_Count = 0;
- BYTE* lpPorts = NULL;
-
- //Getting Ports_MemSize value...
- EnumPorts(NULL,
- 1,
- lpPorts,
- 0,
- &Ports_MemSize,
- &Ports_Count);
-
-
- //Getting lpPorts...
- lpPorts = new BYTE[Ports_MemSize];
- EnumPorts(NULL,
- 1,
- lpPorts,
- Ports_MemSize,
- &Ports_MemSize,
- &Ports_Count);
-
- PORT_INFO_1 *pPortInfo;
- pPortInfo = (PORT_INFO_1 *)lpPorts - 1;
-
- for(int i = 0; i < Ports_Count; i++)
- {
- pPortInfo++;
- if(!strstr(pPortInfo->pName, "COM")) continue;
-
- pPortInfo->pName[strlen(pPortInfo->pName) - 1] = 0;
-
- char COM_string[255];
-
- sprintf_s(COM_string, 255, "\\\\.\\%s", pPortInfo->pName);
-
- HANDLE h = CreateFile(COM_string, GENERIC_READ|GENERIC_WRITE, 0, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);
-
- if(h != INVALID_HANDLE_VALUE)
- {
- CloseHandle(h);
- SendDlgItemMessage(hwndDlg, IDC_COMPORT, CB_ADDSTRING, 0, (LPARAM)pPortInfo->pName);
- }
- }
-
-
- WORD wPort = DBGetContactSettingWord(NULL, "GPS+", "Port", 999);
- if(wPort != 999){
- char ComPort[255];
- sprintf_s(ComPort, 255, "COM%d", wPort);
- SetDlgItemText(hwndDlg, IDC_COMPORT, ComPort);
- }
-
- CheckDlgButton(hwndDlg, IDC_AUTODISCONNECT, DBGetContactSettingByte(NULL, "GPS+", "AutoDisconnect", 1));
- CheckDlgButton(hwndDlg, IDC_CHECKSUM, DBGetContactSettingByte(NULL, "GPS+", "CheckSum", 1));
-
- TranslateDialogDefault( hwndDlg );
- return TRUE;
- }
- case WM_COMMAND:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- return TRUE;
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
- WORD wPort = 0;
- char ComPort[255];
- GetDlgItemText(hwndDlg, IDC_COMPORT, ComPort, 255);
- sscanf(ComPort, "COM%d", &wPort);
- if(wPort == 0){
- MessageBox(0, Translate("Wrong port specified"), Translate("Error"), MB_OK);
- }
- else
- {
- gps.SetPort(wPort);
- if(gps.ReConnect())
- {
- DBWriteContactSettingWord(NULL, "GPS+", "Port", wPort);
- }
- else
- {
- MessageBox(0, Translate("Unnable connect to specified port"), Translate("Error"), MB_OK);
- }
-
- }
- DBWriteContactSettingByte(NULL, "GPS+", "CheckSum", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHECKSUM));
- DBWriteContactSettingByte(NULL, "GPS+", "AutoDisconnect", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTODISCONNECT));
- gps.SetAutoDisconnect(DBGetContactSettingByte(NULL, "GPS+", "AutoDisconnect", 1) ? 5 : 0);
- gps.SetCheckSum(DBGetContactSettingByte(NULL, "GPS+", "CheckSum", 1));
- }
- return TRUE;
- }
-
- return FALSE;
-}
-
-int OptionsInit(WPARAM wParam, LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp;
-
- odp.cbSize = 60;
- odp.position = -790000000;
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.flags = ODPF_BOLDGROUPS;
- odp.pszTitle = Translate("GPS+");
- odp.pszGroup = Translate("Services");
- odp.nIDBottomSimpleControl = 0;
- odp.pfnDlgProc = DlgProcOptions;
- CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
-
- return 0;
-}
-
-
-void InitOptions()
-{
- HookEvent(ME_OPT_INITIALISE, OptionsInit);
-}
\ No newline at end of file |