From 8983afc0314cb42ddc7ff709b78ae32b6fd1f900 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 23 Aug 2010 19:59:55 +0300 Subject: modified: commonheaders.h modified: icons.cpp modified: icons/secured.ico modified: icons/unsecured.ico modified: init.cpp modified: new_gpg.rc modified: new_gpg.vcproj modified: options.cpp modified: resource.h modified: utilities.cpp --- commonheaders.h | 2 ++ icons.cpp | 60 +++++++++++++++++++++++++++++++++++++++ icons/secured.ico | Bin 2550 -> 2550 bytes icons/unsecured.ico | Bin 2550 -> 2550 bytes init.cpp | 2 ++ new_gpg.rc | 10 +++++++ new_gpg.vcproj | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++-- options.cpp | 1 - resource.h | 4 ++- utilities.cpp | 1 + 10 files changed, 154 insertions(+), 5 deletions(-) diff --git a/commonheaders.h b/commonheaders.h index a1f1883..698a90e 100644 --- a/commonheaders.h +++ b/commonheaders.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -51,6 +52,7 @@ using std::fstream; #include #include #include +#include #include "m_extraicons.h" #include "m_metacontacts.h" #include "resource.h" diff --git a/icons.cpp b/icons.cpp index 94603b8..23cee80 100644 --- a/icons.cpp +++ b/icons.cpp @@ -16,6 +16,66 @@ #include "commonheaders.h" +HANDLE IconLibDefine(TCHAR* desc, TCHAR* section, char* ident, HICON icon, char* def_file, int def_idx, int size) +{ + SKINICONDESC sid = {0}; + HANDLE hIcon; + + if(!size) + size = 16; + + sid.cbSize = SKINICONDESC_SIZE; + sid.ptszSection = section; + sid.ptszDescription = desc; + sid.flags = SIDF_TCHAR; + + sid.pszName = ident; + sid.pszDefaultFile = def_file; + sid.iDefaultIndex = def_idx; + sid.hDefaultIcon = icon; + sid.cx = sid.cy = size; + + hIcon = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + + return hIcon; +} + + +void InitIconLib() +{ + extern HINSTANCE hInst; + char lib[MAX_PATH]; + GetModuleFileNameA(hInst, lib, MAX_PATH); + TCHAR *module = mir_a2t(szGPGModuleName); + + IconLibDefine(_T("Secured"), module, "secured", NULL, lib, -IDI_SECURED,0); + IconLibDefine(_T("Unsecured"), module, "unsecured", NULL, lib, -IDI_UNSECURED,0); + mir_free(module); +} + + + + + +HICON IconLibGetIcon(const char* ident) +{ + return (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)ident); +} + + + +void IconLibReleaseIcon(const char* ident) +{ + CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM)ident); +} + + + +HANDLE IconLibHookIconsChanged(MIRANDAHOOK hook) +{ + return HookEvent(ME_SKIN2_ICONSCHANGED, hook); +} + // обновляет иконки в clist и в messagew void ShowStatusIcon(HANDLE hContact,bool enabled) { diff --git a/icons/secured.ico b/icons/secured.ico index 8b42e2c..8d84167 100644 Binary files a/icons/secured.ico and b/icons/secured.ico differ diff --git a/icons/unsecured.ico b/icons/unsecured.ico index 53209bc..567367b 100644 Binary files a/icons/unsecured.ico and b/icons/unsecured.ico differ diff --git a/init.cpp b/init.cpp index 3fcd33c..354d977 100644 --- a/init.cpp +++ b/init.cpp @@ -155,12 +155,14 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) int onIconPressed(WPARAM wParam, LPARAM lParam); int onExtraImageListRebuilding(WPARAM, LPARAM); int onExtraImageApplying(WPARAM wParam, LPARAM); + void InitIconLib(); void InitCheck(); void FirstRun(); FirstRun(); InitCheck(); + InitIconLib(); bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090100?true:false; bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT); diff --git a/new_gpg.rc b/new_gpg.rc index 0026636..842eaf0 100644 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -221,6 +221,16 @@ BEGIN END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SECURED ICON "icons\\secured.ico" +IDI_UNSECURED ICON "icons\\unsecured.ico" #endif // русский resources ///////////////////////////////////////////////////////////////////////////// diff --git a/new_gpg.vcproj b/new_gpg.vcproj index f4c9fa1..f195b1a 100644 --- a/new_gpg.vcproj +++ b/new_gpg.vcproj @@ -156,8 +156,9 @@ MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" - UsePrecompiledHeader="0" + UsePrecompiledHeader="2" PrecompiledHeaderThrough="commonheaders.h" + PrecompiledHeaderFile="c:\temp\new_gpg.pch" AssemblerListingLocation=".\Debug/" ObjectFile=".\Debug/" ProgramDataBaseFileName=".\Debug/" @@ -618,14 +619,38 @@ + + + + + + + + + @@ -643,6 +668,14 @@ + + + + + + + + + + + + + + + + + + extern HINSTANCE hInst; diff --git a/resource.h b/resource.h index 4d3734d..e0592af 100644 --- a/resource.h +++ b/resource.h @@ -12,6 +12,8 @@ #define IDD_KEY_GEN 109 #define IDD_LOAD_EXISTING_KEY 110 #define IDD_KEY_PASSWD 111 +#define IDI_SECURED 112 +#define IDI_UNSECURED 113 #define IDC_SET_BIN_PATH 1016 #define IDC_SET_HOME_DIR 1017 #define IDC_BIN_PATH 1018 @@ -63,7 +65,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 112 +#define _APS_NEXT_RESOURCE_VALUE 114 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1052 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/utilities.cpp b/utilities.cpp index de7c3ff..6f5a654 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -490,3 +490,4 @@ bool isContactSecured(HANDLE hContact) return true; return false; } + -- cgit v1.2.3