summaryrefslogtreecommitdiff
path: root/protocols/MinecraftDynmap/src/dialogs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/MinecraftDynmap/src/dialogs.cpp')
-rw-r--r--protocols/MinecraftDynmap/src/dialogs.cpp47
1 files changed, 16 insertions, 31 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;
}