https://git.reactos.org/?p=reactos.git;a=commitdiff;h=872289446dbe14ba9e6dc…
commit 872289446dbe14ba9e6dcaa1c48080e52cd7da64
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Sun Apr 28 06:30:32 2019 +0300
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Tue Aug 20 00:43:48 2019 +0200
[RAPPS] CMainWindow: remove unused functions , and the globals g_MainWindow and
hListView
---
base/applications/rapps/CMakeLists.txt | 1 -
base/applications/rapps/gui.cpp | 148 ++++++--------------------------
base/applications/rapps/include/gui.h | 16 ----
base/applications/rapps/include/rapps.h | 1 -
base/applications/rapps/installed.cpp | 1 -
base/applications/rapps/misc.cpp | 1 -
6 files changed, 24 insertions(+), 144 deletions(-)
diff --git a/base/applications/rapps/CMakeLists.txt
b/base/applications/rapps/CMakeLists.txt
index f3dea22852b..ea0cf7d34f8 100644
--- a/base/applications/rapps/CMakeLists.txt
+++ b/base/applications/rapps/CMakeLists.txt
@@ -20,7 +20,6 @@ list(APPEND SOURCE
unattended.cpp
include/rapps.h
include/available.h
- include/gui.h
include/dialogs.h
include/installed.h
include/crichedit.h
diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp
index adba84ac449..55df5152175 100644
--- a/base/applications/rapps/gui.cpp
+++ b/base/applications/rapps/gui.cpp
@@ -26,8 +26,6 @@
#define LISTVIEW_ICON_SIZE 24
#define TREEVIEW_ICON_SIZE 24
-HWND hListView = NULL;
-
INT GetSystemColorDepth()
{
DEVMODEW pDevMode;
@@ -508,24 +506,6 @@ public:
bIsAscending = !bIsAscending;
}
- PVOID GetLParam(INT Index)
- {
- INT ItemIndex;
-
- if (Index == -1)
- {
- ItemIndex = (INT) SendMessage(LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
- if (ItemIndex == -1)
- return NULL;
- }
- else
- {
- ItemIndex = Index;
- }
-
- return (PVOID) GetItemData(ItemIndex);
- }
-
BOOL AddColumn(INT Index, ATL::CStringW& Text, INT Width, INT Format)
{
return AddColumn(Index, const_cast<LPWSTR>(Text.GetString()), Width,
Format);
@@ -898,8 +878,7 @@ private:
m_ListView->m_HorizontalAlignment = UiAlign_Stretch;
m_HSplitter->First().Append(m_ListView);
- hListView = m_ListView->Create(m_hWnd);
- return hListView != NULL;
+ return m_ListView->Create(m_hWnd) != NULL;
}
BOOL CreateRichEdit()
@@ -1647,7 +1626,7 @@ private:
while (Count >= 0)
{
- Info = (PINSTALLED_INFO) ListViewGetlParam(Count);
+ Info = (PINSTALLED_INFO) m_ListView->GetItemData(Count);
if (Info)
{
RegCloseKey(Info->hSubKey);
@@ -1702,7 +1681,7 @@ private:
INT Index;
HICON hIcon = NULL;
- HIMAGELIST hImageListView = ListView_GetImageList(hListView, LVSIL_SMALL);
+ HIMAGELIST hImageListView =
(HIMAGELIST)m_ListView->SendMessage(LVM_GETIMAGELIST, LVSIL_SMALL, 0);
if (!SearchPatternMatch(Info->m_szName.GetString(), szSearchPattern)
&&
!SearchPatternMatch(Info->m_szDesc.GetString(), szSearchPattern))
@@ -1876,116 +1855,37 @@ public:
return CWindowImpl::Create(NULL, r, szWindowName.GetString(), WS_OVERLAPPEDWINDOW
| WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
}
-
- CStatusBar * GetStatusBar()
- {
- return m_StatusBar;
- }
-
- CAppsListView * GetListView()
- {
- return m_ListView;
- }
-
- CRichEdit * GetRichEdit()
- {
- return m_RichEdit;
- }
-
- CAvailableApps * GetAvailableApps()
- {
- return &m_AvailableApps;
- }
};
-// global interface
-CMainWindow * g_MainWindow;
-
-HWND CreateMainWindow()
-{
- g_MainWindow = new CMainWindow();
- return g_MainWindow->Create();
-}
-
-DWORD_PTR ListViewGetlParam(INT item)
-{
- if (item < 0)
- {
- item = g_MainWindow->GetListView()->GetSelectionMark();
- }
- return g_MainWindow->GetListView()->GetItemData(item);
-}
-
-VOID SetStatusBarText(LPCWSTR szText)
-{
- g_MainWindow->GetStatusBar()->SetText(szText);
-}
-
-INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpName, LPARAM lParam)
-{
- return g_MainWindow->GetListView()->AddItem(ItemIndex, IconIndex, lpName,
lParam);
-}
-
-VOID NewRichEditText(LPCWSTR szText, DWORD flags)
-{
- g_MainWindow->GetRichEdit()->SetText(szText, flags);
-}
-
-VOID InsertRichEditText(LPCWSTR szText, DWORD flags)
-{
- g_MainWindow->GetRichEdit()->InsertText(szText, flags);
-}
-
-CAvailableApps* GetAvailableApps()
-{
- return g_MainWindow->GetAvailableApps();
-}
-
-// ATL version of functions above
-VOID SetStatusBarText(const ATL::CStringW& szText)
-{
- SetStatusBarText(szText.GetString());
-}
-
-INT ListViewAddItem(INT ItemIndex, INT IconIndex, const ATL::CStringW& Name, LPARAM
lParam)
-{
- return ListViewAddItem(ItemIndex, IconIndex,
const_cast<LPWSTR>(Name.GetString()), lParam);
-}
-
-VOID NewRichEditText(const ATL::CStringW& szText, DWORD flags)
-{
- NewRichEditText(szText.GetString(), flags);
-}
-
-VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags)
-{
- InsertRichEditText(szText.GetString(), flags);
-}
-
VOID ShowMainWindow(INT nShowCmd)
{
HACCEL KeyBrd;
MSG Msg;
- hMainWnd = CreateMainWindow();
+ CMainWindow* wnd = new CMainWindow();
+ if (!wnd)
+ return;
- if (hMainWnd)
- {
- /* Maximize it if we must */
- ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos &&
SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd));
- UpdateWindow(hMainWnd);
+ hMainWnd = wnd->Create();
+ if (!hMainWnd)
+ return;
- /* Load the menu hotkeys */
- KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS));
+ /* Maximize it if we must */
+ ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ?
SW_MAXIMIZE : nShowCmd));
+ UpdateWindow(hMainWnd);
- /* Message Loop */
- while (GetMessageW(&Msg, NULL, 0, 0))
+ /* Load the menu hotkeys */
+ KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS));
+
+ /* Message Loop */
+ while (GetMessageW(&Msg, NULL, 0, 0))
+ {
+ if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg))
{
- if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg))
- {
- TranslateMessage(&Msg);
- DispatchMessageW(&Msg);
- }
+ TranslateMessage(&Msg);
+ DispatchMessageW(&Msg);
}
- }
+ }
+
+ delete wnd;
}
diff --git a/base/applications/rapps/include/gui.h
b/base/applications/rapps/include/gui.h
deleted file mode 100644
index 974a24d3d29..00000000000
--- a/base/applications/rapps/include/gui.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-#include <windef.h>
-#include <atlstr.h>
-
-DWORD_PTR ListViewGetlParam(INT item);
-INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpName, LPARAM lParam);
-VOID SetStatusBarText(LPCWSTR szText);
-VOID NewRichEditText(LPCWSTR szText, DWORD flags);
-VOID InsertRichEditText(LPCWSTR szText, DWORD flags);
-
-VOID SetStatusBarText(const ATL::CStringW& szText);
-INT ListViewAddItem(INT ItemIndex, INT IconIndex, const ATL::CStringW& Name, LPARAM
lParam);
-VOID NewRichEditText(const ATL::CStringW& szText, DWORD flags);
-VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags);
-CAvailableApps * GetAvailableApps();
-extern HWND hListView;
diff --git a/base/applications/rapps/include/rapps.h
b/base/applications/rapps/include/rapps.h
index d3534412703..43d8a5e8e0b 100644
--- a/base/applications/rapps/include/rapps.h
+++ b/base/applications/rapps/include/rapps.h
@@ -7,6 +7,5 @@
#include "installed.h"
#include "available.h"
#include "misc.h"
-#include "gui.h"
#endif /* _RAPPS_H */
diff --git a/base/applications/rapps/installed.cpp
b/base/applications/rapps/installed.cpp
index dda0bbfdcff..c35f141f526 100644
--- a/base/applications/rapps/installed.cpp
+++ b/base/applications/rapps/installed.cpp
@@ -10,7 +10,6 @@
#include "installed.h"
-#include "gui.h"
#include "misc.h"
BOOL INSTALLED_INFO::GetApplicationString(LPCWSTR lpKeyName, ATL::CStringW& String)
diff --git a/base/applications/rapps/misc.cpp b/base/applications/rapps/misc.cpp
index cb18503cc13..d7bd62c9d99 100644
--- a/base/applications/rapps/misc.cpp
+++ b/base/applications/rapps/misc.cpp
@@ -9,7 +9,6 @@
*/
#include "rapps.h"
-#include "gui.h"
#include "misc.h"
static HANDLE hLog = NULL;