diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-20 09:37:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-20 09:37:48 +0000 |
commit | 64751211cc037081bc32d4c41c17e064162d6ca4 (patch) | |
tree | 0d273bc5bfefbf45b39bcad9b65df16583f1e8ee | |
parent | 2c41d37ed5f2f0cb78300f8287933a4922ae1d28 (diff) |
- fix for moving groups;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@17326 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.h | 6 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clc.h | 6 | ||||
-rw-r--r-- | src/mir_app/src/clc.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/clistgroups.cpp | 26 |
4 files changed, 20 insertions, 26 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h index da445957b7..f8413b9bff 100644 --- a/plugins/Clist_modern/src/modern_clc.h +++ b/plugins/Clist_modern/src/modern_clc.h @@ -94,12 +94,6 @@ void clcSetDelayTimer(UINT_PTR uIDEvent, HWND hwnd, int nDelay = -1); #define FONTID_VIEMODES 23
#define FONTID_MODERN_MAX 23
-#define DROPTARGET_OUTSIDE 0
-#define DROPTARGET_ONSELF 1
-#define DROPTARGET_ONNOTHING 2
-#define DROPTARGET_ONGROUP 3
-#define DROPTARGET_ONCONTACT 4
-#define DROPTARGET_INSERTION 5
#define DROPTARGET_ONMETACONTACT 6
#define DROPTARGET_ONSUBCONTACT 7
diff --git a/plugins/Clist_nicer/src/clc.h b/plugins/Clist_nicer/src/clc.h index b083c93a83..da7fb1fe3a 100644 --- a/plugins/Clist_nicer/src/clc.h +++ b/plugins/Clist_nicer/src/clc.h @@ -381,12 +381,6 @@ void RecalcScrollBar(HWND hwnd, struct ClcData *dat); size_t MY_pathToRelative(const wchar_t *pSrc, wchar_t *pOut);
size_t MY_pathToAbsolute(const wchar_t *pSrc, wchar_t *pOut);
-#define DROPTARGET_OUTSIDE 0
-#define DROPTARGET_ONSELF 1
-#define DROPTARGET_ONNOTHING 2
-#define DROPTARGET_ONGROUP 3
-#define DROPTARGET_ONCONTACT 4
-#define DROPTARGET_INSERTION 5
int GetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt);
void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst);
void RecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat);
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 0af50af530..4074bb4a91 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -72,8 +72,12 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
if (hContact == NULL) {
- if (!strcmp(cws->szModule, "CListGroups") && !g_bGroupsLocked)
- Clist_Broadcast(INTM_GROUPSCHANGED, hContact, lParam);
+ if (!strcmp(cws->szModule, "CListGroups")) {
+ if (g_bGroupsLocked)
+ Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
+ else
+ Clist_Broadcast(INTM_GROUPSCHANGED, hContact, lParam);
+ }
return 0;
}
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index b8b3bbdb0e..524f91b9f0 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -268,30 +268,32 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) if (hGroup == 0 || hGroup == hGroupBefore)
return 0;
- CGroupInternal *pGroup = arByIds.find(hGroup - 1);
+ hGroup--;
+ CGroupInternal *pGroup = arByIds.find(hGroup);
if (pGroup == NULL)
return 0;
// shuffle list of groups up to fill gap
int shuffleFrom, shuffleTo, shuffleStep;
if (hGroupBefore == 0) {
- shuffleFrom = hGroup - 1;
- shuffleTo = -1;
+ shuffleFrom = 0;
+ shuffleTo = hGroup;
shuffleStep = 1;
}
else {
- CGroupInternal *pDest = arByIds.find(hGroupBefore - 1);
+ hGroupBefore--;
+ CGroupInternal *pDest = arByIds.find(hGroupBefore);
if (pDest == NULL)
return 0;
if (hGroup < hGroupBefore) {
- shuffleFrom = hGroup - 1;
- shuffleTo = hGroupBefore - 2;
+ shuffleFrom = hGroup;
+ shuffleTo = hGroupBefore;
shuffleStep = 1;
}
else {
- shuffleFrom = hGroup - 1;
- shuffleTo = hGroupBefore - 1;
+ shuffleFrom = hGroupBefore;
+ shuffleTo = hGroup;
shuffleStep = -1;
}
}
@@ -299,17 +301,18 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) g_bGroupsLocked = true;
arByIds.remove(pGroup);
- for (int i = shuffleFrom; i != shuffleTo; i += shuffleStep) {
- CGroupInternal *p = arByIds[i + shuffleStep];
+ for (int i = shuffleFrom; i < shuffleTo; i++) {
+ CGroupInternal *p = arByIds[i];
p->groupId -= shuffleStep;
p->save();
}
- pGroup->groupId = shuffleTo; // reinsert group back
+ pGroup->groupId = hGroupBefore; // reinsert group back
pGroup->save();
arByIds.insert(pGroup);
g_bGroupsLocked = false;
+ Clist_BroadcastAsync(CLM_AUTOREBUILD, 0, 0);
return shuffleTo + 1;
}
@@ -374,7 +377,6 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) }
}
}
- Clist_BroadcastAsync(CLM_AUTOREBUILD, 0, 0);
}
const CLISTGROUPCHANGE grpChg = { sizeof(grpChg), oldName, (wchar_t*)szName };
|