diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-12 13:55:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-12 13:55:58 +0000 |
commit | 0516812f7ae347ddc83354db3dc64626999ae679 (patch) | |
tree | 320ffa458d3d6cc7909350a4d7a80b47f582bf06 /plugins | |
parent | fcd4450462a660eb904c0fc07ff82665dd35b076 (diff) |
- no more "unknown" flags in the extra column;
- options extracted to the separate file;
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@4432 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CountryFlags/flags_10.vcxproj | 1 | ||||
-rw-r--r-- | plugins/CountryFlags/flags_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/CountryFlags/flags_11.vcxproj | 1 | ||||
-rw-r--r-- | plugins/CountryFlags/flags_11.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/CountryFlags/src/extraimg.cpp | 134 | ||||
-rw-r--r-- | plugins/CountryFlags/src/flags.h | 11 | ||||
-rw-r--r-- | plugins/CountryFlags/src/icons.cpp | 19 | ||||
-rw-r--r-- | plugins/CountryFlags/src/main.cpp | 8 | ||||
-rw-r--r-- | plugins/CountryFlags/src/options.cpp | 97 | ||||
-rw-r--r-- | plugins/CountryFlags/src/version.h | 24 |
10 files changed, 155 insertions, 146 deletions
diff --git a/plugins/CountryFlags/flags_10.vcxproj b/plugins/CountryFlags/flags_10.vcxproj index b130e55b20..f1da1df9b2 100644 --- a/plugins/CountryFlags/flags_10.vcxproj +++ b/plugins/CountryFlags/flags_10.vcxproj @@ -196,6 +196,7 @@ <ClCompile Include="src\icons.cpp" />
<ClCompile Include="src\ip2country.cpp" />
<ClCompile Include="src\main.cpp" />
+ <ClCompile Include="src\options.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
diff --git a/plugins/CountryFlags/flags_10.vcxproj.filters b/plugins/CountryFlags/flags_10.vcxproj.filters index d1e0a75857..20fd6acc5c 100644 --- a/plugins/CountryFlags/flags_10.vcxproj.filters +++ b/plugins/CountryFlags/flags_10.vcxproj.filters @@ -36,6 +36,9 @@ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\options.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\flags.h">
diff --git a/plugins/CountryFlags/flags_11.vcxproj b/plugins/CountryFlags/flags_11.vcxproj index fa7ee6d2de..6695dbe46c 100644 --- a/plugins/CountryFlags/flags_11.vcxproj +++ b/plugins/CountryFlags/flags_11.vcxproj @@ -201,6 +201,7 @@ <ClCompile Include="src\icons.cpp" />
<ClCompile Include="src\ip2country.cpp" />
<ClCompile Include="src\main.cpp" />
+ <ClCompile Include="src\options.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
diff --git a/plugins/CountryFlags/flags_11.vcxproj.filters b/plugins/CountryFlags/flags_11.vcxproj.filters index d1e0a75857..20fd6acc5c 100644 --- a/plugins/CountryFlags/flags_11.vcxproj.filters +++ b/plugins/CountryFlags/flags_11.vcxproj.filters @@ -36,6 +36,9 @@ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\options.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\flags.h">
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index a1a1548b0d..f511ee0cf5 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -22,11 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Services */
static HANDLE hServiceDetectContactOrigin;
-/* Misc */
-extern HINSTANCE hInst;
-extern int nCountriesCount;
-extern struct CountryListEntry *countries;
-
/************************* Services *******************************/
static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam)
@@ -34,7 +29,7 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) int countryNumber = 0xFFFF;
char *pszProto = GetContactProto((HANDLE)wParam);
/* ip detect */
- if ( db_get_b(NULL, MODULENAME, "UseIpToCountry", SETTING_USEIPTOCOUNTRY_DEFAULT))
+ if (bUseIpToCountry)
countryNumber = ServiceIpToCountry(db_get_dw((HANDLE)wParam,pszProto,"RealIP",0),0);
/* fallback */
if (countryNumber == 0xFFFF)
@@ -52,13 +47,17 @@ static HANDLE hExtraIcon; static void CALLBACK SetExtraImage(HANDLE hContact)
{
- if ( !db_get_b(NULL, MODULENAME, "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
+ if (!bShowExtraIcon)
return;
int countryNumber = ServiceDetectContactOriginCountry((WPARAM)hContact, 0);
- char szId[20];
- wsprintfA(szId, (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
- ExtraIcon_SetIcon(hExtraIcon, hContact, szId);
+ if (countryNumber == 0xFFFF && !bUseUnknown)
+ ExtraIcon_Clear(hExtraIcon, hContact);
+ else {
+ char szId[20];
+ wsprintfA(szId, (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
+ ExtraIcon_SetIcon(hExtraIcon, hContact, szId);
+ }
}
// always call in context of main thread
@@ -77,7 +76,7 @@ static void EnsureExtraImages(void) static void CALLBACK UpdateExtraImages(LPARAM lParam)
{
- if ( db_get_b(NULL, MODULENAME, "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
+ if (bShowExtraIcon)
EnsureExtraImages();
else
RemoveExtraImages();
@@ -85,7 +84,7 @@ static void CALLBACK UpdateExtraImages(LPARAM lParam) static int ExtraImageApply(WPARAM wParam,LPARAM lParam)
{
- if ( db_get_b(NULL, MODULENAME, "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
+ if (bShowExtraIcon)
SetExtraImage((HANDLE)wParam); /* unbuffered */
return 0;
}
@@ -100,7 +99,7 @@ static void __fastcall SetStatusIcon(HANDLE hContact,int countryNumber) StatusIconData sid = { sizeof(sid) };
sid.szModule = MODULENAME;
- if (countryNumber != 0xFFFF || db_get_b(NULL, MODULENAME, "UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT)) {
+ if (countryNumber != 0xFFFF || bUseUnknown) {
/* copy icon as status icon API will call DestroyIcon() on it */
sid.hIcon = LoadFlagIcon(countryNumber);
sid.szTooltip = (char*) CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber,0);
@@ -128,7 +127,7 @@ static int MsgWndEvent(WPARAM wParam,LPARAM lParam) switch(msgwe->uType) {
case MSG_WINDOW_EVT_OPENING:
case MSG_WINDOW_EVT_CLOSE:
- if ( db_get_b(NULL, MODULENAME, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT)) {
+ if (bShowStatusIcon) {
int countryNumber = ServiceDetectContactOriginCountry((WPARAM)msgwe->hContact, 0);
if (msgwe->uType == MSG_WINDOW_EVT_OPENING && countryNumber != 0xFFFF)
SetStatusIcon(msgwe->hContact,countryNumber);
@@ -143,8 +142,6 @@ static int MsgWndEvent(WPARAM wParam,LPARAM lParam) static void CALLBACK UpdateStatusIcons(LPARAM lParam)
{
- BOOL fShow = db_get_b(NULL,MODULENAME,"ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT);
-
MessageWindowInputData msgwi = { sizeof(msgwi) };
msgwi.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
msgwi.hContact = db_find_first();
@@ -153,7 +150,7 @@ static void CALLBACK UpdateStatusIcons(LPARAM lParam) MessageWindowData msgw; /* output */
msgw.cbSize = sizeof(msgw);
if (!CallService(MS_MSG_GETWINDOWDATA,(WPARAM)&msgwi,(LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
- if (fShow) {
+ if (bShowStatusIcon) {
int countryNumber = ServiceDetectContactOriginCountry((WPARAM)msgwi.hContact, 0);
SetStatusIcon(msgwi.hContact, countryNumber);
}
@@ -165,91 +162,11 @@ static void CALLBACK UpdateStatusIcons(LPARAM lParam) static int StatusIconsChanged(WPARAM wParam,LPARAM lParam)
{
- if ( db_get_b(NULL, MODULENAME, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT))
+ if (bShowStatusIcon)
CallFunctionBuffered(UpdateStatusIcons, 0, FALSE, STATUSICON_REFRESHDELAY);
return 0;
}
-/************************* Options ************************************/
-
-#define M_ENABLE_SUBCTLS (WM_APP+1)
-
-static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
-{
- switch(msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- /* init checkboxes */
- {
- BOOL val;
- /* Status Icon */
- if (ServiceExists(MS_MSG_REMOVEICON))
- val = db_get_b(NULL, MODULENAME, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
- else
- EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG),val=FALSE);
- CheckDlgButton(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG,val);
- /* Extra Image */
- val = db_get_b(NULL,MODULENAME,"ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT) != 0;
- CheckDlgButton(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG,val);
- /* Unknown Flag */
- val = db_get_b(NULL,MODULENAME,"UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
- CheckDlgButton(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG,val);
- /* IP-to-country */
- val = db_get_b(NULL,MODULENAME,"UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT) != 0;
- CheckDlgButton(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY,val);
- }
- SendMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
- return TRUE; /* default focus */
-
- case M_ENABLE_SUBCTLS:
- {
- BOOL checked = IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG);
- EnableWindow(GetDlgItem(hwndDlg,IDC_TEXT_EXTRAIMGFLAGCOLUMN),checked);
- if (!checked)
- checked = IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG);
- EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG),checked);
- EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY),checked);
- return TRUE;
- }
-
- case WM_COMMAND:
- PostMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
- PostMessage(GetParent(hwndDlg),PSM_CHANGED,0,0); /* enable apply */
- return FALSE;
-
- case WM_NOTIFY:
- switch(((NMHDR*)lParam)->code) {
- case PSN_APPLY: /* setting change hook will pick these up */
- db_set_b(NULL,MODULENAME,"UseUnknownFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG) != 0));
- db_set_b(NULL,MODULENAME,"UseIpToCountry",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY) != 0));
- /* Status Icon */
- if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG)))
- db_set_b(NULL,MODULENAME,"ShowStatusIconFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG) != 0));
- /* Extra Image */
- if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG)))
- db_set_b(NULL,MODULENAME,"ShowExtraImgFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG) != 0));
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-static int ExtraImgOptInit(WPARAM wParam,LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXTRAIMG);
- odp.position = 900000002;
- odp.pszGroup = LPGEN("Icons"); /* autotranslated */
- odp.pszTitle = LPGEN("Country Flags"); /* autotranslated */
- odp.pszTab = LPGEN("Country Flags"); /* autotranslated, can be made a tab */
- odp.flags = ODPF_BOLDGROUPS;
- odp.pfnDlgProc = ExtraImgOptDlgProc;
- Options_AddPage(wParam, &odp);
- return 0;
-}
-
static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam)
{
DBCONTACTWRITESETTING *dbcws=(DBCONTACTWRITESETTING*)lParam;
@@ -294,31 +211,22 @@ static int ExtraImgModulesLoaded(WPARAM wParam,LPARAM lParam) hExtraIcon = ExtraIcon_Register("flags_extra", LPGEN("Country flag"));
HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,ExtraImageApply);
+ /* Status Icon */
StatusIconData sid = { sizeof(sid) };
sid.szModule = MODULENAME; // dwID = 0
sid.flags = MBF_HIDDEN;
Srmm_AddIcon(&sid);
- /* Status Icon */
HookEvent(ME_MSG_WINDOWEVENT, MsgWndEvent);
return 0;
}
void InitExtraImg(void)
{
- /* Services */
- hServiceDetectContactOrigin = CreateServiceFunction(MS_FLAGS_DETECTCONTACTORIGINCOUNTRY,ServiceDetectContactOriginCountry);
- /* Misc */
- HookEvent(ME_SYSTEM_MODULESLOADED, ExtraImgModulesLoaded);
- /* Status icon */
- HookEvent(ME_SKIN2_ICONSCHANGED,StatusIconsChanged);
- /* Options */
- HookEvent(ME_OPT_INITIALISE,ExtraImgOptInit);
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ExtraImgSettingChanged);
-}
+ CreateServiceFunction(MS_FLAGS_DETECTCONTACTORIGINCOUNTRY, ServiceDetectContactOriginCountry);
-void UninitExtraImg(void)
-{
- /* Services */
- DestroyServiceFunction(hServiceDetectContactOrigin);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ExtraImgModulesLoaded);
+ HookEvent(ME_SKIN2_ICONSCHANGED, StatusIconsChanged);
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInit);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ExtraImgSettingChanged);
}
diff --git a/plugins/CountryFlags/src/flags.h b/plugins/CountryFlags/src/flags.h index 9ebee77f24..d8a0a9cc79 100644 --- a/plugins/CountryFlags/src/flags.h +++ b/plugins/CountryFlags/src/flags.h @@ -41,6 +41,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "resource.h"
#include "version.h"
+extern HINSTANCE hInst;
+extern int nCountriesCount;
+extern CountryListEntry *countries;
+
/* huffman.c */
#ifdef HUFFMAN_ENCODE
int Huffman_Compress(unsigned char *in,unsigned char *out,unsigned int insize );
@@ -51,7 +55,6 @@ void Huffman_Uncompress(unsigned char *in,unsigned char *out,unsigned int insize HICON __fastcall LoadFlagIcon(int countryNumber);
int __fastcall CountryNumberToIndex(int countryNumber);
void InitIcons(void);
-void UninitIcons(void);
/* ip2country.c */
INT_PTR ServiceIpToCountry(WPARAM wParam,LPARAM lParam);
@@ -60,7 +63,6 @@ void UninitIpToCountry(void); /* extraimg.c */
void InitExtraImg(void);
-void UninitExtraImg(void);
/* utils.c */
typedef void (CALLBACK *BUFFEREDPROC)(LPARAM lParam);
@@ -73,3 +75,8 @@ typedef void (CALLBACK *BUFFEREDPROC)(LPARAM lParam); #endif
void PrepareBufferedFunctions(void);
void KillBufferedFunctions(void);
+
+/* options.c */
+extern bool bUseUnknown, bShowStatusIcon, bShowExtraIcon, bUseIpToCountry;
+void LoadOptions(void);
+int OnOptionsInit(WPARAM wParam,LPARAM lParam);
diff --git a/plugins/CountryFlags/src/icons.cpp b/plugins/CountryFlags/src/icons.cpp index 7e37254ada..5724db6a8b 100644 --- a/plugins/CountryFlags/src/icons.cpp +++ b/plugins/CountryFlags/src/icons.cpp @@ -19,11 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "flags.h"
-extern HINSTANCE hInst;
-extern int nCountriesCount;
-extern struct CountryListEntry *countries;
-static HANDLE hServiceLoadIcon,hServiceCreateMergedIcon;
-
/************************* Bitmap Access **************************/
static HANDLE *phIconHandles;
@@ -194,9 +189,9 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) /* merge them */
ICONINFO icoi;
- if (GetIconInfo(hLowerIcon,&icoi)) {
+ if (GetIconInfo(hLowerIcon, &icoi)) {
BITMAP bm;
- if (hUpperIcon != NULL && GetObject(icoi.hbmColor,sizeof(bm),&bm)) {
+ if (hUpperIcon != NULL && GetObject(icoi.hbmColor, sizeof(bm), &bm)) {
HDC hdc = CreateCompatibleDC(NULL);
if (hdc != NULL) {
POINT aptTriangle[3] = { 0 };
@@ -269,12 +264,6 @@ void InitIcons(void) }
/* create services */
- hServiceLoadIcon = CreateServiceFunction(MS_FLAGS_LOADFLAGICON, ServiceLoadFlagIcon);
- hServiceCreateMergedIcon = CreateServiceFunction(MS_FLAGS_CREATEMERGEDFLAGICON, ServiceCreateMergedFlagIcon);
-}
-
-void UninitIcons(void)
-{
- DestroyServiceFunction(hServiceLoadIcon);
- DestroyServiceFunction(hServiceCreateMergedIcon);
+ CreateServiceFunction(MS_FLAGS_LOADFLAGICON, ServiceLoadFlagIcon);
+ CreateServiceFunction(MS_FLAGS_CREATEMERGEDFLAGICON, ServiceCreateMergedFlagIcon);
}
diff --git a/plugins/CountryFlags/src/main.cpp b/plugins/CountryFlags/src/main.cpp index d72c9937d7..b68b14bd02 100644 --- a/plugins/CountryFlags/src/main.cpp +++ b/plugins/CountryFlags/src/main.cpp @@ -19,9 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "flags.h"
-HINSTANCE hInst;
int nCountriesCount;
-struct CountryListEntry *countries;
+CountryListEntry *countries;
+
+HINSTANCE hInst;
int hLangpack;
static PLUGININFOEX pluginInfo={
@@ -59,14 +60,13 @@ extern "C" __declspec(dllexport) int Load(void) InitIcons();
InitIpToCountry();
InitExtraImg();
+ LoadOptions();
return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
KillBufferedFunctions();
- UninitExtraImg();
UninitIpToCountry();
- UninitIcons();
return 0;
}
diff --git a/plugins/CountryFlags/src/options.cpp b/plugins/CountryFlags/src/options.cpp new file mode 100644 index 0000000000..628dc04551 --- /dev/null +++ b/plugins/CountryFlags/src/options.cpp @@ -0,0 +1,97 @@ +/*
+Miranda IM Country Flags Plugin
+Copyright (C) 2006-1007 H. Herkenrath
+
+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 (Flags-License.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "flags.h"
+
+bool bUseUnknown, bShowStatusIcon, bShowExtraIcon, bUseIpToCountry;
+
+void LoadOptions()
+{
+ bShowStatusIcon = db_get_b(NULL, MODULENAME, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
+ bShowExtraIcon = db_get_b(NULL, MODULENAME, "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT) != 0;
+ bUseUnknown = db_get_b(NULL, MODULENAME, "UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
+ bUseIpToCountry = db_get_b(NULL, MODULENAME, "UseIpToCountry", SETTING_USEIPTOCOUNTRY_DEFAULT) != 0;
+}
+
+#define M_ENABLE_SUBCTLS (WM_APP+1)
+
+static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ switch(msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ CheckDlgButton(hwndDlg, IDC_CHECK_SHOWSTATUSICONFLAG, bShowStatusIcon);
+ CheckDlgButton(hwndDlg, IDC_CHECK_SHOWEXTRAIMGFLAG, bShowExtraIcon);
+ CheckDlgButton(hwndDlg, IDC_CHECK_USEUNKNOWNFLAG, bUseUnknown);
+ CheckDlgButton(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY, bUseIpToCountry);
+
+ SendMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
+ return TRUE; /* default focus */
+
+ case M_ENABLE_SUBCTLS:
+ {
+ BOOL checked = IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_TEXT_EXTRAIMGFLAGCOLUMN),checked);
+ if (!checked)
+ checked = IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG),checked);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY),checked);
+ return TRUE;
+ }
+
+ case WM_COMMAND:
+ PostMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
+ PostMessage(GetParent(hwndDlg),PSM_CHANGED,0,0); /* enable apply */
+ return FALSE;
+
+ case WM_NOTIFY:
+ switch(((NMHDR*)lParam)->code) {
+ case PSN_APPLY: /* setting change hook will pick these up */
+ db_set_b(NULL,MODULENAME,"UseUnknownFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG) != 0));
+ db_set_b(NULL,MODULENAME,"UseIpToCountry",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY) != 0));
+ /* Status Icon */
+ if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG)))
+ db_set_b(NULL,MODULENAME,"ShowStatusIconFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG) != 0));
+ /* Extra Image */
+ if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG)))
+ db_set_b(NULL,MODULENAME,"ShowExtraImgFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG) != 0));
+
+ LoadOptions();
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+int OnOptionsInit(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXTRAIMG);
+ odp.position = 900000002;
+ odp.pszGroup = LPGEN("Icons"); /* autotranslated */
+ odp.pszTitle = LPGEN("Country Flags"); /* autotranslated */
+ odp.pszTab = LPGEN("Country Flags"); /* autotranslated, can be made a tab */
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = ExtraImgOptDlgProc;
+ Options_AddPage(wParam, &odp);
+ return 0;
+}
diff --git a/plugins/CountryFlags/src/version.h b/plugins/CountryFlags/src/version.h index 722fb5abbc..bcd4881d52 100644 --- a/plugins/CountryFlags/src/version.h +++ b/plugins/CountryFlags/src/version.h @@ -1,14 +1,14 @@ -#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 1
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 1
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 4
-#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
-#define __PLUGIN_NAME "Country flags"
-#define __FILENAME "Flags.dll"
-#define __DESCRIPTION "Service offering misc country utilities as flag icons and a IP-to-Country database."
-#define __AUTHOR "H. Herkenrath"
-#define __AUTHOREMAIL "hrathh@users.sourceforge.net"
-#define __AUTHORWEB "http://miranda-ng.org/"
-#define __COPYRIGHT "© 2006-2007 H. Herkenrath"
+#define __PLUGIN_NAME "Country flags"
+#define __FILENAME "Flags.dll"
+#define __DESCRIPTION "Service offering misc country utilities as flag icons and a IP-to-Country database."
+#define __AUTHOR "H. Herkenrath"
+#define __AUTHOREMAIL "hrathh@users.sourceforge.net"
+#define __AUTHORWEB "http://miranda-ng.org/"
+#define __COPYRIGHT "© 2006-2007 H. Herkenrath"
|