summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-08-23 19:59:55 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-08-23 19:59:55 +0300
commit8983afc0314cb42ddc7ff709b78ae32b6fd1f900 (patch)
tree9ba248d49c9ec6cdf6427889b2ee9bf6348b6321
parent35daa0c0ba771eb0bab7f870f12eaf265ec58a2d (diff)
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
-rw-r--r--commonheaders.h2
-rw-r--r--icons.cpp60
-rw-r--r--icons/secured.icobin2550 -> 2550 bytes
-rw-r--r--icons/unsecured.icobin2550 -> 2550 bytes
-rw-r--r--init.cpp2
-rw-r--r--new_gpg.rc10
-rw-r--r--new_gpg.vcproj79
-rw-r--r--options.cpp1
-rw-r--r--resource.h4
-rw-r--r--utilities.cpp1
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 <io.h>
#include <errno.h>
#include <time.h>
+#include <uxtheme.h>
#include <iostream>
#include <map>
@@ -51,6 +52,7 @@ using std::fstream;
#include <m_jabber.h>
#include <m_message.h>
#include <m_cluiframes.h>
+#include <m_icolib.h>
#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
--- a/icons/secured.ico
+++ b/icons/secured.ico
Binary files differ
diff --git a/icons/unsecured.ico b/icons/unsecured.ico
index 53209bc..567367b 100644
--- a/icons/unsecured.ico
+++ b/icons/unsecured.ico
Binary files 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 @@
<File
RelativePath=".\clist.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\gpg_wrapper.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\icons.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\init.cpp"
@@ -635,7 +660,7 @@
>
<Tool
Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
+ UsePrecompiledHeader="1"
PrecompiledHeaderThrough="commonheaders.h"
/>
</FileConfiguration>
@@ -643,6 +668,14 @@
<File
RelativePath=".\jabber_account.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\main.cpp"
@@ -652,29 +685,69 @@
>
<Tool
Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
+ UsePrecompiledHeader="2"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\messages.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\metacontacts.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\options.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\srmm.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\utilities.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="2"
+ />
+ </FileConfiguration>
</File>
</Filter>
<Filter
diff --git a/options.cpp b/options.cpp
index 734a591..8f64c98 100644
--- a/options.cpp
+++ b/options.cpp
@@ -15,7 +15,6 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "commonheaders.h"
-#include <uxtheme.h>
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;
}
+