summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-12-08 11:28:48 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-12-08 11:28:48 +0000
commit16b97339fcf1011af0d7bbc3a9e476248948fc2a (patch)
tree6418042cf360d7021c2d92f7d4356a44e43aa7f9 /src/mir_app
parent017d3afb396ce451eed85c132796f8733b07361f (diff)
first version of custom submenu button that doesn't crash (doesn't work either)
git-svn-id: http://svn.miranda-ng.org/main/trunk@15832 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/menu_options.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp
index 1a3b2f0b5e..f3c89cf9ad 100644
--- a/src/mir_app/src/menu_options.cpp
+++ b/src/mir_app/src/menu_options.cpp
@@ -73,7 +73,7 @@ class CGenMenuOptionsPage : public CDlgBase
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE | TVIF_IMAGE;
tvi.pszText = idstr;
- int count = 0;
+ int count = 0, customOrder = 0;
int runtimepos = 100;
while (tvi.hItem != NULL) {
@@ -91,8 +91,11 @@ class CGenMenuOptionsPage : public CDlgBase
else
ptszCustomName = _T("");
- CMString tszValue(FORMAT, _T("%d;%d;%s"), visible, pimi->mi.position, ptszCustomName);
- db_set_ts(NULL, (char*)szModule, menuItemName, tszValue);
+ CMString tszValue(FORMAT, _T("%d;%d;%s"), visible, runtimepos, ptszCustomName);
+ db_set_ts(NULL, szModule, menuItemName, tszValue);
+
+ if (pimi->mi.flags & CMIF_CUSTOM)
+ db_set_s(NULL, szModule, CMStringA(FORMAT, "Custom%d", customOrder++), menuItemName);
}
if (pimi->submenu.first != NULL)
@@ -401,10 +404,20 @@ public:
if (!m_menuItems.GetItem(&tvi))
return;
+ MenuItemOptData *curData = (MenuItemOptData*)tvi.lParam;
+
+ TMO_MenuItem mi = {};
+ UuidCreate((UUID*)&mi.uid);
+ mi.flags = CMIF_CUSTOM;
+ mi.name.a = LPGEN("New submenu");
+ mi.position = curData->pos - 1;
+ TMO_IntMenuItem *pimi = Menu_AddItem(curData->pimi->parent->id, &mi, NULL);
+
MenuItemOptData *PD = new MenuItemOptData();
PD->id = -1;
- PD->name = TranslateT("New submenu");
- PD->pos = ((MenuItemOptData *)tvi.lParam)->pos - 1;
+ PD->name = mir_tstrdup(pimi->mi.name.t);
+ PD->pos = pimi->mi.position;
+ PD->pimi = pimi;
TVINSERTSTRUCT tvis = { 0 };
tvis.item.lParam = (LPARAM)PD;