Author: ashaposhnikov
Date: Wed Jul 26 13:30:46 2017
New Revision: 75411
URL:
http://svn.reactos.org/svn/reactos?rev=75411&view=rev
Log:
[RAPPS] Making checkboxes useful WIP
- Added selection counter
*NOTE: This requires changes in lang files*
- Added Sellect/Desellect button functionality
- Fixed some typos and macros-to-wide-functions
Modified:
branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp
branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp
branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp
branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc
branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc
branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
==============================================================================
--- branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1]
(original)
+++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1]
Wed Jul 26 13:30:46 2017
@@ -11,7 +11,6 @@
#include "rapps.h"
// CAvailableApplicationInfo
-
CAvailableApplicationInfo::CAvailableApplicationInfo(const ATL::CStringW&
sFileNameParam)
: m_Parser(sFileNameParam)
{
@@ -311,7 +310,7 @@
m_InfoList.RemoveAt(LastListPosition);
delete Info;
- Info = nullptr;
+ Info = NULL;
break;
}
else
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
==============================================================================
--- branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp [iso-8859-1]
(original)
+++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp [iso-8859-1] Wed Jul
26 13:30:46 2017
@@ -111,8 +111,8 @@
ATL::CStringW szLangInfo;
ATL::CStringW szLoadedTextAvailability;
ATL::CStringW szLoadedAInfoText;
+
szLoadedAInfoText.LoadStringW(IDS_AINFO_LANGUAGES);
-
//TODO: replace those hardcoded strings
if (Info->HasNativeLanguage())
@@ -199,7 +199,7 @@
DeleteObject(hImage);
}
- HIMAGELIST InitImageList(VOID)
+ HIMAGELIST InitImageList()
{
HIMAGELIST hImageList;
@@ -328,13 +328,14 @@
int iSubItem;
};
- BOOL HasAllChecked;
+ BOOL bHasAllChecked;
+ BOOL bAscending;
+
public:
- BOOL bAscending;
-
- CAppsListView()
- {
- bAscending = TRUE;
+ CAppsListView() :
+ bAscending(TRUE),
+ bHasAllChecked(FALSE)
+ {
}
VOID ColumnClick(LPNMLISTVIEW pnmv)
@@ -349,7 +350,7 @@
PVOID GetLParam(INT Index)
{
INT ItemIndex;
- LVITEM Item;
+ LVITEMW Item;
if (Index == -1)
{
@@ -379,13 +380,13 @@
BOOL AddColumn(INT Index, LPWSTR lpText, INT Width, INT Format)
{
- LV_COLUMN Column;
+ LV_COLUMNW Column;
ZeroMemory(&Column, sizeof(Column));
Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
Column.iSubItem = Index;
- Column.pszText = (LPTSTR) lpText;
+ Column.pszText = lpText;
Column.cx = Width;
Column.fmt = Format;
@@ -449,18 +450,39 @@
if (hwnd)
{
- SetExtendedListViewStyle(LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT );
+ SetExtendedListViewStyle(LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);
}
return hwnd;
}
+ BOOL GetCheckState(INT item)
+ {
+ return (BOOL) GetItemState(item, LVIS_STATEIMAGEMASK);
+ }
+
+ VOID SetCheckState(INT item, BOOL fCheck)
+ {
+ SetItemState(item, INDEXTOSTATEIMAGEMASK((fCheck) ? 2 : 1),
LVIS_STATEIMAGEMASK);
+ }
+
VOID CheckAll()
{
- if (HasAllChecked)
- {
-
- }
+ bHasAllChecked = !bHasAllChecked;
+ SetCheckState(-1, bHasAllChecked);
+ }
+
+ ATL::CAtlList<PAPPLICATION_INFO> GetCheckedItems()
+ {
+ ATL::CAtlList<PAPPLICATION_INFO> list;
+ for (INT i = 0; i != -1; i = GetNextItem(i, LVNI_ALL))
+ {
+ if (GetCheckState(i) != FALSE)
+ {
+ list.AddTail((PAPPLICATION_INFO) GetItemData(i));
+ }
+ }
+ return list;
}
};
@@ -558,23 +580,24 @@
CUiWindow<CRichEdit> * m_RichEdit;
CUiWindow<CSearchBar> * m_SearchBar;
+ CAvailableApps m_AvailableApps;
LPWSTR pLink;
- BOOL SearchEnabled;
-
- CAvailableApps m_AvailableApps;
-
+ INT nSelectedApps;
+
+ BOOL bSearchEnabled;
+ BOOL bUpdating;
public:
CMainWindow() :
m_ClientPanel(NULL),
pLink(NULL),
- SearchEnabled(FALSE)
+ bSearchEnabled(FALSE)
{
}
private:
- VOID InitApplicationsList(VOID)
+ VOID InitApplicationsList()
{
ATL::CStringW szText;
@@ -597,7 +620,7 @@
return m_TreeView->AddCategory(hRootItem, TextIndex, IconIndex);
}
- VOID InitCategoriesList(VOID)
+ VOID InitCategoriesList()
{
HTREEITEM hRootItem;
@@ -703,7 +726,7 @@
return m_HSplitter->Create(m_hWnd) != NULL;
}
- BOOL CreateSearchBar(VOID)
+ BOOL CreateSearchBar()
{
m_SearchBar = new CUiWindow<CSearchBar>();
m_SearchBar->m_VerticalAlignment = UiAlign_LeftTop;
@@ -716,7 +739,8 @@
BOOL CreateLayout()
{
- bool b = TRUE;
+ BOOL b = TRUE;
+ bUpdating = TRUE;
m_ClientPanel = new CUiPanel();
m_ClientPanel->m_VerticalAlignment = UiAlign_Stretch;
@@ -754,6 +778,7 @@
m_VSplitter->m_Margin.bottom = rBottom.bottom - rBottom.top;
}
+ bUpdating = FALSE;
return b;
}
@@ -761,16 +786,13 @@
{
if (CreateLayout())
{
- ATL::CStringW szBuffer1, szBuffer2;
InitApplicationsList();
-
InitCategoriesList();
- szBuffer2.LoadStringW(hInst, IDS_APPS_COUNT);
- szBuffer1.Format(szBuffer2, m_ListView->GetItemCount());
-
- m_StatusBar->SetText(szBuffer1);
+ nSelectedApps = 0;
+ UpdateStatusBarText();
+
return TRUE;
}
@@ -998,6 +1020,13 @@
if (IS_AVAILABLE_ENUM(SelectedEnumType))
CAvailableAppView::ShowAvailableAppInfo(ItemIndex);
}
+ /* Check if the item is checked */
+ if ((pnic->uNewState & LVIS_STATEIMAGEMASK) &&
!bUpdating)
+ {
+ BOOL checked = m_ListView->GetCheckState(pnic->iItem);
+ nSelectedApps += (checked) ? 1 : -1;
+ UpdateStatusBarText();
+ }
}
}
break;
@@ -1083,10 +1112,10 @@
if (wParam == SEARCH_TIMER_ID)
{
::KillTimer(hwnd, SEARCH_TIMER_ID);
- if (SearchEnabled)
+ if (bSearchEnabled)
UpdateApplicationsList(-1);
}
- break;
+ break;
}
return FALSE;
@@ -1119,7 +1148,7 @@
}
}
- BOOL IsSelectedNodeInstalled(void)
+ BOOL IsSelectedNodeInstalled()
{
HTREEITEM hSelectedItem = m_TreeView->GetSelection();
TV_ITEM tItem;
@@ -1156,7 +1185,7 @@
m_SearchBar->GetWindowTextW(szWndText);
if (szBuf == szWndText)
{
- SearchEnabled = FALSE;
+ bSearchEnabled = FALSE;
m_SearchBar->SetWindowTextW(L"");
}
}
@@ -1168,7 +1197,7 @@
if (szBuf.IsEmpty())
{
szBuf.LoadStringW(hInst, IDS_SEARCH_TEXT);
- SearchEnabled = FALSE;
+ bSearchEnabled = FALSE;
m_SearchBar->SetWindowTextW(szBuf.GetString());
}
}
@@ -1178,9 +1207,9 @@
{
ATL::CStringW szWndText;
- if (!SearchEnabled)
+ if (!bSearchEnabled)
{
- SearchEnabled = TRUE;
+ bSearchEnabled = TRUE;
break;
}
@@ -1265,13 +1294,14 @@
break;
case ID_CHECK_ALL:
- break;
- }
- }
-
- VOID FreeInstalledAppList(VOID)
- {
- INT Count = ListView_GetItemCount(hListView) - 1;
+ m_ListView->CheckAll();
+ break;
+ }
+ }
+
+ VOID FreeInstalledAppList()
+ {
+ INT Count = m_ListView->GetItemCount() - 1;
PINSTALLED_INFO Info;
while (Count >= 0)
@@ -1369,32 +1399,44 @@
return TRUE;
}
+ VOID UpdateStatusBarText()
+ {
+ if (m_StatusBar)
+ {
+ ATL::CStringW szBuffer1, szBuffer2;
+
+ szBuffer2.LoadStringW(hInst, IDS_APPS_COUNT);
+ szBuffer1.Format(szBuffer2, m_ListView->GetItemCount(), nSelectedApps);
+ m_StatusBar->SetText(szBuffer1);
+ }
+ }
VOID UpdateApplicationsList(INT EnumType)
{
ATL::CStringW szBuffer1, szBuffer2;
HIMAGELIST hImageListView;
-
- m_ListView->SendMessageW(WM_SETREDRAW, FALSE, 0);
-
+ bUpdating = TRUE;
+
+ m_ListView->SetRedraw(FALSE);
+
+ nSelectedApps = 0;
if (EnumType < 0) EnumType = SelectedEnumType;
if (IS_INSTALLED_ENUM(SelectedEnumType))
FreeInstalledAppList();
- (VOID) ListView_DeleteAllItems(hListView);
+ m_ListView->DeleteAllItems();
/* Create new ImageList */
hImageListView = ImageList_Create(LISTVIEW_ICON_SIZE,
LISTVIEW_ICON_SIZE,
GetSystemColorDepth() | ILC_MASK,
0, 1);
- HIMAGELIST hImageListBuf = ListView_SetImageList(hListView, hImageListView,
LVSIL_SMALL);
+ HIMAGELIST hImageListBuf = m_ListView->SetImageList(hImageListView,
LVSIL_SMALL);
if (hImageListBuf)
{
ImageList_Destroy(hImageListBuf);
}
-
if (IS_AVAILABLE_ENUM(EnumType))
{
@@ -1404,17 +1446,16 @@
SelectedEnumType = EnumType;
- szBuffer2.LoadStringW(hInst, IDS_APPS_COUNT);
- szBuffer1.Format(szBuffer2, ListView_GetItemCount(hListView));
- SetStatusBarText(szBuffer1);
+ UpdateStatusBarText();
SetWelcomeText();
/* set automatic column width for program names if the list is not empty */
- if (ListView_GetItemCount(hListView) > 0)
- ListView_SetColumnWidth(hListView, 0, LVSCW_AUTOSIZE);
-
- SendMessageW(hListView, WM_SETREDRAW, TRUE, 0);
+ if (m_ListView->GetItemCount() > 0)
+ ListView_SetColumnWidth(m_ListView->GetWindow(), 0, LVSCW_AUTOSIZE);
+
+ bUpdating = FALSE;
+ m_ListView->SetRedraw(TRUE);
}
public:
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
==============================================================================
--- branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp [iso-8859-1]
(original)
+++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp [iso-8859-1]
Wed Jul 26 13:30:46 2017
@@ -101,7 +101,7 @@
WCHAR szAppName[MAX_STR_LEN];
DWORD dwType, dwSize;
INT ItemIndex;
- LVITEM Item;
+ LVITEMW Item;
HKEY hKey;
PINSTALLED_INFO ItemInfo;
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
==============================================================================
--- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc [iso-8859-1]
(original)
+++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc [iso-8859-1]
Wed Jul 26 13:30:46 2017
@@ -110,6 +110,16 @@
ICON IDI_MAIN, IDC_STATIC, 10, 10, 7, 30
END
+IDD_DOWNLOAD_DIALOG_MULTI DIALOGEX 0, 0, 220, 72
+STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE
+CAPTION "Downloading (multiple)..."
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CONTROL "Progress1", IDC_DOWNLOAD_PROGRESS, "msctls_progress32",
WS_BORDER | PBS_SMOOTH, 10, 10, 200, 12
+ EDITTEXT IDC_DOWNLOAD_STATUS, 10, 28, 200, 22, ES_CENTER | ES_MULTILINE |
ES_AUTOVSCROLL | ES_READONLY | WS_DISABLED | NOT WS_BORDER
+ PUSHBUTTON "Cancel", IDCANCEL, 85, 53, 50, 15, WS_GROUP | WS_TABSTOP
+END
+
STRINGTABLE
BEGIN
IDS_TOOLTIP_INSTALL "Install"
@@ -187,7 +197,7 @@
IDS_INSTALL "Install"
IDS_UNINSTALL "Uninstall"
IDS_MODIFY "Modify"
- IDS_APPS_COUNT "Applications count: %d"
+ IDS_APPS_COUNT "Applications count: %d; Selected: %d"
IDS_WELCOME_TITLE "Welcome to ReactOS Applications Manager!\n\n"
IDS_WELCOME_TEXT "Choose a category on the left, then choose an application to
install or uninstall.\nReactOS Web Site: "
IDS_WELCOME_URL "http://www.reactos.org"
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
==============================================================================
--- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc [iso-8859-1]
(original)
+++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc [iso-8859-1]
Wed Jul 26 13:30:46 2017
@@ -91,7 +91,7 @@
END
IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 72
-STYLE DS_SHELLFONT | DS_CENTER | WS_BORDER | WS_CAPTION | WS_POPUP | WS_SYSMENU |
WS_VISIBLE
+STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_SYSMENU | WS_VISIBLE
CAPTION "ÐагÑÑзка..."
FONT 8, "MS Shell Dlg"
BEGIN
@@ -186,7 +186,7 @@
IDS_INSTALL "УÑÑановиÑÑ"
IDS_UNINSTALL "УдалиÑÑ"
IDS_MODIFY "ÐзмениÑÑ"
- IDS_APPS_COUNT "ÐолиÑеÑÑво: %d"
+ IDS_APPS_COUNT "ÐолиÑеÑÑво пÑиложений: %d; ÐÑбÑано:
%d"
IDS_WELCOME_TITLE "ÐобÑо пожаловаÑÑ Ð²
""ÐÐµÐ½ÐµÐ´Ð¶ÐµÑ Ð¿Ñиложений ReactOS""!\n\n"
IDS_WELCOME_TEXT "ÐÑбеÑиÑе каÑегоÑÐ¸Ñ Ñлева и
пÑиложение Ð´Ð»Ñ ÑÑÑановки или ÑдалениÑ.\nÐ¡Ð°Ð¹Ñ ReactOS:
"
IDS_WELCOME_URL "http://www.reactos.org"
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
==============================================================================
--- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc [iso-8859-1]
(original)
+++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc [iso-8859-1]
Wed Jul 26 13:30:46 2017
@@ -99,7 +99,7 @@
END
IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 72
-STYLE DS_SHELLFONT | DS_CENTER | WS_BORDER | WS_CAPTION | WS_POPUP | WS_SYSMENU |
WS_VISIBLE
+STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_SYSMENU | WS_VISIBLE
CAPTION "ÐаванÑаженнÑ..."
FONT 8, "MS Shell Dlg"
BEGIN
@@ -194,7 +194,7 @@
IDS_INSTALL "ÐÑÑановиÑи"
IDS_UNINSTALL "ÐидалиÑи"
IDS_MODIFY "ÐмÑниÑи"
- IDS_APPS_COUNT "KÑлÑкÑÑÑÑ Ð´Ð¾Ð´Ð°ÑкÑв: %d"
+ IDS_APPS_COUNT "KÑлÑкÑÑÑÑ Ð´Ð¾Ð´Ð°ÑкÑв: %d; ÐбÑано: %d"
IDS_WELCOME_TITLE "ÐаÑкаво пÑоÑимо в ÐенеджеÑ
додаÑкÑв ReactOS!\n\n"
IDS_WELCOME_TEXT "ÐибеÑÑÑÑ ÐºÐ°ÑегоÑÑÑ Ð·Ð»Ñва, а поÑÑм
вибеÑÑÑÑ Ð¿ÑогÑами Ð´Ð»Ñ Ð²ÑÑÐ°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ñи
видаленнÑ.\nСÑоÑÑнка ReactOS: "
IDS_WELCOME_URL "http://www.reactos.org"