summaryrefslogtreecommitdiff
path: root/protocols/MinecraftDynmap/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/MinecraftDynmap/src')
-rw-r--r--protocols/MinecraftDynmap/src/dialogs.cpp47
-rw-r--r--protocols/MinecraftDynmap/src/dialogs.h2
2 files changed, 16 insertions, 33 deletions
diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp
index 3639e3cc6b..b74debb644 100644
--- a/protocols/MinecraftDynmap/src/dialogs.cpp
+++ b/protocols/MinecraftDynmap/src/dialogs.cpp
@@ -24,26 +24,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Icons
-static IconItem iconList[] = {
+static IconItem iconList[] =
+{
{ "proto", LPGEN("Protocol icon"), IDI_PROTO },
};
static HANDLE hIconLibItem[_countof(iconList)];
-void InitIcons(void) {
+void InitIcons(void)
+{
g_plugin.registerIcon("Protocols/MinecraftDynmap", iconList, "MinecraftDynmap");
}
-HANDLE GetIconHandle(const char* name) {
- for (size_t i = 0; i < _countof(iconList); i++) {
- if (strcmp(iconList[i].szName, name) == 0) {
- return hIconLibItem[i];
- }
- }
- return nullptr;
-}
-
-
// Dialogs
static void LoadDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
@@ -55,14 +47,13 @@ static void LoadDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const
static void StoreDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
- wchar_t tstr[250+1];
+ wchar_t tstr[250 + 1];
GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr));
- if (tstr[0] != '\0') {
+ if (tstr[0] != '\0')
db_set_ws(0, ppro->m_szModuleName, szSetting, tstr);
- } else {
+ else
db_unset(0, ppro->m_szModuleName, szSetting);
- }
}
@@ -70,36 +61,31 @@ INT_PTR CALLBACK MinecraftDynmapAccountProc(HWND hwnd, UINT message, WPARAM wpar
{
MinecraftDynmapProto *proto;
- switch (message)
- {
-
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<MinecraftDynmapProto*>(lparam);
- SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
LoadDBText(proto, hwnd, IDC_SERVER, MINECRAFTDYNMAP_KEY_SERVER);
LoadDBText(proto, hwnd, IDC_NAME, MINECRAFTDYNMAP_KEY_NAME);
-
return TRUE;
case WM_COMMAND:
switch (LOWORD(wparam)) {
- case IDC_NAME: {
- if (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus()) {
- return TRUE;
- } else {
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
- }
+ case IDC_NAME:
+ if (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus())
+ return TRUE;
+
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
}
break;
case WM_NOTIFY:
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY) {
- proto = reinterpret_cast<MinecraftDynmapProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
+ proto = reinterpret_cast<MinecraftDynmapProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
StoreDBText(proto, hwnd, IDC_SERVER, MINECRAFTDYNMAP_KEY_SERVER);
StoreDBText(proto, hwnd, IDC_NAME, MINECRAFTDYNMAP_KEY_NAME);
@@ -107,7 +93,6 @@ INT_PTR CALLBACK MinecraftDynmapAccountProc(HWND hwnd, UINT message, WPARAM wpar
return TRUE;
}
break;
-
}
return FALSE;
}
diff --git a/protocols/MinecraftDynmap/src/dialogs.h b/protocols/MinecraftDynmap/src/dialogs.h
index d80024c8cf..b7f2dd5be7 100644
--- a/protocols/MinecraftDynmap/src/dialogs.h
+++ b/protocols/MinecraftDynmap/src/dialogs.h
@@ -23,7 +23,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
void InitIcons(void);
-HANDLE GetIconHandle(const char *name);
INT_PTR CALLBACK MinecraftDynmapAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
-INT_PTR CALLBACK MinecraftDynmapOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);