diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-23 12:01:39 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-23 12:01:39 +0000 |
commit | 021891ebbd16e9456d23b7c648bdb26c718d69d2 (patch) | |
tree | 240ea8b342afa8aa93c5d8f4258ee44258b4c9b8 /plugins/Console | |
parent | 3447ff8cda5ba4f4f219107e4907cb9aa8947497 (diff) |
Console:
plusified
git-svn-id: http://svn.miranda-ng.org/main/trunk@540 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Console')
-rw-r--r-- | plugins/Console/Console.cpp | 94 | ||||
-rw-r--r-- | plugins/Console/Console.vcxproj | 14 | ||||
-rw-r--r-- | plugins/Console/Console.vcxproj.filters | 6 | ||||
-rw-r--r-- | plugins/Console/commonheaders.h | 2 | ||||
-rw-r--r-- | plugins/Console/init.cpp | 29 |
5 files changed, 67 insertions, 78 deletions
diff --git a/plugins/Console/Console.cpp b/plugins/Console/Console.cpp index 2a568d98fa..24f187cee1 100644 --- a/plugins/Console/Console.cpp +++ b/plugins/Console/Console.cpp @@ -170,7 +170,7 @@ static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) void ScrollDown(LOGWIN * dat) {
if (dat->Scroll)
- ListView_EnsureVisible(dat->hList, ListView_GetItemCount( dat->hList ) - 1, FALSE);
+ ListView_EnsureVisible(dat->hwnd, ListView_GetItemCount(dat->hwnd) - 1, FALSE);
}
////////////////////////////////////////////////////////////////////////////////
@@ -195,7 +195,7 @@ static void ShowConsole(int show) SetForegroundWindow(hwnd);
if (show)
- RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME |RDW_UPDATENOW | RDW_ERASE);
+ RedrawWindow(pActive->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME |RDW_UPDATENOW | RDW_ERASE);
if (hMenu)
{
@@ -385,7 +385,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA dat->hList = GetDlgItem(hwndDlg, IDC_LIST);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)dat);
- SetWindowLongPtr(dat->hList, GWLP_USERDATA, SetWindowLongPtr(dat->hList,GWLP_WNDPROC,(LONG)SubclassProc));
+ SetWindowLongPtr(dat->hwnd, GWLP_USERDATA, SetWindowLongPtr(dat->hwnd, GWLP_WNDPROC, (LONG)SubclassProc));
// init buttons
{
@@ -414,12 +414,12 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA LVITEM lvi = {0};
LVCOLUMN sLC;
//ListView_SetUnicodeFormat(dat->hList, FALSE);
- ListView_SetImageList(dat->hList, gImg, LVSIL_SMALL);
+ ListView_SetImageList(dat->hwnd, gImg, LVSIL_SMALL);
sLC.mask = LVCF_FMT | LVCF_WIDTH;
sLC.fmt = LVCFMT_LEFT;
sLC.cx = 630;
- ListView_InsertColumn(dat->hList,0,&sLC);
- ListView_SetExtendedListViewStyle(dat->hList, LVS_EX_FULLROWSELECT);
+ ListView_InsertColumn(dat->hwnd, 0, &sLC);
+ ListView_SetExtendedListViewStyle(dat->hwnd, LVS_EX_FULLROWSELECT);
lvi.mask = LVIF_TEXT;
if (gIcons)
@@ -429,7 +429,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA }
lvi.pszText = TranslateT("*** Console started ***");
- ListView_InsertItem(dat->hList,&lvi);
+ ListView_InsertItem(dat->hwnd, &lvi);
}
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -458,20 +458,20 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA if (_tcsstr(str, _T("Data received")))
{
- if (gSeparator) ListView_InsertItem(dat->hList, &lvi);
+ if (gSeparator) ListView_InsertItem(dat->hwnd, &lvi);
lvi.iImage = IMG_IN;
}
else
if (_tcsstr(str, _T("Data sent")))
{
- if (gSeparator) ListView_InsertItem(dat->hList, &lvi);
+ if (gSeparator) ListView_InsertItem(dat->hwnd, &lvi);
lvi.iImage = IMG_OUT;
}
else
{
if (gSeparator && dat->newline)
{
- ListView_InsertItem(dat->hList, &lvi);
+ ListView_InsertItem(dat->hwnd, &lvi);
dat->newline = 0;
}
lvi.iImage = IMG_INFO;
@@ -488,7 +488,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA {
szBreak = lvi.pszText[wraplen];
lvi.pszText[wraplen] = 0;
- last = ListView_InsertItem(dat->hList, &lvi);
+ last = ListView_InsertItem(dat->hwnd, &lvi);
lvi.pszText[wraplen] = szBreak;
len -= wraplen;
lvi.pszText = &str[0] + tmplen - len;
@@ -500,7 +500,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA if (len && lvi.pszText[len-1] == '\r')
lvi.pszText[len-1] = 0;
- last = ListView_InsertItem(dat->hList, &lvi);
+ last = ListView_InsertItem(dat->hwnd, &lvi);
str = _tcstok(NULL, _T("\n"));
@@ -510,7 +510,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA if ( gVisible && dat == pActive && dat->Scroll == 1 )
- ListView_EnsureVisible(dat->hList, last, FALSE);
+ ListView_EnsureVisible(dat->hwnd, last, FALSE);
if (last > gLimit)
{
@@ -518,7 +518,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA while (idx >= 0)
{
- ListView_DeleteItem(dat->hList, idx);
+ ListView_DeleteItem(dat->hwnd, idx);
idx--;
}
}
@@ -553,7 +553,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA lvi.iImage = IMG_INFO;
lvi.iItem = 0x7FFFFFFF;
lvi.pszText = (dat->Paused) ? TranslateT("*** Console paused ***") : TranslateT("*** Console resumed ***");
- ListView_InsertItem(dat->hList,&lvi);
+ ListView_InsertItem(dat->hwnd, &lvi);
CheckDlgButton(hwndDlg,IDC_PAUSE,(dat->Paused)?BST_CHECKED:BST_UNCHECKED);
SendDlgItemMessage(hwndDlg,IDC_PAUSE,BM_SETIMAGE,IMAGE_ICON,(LPARAM)hIcons[((dat->Paused)?ICON_PAUSED:ICON_STARTED)]);
break;
@@ -571,19 +571,19 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA TCHAR szText[128];
TCHAR *src, *dst, *buf;
int flags = LVNI_BELOW;
- int count = ListView_GetSelectedCount(dat->hList);
+ int count = ListView_GetSelectedCount(dat->hwnd);
if (count)
flags |= LVNI_SELECTED;
else
- count = ListView_GetItemCount(dat->hList);
+ count = ListView_GetItemCount(dat->hwnd);
- dst = buf = malloc((count*(sizeof(szText)+1)+1)*sizeof(TCHAR));
+ dst = buf = (TCHAR*)malloc((count*(sizeof(szText)+1)+1)*sizeof(TCHAR));
if (!buf) break;
- while ((idx = ListView_GetNextItem(dat->hList,idx,flags)) > 0)
+ while ((idx = ListView_GetNextItem(dat->hwnd, idx, flags)) > 0)
{
- ListView_GetItemText(dat->hList, idx, 0, szText, sizeof(szText)-1);
+ ListView_GetItemText(dat->hwnd, idx, 0, szText, sizeof(szText)-1);
src = szText;
while (*dst++ = *src++);
dst--;
@@ -610,24 +610,24 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA case IDC_DELETE:
{
int idx = 0;
- int count = ListView_GetSelectedCount(dat->hList);
+ int count = ListView_GetSelectedCount(dat->hwnd);
if ( !count ) break;
- if ( count == ListView_GetItemCount(dat->hList)) {
+ if ( count == ListView_GetItemCount(dat->hwnd)) {
LVITEM lvi = {0};
- ListView_DeleteAllItems(dat->hList);
+ ListView_DeleteAllItems(dat->hwnd);
lvi.mask = LVIF_TEXT | LVIF_IMAGE;
lvi.iImage = IMG_INFO;
lvi.pszText = TranslateT("*** Console cleared ***");
- ListView_InsertItem(dat->hList,&lvi);
+ ListView_InsertItem(dat->hwnd, &lvi);
dat->newline = 0;
break;
}
- while ((idx = ListView_GetNextItem(dat->hList,idx,LVNI_BELOW|LVNI_SELECTED)) > 0)
+ while ((idx = ListView_GetNextItem(dat->hwnd, idx, LVNI_BELOW|LVNI_SELECTED)) > 0)
{
- ListView_DeleteItem(dat->hList,idx);
+ ListView_DeleteItem(dat->hwnd, idx);
idx--;
}
break;
@@ -637,19 +637,19 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA FILE *fp;
TCHAR szFile[MAX_PATH];
- if (!Openfile(szFile,ListView_GetSelectedCount(dat->hList))) break;
+ if (!Openfile(szFile, ListView_GetSelectedCount(dat->hwnd))) break;
fp = _tfopen(szFile, _T("wt"));
if (fp) {
int idx = 0;
TCHAR szText[128];
int flags = LVNI_BELOW;
- if (ListView_GetSelectedCount(dat->hList))
+ if (ListView_GetSelectedCount(dat->hwnd))
flags |= LVNI_SELECTED;
- while ((idx = ListView_GetNextItem(dat->hList,idx,flags)) > 0)
+ while ((idx = ListView_GetNextItem(dat->hwnd, idx, flags)) > 0)
{
- ListView_GetItemText(dat->hList, idx, 0, szText, sizeof(szText)-1);
+ ListView_GetItemText(dat->hwnd, idx, 0, szText, SIZEOF(szText)-1);
_ftprintf(fp, _T("%s\n"), szText);
}
fclose(fp);
@@ -678,7 +678,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA DestroyWindow(hwndDlg);
break;
case WM_DESTROY:
- SetWindowLongPtr(dat->hList, GWLP_WNDPROC, GetWindowLongPtr(dat->hList,GWLP_USERDATA));
+ SetWindowLongPtr(dat->hwnd, GWLP_WNDPROC, GetWindowLongPtr(dat->hwnd, GWLP_USERDATA));
SendMessage(hwndConsole, HM_REMOVE, 0, (LPARAM)dat);
break;
}
@@ -800,15 +800,15 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L if (pActive)
{
- col = ListView_GetBkColor(pActive->hList);
- ListView_SetBkColor(lw->hList, col);
- ListView_SetTextBkColor(lw->hList, col);
+ col = ListView_GetBkColor(pActive->hwnd);
+ ListView_SetBkColor(lw->hwnd, col);
+ ListView_SetTextBkColor(lw->hwnd, col);
- col = ListView_GetTextColor(pActive->hList);
- ListView_SetTextColor(lw->hList, col);
+ col = ListView_GetTextColor(pActive->hwnd);
+ ListView_SetTextColor(lw->hwnd, col);
if (hfLogFont)
- SendMessage(lw->hList, WM_SETFONT, (WPARAM)hfLogFont, (LPARAM)TRUE);
+ SendMessage(lw->hwnd, WM_SETFONT, (WPARAM)hfLogFont, (LPARAM)TRUE);
}
// hide startup window
@@ -852,7 +852,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
ScrollDown(pActive);
ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE);
- SetFocus(pActive->hList);
+ SetFocus(pActive->hwnd);
}
else
pActive = NULL;
@@ -872,9 +872,9 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L for ( i = 0; i < lModules.realCount; i++ )
{
lw = (LOGWIN*)lModules.items[i];
- ListView_SetTextColor(lw->hList, (COLORREF)lParam);
+ ListView_SetTextColor(lw->hwnd, (COLORREF)lParam);
if (wParam)
- SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE);
+ SendMessage(lw->hwnd, WM_SETFONT, wParam, (LPARAM)TRUE);
}
return TRUE;
}
@@ -886,10 +886,10 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L for ( i = 0; i < lModules.realCount; i++ )
{
lw = (LOGWIN*)lModules.items[i];
- ListView_SetBkColor(lw->hList, (COLORREF)lParam);
- ListView_SetTextBkColor(lw->hList, (COLORREF)lParam);
+ ListView_SetBkColor(lw->hwnd, (COLORREF)lParam);
+ ListView_SetTextBkColor(lw->hwnd, (COLORREF)lParam);
if (wParam)
- SendMessage(lw->hList, WM_SETFONT, wParam, (LPARAM)TRUE);
+ SendMessage(lw->hwnd, WM_SETFONT, wParam, (LPARAM)TRUE);
}
return TRUE;
}
@@ -935,8 +935,8 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L return TRUE;
}
case WM_SETFOCUS:
- if ( pActive ) {
- SetFocus(pActive->hList);
+ if (pActive) {
+ SetFocus(pActive->hwnd);
}
return TRUE;
case WM_NOTIFY:
@@ -962,7 +962,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L ScrollDown(pActive);
ShowWindow(hOld, SW_HIDE);
ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE);
- SetFocus(pActive->hList);
+ SetFocus(pActive->hwnd);
} else
SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
}
@@ -1408,7 +1408,7 @@ void InitConsole() mir_getUTFI(&utfi);
mir_getLI(&li);
- lModules.sortFunc = stringCompare;
+ lModules.sortFunc = (FSortFunc)stringCompare;
lModules.increment = 5;
hIcons[0] = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE));
diff --git a/plugins/Console/Console.vcxproj b/plugins/Console/Console.vcxproj index f2d98ecd9b..3dee25dae4 100644 --- a/plugins/Console/Console.vcxproj +++ b/plugins/Console/Console.vcxproj @@ -73,7 +73,7 @@ <ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_UNICODE;WIN32;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -96,7 +96,7 @@ <ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_UNICODE;WIN64;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -119,7 +119,7 @@ <Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_UNICODE;WIN32;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -145,7 +145,7 @@ <Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_UNICODE;WIN64;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;Console_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -167,11 +167,11 @@ </Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="Commonheaders.c">
+ <ClCompile Include="Commonheaders.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="Console.c" />
- <ClCompile Include="init.c" />
+ <ClCompile Include="Console.cpp" />
+ <ClCompile Include="init.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Commonheaders.h" />
diff --git a/plugins/Console/Console.vcxproj.filters b/plugins/Console/Console.vcxproj.filters index cc191810d3..7cb1fc485a 100644 --- a/plugins/Console/Console.vcxproj.filters +++ b/plugins/Console/Console.vcxproj.filters @@ -15,13 +15,13 @@ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="Commonheaders.c">
+ <ClCompile Include="Commonheaders.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="Console.c">
+ <ClCompile Include="Console.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="init.c">
+ <ClCompile Include="init.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/plugins/Console/commonheaders.h b/plugins/Console/commonheaders.h index c1add15988..e2024726eb 100644 --- a/plugins/Console/commonheaders.h +++ b/plugins/Console/commonheaders.h @@ -61,7 +61,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "version.h"
-HINSTANCE hInst;
+extern HINSTANCE hInst;
void InitConsole();
void ShutdownConsole();
diff --git a/plugins/Console/init.cpp b/plugins/Console/init.cpp index f52a8f3ae1..474c48a1a6 100644 --- a/plugins/Console/init.cpp +++ b/plugins/Console/init.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. PLUGINLINK *pluginLink;
DWORD mirandaVer;
int hLangpack;
+HINSTANCE hInst;
PLUGININFOEX pluginInfoEx={
sizeof(PLUGININFOEX),
@@ -41,48 +42,36 @@ PLUGININFOEX pluginInfoEx={ MIID_CONSOLE
};
-
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
hInst = hinstDLL;
return TRUE;
}
-////////////////////////////////////////////////////////////////////////////////
-
-__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- mirandaVer = mirandaVersion;
return &pluginInfoEx;
}
// we implement service mode interface
static const MUUID interfaces[] = {MIID_LOGWINDOW, MIID_LAST};
-__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
return interfaces;
}
-////////////////////////////////////////////////////////////////////////////////
-
-int __declspec(dllexport) Load(PLUGINLINK *link)
+extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
{
pluginLink = link;
mir_getLP(&pluginInfoEx);
- if (mirandaVer < PLUGIN_MAKE_VERSION(0,8,0,3))
- return -1;
- else
- {
- InitCommonControls();
- InitConsole();
- return 0;
- }
+ InitCommonControls();
+ InitConsole();
+ return 0;
}
-
-int __declspec(dllexport) Unload(void)
+extern "C" __declspec(dllexport) int Unload(void)
{
ShutdownConsole();
return 0;
-}
+}
\ No newline at end of file |