ReactOS  0.4.15-dev-1397-g19779b3
CMainWindow Class Reference

#include <winproc.h>

Inheritance diagram for CMainWindow:
Collaboration diagram for CMainWindow:

Public Member Functions

LRESULT OnDropFiles (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCreate (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnDestroy (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnClose (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnInitMenuPopup (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSize (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnGetMinMaxInfo (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSetCursor (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnKeyDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSysColorChange (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCommand (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
void alignChildrenToMainWindow ()
 
void saveImage (BOOL overwrite)
 
void InsertSelectionFromHBITMAP (HBITMAP bitmap, HWND window)
 
BOOL ConfirmSave ()
 
 CMainWindow ()
 
 ~CMainWindow ()
 
HWND Create ()
 
BOOL ItemCheckStateChanged (BOOL bChecked, LPVOID CallbackParam)
 
BOOL InstallApplication (CAvailableApplicationInfo *Info)
 
BOOL SearchTextChanged (ATL::CStringW &SearchText)
 
void HandleTabOrder (int direction)
 
- Public Member Functions inherited from ATL::CWindowImpl< CMainWindow, CWindow, CFrameWinTraits >
HWND Create (HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
- Public Member Functions inherited from ATL::CWindowImplBaseT< CWindow, CFrameWinTraits >
 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
virtual WNDPROC GetWindowProc ()
 
LRESULT DefWindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HWND Create (HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, _U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
 
- Public Member Functions inherited from ATL::CWindowImplRoot< CWindow >
 CWindowImplRoot ()
 
virtual ~CWindowImplRoot ()
 
- Public Member Functions inherited from ATL::CWindow
 CWindow (HWND hWnd=NULL)
 
 operator HWND () const
 
UINT ArrangeIconicWindows ()
 
void Attach (HWND hWndNew)
 
HDC BeginPaint (LPPAINTSTRUCT lpPaint)
 
BOOL BringWindowToTop ()
 
BOOL CenterWindow (HWND hWndCenter=NULL)
 
BOOL ChangeClipboardChain (HWND hWndNewNext)
 
BOOL CheckDlgButton (int nIDButton, UINT nCheck)
 
BOOL CheckRadioButton (int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
 
HWND ChildWindowFromPoint (POINT point) const
 
HWND ChildWindowFromPointEx (POINT point, UINT uFlags) const
 
BOOL ClientToScreen (LPPOINT lpPoint) const
 
BOOL ClientToScreen (LPRECT lpRect) const
 
HWND Create (LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
BOOL CreateCaret (HBITMAP pBitmap)
 
BOOL CreateGrayCaret (int nWidth, int nHeight)
 
BOOL CreateSolidCaret (int nWidth, int nHeight)
 
HDWP DeferWindowPos (HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
 
BOOL DestroyWindow ()
 
HWND Detach ()
 
int DlgDirList (LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType)
 
int DlgDirListComboBox (LPTSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT nFileType)
 
BOOL DlgDirSelect (LPTSTR lpString, int nCount, int nIDListBox)
 
BOOL DlgDirSelectComboBox (LPTSTR lpString, int nCount, int nIDComboBox)
 
void DragAcceptFiles (BOOL bAccept=TRUE)
 
BOOL DrawMenuBar ()
 
BOOL EnableScrollBar (UINT uSBFlags, UINT uArrowFlags=ESB_ENABLE_BOTH)
 
BOOL EnableWindow (BOOL bEnable=TRUE)
 
void EndPaint (LPPAINTSTRUCT lpPaint)
 
BOOL FlashWindow (BOOL bInvert)
 
BOOL GetClientRect (LPRECT lpRect) const
 
HDC GetDC ()
 
HDC GetDCEx (HRGN hRgnClip, DWORD flags)
 
HWND GetDescendantWindow (int nID) const
 
HRESULT GetDlgControl (int nID, REFIID iid, void **ppCtrl)
 
int GetDlgCtrlID () const
 
HRESULT GetDlgHost (int nID, REFIID iid, void **ppHost)
 
HWND GetDlgItem (int nID)
 
UINT GetDlgItemInt (int nID, BOOL *lpTrans=NULL, BOOL bSigned=TRUE) const
 
UINT GetDlgItemText (int nID, LPTSTR lpStr, int nMaxCount) const
 
BOOL GetDlgItemText (int nID, BSTR &bstrText) const
 
DWORD GetExStyle () const
 
HFONT GetFont () const
 
DWORD GetHotKey () const
 
HICON GetIcon (BOOL bBigIcon=TRUE) const
 
HWND GetLastActivePopup () const
 
HMENU GetMenu () const
 
HWND GetNextDlgGroupItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
HWND GetNextDlgTabItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
CWindow GetParent () const
 
BOOL GetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo)
 
BOOL GetScrollPos (int nBar)
 
BOOL GetScrollRange (int nBar, LPINT lpMinPos, LPINT lpMaxPos) const
 
DWORD GetStyle () const
 
HMENU GetSystemMenu (BOOL bRevert)
 
HWND GetTopLevelParent () const
 
HWND GetTopLevelWindow () const
 
HWND GetTopWindow () const
 
BOOL GetUpdateRect (LPRECT lpRect, BOOL bErase=FALSE)
 
int GetUpdateRgn (HRGN hRgn, BOOL bErase=FALSE)
 
HWND GetWindow (UINT nCmd) const
 
DWORD GetWindowContextHelpId () const
 
HDC GetWindowDC ()
 
LONG GetWindowLong (int nIndex) const
 
LONG_PTR GetWindowLongPtr (int nIndex) const
 
BOOL GetWindowPlacement (WINDOWPLACEMENT *lpwndpl) const
 
DWORD GetWindowProcessID ()
 
BOOL GetWindowRect (LPRECT lpRect) const
 
int GetWindowRgn (HRGN hRgn)
 
int GetWindowText (LPTSTR lpszStringBuf, int nMaxCount) const
 
BOOL GetWindowText (BSTR &bstrText)
 
int GetWindowTextLength () const
 
DWORD GetWindowThreadID ()
 
WORD GetWindowWord (int nIndex) const
 
void GotoDlgCtrl (HWND hWndCtrl) const
 
BOOL HideCaret ()
 
BOOL HiliteMenuItem (HMENU hMenu, UINT uHiliteItem, UINT uHilite)
 
BOOL Invalidate (BOOL bErase=TRUE)
 
BOOL InvalidateRect (LPCRECT lpRect, BOOL bErase=TRUE)
 
void InvalidateRgn (HRGN hRgn, BOOL bErase=TRUE)
 
BOOL IsChild (const HWND hWnd) const
 
BOOL IsDialogMessage (LPMSG lpMsg)
 
UINT IsDlgButtonChecked (int nIDButton) const
 
BOOL IsIconic () const
 
BOOL IsParentDialog ()
 
BOOL IsWindow () const
 
BOOL IsWindowEnabled () const
 
BOOL IsWindowVisible () const
 
BOOL IsWindowUnicode ()
 
BOOL IsZoomed () const
 
BOOL KillTimer (UINT_PTR nIDEvent)
 
BOOL LockWindowUpdate (BOOL bLock=TRUE)
 
int MapWindowPoints (HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
 
int MapWindowPoints (HWND hWndTo, LPRECT lpRect) const
 
int MessageBox (LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
 
BOOL ModifyStyle (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL ModifyStyleEx (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL MoveWindow (int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
 
void NextDlgCtrl () const
 
BOOL OpenClipboard ()
 
BOOL PostMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void PrevDlgCtrl () const
 
void Print (HDC hDC, DWORD dwFlags) const
 
void PrintClient (HDC hDC, DWORD dwFlags) const
 
BOOL RedrawWindow (LPCRECT lpRectUpdate=NULL, HRGN hRgnUpdate=NULL, UINT flags=RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE)
 
int ReleaseDC (HDC hDC)
 
BOOL ResizeClient (int nWidth, int nHeight, BOOL bRedraw=FALSE)
 
BOOL ScreenToClient (LPPOINT lpPoint) const
 
BOOL ScrollWindow (int xAmount, int yAmount, LPCRECT lpRect=NULL, LPCRECT lpClipRect=NULL)
 
int ScrollWindowEx (int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT flags)
 
LRESULT SendDlgItemMessage (int nID, UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
LRESULT SendMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void SendMessageToDescendants (UINT message, WPARAM wParam=0, LPARAM lParam=0, BOOL bDeep=TRUE)
 
BOOL SendNotifyMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
HWND SetActiveWindow ()
 
HWND SetCapture ()
 
HWND SetClipboardViewer ()
 
int SetDlgCtrlID (int nID)
 
BOOL SetDlgItemInt (int nID, UINT nValue, BOOL bSigned=TRUE)
 
BOOL SetDlgItemText (int nID, LPCTSTR lpszString)
 
HWND SetFocus ()
 
void SetFont (HFONT hFont, BOOL bRedraw=TRUE)
 
int SetHotKey (WORD wVirtualKeyCode, WORD wModifiers)
 
HICON SetIcon (HICON hIcon, BOOL bBigIcon=TRUE)
 
BOOL SetMenu (HMENU hMenu)
 
HWND SetParent (HWND hWndNewParent)
 
void SetRedraw (BOOL bRedraw=TRUE)
 
int SetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw=TRUE)
 
int SetScrollPos (int nBar, int nPos, BOOL bRedraw=TRUE)
 
BOOL SetScrollRange (int nBar, int nMinPos, int nMaxPos, BOOL bRedraw=TRUE)
 
UINT_PTR SetTimer (UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
 
BOOL SetWindowContextHelpId (DWORD dwContextHelpId)
 
LONG SetWindowLong (int nIndex, LONG dwNewLong)
 
LONG_PTR SetWindowLongPtr (int nIndex, LONG_PTR dwNewLong)
 
BOOL SetWindowPlacement (const WINDOWPLACEMENT *lpwndpl)
 
BOOL SetWindowPos (HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
 
int SetWindowRgn (HRGN hRgn, BOOL bRedraw=FALSE)
 
BOOL SetWindowText (LPCTSTR lpszString)
 
WORD SetWindowWord (int nIndex, WORD wNewWord)
 
BOOL ShowCaret ()
 
BOOL ShowOwnedPopups (BOOL bShow=TRUE)
 
BOOL ShowScrollBar (UINT nBar, BOOL bShow=TRUE)
 
BOOL ShowWindow (int nCmdShow)
 
BOOL ShowWindowAsync (int nCmdShow)
 
BOOL UpdateWindow ()
 
BOOL ValidateRect (LPCRECT lpRect)
 
BOOL ValidateRgn (HRGN hRgn)
 
BOOL WinHelp (LPCTSTR lpszHelp, UINT nCmd=HELP_CONTEXT, DWORD dwData=0)
 
- Public Member Functions inherited from ATL::CWindowImpl< CMainWindow >
HWND Create (HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
- Public Member Functions inherited from ATL::CWindowImplBaseT< CWindow, CControlWinTraits >
 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
virtual WNDPROC GetWindowProc ()
 
LRESULT DefWindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HWND Create (HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, _U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
 

Static Public Member Functions

static ATL::CWndClassInfoGetWndClassInfo ()
 
- Static Public Member Functions inherited from ATL::CWindowImpl< CMainWindow, CWindow, CFrameWinTraits >
static LPCTSTR GetWndCaption ()
 
- Static Public Member Functions inherited from ATL::CWindowImplBaseT< CWindow, CFrameWinTraits >
static DWORD GetWndStyle (DWORD dwStyle)
 
static DWORD GetWndExStyle (DWORD dwExStyle)
 
static LRESULT CALLBACK StartWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CWindow
static LPCTSTR GetWndClassName ()
 
static LRESULT SendMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CWindowImpl< CMainWindow >
static LPCTSTR GetWndCaption ()
 
- Static Public Member Functions inherited from ATL::CWindowImplBaseT< CWindow, CControlWinTraits >
static DWORD GetWndStyle (DWORD dwStyle)
 
static DWORD GetWndExStyle (DWORD dwExStyle)
 
static LRESULT CALLBACK StartWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Private Member Functions

VOID InitCategoriesList ()
 
BOOL CreateStatusBar ()
 
BOOL CreateTreeView ()
 
BOOL CreateApplicationView ()
 
BOOL CreateVSplitter ()
 
BOOL CreateLayout ()
 
VOID LayoutCleanup ()
 
BOOL InitControls ()
 
VOID OnSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
BOOL RemoveSelectedAppFromRegistry ()
 
BOOL UninstallSelectedApp (BOOL bModify)
 
BOOL ProcessWindowMessage (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId)
 
BOOL IsSelectedNodeInstalled ()
 
VOID ShowAboutDlg ()
 
VOID OnCommand (WPARAM wParam, LPARAM lParam)
 
BOOL CALLBACK EnumInstalledAppProc (CInstalledApplicationInfo *Info)
 
BOOL CALLBACK EnumAvailableAppProc (CAvailableApplicationInfo *Info, BOOL bInitialCheckState)
 
VOID UpdateStatusBarText ()
 
VOID UpdateApplicationsList (INT EnumType)
 

Static Private Member Functions

static BOOL CALLBACK s_EnumInstalledAppProc (CInstalledApplicationInfo *Info, PVOID param)
 
static BOOL CALLBACK s_EnumAvailableAppProc (CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param)
 
static BOOL CALLBACK s_EnumSelectedAppForDownloadProc (CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param)
 

Private Attributes

CUiPanelm_ClientPanel = NULL
 
CUiSplitPanelm_VSplitter = NULL
 
CSideTreeViewm_TreeView = NULL
 
CUiWindow< CStatusBar > * m_StatusBar = NULL
 
CApplicationViewm_ApplicationView = NULL
 
CAvailableApps m_AvailableApps
 
CInstalledApps m_InstalledApps
 
BOOL bUpdating = FALSE
 
ATL::CStringW szSearchPattern
 
INT SelectedEnumType
 

Additional Inherited Members

- Public Types inherited from ATL::CWindowImplRoot< CWindow >
enum  
 
- Public Attributes inherited from ATL::CWindowImplBaseT< CWindow, CFrameWinTraits >
WNDPROC m_pfnSuperWindowProc
 
- Public Attributes inherited from ATL::CWindowImplRoot< CWindow >
CWndProcThunk m_thunk
 
const _ATL_MSGm_pCurrentMsg
 
DWORD m_dwState
 
- Public Attributes inherited from ATL::CWindow
HWND m_hWnd
 
- Public Attributes inherited from ATL::CWindowImplBaseT< CWindow, CControlWinTraits >
WNDPROC m_pfnSuperWindowProc
 
- Static Public Attributes inherited from ATL::CWindow
static RECT rcDefault
 

Detailed Description

Definition at line 12 of file winproc.h.

Constructor & Destructor Documentation

◆ CMainWindow()

CMainWindow::CMainWindow ( )

Definition at line 95 of file gui.cpp.

95  :
98 {
99 }
INT SelectedEnumType
Definition: gui.h:63
#define NULL
Definition: types.h:112
CUiPanel * m_ClientPanel
Definition: gui.h:49

◆ ~CMainWindow()

CMainWindow::~CMainWindow ( )

Definition at line 101 of file gui.cpp.

102 {
103  LayoutCleanup();
104 }
VOID LayoutCleanup()
Definition: gui.cpp:220

Member Function Documentation

◆ alignChildrenToMainWindow()

void CMainWindow::alignChildrenToMainWindow ( )

Definition at line 51 of file winproc.cpp.

52 {
53  int x, y, w, h;
54  RECT clientRect;
55  GetClientRect(&clientRect);
56 
58  {
59  x = 56;
60  w = clientRect.right - 56;
61  }
62  else
63  {
64  x = 0;
65  w = clientRect.right;
66  }
67  if (paletteWindow.IsWindowVisible())
68  {
69  y = 49;
70  h = clientRect.bottom - 49;
71  }
72  else
73  {
74  y = 3;
75  h = clientRect.bottom - 3;
76  }
77 
78  RECT statusBarRect0;
79  SendMessage(hStatusBar, SB_GETRECT, 0, (LPARAM)&statusBarRect0);
80  int statusBarBorders[3];
81  SendMessage(hStatusBar, SB_GETBORDERS, 0, (LPARAM)&statusBarBorders);
82  int statusBarHeight = statusBarRect0.bottom - statusBarRect0.top + statusBarBorders[1];
83 
84  scrollboxWindow.MoveWindow(x, y, w, ::IsWindowVisible(hStatusBar) ? h - statusBarHeight : h, TRUE);
85  paletteWindow.MoveWindow(x, 9, 255, 32, TRUE);
86 }
CToolBox toolBoxContainer
Definition: main.cpp:66
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:307
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG right
Definition: windef.h:308
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define SB_GETRECT
Definition: commctrl.h:1955
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
#define SB_GETBORDERS
Definition: commctrl.h:1952
LONG_PTR LPARAM
Definition: windef.h:208
HWND hStatusBar
Definition: main.cpp:35
CPaletteWindow paletteWindow
Definition: main.cpp:68
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
CScrollboxWindow scrollboxWindow
Definition: main.cpp:69
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
LONG bottom
Definition: windef.h:309
BOOL IsWindowVisible() const
Definition: atlwin.h:890

Referenced by OnCommand(), and OnSize().

◆ ConfirmSave()

BOOL CMainWindow::ConfirmSave ( )

Definition at line 187 of file winproc.cpp.

188 {
189  if (imageModel.IsImageSaved())
190  return TRUE;
191 
192  CString strProgramName;
193  strProgramName.LoadString(IDS_PROGRAMNAME);
194 
195  CString strSavePromptText;
197 
198  switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION))
199  {
200  case IDYES:
201  saveImage(TRUE);
202  return imageModel.IsImageSaved();
203  case IDNO:
204  return TRUE;
205  case IDCANCEL:
206  return FALSE;
207  }
208 
209  return TRUE;
210 }
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
#define IDS_PROGRAMNAME
Definition: definitions.h:203
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:716
BOOL IsImageSaved()
Definition: history.cpp:167
#define FALSE
Definition: types.h:117
void saveImage(BOOL overwrite)
Definition: winproc.cpp:88
#define MB_ICONQUESTION
Definition: winuser.h:783
#define MB_YESNOCANCEL
Definition: winuser.h:812
#define IDS_SAVEPROMPTTEXT
Definition: definitions.h:208
#define PathFindFileName
Definition: shlwapi.h:911
TCHAR filepathname[1000]
Definition: main.cpp:52
ImageModel imageModel
Definition: main.cpp:32
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:554
#define IDNO
Definition: winuser.h:830
#define IDCANCEL
Definition: winuser.h:825
int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
Definition: atlwin.h:934

Referenced by OnClose(), OnCommand(), and OnDropFiles().

◆ Create()

HWND CMainWindow::Create ( )

Definition at line 732 of file gui.cpp.

733 {
734  ATL::CStringW szWindowName;
735  szWindowName.LoadStringW(IDS_APPTITLE);
736 
737  RECT r = {
742  };
743  r.right += r.left;
744  r.bottom += r.top;
745 
747 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define IDS_APPTITLE
Definition: resource.h:3
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
_In_ BOOLEAN Create
Definition: pstypes.h:519
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:308
#define CW_USEDEFAULT
Definition: winuser.h:225
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
PCXSTR GetString() const
Definition: atlsimpstr.h:361
#define NULL
Definition: types.h:112
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
BOOL bSaveWndPos
Definition: settings.h:7

Referenced by _tWinMain(), and MainWindowLoop().

◆ CreateApplicationView()

BOOL CMainWindow::CreateApplicationView ( )
private

Definition at line 160 of file gui.cpp.

161 {
162  m_ApplicationView = new CApplicationView(this); // pass this to ApplicationView for callback purpose
166 
167  return m_ApplicationView->Create(m_hWnd) != NULL;
168 }
CUiSplitPanel * m_VSplitter
Definition: gui.h:50
CUiCollection & Second()
Definition: rosui.h:568
HWND Create(HWND hwndParent)
Definition: appview.cpp:1917
INT Append(T *ptr)
Definition: rosui.h:79
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
CApplicationView * m_ApplicationView
Definition: gui.h:55
HWND m_hWnd
Definition: atlwin.h:268
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
#define NULL
Definition: types.h:112

Referenced by CreateLayout().

◆ CreateLayout()

BOOL CMainWindow::CreateLayout ( )
private

Definition at line 187 of file gui.cpp.

188 {
189  BOOL b = TRUE;
190  bUpdating = TRUE;
191 
192  m_ClientPanel = new CUiPanel();
195 
196  // Top level
197  b = b && CreateStatusBar();
198  b = b && CreateVSplitter();
199 
200  // Inside V Splitter
201  b = b && CreateTreeView();
202  b = b && CreateApplicationView();
203 
204  if (b)
205  {
206  RECT rBottom;
207 
208  /* Size status bar */
209  m_StatusBar->SendMessageW(WM_SIZE, 0, 0);
210 
211  ::GetWindowRect(m_StatusBar->m_hWnd, &rBottom);
212 
213  m_VSplitter->m_Margin.bottom = rBottom.bottom - rBottom.top;
214  }
215 
216  bUpdating = FALSE;
217  return b;
218 }
CUiSplitPanel * m_VSplitter
Definition: gui.h:50
BOOL CreateStatusBar()
Definition: gui.cpp:140
#define TRUE
Definition: types.h:120
BOOL bUpdating
Definition: gui.h:60
BOOL CreateTreeView()
Definition: gui.cpp:150
LONG top
Definition: windef.h:307
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
BOOL GetWindowRect(LPRECT lpRect) const
Definition: atlwin.h:764
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define WM_SIZE
Definition: winuser.h:1593
BOOL CreateApplicationView()
Definition: gui.cpp:160
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
LONG bottom
Definition: windef.h:309
CUiMargin m_Margin
Definition: rosui.h:240
BOOL CreateVSplitter()
Definition: gui.cpp:170
CUiPanel * m_ClientPanel
Definition: gui.h:49
CUiWindow< CStatusBar > * m_StatusBar
Definition: gui.h:53

Referenced by InitControls().

◆ CreateStatusBar()

BOOL CMainWindow::CreateStatusBar ( void  )
private

Definition at line 140 of file gui.cpp.

141 {
146 
148 }
#define IDC_STATUSBAR
Definition: resource.h:12
INT Append(T *ptr)
Definition: rosui.h:79
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
HWND Create(HWND hwndParent, HMENU hMenu)
Definition: rosctrls.h:460
HWND m_hWnd
Definition: atlwin.h:268
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
#define NULL
Definition: types.h:112
CUiCollection & Children()
Definition: rosui.h:359
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
CUiPanel * m_ClientPanel
Definition: gui.h:49
CUiWindow< CStatusBar > * m_StatusBar
Definition: gui.h:53

Referenced by CreateLayout().

◆ CreateTreeView()

BOOL CMainWindow::CreateTreeView ( )
private

Definition at line 150 of file gui.cpp.

151 {
152  m_TreeView = new CSideTreeView();
156 
157  return m_TreeView->Create(m_hWnd) != NULL;
158 }
CUiSplitPanel * m_VSplitter
Definition: gui.h:50
INT Append(T *ptr)
Definition: rosui.h:79
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
CUiCollection & First()
Definition: rosui.h:567
HWND m_hWnd
Definition: atlwin.h:268
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
#define NULL
Definition: types.h:112
HWND Create(HWND hwndParent)
Definition: rosctrls.h:481
CSideTreeView * m_TreeView
Definition: gui.h:52

Referenced by CreateLayout().

◆ CreateVSplitter()

BOOL CMainWindow::CreateVSplitter ( )
private

Definition at line 170 of file gui.cpp.

171 {
172  m_VSplitter = new CUiSplitPanel();
177  m_VSplitter->m_MinFirst = 0;
178 
179  // TODO: m_MinSecond should be calculate dynamically instead of hard-coded
180  m_VSplitter->m_MinSecond = 480;
181  m_VSplitter->m_Pos = 240;
183 
184  return m_VSplitter->Create(m_hWnd) != NULL;
185 }
CUiSplitPanel * m_VSplitter
Definition: gui.h:50
INT m_MinFirst
Definition: rosui.h:544
INT Append(T *ptr)
Definition: rosui.h:79
#define FALSE
Definition: types.h:117
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
INT m_MinSecond
Definition: rosui.h:545
HWND Create(HWND hwndParent)
Definition: rosui.h:803
BOOL m_DynamicFirst
Definition: rosui.h:543
BOOL m_Horizontal
Definition: rosui.h:542
HWND m_hWnd
Definition: atlwin.h:268
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
INT m_Pos
Definition: rosui.h:541
#define NULL
Definition: types.h:112
CUiCollection & Children()
Definition: rosui.h:359
CUiPanel * m_ClientPanel
Definition: gui.h:49

Referenced by CreateLayout().

◆ EnumAvailableAppProc()

BOOL CALLBACK CMainWindow::EnumAvailableAppProc ( CAvailableApplicationInfo Info,
BOOL  bInitialCheckState 
)
private

Definition at line 631 of file gui.cpp.

632 {
633  if (!SearchPatternMatch(Info->m_szName.GetString(), szSearchPattern) &&
634  !SearchPatternMatch(Info->m_szDesc.GetString(), szSearchPattern))
635  {
636  return TRUE;
637  }
638  return m_ApplicationView->AddAvailableApplication(Info, bInitialCheckState, Info); // currently, the callback param is Info itself
639 }
BOOL AddAvailableApplication(CAvailableApplicationInfo *AvlbAppInfo, BOOL InitCheckState, LPVOID param)
Definition: appview.cpp:1989
ATL::CStringW szSearchPattern
Definition: gui.h:62
#define TRUE
Definition: types.h:120
BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle)
Definition: misc.cpp:526
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
CApplicationView * m_ApplicationView
Definition: gui.h:55

Referenced by s_EnumAvailableAppProc().

◆ EnumInstalledAppProc()

BOOL CALLBACK CMainWindow::EnumInstalledAppProc ( CInstalledApplicationInfo Info)
private

Definition at line 622 of file gui.cpp.

623 {
624  if (!SearchPatternMatch(Info->szDisplayName.GetString(), szSearchPattern))
625  {
626  return TRUE;
627  }
628  return m_ApplicationView->AddInstalledApplication(Info, Info); // currently, the callback param is Info itself
629 }
ATL::CStringW szSearchPattern
Definition: gui.h:62
BOOL AddInstalledApplication(CInstalledApplicationInfo *InstAppInfo, LPVOID param)
Definition: appview.cpp:1980
#define TRUE
Definition: types.h:120
BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle)
Definition: misc.cpp:526
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
CApplicationView * m_ApplicationView
Definition: gui.h:55

Referenced by s_EnumInstalledAppProc().

◆ GetWndClassInfo()

ATL::CWndClassInfo & CMainWindow::GetWndClassInfo ( )
static

Definition at line 708 of file gui.cpp.

709 {
710  DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
711  static ATL::CWndClassInfo wc =
712  {
713  {
714  sizeof(WNDCLASSEX),
715  csStyle,
717  0,
718  0,
719  NULL,
720  LoadIconW(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCEW(IDI_MAIN)),
722  (HBRUSH)(COLOR_BTNFACE + 1),
725  NULL
726  },
727  NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
728  };
729  return wc;
730 }
#define IDR_MAINMENU
Definition: resource.h:40
#define TRUE
Definition: types.h:120
#define CS_HREDRAW
Definition: winuser.h:648
const TCHAR szWindowClass[]
Definition: magnifier.c:28
#define CS_VREDRAW
Definition: winuser.h:653
#define _T(x)
Definition: vfdio.h:22
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define IDI_MAIN
Definition: resource.h:4
#define COLOR_BTNFACE
Definition: winuser.h:918
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1530
#define NULL
Definition: types.h:112
#define IDC_ARROW
Definition: winuser.h:682
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5694

◆ HandleTabOrder()

void CMainWindow::HandleTabOrder ( int  direction)

Definition at line 828 of file gui.cpp.

829 {
830  ATL::CSimpleArray<HWND> TabOrderHwndList;
831 
832  m_TreeView->AppendTabOrderWindow(direction, TabOrderHwndList);
833  m_ApplicationView->AppendTabOrderWindow(direction, TabOrderHwndList);
834 
835 
836  if (TabOrderHwndList.GetSize() == 0)
837  {
838  // in case the list is empty
839  return;
840  }
841 
842  int FocusIndex;
843 
844  if ((FocusIndex = TabOrderHwndList.Find(GetFocus())) == -1)
845  {
846  FocusIndex = 0; // focus the first window in the list
847  }
848  else
849  {
850  FocusIndex += direction;
851  FocusIndex += TabOrderHwndList.GetSize(); // FocusIndex might be negative. we don't want to mod a negative number
852  FocusIndex %= TabOrderHwndList.GetSize();
853  }
854 
855  ::SetFocus(TabOrderHwndList[FocusIndex]);
856  return;
857 }
HWND SetFocus()
Definition: atlwin.h:1130
int GetSize() const
Definition: atlsimpcoll.h:104
VOID AppendTabOrderWindow(int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
Definition: appview.cpp:2014
virtual VOID AppendTabOrderWindow(int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
Definition: rosui.h:500
CApplicationView * m_ApplicationView
Definition: gui.h:55
HWND WINAPI GetFocus(void)
Definition: window.c:1909
int Find(const T &t) const
Definition: atlsimpcoll.h:82
CSideTreeView * m_TreeView
Definition: gui.h:52

Referenced by MainWindowLoop().

◆ InitCategoriesList()

VOID CMainWindow::InitCategoriesList ( )
private

Definition at line 106 of file gui.cpp.

107 {
108  HTREEITEM hRootItemInstalled, hRootItemAvailable;
109 
110  hRootItemInstalled = m_TreeView->AddCategory(TVI_ROOT, IDS_INSTALLED, IDI_CATEGORY);
111  m_TreeView->AddCategory(hRootItemInstalled, IDS_APPLICATIONS, IDI_APPS);
112  m_TreeView->AddCategory(hRootItemInstalled, IDS_UPDATES, IDI_APPUPD);
113 
115 
117  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_AUDIO, IDI_CAT_AUDIO);
118  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_VIDEO, IDI_CAT_VIDEO);
120  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_GAMES, IDI_CAT_GAMES);
122  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_OFFICE, IDI_CAT_OFFICE);
123  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_DEVEL, IDI_CAT_DEVEL);
124  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_EDU, IDI_CAT_EDU);
126  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_FINANCE, IDI_CAT_FINANCE);
127  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_SCIENCE, IDI_CAT_SCIENCE);
128  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_TOOLS, IDI_CAT_TOOLS);
129  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_DRIVERS, IDI_CAT_DRIVERS);
130  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_LIBS, IDI_CAT_LIBS);
131  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_THEMES, IDI_CAT_THEMES);
132  m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_OTHER, IDI_CAT_OTHER);
133 
135  m_TreeView->Expand(hRootItemInstalled, TVE_EXPAND);
136  m_TreeView->Expand(hRootItemAvailable, TVE_EXPAND);
137  m_TreeView->SelectItem(hRootItemAvailable);
138 }
#define IDS_CAT_DEVEL
Definition: resource.h:177
HTREEITEM AddCategory(HTREEITEM hRootItem, UINT TextIndex, UINT IconIndex)
Definition: gui.cpp:52
#define IDS_CAT_OFFICE
Definition: resource.h:186
#define IDI_CAT_DEVEL
Definition: resource.h:21
#define IDI_CATEGORY
Definition: resource.h:13
#define IDS_CAT_VIDEO
Definition: resource.h:190
#define IDS_CAT_FINANCE
Definition: resource.h:181
#define IDS_AVAILABLEFORINST
Definition: resource.h:100
#define IDS_INSTALLED
Definition: resource.h:99
#define IDI_CAT_ENGINEER
Definition: resource.h:24
#define IDI_CAT_OFFICE
Definition: resource.h:30
#define IDI_CAT_VIDEO
Definition: resource.h:34
BOOL Expand(HTREEITEM item, DWORD action)
Definition: rosctrls.h:597
#define IDS_SELECTEDFORINST
Definition: resource.h:119
#define IDS_CAT_INTERNET
Definition: resource.h:184
HIMAGELIST SetImageList()
Definition: gui.cpp:74
#define IDS_CAT_DRIVERS
Definition: resource.h:178
#define IDI_CAT_OTHER
Definition: resource.h:31
BOOL SelectItem(HTREEITEM item, DWORD action=TVGN_CARET)
Definition: rosctrls.h:602
#define IDS_CAT_OTHER
Definition: resource.h:187
#define IDI_CAT_TOOLS
Definition: resource.h:33
#define IDI_CAT_EDU
Definition: resource.h:23
#define IDI_CAT_INTERNET
Definition: resource.h:28
#define TVE_EXPAND
Definition: commctrl.h:3419
#define TVI_ROOT
Definition: commctrl.h:3364
#define IDS_CAT_LIBS
Definition: resource.h:185
#define IDS_CAT_THEMES
Definition: resource.h:191
#define IDS_CAT_SCIENCE
Definition: resource.h:188
#define IDS_CAT_GRAPHICS
Definition: resource.h:183
#define IDS_CAT_AUDIO
Definition: resource.h:176
#define IDS_CAT_EDU
Definition: resource.h:179
#define IDS_CAT_ENGINEER
Definition: resource.h:180
#define IDS_APPLICATIONS
Definition: resource.h:102
#define IDI_CAT_LIBS
Definition: resource.h:29
#define IDI_CAT_GRAPHICS
Definition: resource.h:27
#define IDI_CAT_THEMES
Definition: resource.h:35
#define IDI_CAT_FINANCE
Definition: resource.h:25
#define IDS_UPDATES
Definition: resource.h:101
#define IDI_CAT_DRIVERS
Definition: resource.h:22
#define IDI_CAT_AUDIO
Definition: resource.h:20
#define IDI_CAT_GAMES
Definition: resource.h:26
#define IDS_CAT_TOOLS
Definition: resource.h:189
#define IDI_CAT_SCIENCE
Definition: resource.h:32
#define IDI_APPS
Definition: resource.h:11
#define IDS_CAT_GAMES
Definition: resource.h:182
#define IDI_SELECTEDFORINST
Definition: resource.h:16
#define IDI_APPUPD
Definition: resource.h:12
CSideTreeView * m_TreeView
Definition: gui.h:52

Referenced by InitControls().

◆ InitControls()

BOOL CMainWindow::InitControls ( )
private

Definition at line 229 of file gui.cpp.

230 {
231  if (CreateLayout())
232  {
234 
236 
237  return TRUE;
238  }
239 
240  return FALSE;
241 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL CreateLayout()
Definition: gui.cpp:187
VOID UpdateStatusBarText()
Definition: gui.cpp:660
VOID InitCategoriesList()
Definition: gui.cpp:106

Referenced by ProcessWindowMessage().

◆ InsertSelectionFromHBITMAP()

void CMainWindow::InsertSelectionFromHBITMAP ( HBITMAP  bitmap,
HWND  window 
)

Definition at line 105 of file winproc.cpp.

106 {
107  int width = GetDIBWidth(bitmap);
108  int height = GetDIBHeight(bitmap);
109  int curWidth = imageModel.GetWidth();
110  int curHeight = imageModel.GetHeight();
111 
112  if (width > curWidth || height > curHeight)
113  {
114  BOOL shouldEnlarge = TRUE;
115 
116  if (askBeforeEnlarging)
117  {
118  TCHAR programname[20];
119  TCHAR shouldEnlargePromptText[100];
120 
121  LoadString(hProgInstance, IDS_PROGRAMNAME, programname, SIZEOF(programname));
122  LoadString(hProgInstance, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, SIZEOF(shouldEnlargePromptText));
123 
124  switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
125  {
126  case IDYES:
127  break;
128  case IDNO:
129  shouldEnlarge = FALSE;
130  break;
131  case IDCANCEL:
132  return;
133  }
134  }
135 
136  if (shouldEnlarge)
137  {
138  if (width > curWidth)
139  curWidth = width;
140 
141  if (height > curHeight)
142  curHeight = height;
143 
144  imageModel.Crop(curWidth, curHeight, 0, 0);
145  }
146  }
147 
151 
154 
155  placeSelWin();
156  selectionWindow.ShowWindow(SW_SHOW);
158 }
GLint GLint GLsizei width
Definition: gl.h:1546
void CopyPrevious(void)
Definition: history.cpp:45
CToolBox toolBoxContainer
Definition: main.cpp:66
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
#define IDS_PROGRAMNAME
Definition: definitions.h:203
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
int GetDIBHeight(HBITMAP hBitmap)
Definition: dib.cpp:61
SelectionModel selectionModel
Definition: main.cpp:20
BOOL askBeforeEnlarging
Definition: main.cpp:33
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:124
int GetDIBWidth(HBITMAP hBitmap)
Definition: dib.cpp:53
#define SIZEOF(_ar)
Definition: calc.h:97
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_ENLARGEPROMPTTEXT
Definition: definitions.h:239
#define TOOLBARCLASSNAME
Definition: commctrl.h:942
#define MB_ICONQUESTION
Definition: winuser.h:783
#define MB_YESNOCANCEL
Definition: winuser.h:812
#define SW_SHOW
Definition: winuser.h:769
Definition: uimain.c:88
char TCHAR
Definition: xmlstorage.h:189
#define ID_RECTSEL
Definition: definitions.h:118
#define FindWindowEx
Definition: winuser.h:5753
void placeSelWin()
Definition: mouse.cpp:16
int GetWidth()
Definition: history.cpp:194
int GetHeight()
Definition: history.cpp:199
#define TB_CHECKBUTTON
Definition: commctrl.h:1039
ImageModel imageModel
Definition: main.cpp:32
HWND m_hWnd
Definition: atlwin.h:268
#define WM_COMMAND
Definition: winuser.h:1722
HINSTANCE hProgInstance
Definition: main.cpp:50
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
void ForceRefreshSelectionContents()
Definition: selection.cpp:56
void InsertFromHBITMAP(HBITMAP hBm)
#define NULL
Definition: types.h:112
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
#define IDNO
Definition: winuser.h:830
#define IDCANCEL
Definition: winuser.h:825
int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
Definition: atlwin.h:934
#define LoadString
Definition: winuser.h:5794
CSelectionWindow selectionWindow
Definition: main.cpp:71

Referenced by OnCommand().

◆ InstallApplication()

BOOL CMainWindow::InstallApplication ( CAvailableApplicationInfo Info)

Definition at line 781 of file gui.cpp.

782 {
783  if (Info)
784  {
786  {
788  return TRUE;
789  }
790  }
791  else
792  {
794 
795  // enum all selected apps
797 
798  if (AppsList.GetSize())
799  {
800  if (DownloadListOfApplications(AppsList, FALSE))
801  {
804  return TRUE;
805  }
806  }
807  }
808 
809  return FALSE;
810 }
#define TRUE
Definition: types.h:120
VOID RemoveAllSelected()
Definition: available.cpp:562
static BOOL CALLBACK s_EnumSelectedAppForDownloadProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param)
Definition: gui.cpp:653
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define FALSE
Definition: types.h:117
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param)
Definition: available.cpp:448
CAvailableApps m_AvailableApps
Definition: gui.h:57
VOID UpdateApplicationsList(INT EnumType)
Definition: gui.cpp:671
BOOL DownloadListOfApplications(const ATL::CSimpleArray< CAvailableApplicationInfo > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1011
BOOL DownloadApplication(CAvailableApplicationInfo *pAppInfo, BOOL bIsModal)
Definition: loaddlg.cpp:1028

Referenced by CApplicationView::OnCommand(), and CApplicationView::ProcessWindowMessage().

◆ IsSelectedNodeInstalled()

BOOL CMainWindow::IsSelectedNodeInstalled ( )
private

Definition at line 500 of file gui.cpp.

501 {
502  HTREEITEM hSelectedItem = m_TreeView->GetSelection();
503  TV_ITEM tItem;
504 
505  tItem.mask = TVIF_PARAM | TVIF_HANDLE;
506  tItem.hItem = hSelectedItem;
507  m_TreeView->GetItem(&tItem);
508  switch (tItem.lParam)
509  {
510  case IDS_INSTALLED:
511  case IDS_APPLICATIONS:
512  case IDS_UPDATES:
513  return TRUE;
514  default:
515  return FALSE;
516  }
517 }
#define TRUE
Definition: types.h:120
#define IDS_INSTALLED
Definition: resource.h:99
#define FALSE
Definition: types.h:117
BOOL GetItem(TV_ITEM *pitem)
Definition: rosctrls.h:543
#define TVIF_HANDLE
Definition: commctrl.h:3266
#define IDS_APPLICATIONS
Definition: resource.h:102
#define TV_ITEM
Definition: commctrl.h:3296
#define IDS_UPDATES
Definition: resource.h:101
#define TVIF_PARAM
Definition: commctrl.h:3264
HTREEITEM GetSelection()
Definition: rosctrls.h:592
CSideTreeView * m_TreeView
Definition: gui.h:52

Referenced by ProcessWindowMessage().

◆ ItemCheckStateChanged()

BOOL CMainWindow::ItemCheckStateChanged ( BOOL  bChecked,
LPVOID  CallbackParam 
)

Definition at line 751 of file gui.cpp.

752 {
753  if (!bUpdating)
754  {
755  if (bChecked)
756  {
758  {
759  return FALSE;
760  }
761  }
762  else
763  {
765  {
766  return FALSE;
767  }
768  }
769 
771  return TRUE;
772  }
773  else
774  {
775  return TRUE;
776  }
777 }
#define TRUE
Definition: types.h:120
BOOL bUpdating
Definition: gui.h:60
#define FALSE
Definition: types.h:117
VOID UpdateStatusBarText()
Definition: gui.cpp:660
BOOL AddSelected(CAvailableApplicationInfo *AvlbInfo)
Definition: available.cpp:546
CAvailableApps m_AvailableApps
Definition: gui.h:57
BOOL RemoveSelected(CAvailableApplicationInfo *AvlbInfo)
Definition: available.cpp:551

Referenced by CApplicationView::ItemCheckStateChanged().

◆ LayoutCleanup()

VOID CMainWindow::LayoutCleanup ( )
private

Definition at line 220 of file gui.cpp.

221 {
222  delete m_TreeView;
223  delete m_ApplicationView;
224  delete m_VSplitter;
225  delete m_StatusBar;
226  return;
227 }
CUiSplitPanel * m_VSplitter
Definition: gui.h:50
CApplicationView * m_ApplicationView
Definition: gui.h:55
CSideTreeView * m_TreeView
Definition: gui.h:52
CUiWindow< CStatusBar > * m_StatusBar
Definition: gui.h:53

Referenced by ~CMainWindow().

◆ OnClose()

LRESULT CMainWindow::OnClose ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 212 of file winproc.cpp.

213 {
214  if (ConfirmSave())
215  {
216  DestroyWindow();
217  }
218  return 0;
219 }
BOOL DestroyWindow()
Definition: atlwin.h:428
BOOL ConfirmSave()
Definition: winproc.cpp:187

◆ OnCommand() [1/2]

LRESULT CMainWindow::OnCommand ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 372 of file winproc.cpp.

373 {
374  switch (LOWORD(wParam))
375  {
376  case IDM_HELPINFO:
377  {
379  TCHAR infotitle[100];
380  TCHAR infotext[200];
381  LoadString(hProgInstance, IDS_INFOTITLE, infotitle, SIZEOF(infotitle));
382  LoadString(hProgInstance, IDS_INFOTEXT, infotext, SIZEOF(infotext));
383  ShellAbout(m_hWnd, infotitle, infotext, paintIcon);
384  DeleteObject(paintIcon);
385  break;
386  }
387  case IDM_HELPHELPTOPICS:
388  HtmlHelp(m_hWnd, _T("help\\Paint.chm"), 0, 0);
389  break;
390  case IDM_FILEEXIT:
392  break;
393  case IDM_FILENEW:
394  if (ConfirmSave())
395  {
397  }
398  break;
399  case IDM_FILEOPEN:
400  if (ConfirmSave() && GetOpenFileName(&ofn))
401  {
403  }
404  break;
405  case IDM_FILESAVE:
406  saveImage(TRUE);
407  break;
408  case IDM_FILESAVEAS:
409  saveImage(FALSE);
410  break;
411  case IDM_FILEPAGESETUP:
412  // DUMMY: Shows the dialog only, no functionality
413  PAGESETUPDLG psd;
414  ZeroMemory(&psd, sizeof(psd));
415  psd.lStructSize = sizeof(psd);
416  psd.hwndOwner = m_hWnd;
417  PageSetupDlg(&psd);
418  break;
419  case IDM_FILEPRINT:
420  // TODO: Test whether it actually works
421  PRINTDLG pd;
422  ZeroMemory(&pd, sizeof(pd));
423  pd.lStructSize = sizeof(pd);
424  pd.hwndOwner = m_hWnd;
425  pd.hDevMode = NULL; // freed by user
426  pd.hDevNames = NULL; // freed by user
428  pd.nCopies = 1;
429  pd.nFromPage = 0xffff;
430  pd.nToPage = 0xffff;
431  pd.nMinPage = 1;
432  pd.nMaxPage = 0xffff;
433  if (PrintDlg(&pd) == TRUE)
434  {
436  DeleteDC(pd.hDC);
437  }
438  if (pd.hDevMode)
439  GlobalFree(pd.hDevMode);
440  if (pd.hDevNames)
441  GlobalFree(pd.hDevNames);
442  break;
445  break;
448  break;
451  break;
452  case IDM_FILE1:
453  {
455  break;
456  }
457  case IDM_FILE2:
458  {
460  break;
461  }
462  case IDM_FILE3:
463  {
465  break;
466  }
467  case IDM_FILE4:
468  {
470  break;
471  }
472  case IDM_EDITUNDO:
473  imageModel.Undo();
475  break;
476  case IDM_EDITREDO:
477  imageModel.Redo();
479  break;
480  case IDM_EDITCOPY:
481  OpenClipboard();
482  EmptyClipboard();
484  CloseClipboard();
485  break;
486  case IDM_EDITCUT:
487  /* Copy */
489  /* Delete selection */
491  break;
492  case IDM_EDITPASTE:
493  OpenClipboard();
495  {
497  }
498  CloseClipboard();
499  break;
501  {
502  /* remove selection window and already painted content using undo */
503  imageModel.Undo();
504  break;
505  }
506  case IDM_EDITSELECTALL:
507  {
511  //TODO: do this properly
515  break;
516  }
517  case IDM_EDITCOPYTO:
518  if (GetSaveFileName(&ofn))
520  break;
521  case IDM_EDITPASTEFROM:
522  if (GetOpenFileName(&ofn))
523  {
525  if (hbmNew)
526  {
528  DeleteObject(hbmNew);
529  }
530  }
531  break;
533  if (ChooseColor(&choosecolor))
535  break;
538  break;
541  break;
543  {
545  break;
546  }
551  break;
553  switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
554  {
555  case 1: /* flip horizontally */
556  if (selectionWindow.IsWindowVisible())
558  else
560  break;
561  case 2: /* flip vertically */
562  if (selectionWindow.IsWindowVisible())
564  else
566  break;
567  case 3: /* rotate 90 degrees */
568  break;
569  case 4: /* rotate 180 degrees */
570  if (selectionWindow.IsWindowVisible())
572  else
574  break;
575  case 5: /* rotate 270 degrees */
576  break;
577  }
578  break;
579  case IDM_IMAGEATTRIBUTES:
580  {
581  if (attributesDialog.DoModal(mainWindow.m_hWnd))
582  {
584  }
585  break;
586  }
588  {
589  if (stretchSkewDialog.DoModal(mainWindow.m_hWnd))
590  {
593  }
594  break;
595  }
596  case IDM_IMAGEDRAWOPAQUE:
598  break;
599  case IDM_IMAGECROP:
601  break;
602 
603  case IDM_VIEWTOOLBOX:
606  break;
608  paletteWindow.ShowWindow(paletteWindow.IsWindowVisible() ? SW_HIDE : SW_SHOW);
610  break;
611  case IDM_VIEWSTATUSBAR:
614  break;
615  case IDM_FORMATICONBAR:
616  textEditWindow.ShowWindow(textEditWindow.IsWindowVisible() ? SW_HIDE : SW_SHOW);
617  break;
618  case IDM_VIEWSHOWGRID:
619  showGrid = !showGrid;
621  break;
624  miniature.ShowWindow(showMiniature ? SW_SHOW : SW_HIDE);
625  break;
626 
627  case IDM_VIEWZOOM125:
628  zoomTo(125, 0, 0);
629  break;
630  case IDM_VIEWZOOM25:
631  zoomTo(250, 0, 0);
632  break;
633  case IDM_VIEWZOOM50:
634  zoomTo(500, 0, 0);
635  break;
636  case IDM_VIEWZOOM100:
637  zoomTo(1000, 0, 0);
638  break;
639  case IDM_VIEWZOOM200:
640  zoomTo(2000, 0, 0);
641  break;
642  case IDM_VIEWZOOM400:
643  zoomTo(4000, 0, 0);
644  break;
645  case IDM_VIEWZOOM800:
646  zoomTo(8000, 0, 0);
647  break;
648 
649  case IDM_VIEWFULLSCREEN:
650  fullscreenWindow.ShowWindow(SW_SHOW);
652  break;
653  }
654  return 0;
655 }
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCTSTR name, DWORD dwFileSize, BOOL isFile)
Definition: dib.cpp:108
#define IDM_IMAGEROTATEMIRROR
Definition: definitions.h:101
void FlipHorizontally()
Definition: history.cpp:223
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDM_EDITUNDO
Definition: definitions.h:75
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:45
#define IDM_EDITPASTEFROM
Definition: definitions.h:84
static HICON
Definition: imagelist.c:84
#define IDM_IMAGEINVERTCOLORS
Definition: definitions.h:104
CToolBox toolBoxContainer
Definition: main.cpp:66
void RotateNTimes90Degrees(int iN)
WORD nMaxPage
Definition: commdlg.h:474
#define IDM_VIEWZOOM125
Definition: definitions.h:90
long y
Definition: polytest.cpp:48
#define PageSetupDlg
Definition: commdlg.h:667
#define IDM_VIEWSHOWGRID
Definition: definitions.h:98
long x
Definition: polytest.cpp:48
#define IDM_VIEWZOOM400
Definition: definitions.h:95
#define IDM_EDITSELECTALL
Definition: definitions.h:82
#define ChooseColor
Definition: commdlg.h:661
#define TRUE
Definition: types.h:120
void endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
Definition: mouse.cpp:218
BOOL showGrid
Definition: main.cpp:60
#define SW_HIDE
Definition: winuser.h:762
#define IDM_EDITCOPY
Definition: definitions.h:78
HWND hwndOwner
Definition: commdlg.h:434
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
#define IDM_IMAGECROP
Definition: definitions.h:103
#define IDM_VIEWCOLORPALETTE
Definition: definitions.h:87
OPENFILENAME ofn
Definition: main.cpp:37
void InvertColors()
Definition: history.cpp:204
#define IDM_EDITCOPYTO
Definition: definitions.h:83
#define ZeroMemory
Definition: winbase.h:1648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define IDM_COLORSEDITPALETTE
Definition: definitions.h:109
WORD nCopies
Definition: commdlg.h:475
CString strFile2
Definition: registry.h:31
#define IDM_VIEWSTATUSBAR
Definition: definitions.h:88
SelectionModel selectionModel
Definition: main.cpp:20
#define IDM_COLORSOLDPALETTE
Definition: definitions.h:111
static void SetWallpaper(LPCTSTR szFileName, WallpaperStyle style)
Definition: registry.cpp:40
void Redo(void)
Definition: history.cpp:75
COLORREF rgbResult
Definition: commdlg.h:242
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define GetOpenFileName
Definition: commdlg.h:665
WPARAM wParam
Definition: combotst.c:138
#define IDM_IMAGEDELETEIMAGE
Definition: definitions.h:106
void whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
Definition: mouse.cpp:125
#define IDM_FILEPAGESETUP
Definition: definitions.h:58
WORD nMinPage
Definition: commdlg.h:473
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:124
#define IDM_IMAGEATTRIBUTES
Definition: definitions.h:105
CImgAreaWindow imageArea
Definition: main.cpp:72
#define GetSaveFileName
Definition: commdlg.h:666
#define PrintDlg
Definition: commdlg.h:668
#define LR_COPYRETURNORG
Definition: winuser.h:1080
#define IDM_FILEPRINT
Definition: definitions.h:59
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
#define IDM_VIEWZOOM100
Definition: definitions.h:93
#define SIZEOF(_ar)
Definition: calc.h:97
CMirrorRotateDialog mirrorRotateDialog
Definition: dialogs.cpp:19
#define FALSE
Definition: types.h:117
void startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
Definition: mouse.cpp:56
#define IDM_FILE1
Definition: definitions.h:68
#define IDM_FILEASWALLPAPERCENTERED
Definition: definitions.h:64
void saveImage(BOOL overwrite)
Definition: winproc.cpp:88
#define IDM_VIEWFULLSCREEN
Definition: definitions.h:97
HDC GetDC()
Definition: history.cpp:218
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:98
#define CF_BITMAP
Definition: constants.h:397
#define TOOLBARCLASSNAME
Definition: commctrl.h:942
CMiniatureWindow miniature
Definition: main.cpp:65
WORD nFromPage
Definition: commdlg.h:471
#define IDM_HELPHELPTOPICS
Definition: definitions.h:113
#define PD_RETURNDC
Definition: commdlg.h:155
#define IDM_VIEWZOOM25
Definition: definitions.h:91
CStretchSkewDialog stretchSkewDialog
Definition: dialogs.cpp:21
DWORD lStructSize
Definition: commdlg.h:433
#define SW_SHOW
Definition: winuser.h:769
#define IDS_INFOTEXT
Definition: definitions.h:206
#define IDM_FILE4
Definition: definitions.h:71
void SelectPalette(int nPalette)
void Insert(HBITMAP hbm)
Definition: history.cpp:108
#define IDS_INFOTITLE
Definition: definitions.h:205
char TCHAR
Definition: xmlstorage.h:189
BOOL IsBackgroundTransparent()
Definition: toolsmodel.cpp:93
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define _T(x)
Definition: vfdio.h:22
#define IDM_FILEASWALLPAPERSTRETCHED
Definition: definitions.h:65
void InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
Definition: winproc.cpp:105
#define ID_RECTSEL
Definition: definitions.h:118
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
Definition: history.cpp:182
#define FindWindowEx
Definition: winuser.h:5753
BOOL OpenClipboard()
Definition: atlwin.h:970
#define WM_CLOSE
Definition: winuser.h:1603
void RotateNTimes90Degrees(int iN)
Definition: history.cpp:239
#define IDM_FORMATICONBAR
Definition: definitions.h:89
HGLOBAL hDevMode
Definition: commdlg.h:467
CFullscreenWindow fullscreenWindow
Definition: main.cpp:64
HWND hStatusBar
Definition: main.cpp:35
#define ShellAbout
Definition: shellapi.h:690
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL showMiniature
Definition: main.cpp:61
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
int GetWidth()
Definition: history.cpp:194
TCHAR filepathname[1000]
Definition: main.cpp:52
CAttributesDialog attributesDialog
Definition: dialogs.cpp:20
void alignChildrenToMainWindow()
Definition: winproc.cpp:51
int GetHeight()
Definition: history.cpp:199
#define IDM_VIEWZOOM50
Definition: definitions.h:92
#define IDM_FILEEXIT
Definition: definitions.h:73
#define TB_CHECKBUTTON
Definition: commctrl.h:1039
void SetFgColor(int newColor)
ImageModel imageModel
Definition: main.cpp:32
HWND m_hWnd
Definition: atlwin.h:268
#define IDM_FILEASWALLPAPERPLANE
Definition: definitions.h:63
#define IDM_EDITCUT
Definition: definitions.h:77
#define WM_COMMAND
Definition: winuser.h:1722
#define IDM_EDITPASTE
Definition: definitions.h:79
CPaletteWindow paletteWindow
Definition: main.cpp:68
HINSTANCE hProgInstance
Definition: main.cpp:50
#define IDI_APPICON
Definition: resource.h:166
CString strFile1
Definition: registry.h:30
BOOL SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC)
Definition: dib.cpp:68
#define IDM_IMAGESTRETCHSKEW
Definition: definitions.h:102
#define IDM_HELPINFO
Definition: definitions.h:114
HWND hwndOwner
Definition: commdlg.h:466
CString strFile4
Definition: registry.h:33
#define IDM_IMAGEDRAWOPAQUE
Definition: definitions.h:107
#define IDM_EDITDELETESELECTION
Definition: definitions.h:80
#define IDM_COLORSMODERNPALETTE
Definition: definitions.h:110
#define IDM_EDITREDO
Definition: definitions.h:76
POINT percentage
Definition: dialogs.h:86
#define IDM_FILESAVEAS
Definition: definitions.h:53
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1265
#define IDM_FILE2
Definition: definitions.h:69
PaletteModel paletteModel
Definition: main.cpp:28
BOOL WINAPI DeleteDC(_In_ HDC)
#define IDM_FILESAVE
Definition: definitions.h:52
LPSTR lpstrFile
Definition: commdlg.h:336
HGLOBAL hDevNames
Definition: commdlg.h:468
HBITMAP DoLoadImageFile(HWND hwnd, LPCTSTR name, BOOL fIsMainFile)
Definition: dib.cpp:159
#define NULL
Definition: types.h:112
#define IMAGE_BITMAP
Definition: winuser.h:211
HANDLE WINAPI GetClipboardData(_In_ UINT)
DWORD lStructSize
Definition: commdlg.h:465
BOOL Invalidate(BOOL bErase=TRUE)
Definition: atlwin.h:828
void Undo(void)
Definition: history.cpp:57
void FlipVertically()
Definition: history.cpp:231
WORD nToPage
Definition: commdlg.h:472
#define IDM_FILEOPEN
Definition: definitions.h:51
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:21
#define IDM_FILE3
Definition: definitions.h:70
#define IDM_VIEWZOOM200
Definition: definitions.h:94
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
#define IDM_VIEWZOOM800
Definition: definitions.h:96
DWORD Flags
Definition: commdlg.h:470
#define IDM_FILENEW
Definition: definitions.h:50
static HBITMAP
Definition: button.c:44
#define LoadIcon
Definition: winuser.h:5788
CTextEditWindow textEditWindow
Definition: main.cpp:81
CHOOSECOLOR choosecolor
Definition: main.cpp:36
RegistrySettings registrySettings
Definition: main.cpp:30
#define HtmlHelp
Definition: htmlhelp.h:425
HDC hDC
Definition: commdlg.h:469
#define IDM_VIEWSHOWMINIATURE
Definition: definitions.h:99
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
BOOL ConfirmSave()
Definition: winproc.cpp:187
#define SRCCOPY
Definition: wingdi.h:332
#define LoadString
Definition: winuser.h:5794
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
struct Rect Rect
BOOL IsWindowVisible() const
Definition: atlwin.h:890
CSelectionWindow selectionWindow
Definition: main.cpp:71
#define IDM_VIEWTOOLBOX
Definition: definitions.h:86
CMainWindow mainWindow
Definition: main.cpp:63
CString strFile3
Definition: registry.h:32

Referenced by ProcessWindowMessage().

◆ OnCommand() [2/2]

VOID CMainWindow::OnCommand ( WPARAM  wParam,
LPARAM  lParam 
)
private

Definition at line 532 of file gui.cpp.

533 {
534  WORD wCommand = LOWORD(wParam);
535 
536  if (!lParam)
537  {
538  switch (wCommand)
539  {
540  case ID_SETTINGS:
542  break;
543 
544  case ID_EXIT:
545  PostMessageW(WM_CLOSE, 0, 0);
546  break;
547 
548  case ID_INSTALL:
550  {
552 
553  // enum all selected apps
555 
556  if (AppsList.GetSize())
557  {
558  if (DownloadListOfApplications(AppsList, FALSE))
559  {
562  }
563  }
564  else
565  {
566  // use the currently focused item in application-view
568  if (FocusedApps)
569  {
570  if (DownloadApplication(FocusedApps, FALSE))
571  {
573  }
574  }
575  else
576  {
577  // TODO: in this case, Install button in toolbar (and all other places) should be disabled
578  // or at least popup a messagebox telling user to select/check some app first
579  }
580  }
581  }
582  break;
583 
584  case ID_UNINSTALL:
587  break;
588 
589  case ID_MODIFY:
592  break;
593 
594  case ID_REGREMOVE:
596  break;
597 
598  case ID_REFRESH:
600  break;
601 
602  case ID_RESETDB:
605  break;
606 
607  case ID_HELP:
608  MessageBoxW(L"Help not implemented yet", NULL, MB_OK);
609  break;
610 
611  case ID_ABOUT:
612  ShowAboutDlg();
613  break;
614 
615  case ID_CHECK_ALL:
617  break;
618  }
619  }
620 }
#define ID_REFRESH
Definition: resource.h:16
BOOL RemoveSelectedAppFromRegistry()
Definition: gui.cpp:267
#define ID_SETTINGS
Definition: resource.h:81
#define ID_REGREMOVE
Definition: resource.h:83
#define TRUE
Definition: types.h:120
VOID RemoveAllSelected()
Definition: available.cpp:562
static BOOL CALLBACK s_EnumSelectedAppForDownloadProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param)
Definition: gui.cpp:653
#define ID_RESETDB
Definition: resource.h:84
INT SelectedEnumType
Definition: gui.h:63
#define ID_UNINSTALL
Definition: resource.h:75
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
BOOL IsAvailableEnum(INT x)
Definition: defines.h:66
#define ID_ABOUT
Definition: charmap.c:18
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param)
Definition: available.cpp:448
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define WM_CLOSE
Definition: winuser.h:1603
VOID ShowAboutDlg()
Definition: gui.cpp:519
unsigned short WORD
Definition: ntddk_ex.h:93
#define ID_CHECK_ALL
Definition: resource.h:85
CApplicationView * m_ApplicationView
Definition: gui.h:55
static const WCHAR L[]
Definition: oid.c:1250
HWND m_hWnd
Definition: atlwin.h:268
BOOL UninstallSelectedApp(BOOL bModify)
Definition: gui.cpp:299
VOID CreateSettingsDlg(HWND hwnd)
static BOOL ForceUpdateAppsDB()
Definition: available.cpp:442
#define ID_EXIT
Definition: resource.h:10
CAvailableApps m_AvailableApps
Definition: gui.h:57
VOID UpdateApplicationsList(INT EnumType)
Definition: gui.cpp:671
#define ID_INSTALL
Definition: resource.h:74
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
BOOL DownloadListOfApplications(const ATL::CSimpleArray< CAvailableApplicationInfo > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1011
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ID_HELP
Definition: resource.h:26
BOOL DownloadApplication(CAvailableApplicationInfo *pAppInfo, BOOL bIsModal)
Definition: loaddlg.cpp:1028
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define ID_MODIFY
Definition: resource.h:78
PVOID GetFocusedItemData()
Definition: appview.cpp:2004

◆ OnCreate()

LRESULT CMainWindow::OnCreate ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 173 of file winproc.cpp.

174 {
177  return 0;
178 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define ICON_SMALL
Definition: tnclass.cpp:48
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE hProgInstance
Definition: main.cpp:50
#define IDI_APPICON
Definition: resource.h:166
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
#define LoadIcon
Definition: winuser.h:5788
#define ICON_BIG
Definition: tnclass.cpp:51

◆ OnDestroy()

LRESULT CMainWindow::OnDestroy ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 180 of file winproc.cpp.

181 {
183  PostQuitMessage(0); /* send a WM_QUIT to the message queue */
184  return 0;
185 }
WINDOWPLACEMENT WindowPlacement
Definition: registry.h:28
BOOL GetWindowPlacement(WINDOWPLACEMENT *lpwndpl) const
Definition: atlwin.h:750
RegistrySettings registrySettings
Definition: main.cpp:30
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

◆ OnDropFiles()

LRESULT CMainWindow::OnDropFiles ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 160 of file winproc.cpp.

161 {
162  TCHAR droppedfile[MAX_PATH];
163 
164  HDROP hDrop = (HDROP)wParam;
165  DragQueryFile(hDrop, 0, droppedfile, SIZEOF(droppedfile));
166  DragFinish(hDrop);
167 
168  ConfirmSave() && DoLoadImageFile(m_hWnd, droppedfile, TRUE);
169 
170  return 0;
171 }
#define TRUE
Definition: types.h:120
WPARAM wParam
Definition: combotst.c:138
#define SIZEOF(_ar)
Definition: calc.h:97
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:34
HWND m_hWnd
Definition: atlwin.h:268
HBITMAP DoLoadImageFile(HWND hwnd, LPCTSTR name, BOOL fIsMainFile)
Definition: dib.cpp:159
#define DragQueryFile
Definition: shellapi.h:684
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:543
BOOL ConfirmSave()
Definition: winproc.cpp:187

◆ OnGetMinMaxInfo()

LRESULT CMainWindow::OnGetMinMaxInfo ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 314 of file winproc.cpp.

315 {
317  mm->ptMinTrackSize.x = 330;
318  mm->ptMinTrackSize.y = 430;
319  return 0;
320 }
POINT ptMinTrackSize
Definition: winuser.h:3605
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
struct tagMINMAXINFO * LPMINMAXINFO
LPARAM lParam
Definition: combotst.c:139

◆ OnInitMenuPopup()

LRESULT CMainWindow::OnInitMenuPopup ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 221 of file winproc.cpp.

222 {
223  HMENU menu = GetMenu();
224  BOOL trueSelection = (selectionWindow.IsWindowVisible() && ((toolsModel.GetActiveTool() == TOOL_FREESEL) || (toolsModel.GetActiveTool() == TOOL_RECTSEL)));
225  switch (lParam)
226  {
227  case 0: /* File menu */
228  if ((HMENU)wParam != GetSubMenu(menu, 0))
229  break;
238  {
240  CPath pathFile1(registrySettings.strFile1);
241  pathFile1.CompactPathEx(30);
243  {
244  CPath pathFile2(registrySettings.strFile2);
245  pathFile2.CompactPathEx(30);
247  {
248  CPath pathFile3(registrySettings.strFile3);
249  pathFile3.CompactPathEx(30);
251  {
252  CPath pathFile4(registrySettings.strFile4);
253  pathFile4.CompactPathEx(30);
254  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE4, _T("4 ") + pathFile4);
255  }
256  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE3, _T("3 ") + pathFile3);
257  }
258  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE2, _T("2 ") + pathFile2);
259  }
260  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE1, _T("1 ") + pathFile1);
261  }
262  break;
263  case 1: /* Edit menu */
266  EnableMenuItem(menu, IDM_EDITCUT, ENABLED_IF(trueSelection));
267  EnableMenuItem(menu, IDM_EDITCOPY, ENABLED_IF(trueSelection));
268  EnableMenuItem(menu, IDM_EDITDELETESELECTION, ENABLED_IF(trueSelection));
269  EnableMenuItem(menu, IDM_EDITINVERTSELECTION, ENABLED_IF(trueSelection));
270  EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
271  OpenClipboard();
273  CloseClipboard();
274  break;
275  case 2: /* View menu */
277  CheckMenuItem(menu, IDM_VIEWCOLORPALETTE, CHECKED_IF(paletteWindow.IsWindowVisible()));
279  CheckMenuItem(menu, IDM_FORMATICONBAR, CHECKED_IF(textEditWindow.IsWindowVisible()));
281 
284  break;
285  case 3: /* Image menu */
286  EnableMenuItem(menu, IDM_IMAGECROP, ENABLED_IF(selectionWindow.IsWindowVisible()));
288  break;
289  }
290 
298 
301  return 0;
302 }
BOOL isAFile
Definition: main.cpp:53
int SelectedPalette()
#define IDM_EDITUNDO
Definition: definitions.h:75
ToolsModel toolsModel
Definition: main.cpp:18
CToolBox toolBoxContainer
Definition: main.cpp:66
#define MF_BYCOMMAND
Definition: winuser.h:202
#define IDM_VIEWZOOM125
Definition: definitions.h:90
#define TOOL_TEXT
Definition: definitions.h:144
#define IDM_VIEWSHOWGRID
Definition: definitions.h:98
#define IDM_VIEWZOOM400
Definition: definitions.h:95
#define InsertMenu
Definition: winuser.h:5778
BOOL showGrid
Definition: main.cpp:60
#define IDM_EDITCOPY
Definition: definitions.h:78
#define IDM_IMAGECROP
Definition: definitions.h:103
#define IDM_VIEWCOLORPALETTE
Definition: definitions.h:87
#define MF_STRING
Definition: winuser.h:138
#define IDM_EDITCOPYTO
Definition: definitions.h:83
CString strFile2
Definition: registry.h:31
#define IDM_VIEWSTATUSBAR
Definition: definitions.h:88
#define IDM_COLORSOLDPALETTE
Definition: definitions.h:111
BOOL HasRedoSteps()
Definition: history.cpp:177
WPARAM wParam
Definition: combotst.c:138
int GetZoom()
Definition: toolsmodel.cpp:104
#define IDM_VIEWZOOM100
Definition: definitions.h:93
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define IDM_FILE1
Definition: definitions.h:68
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDM_FILEASWALLPAPERCENTERED
Definition: definitions.h:64
#define MF_BYPOSITION
Definition: winuser.h:203
#define CF_BITMAP
Definition: constants.h:397
#define IDM_VIEWZOOM25
Definition: definitions.h:91
#define IDM_FILE4
Definition: definitions.h:71
HMENU GetMenu() const
Definition: atlwin.h:636
BOOL IsBackgroundTransparent()
Definition: toolsmodel.cpp:93
#define _T(x)
Definition: vfdio.h:22
#define IDM_FILEASWALLPAPERSTRETCHED
Definition: definitions.h:65
#define IDM_FILEMOSTRECENTLYUSEDFILE
Definition: definitions.h:67
BOOL OpenClipboard()
Definition: atlwin.h:970
#define IDM_FORMATICONBAR
Definition: definitions.h:89
HWND hStatusBar
Definition: main.cpp:35
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL showMiniature
Definition: main.cpp:61
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define IDM_EDITINVERTSELECTION
Definition: definitions.h:81
#define IDM_VIEWZOOM50
Definition: definitions.h:92
#define CHECKED_IF(a)
Definition: definitions.h:25
ImageModel imageModel
Definition: main.cpp:32
#define TOOL_FREESEL
Definition: definitions.h:135
#define IDM_FILEASWALLPAPERPLANE
Definition: definitions.h:63
#define IDM_EDITCUT
Definition: definitions.h:77
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define IDM_EDITPASTE
Definition: definitions.h:79
CPaletteWindow paletteWindow
Definition: main.cpp:68
BOOL HasUndoSteps()
Definition: history.cpp:172
CString strFile1
Definition: registry.h:30
#define TOOL_RECTSEL
Definition: definitions.h:136
CString strFile4
Definition: registry.h:33
#define IDM_IMAGEDRAWOPAQUE
Definition: definitions.h:107
#define IDM_EDITDELETESELECTION
Definition: definitions.h:80
bool IsEmpty() const
Definition: atlsimpstr.h:379
#define IDM_COLORSMODERNPALETTE
Definition: definitions.h:110
#define IDM_EDITREDO
Definition: definitions.h:76
#define IDM_FILE2
Definition: definitions.h:69
PaletteModel paletteModel
Definition: main.cpp:28
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
int GetActiveTool()
Definition: toolsmodel.cpp:60
#define ENABLED_IF(a)
Definition: definitions.h:27
#define NULL
Definition: types.h:112
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define IDM_FILE3
Definition: definitions.h:70
#define IDM_VIEWZOOM200
Definition: definitions.h:94
#define IDM_VIEWZOOM800
Definition: definitions.h:96
CTextEditWindow textEditWindow
Definition: main.cpp:81
RegistrySettings registrySettings
Definition: main.cpp:30
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define IDM_VIEWSHOWMINIATURE
Definition: definitions.h:99
LPARAM lParam
Definition: combotst.c:139
BOOL IsWindowVisible() const
Definition: atlwin.h:890
CSelectionWindow selectionWindow
Definition: main.cpp:71
#define IDM_VIEWTOOLBOX
Definition: definitions.h:86
CString strFile3
Definition: registry.h:32

◆ OnKeyDown()

LRESULT CMainWindow::OnKeyDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 329 of file winproc.cpp.

330 {
331  if (wParam == VK_ESCAPE)
332  {
333  HWND hwndCapture = GetCapture();
334  if (hwndCapture)
335  {
336  if (selectionWindow.m_hWnd == hwndCapture ||
337  imageArea.m_hWnd == hwndCapture ||
338  fullscreenWindow.m_hWnd == hwndCapture ||
339  sizeboxLeftTop.m_hWnd == hwndCapture ||
340  sizeboxCenterTop.m_hWnd == hwndCapture ||
341  sizeboxRightTop.m_hWnd == hwndCapture ||
342  sizeboxLeftCenter.m_hWnd == hwndCapture ||
343  sizeboxRightCenter.m_hWnd == hwndCapture ||
344  sizeboxLeftBottom.m_hWnd == hwndCapture ||
345  sizeboxCenterBottom.m_hWnd == hwndCapture ||
346  sizeboxRightBottom.m_hWnd == hwndCapture)
347  {
348  SendMessage(hwndCapture, nMsg, wParam, lParam);
349  }
350  }
351  else
352  {
353  switch (toolsModel.GetActiveTool())
354  {
355  case TOOL_SHAPE: case TOOL_BEZIER:
357  break;
358  }
359  }
360  }
361  return 0;
362 }
ToolsModel toolsModel
Definition: main.cpp:18
CSizeboxWindow sizeboxRightCenter
Definition: main.cpp:77
#define TOOL_SHAPE
Definition: definitions.h:148
#define VK_ESCAPE
Definition: winuser.h:2189
WPARAM wParam
Definition: combotst.c:138
CImgAreaWindow imageArea
Definition: main.cpp:72
CSizeboxWindow sizeboxCenterTop
Definition: main.cpp:74
CSizeboxWindow sizeboxRightTop
Definition: main.cpp:75
CSizeboxWindow sizeboxCenterBottom
Definition: main.cpp:79
#define TOOL_BEZIER
Definition: definitions.h:146
HWND WINAPI GetCapture(void)
Definition: message.c:2880
CSizeboxWindow sizeboxRightBottom
Definition: main.cpp:80
CFullscreenWindow fullscreenWindow
Definition: main.cpp:64
CSizeboxWindow sizeboxLeftCenter
Definition: main.cpp:76
HWND m_hWnd
Definition: atlwin.h:268
CSizeboxWindow sizeboxLeftBottom
Definition: main.cpp:78
int GetActiveTool()
Definition: toolsmodel.cpp:60
CSizeboxWindow sizeboxLeftTop
Definition: main.cpp:73
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
LPARAM lParam
Definition: combotst.c:139
CSelectionWindow selectionWindow
Definition: main.cpp:71

◆ OnSetCursor()

LRESULT CMainWindow::OnSetCursor ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 322 of file winproc.cpp.

323 {
325  bHandled = FALSE;
326  return 0;
327 }
#define FALSE
Definition: types.h:117
#define LoadCursor
Definition: winuser.h:5787
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define NULL
Definition: types.h:112
#define IDC_ARROW
Definition: winuser.h:682

◆ OnSize() [1/2]

LRESULT CMainWindow::OnSize ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 304 of file winproc.cpp.

305 {
306  int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
310  Invalidate(TRUE);
311  return 0;
312 }
#define TRUE
Definition: types.h:120
#define test
Definition: rosglue.h:37
WPARAM wParam
Definition: combotst.c:138
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SIZE
Definition: winuser.h:1593
HWND hStatusBar
Definition: main.cpp:35
void alignChildrenToMainWindow()
Definition: winproc.cpp:51
#define SB_SETPARTS
Definition: commctrl.h:1950
BOOL Invalidate(BOOL bErase=TRUE)
Definition: atlwin.h:828
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ProcessWindowMessage().

◆ OnSize() [2/2]

VOID CMainWindow::OnSize ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
private

Definition at line 243 of file gui.cpp.

244 {
245  if (wParam == SIZE_MINIMIZED)
246  return;
247 
248  /* Size status bar */
249  m_StatusBar->SendMessage(WM_SIZE, 0, 0);
250 
251 
252  RECT r = { 0, 0, LOWORD(lParam), HIWORD(lParam) };
253  HDWP hdwp = NULL;
255 
256  hdwp = BeginDeferWindowPos(count);
257  if (hdwp)
258  {
259  hdwp = m_ClientPanel->OnParentSize(r, hdwp);
260  if (hdwp)
261  {
262  EndDeferWindowPos(hdwp);
263  }
264  }
265 }
HDWP WINAPI BeginDeferWindowPos(_In_ int)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
virtual HDWP OnParentSize(RECT parentRect, HDWP hDwp)
Definition: rosui.h:421
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define WM_SIZE
Definition: winuser.h:1593
#define SIZE_MINIMIZED
Definition: winuser.h:2481
#define NULL
Definition: types.h:112
#define HIWORD(l)
Definition: typedefs.h:247
CUiPanel * m_ClientPanel
Definition: gui.h:49
virtual DWORD_PTR CountSizableChildren()
Definition: rosui.h:407
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
CUiWindow< CStatusBar > * m_StatusBar
Definition: gui.h:53

◆ OnSysColorChange()

LRESULT CMainWindow::OnSysColorChange ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 364 of file winproc.cpp.

365 {
366  /* Redirect message to common controls */
368  SendMessage(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
369  return 0;
370 }
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
CToolBox toolBoxContainer
Definition: main.cpp:66
#define TOOLBARCLASSNAME
Definition: commctrl.h:942
#define FindWindowEx
Definition: winuser.h:5753
HWND m_hWnd
Definition: atlwin.h:268
#define NULL
Definition: types.h:112
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1048

◆ ProcessWindowMessage()

BOOL CMainWindow::ProcessWindowMessage ( HWND  hwnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT theResult,
DWORD  dwMapId 
)
privatevirtual

Implements ATL::CMessageMap.

Definition at line 311 of file gui.cpp.

312 {
313  theResult = 0;
314  switch (Msg)
315  {
316  case WM_CREATE:
317  if (!InitControls())
318  ::PostMessageW(hwnd, WM_CLOSE, 0, 0);
319  break;
320 
321  case WM_DESTROY:
322  {
325 
326  FreeLogs();
329 
330  delete m_ClientPanel;
331 
332  PostQuitMessage(0);
333  return 0;
334  }
335 
336  case WM_COMMAND:
338  break;
339 
340  case WM_NOTIFY:
341  {
343 
344  switch (data->code)
345  {
346  case TVN_SELCHANGED:
347  {
348  if (data->hwndFrom == m_TreeView->m_hWnd)
349  {
350  switch (((LPNMTREEVIEW)lParam)->itemNew.lParam)
351  {
352  case IDS_INSTALLED:
354  break;
355 
356  case IDS_APPLICATIONS:
358  break;
359 
360  case IDS_UPDATES:
362  break;
363 
366  break;
367 
368  case IDS_CAT_AUDIO:
370  break;
371 
372  case IDS_CAT_DEVEL:
374  break;
375 
376  case IDS_CAT_DRIVERS:
378  break;
379 
380  case IDS_CAT_EDU:
382  break;
383 
384  case IDS_CAT_ENGINEER:
386  break;
387 
388  case IDS_CAT_FINANCE:
390  break;
391 
392  case IDS_CAT_GAMES:
394  break;
395 
396  case IDS_CAT_GRAPHICS:
398  break;
399 
400  case IDS_CAT_INTERNET:
402  break;
403 
404  case IDS_CAT_LIBS:
406  break;
407 
408  case IDS_CAT_OFFICE:
410  break;
411 
412  case IDS_CAT_OTHER:
414  break;
415 
416  case IDS_CAT_SCIENCE:
418  break;
419 
420  case IDS_CAT_TOOLS:
422  break;
423 
424  case IDS_CAT_VIDEO:
426  break;
427 
428  case IDS_CAT_THEMES:
430  break;
431 
432  case IDS_SELECTEDFORINST:
434  break;
435  }
436  }
437 
438  HMENU mainMenu = ::GetMenu(hwnd);
439 
440  /* Disable/enable items based on treeview selection */
442  {
444  EnableMenuItem(mainMenu, ID_INSTALL, MF_GRAYED);
446  EnableMenuItem(mainMenu, ID_MODIFY, MF_ENABLED);
447  }
448  else
449  {
453  EnableMenuItem(mainMenu, ID_MODIFY, MF_GRAYED);
454  }
455  }
456  break;
457 
458  }
459  }
460  break;
461 
462  case WM_SIZE:
464  break;
465 
466  case WM_SIZING:
467  {
468  LPRECT pRect = (LPRECT)lParam;
469 
470  if (pRect->right - pRect->left < 565)
471  pRect->right = pRect->left + 565;
472 
473  if (pRect->bottom - pRect->top < 300)
474  pRect->bottom = pRect->top + 300;
475 
476  return TRUE;
477  }
478 
479  case WM_SYSCOLORCHANGE:
480  {
481  /* Forward WM_SYSCOLORCHANGE to common controls */
483  m_TreeView->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
484  }
485  break;
486 
487  case WM_TIMER:
488  if (wParam == SEARCH_TIMER_ID)
489  {
491 
493  }
494  break;
495  }
496 
497  return FALSE;
498 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
BOOL InitControls()
Definition: gui.cpp:229
#define ID_REGREMOVE
Definition: resource.h:83
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
#define IDS_CAT_DEVEL
Definition: resource.h:177
CInstalledApps m_InstalledApps
Definition: gui.h:58
LONG top
Definition: windef.h:307
#define LPNMTREEVIEW
Definition: commctrl.h:3639
#define IDS_CAT_OFFICE
Definition: resource.h:186
LONG left
Definition: windef.h:306
#define IDS_CAT_VIDEO
Definition: resource.h:190
VOID FreeLogs()
Definition: misc.cpp:241
LONG right
Definition: windef.h:308
#define IDS_CAT_FINANCE
Definition: resource.h:181
#define ID_UNINSTALL
Definition: resource.h:75
WPARAM wParam
Definition: combotst.c:138
#define IDS_AVAILABLEFORINST
Definition: resource.h:100
struct tagNMHDR * LPNMHDR
VOID FreeCachedEntries()
Definition: installed.cpp:325
#define IDS_INSTALLED
Definition: resource.h:99
BOOL IsSelectedNodeInstalled()
Definition: gui.cpp:500
void SaveSettings(void)
Definition: settings.c:115
struct @1620 Msg[]
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define FALSE
Definition: types.h:117
BOOL KillTimer(UINT_PTR nIDEvent)
Definition: atlwin.h:908
VOID FreeCachedEntries()
Definition: available.cpp:345
#define WM_SIZING
Definition: winuser.h:1789
#define LPRECT
Definition: precomp.h:28
#define IDS_SELECTEDFORINST
Definition: resource.h:119
#define IDS_CAT_INTERNET
Definition: resource.h:184
#define WM_DESTROY
Definition: winuser.h:1591
#define IDS_CAT_DRIVERS
Definition: resource.h:178
HMENU GetMenu() const
Definition: atlwin.h:636
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
#define IDS_CAT_OTHER
Definition: resource.h:187
#define WM_SIZE
Definition: winuser.h:1593
#define TVN_SELCHANGED
Definition: commctrl.h:3731
#define WM_TIMER
Definition: winuser.h:1724
#define MF_ENABLED
Definition: winuser.h:128
#define WM_CLOSE
Definition: winuser.h:1603
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define IDS_CAT_LIBS
Definition: resource.h:185
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:304
CApplicationView * m_ApplicationView
Definition: gui.h:55
#define IDS_CAT_THEMES
Definition: resource.h:191
#define IDS_CAT_SCIENCE
Definition: resource.h:188
#define IDS_CAT_GRAPHICS
Definition: resource.h:183
#define IDS_CAT_AUDIO
Definition: resource.h:176
#define WM_COMMAND
Definition: winuser.h:1722
#define IDS_CAT_EDU
Definition: resource.h:179
#define IDS_CAT_ENGINEER
Definition: resource.h:180
CAvailableApps m_AvailableApps
Definition: gui.h:57
#define IDS_APPLICATIONS
Definition: resource.h:102
#define SEARCH_TIMER_ID
Definition: gui.cpp:32
VOID UpdateApplicationsList(INT EnumType)
Definition: gui.cpp:671
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1265
#define ID_INSTALL
Definition: resource.h:74
#define IDS_UPDATES
Definition: resource.h:101
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:372
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_CAT_TOOLS
Definition: resource.h:189
#define WM_CREATE
Definition: winuser.h:1590
LONG bottom
Definition: windef.h:309
#define MF_GRAYED
Definition: winuser.h:129
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
CUiPanel * m_ClientPanel
Definition: gui.h:49
#define IDS_CAT_GAMES
Definition: resource.h:182
LPARAM lParam
Definition: combotst.c:139
#define ID_MODIFY
Definition: resource.h:78
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_NOTIFY
Definition: richedit.h:61
CSideTreeView * m_TreeView
Definition: gui.h:52

◆ RemoveSelectedAppFromRegistry()

BOOL CMainWindow::RemoveSelectedAppFromRegistry ( )
private

Definition at line 267 of file gui.cpp.

268 {
270  return FALSE;
271 
272  ATL::CStringW szMsgText, szMsgTitle;
273 
274  if (!szMsgText.LoadStringW(IDS_APP_REG_REMOVE) ||
275  !szMsgTitle.LoadStringW(IDS_INFORMATION))
276  return FALSE;
277 
278  if (MessageBoxW(szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
279  {
281  if (!InstalledApp)
282  return FALSE;
283 
284  LSTATUS Result = InstalledApp->RemoveFromRegistry();
285  if (Result != ERROR_SUCCESS)
286  {
287  // TODO: popup a messagebox telling user it fails somehow
288  return FALSE;
289  }
290 
291  // as it's already removed form registry, this will also remove it from the list
293  return TRUE;
294  }
295 
296  return FALSE;
297 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
INT SelectedEnumType
Definition: gui.h:63
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
#define MB_ICONQUESTION
Definition: winuser.h:783
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
BOOL IsInstalledEnum(INT x)
Definition: defines.h:71
CApplicationView * m_ApplicationView
Definition: gui.h:55
#define IDS_APP_REG_REMOVE
Definition: resource.h:106
VOID UpdateApplicationsList(INT EnumType)
Definition: gui.cpp:671
#define IDS_INFORMATION
Definition: resource.h:107
PVOID GetFocusedItemData()
Definition: appview.cpp:2004

Referenced by OnCommand().

◆ s_EnumAvailableAppProc()

BOOL CALLBACK CMainWindow::s_EnumAvailableAppProc ( CAvailableApplicationInfo Info,
BOOL  bInitialCheckState,
PVOID  param 
)
staticprivate

Definition at line 647 of file gui.cpp.

648 {
649  CMainWindow *pThis = (CMainWindow *)param;
650  return pThis->EnumAvailableAppProc(Info, bInitialCheckState);
651 }
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
BOOL CALLBACK EnumAvailableAppProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState)
Definition: gui.cpp:631
GLfloat param
Definition: glext.h:5796

Referenced by UpdateApplicationsList().

◆ s_EnumInstalledAppProc()

BOOL CALLBACK CMainWindow::s_EnumInstalledAppProc ( CInstalledApplicationInfo Info,
PVOID  param 
)
staticprivate

Definition at line 641 of file gui.cpp.

642 {
643  CMainWindow *pThis = (CMainWindow *)param;
644  return pThis->EnumInstalledAppProc(Info);
645 }
BOOL CALLBACK EnumInstalledAppProc(CInstalledApplicationInfo *Info)
Definition: gui.cpp:622
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
GLfloat param
Definition: glext.h:5796

Referenced by UpdateApplicationsList().

◆ s_EnumSelectedAppForDownloadProc()

BOOL CALLBACK CMainWindow::s_EnumSelectedAppForDownloadProc ( CAvailableApplicationInfo Info,
BOOL  bInitialCheckState,
PVOID  param 
)
staticprivate

Definition at line 653 of file gui.cpp.

654 {
656  pAppList->Add(*Info);
657  return TRUE;
658 }
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
GLfloat param
Definition: glext.h:5796

Referenced by InstallApplication(), and OnCommand().

◆ saveImage()

void CMainWindow::saveImage ( BOOL  overwrite)

Definition at line 88 of file winproc.cpp.

89 {
90  if (isAFile && overwrite)
91  {
93  }
94  else if (GetSaveFileName(&sfn) != 0)
95  {
98  CString strTitle;
100  SetWindowText(strTitle);
101  isAFile = TRUE;
102  }
103 }
BOOL isAFile
Definition: main.cpp:53
void SaveImage(LPTSTR lpFileName)
Definition: history.cpp:162
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define TRUE
Definition: types.h:120
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
Definition: tcsncpy.h:9
LPWSTR lpstrFile
Definition: commdlg.h:367
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:716
BOOL SetWindowText(LPCTSTR lpszString)
Definition: atlwin.h:1232
#define GetSaveFileName
Definition: commdlg.h:666
#define SIZEOF(_ar)
Definition: calc.h:97
OPENFILENAMEW sfn
Definition: eventvwr.c:118
TCHAR filepathname[1000]
Definition: main.cpp:52
ImageModel imageModel
Definition: main.cpp:32
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
#define IDS_WINDOWTITLE
Definition: definitions.h:204

Referenced by ConfirmSave(), and OnCommand().

◆ SearchTextChanged()

BOOL CMainWindow::SearchTextChanged ( ATL::CStringW SearchText)

Definition at line 812 of file gui.cpp.

813 {
814  if (szSearchPattern == SearchText)
815  {
816  return FALSE;
817  }
818 
819  szSearchPattern = SearchText;
820 
821  DWORD dwDelay;
822  SystemParametersInfoW(SPI_GETMENUSHOWDELAY, 0, &dwDelay, 0);
823  SetTimer(SEARCH_TIMER_ID, dwDelay);
824 
825  return TRUE;
826 }
ATL::CStringW szSearchPattern
Definition: gui.h:62
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
Definition: atlwin.h:1190
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SEARCH_TIMER_ID
Definition: gui.cpp:32

Referenced by CApplicationView::OnCommand().

◆ ShowAboutDlg()

VOID CMainWindow::ShowAboutDlg ( )
private

Definition at line 519 of file gui.cpp.

520 {
521  ATL::CStringW szApp;
522  ATL::CStringW szAuthors;
523  HICON hIcon;
524 
525  szApp.LoadStringW(IDS_APPTITLE);
526  szAuthors.LoadStringW(IDS_APP_AUTHORS);
528  ShellAboutW(m_hWnd, szApp, szAuthors, hIcon);
530 }
static HICON
Definition: imagelist.c:84
#define IDS_APPTITLE
Definition: resource.h:3
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define IDI_MAIN
Definition: resource.h:4
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
HWND m_hWnd
Definition: atlwin.h:268
HINSTANCE hInst
Definition: dxdiag.c:13
HICON hIcon
Definition: msconfig.c:44
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDS_APP_AUTHORS
Definition: resource.h:122

Referenced by OnCommand().

◆ UninstallSelectedApp()

BOOL CMainWindow::UninstallSelectedApp ( BOOL  bModify)
private

Definition at line 299 of file gui.cpp.

300 {
302  return FALSE;
303 
305  if (!InstalledApp)
306  return FALSE;
307 
308  return InstalledApp->UninstallApplication(bModify);
309 }
INT SelectedEnumType
Definition: gui.h:63
#define FALSE
Definition: types.h:117
BOOL UninstallApplication(BOOL bModify)
Definition: installed.cpp:139
BOOL IsInstalledEnum(INT x)
Definition: defines.h:71
CApplicationView * m_ApplicationView
Definition: gui.h:55
PVOID GetFocusedItemData()
Definition: appview.cpp:2004

Referenced by OnCommand().

◆ UpdateApplicationsList()

VOID CMainWindow::UpdateApplicationsList ( INT  EnumType)
private

Definition at line 671 of file gui.cpp.

672 {
673  bUpdating = TRUE;
674 
675  if (EnumType == -1)
676  {
677  // keep the old enum type
678  EnumType = SelectedEnumType;
679  }
680  else
681  {
682  SelectedEnumType = EnumType;
683  }
684 
685  m_ApplicationView->SetRedraw(FALSE);
686  if (IsInstalledEnum(EnumType))
687  {
688  // set the display type of application-view. this will remove all the item in application-view too.
690 
691  // enum installed softwares
693  }
694  else if (IsAvailableEnum(EnumType))
695  {
696  // set the display type of application-view. this will remove all the item in application-view too.
698 
699  // enum available softwares
701  }
702  m_ApplicationView->SetRedraw(TRUE);
703  m_ApplicationView->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN); // force the child window to repaint
705  bUpdating = FALSE;
706 }
#define TRUE
Definition: types.h:120
BOOL bUpdating
Definition: gui.h:60
CInstalledApps m_InstalledApps
Definition: gui.h:58
INT SelectedEnumType
Definition: gui.h:63
BOOL SetDisplayAppType(APPLICATION_VIEW_TYPE AppType)
Definition: appview.cpp:1926
#define FALSE
Definition: types.h:117
static BOOL CALLBACK s_EnumAvailableAppProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param)
Definition: gui.cpp:647
BOOL IsAvailableEnum(INT x)
Definition: defines.h:66
BOOL Enum(INT EnumType, APPENUMPROC lpEnumProc, PVOID param)
Definition: installed.cpp:174
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param)
Definition: available.cpp:448
BOOL IsInstalledEnum(INT x)
Definition: defines.h:71
CApplicationView * m_ApplicationView
Definition: gui.h:55
VOID UpdateStatusBarText()
Definition: gui.cpp:660
CAvailableApps m_AvailableApps
Definition: gui.h:57
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
static BOOL CALLBACK s_EnumInstalledAppProc(CInstalledApplicationInfo *Info, PVOID param)
Definition: gui.cpp:641
#define RDW_INVALIDATE
Definition: winuser.h:1200

Referenced by InstallApplication(), OnCommand(), ProcessWindowMessage(), and RemoveSelectedAppFromRegistry().

◆ UpdateStatusBarText()

VOID CMainWindow::UpdateStatusBarText ( )
private

Definition at line 660 of file gui.cpp.

661 {
662  if (m_StatusBar)
663  {
664  ATL::CStringW szBuffer;
665 
667  m_StatusBar->SetText(szBuffer);
668  }
669 }
#define IDS_APPS_COUNT
Definition: resource.h:95
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:716
CApplicationView * m_ApplicationView
Definition: gui.h:55
int GetSelectedCount()
Definition: available.cpp:568
CAvailableApps m_AvailableApps
Definition: gui.h:57
VOID SetText(LPCWSTR lpszText)
Definition: rosctrls.h:455
CUiWindow< CStatusBar > * m_StatusBar
Definition: gui.h:53

Referenced by InitControls(), ItemCheckStateChanged(), and UpdateApplicationsList().

Member Data Documentation

◆ bUpdating

BOOL CMainWindow::bUpdating = FALSE
private

Definition at line 60 of file gui.h.

Referenced by CreateLayout(), ItemCheckStateChanged(), and UpdateApplicationsList().

◆ m_ApplicationView

◆ m_AvailableApps

CAvailableApps CMainWindow::m_AvailableApps
private

◆ m_ClientPanel

CUiPanel* CMainWindow::m_ClientPanel = NULL
private

Definition at line 49 of file gui.h.

Referenced by CreateLayout(), CreateStatusBar(), CreateVSplitter(), OnSize(), and ProcessWindowMessage().

◆ m_InstalledApps

CInstalledApps CMainWindow::m_InstalledApps
private

Definition at line 58 of file gui.h.

Referenced by ProcessWindowMessage(), and UpdateApplicationsList().

◆ m_StatusBar

CUiWindow<CStatusBar>* CMainWindow::m_StatusBar = NULL
private

Definition at line 53 of file gui.h.

Referenced by CreateLayout(), CreateStatusBar(), LayoutCleanup(), OnSize(), and UpdateStatusBarText().

◆ m_TreeView

CSideTreeView* CMainWindow::m_TreeView = NULL
private

◆ m_VSplitter

CUiSplitPanel* CMainWindow::m_VSplitter = NULL
private

◆ SelectedEnumType

INT CMainWindow::SelectedEnumType
private

◆ szSearchPattern

ATL::CStringW CMainWindow::szSearchPattern
private

Definition at line 62 of file gui.h.

Referenced by EnumAvailableAppProc(), EnumInstalledAppProc(), and SearchTextChanged().


The documentation for this class was generated from the following files: