summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2013-08-11 08:31:53 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2013-08-11 08:31:53 +0000
commit65d90486d32affb97b6803abdb77fe09252d8c98 (patch)
tree8baa23155be080b2c1246dbfe5f28f5867812b58
parentf074f54bcb0f6e01dbb0cda4f0727ce8043b399b (diff)
- IEView: Ressource fixes
- Weather: Fix for a rare message box git-svn-id: http://svn.miranda-ng.org/main/trunk@5643 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/IEView/res/ieview.rc72
-rw-r--r--plugins/Weather/src/weather.cpp2
-rw-r--r--plugins/Weather/src/weather.h4
-rw-r--r--plugins/Weather/src/weather_conv.cpp6
-rw-r--r--plugins/Weather/src/weather_info.cpp2
-rw-r--r--plugins/Weather/src/weather_ini.cpp82
6 files changed, 88 insertions, 80 deletions
diff --git a/plugins/IEView/res/ieview.rc b/plugins/IEView/res/ieview.rc
index b642b075b9..09852a0d95 100644
--- a/plugins/IEView/res/ieview.rc
+++ b/plugins/IEView/res/ieview.rc
@@ -7,26 +7,23 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
-
+#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// английский (США) resources
+// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
-IDR_CONTEXTMENU MENU
+IDR_CONTEXTMENU MENU
BEGIN
POPUP "", MENUBREAK
BEGIN
@@ -61,20 +58,23 @@ IDI_GROUP_OFF ICON "group_off.ico"
// Dialog
//
-IDD_GENERAL_OPTIONS DIALOGEX 0, 0, 306, 228
+IDD_GENERAL_OPTIONS DIALOGEX 0, 0, 306, 165
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Options",IDC_STATIC,4,2,297,155
- CONTROL "Enable BBCodes",IDC_ENABLE_BBCODES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,19,265,10
+ CONTROL "Enable BBCodes",IDC_ENABLE_BBCODES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,19,279,10
LTEXT "Currently the following BBCodes are supported: [b][i][u][s][img][size][color][url]",IDC_STATIC,26,31,265,12
- CONTROL "Enable support for Flash files in smileys and BBCodes",IDC_ENABLE_FLASH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,46,265,10
- CONTROL "Enable workaround for PNG transparency",IDC_ENABLE_PNGHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,61,265,10
- CONTROL "Enable MathModule support",IDC_ENABLE_MATHMODULE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,76,265,10
- CONTROL "Replace smileys in user names",IDC_SMILEYS_IN_NAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,91,265,10
- CONTROL "Hide window border",IDC_NO_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,106,265,10
- CONTROL "Embed YouTube videos",IDC_ENABLE_EMBED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,265,10
+ CONTROL "Enable support for Flash files in smileys and BBCodes",IDC_ENABLE_FLASH,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,46,279,10
+ CONTROL "Enable workaround for PNG transparency",IDC_ENABLE_PNGHACK,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,61,279,10
+ CONTROL "Enable MathModule support",IDC_ENABLE_MATHMODULE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,76,279,10
+ CONTROL "Replace smileys in user names",IDC_SMILEYS_IN_NAMES,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,91,279,10
+ CONTROL "Hide window border",IDC_NO_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,106,279,10
+ CONTROL "Embed YouTube videos",IDC_ENABLE_EMBED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,279,10
LTEXT "Size:",IDC_STATIC,26,138,30,8
COMBOBOX IDC_EMBED_SIZE,57,136,56,130,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
@@ -86,8 +86,8 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Mode",IDC_STATIC,4,2,297,222
CONTROL "Compatibility Mode",IDC_MODE_COMPATIBLE,"Button",BS_AUTORADIOBUTTON,118,15,100,10
- CONTROL "Use External CSS",IDC_MODE_CSS,"Button",BS_AUTORADIOBUTTON,118,58,86,10
- CONTROL "Use Templates",IDC_MODE_TEMPLATE,"Button",BS_AUTORADIOBUTTON,118,112,86,10
+ CONTROL "Use External CSS",IDC_MODE_CSS,"Button",BS_AUTORADIOBUTTON,118,58,147,10
+ CONTROL "Use Templates",IDC_MODE_TEMPLATE,"Button",BS_AUTORADIOBUTTON,118,112,147,10
CONTROL "",IDC_PROTOLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_CHECKBOXES | WS_BORDER | WS_HSCROLL | WS_TABSTOP,10,15,100,143
CONTROL "Background image",IDC_BACKGROUND_IMAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,26,86,10
CONTROL "Scroll with text",IDC_SCROLL_BACKGROUND_IMAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,206,26,93,10
@@ -97,16 +97,16 @@ BEGIN
PUSHBUTTON "...",IDC_BROWSE_EXTERNALCSS,278,68,15,11
EDITTEXT IDC_TEMPLATES_FILENAME,118,122,153,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BROWSE_TEMPLATES,278,122,15,11
- ICON IDI_GROUP_OFF,IDC_GROUPSUPPORT,245,135,20,20
- ICON IDI_RTL_OFF,IDC_RTLSUPPORT,260,135,20,20
+ ICON IDI_GROUP_OFF,IDC_GROUPSUPPORT,245,135,21,20
+ ICON IDI_RTL_OFF,IDC_RTLSUPPORT,260,135,21,20
GROUPBOX "Template Options",IDC_STATIC,10,161,284,57
CONTROL "Use message grouping",IDC_LOG_GROUP_MESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,173,125,10
CONTROL "Show nicknames",IDC_LOG_SHOW_NICKNAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,183,125,10
CONTROL "Show time",IDC_LOG_SHOW_TIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,193,125,10
CONTROL "Show seconds",IDC_LOG_SHOW_SECONDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,203,110,10
- CONTROL "Show date",IDC_LOG_SHOW_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,173,120,10
- CONTROL "Use long date format",IDC_LOG_LONG_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,183,110,10
- CONTROL "Use relative timestamp",IDC_LOG_RELATIVE_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,193,110,10
+ CONTROL "Show date",IDC_LOG_SHOW_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,173,143,10
+ CONTROL "Use long date format",IDC_LOG_LONG_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,183,131,10
+ CONTROL "Use relative timestamp",IDC_LOG_RELATIVE_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,193,131,10
END
@@ -133,7 +133,32 @@ END
#endif // APSTUDIO_INVOKED
-#endif // английский (США) resources
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_GENERAL_OPTIONS, DIALOG
+ BEGIN
+ VERTGUIDE, 14
+ VERTGUIDE, 293
+ END
+
+ IDD_SRMM_OPTIONS, DIALOG
+ BEGIN
+ VERTGUIDE, 145
+ VERTGUIDE, 157
+ VERTGUIDE, 265
+ VERTGUIDE, 288
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
@@ -143,8 +168,7 @@ END
//
// Generated from the TEXTINCLUDE 3 resource.
//
-
-
+
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index 1da5f8a6fb..ddb205ea23 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -191,7 +191,7 @@ extern "C" int __declspec(dllexport) Load(void)
EraseAllInfo();
// load weather update data
- LoadWIData(TRUE);
+ LoadWIData(true);
// set status to online if "Do not display weather condition as protocol status" is enabled
old_status = status = ID_STATUS_OFFLINE;
diff --git a/plugins/Weather/src/weather.h b/plugins/Weather/src/weather.h
index b60a90559a..f15bb518cf 100644
--- a/plugins/Weather/src/weather.h
+++ b/plugins/Weather/src/weather.h
@@ -449,10 +449,10 @@ void NetlibHttpDisconnect(void);
void WIListAdd(WIDATA Data);
WIDATA* GetWIData(TCHAR *pszServ);
-BOOL IsContainedInCondList(const TCHAR *pszStr, WICONDLIST *List);
+bool IsContainedInCondList(const TCHAR *pszStr, WICONDLIST *List);
void DestroyWIList();
-BOOL LoadWIData(BOOL dial);
+bool LoadWIData(bool dial);
void FreeWIData(WIDATA *Data);
INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp
index 060ea0b578..b26e15cd32 100644
--- a/plugins/Weather/src/weather_conv.cpp
+++ b/plugins/Weather/src/weather_conv.cpp
@@ -322,10 +322,8 @@ static const WORD statusValue[10] = { LIGHT, FOG, SSHOWER, SNOW, RSHOWER, RAIN,
WORD GetIcon(const TCHAR* cond, WIDATA *Data)
{
- int i;
-
// set the icon using ini
- for (i=0; i<10; i++)
+ for (int i=0; i<10; i++)
if ( IsContainedInCondList(cond, &Data->CondList[i]))
return statusValue[i];
@@ -389,7 +387,7 @@ WORD GetIcon(const TCHAR* cond, WIDATA *Data)
}
// set the icon using langpack
- for (i=0; i < 9; i++) {
+ for (int i=0; i < 9; i++) {
TCHAR LangPackStr[64], LangPackStr1[128];
int j = 0;
do {
diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp
index da31eabb5b..d50f3d1881 100644
--- a/plugins/Weather/src/weather_info.cpp
+++ b/plugins/Weather/src/weather_info.cpp
@@ -134,7 +134,7 @@ INT_PTR CALLBACK DlgProcINIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
LOWORD(wParam) == IDC_RELOADINI )
{
DestroyWIList();
- LoadWIData(TRUE);
+ LoadWIData(true);
INIInfo(hwndDlg);
}
break;
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp
index 25d1da052f..73456a8a73 100644
--- a/plugins/Weather/src/weather_ini.cpp
+++ b/plugins/Weather/src/weather_ini.cpp
@@ -35,10 +35,8 @@ HWND hWndSetup;
// Data = the service data to be added to the list
void WIListAdd(WIDATA Data)
{
- WIDATALIST *newItem;
-
// create a new datalist item and point to the data
- newItem = (WIDATALIST*)mir_alloc(sizeof(WIDATALIST));
+ WIDATALIST *newItem = (WIDATALIST*)mir_alloc(sizeof(WIDATALIST));
newItem->Data = Data;
// add to the linked list
newItem->next = NULL;
@@ -86,9 +84,7 @@ void DestroyWIList(void)
// add a new update item into the current list
void WIItemListAdd(WIDATAITEM *DataItem, WIDATA *Data)
{
- WIDATAITEMLIST *newItem;
-
- newItem = (WIDATAITEMLIST*)mir_alloc(sizeof(WIDATAITEMLIST));
+ WIDATAITEMLIST *newItem = (WIDATAITEMLIST*)mir_alloc(sizeof(WIDATAITEMLIST));
newItem->Item = *DataItem;
newItem->Next = NULL;
if (Data->UpdateData == NULL) Data->UpdateData = newItem;
@@ -146,35 +142,28 @@ void WICondListAdd(char *str, WICONDLIST *List)
}
// check if the condition string matched for the assignment
-BOOL IsContainedInCondList(const TCHAR *pszStr, WICONDLIST *List)
+bool IsContainedInCondList(const TCHAR *pszStr, WICONDLIST *List)
{
- WICONDITEM *Item = List->Head;
-
// loop through the list to find matching internal name
- while (Item != NULL) {
+ for (WICONDITEM *Item = List->Head; Item != NULL; Item = Item->Next) {
// if internal name found, return true indicating that the data is found
if ( _tcsstr(pszStr, Item->Item))
- return TRUE;
- Item = Item->Next;
+ return true;
+
}
// return false when no match found
- return FALSE;
+ return false;
}
// free the memory for icon assignment list
void DestroyCondList(WICONDLIST *List)
{
- WICONDITEM *temp;
-
- temp = List->Head;
-
// free the list one by one
- while (temp != NULL)
+ for (WICONDITEM *temp = List->Head;temp != NULL;temp = List->Head)
{
List->Head = temp->Next;
wfree(&temp->Item); // free the data struct
mir_free(temp);
- temp = List->Head;
}
// make sure the entire list is clear
List->Tail = NULL;
@@ -184,10 +173,9 @@ void DestroyCondList(WICONDLIST *List)
//============ LOADING INI FILES ============
// load the weather update data form INI files
-BOOL LoadWIData(BOOL dial)
+bool LoadWIData(bool dial)
{
- HANDLE hFind;
- TCHAR szSearchPath[MAX_PATH], FileName[MAX_PATH], *chop;
+ TCHAR szSearchPath[MAX_PATH], FileName[MAX_PATH];
WIN32_FIND_DATA fd;
WIDATA Data;
@@ -197,12 +185,12 @@ BOOL LoadWIData(BOOL dial)
// find all *.ini file in the plugin\weather directory
GetModuleFileName(GetModuleHandle(NULL), szSearchPath, SIZEOF(szSearchPath));
- chop = _tcsrchr(szSearchPath, '\\');
+ TCHAR *chop = _tcsrchr(szSearchPath, '\\');
*chop = '\0';
- _tcscat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"));
- _tcscpy(FileName, szSearchPath);
+ _tcsncat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"),SIZEOF(szSearchPath));
+ _tcsncpy(FileName, szSearchPath, SIZEOF(FileName));
- hFind = FindFirstFile(szSearchPath, &fd);
+ HANDLE hFind = FindFirstFile(szSearchPath, &fd);
// load the content of the ini file into memory
if (hFind != INVALID_HANDLE_VALUE) {
@@ -212,7 +200,8 @@ BOOL LoadWIData(BOOL dial)
_tcscat(FileName, fd.cFileName);
if ( _tcsicmp(fd.cFileName, _T("SAMPLE_INI.INI"))) {
LoadStationData(FileName, fd.cFileName, &Data);
- if (Data.Enabled) WIListAdd(Data);
+ if (Data.Enabled)
+ WIListAdd(Data);
}
// look through the entire "plugins\weather" directory
}
@@ -226,11 +215,11 @@ BOOL LoadWIData(BOOL dial)
hWndSetup = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETUP), NULL, DlgProcSetup);
else
MessageBox(NULL,
- TranslateT("No update data file is found. Please check your Plugins\\Weather directory."),
+ TranslateT("No update data file is found. Please check your Plugins\\Weather directory."),
TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// load the station data from a file
@@ -240,8 +229,6 @@ BOOL LoadWIData(BOOL dial)
void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
{
WIDATAITEM DataItem;
- FILE *pfile;
- int i;
char *Group, *Temp;
char *ValName, *Value;
@@ -264,7 +251,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
Data->Enabled = FALSE;
// open the ini file
- pfile = _tfsopen(pszFile, _T("rt"), _SH_DENYWR);
+ FILE *pfile = _tfsopen(pszFile, _T("rt"), _SH_DENYWR);
if (pfile != NULL) {
char Line[4096];
fgets(Line, SIZEOF(Line), pfile);
@@ -285,8 +272,9 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
Data->InternalVer = 6;
else
{
- mir_snprintf(Line, SIZEOF(Line), Translate("Invalid ini format for: %s"), pszFile);
- MessageBoxA(NULL, Line, Translate("Weather Protocol"), MB_OK|MB_ICONERROR);
+ TCHAR str[4096];
+ mir_sntprintf(str, SIZEOF(str), TranslateT("Invalid ini format for: %s"), pszFile);
+ MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK|MB_ICONERROR);
fclose(pfile);
return;
}
@@ -342,7 +330,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
Data->UpdateDataTail = NULL;
// initialize the icon assignment list
- for (i=0; i<10; i++)
+ for (int i=0; i<10; i++)
WICondListInit( &Data->CondList[i] );
while (!feof(pfile)) {
@@ -446,7 +434,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
else if ( !_stricmp(ValName, "MULT ID END")) wSetData(&Data->NameSearch.Multiple.ID.End, Value);
}
else if ( !_stricmp(Group, "ICONS")) {
- for (i=0; i<10; i++) {
+ for (int i=0; i<10; i++) {
if ( !_stricmp(ValName, statusStr[i])) {
WICondListAdd(Value, &Data->CondList[i]);
break;
@@ -496,11 +484,8 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
// Data = the struct to be freed
void FreeWIData(WIDATA *Data)
{
- WIDATAITEMLIST* WItem;
- int i;
-
// free update items linked list first
- WItem = Data->UpdateData;
+ WIDATAITEMLIST *WItem = Data->UpdateData;
while (WItem != NULL)
{
Data->UpdateData = WItem->Next;
@@ -536,7 +521,8 @@ void FreeWIData(WIDATA *Data)
FreeDataItem(&Data->NameSearch.Multiple.ID);
wfree(&Data->ShortFileName);
wfree(&Data->FileName);
- for (i=0; i<10; i++) DestroyCondList(&Data->CondList[i]);
+ for (int i=0; i<10; i++)
+ DestroyCondList(&Data->CondList[i]);
}
//============ WEATHER INI SETUP DIALOG ============
@@ -567,23 +553,23 @@ INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
{
case IDC_STEP1:
// update current data
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (WPARAM)_T("http://miranda-ng.org/"));
+ CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://miranda-ng.org/"));
break;
case IDC_STEP2:
{
- TCHAR szPath[1024], *chop;
- GetModuleFileName(GetModuleHandle(NULL), szPath, sizeof(szPath));
- chop = _tcsrchr(szPath, '\\');
+ TCHAR szPath[1024];
+ GetModuleFileName(GetModuleHandle(NULL), szPath, SIZEOF(szPath));
+ TCHAR *chop = _tcsrchr(szPath, '\\');
*chop = '\0';
- _tcscat(szPath, _T("\\Plugins\\weather\\"));
+ _tcsncat(szPath, _T("\\Plugins\\weather\\"),SIZEOF(szPath));
_tmkdir(szPath);
ShellExecute((HWND)lParam, _T("open"), szPath, _T(""), _T(""), SW_SHOW);
break;
}
case IDC_STEP3:
- if (LoadWIData(FALSE))
+ if (LoadWIData(false))
MessageBox(NULL,
TranslateT("All update data has been reloaded."),
TranslateT("Weather Protocol"), MB_OK|MB_ICONINFORMATION);