[RAPPS] Merged two Installed and Available enum values into one enum
authorAlexander Shaposhnikov <sanchaez@reactos.org>
Sun, 3 Sep 2017 21:10:24 +0000 (21:10 +0000)
committerAlexander Shaposhnikov <sanchaez@reactos.org>
Sun, 3 Sep 2017 21:10:24 +0000 (21:10 +0000)
svn path=/branches/GSoC_2017/rapps/; revision=75761

reactos/base/applications/rapps/gui.cpp
reactos/base/applications/rapps/include/available.h
reactos/base/applications/rapps/include/defines.h
reactos/base/applications/rapps/include/installed.h
reactos/base/applications/rapps/installed.cpp
reactos/base/applications/rapps/winmain.cpp

index 642ff4f..61fb7d1 100644 (file)
@@ -923,7 +923,7 @@ private:
             FreeLogs();
             m_AvailableApps.FreeCachedEntries();
 
-            if (IS_INSTALLED_ENUM(SelectedEnumType))
+            if (IsInstalledEnum(SelectedEnumType))
                 FreeInstalledAppList();
 
             delete m_ClientPanel;
@@ -953,7 +953,7 @@ private:
                         break;
 
                     case IDS_APPLICATIONS:
-                        UpdateApplicationsList(ENUM_APPLICATIONS);
+                        UpdateApplicationsList(ENUM_INSTALLED_APPLICATIONS);
                         break;
 
                     case IDS_UPDATES:
@@ -1087,7 +1087,7 @@ private:
                         (pnic->uNewState & LVIS_FOCUSED) &&
                         !(pnic->uOldState & LVIS_FOCUSED))
                     {
-                        if (IS_INSTALLED_ENUM(SelectedEnumType))
+                        if (IsInstalledEnum(SelectedEnumType))
                             ShowInstalledAppInfo(ItemIndex);
                         if (IsAvailableEnum(SelectedEnumType))
                             CAvailableAppView::ShowAvailableAppInfo(ItemIndex);
@@ -1125,7 +1125,7 @@ private:
             {
                 if (data->hwndFrom == m_ListView->m_hWnd && ((LPNMLISTVIEW) lParam)->iItem != -1)
                 {
-                    if (IS_INSTALLED_ENUM(SelectedEnumType))
+                    if (IsInstalledEnum(SelectedEnumType))
                         ShowInstalledAppInfo(-1);
                     if (IsAvailableEnum(SelectedEnumType))
                         CAvailableAppView::ShowAvailableAppInfo(-1);
@@ -1502,7 +1502,7 @@ private:
     {
         ATL::CStringW szBuffer1, szBuffer2;
         HIMAGELIST hImageListView;
-        BOOL bWasInInstalled = IS_INSTALLED_ENUM(SelectedEnumType);
+        BOOL bWasInInstalled = IsInstalledEnum(SelectedEnumType);
 
         bUpdating = TRUE;
         m_ListView->SetRedraw(FALSE);
@@ -1533,7 +1533,7 @@ private:
             ImageList_Destroy(hImageListBuf);
         }
 
-        if (IS_INSTALLED_ENUM(EnumType))
+        if (IsInstalledEnum(EnumType))
         {
             if (!bWasInInstalled)
             {
index 7711e47..59c1546 100644 (file)
@@ -7,34 +7,6 @@
 
 #include "misc.h"
 
-/* EnumType flags for EnumAvailableApplications */
-enum AvailableCategories
-{
-    ENUM_ALL_AVAILABLE,
-    ENUM_CAT_AUDIO,
-    ENUM_CAT_VIDEO,
-    ENUM_CAT_GRAPHICS,
-    ENUM_CAT_GAMES,
-    ENUM_CAT_INTERNET,
-    ENUM_CAT_OFFICE,
-    ENUM_CAT_DEVEL,
-    ENUM_CAT_EDU,
-    ENUM_CAT_ENGINEER,
-    ENUM_CAT_FINANCE,
-    ENUM_CAT_SCIENCE,
-    ENUM_CAT_TOOLS,
-    ENUM_CAT_DRIVERS,
-    ENUM_CAT_LIBS,
-    ENUM_CAT_OTHER,
-    ENUM_AVAILABLE_MIN = ENUM_ALL_AVAILABLE,
-    ENUM_AVAILABLE_MAX = ENUM_CAT_OTHER
-};
-
-inline BOOL IsAvailableEnum(INT x)
-{
-    return (x >= AvailableCategories::ENUM_AVAILABLE_MIN && x <= AvailableCategories::ENUM_AVAILABLE_MAX);
-}
-
 enum LicenseType
 {
     LICENSE_NONE,
index 63d0dca..935cf6d 100644 (file)
 
 #define APPLICATION_DATABASE_URL L"https://svn.reactos.org/packages/rappmgr.cab"
 #define MAX_STR_LEN              256
-#define ENUM_ALL_COMPONENTS      30
+
+enum AppsCategories
+{
+    ENUM_ALL_AVAILABLE,
+    ENUM_CAT_AUDIO,
+    ENUM_CAT_VIDEO,
+    ENUM_CAT_GRAPHICS,
+    ENUM_CAT_GAMES,
+    ENUM_CAT_INTERNET,
+    ENUM_CAT_OFFICE,
+    ENUM_CAT_DEVEL,
+    ENUM_CAT_EDU,
+    ENUM_CAT_ENGINEER,
+    ENUM_CAT_FINANCE,
+    ENUM_CAT_SCIENCE,
+    ENUM_CAT_TOOLS,
+    ENUM_CAT_DRIVERS,
+    ENUM_CAT_LIBS,
+    ENUM_CAT_OTHER,
+    ENUM_ALL_INSTALLED,
+    ENUM_INSTALLED_APPLICATIONS = 31,
+    ENUM_UPDATES = 32,
+    ENUM_INSTALLED_MIN = ENUM_ALL_INSTALLED,
+    ENUM_INSTALLED_MAX = ENUM_UPDATES,
+    ENUM_AVAILABLE_MIN = ENUM_ALL_AVAILABLE,
+    ENUM_AVAILABLE_MAX = ENUM_CAT_OTHER,
+};
+
+inline BOOL IsAvailableEnum(INT x)
+{
+    return (x >= AppsCategories::ENUM_AVAILABLE_MIN && x <= AppsCategories::ENUM_AVAILABLE_MAX);
+}
+
+inline BOOL IsInstalledEnum(INT x)
+{
+    return (x >= AppsCategories::ENUM_INSTALLED_MIN && x <= AppsCategories::ENUM_INSTALLED_MAX);
+}
index 6b6112c..882ebce 100644 (file)
@@ -3,14 +3,6 @@
 #include <windef.h>
 #include <atlstr.h>
 
-#define ENUM_APPLICATIONS      31
-#define ENUM_UPDATES           32
-
-#define ENUM_INSTALLED_MIN ENUM_ALL_COMPONENTS
-#define ENUM_INSTALLED_MAX ENUM_UPDATES
-
-#define IS_INSTALLED_ENUM(a) (a >= ENUM_INSTALLED_MIN && a <= ENUM_INSTALLED_MAX)
-
 struct INSTALLED_INFO
 {
     HKEY hRootKey;
index 33b80e8..e69a368 100644 (file)
@@ -54,7 +54,7 @@ UninstallApplication(INT Index, BOOL bModify)
     HKEY hKey;
     PINSTALLED_INFO ItemInfo;
 
-    if (!IS_INSTALLED_ENUM(SelectedEnumType))
+    if (!IsInstalledEnum(SelectedEnumType))
         return FALSE;
 
     if (Index == -1)
@@ -146,7 +146,7 @@ RemoveAppFromRegistry(INT Index)
     ATL::CStringW szMsgText, szMsgTitle;
     INT ItemIndex = SendMessageW(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
 
-    if (!IS_INSTALLED_ENUM(SelectedEnumType))
+    if (!IsInstalledEnum(SelectedEnumType))
         return;
 
     Info = (PINSTALLED_INFO) ListViewGetlParam(Index);
@@ -238,13 +238,13 @@ EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc)
                                  &dwSize) == ERROR_SUCCESS)
             {
                 szDisplayName.ReleaseBuffer();
-                if (EnumType < ENUM_ALL_COMPONENTS || EnumType > ENUM_UPDATES)
-                    EnumType = ENUM_ALL_COMPONENTS;
+                if (EnumType < ENUM_ALL_INSTALLED || EnumType > ENUM_UPDATES)
+                    EnumType = ENUM_ALL_INSTALLED;
 
                 if (!bIsSystemComponent)
                 {
-                    if ((EnumType == ENUM_ALL_COMPONENTS) || /* All components */
-                        ((EnumType == ENUM_APPLICATIONS) && (!bIsUpdate)) || /* Applications only */
+                    if ((EnumType == ENUM_ALL_INSTALLED) || /* All components */
+                        ((EnumType == ENUM_INSTALLED_APPLICATIONS) && (!bIsUpdate)) || /* Applications only */
                         ((EnumType == ENUM_UPDATES) && (bIsUpdate))) /* Updates only */
                     {
                         if (!lpEnumProc(ItemIndex, szDisplayName, &Info))
index bb10bc4..0633200 100644 (file)
@@ -15,7 +15,7 @@
 
 HWND hMainWnd;
 HINSTANCE hInst;
-INT SelectedEnumType = ENUM_ALL_COMPONENTS;
+INT SelectedEnumType = ENUM_ALL_INSTALLED;
 SETTINGS_INFO SettingsInfo;
 
 ATL::CStringW szSearchPattern;