From d72729b46f37b9ff953a12ba2926e0b6b71f1142 Mon Sep 17 00:00:00 2001 From: sje Date: Fri, 2 Feb 2007 14:13:23 +0000 Subject: git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@105 4f64403b-2f21-0410-a795-97e2b3489a10 --- clist_classic_sje/Makefile | 53 ++ clist_classic_sje/backup.c | 256 +++++++ clist_classic_sje/clc.h | 83 +++ clist_classic_sje/clcopts.c | 923 ++++++++++++++++++++++++++ clist_classic_sje/clcpaint.c | 590 +++++++++++++++++ clist_classic_sje/clist.dep | 227 +++++++ clist_classic_sje/clist.dsp | 535 +++++++++++++++ clist_classic_sje/clist.dsw | 29 + clist_classic_sje/clist.h | 30 + clist_classic_sje/clist.mak | 754 +++++++++++++++++++++ clist_classic_sje/clist.vcproj | 515 ++++++++++++++ clist_classic_sje/clist_8.sln | 26 + clist_classic_sje/clist_8.vcproj | 781 ++++++++++++++++++++++ clist_classic_sje/clistmenus.c | 36 + clist_classic_sje/clistopts.c | 353 ++++++++++ clist_classic_sje/cluiopts.c | 363 ++++++++++ clist_classic_sje/commonheaders.c | 1 + clist_classic_sje/commonheaders.h | 84 +++ clist_classic_sje/database.c | 218 ++++++ clist_classic_sje/database.h | 214 ++++++ clist_classic_sje/db3x.dep | 56 ++ clist_classic_sje/db3x.dsp | 239 +++++++ clist_classic_sje/db3x.dsw | 29 + clist_classic_sje/db3x.mak | 471 +++++++++++++ clist_classic_sje/db3x.vcproj | 795 ++++++++++++++++++++++ clist_classic_sje/db3x_8.sln | 23 + clist_classic_sje/db3x_8.vcproj | 811 +++++++++++++++++++++++ clist_classic_sje/dbcache.c | 229 +++++++ clist_classic_sje/dbcontacts.c | 270 ++++++++ clist_classic_sje/dbevents.c | 440 ++++++++++++ clist_classic_sje/dbheaders.c | 78 +++ clist_classic_sje/dbmodulechain.c | 132 ++++ clist_classic_sje/dbsettings.c | 957 +++++++++++++++++++++++++++ clist_classic_sje/dbtime.c | 163 +++++ clist_classic_sje/docs/clist-license.txt | 340 ++++++++++ clist_classic_sje/docs/clist-readme.txt | 38 ++ clist_classic_sje/docs/clist-translation.txt | 216 ++++++ clist_classic_sje/docs/db3x-license.txt | 340 ++++++++++ clist_classic_sje/docs/db3x-readme.txt | 38 ++ clist_classic_sje/docs/db3x-translation.txt | 43 ++ clist_classic_sje/encrypt.c | 67 ++ clist_classic_sje/encryption.h | 23 + clist_classic_sje/finalcommand.c | 58 ++ clist_classic_sje/forkthread.c | 94 +++ clist_classic_sje/forkthread.h | 63 ++ clist_classic_sje/frames.c | 713 ++++++++++++++++++++ clist_classic_sje/icon1.ico | Bin 0 -> 318 bytes clist_classic_sje/init.c | 182 +++++ clist_classic_sje/meta_mod.c | 126 ++++ clist_classic_sje/meta_mod.h | 28 + clist_classic_sje/mod.c | 303 +++++++++ clist_classic_sje/mod.h | 30 + clist_classic_sje/options.c | 384 +++++++++++ clist_classic_sje/options.h | 42 ++ clist_classic_sje/res/blank.ico | Bin 0 -> 318 bytes clist_classic_sje/res/delete.ico | Bin 0 -> 1406 bytes clist_classic_sje/res/dragcopy.cur | Bin 0 -> 326 bytes clist_classic_sje/res/dropuser.cur | Bin 0 -> 1086 bytes clist_classic_sje/res/hyperlin.cur | Bin 0 -> 326 bytes clist_classic_sje/res/rename.ico | Bin 0 -> 1406 bytes clist_classic_sje/resource.h | 51 ++ clist_classic_sje/resource.rc | 583 ++++++++++++++++ clist_classic_sje/sync.bat | 4 + 63 files changed, 14530 insertions(+) create mode 100644 clist_classic_sje/Makefile create mode 100644 clist_classic_sje/backup.c create mode 100644 clist_classic_sje/clc.h create mode 100644 clist_classic_sje/clcopts.c create mode 100644 clist_classic_sje/clcpaint.c create mode 100644 clist_classic_sje/clist.dep create mode 100644 clist_classic_sje/clist.dsp create mode 100644 clist_classic_sje/clist.dsw create mode 100644 clist_classic_sje/clist.h create mode 100644 clist_classic_sje/clist.mak create mode 100644 clist_classic_sje/clist.vcproj create mode 100644 clist_classic_sje/clist_8.sln create mode 100644 clist_classic_sje/clist_8.vcproj create mode 100644 clist_classic_sje/clistmenus.c create mode 100644 clist_classic_sje/clistopts.c create mode 100644 clist_classic_sje/cluiopts.c create mode 100644 clist_classic_sje/commonheaders.c create mode 100644 clist_classic_sje/commonheaders.h create mode 100644 clist_classic_sje/database.c create mode 100644 clist_classic_sje/database.h create mode 100644 clist_classic_sje/db3x.dep create mode 100644 clist_classic_sje/db3x.dsp create mode 100644 clist_classic_sje/db3x.dsw create mode 100644 clist_classic_sje/db3x.mak create mode 100644 clist_classic_sje/db3x.vcproj create mode 100644 clist_classic_sje/db3x_8.sln create mode 100644 clist_classic_sje/db3x_8.vcproj create mode 100644 clist_classic_sje/dbcache.c create mode 100644 clist_classic_sje/dbcontacts.c create mode 100644 clist_classic_sje/dbevents.c create mode 100644 clist_classic_sje/dbheaders.c create mode 100644 clist_classic_sje/dbmodulechain.c create mode 100644 clist_classic_sje/dbsettings.c create mode 100644 clist_classic_sje/dbtime.c create mode 100644 clist_classic_sje/docs/clist-license.txt create mode 100644 clist_classic_sje/docs/clist-readme.txt create mode 100644 clist_classic_sje/docs/clist-translation.txt create mode 100644 clist_classic_sje/docs/db3x-license.txt create mode 100644 clist_classic_sje/docs/db3x-readme.txt create mode 100644 clist_classic_sje/docs/db3x-translation.txt create mode 100644 clist_classic_sje/encrypt.c create mode 100644 clist_classic_sje/encryption.h create mode 100644 clist_classic_sje/finalcommand.c create mode 100644 clist_classic_sje/forkthread.c create mode 100644 clist_classic_sje/forkthread.h create mode 100644 clist_classic_sje/frames.c create mode 100644 clist_classic_sje/icon1.ico create mode 100644 clist_classic_sje/init.c create mode 100644 clist_classic_sje/meta_mod.c create mode 100644 clist_classic_sje/meta_mod.h create mode 100644 clist_classic_sje/mod.c create mode 100644 clist_classic_sje/mod.h create mode 100644 clist_classic_sje/options.c create mode 100644 clist_classic_sje/options.h create mode 100644 clist_classic_sje/res/blank.ico create mode 100644 clist_classic_sje/res/delete.ico create mode 100644 clist_classic_sje/res/dragcopy.cur create mode 100644 clist_classic_sje/res/dropuser.cur create mode 100644 clist_classic_sje/res/hyperlin.cur create mode 100644 clist_classic_sje/res/rename.ico create mode 100644 clist_classic_sje/resource.h create mode 100644 clist_classic_sje/resource.rc create mode 100644 clist_classic_sje/sync.bat diff --git a/clist_classic_sje/Makefile b/clist_classic_sje/Makefile new file mode 100644 index 0000000..5a75630 --- /dev/null +++ b/clist_classic_sje/Makefile @@ -0,0 +1,53 @@ +SRC = commonheaders.c \ + database.c \ + dbcache.c \ + dbcontacts.c \ + dbevents.c \ + dbheaders.c \ + dbini.c \ + dblists.c \ + dbmodulechain.c \ + dbsettings.c \ + dbtime.c \ + encrypt.c \ + init.c +OBJ = $(SRC:.c=.o) +RES = resource.res +LIB = -lgdi32 -lversion -lcomctl32 -lcomdlg32 -lole32 + +CC = gcc +RC = windres +RM = rm + +# Install location +ifdef DEBUG +BIN = ..\..\bin\debug\plugins\dbx_3x.dll +else +BIN = ..\..\bin\release\plugins\dbx_3x.dll +endif + +# Defines +DEFINES = -DWIN32 -D__SEH_NOOP +ifdef DEBUG +DEFINES := $(DEFINES) -D_DEBUG +endif + +# Flags +LFLAGS = -shared +RCFLAGS = --input-format rc --output-format coff +ifdef DEBUG +CFLAGS = -g $(DEFINES) -I../../include +else +CFLAGS = -O1 $(DEFINES) -I../../include +endif + +# Targets +all : $(OBJ) $(RES) + $(CC) $(LFLAGS) $(CFLAGS) -o $(BIN) $(OBJ) $(RES) $(LIB) -Wl + +$(RES) : $(RES:.res=.rc) $(RES:.res=.h) Makefile + $(RC) $(RCFLAGS) -o $(RES) -i $(RES:.res=.rc) + +clean : + $(RM) -f $(OBJ) $(RES) + diff --git a/clist_classic_sje/backup.c b/clist_classic_sje/backup.c new file mode 100644 index 0000000..8eb26da --- /dev/null +++ b/clist_classic_sje/backup.c @@ -0,0 +1,256 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "database.h" +#include "options.h" + +#define SHOW_PROGRESS_TIME 1000 // show progress window when backup time exceeds this many milliseconds + +extern HANDLE hDbFile; +extern CRITICAL_SECTION csDbAccess; +extern HINSTANCE g_hInst; + +extern Options options; + +struct DBHeader dbHeader; + +UINT timer_id = 0; + + +BOOL CALLBACK DlgProcProgress(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) { + case WM_INITDIALOG: + { + HWND prog = GetDlgItem(hwndDlg, IDC_PROGRESS); + + TranslateDialogDefault( hwndDlg ); + + SendMessage(prog, PBM_SETPOS, 0, 0); + } + break; + case WM_COMMAND: + if ( HIWORD( wParam ) == BN_CLICKED ) { + switch( LOWORD( wParam )) { + case IDCANCEL: + // in the progress dialog, use the user data to indicate that the user has pressed cancel + SetWindowLong(hwndDlg, GWL_USERDATA, (LONG)1); + return TRUE; + } + } + break; + } + return FALSE; +} + +int RotateBackups(HWND progress_dialog, DWORD start_time) { + char num1[4], num2[4]; + char backupfilename1[MAX_PATH], backupfilename2[MAX_PATH]; + int i; + HWND prog = GetDlgItem(progress_dialog, IDC_PROGRESS); + MSG msg; + + // delete the last file, so that the rest can be rename operations + strcpy(backupfilename1, options.folder); + strcat(backupfilename1, "\\db_backup"); + itoa(options.num_backups - 1, num1, 10); + strcat(backupfilename1, num1); + strcat(backupfilename1, ".dat"); + DeleteFile(backupfilename1); + + for(i = options.num_backups - 1; i > 0 && GetWindowLong(progress_dialog, GWL_USERDATA) == 0; i--) { + strcpy(backupfilename1, options.folder); + strcat(backupfilename1, "\\db_backup"); + itoa(i - 1, num1, 10); + strcat(backupfilename1, num1); + strcat(backupfilename1, ".dat"); + + strcpy(backupfilename2, options.folder); + strcat(backupfilename2, "\\db_backup"); + itoa(i, num2, 10); + strcat(backupfilename2, num2); + strcat(backupfilename2, ".dat"); + + MoveFile(backupfilename1, backupfilename2); + + if(GetTickCount() - start_time >= SHOW_PROGRESS_TIME) + ShowWindow(progress_dialog, SW_SHOW); + + while(PeekMessage(&msg, progress_dialog, 0, 0, PM_REMOVE) != 0) { + if(!IsDialogMessage(progress_dialog, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + SendMessage(prog, PBM_SETPOS, (WPARAM)(int)(100 * (options.num_backups - i) / options.num_backups), 0); + UpdateWindow(progress_dialog); + + } + + return 0; +} + +int Backup() { + HANDLE hBackupFile; + char backup_filename[MAX_PATH]; + char buff[8192]; + DWORD bytes_read, bytes_written, file_size, total_bytes_copied = 0; + HWND progress_dialog = 0, prog; + MSG msg; + + DWORD start_time = GetTickCount(); + + // ensure the backup folder exists (either create it or return non-zero signifying error) + if(!CreateDirectory(options.folder, 0)) { + DWORD err = GetLastError(); + if(err != ERROR_ALREADY_EXISTS) { + return 1; + } + } + + if(!options.disable_progress) { + progress_dialog = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress); + prog = GetDlgItem(progress_dialog, IDC_PROGRESS); + SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, Translate("Rotating backup files...")); + } + + + RotateBackups(progress_dialog, start_time); + + strcpy(backup_filename, options.folder); + strcat(backup_filename, "\\db_backup0.dat"); + + hBackupFile = CreateFile(backup_filename, GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + + if(hBackupFile != INVALID_HANDLE_VALUE) { + if(!options.disable_progress) { + SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, Translate("Copying database file...")); + SendMessage(prog, PBM_SETPOS, (WPARAM)(int)(0), 0); + UpdateWindow(progress_dialog); + } + + EnterCriticalSection(&csDbAccess); + + file_size = GetFileSize(hDbFile, 0); + + if(file_size == 0) { + LeaveCriticalSection(&csDbAccess); + CloseHandle(hBackupFile); + DestroyWindow(progress_dialog); + return 1; + } + + SetFilePointer(hDbFile, sizeof(dbHeader), 0, FILE_BEGIN); + + if(WriteFile(hBackupFile,&dbHeader,sizeof(dbHeader),&bytes_written,NULL) == TRUE) { + total_bytes_copied += bytes_written; + if(!options.disable_progress) { + SendMessage(prog, PBM_SETPOS, (WPARAM)(int)(100.0 * total_bytes_copied / file_size), 0); + UpdateWindow(progress_dialog); + } + } else { + LeaveCriticalSection(&csDbAccess); + CloseHandle(hBackupFile); + DestroyWindow(progress_dialog); + return 1; + } + + while(ReadFile(hDbFile, buff, sizeof(buff), &bytes_read, 0) == TRUE && bytes_read > 0 + && GetWindowLong(progress_dialog, GWL_USERDATA) == 0) + { + if(!WriteFile(hBackupFile, buff, bytes_read, &bytes_written, 0)) { + LeaveCriticalSection(&csDbAccess); + CloseHandle(hBackupFile); + DestroyWindow(progress_dialog); + return 1; + } + total_bytes_copied += bytes_written; + + if(!options.disable_progress) { + + if(GetTickCount() - start_time >= SHOW_PROGRESS_TIME) + ShowWindow(progress_dialog, SW_SHOW); + + + while(PeekMessage(&msg, progress_dialog, 0, 0, PM_REMOVE) != 0) { + if(!IsDialogMessage(progress_dialog, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + SendMessage(prog, PBM_SETPOS, (WPARAM)(int)(100.0 * total_bytes_copied / file_size), 0); + UpdateWindow(progress_dialog); + } + } + LeaveCriticalSection(&csDbAccess); + + CloseHandle(hBackupFile); + + if(!options.disable_progress && GetWindowLong(progress_dialog, GWL_USERDATA) != 0) + DeleteFile(backup_filename); + else + DBWriteContactSettingDword(0, "db3x", "LastBackupTimestamp", (DWORD)time(0)); + + if(!options.disable_progress) + DestroyWindow(progress_dialog); + + return 0; + } + + DestroyWindow(progress_dialog); + return 1; +} + +VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { + time_t t = time(0), diff = t - (time_t)DBGetContactSettingDword(0, "db3x", "LastBackupTimestamp", (DWORD)t); + if(diff > (time_t)(options.period * (options.period_type == PT_HOURS ? 60 * 60 : 60 * 60 * 24))) + Backup(); +} + +int SetBackupTimer(void) { + + if(options.backup_types & BT_PERIODIC) { + if(timer_id == 0) { + time_t t = time(0), diff = t - (time_t)DBGetContactSettingDword(0, "db3x", "LastBackupTimestamp", (DWORD)t); + if(diff > (time_t)(options.period * (options.period_type == PT_HOURS ? 60 * 60 : 60 * 60 * 24))) + Backup(); + + timer_id = SetTimer(0, 0, 1000 * 60 * 60, TimerProc); + } + } else { + if(timer_id != 0) { + KillTimer(0, timer_id); + timer_id = 0; + } + } + + + return 0; +} + +int BackupService(WPARAM wParam, LPARAM lParam) { + return Backup(); +} \ No newline at end of file diff --git a/clist_classic_sje/clc.h b/clist_classic_sje/clc.h new file mode 100644 index 0000000..7b825dd --- /dev/null +++ b/clist_classic_sje/clc.h @@ -0,0 +1,83 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#define FONTID_LAST 7 + +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 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; +}; diff --git a/clist_classic_sje/clcopts.c b/clist_classic_sje/clcopts.c new file mode 100644 index 0000000..ae8ba56 --- /dev/null +++ b/clist_classic_sje/clcopts.c @@ -0,0 +1,923 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" + +#define DBFONTF_BOLD 1 +#define DBFONTF_ITALIC 2 +#define DBFONTF_UNDERLINE 4 + +struct CheckBoxToStyleEx_t +{ + int id; + DWORD flag; + int not; +} + +static const checkBoxToStyleEx[] = { + {IDC_DISABLEDRAGDROP, CLS_EX_DISABLEDRAGDROP, 0}, + {IDC_NOTEDITLABELS, CLS_EX_EDITLABELS, 1}, + {IDC_SHOWSELALWAYS, CLS_EX_SHOWSELALWAYS, 0}, + {IDC_TRACKSELECT, CLS_EX_TRACKSELECT, 0}, + {IDC_SHOWGROUPCOUNTS, CLS_EX_SHOWGROUPCOUNTS, 0}, + {IDC_HIDECOUNTSWHENEMPTY, CLS_EX_HIDECOUNTSWHENEMPTY, 0}, + {IDC_DIVIDERONOFF, CLS_EX_DIVIDERONOFF, 0}, + {IDC_NOTNOTRANSLUCENTSEL, CLS_EX_NOTRANSLUCENTSEL, 1}, + {IDC_LINEWITHGROUPS, CLS_EX_LINEWITHGROUPS, 0}, + {IDC_QUICKSEARCHVISONLY, CLS_EX_QUICKSEARCHVISONLY, 0}, + {IDC_SORTGROUPSALPHA, CLS_EX_SORTGROUPSALPHA, 0}, + {IDC_NOTNOSMOOTHSCROLLING, CLS_EX_NOSMOOTHSCROLLING, 1} +}; + +struct CheckBoxValues_t +{ + DWORD style; + TCHAR* szDescr; +}; + +static const struct CheckBoxValues_t greyoutValues[] = { + { GREYF_UNFOCUS, _T("Not focused") }, + { MODEF_OFFLINE, _T("Offline") }, + { PF2_ONLINE, _T("Online") }, + { PF2_SHORTAWAY, _T("Away") }, + { PF2_LONGAWAY, _T("NA") }, + { PF2_LIGHTDND, _T("Occupied") }, + { PF2_HEAVYDND, _T("DND") }, + { PF2_FREECHAT, _T("Free for chat") }, + { PF2_INVISIBLE, _T("Invisible") }, + { PF2_OUTTOLUNCH, _T("Out to lunch") }, + { PF2_ONTHEPHONE, _T("On the phone") } +}; + +static const struct CheckBoxValues_t offlineValues[] = { + { MODEF_OFFLINE, _T("Offline") }, + { PF2_ONLINE, _T("Online") }, + { PF2_SHORTAWAY, _T("Away") }, + { PF2_LONGAWAY, _T("NA") }, + { PF2_LIGHTDND, _T("Occupied") }, + { PF2_HEAVYDND, _T("DND") }, + { PF2_FREECHAT, _T("Free for chat") }, + { PF2_INVISIBLE, _T("Invisible") }, + { PF2_OUTTOLUNCH, _T("Out to lunch") }, + { PF2_ONTHEPHONE, _T("On the phone") } +}; + +static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) +{ + TVINSERTSTRUCT tvis; + int i; + + tvis.hParent = NULL; + tvis.hInsertAfter = TVI_LAST; + tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; + for (i = 0; i < nValues; i++) { + tvis.item.lParam = values[i].style; + tvis.item.pszText = TranslateTS( values[i].szDescr ); + tvis.item.stateMask = TVIS_STATEIMAGEMASK; + tvis.item.state = INDEXTOSTATEIMAGEMASK((style & tvis.item.lParam) != 0 ? 2 : 1); + TreeView_InsertItem( hwndTree, &tvis); +} } + +static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) +{ + DWORD flags = 0; + TVITEM tvi; + + tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE; + tvi.hItem = TreeView_GetRoot(hwndTree); + while (tvi.hItem) { + TreeView_GetItem(hwndTree, &tvi); + if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2)) + flags |= tvi.lParam; + tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem); + } + return flags; +} + +static BOOL CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + SetWindowLong(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE, + GetWindowLong(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); + SetWindowLong(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE, + GetWindowLong(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); + { + int i; + DWORD exStyle = DBGetContactSettingDword(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle()); + for (i = 0; i < SIZEOF(checkBoxToStyleEx); i++) + CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id, + (exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag * + checkBoxToStyleEx[i].not) ? BST_CHECKED : BST_UNCHECKED); + } + { + UDACCEL accel[2] = { {0, 10} , {2, 50} }; + SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0)); + SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, SIZEOF(accel), (LPARAM) & accel); + SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, + MAKELONG(DBGetContactSettingWord(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0)); + } + CheckDlgButton(hwndDlg, IDC_IDLE, DBGetContactSettingByte(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(64, 0)); + SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, + MAKELONG(DBGetContactSettingByte(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0)); + SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0)); + SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETPOS, 0, + MAKELONG(DBGetContactSettingByte(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0)); + CheckDlgButton(hwndDlg, IDC_GREYOUT, + DBGetContactSettingDword(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING)); + EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT)); + FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, SIZEOF(greyoutValues), + DBGetContactSettingDword(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS)); + FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, SIZEOF(offlineValues), + DBGetContactSettingDword(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES)); + CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, DBGetContactSettingByte(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED); + return TRUE; + case WM_VSCROLL: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_NOTNOSMOOTHSCROLLING) + EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING)); + if (LOWORD(wParam) == IDC_GREYOUT) + EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT)); + if ((LOWORD(wParam) == IDC_LEFTMARGIN || LOWORD(wParam) == IDC_SMOOTHTIME || LOWORD(wParam) == IDC_GROUPINDENT) + && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + return 0; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->idFrom) { + case IDC_GREYOUTOPTS: + case IDC_HIDEOFFLINEOPTS: + if (((LPNMHDR) lParam)->code == NM_CLICK) { + TVHITTESTINFO hti; + hti.pt.x = (short) LOWORD(GetMessagePos()); + hti.pt.y = (short) HIWORD(GetMessagePos()); + ScreenToClient(((LPNMHDR) lParam)->hwndFrom, &hti.pt); + if (TreeView_HitTest(((LPNMHDR) lParam)->hwndFrom, &hti)) + if (hti.flags & TVHT_ONITEMSTATEICON) { + TVITEM tvi; + tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; + tvi.hItem = hti.hItem; + TreeView_GetItem(((LPNMHDR) lParam)->hwndFrom, &tvi); + tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1; + TreeView_SetItem(((LPNMHDR) lParam)->hwndFrom, &tvi); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + } + break; + case 0: + if (((LPNMHDR) lParam)->code == PSN_APPLY ) { + int i; + DWORD exStyle = 0; + for (i = 0; i < SIZEOF(checkBoxToStyleEx); i++) + if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not) + exStyle |= checkBoxToStyleEx[i].flag; + + DBWriteContactSettingDword(NULL, "CLC", "ExStyle", exStyle); + { + DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS)); + DBWriteContactSettingDword(NULL, "CLC", "FullGreyoutFlags", fullGreyoutFlags); + if (IsDlgButtonChecked(hwndDlg, IDC_GREYOUT)) + DBWriteContactSettingDword(NULL, "CLC", "GreyoutFlags", fullGreyoutFlags); + else + DBWriteContactSettingDword(NULL, "CLC", "GreyoutFlags", 0); + } + DBWriteContactSettingByte(NULL, "CLC", "ShowIdle", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0)); + DBWriteContactSettingDword(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS))); + DBWriteContactSettingByte(NULL, "CLC", "LeftMargin", + (BYTE) SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0)); + DBWriteContactSettingWord(NULL, "CLC", "ScrollTime", + (WORD) SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0)); + DBWriteContactSettingByte(NULL, "CLC", "GroupIndent", + (BYTE) SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0)); + DBWriteContactSettingByte(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0)); + pcli->pfnClcOptionsChanged(); + return TRUE; + } + break; + } + break; + case WM_DESTROY: + ImageList_Destroy(TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), TVSIL_NORMAL)); + break; + } + return FALSE; +} + +static BOOL CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_BITMAP, + DBGetContactSettingByte(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP) ? BST_CHECKED : BST_UNCHECKED); + SendMessage(hwndDlg, WM_USER + 10, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_BKCOLOUR); + SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR)); + SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_SELBKCOLOUR); + SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETCOLOUR, 0, + DBGetContactSettingDword(NULL, "CLC", "SelBkColour", CLCDEFAULT_SELBKCOLOUR)); + CheckDlgButton(hwndDlg, IDC_WINCOLOUR, DBGetContactSettingByte(NULL, "CLC", "UseWinColours", 0)); + SendMessage(hwndDlg, WM_USER + 11, 0, 0); + { + DBVARIANT dbv; + if (!DBGetContactSetting(NULL, "CLC", "BkBitmap", &dbv)) { + SetDlgItemTextA(hwndDlg, IDC_FILENAME, dbv.pszVal); + if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)) { + char szPath[MAX_PATH]; + + if (CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) dbv.pszVal, (LPARAM) szPath)) + SetDlgItemTextA(hwndDlg, IDC_FILENAME, szPath); + } + else + mir_free(dbv.pszVal); + } + } + { + WORD bmpUse = DBGetContactSettingWord(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + CheckDlgButton(hwndDlg, IDC_STRETCHH, bmpUse & CLB_STRETCHH ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_STRETCHV, bmpUse & CLB_STRETCHV ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TILEH, bmpUse & CLBF_TILEH ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TILEV, bmpUse & CLBF_TILEV ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SCROLL, bmpUse & CLBF_SCROLL ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_PROPORTIONAL, bmpUse & CLBF_PROPORTIONAL ? BST_CHECKED : BST_UNCHECKED); + } + { + HRESULT(STDAPICALLTYPE * MySHAutoComplete) (HWND, DWORD); + MySHAutoComplete = (HRESULT(STDAPICALLTYPE *) (HWND, DWORD)) GetProcAddress(GetModuleHandleA("shlwapi"), "SHAutoComplete"); + if (MySHAutoComplete) + MySHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1); + } + return TRUE; + case WM_USER + 10: + EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg, IDC_STRETCHH), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg, IDC_STRETCHV), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg, IDC_TILEH), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg, IDC_TILEV), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SCROLL), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + EnableWindow(GetDlgItem(hwndDlg, IDC_PROPORTIONAL), IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + break; + case WM_USER + 11: + { + BOOL b = IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), !b); + EnableWindow(GetDlgItem(hwndDlg, IDC_SELCOLOUR), !b); + break; + } + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BROWSE) { + char str[MAX_PATH]; + OPENFILENAMEA ofn = { 0 }; + char filter[512]; + + GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); + ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; + ofn.hwndOwner = hwndDlg; + ofn.hInstance = NULL; + CallService(MS_UTILS_GETBITMAPFILTERSTRINGS, SIZEOF(filter), (LPARAM) filter); + ofn.lpstrFilter = filter; + ofn.lpstrFile = str; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.nMaxFile = SIZEOF(str); + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrDefExt = "bmp"; + if (!GetOpenFileNameA(&ofn)) + break; + SetDlgItemTextA(hwndDlg, IDC_FILENAME, str); + } + else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) + break; + if (LOWORD(wParam) == IDC_BITMAP) + SendMessage(hwndDlg, WM_USER + 10, 0, 0); + if (LOWORD(wParam) == IDC_WINCOLOUR) + SendMessage(hwndDlg, WM_USER + 11, 0, 0); + if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + return 0; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->idFrom) { + case 0: + switch (((LPNMHDR) lParam)->code) { + case PSN_APPLY: + DBWriteContactSettingByte(NULL, "CLC", "UseBitmap", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); + { + COLORREF col; + col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0); + if (col == CLCDEFAULT_BKCOLOUR) + DBDeleteContactSetting(NULL, "CLC", "BkColour"); + else + DBWriteContactSettingDword(NULL, "CLC", "BkColour", col); + col = SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_GETCOLOUR, 0, 0); + if (col == CLCDEFAULT_SELBKCOLOUR) + DBDeleteContactSetting(NULL, "CLC", "SelBkColour"); + else + DBWriteContactSettingDword(NULL, "CLC", "SelBkColour", col); + DBWriteContactSettingByte(NULL, "CLC", "UseWinColours", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR))); + } + { + char str[MAX_PATH], strrel[MAX_PATH]; + GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str)); + if (ServiceExists(MS_UTILS_PATHTORELATIVE)) { + if (CallService(MS_UTILS_PATHTORELATIVE, (WPARAM) str, (LPARAM) strrel)) + DBWriteContactSettingString(NULL, "CLC", "BkBitmap", strrel); + else + DBWriteContactSettingString(NULL, "CLC", "BkBitmap", str); + } + else + DBWriteContactSettingString(NULL, "CLC", "BkBitmap", str); + } + { + WORD flags = 0; + if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH)) + flags |= CLB_STRETCHH; + if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHV)) + flags |= CLB_STRETCHV; + if (IsDlgButtonChecked(hwndDlg, IDC_TILEH)) + flags |= CLBF_TILEH; + if (IsDlgButtonChecked(hwndDlg, IDC_TILEV)) + flags |= CLBF_TILEV; + if (IsDlgButtonChecked(hwndDlg, IDC_SCROLL)) + flags |= CLBF_SCROLL; + if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL)) + flags |= CLBF_PROPORTIONAL; + DBWriteContactSettingWord(NULL, "CLC", "BkBmpUse", flags); + } + pcli->pfnClcOptionsChanged(); + return TRUE; + } + break; + } + break; + } + return FALSE; +} + +static const TCHAR* szFontIdDescr[FONTID_LAST + 1] = +{ + _T("Standard contacts"), + _T("Online contacts to whom you have a different visibility"), + _T("Offline contacts"), + _T("Contacts which are 'not on list'"), + _T("Groups"), + _T("Group member counts"), + _T("Dividers"), + _T("Offline contacts to whom you have a different visibility") +}; + +#define SAMEASF_FACE 1 +#define SAMEASF_SIZE 2 +#define SAMEASF_STYLE 4 +#define SAMEASF_COLOUR 8 +#include +struct +{ + BYTE sameAsFlags, sameAs; + COLORREF colour; + char size; + BYTE style; + BYTE charset; + TCHAR szFace[LF_FACESIZE]; +} +static fontSettings[FONTID_LAST + 1]; +#include +static WORD fontSameAsDefault[FONTID_LAST + 1] = { 0x00FF, 0x0B00, 0x0F00, 0x0700, 0x0B00, 0x0104, 0x0D00, 0x0B02 }; +static char *fontSizes[] = { "7", "8", "10", "14", "16", "18", "20", "24", "28" }; +static int fontListOrder[FONTID_LAST + 1] = +{ FONTID_CONTACTS, FONTID_INVIS, FONTID_OFFLINE, FONTID_OFFINVIS, FONTID_NOTONLIST, FONTID_GROUPS, FONTID_GROUPCOUNTS, FONTID_DIVIDERS }; + +#define M_REBUILDFONTGROUP (WM_USER+10) +#define M_REMAKESAMPLE (WM_USER+11) +#define M_RECALCONEFONT (WM_USER+12) +#define M_RECALCOTHERFONTS (WM_USER+13) +#define M_SAVEFONT (WM_USER+14) +#define M_REFRESHSAMEASBOXES (WM_USER+15) +#define M_FILLSCRIPTCOMBO (WM_USER+16) +#define M_REDOROWHEIGHT (WM_USER+17) +#define M_LOADFONT (WM_USER+18) +#define M_GUESSSAMEASBOXES (WM_USER+19) +#define M_SETSAMEASBOXES (WM_USER+20) + +static int CALLBACK EnumFontsProc(ENUMLOGFONTEX * lpelfe, NEWTEXTMETRICEX * lpntme, int FontType, LPARAM lParam) +{ + if (!IsWindow((HWND) lParam)) + return FALSE; + if (SendMessage((HWND) lParam, CB_FINDSTRINGEXACT, -1, (LPARAM) lpelfe->elfLogFont.lfFaceName) == CB_ERR) + SendMessage((HWND) lParam, CB_ADDSTRING, 0, (LPARAM) lpelfe->elfLogFont.lfFaceName); + return TRUE; +} + +void FillFontListThread(HWND hwndDlg) +{ + LOGFONT lf = { 0 }; + HDC hdc = GetDC(hwndDlg); + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfFaceName[0] = 0; + lf.lfPitchAndFamily = 0; + EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontsProc, (LPARAM) GetDlgItem(hwndDlg, IDC_TYPEFACE), 0); + ReleaseDC(hwndDlg, hdc); + return; +} + +static int CALLBACK EnumFontScriptsProc(ENUMLOGFONTEX * lpelfe, NEWTEXTMETRICEX * lpntme, int FontType, LPARAM lParam) +{ + if (SendMessage((HWND) lParam, CB_FINDSTRINGEXACT, -1, (LPARAM) lpelfe->elfScript) == CB_ERR) { + int i = SendMessage((HWND) lParam, CB_ADDSTRING, 0, (LPARAM) lpelfe->elfScript); + SendMessage((HWND) lParam, CB_SETITEMDATA, i, lpelfe->elfLogFont.lfCharSet); + } + return TRUE; +} + +static int TextOptsDlgResizer(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc) +{ + return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; +} + +static void SwitchTextDlgToMode(HWND hwndDlg, int expert) +{ + ShowWindow(GetDlgItem(hwndDlg, IDC_GAMMACORRECT), expert ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STSAMETEXT), expert ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SAMETYPE), expert ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SAMESIZE), expert ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SAMESTYLE), expert ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SAMECOLOUR), expert ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STSIZETEXT), expert ? SW_HIDE : SW_SHOW); + ShowWindow(GetDlgItem(hwndDlg, IDC_STCOLOURTEXT), expert ? SW_HIDE : SW_SHOW); + SetDlgItemText(hwndDlg, IDC_STASTEXT, TranslateTS(expert ? _T("as:") : _T("based on:"))); + { + UTILRESIZEDIALOG urd = { 0 }; + urd.cbSize = sizeof(urd); + urd.hwndDlg = hwndDlg; + urd.hInstance = g_hInst; + urd.lpTemplate = MAKEINTRESOURCEA(expert ? IDD_OPT_CLCTEXT : IDD_OPT_CLCTEXTSIMPLE); + urd.pfnResizer = TextOptsDlgResizer; + CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM) & urd); + } + //resizer breaks the sizing of the edit box + SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETBUDDY, (WPARAM) GetDlgItem(hwndDlg, IDC_ROWHEIGHT), 0); + SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, + SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETCURSEL, 0, 0), 0), 0); +} + +static BOOL CALLBACK DlgProcClcTextOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static HFONT hFontSample; + + switch (msg) { + case WM_INITDIALOG: + hFontSample = NULL; + SetDlgItemTextA(hwndDlg, IDC_SAMPLE, "Sample"); + TranslateDialogDefault(hwndDlg); + if (!SendMessage(GetParent(hwndDlg), PSM_ISEXPERT, 0, 0)) + SwitchTextDlgToMode(hwndDlg, 0); + mir_forkthread(FillFontListThread, hwndDlg); + { + int i, itemId, fontId; + LOGFONT lf; + COLORREF colour; + WORD sameAs; + char str[32]; + + for (i = 0; i <= FONTID_LAST; i++) { + fontId = fontListOrder[i]; + pcli->pfnGetFontSetting(fontId, &lf, &colour); + wsprintfA(str, "Font%dAs", fontId); + sameAs = DBGetContactSettingWord(NULL, "CLC", str, fontSameAsDefault[fontId]); + fontSettings[fontId].sameAsFlags = HIBYTE(sameAs); + fontSettings[fontId].sameAs = LOBYTE(sameAs); + fontSettings[fontId].style = + (lf.lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0); + if (lf.lfHeight < 0) { + HDC hdc; + SIZE size; + HFONT hFont = CreateFontIndirect(&lf); + hdc = GetDC(hwndDlg); + SelectObject(hdc, hFont); + GetTextExtentPoint32A(hdc, "_W", 2, &size); + ReleaseDC(hwndDlg, hdc); + DeleteObject(hFont); + fontSettings[fontId].size = (char) size.cy; + } + else fontSettings[fontId].size = (char) lf.lfHeight; + fontSettings[fontId].charset = lf.lfCharSet; + fontSettings[fontId].colour = colour; + lstrcpy(fontSettings[fontId].szFace, lf.lfFaceName); + itemId = SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_ADDSTRING, 0, (LPARAM) TranslateTS( szFontIdDescr[fontId] )); + SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_SETITEMDATA, itemId, fontId); + } + SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_SETCURSEL, 0, 0); + for (i = 0; i < SIZEOF(fontSizes); i++) + SendDlgItemMessageA(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM) fontSizes[i]); + } + SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0)); + SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETPOS, 0, MAKELONG(DBGetContactSettingByte(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT), 0)); + SendMessage(hwndDlg, M_REBUILDFONTGROUP, 0, 0); + SendMessage(hwndDlg, M_SAVEFONT, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_HOTCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_HOTTEXTCOLOUR); + SendDlgItemMessage(hwndDlg, IDC_HOTCOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLC", "HotTextColour", CLCDEFAULT_HOTTEXTCOLOUR)); + CheckDlgButton(hwndDlg, IDC_GAMMACORRECT, DBGetContactSettingByte(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_SELTEXTCOLOUR); + SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLC", "SelTextColour", CLCDEFAULT_SELTEXTCOLOUR)); + SendDlgItemMessage(hwndDlg, IDC_QUICKCOLOUR, CPM_SETDEFAULTCOLOUR, 0, CLCDEFAULT_QUICKSEARCHCOLOUR); + SendDlgItemMessage(hwndDlg, IDC_QUICKCOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "CLC", "QuickSearchColour", CLCDEFAULT_QUICKSEARCHCOLOUR)); + return TRUE; + case M_REBUILDFONTGROUP: //remake all the needed controls when the user changes the font selector at the top + { + int i = SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETCURSEL, 0, 0), 0); + SendMessage(hwndDlg, M_SETSAMEASBOXES, i, 0); + { + int j, id, itemId; + char szText[256]; + SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_RESETCONTENT, 0, 0); + itemId = SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_ADDSTRING, 0, (LPARAM) TranslateT("")); + SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETITEMDATA, itemId, 0xFF); + if (0xFF == fontSettings[i].sameAs) + SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETCURSEL, itemId, 0); + for (j = 0; j <= FONTID_LAST; j++) { + SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETLBTEXT, j, (LPARAM) szText); + id = SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETITEMDATA, j, 0); + if (id == i) + continue; + itemId = SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_ADDSTRING, 0, (LPARAM) szText); + SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETITEMDATA, itemId, id); + if (id == fontSettings[i].sameAs) + SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETCURSEL, itemId, 0); + } + } + SendMessage(hwndDlg, M_LOADFONT, i, 0); + SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, i, 0); + SendMessage(hwndDlg, M_REMAKESAMPLE, 0, 0); + break; + } + case M_SETSAMEASBOXES: //set the check mark in the 'same as' boxes to the right value for fontid wParam + CheckDlgButton(hwndDlg, IDC_SAMETYPE, fontSettings[wParam].sameAsFlags & SAMEASF_FACE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SAMESIZE, fontSettings[wParam].sameAsFlags & SAMEASF_SIZE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SAMESTYLE, fontSettings[wParam].sameAsFlags & SAMEASF_STYLE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SAMECOLOUR, fontSettings[wParam].sameAsFlags & SAMEASF_COLOUR ? BST_CHECKED : BST_UNCHECKED); + break; + case M_FILLSCRIPTCOMBO: //fill the script combo box and set the selection to the value for fontid wParam + { + LOGFONT lf = { 0 }; + int i; + HDC hdc = GetDC(hwndDlg); + lf.lfCharSet = DEFAULT_CHARSET; + GetDlgItemText(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, LF_FACESIZE ); + lf.lfPitchAndFamily = 0; + SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_RESETCONTENT, 0, 0); + EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontScriptsProc, (LPARAM) GetDlgItem(hwndDlg, IDC_SCRIPT), 0); + ReleaseDC(hwndDlg, hdc); + for (i = SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) { + if (SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, i, 0) == fontSettings[wParam].charset) { + SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_SETCURSEL, i, 0); + break; + } + } + if (i < 0) + SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_SETCURSEL, 0, 0); + break; + } + case WM_CTLCOLORSTATIC: + if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_SAMPLE)) { + SetTextColor((HDC) wParam, SendDlgItemMessage(hwndDlg, IDC_COLOUR, CPM_GETCOLOUR, 0, 0)); + SetBkColor((HDC) wParam, GetSysColor(COLOR_3DFACE)); + return (BOOL) GetSysColorBrush(COLOR_3DFACE); + } + break; + case M_REFRESHSAMEASBOXES: //set the disabled flag on the 'same as' checkboxes to the values for fontid wParam + EnableWindow(GetDlgItem(hwndDlg, IDC_SAMETYPE), fontSettings[wParam].sameAs != 0xFF); + EnableWindow(GetDlgItem(hwndDlg, IDC_SAMESIZE), fontSettings[wParam].sameAs != 0xFF); + EnableWindow(GetDlgItem(hwndDlg, IDC_SAMESTYLE), fontSettings[wParam].sameAs != 0xFF); + EnableWindow(GetDlgItem(hwndDlg, IDC_SAMECOLOUR), fontSettings[wParam].sameAs != 0xFF); + if (SendMessage(GetParent(hwndDlg), PSM_ISEXPERT, 0, 0)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEFACE), fontSettings[wParam].sameAs == 0xFF + || !(fontSettings[wParam].sameAsFlags & SAMEASF_FACE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SCRIPT), fontSettings[wParam].sameAs == 0xFF + || !(fontSettings[wParam].sameAsFlags & SAMEASF_FACE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_FONTSIZE), fontSettings[wParam].sameAs == 0xFF + || !(fontSettings[wParam].sameAsFlags & SAMEASF_SIZE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_BOLD), fontSettings[wParam].sameAs == 0xFF + || !(fontSettings[wParam].sameAsFlags & SAMEASF_STYLE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_ITALIC), fontSettings[wParam].sameAs == 0xFF + || !(fontSettings[wParam].sameAsFlags & SAMEASF_STYLE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), fontSettings[wParam].sameAs == 0xFF + || !(fontSettings[wParam].sameAsFlags & SAMEASF_STYLE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_COLOUR), fontSettings[wParam].sameAs == 0xFF + || !(fontSettings[wParam].sameAsFlags & SAMEASF_COLOUR)); + } + else { + EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEFACE), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_SCRIPT), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_FONTSIZE), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BOLD), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_ITALIC), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_COLOUR), TRUE); + } + break; + case M_REMAKESAMPLE: //remake the sample edit box font based on the settings in the controls + { + LOGFONTA lf; + if (hFontSample) { + SendDlgItemMessage(hwndDlg, IDC_SAMPLE, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDC_FONTID, WM_GETFONT, 0, 0), 0); + DeleteObject(hFontSample); + } + lf.lfHeight = GetDlgItemInt(hwndDlg, IDC_FONTSIZE, NULL, FALSE); + { + HDC hdc = GetDC(NULL); + lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); + ReleaseDC(NULL, hdc); + } + lf.lfWidth = lf.lfEscapement = lf.lfOrientation = 0; + lf.lfWeight = IsDlgButtonChecked(hwndDlg, IDC_BOLD) ? FW_BOLD : FW_NORMAL; + lf.lfItalic = IsDlgButtonChecked(hwndDlg, IDC_ITALIC); + lf.lfUnderline = IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE); + lf.lfStrikeOut = 0; + lf.lfCharSet = (BYTE) SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCURSEL, 0, 0), 0); + lf.lfOutPrecision = OUT_DEFAULT_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; + GetDlgItemTextA(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, SIZEOF(lf.lfFaceName)); + hFontSample = CreateFontIndirectA(&lf); + SendDlgItemMessage(hwndDlg, IDC_SAMPLE, WM_SETFONT, (WPARAM) hFontSample, TRUE); + break; + } + case M_RECALCONEFONT: //copy the 'same as' settings for fontid wParam from their sources + if (fontSettings[wParam].sameAs == 0xFF) + break; + if (fontSettings[wParam].sameAsFlags & SAMEASF_FACE) { + lstrcpy(fontSettings[wParam].szFace, fontSettings[fontSettings[wParam].sameAs].szFace); + fontSettings[wParam].charset = fontSettings[fontSettings[wParam].sameAs].charset; + } + if (fontSettings[wParam].sameAsFlags & SAMEASF_SIZE) + fontSettings[wParam].size = fontSettings[fontSettings[wParam].sameAs].size; + if (fontSettings[wParam].sameAsFlags & SAMEASF_STYLE) + fontSettings[wParam].style = fontSettings[fontSettings[wParam].sameAs].style; + if (fontSettings[wParam].sameAsFlags & SAMEASF_COLOUR) + fontSettings[wParam].colour = fontSettings[fontSettings[wParam].sameAs].colour; + break; + case M_RECALCOTHERFONTS: //recalculate the 'same as' settings for all fonts but wParam + { + int i; + for (i = 0; i <= FONTID_LAST; i++) { + if (i == (int) wParam) + continue; + SendMessage(hwndDlg, M_RECALCONEFONT, i, 0); + } + break; + } + case M_SAVEFONT: //save the font settings from the controls to font wParam + fontSettings[wParam].sameAsFlags = + (IsDlgButtonChecked(hwndDlg, IDC_SAMETYPE) ? SAMEASF_FACE : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SAMESIZE) ? SAMEASF_SIZE : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_SAMESTYLE) ? SAMEASF_STYLE : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SAMECOLOUR) ? SAMEASF_COLOUR : 0); + fontSettings[wParam].sameAs = + (BYTE) SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_GETCURSEL, 0, 0), 0); + GetDlgItemText(hwndDlg, IDC_TYPEFACE, fontSettings[wParam].szFace, SIZEOF( fontSettings[wParam].szFace )); + fontSettings[wParam].charset = + (BYTE) SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCURSEL, 0, 0), 0); + fontSettings[wParam].size = (char) GetDlgItemInt(hwndDlg, IDC_FONTSIZE, NULL, FALSE); + fontSettings[wParam].style = + (IsDlgButtonChecked(hwndDlg, IDC_BOLD) ? DBFONTF_BOLD : 0) | (IsDlgButtonChecked(hwndDlg, IDC_ITALIC) ? DBFONTF_ITALIC : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE) ? DBFONTF_UNDERLINE : 0); + fontSettings[wParam].colour = SendDlgItemMessage(hwndDlg, IDC_COLOUR, CPM_GETCOLOUR, 0, 0); + SendMessage(hwndDlg, M_REDOROWHEIGHT, 0, 0); + break; + case M_REDOROWHEIGHT: //recalculate the minimum feasible row height + { + int i; + int minHeight = GetSystemMetrics(SM_CYSMICON); + for (i = 0; i <= FONTID_LAST; i++) + if (fontSettings[i].size > minHeight) + minHeight = fontSettings[i].size; + i = SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0); + if (i < minHeight) + SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETPOS, 0, MAKELONG(minHeight, 0)); + break; + } + case M_LOADFONT: //load font wParam into the controls + SetDlgItemText(hwndDlg, IDC_TYPEFACE, fontSettings[wParam].szFace); + SendMessage(hwndDlg, M_FILLSCRIPTCOMBO, wParam, 0); + SetDlgItemInt(hwndDlg, IDC_FONTSIZE, fontSettings[wParam].size, FALSE); + CheckDlgButton(hwndDlg, IDC_BOLD, fontSettings[wParam].style & DBFONTF_BOLD ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ITALIC, fontSettings[wParam].style & DBFONTF_ITALIC ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_UNDERLINE, fontSettings[wParam].style & DBFONTF_UNDERLINE ? BST_CHECKED : BST_UNCHECKED); + { + LOGFONT lf; + COLORREF colour; + pcli->pfnGetDefaultFontSetting(wParam, &lf, &colour); + SendDlgItemMessage(hwndDlg, IDC_COLOUR, CPM_SETDEFAULTCOLOUR, 0, colour); + } + SendDlgItemMessage(hwndDlg, IDC_COLOUR, CPM_SETCOLOUR, 0, fontSettings[wParam].colour); + break; + case M_GUESSSAMEASBOXES: //guess suitable values for the 'same as' checkboxes for fontId wParam + fontSettings[wParam].sameAsFlags = 0; + if (fontSettings[wParam].sameAs == 0xFF) + break; + if (!lstrcmp(fontSettings[wParam].szFace, fontSettings[fontSettings[wParam].sameAs].szFace) && + fontSettings[wParam].charset == fontSettings[fontSettings[wParam].sameAs].charset) + fontSettings[wParam].sameAsFlags |= SAMEASF_FACE; + if (fontSettings[wParam].size == fontSettings[fontSettings[wParam].sameAs].size) + fontSettings[wParam].sameAsFlags |= SAMEASF_SIZE; + if (fontSettings[wParam].style == fontSettings[fontSettings[wParam].sameAs].style) + fontSettings[wParam].sameAsFlags |= SAMEASF_STYLE; + if (fontSettings[wParam].colour == fontSettings[fontSettings[wParam].sameAs].colour) + fontSettings[wParam].sameAsFlags |= SAMEASF_COLOUR; + SendMessage(hwndDlg, M_SETSAMEASBOXES, wParam, 0); + break; + case WM_VSCROLL: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_COMMAND: + { + int fontId = SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTID, CB_GETCURSEL, 0, 0), 0); + switch (LOWORD(wParam)) { + case IDC_FONTID: + if (HIWORD(wParam) != CBN_SELCHANGE) + return FALSE; + SendMessage(hwndDlg, M_REBUILDFONTGROUP, 0, 0); + return 0; + case IDC_SAMETYPE: + case IDC_SAMESIZE: + case IDC_SAMESTYLE: + case IDC_SAMECOLOUR: + SendMessage(hwndDlg, M_SAVEFONT, fontId, 0); + SendMessage(hwndDlg, M_RECALCONEFONT, fontId, 0); + SendMessage(hwndDlg, M_REMAKESAMPLE, 0, 0); + SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, fontId, 0); + break; + case IDC_SAMEAS: + if (HIWORD(wParam) != CBN_SELCHANGE) + return FALSE; + if (SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_GETCURSEL, 0, 0), 0) == + fontId) + SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_SETCURSEL, 0, 0); + if (!SendMessage(GetParent(hwndDlg), PSM_ISEXPERT, 0, 0)) { + int sameAs = + SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SAMEAS, CB_GETCURSEL, 0, 0), 0); + if (sameAs != 0xFF) + SendMessage(hwndDlg, M_LOADFONT, sameAs, 0); + SendMessage(hwndDlg, M_SAVEFONT, fontId, 0); + SendMessage(hwndDlg, M_GUESSSAMEASBOXES, fontId, 0); + } + else + SendMessage(hwndDlg, M_SAVEFONT, fontId, 0); + SendMessage(hwndDlg, M_RECALCONEFONT, fontId, 0); + SendMessage(hwndDlg, M_FILLSCRIPTCOMBO, fontId, 0); + SendMessage(hwndDlg, M_REMAKESAMPLE, 0, 0); + SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, fontId, 0); + break; + case IDC_TYPEFACE: + case IDC_SCRIPT: + case IDC_FONTSIZE: + if (HIWORD(wParam) != CBN_EDITCHANGE && HIWORD(wParam) != CBN_SELCHANGE) + return FALSE; + if (HIWORD(wParam) == CBN_SELCHANGE) { + SendDlgItemMessage(hwndDlg, LOWORD(wParam), CB_SETCURSEL, SendDlgItemMessage(hwndDlg, LOWORD(wParam), CB_GETCURSEL, 0, 0), 0); + } + if (LOWORD(wParam) == IDC_TYPEFACE) + SendMessage(hwndDlg, M_FILLSCRIPTCOMBO, fontId, 0); + //fall through + case IDC_BOLD: + case IDC_ITALIC: + case IDC_UNDERLINE: + case IDC_COLOUR: + SendMessage(hwndDlg, M_SAVEFONT, fontId, 0); + if (!SendMessage(GetParent(hwndDlg), PSM_ISEXPERT, 0, 0)) { + SendMessage(hwndDlg, M_GUESSSAMEASBOXES, fontId, 0); + SendMessage(hwndDlg, M_REFRESHSAMEASBOXES, fontId, 0); + } + SendMessage(hwndDlg, M_RECALCOTHERFONTS, fontId, 0); + SendMessage(hwndDlg, M_REMAKESAMPLE, 0, 0); + SendMessage(hwndDlg, M_REDOROWHEIGHT, 0, 0); + break; + case IDC_SAMPLE: + return 0; + case IDC_ROWHEIGHT: + if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) + return 0; + break; + } + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->idFrom) { + case 0: + switch (((LPNMHDR) lParam)->code) { + case PSN_APPLY: + { + int i; + char str[20]; + + // Force min height calculation + // This prevents users from setting the row height to be too low + SendMessage(hwndDlg, M_REDOROWHEIGHT, 0, 0); + for (i = 0; i <= FONTID_LAST; i++) { + wsprintfA(str, "Font%dName", i); + DBWriteContactSettingTString(NULL, "CLC", str, fontSettings[i].szFace); + wsprintfA(str, "Font%dSet", i); + DBWriteContactSettingByte(NULL, "CLC", str, fontSettings[i].charset); + wsprintfA(str, "Font%dSize", i); + DBWriteContactSettingByte(NULL, "CLC", str, fontSettings[i].size); + wsprintfA(str, "Font%dSty", i); + DBWriteContactSettingByte(NULL, "CLC", str, fontSettings[i].style); + wsprintfA(str, "Font%dCol", i); + DBWriteContactSettingDword(NULL, "CLC", str, fontSettings[i].colour); + wsprintfA(str, "Font%dAs", i); + DBWriteContactSettingWord(NULL, "CLC", str, (WORD) ((fontSettings[i].sameAsFlags << 8) | fontSettings[i].sameAs)); + } + } + { + COLORREF col; + col = SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_GETCOLOUR, 0, 0); + if (col == CLCDEFAULT_SELTEXTCOLOUR) + DBDeleteContactSetting(NULL, "CLC", "SelTextColour"); + else + DBWriteContactSettingDword(NULL, "CLC", "SelTextColour", col); + col = SendDlgItemMessage(hwndDlg, IDC_HOTCOLOUR, CPM_GETCOLOUR, 0, 0); + if (col == CLCDEFAULT_HOTTEXTCOLOUR) + DBDeleteContactSetting(NULL, "CLC", "HotTextColour"); + else + DBWriteContactSettingDword(NULL, "CLC", "HotTextColour", col); + col = SendDlgItemMessage(hwndDlg, IDC_QUICKCOLOUR, CPM_GETCOLOUR, 0, 0); + if (col == CLCDEFAULT_QUICKSEARCHCOLOUR) + DBDeleteContactSetting(NULL, "CLC", "QuickSearchColour"); + else + DBWriteContactSettingDword(NULL, "CLC", "QuickSearchColour", col); + } + DBWriteContactSettingByte(NULL, "CLC", "RowHeight", (BYTE) SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0)); + DBWriteContactSettingByte(NULL, "CLC", "GammaCorrect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GAMMACORRECT)); + pcli->pfnClcOptionsChanged(); + return TRUE; + case PSN_EXPERTCHANGED: + SwitchTextDlgToMode(hwndDlg, ((PSHNOTIFY *) lParam)->lParam); + break; + } + break; + } + break; + case WM_DESTROY: + if (hFontSample) { + SendDlgItemMessage(hwndDlg, IDC_SAMPLE, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDC_FONTID, WM_GETFONT, 0, 0), 0); + DeleteObject(hFontSample); + } + break; + } + return FALSE; +} + +/****************************************************************************************/ + +int ClcOptInit(WPARAM wParam, LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp; + + ZeroMemory(&odp, sizeof(odp)); + odp.cbSize = sizeof(odp); + odp.position = 0; + odp.hInstance = g_hInst; + odp.pszGroup = "Contact List"; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC); + odp.pszTitle = "List"; + odp.pfnDlgProc = DlgProcClcMainOpts; + odp.flags = ODPF_BOLDGROUPS | ODPF_EXPERTONLY; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp); + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG); + odp.pszTitle = "List Background"; + odp.pfnDlgProc = DlgProcClcBkgOpts; + odp.flags = ODPF_BOLDGROUPS; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp); + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCTEXT); + odp.pszTitle = "List Text"; + odp.pfnDlgProc = DlgProcClcTextOpts; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp); + return 0; +} diff --git a/clist_classic_sje/clcpaint.c b/clist_classic_sje/clcpaint.c new file mode 100644 index 0000000..d244c88 --- /dev/null +++ b/clist_classic_sje/clcpaint.c @@ -0,0 +1,590 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "commonheaders.h" + +extern HIMAGELIST himlCListClc; +static BYTE divide3[765] = { 255 }; + +static void ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight) +{ + SelectObject(hdc, dat->fontInfo[id].hFont); + SetTextColor(hdc, dat->fontInfo[id].colour); + if (fontHeight) + *fontHeight = dat->fontInfo[id].fontHeight; +} + +static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat) +{ + if (dat->gammaCorrection) { + COLORREF oldCol, newCol; + int oldLum, newLum; + + oldCol = GetTextColor(hdc); + oldLum = (GetRValue(oldCol) * 30 + GetGValue(oldCol) * 59 + GetBValue(oldCol) * 11) / 100; + newLum = (GetRValue(dat->hotTextColour) * 30 + GetGValue(dat->hotTextColour) * 59 + GetBValue(dat->hotTextColour) * 11) / 100; + if (newLum == 0) { + SetTextColor(hdc, dat->hotTextColour); + return; + } + if (newLum >= oldLum + 20) { + oldLum += 20; + newCol = + RGB(GetRValue(dat->hotTextColour) * oldLum / newLum, GetGValue(dat->hotTextColour) * oldLum / newLum, + GetBValue(dat->hotTextColour) * oldLum / newLum); + } + else if (newLum <= oldLum) { + int r, g, b; + r = GetRValue(dat->hotTextColour) * oldLum / newLum; + g = GetGValue(dat->hotTextColour) * oldLum / newLum; + b = GetBValue(dat->hotTextColour) * oldLum / newLum; + if (r > 255) { + g += (r - 255) * 3 / 7; + b += (r - 255) * 3 / 7; + r = 255; + } + if (g > 255) { + r += (g - 255) * 59 / 41; + if (r > 255) + r = 255; + b += (g - 255) * 59 / 41; + g = 255; + } + if (b > 255) { + r += (b - 255) * 11 / 89; + if (r > 255) + r = 255; + g += (b - 255) * 11 / 89; + if (g > 255) + g = 255; + b = 255; + } + newCol = RGB(r, g, b); + } + else + newCol = dat->hotTextColour; + SetTextColor(hdc, newCol); + } + else + SetTextColor(hdc, dat->hotTextColour); +} + +static int GetStatusOnlineness(int status) +{ + switch (status) { + case ID_STATUS_FREECHAT: return 110; + case ID_STATUS_ONLINE: return 100; + case ID_STATUS_OCCUPIED: return 60; + case ID_STATUS_ONTHEPHONE: return 50; + case ID_STATUS_DND: return 40; + case ID_STATUS_AWAY: return 30; + case ID_STATUS_OUTTOLUNCH: return 20; + case ID_STATUS_NA: return 10; + case ID_STATUS_INVISIBLE: return 5; + } + return 0; +} + +static int GetGeneralisedStatus(void) +{ + int i, status, thisStatus, statusOnlineness, thisOnlineness; + + status = ID_STATUS_OFFLINE; + statusOnlineness = 0; + + for (i = 0; i < pcli->hClcProtoCount; i++) { + thisStatus = pcli->clcProto[i].dwStatus; + if (thisStatus == ID_STATUS_INVISIBLE) + return ID_STATUS_INVISIBLE; + thisOnlineness = GetStatusOnlineness(thisStatus); + if (thisOnlineness > statusOnlineness) { + status = thisStatus; + statusOnlineness = thisOnlineness; + } + } + return status; +} + +static int GetRealStatus(struct ClcContact *contact, int status) +{ + int i; + char *szProto = contact->proto; + if (!szProto) + return status; + for (i = 0; i < pcli->hClcProtoCount; i++) { + if (!lstrcmpA(pcli->clcProto[i].szProto, szProto)) { + return pcli->clcProto[i].dwStatus; + } + } + return status; +} + +static HMODULE themeAPIHandle = NULL; // handle to uxtheme.dll +static HANDLE(WINAPI * MyOpenThemeData) (HWND, LPCWSTR); +static HRESULT(WINAPI * MyCloseThemeData) (HANDLE); +static HRESULT(WINAPI * MyDrawThemeBackground) (HANDLE, HDC, int, int, const RECT *, const RECT *); + +#define MGPROC(x) GetProcAddress(themeAPIHandle,x) +void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) +{ + HDC hdcMem; + RECT clRect; + int y, indent, index, fontHeight; + struct ClcGroup *group; + HBITMAP hBmpOsb, hOldBitmap; + HFONT hOldFont; + DWORD style = GetWindowLong(hwnd, GWL_STYLE); + int status = GetGeneralisedStatus(); + int grey = 0, groupCountsFontTopShift; + HBRUSH hBrushAlternateGrey = NULL; + // yes I know about GetSysColorBrush() + COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->useWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour; + + if (dat->greyoutFlags & pcli->pfnClcStatusToPf2(status) || style & WS_DISABLED) + grey = 1; + else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS) + grey = 1; + GetClientRect(hwnd, &clRect); + if (rcPaint == NULL) + rcPaint = &clRect; + if (IsRectEmpty(rcPaint)) + return; + y = -dat->yScroll; + hdcMem = CreateCompatibleDC(hdc); + hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL); + hOldBitmap = SelectObject(hdcMem, hBmpOsb); + { + TEXTMETRIC tm; + hOldFont = SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPS].hFont); + GetTextMetrics(hdcMem, &tm); + groupCountsFontTopShift = tm.tmAscent; + SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPCOUNTS].hFont); + GetTextMetrics(hdcMem, &tm); + groupCountsFontTopShift -= tm.tmAscent; + } + if (style & CLS_GREYALTERNATE) + hBrushAlternateGrey = + CreateSolidBrush(GetNearestColor(hdcMem, RGB(GetRValue(tmpbkcolour) - 10, GetGValue(tmpbkcolour) - 10, GetBValue(tmpbkcolour) - 10))); + + ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight); + SetBkMode(hdcMem, TRANSPARENT); + { + HBRUSH hBrush, hoBrush; + + hBrush = CreateSolidBrush(tmpbkcolour); + hoBrush = (HBRUSH) SelectObject(hdcMem, hBrush); + FillRect(hdcMem, rcPaint, hBrush); + SelectObject(hdcMem, hoBrush); + DeleteObject(hBrush); + if (dat->hBmpBackground) { + BITMAP bmp; + HDC hdcBmp; + int x, y; + int maxx, maxy; + int destw, desth; + + // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98. + SetStretchBltMode(hdcMem, HALFTONE); + + GetObject(dat->hBmpBackground, sizeof(bmp), &bmp); + hdcBmp = CreateCompatibleDC(hdcMem); + SelectObject(hdcBmp, dat->hBmpBackground); + y = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0; + maxx = dat->backgroundBmpUse & CLBF_TILEH ? clRect.right : 1; + maxy = dat->backgroundBmpUse & CLBF_TILEV ? maxy = rcPaint->bottom : y + 1; + switch (dat->backgroundBmpUse & CLBM_TYPE) { + case CLB_STRETCH: + if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { + if (clRect.right * bmp.bmHeight < clRect.bottom * bmp.bmWidth) { + desth = clRect.bottom; + destw = desth * bmp.bmWidth / bmp.bmHeight; + } + else { + destw = clRect.right; + desth = destw * bmp.bmHeight / bmp.bmWidth; + } + } + else { + destw = clRect.right; + desth = clRect.bottom; + } + break; + case CLB_STRETCHH: + if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { + destw = clRect.right; + desth = destw * bmp.bmHeight / bmp.bmWidth; + } + else { + destw = clRect.right; + desth = bmp.bmHeight; + } + break; + case CLB_STRETCHV: + if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { + desth = clRect.bottom; + destw = desth * bmp.bmWidth / bmp.bmHeight; + } + else { + destw = bmp.bmWidth; + desth = clRect.bottom; + } + break; + default: //clb_topleft + destw = bmp.bmWidth; + desth = bmp.bmHeight; + break; + } + for (; y < maxy; y += desth) { + if (y < rcPaint->top - desth) + continue; + for (x = 0; x < maxx; x += destw) + StretchBlt(hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); + } + DeleteDC(hdcBmp); + } + } + group = &dat->list; + group->scanIndex = 0; + indent = 0; + for (index = 0; y < rcPaint->bottom;) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + indent--; + if (group == NULL) + break; + group->scanIndex++; + continue; + } + if (y > rcPaint->top - dat->rowHeight) { + int iImage = -1; + int selected = index == dat->selection && (dat->showSelAlways || dat->exStyle & CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd) + && group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER; + int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER && dat->iHotTrack == index; + SIZE textSize, countsSize, spaceSize; + int width, checkboxWidth; + char *szCounts; + + //alternating grey + if (style & CLS_GREYALTERNATE && index & 1) { + RECT rc; + rc.top = y; + rc.bottom = rc.top + dat->rowHeight; + rc.left = 0; + rc.right = clRect.right; + FillRect(hdcMem, &rc, hBrushAlternateGrey); + } + + //setup + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) + ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight); + else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) { + if (group->cl.items[group->scanIndex]->flags & CLCIIF_GROUPFONT) + ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight); + else + ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight); + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_DIVIDER) + ChangeToFont(hdcMem, dat, FONTID_DIVIDERS, &fontHeight); + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_NOTONLIST) + ChangeToFont(hdcMem, dat, FONTID_NOTONLIST, &fontHeight); + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && + ((group->cl.items[group->scanIndex]->flags & CONTACTF_INVISTO + && GetRealStatus(group->cl.items[group->scanIndex], status) != ID_STATUS_INVISIBLE) + || (group->cl.items[group->scanIndex]->flags & CONTACTF_VISTO + && GetRealStatus(group->cl.items[group->scanIndex], status) == ID_STATUS_INVISIBLE) + ) + ) { + // the contact is in the always visible list and the proto is invisible + // the contact is in the always invisible and the proto is in any other mode + ChangeToFont(hdcMem, dat, group->cl.items[group->scanIndex]->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS, &fontHeight); + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && !(group->cl.items[group->scanIndex]->flags & CONTACTF_ONLINE)) + ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight); + else + ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight); + GetTextExtentPoint32(hdcMem, group->cl.items[group->scanIndex]->szText, lstrlen(group->cl.items[group->scanIndex]->szText), &textSize); + width = textSize.cx; + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + szCounts = pcli->pfnGetGroupCountsText(dat, group->cl.items[group->scanIndex]); + if (szCounts[0]) { + GetTextExtentPoint32A(hdcMem, " ", 1, &spaceSize); + ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight); + GetTextExtentPoint32A(hdcMem, szCounts, lstrlenA(szCounts), &countsSize); + width += spaceSize.cx + countsSize.cx; + } + } + + if ((style & CLS_CHECKBOXES && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) || + (style & CLS_GROUPCHECKBOXES && group->cl.items[group->scanIndex]->type == CLCIT_GROUP) || + (group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->flags & CLCIIF_CHECKBOX)) + checkboxWidth = dat->checkboxSize + 2; + else + checkboxWidth = 0; + + //background + if (selected) { + int x = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace - 2; + ImageList_DrawEx(dat->himlHighlight, 0, hdcMem, x, y, min(width + 5, clRect.right - x), dat->rowHeight, CLR_NONE, CLR_NONE, + dat->exStyle & CLS_EX_NOTRANSLUCENTSEL ? ILD_NORMAL : ILD_BLEND25); + SetTextColor(hdcMem, dat->selTextColour); + } + else if (hottrack) + SetHotTrackColour(hdcMem, dat); + + //checkboxes + if (checkboxWidth) { + RECT rc; + HANDLE hTheme = NULL; + + // THEME + if (IsWinVerXPPlus()) { + if (!themeAPIHandle) { + themeAPIHandle = GetModuleHandleA("uxtheme"); + if (themeAPIHandle) { + MyOpenThemeData = (HANDLE(WINAPI *) (HWND, LPCWSTR)) MGPROC("OpenThemeData"); + MyCloseThemeData = (HRESULT(WINAPI *) (HANDLE)) MGPROC("CloseThemeData"); + MyDrawThemeBackground = + (HRESULT(WINAPI *) (HANDLE, HDC, int, int, const RECT *, const RECT *)) MGPROC("DrawThemeBackground"); + } + } + // Make sure all of these methods are valid (i would hope either all or none work) + if (MyOpenThemeData && MyCloseThemeData && MyDrawThemeBackground) { + hTheme = MyOpenThemeData(hwnd, L"BUTTON"); + } + } + rc.left = dat->leftMargin + indent * dat->groupIndent; + rc.right = rc.left + dat->checkboxSize; + rc.top = y + ((dat->rowHeight - dat->checkboxSize) >> 1); + rc.bottom = rc.top + dat->checkboxSize; + if (hTheme) { + MyDrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED ? (hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc, &rc); + } + else + DrawFrameControl(hdcMem, &rc, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | (group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED ? DFCS_CHECKED : 0) | (hottrack ? DFCS_HOT : 0)); + if (hTheme && MyCloseThemeData) { + MyCloseThemeData(hTheme); + hTheme = NULL; + } + } + + //icon + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) + iImage = group->cl.items[group->scanIndex]->group->expanded ? IMAGE_GROUPOPEN : IMAGE_GROUPSHUT; + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) + iImage = group->cl.items[group->scanIndex]->iImage; + if (iImage != -1) { + /*COLORREF colourFg=dat->selBkColour; + int mode=ILD_NORMAL; + if(selected) mode=ILD_SELECTED; + else if(hottrack) {mode=ILD_FOCUS; colourFg=dat->hotTextColour;} + else if(group->cl.items[group->scanIndex]->type==CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags&CONTACTF_NOTONLIST) {colourFg=dat->fontInfo[FONTID_NOTONLIST].colour; mode=ILD_BLEND50;} + ImageList_DrawEx(himlCListClc,iImage,hdcMem,dat->leftMargin+indent*dat->groupIndent+checkboxWidth,y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); + */ + // this doesnt use CLS_CONTACTLIST since the colour prolly wont match anyway + COLORREF colourFg = dat->selBkColour; + int mode = ILD_NORMAL; + if (hottrack) { + colourFg = dat->hotTextColour; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_NOTONLIST) { + colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; + mode = ILD_BLEND50; + } + if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && dat->showIdle + && (group->cl.items[group->scanIndex]->flags & CONTACTF_IDLE) + && GetRealStatus(group->cl.items[group->scanIndex], ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) + mode = ILD_SELECTED; + ImageList_DrawEx(himlCListClc, iImage, hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth, + y + ((dat->rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode); + } + + //text + if (group->cl.items[group->scanIndex]->type == CLCIT_DIVIDER) { + RECT rc; + rc.top = y + (dat->rowHeight >> 1); + rc.bottom = rc.top + 2; + rc.left = dat->leftMargin + indent * dat->groupIndent; + rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3; + DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); + TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText, + lstrlen(group->cl.items[group->scanIndex]->szText)); + rc.left = rc.right + 6 + textSize.cx; + rc.right = clRect.right; + DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + RECT rc; + if (szCounts[0]) { + fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight; + rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace; + rc.right = min(clRect.right - countsSize.cx, rc.left + textSize.cx + spaceSize.cx); + rc.top = y + ((dat->rowHeight - fontHeight) >> 1); + rc.bottom = rc.top + textSize.cy; + if (rc.right < rc.left + 4) + rc.right = clRect.right + 1; + else + TextOutA(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, lstrlenA(szCounts)); + ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight); + if (selected) + SetTextColor(hdcMem, dat->selTextColour); + else if (hottrack) + SetHotTrackColour(hdcMem, dat); + rc.right--; + ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, group->cl.items[group->scanIndex]->szText, + lstrlen(group->cl.items[group->scanIndex]->szText), NULL); + } + else + TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace, + y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText, + lstrlen(group->cl.items[group->scanIndex]->szText)); + if (dat->exStyle & CLS_EX_LINEWITHGROUPS) { + rc.top = y + (dat->rowHeight >> 1); + rc.bottom = rc.top + 2; + rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 3; + rc.right = clRect.right - 1 - dat->extraColumnSpacing * dat->extraColumnsCount; + if (rc.right - rc.left > 1) + DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); + } + } + else { + TCHAR *szText = group->cl.items[group->scanIndex]->szText; + RECT rc; + rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace; + rc.top = y + ((dat->rowHeight - fontHeight) >> 1); + rc.right = (clRect.right - clRect.left); + rc.bottom = rc.top; + DrawText(hdcMem, szText, lstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE); + } + if (selected) { + if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) { + TCHAR *szText = group->cl.items[group->scanIndex]->szText; + RECT rc; + int qlen = lstrlen(dat->szQuickSearch); + SetTextColor(hdcMem, dat->quickSearchColour); + rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace; + rc.top = y + ((dat->rowHeight - fontHeight) >> 1); + rc.right = (clRect.right - clRect.left); + rc.bottom = rc.top; + if (qlen) + DrawText(hdcMem, szText, qlen, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE); + } + } + + //extra icons + for (iImage = 0; iImage < dat->extraColumnsCount; iImage++) { + COLORREF colourFg = dat->selBkColour; + int mode = ILD_NORMAL; + if (group->cl.items[group->scanIndex]->iExtraImage[iImage] == 0xFF) + continue; + if (selected) + mode = ILD_SELECTED; + else if (hottrack) { + mode = ILD_FOCUS; + colourFg = dat->hotTextColour; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_NOTONLIST) { + colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; + mode = ILD_BLEND50; + } + ImageList_DrawEx(dat->himlExtraColumns, group->cl.items[group->scanIndex]->iExtraImage[iImage], hdcMem, + clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - iImage), y + ((dat->rowHeight - 16) >> 1), 0, 0, + CLR_NONE, colourFg, mode); + } + } + index++; + y += dat->rowHeight; + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) { + group = group->cl.items[group->scanIndex]->group; + indent++; + group->scanIndex = 0; + continue; + } + group->scanIndex++; + } + if (dat->iInsertionMark != -1) { //insertion mark + HBRUSH hBrush, hoBrush; + POINT pts[8]; + HRGN hRgn; + + pts[0].x = dat->leftMargin; + pts[0].y = dat->iInsertionMark * dat->rowHeight - dat->yScroll - 4; + pts[1].x = pts[0].x + 2; + pts[1].y = pts[0].y + 3; + pts[2].x = clRect.right - 4; + pts[2].y = pts[1].y; + pts[3].x = clRect.right - 1; + pts[3].y = pts[0].y - 1; + pts[4].x = pts[3].x; + pts[4].y = pts[0].y + 7; + pts[5].x = pts[2].x + 1; + pts[5].y = pts[1].y + 2; + pts[6].x = pts[1].x; + pts[6].y = pts[5].y; + pts[7].x = pts[0].x; + pts[7].y = pts[4].y; + hRgn = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE); + hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour); + hoBrush = (HBRUSH) SelectObject(hdcMem, hBrush); + FillRgn(hdcMem, hRgn, hBrush); + SelectObject(hdcMem, hoBrush); + DeleteObject(hBrush); + } + if (!grey) + BitBlt(hdc, rcPaint->left, rcPaint->top, rcPaint->right - rcPaint->left, rcPaint->bottom - rcPaint->top, hdcMem, rcPaint->left, rcPaint->top, + SRCCOPY); + SelectObject(hdcMem,hOldBitmap); + SelectObject(hdcMem,hOldFont); + DeleteDC(hdcMem); + if (hBrushAlternateGrey) + DeleteObject(hBrushAlternateGrey); + if (grey) { + PBYTE bits; + BITMAPINFOHEADER bmih = { 0 }; + int i; + int greyRed, greyGreen, greyBlue; + COLORREF greyColour; + bmih.biBitCount = 32; + bmih.biSize = sizeof(bmih); + bmih.biCompression = BI_RGB; + bmih.biHeight = -clRect.bottom; + bmih.biPlanes = 1; + bmih.biWidth = clRect.right; + bits = (PBYTE) malloc(4 * bmih.biWidth * -bmih.biHeight); + GetDIBits(hdc, hBmpOsb, 0, clRect.bottom, bits, (BITMAPINFO *) & bmih, DIB_RGB_COLORS); + greyColour = GetSysColor(COLOR_3DFACE); + greyRed = GetRValue(greyColour) * 2; + greyGreen = GetGValue(greyColour) * 2; + greyBlue = GetBValue(greyColour) * 2; + if (divide3[0] == 255) { + for (i = 0; i < SIZEOF(divide3); i++) + divide3[i] = (i + 1) / 3; + } + for (i = 4 * clRect.right * clRect.bottom - 4; i >= 0; i -= 4) { + bits[i] = divide3[bits[i] + greyBlue]; + bits[i + 1] = divide3[bits[i + 1] + greyGreen]; + bits[i + 2] = divide3[bits[i + 2] + greyRed]; + } + SetDIBitsToDevice(hdc, 0, 0, clRect.right, clRect.bottom, 0, 0, 0, clRect.bottom, bits, (BITMAPINFO *) & bmih, DIB_RGB_COLORS); + free(bits); + } + DeleteObject(hBmpOsb); +} diff --git a/clist_classic_sje/clist.dep b/clist_classic_sje/clist.dep new file mode 100644 index 0000000..ba6b38b --- /dev/null +++ b/clist_classic_sje/clist.dep @@ -0,0 +1,227 @@ +# Microsoft Developer Studio Generated Dependency File, included by clist.mak + +.\clcopts.c : \ + "..\..\include\m_addcontact.h"\ + "..\..\include\m_button.h"\ + "..\..\include\m_clc.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_clistint.h"\ + "..\..\include\m_clui.h"\ + "..\..\include\m_contacts.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_file.h"\ + "..\..\include\m_genmenu.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_skin.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + "..\..\include\win2k.h"\ + ".\clc.h"\ + ".\clist.h"\ + ".\commonheaders.h"\ + + +.\clcpaint.c : \ + "..\..\include\m_addcontact.h"\ + "..\..\include\m_button.h"\ + "..\..\include\m_clc.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_clistint.h"\ + "..\..\include\m_clui.h"\ + "..\..\include\m_contacts.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_file.h"\ + "..\..\include\m_genmenu.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_skin.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + "..\..\include\win2k.h"\ + ".\clc.h"\ + ".\clist.h"\ + ".\commonheaders.h"\ + + +.\clistmenus.c : \ + "..\..\include\m_addcontact.h"\ + "..\..\include\m_button.h"\ + "..\..\include\m_clc.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_clistint.h"\ + "..\..\include\m_clui.h"\ + "..\..\include\m_contacts.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_file.h"\ + "..\..\include\m_genmenu.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_skin.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + "..\..\include\win2k.h"\ + ".\clc.h"\ + ".\clist.h"\ + ".\commonheaders.h"\ + + +.\clistopts.c : \ + "..\..\include\m_addcontact.h"\ + "..\..\include\m_button.h"\ + "..\..\include\m_clc.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_clistint.h"\ + "..\..\include\m_clui.h"\ + "..\..\include\m_contacts.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_file.h"\ + "..\..\include\m_genmenu.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_skin.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + "..\..\include\win2k.h"\ + ".\clc.h"\ + ".\clist.h"\ + ".\commonheaders.h"\ + + +.\cluiopts.c : \ + "..\..\include\m_addcontact.h"\ + "..\..\include\m_button.h"\ + "..\..\include\m_clc.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_clistint.h"\ + "..\..\include\m_clui.h"\ + "..\..\include\m_contacts.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_file.h"\ + "..\..\include\m_genmenu.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_skin.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + "..\..\include\win2k.h"\ + ".\clc.h"\ + ".\clist.h"\ + ".\commonheaders.h"\ + + +.\commonheaders.c : \ + "..\..\include\m_addcontact.h"\ + "..\..\include\m_button.h"\ + "..\..\include\m_clc.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_clistint.h"\ + "..\..\include\m_clui.h"\ + "..\..\include\m_contacts.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_file.h"\ + "..\..\include\m_genmenu.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_skin.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + "..\..\include\win2k.h"\ + ".\clc.h"\ + ".\clist.h"\ + ".\commonheaders.h"\ + + +.\forkthread.c : \ + "..\..\include\m_addcontact.h"\ + "..\..\include\m_button.h"\ + "..\..\include\m_clc.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_clistint.h"\ + "..\..\include\m_clui.h"\ + "..\..\include\m_contacts.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_file.h"\ + "..\..\include\m_genmenu.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_skin.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + "..\..\include\win2k.h"\ + ".\clc.h"\ + ".\clist.h"\ + ".\commonheaders.h"\ + + +.\init.c : \ + "..\..\include\m_addcontact.h"\ + "..\..\include\m_button.h"\ + "..\..\include\m_clc.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_clistint.h"\ + "..\..\include\m_clui.h"\ + "..\..\include\m_contacts.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_file.h"\ + "..\..\include\m_genmenu.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_skin.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + "..\..\include\win2k.h"\ + ".\clc.h"\ + ".\clist.h"\ + ".\commonheaders.h"\ + + +.\resource.rc : \ + "..\..\include\statusmodes.h"\ + ".\res\blank.ico"\ + ".\res\delete.ico"\ + ".\res\dragcopy.cur"\ + ".\res\dropuser.cur"\ + ".\res\hyperlin.cur"\ + ".\res\rename.ico"\ + diff --git a/clist_classic_sje/clist.dsp b/clist_classic_sje/clist.dsp new file mode 100644 index 0000000..1f3d9a9 --- /dev/null +++ b/clist_classic_sje/clist.dsp @@ -0,0 +1,535 @@ +# Microsoft Developer Studio Project File - Name="clist" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=clist - Win32 Debug Unicode +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "clist.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "clist.mak" CFG="clist - Win32 Debug Unicode" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "clist - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "clist - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "clist - Win32 Release Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "clist - Win32 Debug Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/Miranda/miranda/plugins/clist", SKIAAAAA" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "clist - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 1 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Yu"commonheaders.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /i "../../include/" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /map /debug /machine:I386 /out:"../../bin/release/plugins/clist_classic.dll" +# SUBTRACT LINK32 /pdb:none /incremental:yes + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /i "../../include/" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /debug /machine:I386 /out:"../../bin/debug/plugins/clist_classic.dll" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none /incremental:no + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "clist___Win32_Release_Unicode" +# PROP BASE Intermediate_Dir "clist___Win32_Release_Unicode" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir ".\Release_Unicode" +# PROP Intermediate_Dir ".\Release_Unicode" +# PROP Ignore_Export_Lib 1 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /O1 /I "../../include/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Yu"commonheaders.h" /FD /c +# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Yu"commonheaders.h" /FD /c +# SUBTRACT CPP /Fr +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /i "../../include/" /d "NDEBUG" +# ADD RSC /l 0x809 /i "../../include/" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /map /machine:I386 /out:"../../bin/release/plugins/clist_classic.dll" +# SUBTRACT BASE LINK32 /debug +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /map /debug /machine:I386 /out:"../../bin/Release Unicode/plugins/clist_classic.dll" +# SUBTRACT LINK32 /pdb:none /incremental:yes + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "clist___Win32_Debug_Unicode" +# PROP BASE Intermediate_Dir "clist___Win32_Debug_Unicode" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir ".\Debug_Unicode" +# PROP Intermediate_Dir ".\Debug_Unicode" +# PROP Ignore_Export_Lib 1 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /i "../../include/" /d "_DEBUG" +# ADD RSC /l 0x809 /i "../../include/" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /debug /machine:I386 /out:"../../bin/debug/plugins/clist_classic.dll" /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /debug /machine:I386 /out:"../../bin/Debug Unicode/plugins/clist_classic.dll" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none /incremental:no + +!ENDIF + +# Begin Target + +# Name "clist - Win32 Release" +# Name "clist - Win32 Debug" +# Name "clist - Win32 Release Unicode" +# Name "clist - Win32 Debug Unicode" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\clcopts.c + +!IF "$(CFG)" == "clist - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# ADD BASE CPP /Yu"commonheaders.h" +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\clcpaint.c + +!IF "$(CFG)" == "clist - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# ADD BASE CPP /Yu"commonheaders.h" +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\clistmenus.c + +!IF "$(CFG)" == "clist - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# ADD BASE CPP /Yu"commonheaders.h" +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\clistopts.c + +!IF "$(CFG)" == "clist - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# ADD BASE CPP /Yu"commonheaders.h" +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\cluiopts.c + +!IF "$(CFG)" == "clist - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# ADD BASE CPP /Yu"commonheaders.h" +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\commonheaders.c + +!IF "$(CFG)" == "clist - Win32 Release" + +# ADD CPP /Yc"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# ADD BASE CPP /Yc"commonheaders.h" +# ADD CPP /Yc"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\forkthread.c + +!IF "$(CFG)" == "clist - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# ADD BASE CPP /Yu"commonheaders.h" +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\init.c + +!IF "$(CFG)" == "clist - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +# ADD BASE CPP /Yu"commonheaders.h" +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +!ENDIF + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\clc.h +# End Source File +# Begin Source File + +SOURCE=.\clist.h +# End Source File +# Begin Source File + +SOURCE=.\commonheaders.h +# End Source File +# Begin Source File + +SOURCE=.\forkthread.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\addcontact.ico +# End Source File +# Begin Source File + +SOURCE=.\res\away.ico +# End Source File +# Begin Source File + +SOURCE=.\res\blank.ico +# End Source File +# Begin Source File + +SOURCE=.\res\changefont.ico +# End Source File +# Begin Source File + +SOURCE=.\res\delete.ico +# End Source File +# Begin Source File + +SOURCE=.\res\detailsl.ico +# End Source File +# Begin Source File + +SOURCE=.\res\dnd.ico +# End Source File +# Begin Source File + +SOURCE=.\res\downarrow.ico +# End Source File +# Begin Source File + +SOURCE=.\res\dragcopy.cur +# End Source File +# Begin Source File + +SOURCE=.\res\dropuser.cur +# End Source File +# Begin Source File + +SOURCE=.\res\emptyblo.ico +# End Source File +# Begin Source File + +SOURCE=.\res\file.ico +# End Source File +# Begin Source File + +SOURCE=.\res\filledbl.ico +# End Source File +# Begin Source File + +SOURCE=.\res\finduser.ico +# End Source File +# Begin Source File + +SOURCE=.\res\freechat.ico +# End Source File +# Begin Source File + +SOURCE=.\res\groupope.ico +# End Source File +# Begin Source File + +SOURCE=.\res\groupshu.ico +# End Source File +# Begin Source File + +SOURCE=.\res\help.ico +# End Source File +# Begin Source File + +SOURCE=.\res\history.ico +# End Source File +# Begin Source File + +SOURCE=.\res\hyperlin.cur +# End Source File +# Begin Source File + +SOURCE=.\res\invisible.ico +# End Source File +# Begin Source File + +SOURCE=.\res\message.ico +# End Source File +# Begin Source File + +SOURCE=.\res\miranda.ico +# End Source File +# Begin Source File + +SOURCE=.\res\mirandaw.ico +# End Source File +# Begin Source File + +SOURCE=.\res\multisend.ico +# End Source File +# Begin Source File + +SOURCE=.\res\na2.ico +# End Source File +# Begin Source File + +SOURCE=.\res\notick.ico +# End Source File +# Begin Source File + +SOURCE=.\res\notick1.ico +# End Source File +# Begin Source File + +SOURCE=.\res\occupied.ico +# End Source File +# Begin Source File + +SOURCE=.\res\offline2.ico +# End Source File +# Begin Source File + +SOURCE=.\res\online2.ico +# End Source File +# Begin Source File + +SOURCE=.\res\onthepho.ico +# End Source File +# Begin Source File + +SOURCE=.\res\options.ico +# End Source File +# Begin Source File + +SOURCE=.\res\outtolun.ico +# End Source File +# Begin Source File + +SOURCE=.\res\rename.ico +# End Source File +# Begin Source File + +SOURCE=.\res\reply.ico +# End Source File +# Begin Source File + +SOURCE=.\resource.rc +# End Source File +# Begin Source File + +SOURCE=.\res\searchal.ico +# End Source File +# Begin Source File + +SOURCE=.\res\sendmail.ico +# End Source File +# Begin Source File + +SOURCE=.\res\smalldot.ico +# End Source File +# Begin Source File + +SOURCE=.\res\sms.ico +# End Source File +# Begin Source File + +SOURCE=.\res\sortcold.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\sortcolu.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\timestamp.ico +# End Source File +# Begin Source File + +SOURCE=.\res\url.ico +# End Source File +# Begin Source File + +SOURCE=.\res\useronli.ico +# End Source File +# Begin Source File + +SOURCE=.\res\viewdetails.ico +# End Source File +# End Group +# End Target +# End Project diff --git a/clist_classic_sje/clist.dsw b/clist_classic_sje/clist.dsw new file mode 100644 index 0000000..604ef45 --- /dev/null +++ b/clist_classic_sje/clist.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "clist"=.\clist.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/clist_classic_sje/clist.h b/clist_classic_sje/clist.h new file mode 100644 index 0000000..4184dbe --- /dev/null +++ b/clist_classic_sje/clist.h @@ -0,0 +1,30 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +void LoadContactTree(void); +int IconFromStatusMode(const char *szProto,int status); +HTREEITEM GetTreeItemByHContact(HANDLE hContact); +void TrayIconUpdateWithImageList(int iImage,const char *szNewTip,char *szPreferredProto); +void SortContacts(void); +void ChangeContactIcon(HANDLE hContact,int iIcon,int add); + +#define NEWSTR_ALLOCA(A) (A==NULL)?NULL:strcpy((char*)alloca(strlen(A)+1),A) diff --git a/clist_classic_sje/clist.mak b/clist_classic_sje/clist.mak new file mode 100644 index 0000000..e4d68cc --- /dev/null +++ b/clist_classic_sje/clist.mak @@ -0,0 +1,754 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on clist.dsp +!IF "$(CFG)" == "" +CFG=clist - Win32 Debug Unicode +!MESSAGE No configuration specified. Defaulting to clist - Win32 Debug Unicode. +!ENDIF + +!IF "$(CFG)" != "clist - Win32 Release" && "$(CFG)" != "clist - Win32 Debug" && "$(CFG)" != "clist - Win32 Release Unicode" && "$(CFG)" != "clist - Win32 Debug Unicode" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "clist.mak" CFG="clist - Win32 Debug Unicode" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "clist - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "clist - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "clist - Win32 Release Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "clist - Win32 Debug Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +!IF "$(CFG)" == "clist - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "..\..\bin\release\plugins\clist_classic.dll" + + +CLEAN : + -@erase "$(INTDIR)\clcopts.obj" + -@erase "$(INTDIR)\clcpaint.obj" + -@erase "$(INTDIR)\clist.pch" + -@erase "$(INTDIR)\clistmenus.obj" + -@erase "$(INTDIR)\clistopts.obj" + -@erase "$(INTDIR)\cluiopts.obj" + -@erase "$(INTDIR)\commonheaders.obj" + -@erase "$(INTDIR)\forkthread.obj" + -@erase "$(INTDIR)\init.obj" + -@erase "$(INTDIR)\resource.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\clist_classic.exp" + -@erase "$(OUTDIR)\clist_classic.map" + -@erase "$(OUTDIR)\clist_classic.pdb" + -@erase "..\..\bin\release\plugins\clist_classic.dll" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +MTL=midl.exe +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC=rc.exe +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\resource.res" /i "../../include/" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\clist.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /incremental:no /pdb:"$(OUTDIR)\clist_classic.pdb" /map:"$(INTDIR)\clist_classic.map" /debug /machine:I386 /out:"../../bin/release/plugins/clist_classic.dll" /implib:"$(OUTDIR)\clist_classic.lib" +LINK32_OBJS= \ + "$(INTDIR)\clcopts.obj" \ + "$(INTDIR)\clcpaint.obj" \ + "$(INTDIR)\clistmenus.obj" \ + "$(INTDIR)\clistopts.obj" \ + "$(INTDIR)\cluiopts.obj" \ + "$(INTDIR)\commonheaders.obj" \ + "$(INTDIR)\forkthread.obj" \ + "$(INTDIR)\init.obj" \ + "$(INTDIR)\resource.res" + +"..\..\bin\release\plugins\clist_classic.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "..\..\bin\debug\plugins\clist_classic.dll" + + +CLEAN : + -@erase "$(INTDIR)\clcopts.obj" + -@erase "$(INTDIR)\clcpaint.obj" + -@erase "$(INTDIR)\clistmenus.obj" + -@erase "$(INTDIR)\clistopts.obj" + -@erase "$(INTDIR)\cluiopts.obj" + -@erase "$(INTDIR)\commonheaders.obj" + -@erase "$(INTDIR)\forkthread.obj" + -@erase "$(INTDIR)\init.obj" + -@erase "$(INTDIR)\resource.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\clist_classic.exp" + -@erase "$(OUTDIR)\clist_classic.lib" + -@erase "$(OUTDIR)\clist_classic.pdb" + -@erase "..\..\bin\debug\plugins\clist_classic.dll" + -@erase "..\..\bin\debug\plugins\clist_classic.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +MTL=midl.exe +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC=rc.exe +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\resource.res" /i "../../include/" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\clist.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /incremental:yes /pdb:"$(OUTDIR)\clist_classic.pdb" /debug /machine:I386 /out:"../../bin/debug/plugins/clist_classic.dll" /implib:"$(OUTDIR)\clist_classic.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\clcopts.obj" \ + "$(INTDIR)\clcpaint.obj" \ + "$(INTDIR)\clistmenus.obj" \ + "$(INTDIR)\clistopts.obj" \ + "$(INTDIR)\cluiopts.obj" \ + "$(INTDIR)\commonheaders.obj" \ + "$(INTDIR)\forkthread.obj" \ + "$(INTDIR)\init.obj" \ + "$(INTDIR)\resource.res" + +"..\..\bin\debug\plugins\clist_classic.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +OUTDIR=.\Release_Unicode +INTDIR=.\Release_Unicode + +ALL : "..\..\bin\Release Unicode\plugins\clist_classic.dll" + + +CLEAN : + -@erase "$(INTDIR)\clcopts.obj" + -@erase "$(INTDIR)\clcpaint.obj" + -@erase "$(INTDIR)\clist.pch" + -@erase "$(INTDIR)\clistmenus.obj" + -@erase "$(INTDIR)\clistopts.obj" + -@erase "$(INTDIR)\cluiopts.obj" + -@erase "$(INTDIR)\commonheaders.obj" + -@erase "$(INTDIR)\forkthread.obj" + -@erase "$(INTDIR)\init.obj" + -@erase "$(INTDIR)\resource.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\clist_classic.exp" + -@erase "$(OUTDIR)\clist_classic.map" + -@erase "$(OUTDIR)\clist_classic.pdb" + -@erase "..\..\bin\Release Unicode\plugins\clist_classic.dll" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +MTL=midl.exe +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC=rc.exe +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\resource.res" /i "../../include/" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\clist.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /incremental:no /pdb:"$(OUTDIR)\clist_classic.pdb" /map:"$(INTDIR)\clist_classic.map" /debug /machine:I386 /out:"../../bin/Release Unicode/plugins/clist_classic.dll" /implib:"$(OUTDIR)\clist_classic.lib" +LINK32_OBJS= \ + "$(INTDIR)\clcopts.obj" \ + "$(INTDIR)\clcpaint.obj" \ + "$(INTDIR)\clistmenus.obj" \ + "$(INTDIR)\clistopts.obj" \ + "$(INTDIR)\cluiopts.obj" \ + "$(INTDIR)\commonheaders.obj" \ + "$(INTDIR)\forkthread.obj" \ + "$(INTDIR)\init.obj" \ + "$(INTDIR)\resource.res" + +"..\..\bin\Release Unicode\plugins\clist_classic.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +OUTDIR=.\Debug_Unicode +INTDIR=.\Debug_Unicode + +ALL : "..\..\bin\Debug Unicode\plugins\clist_classic.dll" + + +CLEAN : + -@erase "$(INTDIR)\clcopts.obj" + -@erase "$(INTDIR)\clcpaint.obj" + -@erase "$(INTDIR)\clistmenus.obj" + -@erase "$(INTDIR)\clistopts.obj" + -@erase "$(INTDIR)\cluiopts.obj" + -@erase "$(INTDIR)\commonheaders.obj" + -@erase "$(INTDIR)\forkthread.obj" + -@erase "$(INTDIR)\init.obj" + -@erase "$(INTDIR)\resource.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\clist_classic.exp" + -@erase "$(OUTDIR)\clist_classic.pdb" + -@erase "..\..\bin\Debug Unicode\plugins\clist_classic.dll" + -@erase "..\..\bin\Debug Unicode\plugins\clist_classic.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +MTL=midl.exe +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC=rc.exe +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\resource.res" /i "../../include/" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\clist.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comctl32.lib shell32.lib ole32.lib comdlg32.lib /nologo /base:"0x6590000" /dll /incremental:yes /pdb:"$(OUTDIR)\clist_classic.pdb" /debug /machine:I386 /out:"../../bin/Debug Unicode/plugins/clist_classic.dll" /implib:"$(OUTDIR)\clist_classic.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\clcopts.obj" \ + "$(INTDIR)\clcpaint.obj" \ + "$(INTDIR)\clistmenus.obj" \ + "$(INTDIR)\clistopts.obj" \ + "$(INTDIR)\cluiopts.obj" \ + "$(INTDIR)\commonheaders.obj" \ + "$(INTDIR)\forkthread.obj" \ + "$(INTDIR)\init.obj" \ + "$(INTDIR)\resource.res" + +"..\..\bin\Debug Unicode\plugins\clist_classic.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("clist.dep") +!INCLUDE "clist.dep" +!ELSE +!MESSAGE Warning: cannot find "clist.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "clist - Win32 Release" || "$(CFG)" == "clist - Win32 Debug" || "$(CFG)" == "clist - Win32 Release Unicode" || "$(CFG)" == "clist - Win32 Debug Unicode" +SOURCE=.\clcopts.c + +!IF "$(CFG)" == "clist - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\clcopts.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\clcopts.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\clcopts.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\clcopts.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\clcpaint.c + +!IF "$(CFG)" == "clist - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\clcpaint.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\clcpaint.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\clcpaint.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\clcpaint.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\clistmenus.c + +!IF "$(CFG)" == "clist - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\clistmenus.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\clistmenus.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\clistmenus.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\clistmenus.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\clistopts.c + +!IF "$(CFG)" == "clist - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\clistopts.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\clistopts.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\clistopts.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\clistopts.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\cluiopts.c + +!IF "$(CFG)" == "clist - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\cluiopts.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\cluiopts.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\cluiopts.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\cluiopts.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\commonheaders.c + +!IF "$(CFG)" == "clist - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yc"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\commonheaders.obj" "$(INTDIR)\clist.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\commonheaders.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yc"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\commonheaders.obj" "$(INTDIR)\clist.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\commonheaders.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\forkthread.c + +!IF "$(CFG)" == "clist - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\forkthread.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\forkthread.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\forkthread.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\forkthread.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\init.c + +!IF "$(CFG)" == "clist - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\init.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\init.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include/" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\init.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\clist.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "clist - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CLIST_EXPORTS" /D "UNICODE" /Fp"$(INTDIR)\clist.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\init.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\resource.rc + +"$(INTDIR)\resource.res" : $(SOURCE) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + + +!ENDIF + diff --git a/clist_classic_sje/clist.vcproj b/clist_classic_sje/clist.vcproj new file mode 100644 index 0000000..d2252b4 --- /dev/null +++ b/clist_classic_sje/clist.vcproj @@ -0,0 +1,515 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clist_classic_sje/clist_8.sln b/clist_classic_sje/clist_8.sln new file mode 100644 index 0000000..b269f58 --- /dev/null +++ b/clist_classic_sje/clist_8.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clist", "clist_8.vcproj", "{E71C1722-A41D-4475-87F4-29961A3654BB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Unicode|Win32 = Debug Unicode|Win32 + Debug|Win32 = Debug|Win32 + Release Unicode|Win32 = Release Unicode|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E71C1722-A41D-4475-87F4-29961A3654BB}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 + {E71C1722-A41D-4475-87F4-29961A3654BB}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 + {E71C1722-A41D-4475-87F4-29961A3654BB}.Debug|Win32.ActiveCfg = Debug|Win32 + {E71C1722-A41D-4475-87F4-29961A3654BB}.Debug|Win32.Build.0 = Debug|Win32 + {E71C1722-A41D-4475-87F4-29961A3654BB}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 + {E71C1722-A41D-4475-87F4-29961A3654BB}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 + {E71C1722-A41D-4475-87F4-29961A3654BB}.Release|Win32.ActiveCfg = Release|Win32 + {E71C1722-A41D-4475-87F4-29961A3654BB}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/clist_classic_sje/clist_8.vcproj b/clist_classic_sje/clist_8.vcproj new file mode 100644 index 0000000..1a53455 --- /dev/null +++ b/clist_classic_sje/clist_8.vcproj @@ -0,0 +1,781 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clist_classic_sje/clistmenus.c b/clist_classic_sje/clistmenus.c new file mode 100644 index 0000000..d7a8a22 --- /dev/null +++ b/clist_classic_sje/clistmenus.c @@ -0,0 +1,36 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "commonheaders.h" + +int CloseAction(WPARAM wParam,LPARAM lParam) +{ + if (CallService(MS_SYSTEM_OKTOEXIT,(WPARAM)0,(LPARAM)0)) + SendMessage( pcli->hwndContactList,WM_DESTROY,0,0 ); + + return(0); +} + +void InitCustomMenus() +{ + CreateServiceFunction( "CloseAction", CloseAction ); +} diff --git a/clist_classic_sje/clistopts.c b/clist_classic_sje/clistopts.c new file mode 100644 index 0000000..de33494 --- /dev/null +++ b/clist_classic_sje/clistopts.c @@ -0,0 +1,353 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "commonheaders.h" + +static BOOL CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_USER + 1: + { + HANDLE hContact = (HANDLE) wParam; + DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam; + if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL + && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) { + CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0); + } + break; + } + case WM_DESTROY: + { + UnhookEvent((HANDLE) GetWindowLong(hwndDlg, GWL_USERDATA)); + break; + } + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1)); + CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, + DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, + DBGetContactSettingByte(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, + DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_SORTBYNAME, !DBGetContactSettingByte(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) + && !DBGetContactSettingByte(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS, + DBGetContactSettingByte(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SORTBYPROTO, + DBGetContactSettingByte(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, + DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOHIDE, + DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + { + DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); + if (!(caps & CLUIF_HIDEEMPTYGROUPS)) + ShowWindow(GetDlgItem(hwndDlg, IDC_HIDEEMPTYGROUPS), SW_HIDE); + if (!(caps & CLUIF_DISABLEGROUPS)) + ShowWindow(GetDlgItem(hwndDlg, IDC_DISABLEGROUPS), SW_HIDE); + if (caps & CLUIF_HASONTOPOPTION) + ShowWindow(GetDlgItem(hwndDlg, IDC_ONTOP), SW_HIDE); + if (caps & CLUIF_HASAUTOHIDEOPTION) { + ShowWindow(GetDlgItem(hwndDlg, IDC_AUTOHIDE), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STAUTOHIDESECS), SW_HIDE); + } + } + SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1)); + SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, + MAKELONG(DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0)); + CheckDlgButton(hwndDlg, IDC_ONECLK, + DBGetContactSettingByte(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, + DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, + !DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DONTCYCLE, + DBGetContactSettingByte(NULL, "CList", "TrayIcon", + SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CYCLE, + DBGetContactSettingByte(NULL, "CList", "TrayIcon", + SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MULTITRAY, + DBGetContactSettingByte(NULL, "CList", "TrayIcon", + SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, + DBGetContactSettingByte(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); + EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); + EnableWindow(GetDlgItem(hwndDlg, IDC_STMSDELAY), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); + CheckDlgButton(hwndDlg, IDC_ICONBLINK, DBGetContactSettingByte(NULL, "CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); + if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), FALSE); + } + if (IsDlgButtonChecked(hwndDlg, IDC_CYCLE)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), FALSE); + } + if (IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE); + } + SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1)); + SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, + MAKELONG(DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0)); + { + int i, count, item; + PROTOCOLDESCRIPTOR **protos; + char szName[64]; + DBVARIANT dbv = { DBVT_DELETED }; + DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv); + CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM) & count, (LPARAM) & protos); + item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) TranslateT("Global")); + SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) 0); + for (i = 0; i < count; i++) { + if (protos[i]->type != PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) + continue; + CallProtoService(protos[i]->szName, PS_GETNAME, SIZEOF(szName), (LPARAM) szName); + item = SendDlgItemMessageA(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) szName); + SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) protos[i]); + if (dbv.type == DBVT_ASCIIZ && !lstrcmpA(dbv.pszVal, protos[i]->szName)) + SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0); + } + DBFreeVariant(&dbv); + } + if (-1 == (int) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0)) + SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM) GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy + SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250)); + SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550), 0)); + return TRUE; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_AUTOHIDE) { + EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + } + if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) { + EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)); + } + if (LOWORD(wParam) == IDC_DISABLEBLINK) { + EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); + EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); + EnableWindow(GetDlgItem(hwndDlg, IDC_STMSDELAY), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); + } + if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && HIWORD(wParam) != EN_CHANGE) + break; + if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE) + break; + if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + return 0; + if (LOWORD(wParam) == IDC_BLINKTIME && HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) + return 0; // dont make apply enabled during buddy set crap + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->idFrom) { + case 0: + switch (((LPNMHDR) lParam)->code) { + case PSN_APPLY: + DBWriteContactSettingByte(NULL, "CList", "HideOffline", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); + { + DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); + if (caps & CLUIF_HIDEEMPTYGROUPS) + DBWriteContactSettingByte(NULL, "CList", "HideEmptyGroups", + (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS)); + if (caps & CLUIF_DISABLEGROUPS) + DBWriteContactSettingByte(NULL, "CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS)); + if (!(caps & CLUIF_HASONTOPOPTION)) { + DBWriteContactSettingByte(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); + SetWindowPos( pcli->hwndContactList, + IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE); + } + if (!(caps & CLUIF_HASAUTOHIDEOPTION)) { + DBWriteContactSettingByte(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + DBWriteContactSettingWord(NULL, "CList", "HideTime", + (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); + } + } + DBWriteContactSettingByte(NULL, "CList", "SortByStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS)); + DBWriteContactSettingByte(NULL, "CList", "SortByProto", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO)); + DBWriteContactSettingByte(NULL, "CList", "ConfirmDelete", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE)); + DBWriteContactSettingByte(NULL, "CList", "Tray1Click", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONECLK)); + DBWriteContactSettingByte(NULL, "CList", "AlwaysStatus", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS)); + DBWriteContactSettingByte(NULL, "CList", "AlwaysMulti", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI)); + DBWriteContactSettingByte(NULL, "CList", "TrayIcon", + (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE + : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : + SETTING_TRAYICON_MULTI))); + DBWriteContactSettingWord(NULL, "CList", "CycleTime", + (WORD) SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0)); + DBWriteContactSettingWord(NULL, "CList", "IconFlashTime", + (WORD) SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); + DBWriteContactSettingByte(NULL, "CList", "DisableTrayFlash", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); + DBWriteContactSettingByte(NULL, "CList", "NoIconBlink", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK)); + if (!SendDlgItemMessage + (hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0), 0)) + DBDeleteContactSetting(NULL, "CList", "PrimaryStatus"); + else + DBWriteContactSettingString(NULL, "CList", "PrimaryStatus", + ((PROTOCOLDESCRIPTOR *) + SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, + SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0), + 0))->szName); + pcli->pfnTrayIconIconsChanged(); + pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */ + pcli->pfnInvalidateDisplayNameCacheEntry( INVALID_HANDLE_VALUE ); /* force reshuffle */ + return TRUE; + } + break; + } + break; + } + return FALSE; +} + +static BOOL CALLBACK DlgProcHotkeyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + { + DBVARIANT dbv; + + TranslateDialogDefault(hwndDlg); + + CheckDlgButton(hwndDlg, IDC_SHOWHIDE, DBGetContactSettingByte(NULL, "CList", "HKEnShowHide", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_READMSG, DBGetContactSettingByte(NULL, "CList", "HKEnReadMsg", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NETSEARCH, DBGetContactSettingByte(NULL, "CList", "HKEnNetSearch", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWOPTIONS, DBGetContactSettingByte(NULL, "CList", "HKEnShowOptions", 0) ? BST_CHECKED : BST_UNCHECKED); + + EnableWindow(GetDlgItem(hwndDlg, IDC_HKSHOWHIDE), IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HKREADMSG), IsDlgButtonChecked(hwndDlg, IDC_READMSG)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HKSEARCH), IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SEARCHURL), IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SEARCHNEWWND), IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HOTKEYURLSTR), IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HKSHOWOPTIONS), IsDlgButtonChecked(hwndDlg, IDC_SHOWOPTIONS)); + + SendDlgItemMessage(hwndDlg, IDC_HKSHOWHIDE, HKM_SETHOTKEY, + DBGetContactSettingWord(NULL, "CList", "HKShowHide", MAKEWORD('A', HOTKEYF_CONTROL | HOTKEYF_SHIFT)), 0); + SendDlgItemMessage(hwndDlg, IDC_HKREADMSG, HKM_SETHOTKEY, + DBGetContactSettingWord(NULL, "CList", "HKReadMsg", MAKEWORD('I', HOTKEYF_CONTROL | HOTKEYF_SHIFT)), 0); + SendDlgItemMessage(hwndDlg, IDC_HKSEARCH, HKM_SETHOTKEY, + DBGetContactSettingWord(NULL, "CList", "HKNetSearch", MAKEWORD('S', HOTKEYF_CONTROL | HOTKEYF_SHIFT)), 0); + SendDlgItemMessage(hwndDlg, IDC_HKSHOWOPTIONS, HKM_SETHOTKEY, + DBGetContactSettingWord(NULL, "CList", "HKShowOptions", MAKEWORD('O', HOTKEYF_CONTROL | HOTKEYF_SHIFT)), 0); + if (!DBGetContactSetting(NULL, "CList", "SearchUrl", &dbv)) { + SetDlgItemTextA(hwndDlg, IDC_SEARCHURL, dbv.pszVal); + mir_free(dbv.pszVal); + } + else + SetDlgItemTextA(hwndDlg, IDC_SEARCHURL, "http://www.google.com/"); + CheckDlgButton(hwndDlg, IDC_SEARCHNEWWND, DBGetContactSettingByte(NULL, "CList", "HKSearchNewWnd", 0) ? BST_CHECKED : BST_UNCHECKED); + return TRUE; + } + case WM_COMMAND: + if (LOWORD(wParam) == IDC_SEARCHURL && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + return 0; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + switch (LOWORD(wParam)) { + case IDC_SHOWHIDE: + EnableWindow(GetDlgItem(hwndDlg, IDC_HKSHOWHIDE), IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE)); + break; + case IDC_READMSG: + EnableWindow(GetDlgItem(hwndDlg, IDC_HKREADMSG), IsDlgButtonChecked(hwndDlg, IDC_READMSG)); + break; + case IDC_NETSEARCH: + EnableWindow(GetDlgItem(hwndDlg, IDC_HKSEARCH), IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SEARCHURL), IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SEARCHNEWWND), IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HOTKEYURLSTR), IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + break; + case IDC_SHOWOPTIONS: + EnableWindow(GetDlgItem(hwndDlg, IDC_HKSHOWOPTIONS), IsDlgButtonChecked(hwndDlg, IDC_SHOWOPTIONS)); + break; + } + break; + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->code) { + case PSN_APPLY: + { + char str[256]; + pcli->pfnHotKeysUnregister( pcli->hwndContactList ); + DBWriteContactSettingByte(NULL, "CList", "HKEnShowHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDE)); + DBWriteContactSettingWord(NULL, "CList", "HKShowHide", (WORD) SendDlgItemMessage(hwndDlg, IDC_HKSHOWHIDE, HKM_GETHOTKEY, 0, 0)); + DBWriteContactSettingByte(NULL, "CList", "HKEnReadMsg", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_READMSG)); + DBWriteContactSettingWord(NULL, "CList", "HKReadMsg", (WORD) SendDlgItemMessage(hwndDlg, IDC_HKREADMSG, HKM_GETHOTKEY, 0, 0)); + DBWriteContactSettingByte(NULL, "CList", "HKEnNetSearch", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NETSEARCH)); + DBWriteContactSettingWord(NULL, "CList", "HKNetSearch", (WORD) SendDlgItemMessage(hwndDlg, IDC_HKSEARCH, HKM_GETHOTKEY, 0, 0)); + GetDlgItemTextA(hwndDlg, IDC_SEARCHURL, str, SIZEOF(str)); + DBWriteContactSettingString(NULL, "CList", "SearchUrl", str); + DBWriteContactSettingByte(NULL, "CList", "HKSearchNewWnd", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SEARCHNEWWND)); + DBWriteContactSettingByte(NULL, "CList", "HKEnShowOptions", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWOPTIONS)); + DBWriteContactSettingWord(NULL, "CList", "HKShowOptions", (WORD) SendDlgItemMessage(hwndDlg, IDC_HKSHOWOPTIONS, HKM_GETHOTKEY, 0, 0)); + pcli->pfnHotKeysRegister( pcli->hwndContactList ); + return TRUE; + } + } + break; + } + return FALSE; +} + +/****************************************************************************************/ + +static UINT expertOnlyControls[] = { IDC_ALWAYSSTATUS }; + +int CListOptInit(WPARAM wParam, LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp; + + ZeroMemory(&odp, sizeof(odp)); + odp.cbSize = sizeof(odp); + odp.position = -1000000000; + odp.hInstance = g_hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST); + odp.pszTitle = "Contact List"; + odp.pfnDlgProc = DlgProcGenOpts; + odp.flags = ODPF_BOLDGROUPS; + odp.nIDBottomSimpleControl = IDC_STCLISTGROUP; + odp.expertOnlyControls = expertOnlyControls; + odp.nExpertOnlyControls = SIZEOF(expertOnlyControls); + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp); + + odp.position = -900000000; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HOTKEY); + odp.pszTitle = "Hotkeys"; + odp.pszGroup = "Events"; + odp.pfnDlgProc = DlgProcHotkeyOpts; + odp.nIDBottomSimpleControl = 0; + odp.nExpertOnlyControls = 0; + odp.expertOnlyControls = NULL; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp); + return 0; +} diff --git a/clist_classic_sje/cluiopts.c b/clist_classic_sje/cluiopts.c new file mode 100644 index 0000000..22c23fd --- /dev/null +++ b/clist_classic_sje/cluiopts.c @@ -0,0 +1,363 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "commonheaders.h" + +extern BOOL(WINAPI * MySetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); + +static BOOL CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, + DBGetContactSettingByte(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TOOLWND, + DBGetContactSettingByte(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MIN2TRAY, + DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE); + } + CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, + DBGetContactSettingByte(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, + DBGetContactSettingByte(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, + DBGetContactSettingByte(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), FALSE); + } + CheckDlgButton(hwndDlg, IDC_FADEINOUT, DBGetContactSettingByte(NULL, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOSIZE, DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DROPSHADOW, DBGetContactSettingByte(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONDESKTOP, DBGetContactSettingByte(NULL, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); + SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, DBGetContactSettingByte(NULL, "CLUI", "MaxSizeHeight", 75)); + CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, DBGetContactSettingByte(NULL, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOHIDE, + DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1)); + SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, + MAKELONG(DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + if (!IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC21), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC22), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZEHEIGHT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZESPIN), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSIZEUPWARD), FALSE); + } + + { DBVARIANT dbv; + if ( !DBGetContactSettingTString(NULL, "CList", "TitleText", &dbv)) { + SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal); + DBFreeVariant( &dbv ); + } + else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME); + } + if (!IsWinVer2000Plus()) { + EnableWindow(GetDlgItem(hwndDlg, IDC_FADEINOUT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DROPSHADOW), FALSE); + } + else + CheckDlgButton(hwndDlg, IDC_TRANSPARENT, + DBGetContactSettingByte(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + + if (!IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC12), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSACTIVE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSINACTIVE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_ACTIVEPERC), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_INACTIVEPERC), FALSE); + } + SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); + SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); + SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, DBGetContactSettingByte(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT)); + SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE, + DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT)); + SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0); + + CheckDlgButton(hwndDlg, IDC_NOBORDER, DBGetContactSettingByte(NULL, "CList", "NoBorder", 0) ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_NOBORDER), !IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDC_AUTOHIDE) { + EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + } + else if (LOWORD(wParam) == IDC_TRANSPARENT) { + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC12), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSACTIVE), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSINACTIVE), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_ACTIVEPERC), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + EnableWindow(GetDlgItem(hwndDlg, IDC_INACTIVEPERC), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + } + else if (LOWORD(wParam) == IDC_AUTOSIZE) { + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC21), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC22), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZEHEIGHT), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSIZEUPWARD), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + } + else if (LOWORD(wParam) == IDC_TOOLWND) { + EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), !IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); + } + else if (LOWORD(wParam) == IDC_SHOWCAPTION) { + EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), !IsDlgButtonChecked(hwndDlg, IDC_TOOLWND) + && IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + EnableWindow(GetDlgItem(hwndDlg, IDC_NOBORDER), !IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + } + + if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_TITLETEXT || LOWORD(wParam) == IDC_MAXSIZEHEIGHT) && + (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) + return 0; + + // Enable apply button + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case WM_HSCROLL: + { + char str[10]; + wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255); + SetDlgItemTextA(hwndDlg, IDC_INACTIVEPERC, str); + wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255); + SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str); + } + if (wParam != 0x12345678) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + if (((LPNMHDR) lParam)->code == PSN_APPLY) { + DBWriteContactSettingByte(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); + DBWriteContactSettingByte(NULL, "CList", "ToolWindow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); + DBWriteContactSettingByte(NULL, "CList", "BringToFront", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); + DBWriteContactSettingByte(NULL, "CLUI", "FadeInOut", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); + DBWriteContactSettingByte(NULL, "CLUI", "AutoSize", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); + DBWriteContactSettingByte(NULL, "CLUI", "MaxSizeHeight", (BYTE) GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE)); + DBWriteContactSettingByte(NULL, "CLUI", "AutoSizeUpward", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); + DBWriteContactSettingByte(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); + DBWriteContactSettingWord(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); + DBWriteContactSettingByte(NULL, "CList", "Transparent", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); + DBWriteContactSettingByte(NULL, "CList", "Alpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0)); + DBWriteContactSettingByte(NULL, "CList", "AutoAlpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0)); + DBWriteContactSettingByte(NULL, "CList", "WindowShadow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); + DBWriteContactSettingByte(NULL, "CList", "OnDesktop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); + DBWriteContactSettingByte(NULL, "CLUI", "ShowCaption", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); + DBWriteContactSettingByte(NULL, "CLUI", "ShowMainMenu", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); + DBWriteContactSettingByte(NULL, "CLUI", "ClientAreaDrag", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); + DBWriteContactSettingByte(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); + DBWriteContactSettingByte(NULL, "CList", "NoBorder", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOBORDER)); + { + TCHAR title[256]; + GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title)); + DBWriteContactSettingTString(NULL, "CList", "TitleText", title); + SetWindowText(pcli->hwndContactList, title); + } + pcli->pfnLoadCluiGlobalOpts(); + SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE); + if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) { + // Window must be hidden to dynamically remove the taskbar button. + // See http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp + WINDOWPLACEMENT p; + p.length = sizeof(p); + GetWindowPlacement(pcli->hwndContactList, &p); + ShowWindow(pcli->hwndContactList, SW_HIDE); + SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, + GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE); + SetWindowPlacement(pcli->hwndContactList, &p); + } + else SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW); + + if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) { + HWND hProgMan = FindWindowA("Progman", NULL); + if (IsWindow(hProgMan)) + SetParent(pcli->hwndContactList, hProgMan); + } + else SetParent(pcli->hwndContactList, NULL); + + if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) + SetWindowLong(pcli->hwndContactList, GWL_STYLE, + GetWindowLong(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); + else + SetWindowLong(pcli->hwndContactList, GWL_STYLE, + GetWindowLong(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)); + + if (IsDlgButtonChecked(hwndDlg, IDC_NOBORDER) && !IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) + SetWindowLong(pcli->hwndContactList, GWL_STYLE, + GetWindowLong(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_THICKFRAME)); + else + SetWindowLong(pcli->hwndContactList, GWL_STYLE, + GetWindowLong(pcli->hwndContactList, GWL_STYLE) | WS_THICKFRAME); + + if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)) + SetMenu(pcli->hwndContactList, NULL); + else + SetMenu(pcli->hwndContactList, pcli->hMenuMain); + + SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + if (IsIconic(pcli->hwndContactList) && !IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) + ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW); + if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { + SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); + if (MySetLayeredWindowAttributes) + MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), + (BYTE) DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), + LWA_ALPHA); + } + else SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); + + SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged + return TRUE; + } + break; + } + return FALSE; +} + +static BOOL CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_SHOWSBAR, DBGetContactSettingByte(NULL, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED); + { + BYTE showOpts = DBGetContactSettingByte(NULL, "CLUI", "SBarShow", 1); + CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED); + } + CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, DBGetContactSettingByte(NULL, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, !IsDlgButtonChecked(hwndDlg, IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, DBGetContactSettingByte(NULL, "CLUI", "EqualSections", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, DBGetContactSettingByte(NULL, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWGRIP, DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CLCBKGND, DBGetContactSettingByte(NULL, "CLUI", "SBarCLCBkGnd", 0) ? BST_CHECKED : BST_UNCHECKED); + if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWICON), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPROTO), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSTATUS), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTSTATUS), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTMIRANDA), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_EQUALSECTIONS), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_SBPANELBEVEL), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWGRIP), FALSE); + } + return TRUE; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_SHOWSBAR) { + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWICON), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPROTO), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSTATUS), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTSTATUS), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTMIRANDA), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg, IDC_EQUALSECTIONS), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SBPANELBEVEL), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWGRIP), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + } + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case WM_NOTIFY: + if (((LPNMHDR) lParam)->code == PSN_APPLY ) { + DBWriteContactSettingByte(NULL, "CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); + DBWriteContactSettingByte(NULL, "CLUI", "SBarShow", + (BYTE) ((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0))); + DBWriteContactSettingByte(NULL, "CLUI", "SBarRightClk", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA)); + DBWriteContactSettingByte(NULL, "CLUI", "EqualSections", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); + DBWriteContactSettingByte(NULL, "CLUI", "SBarBevel", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL)); + DBWriteContactSettingByte(NULL, "CLUI", "SBarCLCBkGnd", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CLCBKGND)); + pcli->pfnLoadCluiGlobalOpts(); + if (DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) != (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) { + HWND parent = GetParent(pcli->hwndStatus); + int flags = WS_CHILD | CCS_BOTTOM; + DBWriteContactSettingByte(NULL, "CLUI", "ShowGrip", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)); + ShowWindow(pcli->hwndStatus, SW_HIDE); + DestroyWindow(pcli->hwndStatus); + flags |= DBGetContactSettingByte(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; + flags |= DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; + pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL); + } + if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) + ShowWindow(pcli->hwndStatus, SW_SHOW); + else + ShowWindow(pcli->hwndStatus, SW_HIDE); + SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); + return TRUE; + } + break; + } + return FALSE; +} + +/****************************************************************************************/ + +static UINT expertOnlyControls[] = +{ + IDC_BRINGTOFRONT, IDC_AUTOSIZE, IDC_STATIC21, IDC_MAXSIZEHEIGHT, IDC_MAXSIZESPIN, + IDC_STATIC22, IDC_AUTOSIZEUPWARD, IDC_SHOWMAINMENU, IDC_SHOWCAPTION, IDC_CLIENTDRAG +}; + +int CluiOptInit(WPARAM wParam, LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp; + + ZeroMemory(&odp, sizeof(odp)); + odp.cbSize = sizeof(odp); + odp.position = 0; + odp.hInstance = g_hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI); + odp.pszTitle = "Window"; + odp.pszGroup = "Contact List"; + odp.pfnDlgProc = DlgProcCluiOpts; + odp.flags = ODPF_BOLDGROUPS; + odp.nIDBottomSimpleControl = IDC_STWINDOWGROUP; + odp.expertOnlyControls = expertOnlyControls; + odp.nExpertOnlyControls = SIZEOF(expertOnlyControls); + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp); + + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SBAR); + odp.pszTitle = "Status Bar"; + odp.pfnDlgProc = DlgProcSBarOpts; + odp.flags = ODPF_BOLDGROUPS | ODPF_EXPERTONLY; + odp.nIDBottomSimpleControl = 0; + odp.nExpertOnlyControls = 0; + odp.expertOnlyControls = NULL; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) & odp); + return 0; +} diff --git a/clist_classic_sje/commonheaders.c b/clist_classic_sje/commonheaders.c new file mode 100644 index 0000000..14f99f7 --- /dev/null +++ b/clist_classic_sje/commonheaders.c @@ -0,0 +1 @@ +#include "commonheaders.h" diff --git a/clist_classic_sje/commonheaders.h b/clist_classic_sje/commonheaders.h new file mode 100644 index 0000000..7db5222 --- /dev/null +++ b/clist_classic_sje/commonheaders.h @@ -0,0 +1,84 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2005 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#if defined(UNICODE) +#define _UNICODE 1 +#endif + +#include + +#ifdef _DEBUG +# define _CRTDBG_MAP_ALLOC +# include +# include +#endif + +#include + +#define _WIN32_WINNT 0x0501 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "resource.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "clc.h" +#include "clist.h" + +#include "../MetaContacts/m_metacontacts.h" +#include + +// shared vars +extern HINSTANCE g_hInst; + +/* most free()'s are invalid when the code is executed from a dll, so this changes + all the bad free()'s to good ones, however it's still incorrect code. The reasons for not + changing them include: + + * DBFreeVariant has a CallService() lookup + * free() is executed in some large loops to do with clist creation of group data + * easy search and replace + +*/ diff --git a/clist_classic_sje/database.c b/clist_classic_sje/database.c new file mode 100644 index 0000000..2d815dc --- /dev/null +++ b/clist_classic_sje/database.c @@ -0,0 +1,218 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "commonheaders.h" +#include "database.h" + +int ProfileManager(char *szDbDest,int cbDbDest); +int ShouldAutoCreate(void); +int CreateDbHeaders(HANDLE hFile); +int InitialiseDbHeaders(void); +int InitSettings(void); +void UninitSettings(void); +int InitContacts(void); +void UninitContacts(void); +int InitEvents(void); +void UninitEvents(void); +int InitCrypt(void); +int InitTime(void); +int InitModuleNames(void); +void UninitModuleNames(void); +int InitCache(void); +void UninitCache(void); +int InitIni(void); +void UninitIni(void); + +int InitOptions(void); +void UninitOptions(void); + +void FinalCommandSetup(void); +void FinalCommandExecute(void); + +HANDLE hDbFile=INVALID_HANDLE_VALUE; +CRITICAL_SECTION csDbAccess; +struct DBHeader dbHeader; +char szDbPath[MAX_PATH]; + +BOOL bUnloading=FALSE; + +static void UnloadDatabase(void) +{ + CloseHandle(hDbFile); +} + +DWORD CreateNewSpace(int bytes) +{ + DWORD ofsNew; + + ofsNew=dbHeader.ofsFileEnd; + dbHeader.ofsFileEnd+=bytes; + DBWrite(0,&dbHeader,sizeof(dbHeader)); + log2("newspace %d@%08x",bytes,ofsNew); + return ofsNew; +} + +void DeleteSpace(DWORD ofs,int bytes) +{ + PBYTE buf; + log2("deletespace %d@%08x",bytes,ofs); + + // reclaim a little space - will result in e.g. multiple db events with the same handle! +#ifdef DB_RECLAIM + if(ofs + bytes == dbHeader.ofsFileEnd) { + dbHeader.ofsFileEnd-=bytes; + DBWrite(0,&dbHeader,sizeof(dbHeader)); + // shrink file + SetFilePointer(hDbFile, dbHeader.ofsFileEnd, 0, FILE_BEGIN); + SetEndOfFile(hDbFile); + return; + } +#endif + + dbHeader.slackSpace+=bytes; + DBWrite(0,&dbHeader,sizeof(dbHeader)); + buf=(PBYTE)mir_alloc(bytes); + memset(buf,0,bytes); + DBWrite(ofs,buf,bytes); + mir_free(buf); +} + +void UnloadDatabaseModule(void) +{ + bUnloading = TRUE; + + FinalCommandSetup(); + + UninitOptions(); + + //UninitIni(); + UninitEvents(); + UninitSettings(); + UninitContacts(); + UninitModuleNames(); + UninitCache(); + UnloadDatabase(); + DeleteCriticalSection(&csDbAccess); + + FinalCommandExecute(); +} + +static int GetProfileName(WPARAM wParam, LPARAM lParam) +{ + char * p = 0; + p = strrchr(szDbPath, '\\'); + if ( p == 0 ) return 1; + p++; + strncpy((char*)lParam, p, (size_t) wParam); + return 0; +} + +static int GetProfilePath(WPARAM wParam, LPARAM lParam) +{ + char * dst = (char*)lParam; + char * p = 0; + strncpy(dst,szDbPath,wParam); + p = strrchr(dst, '\\'); + if ( p == NULL ) return 1; + *p=0; + return 0; +} + +int LoadDatabaseModule(void) +{ + InitializeCriticalSection(&csDbAccess); + log0("DB logging running"); + { + DWORD dummy=0; + hDbFile=CreateFile(szDbPath,GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL); + if ( hDbFile == INVALID_HANDLE_VALUE ) { + return 1; + } + if ( !ReadFile(hDbFile,&dbHeader,sizeof(dbHeader),&dummy,NULL) ) { + CloseHandle(hDbFile); + return 1; + } + } + //if(ParseCommandLine()) return 1; + if(InitCache()) return 1; + if(InitModuleNames()) return 1; + if(InitContacts()) return 1; + if(InitSettings()) return 1; + if(InitEvents()) return 1; + if(InitCrypt()) return 1; + //if(InitTime()) return 1; + //if(InitIni()) return 1; + CreateServiceFunction(MS_DB_GETPROFILENAME,GetProfileName); + CreateServiceFunction(MS_DB_GETPROFILEPATH,GetProfilePath); + + if(InitOptions()) return 1; + + return 0; +} + +static DWORD DatabaseCorrupted=0; + +void __cdecl dbpanic(void *arg) +{ + + MessageBox(0,Translate("Miranda has detected corruption in your database. This corruption maybe fixed by DBTool. Please download it from http://www.miranda-im.org. Miranda will now shutdown."),Translate("Database Panic"),MB_SETFOREGROUND|MB_TOPMOST|MB_APPLMODAL|MB_ICONWARNING|MB_OK); + TerminateProcess(GetCurrentProcess(),255); + return; +} + +void DatabaseCorruption(void) +{ + int kill=0; + + EnterCriticalSection(&csDbAccess); + if (DatabaseCorrupted==0) { + DatabaseCorrupted++; + kill++; + } else { + /* db is already corrupted, someone else is dealing with it, wait here + so that we don't do any more damage */ + LeaveCriticalSection(&csDbAccess); + Sleep(INFINITE); + return; + } + LeaveCriticalSection(&csDbAccess); + if (kill) { + _beginthread(dbpanic,0,NULL); + Sleep(INFINITE); + } +} + +#ifdef DBLOGGING +void DBLog(const char *file,int line,const char *fmt,...) +{ + FILE *fp; + va_list vararg; + char str[1024]; + + va_start(vararg,fmt); + mir_vsnprintf(str,sizeof(str),fmt,vararg); + va_end(vararg); + fp=fopen("c:\\mirandadatabase.log.txt","at"); + fprintf(fp,"%u: %s %d: %s\n",GetTickCount(),file,line,str); + fclose(fp); +} +#endif diff --git a/clist_classic_sje/database.h b/clist_classic_sje/database.h new file mode 100644 index 0000000..3e09949 --- /dev/null +++ b/clist_classic_sje/database.h @@ -0,0 +1,214 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +//all offsets are relative to the start of the file +//offsets are 0 if there is nothing in the chain or this is the last in the +//chain + +/* tree diagram + +DBHeader + |-->end of file (plain offset) + |-->first contact (DBContact) + | |-->next contact (DBContact) + | | \--> ... + | |-->first settings (DBContactSettings) + | | |-->next settings (DBContactSettings) + | | | \--> ... + | | \-->module name (DBModuleName) + | \-->first/last/firstunread event + |-->user contact (DBContact) + | |-->next contact=NULL + | |-->first settings as above + | \-->first/last/firstunread event as above + \-->first module name (DBModuleName) + \-->next module name (DBModuleName) + \--> ... +*/ + +#define DB_RESIZE_GRANULARITY 16384 +#define DB_THIS_VERSION 0x00000700u +#define DB_SETTINGS_RESIZE_GRANULARITY 128 + +#include +struct DBHeader { + BYTE signature[16]; // 'Miranda ICQ DB',0,26 + DWORD version; //as 4 bytes, ie 1.2.3.10=0x0102030a + //this version is 0x00000700 + DWORD ofsFileEnd; //offset of the end of the database - place to write + //new structures + DWORD slackSpace; //a counter of the number of bytes that have been + //wasted so far due to deleting structures and/or + //re-making them at the end. We should compact when + //this gets above a threshold + DWORD contactCount; //number of contacts in the chain,excluding the user + DWORD ofsFirstContact; //offset to first struct DBContact in the chain + DWORD ofsUser; //offset to struct DBContact representing the user + DWORD ofsFirstModuleName; //offset to first struct DBModuleName in the chain +}; + +#define DBCONTACT_SIGNATURE 0x43DECADEu +struct DBContact { + DWORD signature; + DWORD ofsNext; //offset to the next contact in the chain. zero if + //this is the 'user' contact or the last contact + //in the chain + DWORD ofsFirstSettings; //offset to the first DBContactSettings in the + //chain for this contact. + DWORD eventCount; //number of events in the chain for this contact + DWORD ofsFirstEvent,ofsLastEvent; //offsets to the first and last DBEvent in + //the chain for this contact + DWORD ofsFirstUnreadEvent; //offset to the first (chronological) unread event + //in the chain, 0 if all are read + DWORD timestampFirstUnread; //timestamp of the event at ofsFirstUnreadEvent +}; + +#define DBMODULENAME_SIGNATURE 0x4DDECADEu +struct DBModuleName { + DWORD signature; + DWORD ofsNext; //offset to the next module name in the chain + BYTE cbName; //number of characters in this module name + char name[1]; //name, no nul terminator +}; + +#define DBCONTACTSETTINGS_SIGNATURE 0x53DECADEu +struct DBContactSettings { + DWORD signature; + DWORD ofsNext; //offset to the next contactsettings in the chain + DWORD ofsModuleName; //offset to the DBModuleName of the owner of these + //settings + DWORD cbBlob; //size of the blob in bytes. May be larger than the + //actual size for reducing the number of moves + //required using granularity in resizing + BYTE blob[1]; //the blob. a back-to-back sequence of DBSetting + //structs, the last has cbName=0 +}; + +/* not a valid structure, content is figured out on the fly +struct DBSetting { + BYTE cbName; //number of bytes in the name of this setting + //this =0 marks the end + char szName[...]; //setting name, excluding nul + BYTE dataType; //type of data. see m_database.h, db/contact/getsetting + union { //a load of types of data, length is defined by dataType + BYTE bVal; WORD wVal; DWORD dVal; + struct { + WORD cbString; + char szVal[...]; //excludes nul terminator + }; + struct { + WORD cbBlob; + BYTE blobVal[...]; + }; + }; +}; +*/ + +#define DBEVENT_SIGNATURE 0x45DECADEu +struct DBEvent { + DWORD signature; + DWORD ofsPrev,ofsNext; //offset to the previous and next events in the + //chain. Chain is sorted chronologically + DWORD ofsModuleName; //offset to a DBModuleName struct of the name of + //the owner of this event + DWORD timestamp; //seconds since 00:00:00 01/01/1970 + DWORD flags; //see m_database.h, db/event/add + WORD eventType; //module-defined event type + DWORD cbBlob; //number of bytes in the blob + BYTE blob[1]; //the blob. module-defined formatting +}; +#include + +typedef struct +{ + BYTE bIsResident; + char name[1]; +} + DBCachedSettingName; + +typedef struct +{ + char* name; + DBVARIANT value; +} + DBCachedGlobalValue; + +typedef struct DBCachedContactValue_tag +{ + char* name; + DBVARIANT value; + struct DBCachedContactValue_tag* next; +} + DBCachedContactValue; + +typedef struct +{ + HANDLE hContact; + HANDLE hNext; + DBCachedContactValue* first; +} + DBCachedContactValueList; + + +//databasecorruption: called if any signatures are broken. very very fatal +void DatabaseCorruption(void); +PBYTE DBRead(DWORD ofs,int bytesRequired,int *bytesAvail); //any preview result could be invalidated by the next call +void DBWrite(DWORD ofs,PVOID pData,int count); +void DBFlush(int setting); +void DBMoveChunk(DWORD ofsDest,DWORD ofsSource,int bytes); +DWORD CreateNewSpace(int bytes); +void DeleteSpace(DWORD ofs,int bytes); +int GetProfileDirectory(char *szPath,int cbPath); +int GetDefaultProfilePath(char *szPath,int cbPath,int *specified); +int ShouldShowProfileManager(void); +int CheckDbHeaders(struct DBHeader * hdr); +int CreateDbHeaders(HANDLE hFile); +int LoadDatabaseModule(void); +void UnloadDatabaseModule(void); + +#ifdef _DEBUG +#define MAXCACHEDREADSIZE 512 +#else +#define MAXCACHEDREADSIZE 2048 //push it to 1K //technically 4096 would work, but I'm not going to push it +#endif + +#ifdef _DEBUG +//#define DBLOGGING +#endif +#ifdef DBLOGGING +void DBLog(const char *file,int line,const char *fmt,...); +#define logg() DBLog(__FILE__,__LINE__,"") +#define log0(s) DBLog(__FILE__,__LINE__,s) +#define log1(s,a) DBLog(__FILE__,__LINE__,s,a) +#define log2(s,a,b) DBLog(__FILE__,__LINE__,s,a,b) +#define log3(s,a,b,c) DBLog(__FILE__,__LINE__,s,a,b,c) +#define log4(s,a,b,c,d) DBLog(__FILE__,__LINE__,s,a,b,c,d) +#else +#define logg() +#define log0(s) +#define log1(s,a) +#define log2(s,a,b) +#define log3(s,a,b,c) +#define log4(s,a,b,c,d) +#endif diff --git a/clist_classic_sje/db3x.dep b/clist_classic_sje/db3x.dep new file mode 100644 index 0000000..20d2e5d --- /dev/null +++ b/clist_classic_sje/db3x.dep @@ -0,0 +1,56 @@ +# Microsoft Developer Studio Generated Dependency File, included by db3x.mak + +.\commonheaders.c : \ + "..\..\include\m_database.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_system.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\win2k.h"\ + ".\commonheaders.h"\ + + +.\database.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + + +.\dbcache.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + + +.\dbcontacts.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + + +.\dbevents.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + + +.\dbheaders.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + + +.\dbmodulechain.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + + +.\dbsettings.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + + +.\encrypt.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + + +.\init.c : \ + "..\..\include\m_plugins.h"\ + ".\database.h"\ + diff --git a/clist_classic_sje/db3x.dsp b/clist_classic_sje/db3x.dsp new file mode 100644 index 0000000..241e039 --- /dev/null +++ b/clist_classic_sje/db3x.dsp @@ -0,0 +1,239 @@ +# Microsoft Developer Studio Project File - Name="db3x" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=db3x - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "db3x.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "db3x.mak" CFG="db3x - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db3x - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "db3x - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/Miranda/miranda/plugins/db3x", WKIAAAAA" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db3x - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Yu"commonheaders.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x5130000" /dll /map /debug /machine:I386 /out:"../../bin/release/plugins/dbx_3x.dll" /IGNORE:4089 +# SUBTRACT LINK32 /pdb:none /incremental:yes + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr /Yu"commonheaders.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/debug/plugins/dbx_3x.dll" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none /incremental:no + +!ENDIF + +# Begin Target + +# Name "db3x - Win32 Release" +# Name "db3x - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\commonheaders.c +# ADD CPP /Yc"commonheaders.h" +# End Source File +# Begin Source File + +SOURCE=.\database.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dbcache.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dbcontacts.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dbevents.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dbheaders.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dbmodulechain.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dbsettings.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\encrypt.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\init.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +# ADD CPP /Yu"commonheaders.h" + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +!ENDIF + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\commonheaders.h +# End Source File +# Begin Source File + +SOURCE=.\database.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\resource.rc +# End Source File +# End Group +# End Target +# End Project diff --git a/clist_classic_sje/db3x.dsw b/clist_classic_sje/db3x.dsw new file mode 100644 index 0000000..0f90f8d --- /dev/null +++ b/clist_classic_sje/db3x.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "db3x"=.\db3x.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/clist_classic_sje/db3x.mak b/clist_classic_sje/db3x.mak new file mode 100644 index 0000000..faade4a --- /dev/null +++ b/clist_classic_sje/db3x.mak @@ -0,0 +1,471 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on db3x.dsp +!IF "$(CFG)" == "" +CFG=db3x - Win32 Debug +!MESSAGE No configuration specified. Defaulting to db3x - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "db3x - Win32 Release" && "$(CFG)" != "db3x - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "db3x.mak" CFG="db3x - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db3x - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "db3x - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db3x - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "..\..\bin\release\plugins\dbx_3x.dll" + + +CLEAN : + -@erase "$(INTDIR)\commonheaders.obj" + -@erase "$(INTDIR)\database.obj" + -@erase "$(INTDIR)\db3x.pch" + -@erase "$(INTDIR)\dbcache.obj" + -@erase "$(INTDIR)\dbcontacts.obj" + -@erase "$(INTDIR)\dbevents.obj" + -@erase "$(INTDIR)\dbheaders.obj" + -@erase "$(INTDIR)\dbmodulechain.obj" + -@erase "$(INTDIR)\dbsettings.obj" + -@erase "$(INTDIR)\encrypt.obj" + -@erase "$(INTDIR)\init.obj" + -@erase "$(INTDIR)\resource.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\dbx_3x.exp" + -@erase "$(OUTDIR)\dbx_3x.lib" + -@erase "$(OUTDIR)\dbx_3x.map" + -@erase "$(OUTDIR)\dbx_3x.pdb" + -@erase "..\..\bin\release\plugins\dbx_3x.dll" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\resource.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\db3x.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x5130000" /dll /incremental:no /pdb:"$(OUTDIR)\dbx_3x.pdb" /map:"$(INTDIR)\dbx_3x.map" /debug /machine:I386 /out:"../../bin/release/plugins/dbx_3x.dll" /implib:"$(OUTDIR)\dbx_3x.lib" /IGNORE:4089 +LINK32_OBJS= \ + "$(INTDIR)\commonheaders.obj" \ + "$(INTDIR)\database.obj" \ + "$(INTDIR)\dbcache.obj" \ + "$(INTDIR)\dbcontacts.obj" \ + "$(INTDIR)\dbevents.obj" \ + "$(INTDIR)\dbheaders.obj" \ + "$(INTDIR)\dbmodulechain.obj" \ + "$(INTDIR)\dbsettings.obj" \ + "$(INTDIR)\encrypt.obj" \ + "$(INTDIR)\init.obj" \ + "$(INTDIR)\resource.res" + +"..\..\bin\release\plugins\dbx_3x.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "..\..\bin\debug\plugins\dbx_3x.dll" "$(OUTDIR)\db3x.bsc" + + +CLEAN : + -@erase "$(INTDIR)\commonheaders.obj" + -@erase "$(INTDIR)\commonheaders.sbr" + -@erase "$(INTDIR)\database.obj" + -@erase "$(INTDIR)\database.sbr" + -@erase "$(INTDIR)\db3x.pch" + -@erase "$(INTDIR)\dbcache.obj" + -@erase "$(INTDIR)\dbcache.sbr" + -@erase "$(INTDIR)\dbcontacts.obj" + -@erase "$(INTDIR)\dbcontacts.sbr" + -@erase "$(INTDIR)\dbevents.obj" + -@erase "$(INTDIR)\dbevents.sbr" + -@erase "$(INTDIR)\dbheaders.obj" + -@erase "$(INTDIR)\dbheaders.sbr" + -@erase "$(INTDIR)\dbmodulechain.obj" + -@erase "$(INTDIR)\dbmodulechain.sbr" + -@erase "$(INTDIR)\dbsettings.obj" + -@erase "$(INTDIR)\dbsettings.sbr" + -@erase "$(INTDIR)\encrypt.obj" + -@erase "$(INTDIR)\encrypt.sbr" + -@erase "$(INTDIR)\init.obj" + -@erase "$(INTDIR)\init.sbr" + -@erase "$(INTDIR)\resource.res" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\db3x.bsc" + -@erase "$(OUTDIR)\dbx_3x.exp" + -@erase "$(OUTDIR)\dbx_3x.lib" + -@erase "$(OUTDIR)\dbx_3x.map" + -@erase "$(OUTDIR)\dbx_3x.pdb" + -@erase "..\..\bin\debug\plugins\dbx_3x.dll" + -@erase "..\..\bin\debug\plugins\dbx_3x.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\resource.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\db3x.bsc" +BSC32_SBRS= \ + "$(INTDIR)\commonheaders.sbr" \ + "$(INTDIR)\database.sbr" \ + "$(INTDIR)\dbcache.sbr" \ + "$(INTDIR)\dbcontacts.sbr" \ + "$(INTDIR)\dbevents.sbr" \ + "$(INTDIR)\dbheaders.sbr" \ + "$(INTDIR)\dbmodulechain.sbr" \ + "$(INTDIR)\dbsettings.sbr" \ + "$(INTDIR)\encrypt.sbr" \ + "$(INTDIR)\init.sbr" + +"$(OUTDIR)\db3x.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\dbx_3x.pdb" /map:"$(INTDIR)\dbx_3x.map" /debug /machine:I386 /out:"../../bin/debug/plugins/dbx_3x.dll" /implib:"$(OUTDIR)\dbx_3x.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\commonheaders.obj" \ + "$(INTDIR)\database.obj" \ + "$(INTDIR)\dbcache.obj" \ + "$(INTDIR)\dbcontacts.obj" \ + "$(INTDIR)\dbevents.obj" \ + "$(INTDIR)\dbheaders.obj" \ + "$(INTDIR)\dbmodulechain.obj" \ + "$(INTDIR)\dbsettings.obj" \ + "$(INTDIR)\encrypt.obj" \ + "$(INTDIR)\init.obj" \ + "$(INTDIR)\resource.res" + +"..\..\bin\debug\plugins\dbx_3x.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("db3x.dep") +!INCLUDE "db3x.dep" +!ELSE +!MESSAGE Warning: cannot find "db3x.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "db3x - Win32 Release" || "$(CFG)" == "db3x - Win32 Debug" +SOURCE=.\commonheaders.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yc"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\commonheaders.obj" "$(INTDIR)\db3x.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yc"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\commonheaders.obj" "$(INTDIR)\commonheaders.sbr" "$(INTDIR)\db3x.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\database.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\database.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\database.obj" "$(INTDIR)\database.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\dbcache.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\dbcache.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\dbcache.obj" "$(INTDIR)\dbcache.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\dbcontacts.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\dbcontacts.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\dbcontacts.obj" "$(INTDIR)\dbcontacts.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\dbevents.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\dbevents.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\dbevents.obj" "$(INTDIR)\dbevents.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\dbheaders.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\dbheaders.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\dbheaders.obj" "$(INTDIR)\dbheaders.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\dbmodulechain.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\dbmodulechain.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\dbmodulechain.obj" "$(INTDIR)\dbmodulechain.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\dbsettings.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\dbsettings.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\dbsettings.obj" "$(INTDIR)\dbsettings.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\encrypt.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\encrypt.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\encrypt.obj" "$(INTDIR)\encrypt.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\init.c + +!IF "$(CFG)" == "db3x - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\init.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "db3x - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB3X_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\db3x.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\init.obj" "$(INTDIR)\init.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\db3x.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\resource.rc + +"$(INTDIR)\resource.res" : $(SOURCE) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + + +!ENDIF + diff --git a/clist_classic_sje/db3x.vcproj b/clist_classic_sje/db3x.vcproj new file mode 100644 index 0000000..65bf2b5 --- /dev/null +++ b/clist_classic_sje/db3x.vcproj @@ -0,0 +1,795 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clist_classic_sje/db3x_8.sln b/clist_classic_sje/db3x_8.sln new file mode 100644 index 0000000..a033a41 --- /dev/null +++ b/clist_classic_sje/db3x_8.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "db3x", "db3x_8.vcproj", "{8B778B6A-F5EF-49A4-8437-424832F2B280}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release (RECLAIM)|Win32 = Release (RECLAIM)|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8B778B6A-F5EF-49A4-8437-424832F2B280}.Debug|Win32.ActiveCfg = Release|Win32 + {8B778B6A-F5EF-49A4-8437-424832F2B280}.Debug|Win32.Build.0 = Release|Win32 + {8B778B6A-F5EF-49A4-8437-424832F2B280}.Release (RECLAIM)|Win32.ActiveCfg = Release (RECLAIM)|Win32 + {8B778B6A-F5EF-49A4-8437-424832F2B280}.Release (RECLAIM)|Win32.Build.0 = Release (RECLAIM)|Win32 + {8B778B6A-F5EF-49A4-8437-424832F2B280}.Release|Win32.ActiveCfg = Release|Win32 + {8B778B6A-F5EF-49A4-8437-424832F2B280}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/clist_classic_sje/db3x_8.vcproj b/clist_classic_sje/db3x_8.vcproj new file mode 100644 index 0000000..e5cfbba --- /dev/null +++ b/clist_classic_sje/db3x_8.vcproj @@ -0,0 +1,811 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clist_classic_sje/dbcache.c b/clist_classic_sje/dbcache.c new file mode 100644 index 0000000..dd3bc5a --- /dev/null +++ b/clist_classic_sje/dbcache.c @@ -0,0 +1,229 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "database.h" + + +#define CACHESECTIONSIZE 4096 +#define CACHESECTIONCOUNT 32 + +extern HANDLE hDbFile; +extern CRITICAL_SECTION csDbAccess; + +static BOOL safetyMode=TRUE; +static PBYTE pDbCache; +static DWORD lastUseCounter; +struct DBCacheSectionInfo { + DWORD ofsBase; + DWORD lastUsed; +} static cacheSectionInfo[CACHESECTIONCOUNT]; + +static __inline int FindSectionForOffset(const DWORD ofs) +{ + int i; + for(i=0;i=cacheSectionInfo[i].ofsBase && ofs=cacheSectionInfo[i].ofsBase && ofs=cacheSectionInfo[i].ofsBase+CACHESECTIONSIZE) //don't finish at end + CopyMemory(pDbCache+i*CACHESECTIONSIZE,(PBYTE)pData+cacheSectionInfo[i].ofsBase-ofs,CACHESECTIONSIZE); + else CopyMemory(pDbCache+i*CACHESECTIONSIZE,(PBYTE)pData+cacheSectionInfo[i].ofsBase-ofs,bytes-(cacheSectionInfo[i].ofsBase-ofs)); + } + else { //start at beginning + if(ofs+bytes>=cacheSectionInfo[i].ofsBase+CACHESECTIONSIZE) //don't finish at end + CopyMemory(pDbCache+i*CACHESECTIONSIZE+ofs-cacheSectionInfo[i].ofsBase,pData,cacheSectionInfo[i].ofsBase+CACHESECTIONSIZE-ofs); + else CopyMemory(pDbCache+i*CACHESECTIONSIZE+ofs-cacheSectionInfo[i].ofsBase,pData,bytes); + } + } + } +} + +void DBMoveChunk(DWORD ofsDest,DWORD ofsSource,int bytes) +{ + DWORD bytesRead; + PBYTE buf; + + log3("move %d %08x->%08x",bytes,ofsSource,ofsDest); + buf=(PBYTE)mir_alloc(bytes); + SetFilePointer(hDbFile,ofsSource,NULL,FILE_BEGIN); + ReadFile(hDbFile,buf,bytes,&bytesRead,NULL); + DBWrite(ofsDest,buf,bytes); + mir_free(buf); + logg(); +} + +static int flushBuffersTimerId; +static VOID CALLBACK DoBufferFlushTimerProc(HWND hwnd,UINT message,UINT idEvent,DWORD dwTime) +{ + KillTimer(NULL,flushBuffersTimerId); + log0("tflush1"); + FlushFileBuffers(hDbFile); + log0("tflush2"); +} + +void DBFlush(int setting) +{ + if(!setting) { + log0("nflush1"); + if(safetyMode) FlushFileBuffers(hDbFile); + log0("nflush2"); + return; + } + KillTimer(NULL,flushBuffersTimerId); + flushBuffersTimerId=SetTimer(NULL,flushBuffersTimerId,50,DoBufferFlushTimerProc); +} + +static int CacheSetSafetyMode(WPARAM wParam,LPARAM lParam) +{ + EnterCriticalSection(&csDbAccess); + safetyMode=wParam; + LeaveCriticalSection(&csDbAccess); + if(safetyMode) FlushFileBuffers(hDbFile); + return 0; +} + +int InitCache(void) +{ + int i; + DWORD bytesRead; + + CreateServiceFunction(MS_DB_SETSAFETYMODE,CacheSetSafetyMode); + pDbCache=(PBYTE)mir_alloc(CACHESECTIONSIZE*CACHESECTIONCOUNT); + lastUseCounter=CACHESECTIONCOUNT; + for(i=0;ihNext != NULL ) { + LeaveCriticalSection(&csDbAccess); + return (int)VL->hNext; + } } } + + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbc->signature!=DBCONTACT_SIGNATURE) + ret=(int)(HANDLE)NULL; + else { + if ( VL == NULL ) { + VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList)); + VL->hContact = (HANDLE)wParam; + li.List_Insert(&lContacts,VL,index); + } + VL->hNext = (HANDLE)dbc->ofsNext; + ret=(int)(HANDLE)dbc->ofsNext; + } + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int DeleteContact(WPARAM wParam,LPARAM lParam) +{ + struct DBContact *dbc,*dbcPrev; + DWORD ofsThis,ofsNext,ofsFirstEvent; + struct DBContactSettings *dbcs; + struct DBEvent *dbe; + int index; + + if((HANDLE)wParam==NULL) return 1; + EnterCriticalSection(&csDbAccess); + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbc->signature!=DBCONTACT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + if ( (HANDLE)wParam == (HANDLE)dbHeader.ofsUser ) { + LeaveCriticalSection(&csDbAccess); + log0("FATAL: del of user chain attempted."); + return 1; + } + log0("del contact"); + LeaveCriticalSection(&csDbAccess); + //call notifier while outside mutex + NotifyEventHooks(hContactDeletedEvent,wParam,0); + //get back in + EnterCriticalSection(&csDbAccess); + + { DBCachedContactValueList VLtemp; + VLtemp.hContact = (HANDLE)wParam; + if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) + { + DBCachedContactValueList *VL = ( DBCachedContactValueList* )lContacts.items[index]; + DBCachedContactValue* V = VL->first; + while ( V != NULL ) { + DBCachedContactValue* V1 = V->next; + if ( V->value.type == DBVT_ASCIIZ ) + HeapFree( hCacheHeap, HEAP_NO_SERIALIZE, V->value.pszVal ); + HeapFree( hCacheHeap, HEAP_NO_SERIALIZE, V ); + V = V1; + } + HeapFree( hCacheHeap, HEAP_NO_SERIALIZE, VL ); + + li.List_Remove(&lContacts,index); + } } + + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + //delete settings chain + ofsThis=dbc->ofsFirstSettings; + ofsFirstEvent=dbc->ofsFirstEvent; + while(ofsThis) { + dbcs=(struct DBContactSettings*)DBRead(ofsThis,sizeof(struct DBContactSettings),NULL); + ofsNext=dbcs->ofsNext; + DeleteSpace(ofsThis,offsetof(struct DBContactSettings,blob)+dbcs->cbBlob); + ofsThis=ofsNext; + } + //delete event chain + ofsThis=ofsFirstEvent; + while(ofsThis) { + dbe=(struct DBEvent*)DBRead(ofsThis,sizeof(struct DBEvent),NULL); + ofsNext=dbe->ofsNext; + DeleteSpace(ofsThis,offsetof(struct DBEvent,blob)+dbe->cbBlob); + ofsThis=ofsNext; + } + //find previous contact in chain and change ofsNext + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbHeader.ofsFirstContact==wParam) { + dbHeader.ofsFirstContact=dbc->ofsNext; + DBWrite(0,&dbHeader,sizeof(dbHeader)); + } + else { + ofsNext=dbc->ofsNext; + ofsThis=dbHeader.ofsFirstContact; + dbcPrev=(struct DBContact*)DBRead(ofsThis,sizeof(struct DBContact),NULL); + while(dbcPrev->ofsNext!=wParam) { + if(dbcPrev->ofsNext==0) DatabaseCorruption(); + ofsThis=dbcPrev->ofsNext; + dbcPrev=(struct DBContact*)DBRead(ofsThis,sizeof(struct DBContact),NULL); + } + dbcPrev->ofsNext=ofsNext; + DBWrite(ofsThis,dbcPrev,sizeof(struct DBContact)); + { + DBCachedContactValueList VLtemp; + VLtemp.hContact = (HANDLE)ofsThis; + if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) + { + DBCachedContactValueList *VL = ( DBCachedContactValueList* )lContacts.items[index]; + VL->hNext = ( HANDLE )ofsNext; + } } + } + //delete contact + DeleteSpace(wParam,sizeof(struct DBContact)); + //decrement contact count + dbHeader.contactCount--; + DBWrite(0,&dbHeader,sizeof(dbHeader)); + DBFlush(0); + //quit + LeaveCriticalSection(&csDbAccess); + return 0; +} + +static int AddContact(WPARAM wParam,LPARAM lParam) +{ + struct DBContact dbc; + DWORD ofsNew; + + log0("add contact"); + EnterCriticalSection(&csDbAccess); + ofsNew=CreateNewSpace(sizeof(struct DBContact)); + dbc.signature=DBCONTACT_SIGNATURE; + dbc.eventCount=0; + dbc.ofsFirstEvent=dbc.ofsLastEvent=0; + dbc.ofsFirstSettings=0; + dbc.ofsNext=dbHeader.ofsFirstContact; + dbc.ofsFirstUnreadEvent=0; + dbc.timestampFirstUnread=0; + dbHeader.ofsFirstContact=ofsNew; + dbHeader.contactCount++; + DBWrite(ofsNew,&dbc,sizeof(struct DBContact)); + DBWrite(0,&dbHeader,sizeof(dbHeader)); + DBFlush(0); + + { int index; + + DBCachedContactValueList *VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList)); + VL->hContact = (HANDLE)ofsNew; + + li.List_GetIndex(&lContacts,VL,&index); + li.List_Insert(&lContacts,VL,index); + } + + LeaveCriticalSection(&csDbAccess); + NotifyEventHooks(hContactAddedEvent,(WPARAM)ofsNew,0); + return (int)ofsNew; +} + +static int IsDbContact(WPARAM wParam,LPARAM lParam) +{ + struct DBContact dbc; + DWORD ofsContact=(DWORD)wParam; + int ret; + + EnterCriticalSection(&csDbAccess); + { + int index; + DBCachedContactValueList VLtemp,*VL; + VLtemp.hContact = (HANDLE)wParam; + if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) + ret = TRUE; + else { + dbc=*(struct DBContact*)DBRead(ofsContact,sizeof(struct DBContact),NULL); + ret=dbc.signature==DBCONTACT_SIGNATURE; + + if (ret) { + VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList)); + VL->hContact = (HANDLE)wParam; + li.List_Insert(&lContacts,VL,index); + } } } + + LeaveCriticalSection(&csDbAccess); + return ret; +} diff --git a/clist_classic_sje/dbevents.c b/clist_classic_sje/dbevents.c new file mode 100644 index 0000000..e0f7c02 --- /dev/null +++ b/clist_classic_sje/dbevents.c @@ -0,0 +1,440 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "database.h" + + +DWORD GetModuleNameOfs(const char *szName); +char *GetModuleNameByOfs(DWORD ofs); + +static int GetEventCount(WPARAM wParam,LPARAM lParam); +static int AddEvent(WPARAM wParam,LPARAM lParam); +static int DeleteEvent(WPARAM wParam,LPARAM lParam); +static int GetBlobSize(WPARAM wParam,LPARAM lParam); +static int GetEvent(WPARAM wParam,LPARAM lParam); +static int MarkEventRead(WPARAM wParam,LPARAM lParam); +static int GetEventContact(WPARAM wParam,LPARAM lParam); +static int FindFirstEvent(WPARAM wParam,LPARAM lParam); +static int FindFirstUnreadEvent(WPARAM wParam,LPARAM lParam); +static int FindLastEvent(WPARAM wParam,LPARAM lParam); +static int FindNextEvent(WPARAM wParam,LPARAM lParam); +static int FindPrevEvent(WPARAM wParam,LPARAM lParam); + +extern CRITICAL_SECTION csDbAccess; +extern struct DBHeader dbHeader; + +static HANDLE hEventDeletedEvent,hEventAddedEvent,hEventFilterAddedEvent; + +int InitEvents(void) +{ + CreateServiceFunction(MS_DB_EVENT_GETCOUNT,GetEventCount); + CreateServiceFunction(MS_DB_EVENT_ADD,AddEvent); + CreateServiceFunction(MS_DB_EVENT_DELETE,DeleteEvent); + CreateServiceFunction(MS_DB_EVENT_GETBLOBSIZE,GetBlobSize); + CreateServiceFunction(MS_DB_EVENT_GET,GetEvent); + CreateServiceFunction(MS_DB_EVENT_MARKREAD,MarkEventRead); + CreateServiceFunction(MS_DB_EVENT_GETCONTACT,GetEventContact); + CreateServiceFunction(MS_DB_EVENT_FINDFIRST,FindFirstEvent); + CreateServiceFunction(MS_DB_EVENT_FINDFIRSTUNREAD,FindFirstUnreadEvent); + CreateServiceFunction(MS_DB_EVENT_FINDLAST,FindLastEvent); + CreateServiceFunction(MS_DB_EVENT_FINDNEXT,FindNextEvent); + CreateServiceFunction(MS_DB_EVENT_FINDPREV,FindPrevEvent); + hEventDeletedEvent=CreateHookableEvent(ME_DB_EVENT_DELETED); + hEventAddedEvent=CreateHookableEvent(ME_DB_EVENT_ADDED); + hEventFilterAddedEvent=CreateHookableEvent(ME_DB_EVENT_FILTER_ADD); + return 0; +} + +void UninitEvents(void) +{ +} + +static int GetEventCount(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBContact *dbc; + + EnterCriticalSection(&csDbAccess); + if(wParam==0) wParam=dbHeader.ofsUser; + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbc->signature!=DBCONTACT_SIGNATURE) ret=-1; + else ret=dbc->eventCount; + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int AddEvent(WPARAM wParam,LPARAM lParam) +{ + DBEVENTINFO *dbei=(DBEVENTINFO*)lParam; + struct DBContact dbc; + struct DBEvent dbe,*dbeTest; + DWORD ofsNew,ofsModuleName,ofsContact,ofsThis; + + if(dbei==NULL||dbei->cbSize!=sizeof(DBEVENTINFO)) return (int)NULL; + if(dbei->timestamp==0) return (int)NULL; + if (NotifyEventHooks(hEventFilterAddedEvent,wParam,lParam)) { + return (int)NULL; + } + EnterCriticalSection(&csDbAccess); + if(wParam==0) ofsContact=dbHeader.ofsUser; + else ofsContact=wParam; + dbc=*(struct DBContact*)DBRead(ofsContact,sizeof(struct DBContact),NULL); + if(dbc.signature!=DBCONTACT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return (int)NULL; + } + ofsNew=CreateNewSpace(offsetof(struct DBEvent,blob)+dbei->cbBlob); + ofsModuleName=GetModuleNameOfs(dbei->szModule); + + dbe.signature=DBEVENT_SIGNATURE; + dbe.ofsModuleName=ofsModuleName; + dbe.timestamp=dbei->timestamp; + dbe.flags=dbei->flags; + dbe.eventType=dbei->eventType; + dbe.cbBlob=dbei->cbBlob; + //find where to put it - sort by timestamp + if(dbc.eventCount==0) { + dbe.ofsPrev=wParam; + dbe.ofsNext=0; + dbe.flags|=DBEF_FIRST; + dbc.ofsFirstEvent=dbc.ofsLastEvent=ofsNew; + } + else { + dbeTest=(struct DBEvent*)DBRead(dbc.ofsFirstEvent,sizeof(struct DBEvent),NULL); + // Should new event be placed before first event in chain? + if (dbei->timestamp < dbeTest->timestamp) { + dbe.ofsPrev=wParam; + dbe.ofsNext=dbc.ofsFirstEvent; + dbe.flags|=DBEF_FIRST; + dbc.ofsFirstEvent=ofsNew; + dbeTest=(struct DBEvent*)DBRead(dbe.ofsNext,sizeof(struct DBEvent),NULL); + dbeTest->flags&=~DBEF_FIRST; + dbeTest->ofsPrev=ofsNew; + DBWrite(dbe.ofsNext,dbeTest,sizeof(struct DBEvent)); + } + else { + // Loop through the chain, starting at the end + ofsThis = dbc.ofsLastEvent; + dbeTest = (struct DBEvent*)DBRead(ofsThis, sizeof(struct DBEvent), NULL); + for(;;) { + // If the new event's timesstamp is equal to or greater than the + // current dbevent, it will be inserted after. If not, continue + // with the previous dbevent in chain. + if (dbe.timestamp >= dbeTest->timestamp) { + dbe.ofsPrev = ofsThis; + dbe.ofsNext = dbeTest->ofsNext; + dbeTest->ofsNext = ofsNew; + DBWrite(ofsThis, dbeTest, sizeof(struct DBEvent)); + if (dbe.ofsNext == 0) + dbc.ofsLastEvent = ofsNew; + else { + dbeTest = (struct DBEvent*)DBRead(dbe.ofsNext, sizeof(struct DBEvent), NULL); + dbeTest->ofsPrev = ofsNew; + DBWrite(dbe.ofsNext, dbeTest, sizeof(struct DBEvent)); + } + break; + } + ofsThis = dbeTest->ofsPrev; + dbeTest = (struct DBEvent*)DBRead(ofsThis, sizeof(struct DBEvent), NULL); + } + } + } + dbc.eventCount++; + if(!(dbe.flags&(DBEF_READ|DBEF_SENT))) { + if(dbe.timestamppBlob,dbei->cbBlob); + DBFlush(0); + LeaveCriticalSection(&csDbAccess); + log1("add event @ %08x",ofsNew); + NotifyEventHooks(hEventAddedEvent,wParam,(LPARAM)ofsNew); + return (int)ofsNew; +} + +static int DeleteEvent(WPARAM wParam,LPARAM lParam) +{ + struct DBContact dbc; + DWORD ofsContact,ofsThis; + struct DBEvent dbe,*dbeNext,*dbePrev; + + EnterCriticalSection(&csDbAccess); + if(wParam==0) ofsContact=dbHeader.ofsUser; + else ofsContact=wParam; + dbc=*(struct DBContact*)DBRead(ofsContact,sizeof(struct DBContact),NULL); + dbe=*(struct DBEvent*)DBRead(lParam,sizeof(struct DBEvent),NULL); + if(dbc.signature!=DBCONTACT_SIGNATURE || dbe.signature!=DBEVENT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + log1("delete event @ %08x",wParam); + LeaveCriticalSection(&csDbAccess); + //call notifier while outside mutex + NotifyEventHooks(hEventDeletedEvent,wParam,lParam); + //get back in + EnterCriticalSection(&csDbAccess); + dbc=*(struct DBContact*)DBRead(ofsContact,sizeof(struct DBContact),NULL); + dbe=*(struct DBEvent*)DBRead(lParam,sizeof(struct DBEvent),NULL); + //check if this was the first unread, if so, recalc the first unread + if(dbc.ofsFirstUnreadEvent==(DWORD)lParam) { + dbeNext=&dbe; + for(;;) { + if(dbeNext->ofsNext==0) { + dbc.ofsFirstUnreadEvent=0; + dbc.timestampFirstUnread=0; + break; + } + ofsThis=dbeNext->ofsNext; + dbeNext=(struct DBEvent*)DBRead(ofsThis,sizeof(struct DBEvent),NULL); + if(!(dbeNext->flags&(DBEF_READ|DBEF_SENT))) { + dbc.ofsFirstUnreadEvent=ofsThis; + dbc.timestampFirstUnread=dbeNext->timestamp; + break; + } + } + } + //get previous and next events in chain and change offsets + if(dbe.flags&DBEF_FIRST) { + if(dbe.ofsNext==0) { + dbc.ofsFirstEvent=dbc.ofsLastEvent=0; + } + else { + dbeNext=(struct DBEvent*)DBRead(dbe.ofsNext,sizeof(struct DBEvent),NULL); + dbeNext->flags|=DBEF_FIRST; + dbeNext->ofsPrev=dbe.ofsPrev; + DBWrite(dbe.ofsNext,dbeNext,sizeof(struct DBEvent)); + dbc.ofsFirstEvent=dbe.ofsNext; + } + } + else { + if(dbe.ofsNext==0) { + dbePrev=(struct DBEvent*)DBRead(dbe.ofsPrev,sizeof(struct DBEvent),NULL); + dbePrev->ofsNext=0; + DBWrite(dbe.ofsPrev,dbePrev,sizeof(struct DBEvent)); + dbc.ofsLastEvent=dbe.ofsPrev; + } + else { + dbePrev=(struct DBEvent*)DBRead(dbe.ofsPrev,sizeof(struct DBEvent),NULL); + dbePrev->ofsNext=dbe.ofsNext; + DBWrite(dbe.ofsPrev,dbePrev,sizeof(struct DBEvent)); + dbeNext=(struct DBEvent*)DBRead(dbe.ofsNext,sizeof(struct DBEvent),NULL); + dbeNext->ofsPrev=dbe.ofsPrev; + DBWrite(dbe.ofsNext,dbeNext,sizeof(struct DBEvent)); + } + } + //delete event + DeleteSpace(lParam,offsetof(struct DBEvent,blob)+dbe.cbBlob); + //decrement event count + dbc.eventCount--; + DBWrite(ofsContact,&dbc,sizeof(struct DBContact)); + DBFlush(0); + //quit + LeaveCriticalSection(&csDbAccess); + return 0; +} + +static int GetBlobSize(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBEvent *dbe; + + EnterCriticalSection(&csDbAccess); + dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL); + if(dbe->signature!=DBEVENT_SIGNATURE) ret=-1; + else ret=dbe->cbBlob; + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int GetEvent(WPARAM wParam,LPARAM lParam) +{ + struct DBEvent *dbe; + DBEVENTINFO *dbei=(DBEVENTINFO*)lParam; + int bytesToCopy,i; + + if(dbei==NULL||dbei->cbSize!=sizeof(DBEVENTINFO)) return 1; + EnterCriticalSection(&csDbAccess); + dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL); + if(dbe->signature!=DBEVENT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + dbei->szModule=GetModuleNameByOfs(dbe->ofsModuleName); + dbei->timestamp=dbe->timestamp; + dbei->flags=dbe->flags; + dbei->eventType=dbe->eventType; + if(dbei->cbBlobcbBlob) bytesToCopy=dbei->cbBlob; + else bytesToCopy=dbe->cbBlob; + dbei->cbBlob=dbe->cbBlob; + if(dbei->pBlob == 0 && bytesToCopy > 0) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + for(i=0;;i+=MAXCACHEDREADSIZE) { + if(bytesToCopy-i<=MAXCACHEDREADSIZE) { + CopyMemory(dbei->pBlob+i,DBRead(wParam+offsetof(struct DBEvent,blob)+i,bytesToCopy-i,NULL),bytesToCopy-i); + break; + } + CopyMemory(dbei->pBlob+i,DBRead(wParam+offsetof(struct DBEvent,blob)+i,MAXCACHEDREADSIZE,NULL),MAXCACHEDREADSIZE); + } + LeaveCriticalSection(&csDbAccess); + return 0; +} + +static int MarkEventRead(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBEvent *dbe; + struct DBContact dbc; + DWORD ofsThis; + + EnterCriticalSection(&csDbAccess); + if(wParam==0) wParam=dbHeader.ofsUser; + dbc=*(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + dbe=(struct DBEvent*)DBRead(lParam,sizeof(struct DBEvent),NULL); + if(dbe->signature!=DBEVENT_SIGNATURE || dbc.signature!=DBCONTACT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return -1; + } + if(dbe->flags&DBEF_READ || dbe->flags&DBEF_SENT) { + ret=(int)dbe->flags; + LeaveCriticalSection(&csDbAccess); + return ret; + } + log1("mark read @ %08x",wParam); + dbe->flags|=DBEF_READ; + DBWrite(lParam,dbe,sizeof(struct DBEvent)); + ret=(int)dbe->flags; + if(dbc.ofsFirstUnreadEvent==(DWORD)lParam) { + for(;;) { + if(dbe->ofsNext==0) { + dbc.ofsFirstUnreadEvent=0; + dbc.timestampFirstUnread=0; + break; + } + ofsThis=dbe->ofsNext; + dbe=(struct DBEvent*)DBRead(ofsThis,sizeof(struct DBEvent),NULL); + if(!(dbe->flags&(DBEF_READ|DBEF_SENT))) { + dbc.ofsFirstUnreadEvent=ofsThis; + dbc.timestampFirstUnread=dbe->timestamp; + break; + } + } + } + DBWrite(wParam,&dbc,sizeof(struct DBContact)); + DBFlush(0); + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int GetEventContact(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBEvent *dbe; + + EnterCriticalSection(&csDbAccess); + dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL); + if(dbe->signature!=DBEVENT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return -1; + } + while(!(dbe->flags&DBEF_FIRST)) + dbe=(struct DBEvent*)DBRead(dbe->ofsPrev,sizeof(struct DBEvent),NULL); + ret=(int)(HANDLE)dbe->ofsPrev; + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int FindFirstEvent(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBContact *dbc; + + EnterCriticalSection(&csDbAccess); + if(wParam==0) wParam=dbHeader.ofsUser; + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbc->signature!=DBCONTACT_SIGNATURE) ret=(int)(HANDLE)NULL; + else ret=(int)dbc->ofsFirstEvent; + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int FindFirstUnreadEvent(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBContact *dbc; + + EnterCriticalSection(&csDbAccess); + if(wParam==0) wParam=dbHeader.ofsUser; + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbc->signature!=DBCONTACT_SIGNATURE) ret=(int)(HANDLE)NULL; + else ret=(int)dbc->ofsFirstUnreadEvent; + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int FindLastEvent(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBContact *dbc; + + EnterCriticalSection(&csDbAccess); + if(wParam==0) wParam=dbHeader.ofsUser; + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbc->signature!=DBCONTACT_SIGNATURE) ret=(int)(HANDLE)NULL; + else ret=(int)dbc->ofsLastEvent; + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int FindNextEvent(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBEvent *dbe; + + EnterCriticalSection(&csDbAccess); + dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL); + if(dbe->signature!=DBEVENT_SIGNATURE) ret=(int)(HANDLE)NULL; + else ret=(int)(HANDLE)dbe->ofsNext; + LeaveCriticalSection(&csDbAccess); + return ret; +} + +static int FindPrevEvent(WPARAM wParam,LPARAM lParam) +{ + int ret; + struct DBEvent *dbe; + + EnterCriticalSection(&csDbAccess); + dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL); + if(dbe->signature!=DBEVENT_SIGNATURE) ret=(int)(HANDLE)NULL; + else if(dbe->flags&DBEF_FIRST) ret=(int)(HANDLE)NULL; + else ret=(int)(HANDLE)dbe->ofsPrev; + LeaveCriticalSection(&csDbAccess); + return ret; +} diff --git a/clist_classic_sje/dbheaders.c b/clist_classic_sje/dbheaders.c new file mode 100644 index 0000000..da7cb6e --- /dev/null +++ b/clist_classic_sje/dbheaders.c @@ -0,0 +1,78 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "database.h" + +extern struct DBHeader dbHeader; +extern HANDLE hDbFile; + +struct DBSignature { + char name[15]; + BYTE eof; +}; +static struct DBSignature dbSignature={"Miranda ICQ DB",0x1A}; + +//the cache has not been loaded when these functions are used + +int CreateDbHeaders(HANDLE hFile) +{ + struct DBContact user; + DWORD bytesWritten; + + CopyMemory(dbHeader.signature,&dbSignature,sizeof(dbHeader.signature)); + dbHeader.version=DB_THIS_VERSION; + dbHeader.ofsFileEnd=sizeof(struct DBHeader); + dbHeader.slackSpace=0; + dbHeader.contactCount=0; + dbHeader.ofsFirstContact=0; + dbHeader.ofsFirstModuleName=0; + dbHeader.ofsUser=0; + //create user + dbHeader.ofsUser=dbHeader.ofsFileEnd; + dbHeader.ofsFileEnd+=sizeof(struct DBContact); + SetFilePointer(hFile,0,NULL,FILE_BEGIN); + WriteFile(hFile,&dbHeader,sizeof(dbHeader),&bytesWritten,NULL); + user.signature=DBCONTACT_SIGNATURE; + user.ofsNext=0; + user.ofsFirstSettings=0; + user.eventCount=0; + user.ofsFirstEvent=user.ofsLastEvent=0; + SetFilePointer(hFile,dbHeader.ofsUser,NULL,FILE_BEGIN); + WriteFile(hFile,&user,sizeof(struct DBContact),&bytesWritten,NULL); + FlushFileBuffers(hFile); + return 0; +} + +int CheckDbHeaders(struct DBHeader * hdr) +{ + if(memcmp(hdr->signature,&dbSignature,sizeof(hdr->signature))) return 1; + if(hdr->version!=DB_THIS_VERSION) return 2; + if(hdr->ofsUser==0) return 3; + return 0; +} + +int InitialiseDbHeaders(void) +{ + return 0; +} diff --git a/clist_classic_sje/dbmodulechain.c b/clist_classic_sje/dbmodulechain.c new file mode 100644 index 0000000..352a06c --- /dev/null +++ b/clist_classic_sje/dbmodulechain.c @@ -0,0 +1,132 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "database.h" + +extern struct DBHeader dbHeader; + +static int EnumModuleNames(WPARAM wParam,LPARAM lParam); + +struct ModuleName { + char *name; + DWORD hash; + DWORD ofs; +}; +static struct ModuleName *moduleName; +static int moduleNameCount; + +int InitModuleNames(void) +{ + struct DBModuleName *dbmn; + DWORD ofsThis,ofsNext; + int nameLen; + + moduleNameCount=0; + moduleName=NULL; + ofsThis=dbHeader.ofsFirstModuleName; + dbmn=(struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL); + while(ofsThis) { + if(dbmn->signature!=DBMODULENAME_SIGNATURE) DatabaseCorruption(); + moduleName=(struct ModuleName*)mir_realloc(moduleName,sizeof(struct ModuleName)*(moduleNameCount+1)); + moduleName[moduleNameCount].ofs=ofsThis; + moduleName[moduleNameCount].hash=dbmn->cbName; //very very simple hash so far + moduleName[moduleNameCount].name=(char*)mir_alloc(dbmn->cbName+1); + ofsNext=dbmn->ofsNext; + nameLen=dbmn->cbName; + CopyMemory(moduleName[moduleNameCount].name,DBRead(ofsThis+offsetof(struct DBModuleName,name),nameLen,NULL),nameLen); + moduleName[moduleNameCount].name[nameLen]=0; + moduleNameCount++; + ofsThis=ofsNext; + dbmn=(struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL); + } + CreateServiceFunction(MS_DB_MODULES_ENUM,EnumModuleNames); + return 0; +} + +void UninitModuleNames(void) +{ + int i; + for(i=0;iofsFirstSettings; + while(ofsThis) { + dbcs=(struct DBContactSettings*)DBRead(ofsThis,sizeof(struct DBContactSettings),NULL); + if(dbcs->signature!=DBCONTACTSETTINGS_SIGNATURE) DatabaseCorruption(); + if(dbcs->ofsModuleName==ofsModuleName) { + settingsGroupOfsCache[nextSGOCacheEntry].ofsContact=ofsContact; + settingsGroupOfsCache[nextSGOCacheEntry].ofsModuleName=ofsModuleName; + settingsGroupOfsCache[nextSGOCacheEntry].ofsSettingsGroup=ofsThis; + if(++nextSGOCacheEntry==SETTINGSGROUPOFSCOUNT) nextSGOCacheEntry=0; + return ofsThis; + } + ofsThis=dbcs->ofsNext; + } + return 0; +} + +static void InvalidateSettingsGroupOfsCacheEntry(DWORD ofsSettingsGroup) +{ + int i; + + for(i=0;itype == DBVT_UTF8 || d->type == DBVT_ASCIIZ ) ? d->pszVal : NULL; + + memcpy( d, s, sizeof( DBVARIANT )); + if (( s->type == DBVT_UTF8 || s->type == DBVT_ASCIIZ ) && s->pszVal != NULL ) { + if ( szSave != NULL ) + d->pszVal = (char*)HeapReAlloc(hCacheHeap,HEAP_NO_SERIALIZE,szSave,strlen(s->pszVal)+1); + else + d->pszVal = (char*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE,strlen(s->pszVal)+1); + strcpy(d->pszVal,s->pszVal); + } + + switch( d->type ) { + case DBVT_BYTE: log1( "set cached byte: %d", d->bVal ); break; + case DBVT_WORD: log1( "set cached word: %d", d->wVal ); break; + case DBVT_DWORD: log1( "set cached dword: %d", d->dVal ); break; + case DBVT_UTF8: + case DBVT_ASCIIZ: log1( "set cached string: '%s'", d->pszVal ); break; + default: log1( "set cached crap: %d", d->type ); break; +} } + +static void FreeCachedVariant( DBVARIANT* V ) +{ + if (( V->type == DBVT_ASCIIZ || V->type == DBVT_UTF8 ) && V->pszVal != NULL ) + HeapFree(hCacheHeap,HEAP_NO_SERIALIZE,V->pszVal); +} + +static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllocate ) +{ + int index; + + if ( hContact == 0 ) { + DBCachedGlobalValue Vtemp, *V; + Vtemp.name = szSetting; + if ( li.List_GetIndex(&lGlobalSettings,&Vtemp,&index)) { + V = (DBCachedGlobalValue*)lGlobalSettings.items[index]; + if ( bAllocate == -1 ) { + FreeCachedVariant( &V->value ); + li.List_Remove(&lGlobalSettings,index); + HeapFree(hCacheHeap,HEAP_NO_SERIALIZE,V); + return NULL; + } } + else { + if ( bAllocate != 1 ) + return NULL; + + V = (DBCachedGlobalValue*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedGlobalValue)); + V->name = szSetting; + li.List_Insert(&lGlobalSettings,V,index); + } + + return &V->value; + } + else { + DBCachedContactValue *V, *V1; + DBCachedContactValueList VLtemp,*VL; + + VLtemp.hContact=hContact; + if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) { + VL = (DBCachedContactValueList*)lContacts.items[index]; + } + else { + if ( bAllocate == -1 ) + return NULL; + + VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList)); + VL->hContact = hContact; + li.List_Insert(&lContacts,VL,index); + } + + for ( V = VL->first; V != NULL; V = V->next) + if (strcmp(V->name,szSetting)==0) + break; + + if ( V == NULL ) + { if ( bAllocate != 1 ) + return NULL; + + V = HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValue)); + V->next = VL->first; + VL->first = V; + V->name = szSetting; + } + else if ( bAllocate == -1 ) { + FreeCachedVariant(&V->value); + if ( VL->first == V ) + VL->first = V->next; + for ( V1=VL->first; V1 != NULL; V1 = V1->next ) + if ( V1->next == V ) { + V1->next = V->next; + break; + } + HeapFree(hCacheHeap,HEAP_NO_SERIALIZE,V); + return NULL; + } + + return &V->value; +} } + +#define NeedBytes(n) if(bytesRemaining<(n)) pBlob=(PBYTE)DBRead(ofsBlobPtr,(n),&bytesRemaining) +#define MoveAlong(n) {int x=n; pBlob+=(x); ofsBlobPtr+=(x); bytesRemaining-=(x);} +#define VLT(n) ((n==DBVT_UTF8)?DBVT_ASCIIZ:n) +static __inline int GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs,int isStatic) +{ + struct DBContact dbc; + struct DBContactSettings dbcs; + DWORD ofsModuleName,ofsContact,ofsSettingsGroup,ofsBlobPtr; + int settingNameLen; + int bytesRemaining; + PBYTE pBlob; + char* szCachedSettingName; + + if ((!dbcgs->szSetting) || (!dbcgs->szModule)) + return 1; + settingNameLen=strlen(dbcgs->szSetting); + + EnterCriticalSection(&csDbAccess); + + log3("get [%08p] %s/%s",hContact,dbcgs->szModule,dbcgs->szSetting); + + szCachedSettingName = GetCachedSetting(dbcgs->szModule,dbcgs->szSetting,settingNameLen); + { + DBVARIANT* pCachedValue = GetCachedValuePtr( hContact, szCachedSettingName, 0 ); + if ( pCachedValue != NULL ) { + if ( pCachedValue->type == DBVT_ASCIIZ || pCachedValue->type == DBVT_UTF8 ) { + int cbOrigLen = dbcgs->pValue->cchVal; + char* cbOrigPtr = dbcgs->pValue->pszVal; + memcpy( dbcgs->pValue, pCachedValue, sizeof( DBVARIANT )); + if ( isStatic ) { + int cbLen = 0; + if ( pCachedValue->pszVal != NULL ) + cbLen = strlen( pCachedValue->pszVal ); + + cbOrigLen--; + dbcgs->pValue->pszVal = cbOrigPtr; + if(cbLenpValue->pszVal,pCachedValue->pszVal,cbOrigLen); + dbcgs->pValue->pszVal[cbOrigLen]=0; + dbcgs->pValue->cchVal=cbLen; + } + else { + dbcgs->pValue->pszVal = (char*)mir_alloc(strlen(pCachedValue->pszVal)+1); + strcpy(dbcgs->pValue->pszVal,pCachedValue->pszVal); + } + } + else + memcpy( dbcgs->pValue, pCachedValue, sizeof( DBVARIANT )); + + switch( dbcgs->pValue->type ) { + case DBVT_BYTE: log1( "get cached byte: %d", dbcgs->pValue->bVal ); break; + case DBVT_WORD: log1( "get cached word: %d", dbcgs->pValue->wVal ); break; + case DBVT_DWORD: log1( "get cached dword: %d", dbcgs->pValue->dVal ); break; + case DBVT_UTF8: + case DBVT_ASCIIZ: log1( "get cached string: '%s'", dbcgs->pValue->pszVal); break; + default: log1( "get cached crap: %d", dbcgs->pValue->type ); break; + } + + LeaveCriticalSection(&csDbAccess); + return ( pCachedValue->type == DBVT_DELETED ) ? 1 : 0; + } } + + ofsModuleName=GetModuleNameOfs(dbcgs->szModule); + if(hContact==NULL) ofsContact=dbHeader.ofsUser; + else ofsContact=(DWORD)hContact; + dbc=*(struct DBContact*)DBRead(ofsContact,sizeof(struct DBContact),NULL); + if(dbc.signature!=DBCONTACT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + ofsSettingsGroup=GetSettingsGroupOfsByModuleNameOfs(&dbc,ofsContact,ofsModuleName); + if(ofsSettingsGroup) { + dbcs=*(struct DBContactSettings*)DBRead(ofsSettingsGroup,sizeof(struct DBContactSettings),&bytesRemaining); + ofsBlobPtr=ofsSettingsGroup+offsetof(struct DBContactSettings,blob); + pBlob=(PBYTE)DBRead(ofsBlobPtr,1,&bytesRemaining); + while(pBlob[0]) { + NeedBytes(1+settingNameLen); + if(pBlob[0]==settingNameLen && !memcmp(pBlob+1,dbcgs->szSetting,settingNameLen)) { + MoveAlong(1+settingNameLen); + NeedBytes(5); + if(isStatic && pBlob[0]&DBVTF_VARIABLELENGTH && VLT(dbcgs->pValue->type) != VLT(pBlob[0])) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + dbcgs->pValue->type=pBlob[0]; + switch(pBlob[0]) { + case DBVT_DELETED: { /* this setting is deleted */ + dbcgs->pValue->type=DBVT_DELETED; + LeaveCriticalSection(&csDbAccess); + return 2; + } + case DBVT_BYTE: dbcgs->pValue->bVal=pBlob[1]; break; + case DBVT_WORD: dbcgs->pValue->wVal=*(PWORD)(pBlob+1); break; + case DBVT_DWORD: dbcgs->pValue->dVal=*(PDWORD)(pBlob+1); break; + case DBVT_UTF8: + case DBVT_ASCIIZ: + NeedBytes(3+*(PWORD)(pBlob+1)); + if(isStatic) { + dbcgs->pValue->cchVal--; + if(*(PWORD)(pBlob+1)pValue->cchVal) dbcgs->pValue->cchVal=*(PWORD)(pBlob+1); + CopyMemory(dbcgs->pValue->pszVal,pBlob+3,dbcgs->pValue->cchVal); + dbcgs->pValue->pszVal[dbcgs->pValue->cchVal]=0; + dbcgs->pValue->cchVal=*(PWORD)(pBlob+1); + } + else { + dbcgs->pValue->pszVal=(char*)mir_alloc(1+*(PWORD)(pBlob+1)); + CopyMemory(dbcgs->pValue->pszVal,pBlob+3,*(PWORD)(pBlob+1)); + dbcgs->pValue->pszVal[*(PWORD)(pBlob+1)]=0; + } + break; + case DBVT_BLOB: + NeedBytes(3+*(PWORD)(pBlob+1)); + if(isStatic) { + if(*(PWORD)(pBlob+1)pValue->cpbVal) dbcgs->pValue->cpbVal=*(PWORD)(pBlob+1); + CopyMemory(dbcgs->pValue->pbVal,pBlob+3,dbcgs->pValue->cchVal); + } + else { + dbcgs->pValue->pbVal=(char*)mir_alloc(*(PWORD)(pBlob+1)); + CopyMemory(dbcgs->pValue->pbVal,pBlob+3,*(PWORD)(pBlob+1)); + } + dbcgs->pValue->cpbVal=*(PWORD)(pBlob+1); + break; + } + + /**** add to cache **********************/ + if ( dbcgs->pValue->type != DBVT_BLOB ) + { + DBVARIANT* pCachedValue = GetCachedValuePtr( hContact, szCachedSettingName, 1 ); + if ( pCachedValue != NULL ) + SetCachedVariant(dbcgs->pValue,pCachedValue); + } + + LeaveCriticalSection(&csDbAccess); + logg(); + return 0; + } + NeedBytes(1); + MoveAlong(pBlob[0]+1); + NeedBytes(3); + MoveAlong(1+GetSettingValueLength(pBlob)); + NeedBytes(1); + } } + + /**** add missing setting to cache **********************/ + if ( dbcgs->pValue->type != DBVT_BLOB ) + { + DBVARIANT* pCachedValue = GetCachedValuePtr( hContact, szCachedSettingName, 1 ); + if ( pCachedValue != NULL ) + pCachedValue->type = DBVT_DELETED; + } + + LeaveCriticalSection(&csDbAccess); + logg(); + return 1; +} + +static int GetContactSetting(WPARAM wParam,LPARAM lParam) +{ + DBCONTACTGETSETTING* dgs = ( DBCONTACTGETSETTING* )lParam; + dgs->pValue->type = 0; + if ( GetContactSettingWorker(( HANDLE )wParam, dgs, 0 )) + return 1; + + if ( dgs->pValue->type == DBVT_UTF8 ) { + mir_utf8decode( dgs->pValue->pszVal, NULL ); + dgs->pValue->type = DBVT_ASCIIZ; + } + + return 0; +} + +static int GetContactSettingStr(WPARAM wParam,LPARAM lParam) +{ + DBCONTACTGETSETTING* dgs = (DBCONTACTGETSETTING*)lParam; + int iSaveType = dgs->pValue->type; + + if ( GetContactSettingWorker(( HANDLE )wParam, dgs, 0 )) + return 1; + + if ( iSaveType == 0 || iSaveType == dgs->pValue->type ) + return 0; + + if ( dgs->pValue->type != DBVT_ASCIIZ && dgs->pValue->type != DBVT_UTF8 ) + return 0; + + if ( iSaveType == DBVT_WCHAR ) { + if ( dgs->pValue->type != DBVT_UTF8 ) { + int len = MultiByteToWideChar( CP_ACP, 0, dgs->pValue->pszVal, -1, NULL, 0 ); + wchar_t* wszResult = ( wchar_t* )mir_alloc(( len+1 )*sizeof( wchar_t )); + if ( wszResult == NULL ) + return 1; + + MultiByteToWideChar( CP_ACP, 0, dgs->pValue->pszVal, -1, wszResult, len ); + wszResult[ len ] = 0; + mir_free( dgs->pValue->pszVal ); + dgs->pValue->pwszVal = wszResult; + } + else { + char* savePtr = dgs->pValue->pszVal; + mir_utf8decode( dgs->pValue->pszVal, &dgs->pValue->pwszVal ); + mir_free( savePtr ); + } + } + else if ( iSaveType == DBVT_UTF8 ) { + char* tmpBuf = mir_utf8encode( dgs->pValue->pszVal ); + if ( tmpBuf == NULL ) + return 1; + + mir_free( dgs->pValue->pszVal ); + dgs->pValue->pszVal = tmpBuf; + } + else if ( iSaveType == DBVT_ASCIIZ ) + mir_utf8decode( dgs->pValue->pszVal, NULL ); + + dgs->pValue->type = iSaveType; + return 0; +} + +static int GetContactSettingStatic(WPARAM wParam,LPARAM lParam) +{ + DBCONTACTGETSETTING* dgs = (DBCONTACTGETSETTING*)lParam; + if ( GetContactSettingWorker(( HANDLE )wParam, dgs, 1 )) + return 1; + + if ( dgs->pValue->type == DBVT_UTF8 ) { + mir_utf8decode( dgs->pValue->pszVal, NULL ); + dgs->pValue->type = DBVT_ASCIIZ; + } + + return 0; +} + +static int FreeVariant(WPARAM wParam,LPARAM lParam) +{ + DBVARIANT *dbv=(DBVARIANT*)lParam; + if ( dbv == 0 ) return 1; + switch ( dbv->type ) { + case DBVT_ASCIIZ: + case DBVT_UTF8: + case DBVT_WCHAR: + { + if ( dbv->pszVal ) mir_free(dbv->pszVal); + dbv->pszVal=0; + break; + } + case DBVT_BLOB: + { + if ( dbv->pbVal ) mir_free(dbv->pbVal); + dbv->pbVal=0; + break; + } + } + dbv->type=0; + return 0; +} + +static int SetSettingResident(WPARAM wParam,LPARAM lParam) +{ + char* szSetting; + size_t cbSettingNameLen = strlen(( char* )lParam ); + int idx; + char* szTemp = ( char* )alloca( cbSettingNameLen+2 ); + strcpy( szTemp+1, ( char* )lParam ); + + EnterCriticalSection(&csDbAccess); + if ( !li.List_GetIndex( &lSettings, szTemp, &idx )) + szSetting = InsertCachedSetting( szTemp, cbSettingNameLen+2, idx ); + else + szSetting = lSettings.items[ idx ]; + + *szSetting = (char)wParam; + + LeaveCriticalSection(&csDbAccess); + return 0; +} + +static int WriteContactSetting(WPARAM wParam,LPARAM lParam) +{ + DBCONTACTWRITESETTING *dbcws=(DBCONTACTWRITESETTING*)lParam; + struct DBContact dbc; + DWORD ofsModuleName; + struct DBContactSettings dbcs; + PBYTE pBlob; + int settingNameLen=0; + int moduleNameLen=0; + int settingDataLen=0; + + int bytesRequired,bytesRemaining; + DWORD ofsContact,ofsSettingsGroup,ofsBlobPtr; + + if (dbcws == NULL) + return 1; + + if (dbcws->value.type == DBVT_WCHAR) { + if (dbcws->value.pszVal != NULL) { + char* val = mir_utf8encodeW(dbcws->value.pwszVal); + if ( val == NULL ) + return 1; + + dbcws->value.pszVal = ( char* )alloca( strlen( val )+1 ); + strcpy( dbcws->value.pszVal, val ); + mir_free(val); + dbcws->value.type = DBVT_UTF8; + } + else return 1; + } + + if(dbcws->value.type!=DBVT_BYTE && dbcws->value.type!=DBVT_WORD && dbcws->value.type!=DBVT_DWORD && dbcws->value.type!=DBVT_ASCIIZ && dbcws->value.type!=DBVT_UTF8 && dbcws->value.type!=DBVT_BLOB) + return 1; + if ((!dbcws->szModule) || (!dbcws->szSetting) || ((dbcws->value.type == DBVT_ASCIIZ || dbcws->value.type == DBVT_UTF8 )&& dbcws->value.pszVal == NULL) || (dbcws->value.type == DBVT_BLOB && dbcws->value.pbVal == NULL) ) + return 1; + // the db format can't tolerate more than 255 bytes of space (incl. null) for settings+module name + settingNameLen=strlen(dbcws->szSetting); + moduleNameLen=strlen(dbcws->szModule); + if ( settingNameLen > 0xFE ) + { + #ifdef _DEBUG + OutputDebugString("WriteContactSetting() got a > 255 setting name length. \n"); + #endif + return 1; + } + if ( moduleNameLen > 0xFE ) + { + #ifdef _DEBUG + OutputDebugString("WriteContactSetting() got a > 255 module name length. \n"); + #endif + return 1; + } + + // the db can not tolerate strings/blobs longer than 0xFFFF since the format writes 2 lengths + switch( dbcws->value.type ) { + case DBVT_ASCIIZ: case DBVT_BLOB: case DBVT_UTF8: + { int len = ( dbcws->value.type != DBVT_BLOB ) ? strlen(dbcws->value.pszVal) : dbcws->value.cpbVal; + if ( len >= 0xFFFF ) { + #ifdef _DEBUG + OutputDebugString("WriteContactSetting() writing huge string/blob, rejecting ( >= 0xFFFF ) \n"); + #endif + return 1; + } + } + } + + EnterCriticalSection(&csDbAccess); + { + char* szCachedSettingName = GetCachedSetting(dbcws->szModule, dbcws->szSetting, settingNameLen); + if ( dbcws->value.type != DBVT_BLOB ) { + DBVARIANT* pCachedValue = GetCachedValuePtr((HANDLE)wParam, szCachedSettingName, 1); + if ( pCachedValue != NULL ) { + BOOL bIsIdentical = FALSE; + if ( pCachedValue->type == dbcws->value.type ) { + switch(dbcws->value.type) { + case DBVT_BYTE: bIsIdentical = pCachedValue->bVal == dbcws->value.bVal; break; + case DBVT_WORD: bIsIdentical = pCachedValue->wVal == dbcws->value.wVal; break; + case DBVT_DWORD: bIsIdentical = pCachedValue->dVal == dbcws->value.dVal; break; + case DBVT_UTF8: + case DBVT_ASCIIZ: bIsIdentical = strcmp( pCachedValue->pszVal, dbcws->value.pszVal ) == 0; break; + } + if ( bIsIdentical ) { + LeaveCriticalSection(&csDbAccess); + return 0; + } + } + SetCachedVariant(&dbcws->value, pCachedValue); + } + if ( szCachedSettingName[-1] != 0 ) { + LeaveCriticalSection(&csDbAccess); + NotifyEventHooks(hSettingChangeEvent,wParam,lParam); + return 0; + } + } + else GetCachedValuePtr((HANDLE)wParam, szCachedSettingName, -1); + } + + ofsModuleName=GetModuleNameOfs(dbcws->szModule); + if(wParam==0) ofsContact=dbHeader.ofsUser; + else ofsContact=wParam; + + dbc=*(struct DBContact*)DBRead(ofsContact,sizeof(struct DBContact),NULL); + if(dbc.signature!=DBCONTACT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + log0("write setting"); + //make sure the module group exists + ofsSettingsGroup=GetSettingsGroupOfsByModuleNameOfs(&dbc,ofsContact,ofsModuleName); + if(ofsSettingsGroup==0) { //module group didn't exist - make it + if(dbcws->value.type&DBVTF_VARIABLELENGTH) { + if(dbcws->value.type==DBVT_ASCIIZ || dbcws->value.type==DBVT_UTF8) bytesRequired=strlen(dbcws->value.pszVal)+2; + else if(dbcws->value.type==DBVT_BLOB) bytesRequired=dbcws->value.cpbVal+2; + } + else bytesRequired=dbcws->value.type; + bytesRequired+=2+settingNameLen; + bytesRequired+=(DB_SETTINGS_RESIZE_GRANULARITY-(bytesRequired%DB_SETTINGS_RESIZE_GRANULARITY))%DB_SETTINGS_RESIZE_GRANULARITY; + ofsSettingsGroup=CreateNewSpace(bytesRequired+offsetof(struct DBContactSettings,blob)); + dbcs.signature=DBCONTACTSETTINGS_SIGNATURE; + dbcs.ofsNext=dbc.ofsFirstSettings; + dbcs.ofsModuleName=ofsModuleName; + dbcs.cbBlob=bytesRequired; + dbcs.blob[0]=0; + dbc.ofsFirstSettings=ofsSettingsGroup; + DBWrite(ofsContact,&dbc,sizeof(struct DBContact)); + DBWrite(ofsSettingsGroup,&dbcs,sizeof(struct DBContactSettings)); + ofsBlobPtr=ofsSettingsGroup+offsetof(struct DBContactSettings,blob); + pBlob=(PBYTE)DBRead(ofsBlobPtr,1,&bytesRemaining); + } + else { + dbcs=*(struct DBContactSettings*)DBRead(ofsSettingsGroup,sizeof(struct DBContactSettings),&bytesRemaining); + //find if the setting exists + ofsBlobPtr=ofsSettingsGroup+offsetof(struct DBContactSettings,blob); + pBlob=(PBYTE)DBRead(ofsBlobPtr,1,&bytesRemaining); + while(pBlob[0]) { + NeedBytes(settingNameLen+1); + if(pBlob[0]==settingNameLen && !memcmp(pBlob+1,dbcws->szSetting,settingNameLen)) + break; + NeedBytes(1); + MoveAlong(pBlob[0]+1); + NeedBytes(3); + MoveAlong(1+GetSettingValueLength(pBlob)); + NeedBytes(1); + } + if(pBlob[0]) { //setting already existed, and up to end of name is in cache + MoveAlong(1+settingNameLen); + //if different type or variable length and length is different + NeedBytes(3); + if(pBlob[0]!=dbcws->value.type || ((pBlob[0]==DBVT_ASCIIZ || pBlob[0]==DBVT_UTF8) && *(PWORD)(pBlob+1)!=strlen(dbcws->value.pszVal)) || (pBlob[0]==DBVT_BLOB && *(PWORD)(pBlob+1)!=dbcws->value.cpbVal)) { + //bin it + int nameLen,valLen; + DWORD ofsSettingToCut; + NeedBytes(3); + nameLen=1+settingNameLen; + valLen=1+GetSettingValueLength(pBlob); + ofsSettingToCut=ofsBlobPtr-nameLen; + MoveAlong(valLen); + NeedBytes(1); + while(pBlob[0]) { + MoveAlong(pBlob[0]+1); + NeedBytes(3); + MoveAlong(1+GetSettingValueLength(pBlob)); + NeedBytes(1); + } + DBMoveChunk(ofsSettingToCut,ofsSettingToCut+nameLen+valLen,ofsBlobPtr+1-ofsSettingToCut); + ofsBlobPtr-=nameLen+valLen; + pBlob=(PBYTE)DBRead(ofsBlobPtr,1,&bytesRemaining); + } + else { + //replace existing setting at pBlob + MoveAlong(1); //skip data type + switch(dbcws->value.type) { + case DBVT_BYTE: DBWrite(ofsBlobPtr,&dbcws->value.bVal,1); break; + case DBVT_WORD: DBWrite(ofsBlobPtr,&dbcws->value.wVal,2); break; + case DBVT_DWORD: DBWrite(ofsBlobPtr,&dbcws->value.dVal,4); break; + case DBVT_UTF8: + case DBVT_ASCIIZ: DBWrite(ofsBlobPtr+2,dbcws->value.pszVal,strlen(dbcws->value.pszVal)); break; + case DBVT_BLOB: DBWrite(ofsBlobPtr+2,dbcws->value.pbVal,dbcws->value.cpbVal); break; + } + //quit + DBFlush(1); + LeaveCriticalSection(&csDbAccess); + //notify + NotifyEventHooks(hSettingChangeEvent,wParam,lParam); + return 0; + } + } + } + //cannot do a simple replace, add setting to end of list + //pBlob already points to end of list + //see if it fits + if(dbcws->value.type&DBVTF_VARIABLELENGTH) { + if(dbcws->value.type==DBVT_ASCIIZ || dbcws->value.type==DBVT_UTF8) bytesRequired=strlen(dbcws->value.pszVal)+2; + else if(dbcws->value.type==DBVT_BLOB) bytesRequired=dbcws->value.cpbVal+2; + } + else bytesRequired=dbcws->value.type; + bytesRequired+=2+settingNameLen; + bytesRequired+=ofsBlobPtr+1-(ofsSettingsGroup+offsetof(struct DBContactSettings,blob)); + if((DWORD)bytesRequired>dbcs.cbBlob) { + //doesn't fit: move entire group + struct DBContactSettings *dbcsPrev; + DWORD ofsDbcsPrev,oldSize,ofsNew; + + InvalidateSettingsGroupOfsCacheEntry(ofsSettingsGroup); + bytesRequired+=(DB_SETTINGS_RESIZE_GRANULARITY-(bytesRequired%DB_SETTINGS_RESIZE_GRANULARITY))%DB_SETTINGS_RESIZE_GRANULARITY; + //find previous group to change its offset + ofsDbcsPrev=dbc.ofsFirstSettings; + if(ofsDbcsPrev==ofsSettingsGroup) ofsDbcsPrev=0; + else { + dbcsPrev=(struct DBContactSettings*)DBRead(ofsDbcsPrev,sizeof(struct DBContactSettings),NULL); + while(dbcsPrev->ofsNext!=ofsSettingsGroup) { + if(dbcsPrev->ofsNext==0) DatabaseCorruption(); + ofsDbcsPrev=dbcsPrev->ofsNext; + dbcsPrev=(struct DBContactSettings*)DBRead(ofsDbcsPrev,sizeof(struct DBContactSettings),NULL); + } + } + //create the new one + ofsNew=CreateNewSpace(bytesRequired+offsetof(struct DBContactSettings,blob)); + //copy across + DBMoveChunk(ofsNew,ofsSettingsGroup,bytesRequired+offsetof(struct DBContactSettings,blob)); + oldSize=dbcs.cbBlob; + dbcs.cbBlob=bytesRequired; + DBWrite(ofsNew,&dbcs,offsetof(struct DBContactSettings,blob)); + if(ofsDbcsPrev==0) { + dbc.ofsFirstSettings=ofsNew; + DBWrite(ofsContact,&dbc,sizeof(struct DBContact)); + } + else { + dbcsPrev=(struct DBContactSettings*)DBRead(ofsDbcsPrev,sizeof(struct DBContactSettings),NULL); + dbcsPrev->ofsNext=ofsNew; + DBWrite(ofsDbcsPrev,dbcsPrev,offsetof(struct DBContactSettings,blob)); + } + DeleteSpace(ofsSettingsGroup,oldSize+offsetof(struct DBContactSettings,blob)); + ofsBlobPtr+=ofsNew-ofsSettingsGroup; + ofsSettingsGroup=ofsNew; + pBlob=(PBYTE)DBRead(ofsBlobPtr,1,&bytesRemaining); + } + //we now have a place to put it and enough space: make it + DBWrite(ofsBlobPtr,&settingNameLen,1); + DBWrite(ofsBlobPtr+1,(PVOID)dbcws->szSetting,settingNameLen); + MoveAlong(1+settingNameLen); + DBWrite(ofsBlobPtr,&dbcws->value.type,1); + MoveAlong(1); + switch(dbcws->value.type) { + case DBVT_BYTE: DBWrite(ofsBlobPtr,&dbcws->value.bVal,1); MoveAlong(1); break; + case DBVT_WORD: DBWrite(ofsBlobPtr,&dbcws->value.wVal,2); MoveAlong(2); break; + case DBVT_DWORD: DBWrite(ofsBlobPtr,&dbcws->value.dVal,4); MoveAlong(4); break; + case DBVT_UTF8: + case DBVT_ASCIIZ: + { int len=strlen(dbcws->value.pszVal); + DBWrite(ofsBlobPtr,&len,2); + DBWrite(ofsBlobPtr+2,dbcws->value.pszVal,len); + MoveAlong(2+len); + } + break; + case DBVT_BLOB: + DBWrite(ofsBlobPtr,&dbcws->value.cpbVal,2); + DBWrite(ofsBlobPtr+2,dbcws->value.pbVal,dbcws->value.cpbVal); + MoveAlong(2+dbcws->value.cpbVal); + break; + } + { BYTE zero=0; + DBWrite(ofsBlobPtr,&zero,1); + } + //quit + DBFlush(1); + LeaveCriticalSection(&csDbAccess); + //notify + NotifyEventHooks(hSettingChangeEvent,wParam,lParam); + return 0; +} + +static int DeleteContactSetting(WPARAM wParam,LPARAM lParam) +{ + DBCONTACTGETSETTING *dbcgs=(DBCONTACTGETSETTING*)lParam; + struct DBContact *dbc; + DWORD ofsModuleName,ofsSettingsGroup,ofsBlobPtr; + struct DBContactSettings dbcs; + PBYTE pBlob; + int settingNameLen=strlen(dbcgs->szSetting),bytesRemaining; + char* szCachedSettingName; + WPARAM saveWparam = wParam; + + if ((!dbcgs->szModule) || (!dbcgs->szSetting)) + return 1; + + EnterCriticalSection(&csDbAccess); + ofsModuleName=GetModuleNameOfs(dbcgs->szModule); + if(wParam==0) wParam=dbHeader.ofsUser; + + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbc->signature!=DBCONTACT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + //make sure the module group exists + ofsSettingsGroup=GetSettingsGroupOfsByModuleNameOfs(dbc,wParam,ofsModuleName); + if(ofsSettingsGroup==0) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); + if(dbc->signature!=DBCONTACT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + ofsSettingsGroup=GetSettingsGroupOfsByModuleNameOfs(dbc,wParam,ofsModuleName); + if(ofsSettingsGroup==0) { + LeaveCriticalSection(&csDbAccess); + return 1; + } + dbcs=*(struct DBContactSettings*)DBRead(ofsSettingsGroup,sizeof(struct DBContactSettings),NULL); + //find if the setting exists + ofsBlobPtr=ofsSettingsGroup+offsetof(struct DBContactSettings,blob); + pBlob=(PBYTE)DBRead(ofsBlobPtr,1,&bytesRemaining); + while(pBlob[0]) { + NeedBytes(settingNameLen+1); + if(pBlob[0]==settingNameLen && !memcmp(pBlob+1,dbcgs->szSetting,settingNameLen)) + break; + NeedBytes(1); + MoveAlong(pBlob[0]+1); + NeedBytes(3); + MoveAlong(1+GetSettingValueLength(pBlob)); + NeedBytes(1); + } + if(!pBlob[0]) { //setting didn't exist + LeaveCriticalSection(&csDbAccess); + return 1; + } + { //bin it + int nameLen,valLen; + DWORD ofsSettingToCut; + MoveAlong(1+settingNameLen); + NeedBytes(3); + nameLen=1+settingNameLen; + valLen=1+GetSettingValueLength(pBlob); + ofsSettingToCut=ofsBlobPtr-nameLen; + MoveAlong(valLen); + NeedBytes(1); + while(pBlob[0]) { + MoveAlong(pBlob[0]+1); + NeedBytes(3); + MoveAlong(1+GetSettingValueLength(pBlob)); + NeedBytes(1); + } + DBMoveChunk(ofsSettingToCut,ofsSettingToCut+nameLen+valLen,ofsBlobPtr+1-ofsSettingToCut); + } + + szCachedSettingName = GetCachedSetting(dbcgs->szModule,dbcgs->szSetting,settingNameLen); + GetCachedValuePtr((HANDLE)saveWparam, szCachedSettingName, -1 ); + + //quit + DBFlush(1); + LeaveCriticalSection(&csDbAccess); + { //notify + DBCONTACTWRITESETTING dbcws; + dbcws.szModule=dbcgs->szModule; + dbcws.szSetting=dbcgs->szSetting; + dbcws.value.type=DBVT_DELETED; + NotifyEventHooks(hSettingChangeEvent,saveWparam,(LPARAM)&dbcws); + } + return 0; +} + +static int EnumContactSettings(WPARAM wParam,LPARAM lParam) +{ + DBCONTACTENUMSETTINGS *dbces=(DBCONTACTENUMSETTINGS*)lParam; + struct DBContact dbc; + struct DBContactSettings dbcs; + DWORD ofsModuleName,ofsContact,ofsBlobPtr; + int bytesRemaining, result; + PBYTE pBlob; + char szSetting[256]; + + if (!dbces->szModule) + return -1; + + EnterCriticalSection(&csDbAccess); + + ofsModuleName=GetModuleNameOfs(dbces->szModule); + if(wParam==0) ofsContact=dbHeader.ofsUser; + else ofsContact=wParam; + dbc=*(struct DBContact*)DBRead(ofsContact,sizeof(struct DBContact),NULL); + if(dbc.signature!=DBCONTACT_SIGNATURE) { + LeaveCriticalSection(&csDbAccess); + return -1; + } + dbces->ofsSettings=GetSettingsGroupOfsByModuleNameOfs(&dbc,ofsContact,ofsModuleName); + if(!dbces->ofsSettings) { + LeaveCriticalSection(&csDbAccess); + return -1; + } + dbcs=*(struct DBContactSettings*)DBRead(dbces->ofsSettings,sizeof(struct DBContactSettings),&bytesRemaining); + ofsBlobPtr=dbces->ofsSettings+offsetof(struct DBContactSettings,blob); + pBlob=(PBYTE)DBRead(ofsBlobPtr,1,&bytesRemaining); + if(pBlob[0]==0) { + LeaveCriticalSection(&csDbAccess); + return -1; + } + result = 0; + while(pBlob[0]) { + NeedBytes(1); + NeedBytes(1+pBlob[0]); + CopyMemory(szSetting,pBlob+1,pBlob[0]); szSetting[pBlob[0]]=0; + result = (dbces->pfnEnumProc)(szSetting,dbces->lParam); + MoveAlong(1+pBlob[0]); + NeedBytes(3); + MoveAlong(1+GetSettingValueLength(pBlob)); + NeedBytes(1); + } + LeaveCriticalSection(&csDbAccess); + return result; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// +// Module initialization procedure + +static int stringCompare( DBCachedSettingName* p1, DBCachedSettingName* p2 ) +{ + return strcmp( p1->name, p2->name ); +} + +static int stringCompare2( DBCachedGlobalValue* p1, DBCachedGlobalValue* p2 ) +{ + return strcmp( p1->name, p2->name ); +} + +static int handleCompare( void* p1, void* p2 ) +{ + if ( *( long* )p1 == *( long* )p2 ) + return 0; + + return *( long* )p1 - *( long* )p2; +} + +int InitSettings(void) +{ + CreateServiceFunction(MS_DB_CONTACT_GETSETTING,GetContactSetting); + CreateServiceFunction(MS_DB_CONTACT_GETSETTING_STR,GetContactSettingStr); + CreateServiceFunction(MS_DB_CONTACT_GETSETTINGSTATIC,GetContactSettingStatic); + CreateServiceFunction(MS_DB_CONTACT_FREEVARIANT,FreeVariant); + CreateServiceFunction(MS_DB_CONTACT_WRITESETTING,WriteContactSetting); + CreateServiceFunction(MS_DB_CONTACT_DELETESETTING,DeleteContactSetting); + CreateServiceFunction(MS_DB_CONTACT_ENUMSETTINGS,EnumContactSettings); + CreateServiceFunction(MS_DB_SETSETTINGRESIDENT,SetSettingResident); + hSettingChangeEvent=CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); + + hCacheHeap=HeapCreate(HEAP_NO_SERIALIZE,0,0); + lSettings.sortFunc=stringCompare; + lSettings.increment=50; + lContacts.sortFunc=handleCompare; + lContacts.increment=100; + lGlobalSettings.sortFunc=stringCompare2; + lGlobalSettings.increment=100; + return 0; +} + +void UninitSettings(void) +{ + HeapDestroy(hCacheHeap); + li.List_Destroy(&lContacts); + li.List_Destroy(&lSettings); + li.List_Destroy(&lGlobalSettings); +} diff --git a/clist_classic_sje/dbtime.c b/clist_classic_sje/dbtime.c new file mode 100644 index 0000000..e9189b9 --- /dev/null +++ b/clist_classic_sje/dbtime.c @@ -0,0 +1,163 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "database.h" + +static int daysInMonth[12]={31,28,31,30,31,30,31,31,30,31,30,31}; +static int IsLeapYear(int year) +{ + if(year&3) return 0; + if(year%100) return 1; + if(year%400) return 0; + return 1; +} + +static int CompareSystemTimes(SYSTEMTIME *st,SYSTEMTIME *switchDate) +{ + FILETIME ft1,ft2; + + if(switchDate->wYear==0) { //strange day-in-month thing + SYSTEMTIME tempst; + + //short-circuit if the months aren't the same + if(st->wMonthwMonth) return -1; + if(st->wMonth>switchDate->wMonth) return 1; + + tempst=*switchDate; + tempst.wYear=st->wYear; + tempst.wDay=1; + SystemTimeToFileTime(&tempst,&ft1); + FileTimeToSystemTime(&ft1,&tempst); //gets the day of week of the first of the month + tempst.wDay=1+(7+switchDate->wDayOfWeek-tempst.wDayOfWeek)%7; + if(switchDate->wDay==5) { //last wDayOfWeek in month + if(tempst.wMonth==2) { + if(IsLeapYear(tempst.wYear)) daysInMonth[1]=29; + else daysInMonth[1]=28; + } + tempst.wDay+=7*3; //can't be less than 4 of that day in the month + if(tempst.wDay+7<=daysInMonth[switchDate->wMonth-1]) tempst.wDay+=7; + } + else tempst.wDay+=7*(switchDate->wDay-1); //nth of month + SystemTimeToFileTime(&tempst,&ft2); + } + else { + switchDate->wYear=st->wYear; + SystemTimeToFileTime(switchDate,&ft2); + } + SystemTimeToFileTime(st,&ft1); + return CompareFileTime(&ft1,&ft2); +} + +static int TimestampToLocal(WPARAM wParam,LPARAM lParam) +{ + TIME_ZONE_INFORMATION tzInfo; + LARGE_INTEGER liFiletime; + FILETIME filetime; + SYSTEMTIME st; + + GetTimeZoneInformation(&tzInfo); + if(tzInfo.StandardDate.wMonth==0) { //no daylight savings time + return (int)(wParam-tzInfo.Bias*60); + } + //this huge number is the difference between 1970 and 1601 in seconds + liFiletime.QuadPart=(mir_i64(11644473600)+(__int64)wParam)*10000000; + filetime.dwHighDateTime=liFiletime.HighPart; + filetime.dwLowDateTime=liFiletime.LowPart; + FileTimeToSystemTime(&filetime,&st); + if(tzInfo.DaylightDate.wMonth0) { + return (int)(wParam-(tzInfo.Bias+tzInfo.StandardBias)*60); + } + return (int)(wParam-(tzInfo.Bias+tzInfo.DaylightBias)*60); + } + else { + //southern hemisphere + if(CompareSystemTimes(&st,&tzInfo.StandardDate)<0 || + CompareSystemTimes(&st,&tzInfo.DaylightDate)>0) { + return (int)(wParam-(tzInfo.Bias+tzInfo.DaylightBias)*60); + } + return (int)(wParam-(tzInfo.Bias+tzInfo.StandardBias)*60); + } + return 0; +} + +static int TimestampToString(WPARAM wParam,LPARAM lParam) +{ + DBTIMETOSTRING *tts=(DBTIMETOSTRING*)lParam; + LARGE_INTEGER liFiletime; + FILETIME filetime; + SYSTEMTIME st; + char dateTimeStr[64]; + char *pDest,*pFormat; + int destCharsLeft,dateTimeStrLen; + + //this huge number is the difference between 1970 and 1601 in seconds + liFiletime.QuadPart=(mir_i64(11644473600)+(__int64)(DWORD)TimestampToLocal(wParam,0))*10000000; + filetime.dwHighDateTime=liFiletime.HighPart; + filetime.dwLowDateTime=liFiletime.LowPart; + FileTimeToSystemTime(&filetime,&st); + destCharsLeft=tts->cbDest; + for(pFormat=tts->szFormat,pDest=tts->szDest;*pFormat;pFormat++) { + switch(*pFormat) { + case 't': + GetTimeFormat(LOCALE_USER_DEFAULT,TIME_NOSECONDS,&st,NULL,dateTimeStr,sizeof(dateTimeStr)); + break; + case 's': + GetTimeFormat(LOCALE_USER_DEFAULT,0,&st,NULL,dateTimeStr,sizeof(dateTimeStr)); + break; + case 'm': + GetTimeFormat(LOCALE_USER_DEFAULT,TIME_NOMINUTESORSECONDS,&st,NULL,dateTimeStr,sizeof(dateTimeStr)); + break; + case 'd': + GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&st,NULL,dateTimeStr,sizeof(dateTimeStr)); + break; + case 'D': + GetDateFormat(LOCALE_USER_DEFAULT,DATE_LONGDATE,&st,NULL,dateTimeStr,sizeof(dateTimeStr)); + break; + default: + if(destCharsLeft) { + *pDest++=*pFormat; + destCharsLeft--; + } + continue; + } + dateTimeStrLen=strlen(dateTimeStr); + if(destCharsLeftszDest[tts->cbDest-1]=0; + return 0; +} + +int InitTime(void) +{ + CreateServiceFunction(MS_DB_TIME_TIMESTAMPTOLOCAL,TimestampToLocal); + CreateServiceFunction(MS_DB_TIME_TIMESTAMPTOSTRING,TimestampToString); + return 0; +} diff --git a/clist_classic_sje/docs/clist-license.txt b/clist_classic_sje/docs/clist-license.txt new file mode 100644 index 0000000..7f11610 --- /dev/null +++ b/clist_classic_sje/docs/clist-license.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/clist_classic_sje/docs/clist-readme.txt b/clist_classic_sje/docs/clist-readme.txt new file mode 100644 index 0000000..18d96a0 --- /dev/null +++ b/clist_classic_sje/docs/clist-readme.txt @@ -0,0 +1,38 @@ +################################################################ +# Classic Contact List Plugin +################################################################ + +About +----- +The Classic Contact List control is used to view your contacts +in Miranda IM. + + +Requirements +------------ + - Miranda IM 0.4 + + +History +------- +0.4.0.0 + - CList separated from core (initial release) + + +Copyright +--------- +Copyright (C) 2003-2005 Miranda IM Development Team + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. diff --git a/clist_classic_sje/docs/clist-translation.txt b/clist_classic_sje/docs/clist-translation.txt new file mode 100644 index 0000000..2530575 --- /dev/null +++ b/clist_classic_sje/docs/clist-translation.txt @@ -0,0 +1,216 @@ +Miranda Language Pack Version 1 +Locale: 0809 +Authors: Miranda IM Development Team +Author-email: info@miranda-im.org +Last-Modified-Using: Miranda IM 0.4 +Plugins-included: + +; Generated by lpgen on Thu May 12 12:11:20 2005 +; Translations: 184 + +; clcitems.c +;[Offline] + +; clcopts.c +;[Contact List] +;[List] +;[List Background] +;[List Text] +;[] + +; clistmenus.c +;[E&xit] +;[&Message] +;[&File] +;[User &Details] +;[View &History] + +; clistmod.c +;[Connecting] +;[Online] +;[Away] +;[DND] +;[NA] +;[Occupied] +;[Free for chat] +;[Invisible] +;[Out to lunch] +;[On the phone] +;[Idle] +;[Connecting (attempt %d)] +;[This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network.] +;[Delete Contact] +;[De&lete] +;[&Add permanently to list] + +; clistopts.c +;[Hotkeys] +;[Events] +;[Global] + +; clistsettings.c +;[(Unknown Contact)] +;['(Unknown Contact)'] + +; clisttray.c +;[&Main Menu] +;[&Status] + +; clui.c +;[&Rename] + +; cluiopts.c +;[Window] +;[Status Bar] + +; groups.c +;[New Group] +;[You already have a group with that name. Please enter a unique name for the group.] +;[Rename Group] +;[This group] + +; resource.rc +;[Hide from list only, in order to keep their history and ignore/visibility settings] +;[Are you sure you want to delete %s?] +;[Show/Hide:] +;[HotKey1] +;[Read Msg:] +;[Net Search:] +;[Open in new browser window] +;[Show Options] +;[Hide offline users] +;[Hide empty groups] +;[Disable groups] +;[Ask before deleting contacts] +;[Sort contacts by name] +;[Sort contacts by status] +;[Sort contacts by protocol] +;[Single click interface] +;[Always show status in tooltip] +;[Disable icon blinking] +;[Show] +;[Cycle icons every] +;[Spin1] +;[Show multiple icons] +;[Only when statuses differ] +;[Spin5] +;[Always on top] +;[Tool style main window] +;[Minimize to tray] +;[Hide contact list after it has been idle for] +;[Automatically resize window to height of list] +;[Size upwards] +;[Fade contact list in/out] +;[Transparent contact list] +;[Slider2] +;[Show menu bar] +;[Easy move] +;[Show title bar] +;[If window is partially covered, bring to front instead of hiding] +;[Show drop shadow (restart required)] +;[Pin to desktop] +;[Show divider between online and offline contacts] +;[Hot track items as mouse passes over] +;[Disable drag and drop of items] +;[Disable rename of items by clicking twice] +;[Show selection even when list is not focused] +;[Make selection highlight translucent] +;[Draw a line alongside group names] +;[Show counts of number of contacts in a group] +;[Hide group counts when there are none online] +;[Sort groups alphabetically] +;[Quicksearch in open groups only] +;[Scroll list smoothly] +;[Grey out entire list when:] +;[Dim idle contacts] +;[Hide vertical scroll bar] +;[Typeface] +;[Size] +;[Style] +;[Colour] +;[Bold] +;[Italic] +;[Underline] +;[Gamma correction] +;[Use background image] +;[Stretch to width] +;[Stretch to height] +;[Tile horizontally] +;[Tile vertically] +;[Scroll with text] +;[Stretch proportionally] +;[Use Windows colours] +;[Show status bar] +;[Show icons] +;[Show protocol names] +;[Show status text] +;[Right click opens status menu] +;[Right click opens Miranda IM menu] +;[Make sections equal width] +;[Show bevels on panels] +;[Show resize grip indicator] +;[No] +;[Yes] +;[...] +;[Use Options->Ignore (expert mode) to unhide contacts.] +;[This will erase all history and settings for this contact!] +;[URL:] +;[ms delay] +;[icon when statuses differ] +;[seconds, when statuses differ] +;[seconds] +;[maximum] +;[% of screen] +;[Title bar text:] +;[Inactive opacity:] +;[Active opacity:] +;[000%] +;['Hide Offline' means to hide:] +;[Indent groups by:] +;[pixels] +;[Time:] +;[milliseconds] +;[Left margin:] +;[same] +;[as:] +;[Row height:] +;[Selected text:] +;[Hottrack text:] +;[Quicksearch text:] +;[Size:] +;[Colour:] +;[Background colour] +;[Selection colour] +;[System tray icon] +;[System tray icon when using multiple protocols] +;[Contact List Sorting] +;[Translucency options (Windows 2000/XP only)] +;[Items] +;[Groups] +;[Visual] +;[Fonts] +;[Rows] +;[Additional Colours] +;[Contact List Background] +;[&Offline\tCtrl+0] +;[On&line\tCtrl+1] +;[&Away\tCtrl+2] +;[&NA\tCtrl+3] +;[Occ&upied\tCtrl+4] +;[&DND\tCtrl+5] +;[&Free for chat\tCtrl+6] +;[&Invisible\tCtrl+7] +;[On the &Phone\tCtrl+8] +;[Out to &Lunch\tCtrl+9] +;[&Hide/Show] +;[&New Group] +;[&Hide Offline Users] +;[Hide &Offline Users out here] +;[Hide &Empty Groups] +;[Disable &Groups] +;[Hide Miranda] +;[&New Subgroup] +;[&Hide Offline Users in here] +;[&Rename Group] +;[&Delete Group] + diff --git a/clist_classic_sje/docs/db3x-license.txt b/clist_classic_sje/docs/db3x-license.txt new file mode 100644 index 0000000..7f11610 --- /dev/null +++ b/clist_classic_sje/docs/db3x-license.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/clist_classic_sje/docs/db3x-readme.txt b/clist_classic_sje/docs/db3x-readme.txt new file mode 100644 index 0000000..eb5707c --- /dev/null +++ b/clist_classic_sje/docs/db3x-readme.txt @@ -0,0 +1,38 @@ +################################################################ +# Classic Database Driver for Miranda IM +################################################################ + +About +----- +The Classic Database Driver is used to store all contacts and +events in Miranda IM. + + +Requirements +------------ + - Miranda IM 0.4 + + +History +------- +0.4.0.0 + - DB driver separated from core (initial release) + + +Copyright +--------- +Copyright (C) 2003-2005 Miranda IM Development Team + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. diff --git a/clist_classic_sje/docs/db3x-translation.txt b/clist_classic_sje/docs/db3x-translation.txt new file mode 100644 index 0000000..fc265cc --- /dev/null +++ b/clist_classic_sje/docs/db3x-translation.txt @@ -0,0 +1,43 @@ +Miranda Language Pack Version 1 +Locale: 0809 +Authors: Miranda IM Development Team +Author-email: info@miranda-im.org +Last-Modified-Using: Miranda IM 0.4 +Plugins-included: + +; Generated by lpgen on Wed Apr 6 12:41:12 2005 +; Translations: 27 + +; database.c +;[Miranda has detected corruption in your database. This corruption maybe fixed by DBTool. Please download it from http://www.miranda-im.org. Miranda will now shutdown.] +;[Database Panic] + +; dbini.c +;[Invalid setting type. The first character of every value must be b, w, d, l, s or n.] +;[Install Database Settings] + +; resource.rc +;[&Allow all further changes to this section] +;[Yes] +;[&Yes] +;[No] +;[No to all] +;[&View contents] +;[&No] +;[Cancel Import] +;[&Recycle] +;[&Delete] +;[&Move/Rename] +;[&Leave] +;[A file containing new database settings has been placed in the Miranda IM directory.] +;[Do you want to import the settings now?] +;[Security systems to prevent malicious changes are in place and you will be warned before changes that are not known to be safe.] +;[Database settings are being imported from] +;[This file wishes to change the setting] +;[to the value] +;[Do you want to allow this change?] +;[The import has completed from] +;[What do you want to do with the file now?] +;[Database Setting Change] +;[Database Import Complete] + diff --git a/clist_classic_sje/encrypt.c b/clist_classic_sje/encrypt.c new file mode 100644 index 0000000..1382a27 --- /dev/null +++ b/clist_classic_sje/encrypt.c @@ -0,0 +1,67 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "database.h" + +//VERY VERY VERY BASIC ENCRYPTION FUNCTION + + +void Encrypt(char*msg,BOOL up) +{ + int i; + int jump; + if (up) + { + jump=5; + } + else + { + jump=-5; + } + + for (i=0;msg[i];i++) + { + msg[i]=msg[i]+jump; + } + +} + +static int EncodeString(WPARAM wParam,LPARAM lParam) +{ + Encrypt((char*)lParam,TRUE); + return 0; +} + +static int DecodeString(WPARAM wParam,LPARAM lParam) +{ + Encrypt((char*)lParam,FALSE); + return 0; +} + +int InitCrypt(void) +{ + CreateServiceFunction(MS_DB_CRYPT_ENCODESTRING,EncodeString); + CreateServiceFunction(MS_DB_CRYPT_DECODESTRING,DecodeString); + return 0; +} diff --git a/clist_classic_sje/encryption.h b/clist_classic_sje/encryption.h new file mode 100644 index 0000000..73c2d7e --- /dev/null +++ b/clist_classic_sje/encryption.h @@ -0,0 +1,23 @@ +/* +Miranda ICQ: the free icq client for MS Windows +Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef MODULAR +#include + +void Encrypt(char*msg,BOOL up); +#endif \ No newline at end of file diff --git a/clist_classic_sje/finalcommand.c b/clist_classic_sje/finalcommand.c new file mode 100644 index 0000000..2e8ecbb --- /dev/null +++ b/clist_classic_sje/finalcommand.c @@ -0,0 +1,58 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" + +char exit_command[MAX_PATH], + exit_command_dir[MAX_PATH], + exit_command_params[MAX_PATH]; + +BOOL command_valid = FALSE, + command_dir_valid = FALSE, + command_params_valid = FALSE; + +void FinalCommandSetup(void) { + DBVARIANT dbv; + + if(!DBGetContactSetting(0, "db3x", "ExitCommand", &dbv) && dbv.type == DBVT_ASCIIZ) { + strncpy(exit_command, dbv.pszVal, MAX_PATH); + command_valid = TRUE; + DBFreeVariant(&dbv); + + if(!DBGetContactSetting(0, "db3x", "ExitCommandParams", &dbv) && dbv.type == DBVT_ASCIIZ) { + strncpy(exit_command_params, dbv.pszVal, MAX_PATH); + command_params_valid = TRUE; + DBFreeVariant(&dbv); + } + if(!DBGetContactSetting(0, "db3x", "ExitCommandDir", &dbv) && dbv.type == DBVT_ASCIIZ) { + strncpy(exit_command_dir, dbv.pszVal, MAX_PATH); + command_dir_valid = TRUE; + DBFreeVariant(&dbv); + } + } +} + +void FinalCommandExecute(void) { + if(command_valid) + ShellExecute(0, 0, exit_command, command_params_valid ? exit_command_params : 0, command_dir_valid ? exit_command_dir : 0, SW_SHOWNORMAL); +} diff --git a/clist_classic_sje/forkthread.c b/clist_classic_sje/forkthread.c new file mode 100644 index 0000000..920fc1f --- /dev/null +++ b/clist_classic_sje/forkthread.c @@ -0,0 +1,94 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" + +struct FORK_ARG +{ + HANDLE hEvent; + void (__cdecl * threadcode) (void *); + unsigned (__stdcall * threadcodeex) (void *); + void *arg; +}; + +void __cdecl forkthread_r(struct FORK_ARG *fa) +{ + void (*callercode) (void *) = fa->threadcode; + void *arg = fa->arg; + CallService(MS_SYSTEM_THREAD_PUSH, 0, 0); + SetEvent(fa->hEvent); + __try { + callercode(arg); + } + __finally { + CallService(MS_SYSTEM_THREAD_POP, 0, 0); + } + return; +} + +unsigned long forkthread(void (__cdecl * threadcode) (void *), unsigned long stacksize, void *arg) +{ + unsigned long rc; + struct FORK_ARG fa; + fa.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + fa.threadcode = threadcode; + fa.arg = arg; + rc = _beginthread(forkthread_r, stacksize, &fa); + if ((unsigned long) -1L != rc) { + WaitForSingleObject(fa.hEvent, INFINITE); + } //if + CloseHandle(fa.hEvent); + return rc; +} + +unsigned long __stdcall forkthreadex_r(struct FORK_ARG *fa) +{ + unsigned (__stdcall * threadcode) (void *) = fa->threadcodeex; + void *arg = fa->arg; + unsigned long rc; + + CallService(MS_SYSTEM_THREAD_PUSH, 0, 0); + SetEvent(fa->hEvent); + __try { + rc = threadcode(arg); + } + __finally { + CallService(MS_SYSTEM_THREAD_POP, 0, 0); + } + return rc; +} + +unsigned long forkthreadex(void *sec, unsigned stacksize, unsigned (__stdcall * threadcode) (void *), void *arg, unsigned cf, unsigned *thraddr) +{ + unsigned long rc; + struct FORK_ARG fa; + fa.threadcodeex = threadcode; + fa.arg = arg; + fa.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + rc = _beginthreadex(sec, stacksize, forkthreadex_r, &fa, 0, thraddr); + if (rc) { + WaitForSingleObject(fa.hEvent, INFINITE); + } + CloseHandle(fa.hEvent); + return rc; +} diff --git a/clist_classic_sje/forkthread.h b/clist_classic_sje/forkthread.h new file mode 100644 index 0000000..9abcf5e --- /dev/null +++ b/clist_classic_sje/forkthread.h @@ -0,0 +1,63 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* + +Purpose: + + A safe version of _beginthread() + +Description: + + A new thread is created and the source thread is paused until + internal code to call MS_SYSTEM_THREAD_PUSH is made in the context + if the new thread. + + The source thread is then released and then the user supplied + code is called, when that function returns -- MS_SYSTEM_THREAD_POP + is called and then the thread returns. + + This insures that Miranda will not exit whilst new threads + are trying to be born; and the unwind wait stack will unsure + that Miranda will wait for all created threads to return as well. + +Cavets: + + The function must be reimplemented across MT plugins, since thread + creation depends on CRT which can not be shared. + +*/ +unsigned long forkthread ( + void (__cdecl *threadcode)(void*), + unsigned long stacksize, + void *arg +); + +unsigned long forkthreadex( + void *sec, + unsigned stacksize, + unsigned (__stdcall *threadcode)(void*), + void *arg, + unsigned cf, + unsigned *thraddr +); diff --git a/clist_classic_sje/frames.c b/clist_classic_sje/frames.c new file mode 100644 index 0000000..0c0432a --- /dev/null +++ b/clist_classic_sje/frames.c @@ -0,0 +1,713 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "../clist_nicer/m_cluiframes.h" +#include +#include + +#define WMU_SNAPTO (WM_USER + 0x10) +#define SNAP_THRESH 10 + +// my own alignment enum +typedef enum {AL_TOP, AL_BOTTOM, AL_LEFT, AL_RIGHT} FrameAlign; + +int next_frame_id = 1; +CRITICAL_SECTION cs; + +DWORD id_pos_timer = 0; + +BOOL clist_visible = FALSE; + +HMODULE hUserDll = 0; +BOOL(WINAPI * MyFramesSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD) = 0; +BOOL(WINAPI * MyAnimateWindow) (HWND hWnd, DWORD dwTime, DWORD dwFlags) = 0; + +void SetCListVisible(BOOL visible) { + clist_visible = visible; +} + +int height_client_to_frame(int client_height, LONG style, LONG ex_style) { + RECT tr; + tr.top = tr.right = tr.left = 0; + tr.bottom = client_height; + AdjustWindowRectEx(&tr, style, FALSE, ex_style); + return tr.bottom - tr.top; +} + +int ReadFrameFlags(char *frame_name, int default_flags) { + char setting[256]; + mir_snprintf(setting, 256, "FrameFlags_%s", frame_name); + return DBGetContactSettingDword(0, "SimpleCLUIFrames", setting, default_flags); +} + +int ReadFrameHeight(char *frame_name, int default_height) { + char setting[256]; + mir_snprintf(setting, 256, "FrameHeight_%s", frame_name); + return DBGetContactSettingDword(0, "SimpleCLUIFrames", setting, default_height); +} + +int ReadFrameWidth(char *frame_name, int default_width) { + char setting[256]; + mir_snprintf(setting, 256, "FrameWidth_%s", frame_name); + return DBGetContactSettingDword(0, "SimpleCLUIFrames", setting, default_width); +} + +BOOL ReadFrameFloating(char *frame_name, BOOL default_floating) { + char setting[256]; + mir_snprintf(setting, 256, "FrameFloat_%s", frame_name); + return DBGetContactSettingByte(0, "SimpleCLUIFrames", setting, default_floating ? 1 : 0) ? TRUE : FALSE; +} + +FrameAlign ReadFrameAlign(char *frame_name, FrameAlign default_align) { + char setting[256]; + mir_snprintf(setting, 256, "FrameAlign_%s", frame_name); + return (FrameAlign)DBGetContactSettingByte(0, "SimpleCLUIFrames", setting, (int)default_align); +} + +int ReadFrameOffX(char *frame_name, int default_off_x) { + char setting[256]; + mir_snprintf(setting, 256, "FrameOffX_%s", frame_name); + return DBGetContactSettingDword(0, "SimpleCLUIFrames", setting, default_off_x); +} + +int ReadFrameOffY(char *frame_name, int default_off_y) { + char setting[256]; + mir_snprintf(setting, 256, "FrameOffY_%s", frame_name); + return DBGetContactSettingDword(0, "SimpleCLUIFrames", setting, default_off_y); +} + +void StoreFrameFlags(char *frame_name, int flags) { + char setting[256]; + mir_snprintf(setting, 256, "FrameFlags_%s", frame_name); + DBWriteContactSettingDword(0, "SimpleCLUIFrames", setting, flags); +} + +void StoreFrameHeight(char *frame_name, int height) { + char setting[256]; + mir_snprintf(setting, 256, "FrameHeight_%s", frame_name); + DBWriteContactSettingDword(0, "SimpleCLUIFrames", setting, height); +} + +void StoreFrameWidth(char *frame_name, int width) { + char setting[256]; + mir_snprintf(setting, 256, "FrameWidth_%s", frame_name); + DBWriteContactSettingDword(0, "SimpleCLUIFrames", setting, width); +} + +void StoreFrameFloating(char *frame_name, BOOL floating) { + char setting[256]; + mir_snprintf(setting, 256, "FrameFloat_%s", frame_name); + DBWriteContactSettingByte(0, "SimpleCLUIFrames", setting, floating ? 1 : 0); +} + +void StoreFrameAlign(char *frame_name, FrameAlign align) { + char setting[256]; + mir_snprintf(setting, 256, "FrameAlign_%s", frame_name); + DBWriteContactSettingByte(0, "SimpleCLUIFrames", setting, (BYTE)align); +} + +void StoreFrameOffX(char *frame_name, int off_x) { + char setting[256]; + mir_snprintf(setting, 256, "FrameOffX_%s", frame_name); + DBWriteContactSettingDword(0, "SimpleCLUIFrames", setting, off_x); +} + +void StoreFrameOffY(char *frame_name, int off_y) { + char setting[256]; + mir_snprintf(setting, 256, "FrameOffY_%s", frame_name); + DBWriteContactSettingDword(0, "SimpleCLUIFrames", setting, off_y); +} + +struct FrameListNode { + CLISTFrame frame_data; + HWND hwndParent; + int id; + struct FrameListNode *next; + LONG origStyle, origExStyle; + BOOL floating; + FrameAlign align; + int width, height; // for frame (frame_data->height is client - which is only used as input from API [addframe, set frame options]) + + int off_x, off_y; // offsets from clist location for non-floating mode + + BOOL sizing, size_move; +}; + +struct FrameListNode *frame_list = 0; + +struct FrameListNode *GetFrame(int id) { + struct FrameListNode *current, *ret = 0; + EnterCriticalSection(&cs); + current = frame_list; + while(current) { + if(current->id == id) { + ret = current; + break; + } + current = current->next; + } + LeaveCriticalSection(&cs); + return ret; +} + +void PositionFramesNow() { + HWND hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0), + hwndFrame; + LONG clistStyle = GetWindowLong(hwndClist, GWL_STYLE), + clistExStyle = GetWindowLong(hwndClist, GWL_EXSTYLE); + + RECT r, fr; + int frameHeight, frameWidth; + struct FrameListNode *current; + BOOL hwndVis; + GetWindowRect(hwndClist, &r); + + EnterCriticalSection(&cs); + current = frame_list; + while(current) { + hwndFrame = current->hwndParent; + frameHeight = current->height; + frameWidth = current->width; + hwndVis = IsWindowVisible(hwndFrame); + if(clist_visible && (current->frame_data.Flags & F_VISIBLE)) { + if(GetWindowLong(hwndFrame, GWL_STYLE) != clistStyle) { + SetWindowLong(hwndFrame, GWL_STYLE, clistStyle); + SetWindowPos(hwndFrame, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED); + } + if(GetWindowLong(hwndFrame, GWL_EXSTYLE) != clistExStyle) { + SetWindowLong(hwndFrame, GWL_EXSTYLE, clistExStyle); + if (MyFramesSetLayeredWindowAttributes && (clistExStyle & WS_EX_LAYERED)) + MyFramesSetLayeredWindowAttributes( + hwndFrame, RGB(0, 0, 0), + (BYTE) DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), + LWA_ALPHA + ); + + } + + // convert client height to frame height for collapsed frames + if(!(current->frame_data.Flags & F_UNCOLLAPSED)) + frameHeight = height_client_to_frame(0, clistStyle, clistExStyle); + + GetWindowRect(hwndFrame, &fr); + if(!current->floating) { + if(fr.left != r.left + current->off_x || fr.top != r.top + current->off_y || fr.right != r.left + current->off_x + frameWidth || fr.bottom != r.top + current->off_y + frameHeight) { + SetWindowPos(hwndFrame, 0, r.left + current->off_x, r.top + current->off_y , frameWidth, frameHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + } + } else { + if(fr.bottom - fr.top != frameHeight || fr.right - fr.left != frameWidth) { + SetWindowPos(hwndFrame, 0, 0, 0, frameWidth, frameHeight, SWP_NOZORDER | SWP_NOACTIVATE| SWP_NOMOVE | SWP_NOSENDCHANGING); + } + } + + if(!hwndVis) { + //SetWindowPos(hwndFrame, 0, 0, 0, frameWidth, frameHeight, SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_ASYNCWINDOWPOS); + ShowWindow(hwndFrame, SW_SHOWNOACTIVATE); + UpdateWindow(hwndFrame); + //InvalidateRect(hwndFrame, 0, TRUE); + //UpdateWindow(hwndFrame); + //InvalidateRect(current->frame_data.hWnd, 0, TRUE); + //UpdateWindow(current->frame_data.hWnd); + //PostMessage(hwndFrame, WM_SIZE, 0, 0); + RedrawWindow(hwndFrame, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE); + } + } else + if(IsWindowVisible(hwndFrame)) ShowWindow(hwndFrame, SW_HIDE); + + current = current->next; + } + LeaveCriticalSection(&cs); +} + +//void PosTimerProc(HWND hwnd, UINT msg, UINT_PTR idEvent, DWORD time) { +// PositionFramesNow(); +//} + +// schedule a frame position update +void PositionFrames() { + /* + if(id_pos_timer) { + KillTimer(0, id_pos_timer); + id_pos_timer = 0; + } + id_pos_timer = SetTimer(0, 0, 1000, (TIMERPROC)PosTimerProc); + */ + PositionFramesNow(); +} + + +int AddFrame(WPARAM wParam, LPARAM lParam) { + CLISTFrame *frame_data = (CLISTFrame *)wParam; + HWND hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + + LONG clistStyle = GetWindowLong(hwndClist, GWL_STYLE), + clistExStyle = GetWindowLong(hwndClist, GWL_EXSTYLE), + childStyle; + + struct FrameListNode *node; + TCHAR title[256]; + HWND hwndParent; + RECT r; + + if(frame_data->cbSize != sizeof(CLISTFrame)) + return -1; + + childStyle = GetWindowLong(frame_data->hWnd, GWL_STYLE); + childStyle &= ~(WS_POPUP | WS_BORDER); + childStyle |= (WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN); + + SetWindowLong(frame_data->hWnd, GWL_STYLE, childStyle); + SetWindowPos(frame_data->hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + + frame_data->Flags = ReadFrameFlags(frame_data->name, frame_data->Flags | F_UNCOLLAPSED); + StoreFrameFlags(frame_data->name, frame_data->Flags); + +#ifdef _UNICODE + MultiByteToWideChar(CallService(MS_LANGPACK_GETCODEPAGE, 0, 0), 0, frame_data->name, -1, title, 256); +#else + strncpy(title, frame_data->name, 256); +#endif + + node = (struct FrameListNode *)malloc(sizeof(struct FrameListNode)); + memcpy(&node->frame_data, frame_data, sizeof(CLISTFrame)); + node->id = next_frame_id++; + node->origStyle = GetWindowLong(node->frame_data.hWnd, GWL_STYLE); + node->origExStyle = GetWindowLong(node->frame_data.hWnd, GWL_EXSTYLE); + node->frame_data.name = _strdup(frame_data->name); + node->sizing = node->size_move = FALSE; + + node->align = ReadFrameAlign(frame_data->name, AL_TOP); + + node->width = ReadFrameWidth(frame_data->name, 150); + //node->floating = ReadFrameFloating(frame_data->name, FALSE); + node->floating = FALSE; + node->off_x = ReadFrameOffX(frame_data->name, 0); + node->off_y = ReadFrameOffY(frame_data->name, 0); + + node->height = ReadFrameHeight(frame_data->name, height_client_to_frame(frame_data->height, clistStyle, clistExStyle)); + StoreFrameHeight(frame_data->name, node->height); + + GetWindowRect(hwndClist, &r); + //hwndParent = CreateWindowEx(clistExStyle, _T("CListFrameClass"), title, clistStyle, r.left + node->off_x, r.top + node->off_y, node->width, node->height, hwndClist, NULL, g_hInst, NULL); + hwndParent = CreateWindowEx(clistExStyle, _T("CListFrameClass"), title, clistStyle, r.left + node->off_x, r.top + node->off_y, 0, 0, hwndClist, NULL, g_hInst, NULL); + if (MyFramesSetLayeredWindowAttributes && (clistExStyle & WS_EX_LAYERED)) + MyFramesSetLayeredWindowAttributes(hwndParent, RGB(0, 0, 0), + (BYTE) DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), + LWA_ALPHA); + + node->hwndParent = hwndParent; + SetParent(frame_data->hWnd, hwndParent); + PostMessage(hwndParent, WM_CHANGEUISTATE, UIS_INITIALIZE, 0); + + SetWindowLong(hwndParent, GWL_USERDATA, (LONG)node); + + EnterCriticalSection(&cs); + node->next = frame_list; + frame_list = node; + LeaveCriticalSection(&cs); + + return node->id; +} + +int ShowHideFrame(WPARAM wParam, LPARAM lParam) { + int id = (int)wParam; + struct FrameListNode *node = GetFrame(id); + if(node) { + node->frame_data.Flags ^= F_VISIBLE; + StoreFrameFlags(node->frame_data.name, node->frame_data.Flags); + PositionFrames(); + } + return 0; +} + +int ShowAllFrames(WPARAM wParam, LPARAM lParam) { + struct FrameListNode *current; + + EnterCriticalSection(&cs); + current = frame_list; + while(current) { + current->frame_data.Flags |= F_VISIBLE; + StoreFrameFlags(current->frame_data.name, current->frame_data.Flags); + current = current->next; + } + LeaveCriticalSection(&cs); + PositionFrames(); + return 0; +} + +int UpdateFrame(WPARAM wParam, LPARAM lParam) { + int id = (int)wParam, flags = (int)lParam; + struct FrameListNode *node = GetFrame(id); + if(node) { + if(flags & FU_FMREDRAW) { + RedrawWindow(node->hwndParent, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE); + //RedrawWindow(node->frame_data.hWnd, 0, 0, RDW_FRAME | RDW_INVALIDATE); + //InvalidateRect(node->hwndParent, 0, TRUE); + } + } + return 0; +} + + +int GetFrameOptions(WPARAM wParam, LPARAM lParam) { + //int id = (int)LOWORD(wParam), flags = (int)HIWORD(wParam); // grr - header file wrong! + int id = (int)HIWORD(wParam), flags = (int)LOWORD(wParam); + struct FrameListNode *node = GetFrame(id); + if(node) { + switch(flags) { + case FO_FLAGS: + return node->frame_data.Flags; + case FO_FLOATING: + return node->floating; + case FO_HEIGHT: + return node->frame_data.height; + } + } + + return -1; +} + +int SetFrameOptions(WPARAM wParam, LPARAM lParam) { + //int id = (int)LOWORD(wParam), flags = (int)HIWORD(wParam); // grr - header file wrong! + int id = (int)HIWORD(wParam), flag = (int)LOWORD(wParam); + int value = (int)lParam; + struct FrameListNode *node = GetFrame(id); + if(node) { + switch(flag) { + case FO_HEIGHT: + node->frame_data.height = value; + { + HWND hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + LONG clistStyle = GetWindowLong(hwndClist, GWL_STYLE), + clistExStyle = GetWindowLong(hwndClist, GWL_EXSTYLE); + node->height = height_client_to_frame(value, clistStyle, clistExStyle); + StoreFrameHeight(node->frame_data.name, node->height); + } + break; + case FO_FLAGS: + node->frame_data.Flags = value; + StoreFrameFlags(node->frame_data.name, node->frame_data.Flags); + break; + case FO_FLOATING: + node->floating = value ? TRUE : FALSE; + StoreFrameFloating(node->frame_data.name, node->floating); + break; + default: + return -1; + } + + PositionFrames(); + } + + return 0; +} + +void MakeFrameServices() { + CreateServiceFunction(MS_CLIST_FRAMES_ADDFRAME, AddFrame); + CreateServiceFunction(MS_CLIST_FRAMES_SHFRAME, ShowHideFrame); + CreateServiceFunction(MS_CLIST_FRAMES_UPDATEFRAME, UpdateFrame); + CreateServiceFunction(MS_CLIST_FRAMES_GETFRAMEOPTIONS, GetFrameOptions); + CreateServiceFunction(MS_CLIST_FRAMES_SETFRAMEOPTIONS, SetFrameOptions); + CreateServiceFunction(MS_CLIST_FRAMES_SHOWALLFRAMES, ShowAllFrames); +} + +void AddMainMenuItem() { + CLISTMENUITEM menu; + ZeroMemory(&menu,sizeof(menu)); + menu.cbSize=sizeof(menu); + menu.flags = CMIM_ALL; + + menu.hIcon=LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_BLANK)); + + menu.pszName = (char *)Translate("Show all frames"); + menu.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES; + menu.position = 500100000; + CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu); +} + +int FramesModulesLoaded(WPARAM wParam, LPARAM lParam) { + SetCListVisible(IsWindowVisible((HWND)CallService(MS_CLUI_GETHWND, 0, 0))); + PositionFrames(); + AddMainMenuItem(); + return 0; +} + +LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + switch(msg) { + case WM_MOVE: + //PUShowMessage("move", SM_NOTIFY); + if(!IsWindowVisible(hwnd)) break; + { + + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + if(node) { + RECT r, clr; + HWND hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + GetWindowRect(hwndClist, &clr); + GetWindowRect(hwnd, &r); + + node->off_x = r.left - clr.left; + node->off_y = r.top - clr.top; + StoreFrameOffX(node->frame_data.name, node->off_x); + StoreFrameOffY(node->frame_data.name, node->off_y); + } + } + break; + case WM_SIZE: + //PUShowMessage("size", SM_NOTIFY); + //if(!IsWindowVisible(hwnd)) break; + { + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + if(node) { + HWND hwndChild = node->frame_data.hWnd; + RECT r, cr; + GetClientRect(hwnd, &r); + GetWindowRect(hwndChild, &cr); + SetWindowPos(hwndChild, HWND_TOP, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_SHOWWINDOW); + //SetWindowPos(hwndChild, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE); + if(cr.left != r.left || cr.top != r.top || cr.right != r.right || cr.bottom != r.bottom) { + cr = r; + GetWindowRect(hwnd, &r); + // frame_data.height is client height + // but node width and height are frame + if(node->frame_data.Flags & F_UNCOLLAPSED) { + node->frame_data.height = cr.bottom - cr.top; + node->height = r.bottom - r.top; + StoreFrameHeight(node->frame_data.name, node->height); + } + node->width = r.right - r.left; + StoreFrameWidth(node->frame_data.name, node->width); + PositionFrames(); + } + + if(node->size_move) + node->sizing = TRUE; + UpdateWindow(hwnd); + } + } + break; + case WM_ENTERSIZEMOVE: + { + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + if(node) node->size_move = TRUE; + } + break; + case WM_EXITSIZEMOVE: + { + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + if(node) node->size_move = node->sizing = FALSE; + } + break; + case WM_CLOSE: + { + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + if(node) ShowHideFrame(node->id, 0); + } + return 0; + case WM_NCLBUTTONDBLCLK: + //PUShowMessage("dbl click", SM_NOTIFY); + { + HRESULT hr = DefWindowProc(hwnd, WM_NCHITTEST, 0, lParam); + if(hr == HTCAPTION) { + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + if(node) { + node->frame_data.Flags ^= F_UNCOLLAPSED; + StoreFrameFlags(node->frame_data.name, node->frame_data.Flags); + PositionFrames(); + } + } + } + break; + case WM_WINDOWPOSCHANGING: + { + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + if(node) { + WINDOWPOS *winpos = (WINDOWPOS *)lParam; + HWND hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + struct FrameListNode *current; + + if(IsWindowVisible(hwndClist)) + SendMessage(hwnd, WMU_SNAPTO, (WPARAM)hwndClist, (LPARAM)winpos); + + EnterCriticalSection(&cs); + current = frame_list; + while(current) { + if(IsWindowVisible(current->hwndParent)) + SendMessage(hwnd, WMU_SNAPTO, (WPARAM)current->hwndParent, (LPARAM)winpos); + current = current->next; + } + LeaveCriticalSection(&cs); + + //PositionFrames(); + } + } + return 0; + //break; + case WMU_SNAPTO: + { + BOOL snapped = FALSE; + WINDOWPOS *winpos = (WINDOWPOS *)lParam; + HWND hwndOther = (HWND)wParam; + RECT sr; + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + + if(node && GetWindowRect(hwndOther,&sr)) { + if((winpos->x <= (sr.right + SNAP_THRESH)) && (winpos->x >= (sr.right - SNAP_THRESH))) { + if ((winpos->y + winpos->cy >= sr.top) && (winpos->y <= sr.bottom)) { + snapped = TRUE; + if(node->sizing) winpos->cx += winpos->x - sr.right; + winpos->x = sr.right; + } + } + + if((winpos->x + winpos->cx <= (sr.left + SNAP_THRESH)) && (winpos->x + winpos->cx >= (sr.left - SNAP_THRESH))) { + if ((winpos->y + winpos->cy >= sr.top) && (winpos->y <= sr.bottom)) { + snapped = TRUE; + + if(node->sizing) winpos->cx = sr.left - winpos->x; + else winpos->x = sr.left - winpos->cx; + } + } + + if((winpos->y <= (sr.bottom + SNAP_THRESH)) && (winpos->y >= (sr.bottom - SNAP_THRESH))) { + if ((winpos->x + winpos->cx >= sr.left) && (winpos->x <= sr.right)) { + snapped = TRUE; + if(node->sizing) winpos->cy += winpos->y - sr.bottom; + winpos->y = sr.bottom; + } + } + + if((winpos->y + winpos->cy <= (sr.top + SNAP_THRESH)) && (winpos->y + winpos->cy >= (sr.top - SNAP_THRESH))) { + if ((winpos->x + winpos->cx >= sr.left) && (winpos->x <= sr.right)) { + snapped = TRUE; + + if(node->sizing) winpos->cy = sr.top - winpos->y; + else winpos->y = sr.top - winpos->cy; + } + } + + if((winpos->x <= (sr.left + SNAP_THRESH)) && (winpos->x >= (sr.left - SNAP_THRESH))) { + if ((winpos->y + winpos->cy == sr.top) || (winpos->y == sr.bottom)) { + snapped = TRUE; + if(node->sizing) winpos->cx += winpos->x - sr.left; + winpos->x = sr.left; + } + } + + if((winpos->x + winpos->cx <= (sr.right + SNAP_THRESH)) && (winpos->x + winpos->cx >= (sr.right - SNAP_THRESH))) { + if ((winpos->y + winpos->cy == sr.top) || (winpos->y == sr.bottom)) { + snapped = TRUE; + if(node->sizing) winpos->cx = sr.right - winpos->x; + else winpos->x = sr.right - winpos->cx; + } + } + + if((winpos->y <= (sr.top + SNAP_THRESH)) && (winpos->y >= (sr.top - SNAP_THRESH))) { + if ((winpos->x + winpos->cx == sr.left) || (winpos->x == sr.right)) { + snapped = TRUE; + if(node->sizing) winpos->cy += winpos->y - sr.top; + winpos->y = sr.top; + } + } + + if((winpos->y + winpos->cy <= (sr.bottom + SNAP_THRESH)) && (winpos->y + winpos->cy >= (sr.bottom - SNAP_THRESH))) { + if ((winpos->x + winpos->cx == sr.left) || (winpos->x == sr.right)) { + snapped = TRUE; + if(node->sizing) winpos->cy = sr.bottom - winpos->y; + else winpos->y = sr.bottom - winpos->cy; + } + } + } + return snapped; + } + /* + case WM_SHOWWINDOW: + { + struct FrameListNode *node = (struct FrameListNode *)GetWindowLong(hwnd, GWL_USERDATA); + if(!node) break; + if (lParam) + break; + if (!DBGetContactSettingByte(NULL, "CLUI", "FadeInOut", 0) || !IsWinVer2000Plus()) + break; + if(!(node->frame_data.Flags & F_VISIBLE)) + break; + if (wParam) + SetForegroundWindow(hwnd); + if(MyAnimateWindow) + MyAnimateWindow(hwnd, 200, AW_BLEND | (wParam ? 0 : AW_HIDE)); + //SetWindowPos(cli.hwndContactTree, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + } + break; + */ + } + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +void InitFrames() { + WNDCLASS wndclass; + + hUserDll = LoadLibraryA("user32.dll"); + if (hUserDll) { + MyFramesSetLayeredWindowAttributes = (BOOL(WINAPI *) (HWND, COLORREF, BYTE, DWORD)) GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); + MyAnimateWindow = (BOOL(WINAPI *) (HWND, DWORD, DWORD)) GetProcAddress(hUserDll, "AnimateWindow"); + } + + wndclass.style = CS_VREDRAW | CS_HREDRAW | CS_GLOBALCLASS; + wndclass.lpfnWndProc = FrameWindowProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = g_hInst; + wndclass.hIcon = 0; + wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); + wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = _T("CListFrameClass"); + RegisterClass(&wndclass); + + InitializeCriticalSection(&cs); + + MakeFrameServices(); +} + +void DeinitFrames() { + struct FrameListNode *current; + + EnterCriticalSection(&cs); + current = frame_list; + while(current) { + DestroyWindow(current->hwndParent); + + frame_list = current->next; + free(current->frame_data.name); + free(current); + current = frame_list; + } + LeaveCriticalSection(&cs); + DeleteCriticalSection(&cs); + + UnregisterClass(_T("CListFrameClas"), g_hInst); + + if(hUserDll) + FreeLibrary(hUserDll); +} \ No newline at end of file diff --git a/clist_classic_sje/icon1.ico b/clist_classic_sje/icon1.ico new file mode 100644 index 0000000..171f5dd Binary files /dev/null and b/clist_classic_sje/icon1.ico differ diff --git a/clist_classic_sje/init.c b/clist_classic_sje/init.c new file mode 100644 index 0000000..b9a26c2 --- /dev/null +++ b/clist_classic_sje/init.c @@ -0,0 +1,182 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2005 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" + +HINSTANCE g_hInst = 0; +PLUGINLINK *pluginLink; +CLIST_INTERFACE* pcli = NULL; +HIMAGELIST himlCListClc = NULL; + +extern int currentDesiredStatusMode; + +struct MM_INTERFACE mmi; +BOOL(WINAPI * MySetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD) = NULL; + +///////////////////////////////////////////////////////////////////////////////////////// +// external functions + +void InitCustomMenus( void ); +void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint); + +int ClcOptInit(WPARAM wParam, LPARAM lParam); +int CluiOptInit(WPARAM wParam, LPARAM lParam); +int CListOptInit(WPARAM wParam, LPARAM lParam); + +void ReplaceCListWndProc(CLIST_INTERFACE *pcli); +void AddMetaMods(CLIST_INTERFACE *pcli); + +void InitFrames(); +int FramesModulesLoaded(WPARAM wParam, LPARAM lParam); +void DeinitFrames(); + +///////////////////////////////////////////////////////////////////////////////////////// +// dll stub + +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved) +{ + g_hInst = hInstDLL; + DisableThreadLibraryCalls(g_hInst); + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// returns the plugin information + +PLUGININFO pluginInfo = { + sizeof(PLUGININFO), + #if defined( _UNICODE ) + "Classic contact list [sje mod] (Unicode)", + #else + "Classic contact list [sje mod]", + #endif + PLUGIN_MAKE_VERSION(0, 2, 4, 1), + + "Display contacts, event notifications, protocol status", + "Miranda IM project", + "mail@scottellis.com.au", + "Copyright 2000-2006 Miranda IM project, 2006 Scott Ellis", + "http://www.scottellis.com.au", + UNICODE_AWARE, + DEFMOD_CLISTALL +}; + +__declspec(dllexport) PLUGININFO *MirandaPluginInfo(DWORD mirandaVersion) +{ + if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 4, 3, 0)) + return NULL; + return &pluginInfo; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// called when all modules got loaded + +static int OnModulesLoaded( WPARAM wParam, LPARAM lParam ) +{ + + himlCListClc = (HIMAGELIST) CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); + + if(ServiceExists(MS_MC_DISABLEHIDDENGROUP)) + CallService(MS_MC_DISABLEHIDDENGROUP, 1, 0); + + //HookEvent(ME_SYSTEM_MODULESLOADED, FramesModulesLoaded); + + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// options iniatialization + +static int OnOptsInit(WPARAM wParam, LPARAM lParam) +{ + ClcOptInit(wParam, lParam); + CluiOptInit(wParam, lParam); + CListOptInit(wParam, lParam); + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// menu status services + +static int GetStatusMode(WPARAM wParam, LPARAM lParam) +{ + return pcli->currentDesiredStatusMode; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// main clist initialization routine + +int __declspec(dllexport) CListInitialise(PLUGINLINK * link) +{ + int rc = 0; + pluginLink = link; + #ifdef _DEBUG + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + #endif + + // get the internal malloc/free() + mir_getMMI( &mmi ); + + pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); + if ( (int)pcli == CALLSERVICE_NOTFOUND ) { +LBL_Error: + MessageBoxA( NULL, "This version of plugin requires Miranda IM 0.7.0.8 or later", "Fatal error", MB_OK ); + return 1; + } + if ( pcli->version < 4 ) + goto LBL_Error; + + pcli->pfnPaintClc = PaintClc; + + ReplaceCListWndProc(pcli); + AddMetaMods(pcli); + //InitFrames(); + + MySetLayeredWindowAttributes = (BOOL(WINAPI *) (HWND, COLORREF, BYTE, DWORD)) GetProcAddress( + LoadLibraryA("user32.dll"), "SetLayeredWindowAttributes"); + + CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode); + + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_OPT_INITIALISE, OnOptsInit); + + InitCustomMenus(); + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// a plugin loader aware of CList exports will never call this. + +int __declspec(dllexport) Load(PLUGINLINK * link) +{ + return 1; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// a plugin unloader + +int __declspec(dllexport) Unload(void) +{ + //DeinitFrames(); + return 0; +} diff --git a/clist_classic_sje/meta_mod.c b/clist_classic_sje/meta_mod.c new file mode 100644 index 0000000..ed50996 --- /dev/null +++ b/clist_classic_sje/meta_mod.c @@ -0,0 +1,126 @@ +#include "commonheaders.h" + +CLIST_INTERFACE cli = {0}; + +void ( *pfnOldAddContactToTree )( HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline); + +void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline) +{ + if(!DBGetContactSettingByte(0, "MetaContacts", "Enabled", 1) || !DBGetContactSettingByte(hContact, "MetaContacts", "IsSubcontact", 0)) + pfnOldAddContactToTree(hwnd, dat, hContact, updateTotalCount, checkHideOffline); +} + + +void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) +{ + char *szProto; + DWORD style = GetWindowLong(hwnd, GWL_STYLE); + HANDLE hContact; + struct ClcGroup *group; + DBVARIANT dbv; + + dat->list.expanded = 1; + dat->list.hideOffline = DBGetContactSettingByte(NULL, "CLC", "HideOfflineRoot", 0); + dat->list.cl.count = dat->list.cl.limit = 0; + dat->selection = -1; + { + int i; + TCHAR *szGroupName; + DWORD groupFlags; + + for (i = 1;; i++) { + szGroupName = cli.pfnGetGroupName(i, &groupFlags); + if (szGroupName == NULL) + break; + cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0); + } + } + + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + while (hContact) { + if ((style & CLS_SHOWHIDDEN || !DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) + && (!DBGetContactSettingByte(0, "MetaContacts", "Enabled", 1) || !DBGetContactSettingByte(hContact, "MetaContacts", "IsSubcontact", 0))) + { + if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) + group = &dat->list; + else { + group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, (DWORD) - 1, 0, 0); + mir_free(dbv.ptszVal); + } + + if (group != NULL) { + group->totalMembers++; + 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)) + cli.pfnAddContactToGroup(dat, group, hContact); + } + else if (!cli.pfnIsHiddenMode(dat, DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE))) + cli.pfnAddContactToGroup(dat, group, hContact); + } + else cli.pfnAddContactToGroup(dat, group, hContact); + } + } + hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); + } + + if (style & CLS_HIDEEMPTYGROUPS) { + group = &dat->list; + group->scanIndex = 0; + for (;;) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + if (group == NULL) + break; + } + else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + if (group->cl.items[group->scanIndex]->group->cl.count == 0) { + group = cli.pfnRemoveItemFromGroup(hwnd, group, group->cl.items[group->scanIndex], 0); + } + else { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + } + continue; + } + group->scanIndex++; + } + } + + cli.pfnSortCLC(hwnd, dat, 0); +} + +int SettingChanged(WPARAM wParam, LPARAM lParam) { + HANDLE hContact = (HANDLE)wParam; + + if(!hContact) { + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; + if(strcmp(cws->szModule, "MetaContacts") == 0 && strcmp(cws->szSetting, "Enabled") == 0) + cli.pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0); // causes list rebuild + + return 0; + } + + if(!DBGetContactSettingByte(0, "MetaContacts", "Enabled", 1)) return 0; + + { + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; + if(strcmp(cws->szSetting, "IsSubcontact") == 0) + cli.pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0); // causes list rebuild + return 0; + } + + return 0; +} + +void AddMetaMods(CLIST_INTERFACE *pcli) { + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged); + + pfnOldAddContactToTree = pcli->pfnAddContactToTree; + pcli->pfnAddContactToTree = fnAddContactToTree; + + pcli->pfnRebuildEntireList = fnRebuildEntireList; + cli = *pcli; // this should be fixed +} + diff --git a/clist_classic_sje/meta_mod.h b/clist_classic_sje/meta_mod.h new file mode 100644 index 0000000..acd058a --- /dev/null +++ b/clist_classic_sje/meta_mod.h @@ -0,0 +1,28 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include + +void AddMetaMods(CLIST_INTERFACE *pcli); + + + diff --git a/clist_classic_sje/mod.c b/clist_classic_sje/mod.c new file mode 100644 index 0000000..0b82f29 --- /dev/null +++ b/clist_classic_sje/mod.c @@ -0,0 +1,303 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#define DCX_USESTYLE 0x10000 + +LRESULT (CALLBACK *oldContactListWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) = 0; +LRESULT (CALLBACK *oldContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) = 0; +LRESULT (CALLBACK *oldStatusBarWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) = 0; + +void PositionFrames(); +void SetCListVisible(BOOL clist_visible); + +//--------------------- patch by TioDuke to implement ME_CLIST_FRAMES_SB_SHOW/HIDE_TOOLTIP events --------------- +#define TM_STATUSBAR 23435234 + +POINT lastpnt={0}; +BOOL tooltipshoing=FALSE; + +HANDLE hStatusBarShowToolTipEvent=NULL, hStatusBarHideToolTipEvent=NULL; + +#define ME_CLIST_FRAMES_SB_SHOW_TOOLTIP "CListFrames/StatusBarShowToolTip" +#define ME_CLIST_FRAMES_SB_HIDE_TOOLTIP "CListFrames/StatusBarHideToolTip" +//--------------------------------------------------------------------------------------------------------------- + +LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + switch(msg) { + case WM_NCHITTEST: + { + LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam); + if(lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT + || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) + return HTTRANSPARENT; + break; + } + } + + return oldContactListControlWndProc(hwnd, msg, wParam, lParam); +} + +LRESULT CALLBACK StatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + switch(msg) { + case WM_CREATE: + tooltipshoing = FALSE; + break; + case WM_TIMER: + if (wParam == TM_STATUSBAR) { + POINT pt; + + KillTimer(hwnd, TM_STATUSBAR); + GetCursorPos(&pt); + if (pt.x == lastpnt.x && pt.y == lastpnt.y) { + int i, nParts; + RECT rc; + char *szProto; + + ScreenToClient(hwnd, &pt); + nParts = SendMessage(hwnd, SB_GETPARTS, 0, 0); + for (i=0; i < nParts; i++) { + SendMessage(hwnd, SB_GETRECT, i, (LPARAM)&rc); + if (PtInRect(&rc, pt)) { + szProto = (char *)SendMessage(hwnd, SB_GETTEXT, i, 0); + if (!szProto) + return CallWindowProc(oldStatusBarWndProc, hwnd, msg, wParam, lParam); + NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)szProto, 0); + tooltipshoing = TRUE; + } + } + } + } + break; + case WM_SETCURSOR: + { + POINT pt; + + GetCursorPos(&pt); + if (pt.x == lastpnt.x && pt.y == lastpnt.y) + return CallWindowProc(oldStatusBarWndProc, hwnd, msg, wParam, lParam); + lastpnt = pt; + if (tooltipshoing) { + NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0); + tooltipshoing = FALSE; + } + KillTimer(hwnd, TM_STATUSBAR); + SetTimer(hwnd, TM_STATUSBAR, DBGetContactSettingWord(NULL, "CLC","InfoTipHoverTime", 750), 0); + } + break; + case WM_ERASEBKGND: + if(DBGetContactSettingByte(0, "CLUI", "SBarCLCBkGnd", 0)) { + HDC hdc = (HDC)wParam; + RECT r; + HBRUSH hBrush = CreateSolidBrush((COLORREF)DBGetContactSettingDword(0, "CLC", "BkColour", COLOR_3DSHADOW)); + GetClientRect(hwnd, &r); + FillRect(hdc, &r, hBrush); + DeleteObject(hBrush); + return 1; + } + break; + case WM_NCHITTEST: + { + LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam); + if(lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT + || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) + return HTTRANSPARENT; + break; + } + } + + return CallWindowProc(oldStatusBarWndProc, hwnd, msg, wParam, lParam); +} + + +#define M_PAINTFRAME (WM_USER+0x08) +LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + switch(msg) { + case WM_CREATE: + { + HRESULT hr = oldContactListWndProc(hwnd, msg, wParam, lParam); + oldStatusBarWndProc = (WNDPROC)SetWindowLong(pcli->hwndStatus, GWL_WNDPROC, (LONG)StatusBarWndProc); + return hr; + } + //case WM_CREATE: + case (WM_USER + 1): //M_CREATECLC: + { + LRESULT ret = oldContactListWndProc(hwnd, msg, wParam, lParam); + if(DBGetContactSettingByte(0, "CList", "NoBorder", 0) && !DBGetContactSettingByte(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT)) { + //SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_TOOLWINDOW); + SetWindowLong(pcli->hwndContactList, GWL_STYLE, + GetWindowLong(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_THICKFRAME)); + SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + //RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + } + return ret; + } + case WM_NCHITTEST: + { + if(DBGetContactSettingByte(0, "CList", "NoBorder", 0) && !DBGetContactSettingByte(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT)) { + POINT pt; + RECT r; + HRESULT hr; + GetClientRect(hwnd, &r); + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + ScreenToClient(hwnd, &pt); + + // allow for HTSIZE + hr = DefWindowProc(hwnd, WM_NCHITTEST, wParam, lParam); + if(hr == HTCLIENT) { + if(pt.x > GetSystemMetrics(SM_CXFRAME) && pt.x < r.right - GetSystemMetrics(SM_CXFRAME)) { + if(pt.y > GetSystemMetrics(SM_CYFRAME) && pt.y < r.bottom - GetSystemMetrics(SM_CYFRAME)) + hr = HTCLIENT; + else if(pt.y < GetSystemMetrics(SM_CYFRAME)) + hr = HTTOP; + else if(pt.y > r.bottom - GetSystemMetrics(SM_CYFRAME)) + hr = HTBOTTOM; + } else if(pt.x < GetSystemMetrics(SM_CXFRAME)) { + if(pt.y > GetSystemMetrics(SM_CYFRAME) && pt.y < r.bottom - GetSystemMetrics(SM_CYFRAME)) + hr = HTLEFT; + else if(pt.y < GetSystemMetrics(SM_CYFRAME)) + hr = HTTOPLEFT; + else if(pt.y > r.bottom - GetSystemMetrics(SM_CYFRAME)) + hr = HTBOTTOMLEFT; + } else if(pt.x > r.right - GetSystemMetrics(SM_CXFRAME)) { + if(pt.y > 5 && pt.y < r.bottom - GetSystemMetrics(SM_CYFRAME)) + hr = HTRIGHT; + else if(pt.y < GetSystemMetrics(SM_CYFRAME)) + hr = HTTOPRIGHT; + else if(pt.y > r.bottom - GetSystemMetrics(SM_CYFRAME)) + hr = HTBOTTOMRIGHT; + } + } + + if (hr == HTSIZE || hr == HTTOP || hr == HTTOPLEFT || hr == HTTOPRIGHT || + hr == HTBOTTOM || hr == HTBOTTOMRIGHT || hr == HTBOTTOMLEFT) + if (DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0)) + hr = HTCLIENT; + + return hr; + } + + } + break; + case WM_CONTEXTMENU: + { + RECT rc; + POINT pt; + CLIST_INTERFACE cli = *( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); + + + pt.x = (short) LOWORD(lParam); + pt.y = (short) HIWORD(lParam); + // x/y might be -1 if it was generated by a kb click + GetWindowRect(cli.hwndContactTree, &rc); + if (pt.x == -1 && pt.y == -1) { + // all this is done in screen-coords! + GetCursorPos(&pt); + // the mouse isnt near the window, so put it in the middle of the window + if (!PtInRect(&rc, pt)) { + pt.x = rc.left + (rc.right - rc.left) / 2; + pt.y = rc.top + (rc.bottom - rc.top) / 2; + } + } + if (PtInRect(&rc, pt)) { + HMENU hMainMenu = LoadMenu(cli.hInst, MAKEINTRESOURCE(IDR_CONTEXT)), + hMenu = GetSubMenu(hMainMenu, 1); + + { + MENUITEMINFO mi; + ZeroMemory(&mi, sizeof(mi)); + mi.cbSize = MENUITEMINFO_V4_SIZE; + mi.fMask = MIIM_SUBMENU | MIIM_TYPE; + mi.fType = MFT_STRING; + mi.hSubMenu = (HMENU) CallService(MS_CLIST_MENUGETMAIN, 0, 0); + mi.dwTypeData = _T("&Main Menu"); + SetMenuItemInfo(hMenu, 9, TRUE, &mi); + } + + + CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM) hMenu, 0); + CheckMenuItem(hMenu, POPUP_HIDEOFFLINE, + DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, POPUP_HIDEOFFLINEROOT, SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, POPUP_HIDEEMPTYGROUPS, + GetWindowLong(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, POPUP_DISABLEGROUPS, GetWindowLong(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? MF_UNCHECKED : MF_CHECKED); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); + RemoveMenu(hMenu, 9, MF_BYPOSITION); + DestroyMenu(hMainMenu); + return 0; + } + GetWindowRect(cli.hwndStatus, &rc); + if (PtInRect(&rc, pt)) { + HMENU hMenu; + if (DBGetContactSettingByte(NULL, "CLUI", "SBarRightClk", 0)) + hMenu = (HMENU) CallService(MS_CLIST_MENUGETMAIN, 0, 0); + else + hMenu = (HMENU) CallService(MS_CLIST_MENUGETSTATUS, 0, 0); + TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); + return 0; + } } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case POPUP_OPTIONS: + { + OPENOPTIONSDIALOG ood = {0}; + ood.cbSize = sizeof(ood); + CallService(MS_OPT_OPENOPTIONS, 0, (LPARAM)&ood); + } + return TRUE; + case POPUP_EXIT: + SendMessage((HWND)CallService(MS_CLUI_GETHWND, 0, 0), WM_DESTROY, 0, 0); + return TRUE; + } + break; + + /* + case WM_MOVE: + case WM_SIZE: + case WM_STYLECHANGED: + PositionFrames(); + break; + case WM_SHOWWINDOW: + SetCListVisible(wParam); + PositionFrames(); + break; + */ + } + + //return CallWindowProc(oldContactListWndProc, hwnd, msg, wParam, lParam); + return oldContactListWndProc(hwnd, msg, wParam, lParam); +} + +void ReplaceCListWndProc(CLIST_INTERFACE *pcli) { + oldContactListWndProc = pcli->pfnContactListWndProc; + pcli->pfnContactListWndProc = ContactListWndProc; + + oldContactListControlWndProc = pcli->pfnContactListControlWndProc; + pcli->pfnContactListControlWndProc = ContactListControlWndProc; + + hStatusBarShowToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP); + hStatusBarHideToolTipEvent = CreateHookableEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP); +} diff --git a/clist_classic_sje/mod.h b/clist_classic_sje/mod.h new file mode 100644 index 0000000..862aae9 --- /dev/null +++ b/clist_classic_sje/mod.h @@ -0,0 +1,30 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include + +void ReplaceCListWndProc(CLIST_INTERFACE *pcli); + + +//LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +//extern LRESULT (CALLBACK *oldContactListWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/clist_classic_sje/options.c b/clist_classic_sje/options.c new file mode 100644 index 0000000..9381923 --- /dev/null +++ b/clist_classic_sje/options.c @@ -0,0 +1,384 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "commonheaders.h" +#include "../../include/m_utils.h" +#include "../../include/m_trigger.h" +#include "../updater/m_updater.h" + +#include + +#include "database.h" +#include "options.h" + +extern HINSTANCE g_hInst; +Options options; + + +#define SUB_DIR "\\AutoBackups" +int GetProfileDirectory(char *szPath,int cbPath) { + return CallService(MS_DB_GETPROFILEPATH, (WPARAM)cbPath, (LPARAM)szPath); +} + +int Backup(void); +int BackupService(WPARAM wParam, LPARAM lParam); +int SetBackupTimer(void); + +int LoadOptions(void) { + DBVARIANT dbv; + + options.backup_types = (BackupType)DBGetContactSettingByte(0, "db3x", "BackupType", (BYTE)(BT_EXIT | BT_PERIODIC)); + options.period = (unsigned int)DBGetContactSettingWord(0, "db3x", "Period", 1); + options.period_type = (PeriodType)DBGetContactSettingByte(0, "db3x", "PeriodType", (BYTE)PT_DAYS); + + if(!DBGetContactSetting(0, "db3x", "Folder", &dbv) && dbv.type == DBVT_ASCIIZ) { + if(strlen(dbv.pszVal) >= 2 && dbv.pszVal[1] == ':') { + strncpy(options.folder, dbv.pszVal, MAX_PATH); + } else { + GetProfileDirectory(options.folder, MAX_PATH); + strcat(options.folder, "\\"); + strcat(options.folder, dbv.pszVal); + } + DBFreeVariant(&dbv); + } else { + int len; + GetProfileDirectory(options.folder, MAX_PATH); + len = strlen(options.folder); + strncat(options.folder, SUB_DIR, MAX_PATH - len); + } + + options.num_backups = (unsigned int)DBGetContactSettingWord(0, "db3x", "NumBackups", 3); + + options.disable_progress = (BOOL)DBGetContactSettingByte(0, "db3x", "NoProgress", 0); + + SetBackupTimer(); + return 0; +} + +int SaveOptions(void) { + char prof_dir[MAX_PATH]; + int prof_len, opt_len; + + DBWriteContactSettingByte(0, "db3x", "BackupType", (BYTE)options.backup_types); + DBWriteContactSettingWord(0, "db3x", "Period", (WORD)options.period); + DBWriteContactSettingByte(0, "db3x", "PeriodType", (BYTE)options.period_type); + + GetProfileDirectory(prof_dir, MAX_PATH); + strcat(prof_dir, "\\"); + prof_len = strlen(prof_dir); + opt_len = strlen(options.folder); + + if(opt_len > prof_len && strncmp(options.folder, prof_dir, prof_len) == 0) { + DBWriteContactSettingString(0, "db3x", "Folder", (options.folder + prof_len)); + } else + DBWriteContactSettingString(0, "db3x", "Folder", options.folder); + + DBWriteContactSettingWord(0, "db3x", "NumBackups", (WORD)options.num_backups); + DBWriteContactSettingByte(0, "db3x", "NoProgress", (BYTE)options.disable_progress); + + SetBackupTimer(); + return 0; +} + +Options new_options; + +int SetDlgState(HWND hwndDlg) { + HWND hwndCtrl; + char buff[10]; + + if(new_options.backup_types == BT_DISABLED) { + CheckDlgButton(hwndDlg, IDC_RAD_DISABLED, BST_CHECKED); + hwndCtrl = GetDlgItem(hwndDlg, IDC_RAD_DISABLED); + EnableWindow(hwndCtrl, FALSE); + + CheckDlgButton(hwndDlg, IDC_RAD_START, BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_RAD_EXIT, BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_RAD_PERIODIC, BST_UNCHECKED); + hwndCtrl = GetDlgItem(hwndDlg, IDC_ED_PERIOD); + EnableWindow(hwndCtrl, FALSE); + hwndCtrl = GetDlgItem(hwndDlg, IDC_RAD_DAYS); + EnableWindow(hwndCtrl, FALSE); + hwndCtrl = GetDlgItem(hwndDlg, IDC_RAD_HOURS); + EnableWindow(hwndCtrl, FALSE); + } else { + hwndCtrl = GetDlgItem(hwndDlg, IDC_RAD_DISABLED); + EnableWindow(hwndCtrl, TRUE); + CheckDlgButton(hwndDlg, IDC_RAD_DISABLED, BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_RAD_START, new_options.backup_types & BT_START ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_RAD_EXIT, new_options.backup_types & BT_EXIT ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_RAD_PERIODIC, new_options.backup_types & BT_PERIODIC ? BST_CHECKED : BST_UNCHECKED); + hwndCtrl = GetDlgItem(hwndDlg, IDC_ED_PERIOD); + EnableWindow(hwndCtrl, new_options.backup_types & BT_PERIODIC); + hwndCtrl = GetDlgItem(hwndDlg, IDC_RAD_DAYS); + EnableWindow(hwndCtrl, new_options.backup_types & BT_PERIODIC); + hwndCtrl = GetDlgItem(hwndDlg, IDC_RAD_HOURS); + EnableWindow(hwndCtrl, new_options.backup_types & BT_PERIODIC); + } + + SetDlgItemText(hwndDlg, IDC_ED_PERIOD, itoa(new_options.period, buff, 10)); + + switch(new_options.period_type) { + case PT_DAYS: + CheckDlgButton(hwndDlg, IDC_RAD_DAYS, BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_RAD_HOURS, BST_UNCHECKED); + break; + case PT_HOURS: + CheckDlgButton(hwndDlg, IDC_RAD_DAYS, BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_RAD_HOURS, BST_CHECKED); + break; + } + + SetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, itoa(new_options.num_backups, buff, 10)); + + SetDlgItemText(hwndDlg, IDC_ED_FOLDER, new_options.folder); + + CheckDlgButton(hwndDlg, IDC_CHK_NOPROG, new_options.disable_progress ? BST_CHECKED : BST_UNCHECKED); + + return 0; +} + +BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + char buff[10]; + char folder_buff[MAX_PATH]; + BROWSEINFO bi; + LPCITEMIDLIST pidl; + + switch ( msg ) { + case WM_INITDIALOG: + TranslateDialogDefault( hwndDlg ); + memcpy(&new_options, &options, sizeof(Options)); + SetDlgState(hwndDlg); + return TRUE; + case WM_COMMAND: + if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) { + switch( LOWORD( wParam )) { + case IDC_ED_PERIOD: + case IDC_ED_FOLDER: + case IDC_ED_NUMBACKUPS: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + } + if ( HIWORD( wParam ) == BN_CLICKED ) { + switch( LOWORD( wParam )) { + case IDC_RAD_DISABLED: + if(IsDlgButtonChecked(hwndDlg, IDC_RAD_DISABLED)) { + new_options.backup_types = BT_DISABLED; + } + SetDlgState(hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_RAD_START: + if(IsDlgButtonChecked(hwndDlg, IDC_RAD_START)) + new_options.backup_types |= BT_START; + else + new_options.backup_types &= ~BT_START; + SetDlgState(hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_RAD_EXIT: + if(IsDlgButtonChecked(hwndDlg, IDC_RAD_EXIT)) + new_options.backup_types |= BT_EXIT; + else + new_options.backup_types &= ~BT_EXIT; + SetDlgState(hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_RAD_PERIODIC: + if(IsDlgButtonChecked(hwndDlg, IDC_RAD_PERIODIC)) + new_options.backup_types |= BT_PERIODIC; + else + new_options.backup_types &= ~BT_PERIODIC; + SetDlgState(hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_RAD_DAYS: + new_options.period_type = PT_DAYS; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_RAD_HOURS: + new_options.period_type = PT_HOURS; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case IDC_BUT_BROWSE: + bi.hwndOwner = hwndDlg; + bi.pidlRoot = 0; + bi.pszDisplayName = folder_buff; + bi.lpszTitle = Translate("Select Backup Folder"); + bi.ulFlags = 0; + bi.lpfn = 0; + bi.lParam = 0; + bi.iImage = 0; + + if((pidl = SHBrowseForFolder(&bi)) != 0) { + SHGetPathFromIDList(pidl, folder_buff); + SetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff); + SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 ); + + CoTaskMemFree((void *)pidl); + } + break; + case IDC_BUT_NOW: + Backup(); + break; + case IDC_CHK_NOPROG: + new_options.disable_progress = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOPROG); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + } + + break; + case WM_NOTIFY: + if (((LPNMHDR)lParam)->code == PSN_APPLY ) { + GetDlgItemText(hwndDlg, IDC_ED_PERIOD, buff, sizeof(buff)); + new_options.period = atoi(buff); + GetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, buff, sizeof(buff)); + new_options.num_backups = atoi(buff); + GetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff, MAX_PATH); + + { + BOOL folder_ok = TRUE; + if(!CreateDirectory(folder_buff, 0)) { + DWORD err = GetLastError(); + if(err != ERROR_ALREADY_EXISTS) { + char msg_buff[512]; + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, msg_buff, 512, 0); + MessageBox(0, msg_buff, Translate("Error Creating Backup Folder"), MB_OK | MB_ICONERROR); + folder_ok = FALSE; + } + } + + if(folder_ok) { + strncpy(new_options.folder, folder_buff, MAX_PATH); + memcpy(&options, &new_options, sizeof(Options)); + SaveOptions(); + } else { + memcpy(&new_options, &options, sizeof(Options)); + SetDlgState(hwndDlg); + } + } + return TRUE; + + } + break; + } + + return FALSE; +} + +int OptInit(WPARAM wParam, LPARAM lParam) { + OPTIONSDIALOGPAGE odp = {0}; +#define OPTIONPAGE_OLD_SIZE2 60 + //odp.cbSize = sizeof(odp); + odp.cbSize = OPTIONPAGE_OLD_SIZE2; + odp.position = -790000000; + odp.hInstance = g_hInst; + odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS); + odp.pszTitle = Translate("Database Backups"); + odp.pszGroup = Translate("Services"); + odp.flags = ODPF_BOLDGROUPS; + odp.nIDBottomSimpleControl = 0; + odp.pfnDlgProc = DlgProcOpts; + CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp ); + + return 0; +} + +int ModulesLoaded(WPARAM wParam, LPARAM lParam) { + CLISTMENUITEM menu; + + HookEvent(ME_OPT_INITIALISE, OptInit); + + ZeroMemory(&menu,sizeof(menu)); + menu.cbSize=sizeof(menu); + menu.flags = CMIM_ALL; + + menu.hIcon=LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_MENU)); + + // main menu item + menu.pszName = (char *)Translate("Backup Profile"); + menu.pszService = MS_DB_BACKUP; + menu.position = 500100000; + CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu); + + // register trigger action for triggerplugin + if(ServiceExists(MS_TRIGGER_REGISTERACTION)) { + // create update action for triggerplugin + ACTIONREGISTER ar = {0}; + ar.cbSize = sizeof(ACTIONREGISTER); + ar.pszName = Translate("Backup Database"); + ar.pszService = MS_DB_BACKUPTRGR; + + CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar); + } + + + return 0; +} + +// can't do this on unload, since other plugins will be have already been unloaded, but their hooks +// for setting changed event not cleared. the backup on exit function will write to the db, calling those hooks. +int PreShutdown(WPARAM wParam, LPARAM lParam) { + if(options.backup_types & BT_EXIT) + Backup(); + + return 0; +} + +int BackupServiceTrgr(WPARAM wParam, LPARAM lParam) { + if(wParam & ACT_PERFORM) { + return CallService(MS_DB_BACKUP, 0, 0); + } + return 0; +} + +int InitOptions(void) { + + OleInitialize(0); + + CreateServiceFunction(MS_DB_BACKUP, BackupService); + CreateServiceFunction(MS_DB_BACKUPTRGR, BackupServiceTrgr); + + // we have to wait for the options module to load! + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + + HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); + + // but, our stuff has loaded so... + LoadOptions(); + + if(options.backup_types & BT_START) + Backup(); + + return 0; +} + +int UninitOptions(void) { + + OleUninitialize(); + + return 0; +} + diff --git a/clist_classic_sje/options.h b/clist_classic_sje/options.h new file mode 100644 index 0000000..5f027bc --- /dev/null +++ b/clist_classic_sje/options.h @@ -0,0 +1,42 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include "resource.h" + +typedef enum { BT_DISABLED = 0, BT_START = 1, BT_EXIT = 2, BT_PERIODIC = 4} BackupType; +typedef enum { PT_DAYS, PT_HOURS} PeriodType; + +typedef struct Options_tag { + int backup_types; + unsigned int period; + PeriodType period_type; + char folder[MAX_PATH]; + unsigned int num_backups; + BOOL disable_progress; +} Options; + + +#define MS_DB_BACKUP "DB/Backup" +#define MS_DB_BACKUPTRGR "DB/BackupTrigger" diff --git a/clist_classic_sje/res/blank.ico b/clist_classic_sje/res/blank.ico new file mode 100644 index 0000000..7845f62 Binary files /dev/null and b/clist_classic_sje/res/blank.ico differ diff --git a/clist_classic_sje/res/delete.ico b/clist_classic_sje/res/delete.ico new file mode 100644 index 0000000..9b0f0ff Binary files /dev/null and b/clist_classic_sje/res/delete.ico differ diff --git a/clist_classic_sje/res/dragcopy.cur b/clist_classic_sje/res/dragcopy.cur new file mode 100644 index 0000000..89c7c96 Binary files /dev/null and b/clist_classic_sje/res/dragcopy.cur differ diff --git a/clist_classic_sje/res/dropuser.cur b/clist_classic_sje/res/dropuser.cur new file mode 100644 index 0000000..a84b19e Binary files /dev/null and b/clist_classic_sje/res/dropuser.cur differ diff --git a/clist_classic_sje/res/hyperlin.cur b/clist_classic_sje/res/hyperlin.cur new file mode 100644 index 0000000..f0f548c Binary files /dev/null and b/clist_classic_sje/res/hyperlin.cur differ diff --git a/clist_classic_sje/res/rename.ico b/clist_classic_sje/res/rename.ico new file mode 100644 index 0000000..2c6bc2a Binary files /dev/null and b/clist_classic_sje/res/rename.ico differ diff --git a/clist_classic_sje/resource.h b/clist_classic_sje/resource.h new file mode 100644 index 0000000..3e69e1e --- /dev/null +++ b/clist_classic_sje/resource.h @@ -0,0 +1,51 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by resource.rc +// +#define IDC_NOTOALL 3 +#define IDD_INSTALLINI 235 +#define IDD_WARNINICHANGE 236 +#define IDD_INIIMPORTDONE 237 +#define IDD_OPTIONS 238 +#define IDD_COPYPROGRESS 239 +#define IDC_ININAME 1333 +#define IDC_VIEWINI 1334 +#define IDC_SECURITYINFO 1335 +#define IDC_SETTINGNAME 1336 +#define IDC_NEWVALUE 1337 +#define IDC_WARNNOMORE 1338 +#define IDC_DELETE 1339 +#define IDC_RECYCLE 1340 +#define IDC_NEWNAME 1341 +#define IDC_MOVE 1342 +#define IDC_LEAVE 1343 + +#define IDC_ED_PERIOD 1344 +#define IDC_RAD_DAYS 1345 +#define IDC_RAD_HOURS 1346 +#define IDC_ED_FOLDER 1347 +#define IDC_BUT_BROWSE 1348 +#define IDC_ED_NUMBACKUPS 1349 +#define IDC_BUT_NOW 1350 +#define IDC_CHK_NOPROG 1351 +#define IDC_RAD_DISABLED 1352 +#define IDC_RAD_START 1353 +#define IDC_RAD_EXIT 1354 +#define IDC_RAD_PERIODIC 1355 + +#define IDC_PROGRESS 1356 +#define IDC_PROGRESSMESSAGE 1357 + +#define IDI_MENU 240 + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 273 +#define _APS_NEXT_COMMAND_VALUE 40018 +#define _APS_NEXT_CONTROL_VALUE 1676 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/clist_classic_sje/resource.rc b/clist_classic_sje/resource.rc new file mode 100644 index 0000000..1b1d78b --- /dev/null +++ b/clist_classic_sje/resource.rc @@ -0,0 +1,583 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include +#include +#include + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DELETECONTACT DIALOGEX 0, 0, 284, 90 +STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "Delete Contact" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "No",IDNO,162,38,65,14 + PUSHBUTTON "Yes",IDYES,54,38,65,14 + CONTROL "Hide from list only, in order to keep their history and ignore/visibility settings",IDC_HIDE, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,65,270,9 + LTEXT "Use Options->Ignore (expert mode) to unhide contacts.",IDC_STATIC,20,78,257,8 + CONTROL "Are you sure you want to delete %s?",IDC_TOPLINE,"Static",SS_SIMPLE | SS_NOPREFIX | WS_GROUP,7,7,270,8 + LTEXT "This will erase all history and settings for this contact!",IDC_STATIC,7,18,239,14 +END + +IDD_OPT_HOTKEY DIALOGEX 0, 0, 238, 136 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Hotkeys",IDC_STATIC,4,4,230,126 + CONTROL "Show/Hide:",IDC_SHOWHIDE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,14,19,78,9 + CONTROL "HotKey1",IDC_HKSHOWHIDE,"msctls_hotkey32",WS_BORDER | + WS_TABSTOP,92,17,93,12 + CONTROL "Read Message:",IDC_READMSG,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,14,36,78,9 + CONTROL "HotKey1",IDC_HKREADMSG,"msctls_hotkey32",WS_BORDER | + WS_TABSTOP,92,34,93,12 + CONTROL "Web Search:",IDC_NETSEARCH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,14,53,78,9 + CONTROL "HotKey1",IDC_HKSEARCH,"msctls_hotkey32",WS_BORDER | + WS_TABSTOP,92,51,93,12 + LTEXT "URL:",IDC_HOTKEYURLSTR,26,71,22,8 + EDITTEXT IDC_SEARCHURL,92,69,136,12,ES_AUTOHSCROLL + CONTROL "Open in new browser window",IDC_SEARCHNEWWND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,86,136,10 + CONTROL "Show Options",IDC_SHOWOPTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,107,71,9 + CONTROL "HotKey1",IDC_HKSHOWOPTIONS,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,92,105,93,12 +END + +IDD_OPT_CLIST DIALOGEX 0, 0, 314, 204 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Hide offline users",IDC_HIDEOFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,17,124,10 + CONTROL "Hide empty groups",IDC_HIDEEMPTYGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,33,124,10 + CONTROL "Disable groups",IDC_DISABLEGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,50,124,10 + CONTROL "Ask before deleting contacts",IDC_CONFIRMDELETE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,67,124,10 + CONTROL "Sort contacts by name",IDC_SORTBYNAME,"Button",BS_AUTORADIOBUTTON | WS_GROUP,153,14,144,10 + CONTROL "Sort contacts by status",IDC_SORTBYSTATUS,"Button",BS_AUTORADIOBUTTON,153,26,149,10 + CONTROL "Sort contacts by protocol",IDC_SORTBYPROTO,"Button",BS_AUTORADIOBUTTON,153,38,151,10 + CONTROL "Single click interface",IDC_ONECLK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,68,150,10 + CONTROL "Always show status in tooltip",IDC_ALWAYSSTATUS,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,152,81,151,11 + CONTROL "Disable icon blinking",IDC_DISABLEBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,95,86,9 + EDITTEXT IDC_BLINKTIME,153,109,35,12,ES_NUMBER + LTEXT "ms delay",IDC_STMSDELAY,192,110,113,8 + CONTROL "Show",IDC_DONTCYCLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,10,143,97,10 + COMBOBOX IDC_PRIMARYSTATUS,107,142,78,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "icon when statuses differ",IDC_STATIC,189,144,116,8,NOT WS_GROUP + CONTROL "Cycle icons every",IDC_CYCLE,"Button",BS_AUTORADIOBUTTON,10,160,97,10 + EDITTEXT IDC_CYCLETIME,107,159,30,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_CYCLETIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,127,158,10,14 + LTEXT "seconds, when statuses differ",IDC_STATIC,140,161,165,8,NOT WS_GROUP + CONTROL "Show multiple icons",IDC_MULTITRAY,"Button",BS_AUTORADIOBUTTON,10,177,98,10 + CONTROL "Only when statuses differ",IDC_ALWAYSMULTI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,177,198,10 + GROUPBOX "Contact List",IDC_STCLISTGROUP,2,2,135,126 + GROUPBOX "System tray icon",IDC_STATIC,143,57,169,70 + GROUPBOX "System tray icon when using multiple protocols",IDC_STATIC,2,131,310,66 + GROUPBOX "Contact List Sorting",IDC_STATIC,143,2,169,54,WS_GROUP + CONTROL "Spin5",IDC_BLINKSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,173,97,11,21 + CONTROL "Disable icon blinking",IDC_ICONBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,84,97,10 +END + +IDD_OPT_CLUI DIALOGEX 0, 0, 313, 245 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Window",IDC_STWINDOWGROUP,4,4,305,154 + CONTROL "Always on top",IDC_ONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,18,128,10 + CONTROL "Tool style main window",IDC_TOOLWND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,32,128,10 + CONTROL "Minimize to tray",IDC_MIN2TRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,46,128,10 + CONTROL "Hide contact list after it has been idle for",IDC_AUTOHIDE, + "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,141,18,162,10 + EDITTEXT IDC_HIDETIME,151,33,30,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_HIDETIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,172,32,10,14 + LTEXT "seconds",IDC_STATIC01,186,35,56,8 + CONTROL "Automatically resize window to height of list",IDC_AUTOSIZE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,141,55,162,10 + LTEXT "maximum",IDC_STATIC21,151,72,45,8 + EDITTEXT IDC_MAXSIZEHEIGHT,197,70,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Spin1",IDC_MAXSIZESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,218,69,10,14 + LTEXT "% of screen",IDC_STATIC22,230,72,69,8 + CONTROL "Size upwards",IDC_AUTOSIZEUPWARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,151,86,147,10 + LTEXT "Title bar text:",IDC_STATIC,12,106,51,8 + GROUPBOX "Translucency options (Windows 2000/XP only)",IDC_STATIC,4,161,305,80 + CONTROL "Fade contact list in/out",IDC_FADEINOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,174,163,10 + CONTROL "Transparent contact list",IDC_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,191,151,9 + LTEXT "Inactive opacity:",IDC_STATIC11,23,206,89,8 + CONTROL "Slider2",IDC_TRANSINACTIVE,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,112,205,130,11 + LTEXT "Active opacity:",IDC_STATIC12,23,221,89,8 + CONTROL "Slider2",IDC_TRANSACTIVE,"msctls_trackbar32",TBS_TOP | TBS_NOTICKS | WS_TABSTOP,112,221,130,11 + LTEXT "000%",IDC_INACTIVEPERC,246,206,29,8,SS_NOPREFIX + LTEXT "000%",IDC_ACTIVEPERC,246,222,29,8,SS_NOPREFIX + CONTROL "Show menu bar",IDC_SHOWMAINMENU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,60,128,10 + CONTROL "Easy move",IDC_CLIENTDRAG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,74,128,10 + CONTROL "Show title bar",IDC_SHOWCAPTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,88,128,10 + CONTROL "If window is partially covered, bring to front instead of hiding",IDC_BRINGTOFRONT, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,141,102,162,16 + EDITTEXT IDC_TITLETEXT,63,104,72,12,ES_AUTOHSCROLL + CONTROL "Show drop shadow (restart required)",IDC_DROPSHADOW, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,122,138,10 + CONTROL "Pin to desktop",IDC_ONDESKTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,137,125,10 + CONTROL "No frame border",IDC_NOBORDER,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,141,133,162,16 +END + +IDD_OPT_CLC DIALOGEX 0, 0, 314, 251 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Items",IDC_STATIC,2,2,310,114 + CONTROL "Show divider between online and offline contacts",IDC_DIVIDERONOFF, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,13,179,10 + CONTROL "Hot track items as mouse passes over",IDC_TRACKSELECT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,28,179,10 + CONTROL "Disable drag and drop of items",IDC_DISABLEDRAGDROP, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,43,179,10 + CONTROL "Disable rename of items by clicking twice",IDC_NOTEDITLABELS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,179,10 + CONTROL "Show selection even when list is not focused",IDC_SHOWSELALWAYS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,73,179,10 + CONTROL "Make selection highlight translucent",IDC_NOTNOTRANSLUCENTSEL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,88,179,10 + LTEXT "'Hide Offline' means to hide:",IDC_STATIC,191,10,112,8 + CONTROL "Tree1",IDC_HIDEOFFLINEOPTS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | WS_BORDER | WS_TABSTOP | 0x4000,191,20,112,86 + GROUPBOX "Groups",IDC_STATIC,2,120,148,121 + CONTROL "Draw a line alongside group names",IDC_LINEWITHGROUPS, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,129,131,16 + CONTROL "Show counts of number of contacts in a group",IDC_SHOWGROUPCOUNTS, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,147,131,16 + CONTROL "Hide group counts when there are none online",IDC_HIDECOUNTSWHENEMPTY, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,165,131,16 + CONTROL "Sort groups alphabetically",IDC_SORTGROUPSALPHA,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,183,131,16 + CONTROL "Quicksearch in open groups only",IDC_QUICKSEARCHVISONLY, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,201,131,16 + LTEXT "Indent groups by:",IDC_STATIC,11,221,67,8 + EDITTEXT IDC_GROUPINDENT,78,219,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_GROUPINDENTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,95,215,10,14 + LTEXT "pixels",IDC_STATIC,112,221,36,8 + GROUPBOX "Visual",IDC_STATIC,156,120,156,121 + CONTROL "Scroll list smoothly",IDC_NOTNOSMOOTHSCROLLING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,164,130,139,10 + LTEXT "Time:",IDC_STATIC11,174,144,42,8 + EDITTEXT IDC_SMOOTHTIME,216,142,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_SMOOTHTIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,237,137,10,14 + LTEXT "milliseconds",IDC_STATIC12,250,140,56,8,SS_CENTERIMAGE + LTEXT "Left margin:",IDC_STATIC,165,180,52,8 + EDITTEXT IDC_LEFTMARGIN,215,180,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_LEFTMARGINSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,240,180,10,14 + LTEXT "pixels",IDC_STATIC,250,180,54,8 + CONTROL "Grey out entire list when:",IDC_GREYOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,195,139,10 + CONTROL "Tree1",IDC_GREYOUTOPTS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | WS_BORDER | WS_TABSTOP | 0x4000,165,205,139,30 + CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,102,153,10 + CONTROL "Hide vertical scroll bar",IDC_NOSCROLLBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,160,140,10 +END + +IDD_OPT_CLCTEXT DIALOGEX 0, 0, 277, 240 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Fonts",IDC_STATIC,4,4,269,125 + COMBOBOX IDC_FONTID,12,17,253,87,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "same",IDC_STSAMETEXT,19,32,45,10,SS_CENTERIMAGE + CONTROL "Typeface",IDC_SAMETYPE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,32,52,10 + CONTROL "Size",IDC_SAMESIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,32,45,10 + CONTROL "Style",IDC_SAMESTYLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,163,32,48,10 + CONTROL "Colour",IDC_SAMECOLOUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,32,53,10 + LTEXT "as:",IDC_STASTEXT,19,46,45,10,SS_CENTERIMAGE + COMBOBOX IDC_SAMEAS,64,45,196,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_STHORZBAR,"Static",SS_ETCHEDHORZ,9,64,259,1 + COMBOBOX IDC_TYPEFACE,12,72,136,182,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SCRIPT,156,72,60,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FONTSIZE,225,72,40,69,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Bold",IDC_BOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,88,45,10 + CONTROL "Italic",IDC_ITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,88,52,10 + CONTROL "Underline",IDC_UNDERLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,88,66,10 + CONTROL "",IDC_COLOUR,"ColourPicker",WS_TABSTOP,206,87,59,12 + EDITTEXT IDC_SAMPLE,63,104,151,16,ES_CENTER | ES_READONLY | NOT WS_TABSTOP + GROUPBOX "Rows",IDC_STATIC,4,134,269,31 + LTEXT "Row height:",IDC_STATIC,12,148,65,8 + EDITTEXT IDC_ROWHEIGHT,77,146,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_ROWHEIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,97,145,10,14 + LTEXT "pixels",IDC_STATIC,112,148,62,8 + GROUPBOX "Additional Colours",IDC_STATIC,4,171,269,65 + LTEXT "Selected text:",IDC_STATIC,12,186,65,8 + CONTROL "",IDC_SELCOLOUR,"ColourPicker",WS_TABSTOP,77,184,29,12 + LTEXT "Hottrack text:",IDC_STATIC,12,202,65,8 + CONTROL "",IDC_HOTCOLOUR,"ColourPicker",WS_TABSTOP,77,200,29,12 + CONTROL "Gamma correction",IDC_GAMMACORRECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,201,117,10 + LTEXT "Quicksearch text:",IDC_STATIC,12,218,65,8 + CONTROL "",IDC_QUICKCOLOUR,"ColourPicker",WS_TABSTOP,77,216,29,12 + LTEXT "Size:",IDC_STSIZETEXT,231,114,34,8,NOT WS_VISIBLE + LTEXT "Colour:",IDC_STCOLOURTEXT,228,102,37,8,NOT WS_VISIBLE +END + +IDD_OPT_CLCBKG DIALOGEX 0, 0, 235, 154 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Contact List Background",IDC_STATIC,4,4,227,146 + LTEXT "Background colour",IDC_STATIC,59,35,72,8,NOT WS_GROUP + CONTROL "",IDC_BKGCOLOUR,"ColourPicker",WS_TABSTOP,22,35,32,10 + LTEXT "Selection colour",IDC_STATIC,59,51,72,8 + CONTROL "",IDC_SELCOLOUR,"ColourPicker",WS_TABSTOP,22,51,32,10 + CONTROL "Use background image",IDC_BITMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,70,161,10 + EDITTEXT IDC_FILENAME,22,88,184,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BROWSE,208,88,15,11 + CONTROL "Stretch to width",IDC_STRETCHH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,105,100,10 + CONTROL "Stretch to height",IDC_STRETCHV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,105,101,10 + CONTROL "Tile horizontally",IDC_TILEH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,118,100,10 + CONTROL "Tile vertically",IDC_TILEV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,118,101,10 + CONTROL "Scroll with text",IDC_SCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,131,100,10 + CONTROL "Stretch proportionally",IDC_PROPORTIONAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,131,101,10 + CONTROL "Use Windows colours",IDC_WINCOLOUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,20,156,10 +END + +IDD_OPT_SBAR DIALOGEX 0, 0, 178, 212 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Status Bar",IDC_STATIC,4,4,170,204 + CONTROL "Show status bar",IDC_SHOWSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,17,152,10 + CONTROL "Show icons",IDC_SHOWICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,33,142,10 + CONTROL "Show protocol names",IDC_SHOWPROTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,48,142,10 + CONTROL "Show status text",IDC_SHOWSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,63,142,10 + CONTROL "Right click opens status menu",IDC_RIGHTSTATUS,"Button",BS_AUTORADIOBUTTON,22,170,142,10 + CONTROL "Right click opens Miranda IM menu",IDC_RIGHTMIRANDA, + "Button",BS_AUTORADIOBUTTON,22,157,142,10 + CONTROL "Make sections equal width",IDC_EQUALSECTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,78,142,10 + CONTROL "Show bevels on panels",IDC_SBPANELBEVEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,94,107,10 + CONTROL "Show resize grip indicator",IDC_SHOWGRIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,110,96,10 + CONTROL "Contact list background colour",IDC_CLCBKGND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,126,142,10 +END + +IDD_OPT_CLCTEXTSIMPLE DIALOGEX 0, 0, 277, 240 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Fonts",IDC_STATIC,4,4,269,125 + COMBOBOX IDC_FONTID,12,17,253,87,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "as:",IDC_STASTEXT,25,34,52,10,SS_CENTERIMAGE + COMBOBOX IDC_SAMEAS,77,33,163,88,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_STHORZBAR,"Static",SS_ETCHEDHORZ,9,51,259,1 + COMBOBOX IDC_TYPEFACE,12,58,172,182,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SCRIPT,192,58,73,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Size:",IDC_STSIZETEXT,33,76,34,8 + COMBOBOX IDC_FONTSIZE,67,74,54,69,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "Colour:",IDC_STCOLOURTEXT,147,76,37,8 + CONTROL "",IDC_COLOUR,"ColourPicker",WS_TABSTOP,184,74,59,12 + CONTROL "Bold",IDC_BOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,58,90,45,10 + CONTROL "Italic",IDC_ITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,90,52,10 + CONTROL "Underline",IDC_UNDERLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,179,90,66,10 + EDITTEXT IDC_SAMPLE,63,104,151,16,ES_CENTER | ES_READONLY | NOT WS_TABSTOP + GROUPBOX "Rows",IDC_STATIC,4,134,269,31 + LTEXT "Row height:",IDC_STATIC,12,148,65,8 + EDITTEXT IDC_ROWHEIGHT,77,146,31,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_ROWHEIGHTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,97,145,10,14 + LTEXT "pixels",IDC_STATIC,112,148,62,8 + GROUPBOX "Additional Colours",IDC_STATIC,4,171,269,65 + LTEXT "Selected text:",IDC_STATIC,12,186,65,8 + CONTROL "",IDC_SELCOLOUR,"ColourPicker",WS_TABSTOP,77,184,29,12 + LTEXT "Hottrack text:",IDC_STATIC,12,202,65,8 + CONTROL "",IDC_HOTCOLOUR,"ColourPicker",WS_TABSTOP,77,200,29,12 + LTEXT "Quicksearch text:",IDC_STATIC,12,218,65,8 + CONTROL "",IDC_QUICKCOLOUR,"ColourPicker",WS_TABSTOP,77,216,29,12 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_DELETECONTACT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 277 + TOPMARGIN, 7 + BOTTOMMARGIN, 85 + END + + IDD_OPT_HOTKEY, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 234 + TOPMARGIN, 4 + BOTTOMMARGIN, 132 + HORZGUIDE, 23 + HORZGUIDE, 40 + HORZGUIDE, 57 + END + + IDD_OPT_CLIST, DIALOG + BEGIN + LEFTMARGIN, 2 + RIGHTMARGIN, 312 + VERTGUIDE, 10 + VERTGUIDE, 107 + TOPMARGIN, 2 + BOTTOMMARGIN, 202 + HORZGUIDE, 179 + HORZGUIDE, 196 + END + + IDD_OPT_CLUI, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 309 + VERTGUIDE, 13 + VERTGUIDE, 23 + VERTGUIDE, 112 + VERTGUIDE, 141 + VERTGUIDE, 151 + VERTGUIDE, 175 + VERTGUIDE, 242 + VERTGUIDE, 246 + TOPMARGIN, 4 + BOTTOMMARGIN, 241 + HORZGUIDE, 18 + HORZGUIDE, 39 + HORZGUIDE, 76 + HORZGUIDE, 180 + HORZGUIDE, 196 + END + + IDD_OPT_CLC, DIALOG + BEGIN + LEFTMARGIN, 2 + RIGHTMARGIN, 312 + VERTGUIDE, 11 + VERTGUIDE, 164 + VERTGUIDE, 216 + TOPMARGIN, 2 + BOTTOMMARGIN, 249 + HORZGUIDE, 145 + HORZGUIDE, 163 + HORZGUIDE, 222 + END + + IDD_OPT_CLCTEXT, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 273 + VERTGUIDE, 12 + VERTGUIDE, 19 + VERTGUIDE, 77 + VERTGUIDE, 258 + VERTGUIDE, 265 + TOPMARGIN, 4 + BOTTOMMARGIN, 236 + HORZGUIDE, 37 + HORZGUIDE, 51 + HORZGUIDE, 79 + HORZGUIDE, 94 + HORZGUIDE, 152 + HORZGUIDE, 190 + HORZGUIDE, 206 + HORZGUIDE, 222 + END + + IDD_OPT_CLCBKG, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 231 + VERTGUIDE, 12 + VERTGUIDE, 22 + VERTGUIDE, 122 + TOPMARGIN, 4 + BOTTOMMARGIN, 150 + HORZGUIDE, 24 + HORZGUIDE, 35 + HORZGUIDE, 73 + HORZGUIDE, 89 + HORZGUIDE, 102 + HORZGUIDE, 115 + END + + IDD_OPT_SBAR, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 174 + VERTGUIDE, 12 + VERTGUIDE, 22 + VERTGUIDE, 164 + TOPMARGIN, 4 + BOTTOMMARGIN, 208 + END + + IDD_OPT_CLCTEXTSIMPLE, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 273 + VERTGUIDE, 12 + VERTGUIDE, 19 + VERTGUIDE, 77 + VERTGUIDE, 258 + VERTGUIDE, 265 + TOPMARGIN, 4 + BOTTOMMARGIN, 236 + HORZGUIDE, 37 + HORZGUIDE, 64 + HORZGUIDE, 80 + HORZGUIDE, 95 + HORZGUIDE, 152 + HORZGUIDE, 190 + HORZGUIDE, 206 + HORZGUIDE, 222 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include \r\n" + "#include \r\n" + "#include \r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_RENAME ICON "res\\rename.ico" +IDI_BLANK ICON "res\\blank.ico" +IDI_DELETE ICON "res\\delete.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +IDC_HYPERLINKHAND CURSOR "res\\hyperlin.cur" +IDC_DROP CURSOR "res\\dragcopy.cur" +IDC_DROPUSER CURSOR "res\\dropuser.cur" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_CLISTMENU MENU +BEGIN + POPUP "&¤" + BEGIN + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_ICQ_EXIT + END + POPUP "&Status" + BEGIN + MENUITEM "&Offline\tCtrl+0", ID_STATUS_OFFLINE, CHECKED + MENUITEM "On&line\tCtrl+1", ID_STATUS_ONLINE + MENUITEM "&Away\tCtrl+2", ID_STATUS_AWAY + MENUITEM "&NA\tCtrl+3", ID_STATUS_NA + MENUITEM "Occ&upied\tCtrl+4", ID_STATUS_OCCUPIED + MENUITEM "&DND\tCtrl+5", ID_STATUS_DND + MENUITEM "&Free for chat\tCtrl+6", ID_STATUS_FREECHAT + MENUITEM "&Invisible\tCtrl+7", ID_STATUS_INVISIBLE + MENUITEM "On the &Phone\tCtrl+8", ID_STATUS_ONTHEPHONE + MENUITEM "Out to &Lunch\tCtrl+9", ID_STATUS_OUTTOLUNCH + END +END + +IDR_CONTEXT MENU +BEGIN + POPUP "Tray" + BEGIN + MENUITEM "&Hide/Show", ID_TRAY_HIDE + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_TRAY_EXIT + END + POPUP "Nowhere" + BEGIN + MENUITEM "&New Group", POPUP_NEWGROUP + MENUITEM SEPARATOR + MENUITEM "&Hide Offline Users", POPUP_HIDEOFFLINE + MENUITEM "Hide &Offline Users out here", POPUP_HIDEOFFLINEROOT + MENUITEM "Hide &Empty Groups", POPUP_HIDEEMPTYGROUPS + MENUITEM "Disable &Groups", POPUP_DISABLEGROUPS + MENUITEM SEPARATOR + MENUITEM "Hide Miranda", POPUP_HIDEMIRANDA + MENUITEM SEPARATOR + MENUITEM "&Main Menu", 65535 + MENUITEM "O&ptions...", POPUP_OPTIONS + MENUITEM "Exit", POPUP_EXIT + END + POPUP "Group" + BEGIN + MENUITEM "&New Subgroup", POPUP_NEWSUBGROUP + MENUITEM "&Hide Offline Users in here", POPUP_GROUPHIDEOFFLINE + MENUITEM SEPARATOR + MENUITEM "&Rename Group", POPUP_RENAMEGROUP + MENUITEM "&Delete Group", POPUP_DELETEGROUP + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/clist_classic_sje/sync.bat b/clist_classic_sje/sync.bat new file mode 100644 index 0000000..60d3f6b --- /dev/null +++ b/clist_classic_sje/sync.bat @@ -0,0 +1,4 @@ +@echo off + +rem *** this is just a dummy file, so that the 'post-build' copied from the project I +rem *** modified in miranda's svn does not cause an error :) \ No newline at end of file -- cgit v1.2.3