summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-14 19:06:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-14 19:06:59 +0000
commite3ffab889d900847fa6fb9807bc5f818da28c358 (patch)
tree5722d206bdaeaec951c1c293bb671cd7347ebad7 /src
parente2e713063780dd623c8025b6f4762c1e32bc784d (diff)
much less crazy way to organize clist data
git-svn-id: http://svn.miranda-ng.org/main/trunk@973 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/clist/clc.cpp47
-rw-r--r--src/modules/clist/clc.h59
-rw-r--r--src/modules/clist/clcitems.cpp12
-rw-r--r--src/modules/clist/clcutils.cpp1
4 files changed, 57 insertions, 62 deletions
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 56a8b66c35..f7d9ba1411 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -738,7 +738,16 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case VK_END: dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1; selMoved = 1; break;
case VK_LEFT: changeGroupExpand = 1; break;
case VK_RIGHT: changeGroupExpand = 2; break;
- case VK_RETURN: cli.pfnDoSelectionDefaultAction(hwnd, dat); return 0;
+ case VK_RETURN: cli.pfnDoSelectionDefaultAction(hwnd, dat);
+ // TODO: clear filtering here somehow?
+ /*if (dat->filterSearch) {
+ dat->szQuickSearch[0] = 0;
+ cli.pfnSaveStateAndRebuildList(hwnd, dat);
+ //cli.pfnRebuildEntireList(hwnd, dat);
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }*/
+ return 0;
case VK_F2: cli.pfnBeginRenameSelection(hwnd, dat); return 0;
case VK_DELETE: cli.pfnDeleteFromContactList(hwnd, dat); return 0;
default:
@@ -757,7 +766,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
int hit;
struct ClcContact *contact;
struct ClcGroup *group;
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this shouldn't clear filtering, but it should refresh highlighting somehow?
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, &group);
if (hit != -1) {
if (changeGroupExpand == 1 && contact->type == CLCIT_CONTACT) {
@@ -776,7 +789,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
return 0;
}
if (selMoved) {
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this shouldn't clear filtering, but it should refresh highlighting somehow?
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
if (dat->selection >= cli.pfnGetGroupContentsCount(&dat->list, 1))
dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1;
if (dat->selection < 0)
@@ -827,6 +844,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
_tcscat(dat->szQuickSearch, szNew);
}
+
+ if (dat->filterSearch) {
+ cli.pfnSaveStateAndRebuildList(hwnd, dat);
+ //cli.pfnRebuildEntireList(hwnd, dat);
+ }
if (dat->szQuickSearch[0]) {
int index;
index = cli.pfnFindRowByText(hwnd, dat, dat->szQuickSearch, 1);
@@ -835,6 +857,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
else {
MessageBeep(MB_OK);
dat->szQuickSearch[ lstrlen(dat->szQuickSearch) - 1] = '\0';
+ cli.pfnSaveStateAndRebuildList(hwnd, dat);
}
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
@@ -928,7 +951,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
cli.pfnEndRename(hwnd, dat, 1);
dat->ptDragStart.x = (short) LOWORD(lParam);
dat->ptDragStart.y = (short) HIWORD(lParam);
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this shouldn't clear filtering, but it should refresh highlighting somehow?
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, &group, &hitFlags);
if (hit != -1) {
if (hit == dat->selection && hitFlags & CLCHT_ONITEMLABEL && dat->exStyle & CLS_EX_EDITLABELS) {
@@ -1210,7 +1237,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
cli.pfnHideInfoTip(hwnd, dat);
KillTimer(hwnd, TIMERID_RENAME);
KillTimer(hwnd, TIMERID_INFOTIP);
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this should remove filtering (same as pressing ENTER)?
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
dat->selection = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
if (dat->selection != -1)
@@ -1235,7 +1266,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (GetFocus() != hwnd)
SetFocus(hwnd);
dat->iHotTrack = -1;
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this shouldn't remove filtering
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
pt.x = (short) LOWORD(lParam);
pt.y = (short) HIWORD(lParam);
if (pt.x == -1 && pt.y == -1) {
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h
index 3662cea1c6..bbcdf85528 100644
--- a/src/modules/clist/clc.h
+++ b/src/modules/clist/clc.h
@@ -21,63 +21,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-struct ClcContact {
- BYTE type;
- BYTE flags;
- union {
- struct {
- WORD iImage;
- HANDLE hContact;
- };
- struct {
- WORD groupId;
- struct ClcGroup *group;
- };
- };
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- TCHAR szText[120-MAXEXTRACOLUMNS];
- char * proto; // MS_PROTO_GETBASEPROTO
+struct ClcContact : public ClcContactBase
+{
};
-struct ClcData {
- struct ClcGroup list;
- int rowHeight;
- int yScroll;
- int selection;
- struct ClcFontInfo fontInfo[FONTID_MAX + 1];
- int scrollTime;
- HIMAGELIST himlHighlight;
- int groupIndent;
- TCHAR szQuickSearch[128];
- int iconXSpace;
- HWND hwndRenameEdit;
- COLORREF bkColour, selBkColour, selTextColour, hotTextColour, quickSearchColour;
- int iDragItem, iInsertionMark;
- int dragStage;
- POINT ptDragStart;
- int dragAutoScrolling;
- int dragAutoScrollHeight;
- int leftMargin;
- int insertionMarkHitHeight;
- HBITMAP hBmpBackground;
- int backgroundBmpUse, bkChanged;
- int iHotTrack;
- int gammaCorrection;
- DWORD greyoutFlags; //see m_clc.h
- DWORD offlineModes;
- DWORD exStyle;
- POINT ptInfoTip;
- int infoTipTimeout;
- HANDLE hInfoTipItem;
- HIMAGELIST himlExtraColumns;
- int extraColumnsCount;
- int extraColumnSpacing;
- int checkboxSize;
- int showSelAlways;
- int showIdle;
- int noVScrollbar;
- int useWindowsColours;
- int needsResort;
+struct ClcData : public ClcDataBase
+{
};
/* clc.c */
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp
index 7c0feb52ba..f52d0bc234 100644
--- a/src/modules/clist/clcitems.cpp
+++ b/src/modules/clist/clcitems.cpp
@@ -394,7 +394,17 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat)
if (group != NULL) {
group->totalMembers++;
- if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+ /*if (dat->filterSearch && dat->szQuickSearch) {
+ // search filtering
+
+ // how to get contact's visible name? this code is crashing :)
+ ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
+ if (cache) {
+ //if (!_tcsstr(CharLowerW(pdnce->tszName), CharLowerW(dat->szQuickSearch)))
+ if (_tcsnicmp(dat->szQuickSearch, cache->tszName, lstrlen(dat->szQuickSearch)))
+ cli.pfnAddContactToGroup(dat, group, hContact);
+ }
+ } else*/ if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL) {
if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp
index 8617d82f9a..6c1b1e94e7 100644
--- a/src/modules/clist/clcutils.cpp
+++ b/src/modules/clist/clcutils.cpp
@@ -749,6 +749,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat)
dat->gammaCorrection = DBGetContactSettingByte(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT);
dat->showIdle = DBGetContactSettingByte(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE);
dat->noVScrollbar = DBGetContactSettingByte(NULL, "CLC", "NoVScrollBar", 0);
+ dat->filterSearch = DBGetContactSettingByte(NULL, "CLC", "FilterSearch", 1);
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
if ( !dat->bkChanged) {
DBVARIANT dbv;