ReactOS 0.4.15-dev-8080-g044f181
CMainWindow Class Reference

#include <main.h>

Inheritance diagram for CMainWindow:
Collaboration diagram for CMainWindow:

Public Member Functions

 CMainWindow ()
 
HWND DoCreate ()
 
BOOL GetOpenFileName (IN OUT LPWSTR pszFile, INT cchMaxFile)
 
BOOL GetSaveFileName (IN OUT LPWSTR pszFile, INT cchMaxFile)
 
BOOL ChooseColor (IN OUT COLORREF *prgbColor)
 
VOID TrackPopupMenu (POINT ptScreen, INT iSubMenu)
 
BOOL CanUndo () const
 
BOOL CanRedo () const
 
BOOL CanPaste () const
 
 CMainWindow (CAppDB *db, BOOL bAppwiz=FALSE)
 
 ~CMainWindow ()
 
HWND Create ()
 
VOID ItemCheckStateChanged (BOOL bChecked, LPVOID CallbackParam)
 
BOOL InstallApplication (CAppInfo *Info)
 
BOOL SearchTextChanged (CStringW &SearchText)
 
void HandleTabOrder (int direction)
 
- 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< TBase, TWinTraits >
 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
HWND UnsubclassWindow (BOOL bForce=FALSE)
 
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< TBase >
 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 (_In_ int nID) const
 
UINT GetDlgItemInt (_In_ int nID, _Out_opt_ BOOL *lpTrans=NULL, _In_ BOOL bSigned=TRUE) const
 
UINT GetDlgItemText (_In_ int nID, _Out_writes_to_(nMaxCount, return+1) LPTSTR lpStr, _In_ int nMaxCount) const
 
BOOL GetDlgItemText (_In_ int nID, _Inout_ _Outref_result_maybenull_ _Post_z_ 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 (_Out_writes_to_(nMaxCount, return+1) LPTSTR lpszStringBuf, _In_ int nMaxCount) const
 
BOOL GetWindowText (_Inout_ _Outref_result_maybenull_ _Post_z_ BSTR &bstrText) const
 
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)
 
virtual BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID)=0
 
- 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)
 

Static Public Member Functions

static ATL::CWndClassInfoGetWndClassInfo ()
 
- Static Public Member Functions inherited from ATL::CWindowImpl< CMainWindow >
static LPCTSTR GetWndCaption ()
 
- Static Public Member Functions inherited from ATL::CWindowImplBaseT< TBase, TWinTraits >
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, CWindow, CFrameWinTraits >
static LPCTSTR GetWndCaption ()
 

Private 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 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)
 
LRESULT OnMouseWheel (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
void alignChildrenToMainWindow ()
 
void saveImage (BOOL overwrite)
 
void InsertSelectionFromHBITMAP (HBITMAP bitmap, HWND window)
 
BOOL ConfirmSave ()
 
void ProcessFileMenu (HMENU hPopupMenu)
 
VOID InitCategoriesList ()
 
BOOL CreateStatusBar ()
 
BOOL CreateTreeView ()
 
BOOL CreateApplicationView ()
 
BOOL CreateVSplitter ()
 
BOOL CreateLayout ()
 
VOID LayoutCleanup ()
 
BOOL InitControls ()
 
VOID OnSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
VOID CheckAvailable ()
 
BOOL RemoveSelectedAppFromRegistry ()
 
BOOL UninstallSelectedApp (BOOL bModify)
 
BOOL ProcessWindowMessage (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId)
 
VOID ShowAboutDlg ()
 
VOID OnCommand (WPARAM wParam, LPARAM lParam)
 
VOID UpdateStatusBarText ()
 
VOID UpdateApplicationsList (AppsCategories EnumType, BOOL bReload=FALSE, BOOL bCheckAvailable=FALSE)
 
VOID AddApplicationsToView (CAtlList< CAppInfo * > &List)
 

Private Attributes

HMENU m_hMenu
 
CUiPanelm_ClientPanel = NULL
 
CUiSplitPanelm_VSplitter = NULL
 
CSideTreeViewm_TreeView = NULL
 
CUiWindow< CStatusBar > * m_StatusBar = NULL
 
CApplicationViewm_ApplicationView = NULL
 
CAppDBm_Db
 
CAtlList< CAppInfo * > m_Selected
 
BOOL bUpdating = FALSE
 
BOOL bAppwizMode
 
HTREEITEM hRootItemInstalled
 
CStringW szSearchPattern
 
AppsCategories SelectedEnumType
 

Additional Inherited Members

- Public Types inherited from ATL::CWindowImplRoot< TBase >
enum  { WINSTATE_DESTROYED = 0x00000001 }
 
- Public Attributes inherited from ATL::CWindowImplBaseT< TBase, TWinTraits >
WNDPROC m_pfnSuperWindowProc
 
- Public Attributes inherited from ATL::CWindowImplRoot< TBase >
CWndProcThunk m_thunk
 
const _ATL_MSGm_pCurrentMsg
 
DWORD m_dwState
 
- Public Attributes inherited from ATL::CWindow
HWND m_hWnd
 
- Static Public Attributes inherited from ATL::CWindow
static RECT rcDefault
 

Detailed Description

Definition at line 11 of file main.h.

Constructor & Destructor Documentation

◆ CMainWindow() [1/2]

CMainWindow::CMainWindow ( )
inline

Definition at line 30 of file main.h.

30: m_hMenu(NULL) { }
HMENU m_hMenu
Definition: main.h:42
#define NULL
Definition: types.h:112

◆ CMainWindow() [2/2]

CMainWindow::CMainWindow ( CAppDB db,
BOOL  bAppwiz = FALSE 
)
explicit

Definition at line 85 of file gui.cpp.

86{
87}
@ ENUM_ALL_INSTALLED
Definition: appinfo.h:44
AppsCategories SelectedEnumType
Definition: gui.h:64
BOOL bAppwizMode
Definition: gui.h:60
CAppDB * m_Db
Definition: gui.h:56
CUiPanel * m_ClientPanel
Definition: gui.h:48

◆ ~CMainWindow()

CMainWindow::~CMainWindow ( )

Definition at line 89 of file gui.cpp.

90{
92}
VOID LayoutCleanup()
Definition: gui.cpp:215

Member Function Documentation

◆ AddApplicationsToView()

VOID CMainWindow::AddApplicationsToView ( CAtlList< CAppInfo * > &  List)
private

Definition at line 588 of file gui.cpp.

589{
590 POSITION CurrentListPosition = List.GetHeadPosition();
591 while (CurrentListPosition)
592 {
593 CAppInfo *Info = List.GetNext(CurrentListPosition);
596 {
597 BOOL bSelected = m_Selected.Find(Info) != NULL;
599 }
600 }
601}
BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle)
Definition: misc.cpp:409
POSITION Find(INARGTYPE element, _In_opt_ POSITION posStartAfter=NULL) const
Definition: atlcoll.h:773
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
BOOL AddApplication(CAppInfo *InstAppInfo, BOOL InitialCheckState)
Definition: appview.cpp:1856
CStringW szSearchPattern
Definition: gui.h:63
CAtlList< CAppInfo * > m_Selected
Definition: gui.h:57
CApplicationView * m_ApplicationView
Definition: gui.h:54
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by UpdateApplicationsList().

◆ alignChildrenToMainWindow()

void CMainWindow::alignChildrenToMainWindow ( )
private

Definition at line 341 of file main.cpp.

342{
343 RECT clientRect, rc;
344 GetClientRect(&clientRect);
345 RECT rcSpace = clientRect;
347
349 {
351 rcSpace.bottom -= rc.bottom - rc.top;
352 }
353
354 HDWP hDWP = ::BeginDeferWindowPos(3);
355
357 {
359 {
361 rcSpace.right - CX_TOOLBAR, rcSpace.top,
362 CX_TOOLBAR, rcSpace.bottom - rcSpace.top,
363 uFlags);
364 rcSpace.right -= CX_TOOLBAR;
365 }
366 else
367 {
369 rcSpace.left, rcSpace.top,
370 CX_TOOLBAR, rcSpace.bottom - rcSpace.top,
371 uFlags);
372 rcSpace.left += CX_TOOLBAR;
373 }
374 }
375
377 {
379 {
380 hDWP = ::DeferWindowPos(hDWP, paletteWindow, NULL,
381 rcSpace.left, rcSpace.bottom - CY_PALETTE,
382 rcSpace.right - rcSpace.left, CY_PALETTE,
383 uFlags);
384 rcSpace.bottom -= CY_PALETTE;
385 }
386 else
387 {
388 hDWP = ::DeferWindowPos(hDWP, paletteWindow, NULL,
389 rcSpace.left, rcSpace.top,
390 rcSpace.right - rcSpace.left, CY_PALETTE,
391 uFlags);
392 rcSpace.top += CY_PALETTE;
393 }
394 }
395
396 if (canvasWindow.IsWindow())
397 {
398 hDWP = ::DeferWindowPos(hDWP, canvasWindow, NULL,
399 rcSpace.left, rcSpace.top,
400 rcSpace.right - rcSpace.left, rcSpace.bottom - rcSpace.top,
401 uFlags);
402 }
403
405}
HWND g_hStatusBar
Definition: main.cpp:23
#define CY_PALETTE
Definition: palette.h:12
RegistrySettings registrySettings
Definition: registry.cpp:14
CToolBox toolBoxContainer
Definition: toolbox.cpp:11
#define BAR1ID_BOTTOM
Definition: registry.h:51
#define BAR2ID_RIGHT
Definition: registry.h:56
CCanvasWindow canvasWindow
Definition: canvas.cpp:10
BOOL IsWindowVisible() const
Definition: atlwin.h:958
UINT uFlags
Definition: api.c:59
unsigned int UINT
Definition: ndis.h:50
CPaletteWindow paletteWindow
Definition: palette.cpp:19
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define CX_TOOLBAR
Definition: toolbox.h:14
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define SWP_NOREPOSITION
Definition: winuser.h:1250
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SWP_NOCOPYBITS
Definition: winuser.h:1243
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOZORDER
Definition: winuser.h:1247
HDWP WINAPI BeginDeferWindowPos(_In_ int)

Referenced by OnCommand(), and OnSize().

◆ CanPaste()

BOOL CMainWindow::CanPaste ( ) const

Definition at line 692 of file main.cpp.

693{
695 return ::IsClipboardFormatAvailable(CF_UNICODETEXT);
696
700}
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
CTextEditWindow textEditWindow
Definition: textedit.cpp:12
#define CF_UNICODETEXT
Definition: constants.h:408
#define CF_BITMAP
Definition: constants.h:397
#define CF_ENHMETAFILE
Definition: constants.h:409
#define CF_DIB
Definition: constants.h:403
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:134
@ TOOL_TEXT
Definition: toolsmodel.h:21
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)

Referenced by OnInitMenuPopup().

◆ CanRedo()

BOOL CMainWindow::CanRedo ( ) const

Definition at line 685 of file main.cpp.

686{
688 return FALSE; // There is no "WM_REDO" in EDIT control
689 return imageModel.CanRedo();
690}
BOOL CanRedo() const
Definition: history.h:30
#define FALSE
Definition: types.h:117
ImageModel imageModel
Definition: history.cpp:11

Referenced by OnInitMenuPopup().

◆ CanUndo()

BOOL CMainWindow::CanUndo ( ) const

Definition at line 676 of file main.cpp.

677{
679 return (BOOL)textEditWindow.SendMessage(EM_CANUNDO);
681 return TRUE;
682 return imageModel.CanUndo();
683}
SelectionModel selectionModel
BOOL CanUndo() const
Definition: history.h:29
BOOL IsSelection() const
Definition: toolsmodel.cpp:41
#define TRUE
Definition: types.h:120
#define EM_CANUNDO
Definition: winuser.h:1983

Referenced by OnInitMenuPopup().

◆ CheckAvailable()

VOID CMainWindow::CheckAvailable ( )
private

Definition at line 297 of file gui.cpp.

298{
299 if (m_Db->GetAvailableCount() == 0)
300 {
303 }
304}
VOID UpdateAvailable()
Definition: appdb.cpp:121
size_t GetAvailableCount() const
Definition: appdb.h:50
VOID RemoveCached()
Definition: appdb.cpp:291

Referenced by UpdateApplicationsList().

◆ ChooseColor()

BOOL CMainWindow::ChooseColor ( IN OUT COLORREF prgbColor)

Definition at line 282 of file main.cpp.

283{
284 static CHOOSECOLOR choosecolor = { 0 };
285 static COLORREF custColors[16] =
286 {
287 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
288 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff
289 };
290
291 if (choosecolor.lStructSize == 0)
292 {
293 // Initializing the CHOOSECOLOR structure for ChooseColor
294 ZeroMemory(&choosecolor, sizeof(choosecolor));
295 choosecolor.lStructSize = sizeof(choosecolor);
296 choosecolor.hwndOwner = m_hWnd;
297 choosecolor.lpCustColors = custColors;
298 }
299
300 choosecolor.Flags = CC_RGBINIT;
301 choosecolor.rgbResult = *prgbColor;
302 if (!::ChooseColor(&choosecolor))
303 return FALSE;
304
305 *prgbColor = choosecolor.rgbResult;
306 return TRUE;
307}
HWND m_hWnd
Definition: atlwin.h:273
#define CC_RGBINIT
Definition: commdlg.h:50
#define ChooseColor
Definition: commdlg.h:661
COLORREF rgbResult
Definition: commdlg.h:242
HWND hwndOwner
Definition: commdlg.h:240
COLORREF * lpCustColors
Definition: commdlg.h:243
DWORD lStructSize
Definition: commdlg.h:239
#define ZeroMemory
Definition: winbase.h:1712
DWORD COLORREF
Definition: windef.h:300

Referenced by CPaletteWindow::OnLButtonDblClk(), and CPaletteWindow::OnRButtonDblClk().

◆ ConfirmSave()

BOOL CMainWindow::ConfirmSave ( )
private

Definition at line 607 of file main.cpp.

608{
610
612 return TRUE;
613
614 CStringW strProgramName;
615 strProgramName.LoadString(IDS_PROGRAMNAME);
616
617 CStringW strSavePromptText;
619
620 switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION))
621 {
622 case IDYES:
624 return imageModel.IsImageSaved();
625 case IDNO:
626 return TRUE;
627 case IDCANCEL:
628 return FALSE;
629 }
630
631 return TRUE;
632}
WCHAR g_szFileName[MAX_LONG_PATH]
Definition: main.cpp:18
#define IDS_SAVEPROMPTTEXT
Definition: resource.h:191
#define IDS_PROGRAMNAME
Definition: resource.h:186
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:639
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
VOID OnEndDraw(BOOL bCancel)
Definition: canvas.cpp:701
void saveImage(BOOL overwrite)
Definition: main.cpp:407
BOOL IsImageSaved() const
Definition: history.cpp:224
#define PathFindFileName
Definition: shlwapi.h:911
#define IDCANCEL
Definition: winuser.h:831
#define IDNO
Definition: winuser.h:836
#define MB_ICONQUESTION
Definition: winuser.h:789
#define MessageBox
Definition: winuser.h:5822
#define IDYES
Definition: winuser.h:835
#define MB_YESNOCANCEL
Definition: winuser.h:818

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

◆ Create()

HWND CMainWindow::Create ( )

Definition at line 686 of file gui.cpp.

687{
688 CStringW szWindowName;
689 szWindowName.LoadStringW(IDS_APPTITLE);
690
691 RECT r = {
695 r.right += r.left;
696 r.bottom += r.top;
697
698 return CWindowImpl::Create(
700}
#define IDS_APPTITLE
Definition: resource.h:3
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1734
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
BOOL bSaveWndPos
Definition: settings.h:7
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define CW_USEDEFAULT
Definition: winuser.h:225

Referenced by DoCreate(), and MainWindowLoop().

◆ CreateApplicationView()

BOOL CMainWindow::CreateApplicationView ( )
private

Definition at line 152 of file gui.cpp.

153{
154 m_ApplicationView = new CApplicationView(this); // pass this to ApplicationView for callback purpose
158
160}
HWND Create(HWND hwndParent)
Definition: appview.cpp:1808
CUiSplitPanel * m_VSplitter
Definition: gui.h:49
INT Append(T *ptr)
Definition: rosui.h:87
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:257
CUiAlignment m_VerticalAlignment
Definition: rosui.h:258
CUiCollection & Second()
Definition: rosui.h:623
@ UiAlign_Stretch
Definition: rosui.h:249

Referenced by CreateLayout().

◆ CreateLayout()

BOOL CMainWindow::CreateLayout ( )
private

Definition at line 181 of file gui.cpp.

182{
183 BOOL b = TRUE;
184 bUpdating = TRUE;
185
186 m_ClientPanel = new CUiPanel();
189
190 // Top level
191 b = b && CreateStatusBar();
192 b = b && CreateVSplitter();
193
194 // Inside V Splitter
195 b = b && CreateTreeView();
197
198 if (b)
199 {
200 RECT rBottom;
201
202 /* Size status bar */
203 m_StatusBar->SendMessageW(WM_SIZE, 0, 0);
204
205 ::GetWindowRect(m_StatusBar->m_hWnd, &rBottom);
206
207 m_VSplitter->m_Margin.bottom = rBottom.bottom - rBottom.top;
208 }
209
211 return b;
212}
BOOL CreateTreeView()
Definition: gui.cpp:141
BOOL CreateVSplitter()
Definition: gui.cpp:163
BOOL bUpdating
Definition: gui.h:59
CUiWindow< CStatusBar > * m_StatusBar
Definition: gui.h:52
BOOL CreateStatusBar()
Definition: gui.cpp:130
BOOL CreateApplicationView()
Definition: gui.cpp:152
CUiMargin m_Margin
Definition: rosui.h:255
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
#define WM_SIZE
Definition: winuser.h:1611

Referenced by InitControls().

◆ CreateStatusBar()

BOOL CMainWindow::CreateStatusBar ( )
private

Definition at line 130 of file gui.cpp.

131{
136
138}
#define IDC_STATUSBAR
Definition: resource.h:12
HWND Create(HWND hwndParent, HMENU hMenu)
Definition: rosctrls.h:462
CUiCollection & Children()
Definition: rosui.h:384
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
@ UiAlign_RightBtm
Definition: rosui.h:248

Referenced by CreateLayout().

◆ CreateTreeView()

BOOL CMainWindow::CreateTreeView ( )
private

Definition at line 141 of file gui.cpp.

142{
147
148 return m_TreeView->Create(m_hWnd) != NULL;
149}
CSideTreeView * m_TreeView
Definition: gui.h:51
HWND Create(HWND hwndParent)
Definition: rosctrls.h:483
CUiCollection & First()
Definition: rosui.h:618

Referenced by CreateLayout().

◆ CreateVSplitter()

BOOL CMainWindow::CreateVSplitter ( )
private

Definition at line 163 of file gui.cpp.

164{
171
172 // TODO: m_MinSecond should be calculate dynamically instead of hard-coded
174 m_VSplitter->m_Pos = 240;
176
177 return m_VSplitter->Create(m_hWnd) != NULL;
178}
INT m_Pos
Definition: rosui.h:584
BOOL m_Horizontal
Definition: rosui.h:585
BOOL m_DynamicFirst
Definition: rosui.h:586
INT m_MinSecond
Definition: rosui.h:588
HWND Create(HWND hwndParent)
Definition: rosui.h:867
INT m_MinFirst
Definition: rosui.h:587

Referenced by CreateLayout().

◆ DoCreate()

HWND CMainWindow::DoCreate ( )

Definition at line 309 of file main.cpp.

310{
312
313 CStringW strTitle;
315
318}
HINSTANCE g_hinstExe
Definition: main.cpp:17
#define IDS_DEFAULTFILENAME
Definition: resource.h:192
#define IDS_WINDOWTITLE
Definition: resource.h:187
HWND Create()
Definition: gui.cpp:686
WINDOWPLACEMENT WindowPlacement
Definition: registry.h:29
#define WS_EX_ACCEPTFILES
Definition: pedump.c:648
#define _countof(array)
Definition: sndvol32.h:70
RECT rcNormalPosition
Definition: winuser.h:3295
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define HWND_DESKTOP
Definition: winuser.h:1209

Referenced by wWinMain().

◆ GetOpenFileName()

BOOL CMainWindow::GetOpenFileName ( IN OUT LPWSTR  pszFile,
INT  cchMaxFile 
)

Definition at line 206 of file main.cpp.

207{
208 static OPENFILENAMEW ofn = { 0 };
209 static CStringW strFilter;
210
211 if (ofn.lStructSize == 0)
212 {
213 // The "All Files" item text
214 CStringW strAllPictureFiles;
215 strAllPictureFiles.LoadString(g_hinstExe, IDS_ALLPICTUREFILES);
216
217 // Get the import filter
218 CSimpleArray<GUID> aguidFileTypesI;
219 CImage::GetImporterFilterString(strFilter, aguidFileTypesI, strAllPictureFiles,
221 strFilter.Replace(L'|', UNICODE_NULL);
222
223 // Initializing the OPENFILENAME structure for GetOpenFileName
224 ZeroMemory(&ofn, sizeof(ofn));
225 ofn.lStructSize = sizeof(ofn);
228 ofn.lpstrFilter = strFilter;
230 ofn.lpstrDefExt = L"png";
231 }
232
233 ofn.lpstrFile = pszFile;
234 ofn.nMaxFile = cchMaxFile;
235 return ::GetOpenFileNameW(&ofn);
236}
#define IDS_ALLPICTUREFILES
Definition: resource.h:213
static HRESULT GetImporterFilterString(CSimpleString &strImporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultLoad, TCHAR chSeparator=TEXT('|'))
Definition: atlimage.h:794
@ excludeDefaultLoad
Definition: atlimage.h:702
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:886
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
OPENFILENAME ofn
Definition: sndrec32.cpp:56
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hwndOwner
Definition: commdlg.h:330
HINSTANCE hInstance
Definition: commdlg.h:331
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337

◆ GetSaveFileName()

BOOL CMainWindow::GetSaveFileName ( IN OUT LPWSTR  pszFile,
INT  cchMaxFile 
)

Definition at line 238 of file main.cpp.

239{
240 static OPENFILENAMEW sfn = { 0 };
241 static CStringW strFilter;
242
243 if (sfn.lStructSize == 0)
244 {
245 // Get the export filter
246 CSimpleArray<GUID> aguidFileTypesE;
247 CImage::GetExporterFilterString(strFilter, aguidFileTypesE, NULL,
249 strFilter.Replace(L'|', UNICODE_NULL);
250
251 // Initializing the OPENFILENAME structure for GetSaveFileName
252 ZeroMemory(&sfn, sizeof(sfn));
253 sfn.lStructSize = sizeof(sfn);
256 sfn.lpstrFilter = strFilter;
259 sfn.lpstrDefExt = L"png";
260
261 LPWSTR pchDotExt = PathFindExtensionW(pszFile);
262 if (*pchDotExt == UNICODE_NULL)
263 {
264 // Choose PNG
265 StringCchCatW(pszFile, cchMaxFile, L".png");
266 for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
267 {
268 if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
269 {
270 sfn.nFilterIndex = i + 1;
271 break;
272 }
273 }
274 }
275 }
276
277 sfn.lpstrFile = pszFile;
278 sfn.nMaxFile = cchMaxFile;
279 return ::GetSaveFileNameW(&sfn);
280}
static UINT_PTR APIENTRY OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: main.cpp:74
static HRESULT GetExporterFilterString(CSimpleString &strExporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultSave, TCHAR chSeparator=TEXT('|'))
Definition: atlimage.h:817
@ excludeDefaultSave
Definition: atlimage.h:703
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
OPENFILENAMEW sfn
Definition: eventvwr.c:101
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
HINSTANCE hInstance
Definition: commdlg.h:362
HWND hwndOwner
Definition: commdlg.h:361
DWORD Flags
Definition: commdlg.h:373
LPWSTR lpstrFile
Definition: commdlg.h:367
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
DWORD lStructSize
Definition: commdlg.h:360
DWORD nMaxFile
Definition: commdlg.h:368
LPCWSTR lpstrFilter
Definition: commdlg.h:363
DWORD nFilterIndex
Definition: commdlg.h:366
int32_t INT
Definition: typedefs.h:58
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetWndClassInfo()

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

Definition at line 669 of file gui.cpp.

670{
671 DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
672 static ATL::CWndClassInfo wc = {
673 {sizeof(WNDCLASSEX), csStyle, StartWindowProc, 0, 0, NULL,
674 LoadIconW(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCEW(IDI_MAIN)), LoadCursorW(NULL, IDC_ARROW),
676 NULL,
677 NULL,
678 IDC_ARROW,
679 TRUE,
680 0,
681 _T("")};
682 return wc;
683}
#define IDI_MAIN
Definition: resource.h:4
#define IDR_MAINMENU
Definition: resource.h:40
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1619
unsigned long DWORD
Definition: ntddk_ex.h:95
const TCHAR szWindowClass[]
Definition: magnifier.c:28
#define _T(x)
Definition: vfdio.h:22
#define CS_VREDRAW
Definition: winuser.h:658
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2136
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5719
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2106
#define COLOR_BTNFACE
Definition: winuser.h:928

◆ HandleTabOrder()

void CMainWindow::HandleTabOrder ( int  direction)

Definition at line 765 of file gui.cpp.

766{
767 ATL::CSimpleArray<HWND> TabOrderHwndList;
768
769 m_TreeView->AppendTabOrderWindow(direction, TabOrderHwndList);
770 m_ApplicationView->AppendTabOrderWindow(direction, TabOrderHwndList);
771
772 if (TabOrderHwndList.GetSize() == 0)
773 {
774 // in case the list is empty
775 return;
776 }
777
778 int FocusIndex;
779
780 if ((FocusIndex = TabOrderHwndList.Find(GetFocus())) == -1)
781 {
782 FocusIndex = 0; // focus the first window in the list
783 }
784 else
785 {
786 FocusIndex += direction;
787 FocusIndex +=
788 TabOrderHwndList.GetSize(); // FocusIndex might be negative. we don't want to mod a negative number
789 FocusIndex %= TabOrderHwndList.GetSize();
790 }
791
792 ::SetFocus(TabOrderHwndList[FocusIndex]);
793 return;
794}
int GetSize() const
Definition: atlsimpcoll.h:104
int Find(const T &t) const
Definition: atlsimpcoll.h:82
HWND SetFocus()
Definition: atlwin.h:1198
VOID AppendTabOrderWindow(int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
Definition: appview.cpp:1886
virtual VOID AppendTabOrderWindow(int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
Definition: rosui.h:546
HWND WINAPI GetFocus(void)
Definition: window.c:1893

Referenced by MainWindowLoop().

◆ InitCategoriesList()

VOID CMainWindow::InitCategoriesList ( )
private

Definition at line 95 of file gui.cpp.

96{
97 HTREEITEM hRootItemAvailable;
98
102
104
106 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_AUDIO, IDI_CAT_AUDIO);
107 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_VIDEO, IDI_CAT_VIDEO);
109 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_GAMES, IDI_CAT_GAMES);
112 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_DEVEL, IDI_CAT_DEVEL);
113 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_EDU, IDI_CAT_EDU);
117 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_TOOLS, IDI_CAT_TOOLS);
119 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_LIBS, IDI_CAT_LIBS);
121 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_OTHER, IDI_CAT_OTHER);
122
125 m_TreeView->Expand(hRootItemAvailable, TVE_EXPAND);
126 m_TreeView->SelectItem(bAppwizMode ? hRootItemInstalled : hRootItemAvailable);
127}
#define IDS_UPDATES
Definition: resource.h:100
#define IDS_CAT_TOOLS
Definition: resource.h:189
#define IDI_CAT_FINANCE
Definition: resource.h:25
#define IDS_CAT_VIDEO
Definition: resource.h:190
#define IDS_SELECTEDFORINST
Definition: resource.h:117
#define IDS_CAT_GRAPHICS
Definition: resource.h:183
#define IDI_SELECTEDFORINST
Definition: resource.h:16
#define IDI_CAT_EDU
Definition: resource.h:23
#define IDS_AVAILABLEFORINST
Definition: resource.h:99
#define IDI_CAT_INTERNET
Definition: resource.h:28
#define IDI_CAT_LIBS
Definition: resource.h:29
#define IDS_CAT_AUDIO
Definition: resource.h:176
#define IDS_CAT_SCIENCE
Definition: resource.h:188
#define IDS_CAT_ENGINEER
Definition: resource.h:180
#define IDI_CATEGORY
Definition: resource.h:13
#define IDI_CAT_OFFICE
Definition: resource.h:30
#define IDS_CAT_LIBS
Definition: resource.h:185
#define IDS_CAT_OTHER
Definition: resource.h:187
#define IDI_CAT_GRAPHICS
Definition: resource.h:27
#define IDS_CAT_DEVEL
Definition: resource.h:177
#define IDI_APPS
Definition: resource.h:11
#define IDS_CAT_THEMES
Definition: resource.h:191
#define IDI_CAT_SCIENCE
Definition: resource.h:32
#define IDI_CAT_OTHER
Definition: resource.h:31
#define IDS_CAT_GAMES
Definition: resource.h:182
#define IDS_CAT_EDU
Definition: resource.h:179
#define IDS_CAT_INTERNET
Definition: resource.h:184
#define IDI_APPUPD
Definition: resource.h:12
#define IDI_CAT_VIDEO
Definition: resource.h:34
#define IDS_CAT_DRIVERS
Definition: resource.h:178
#define IDI_CAT_DRIVERS
Definition: resource.h:22
#define IDI_CAT_DEVEL
Definition: resource.h:21
#define IDS_CAT_OFFICE
Definition: resource.h:186
#define IDS_CAT_FINANCE
Definition: resource.h:181
#define IDI_CAT_THEMES
Definition: resource.h:35
#define IDI_CAT_GAMES
Definition: resource.h:26
#define IDS_APPLICATIONS
Definition: resource.h:101
#define IDI_CAT_ENGINEER
Definition: resource.h:24
#define IDS_INSTALLED
Definition: resource.h:98
#define IDI_CAT_TOOLS
Definition: resource.h:33
#define IDI_CAT_AUDIO
Definition: resource.h:20
HTREEITEM hRootItemInstalled
Definition: gui.h:61
HTREEITEM AddCategory(HTREEITEM hRootItem, UINT TextIndex, UINT IconIndex)
Definition: gui.cpp:46
HIMAGELIST SetImageList()
Definition: gui.cpp:65
BOOL Expand(HTREEITEM item, DWORD action)
Definition: rosctrls.h:599
BOOL SelectItem(HTREEITEM item, DWORD action=TVGN_CARET)
Definition: rosctrls.h:604
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TVI_ROOT
Definition: commctrl.h:3368

Referenced by InitControls().

◆ InitControls()

BOOL CMainWindow::InitControls ( )
private

Definition at line 225 of file gui.cpp.

226{
227 if (CreateLayout())
228 {
231
232 return TRUE;
233 }
234
235 return FALSE;
236}
VOID UpdateStatusBarText()
Definition: gui.cpp:576
BOOL CreateLayout()
Definition: gui.cpp:181
VOID InitCategoriesList()
Definition: gui.cpp:95

Referenced by ProcessWindowMessage().

◆ InsertSelectionFromHBITMAP()

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

Definition at line 431 of file main.cpp.

432{
433 int width = GetDIBWidth(bitmap);
435 int curWidth = imageModel.GetWidth();
436 int curHeight = imageModel.GetHeight();
437
438 if (width > curWidth || height > curHeight)
439 {
440 BOOL shouldEnlarge = TRUE;
441
443 {
444 WCHAR programname[20];
445 WCHAR shouldEnlargePromptText[100];
446
447 ::LoadStringW(g_hinstExe, IDS_PROGRAMNAME, programname, _countof(programname));
448 ::LoadStringW(g_hinstExe, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, _countof(shouldEnlargePromptText));
449
450 switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
451 {
452 case IDYES:
453 break;
454 case IDNO:
455 shouldEnlarge = FALSE;
456 break;
457 case IDCANCEL:
458 return;
459 }
460 }
461
462 if (shouldEnlarge)
463 {
464 if (width > curWidth)
465 curWidth = width;
466
467 if (height > curHeight)
468 curHeight = height;
469
470 imageModel.Crop(curWidth, curHeight, 0, 0);
471 }
472 }
473
475
479}
BOOL g_askBeforeEnlarging
Definition: main.cpp:16
#define IDS_ENLARGEPROMPTTEXT
Definition: resource.h:221
int GetWidth() const
Definition: history.cpp:253
void NotifyImageChanged()
Definition: history.cpp:23
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:191
int GetHeight() const
Definition: history.cpp:258
void InsertFromHBITMAP(HBITMAP hbmColor, INT x=0, INT y=0, HBITMAP hbmMask=NULL)
void SetActiveTool(TOOLTYPE nActiveTool)
Definition: toolsmodel.cpp:144
int GetDIBHeight(HBITMAP hBitmap)
Definition: dib.cpp:144
int GetDIBWidth(HBITMAP hBitmap)
Definition: dib.cpp:136
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
Definition: uimain.c:89
@ TOOL_RECTSEL
Definition: toolsmodel.h:13
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by OnCommand().

◆ InstallApplication()

BOOL CMainWindow::InstallApplication ( CAppInfo Info)

Definition at line 733 of file gui.cpp.

734{
735 if (Info)
736 {
738 {
740 return TRUE;
741 }
742 }
743
744 return FALSE;
745}
VOID UpdateApplicationsList(AppsCategories EnumType, BOOL bReload=FALSE, BOOL bCheckAvailable=FALSE)
Definition: gui.cpp:604
BOOL DownloadApplication(CAppInfo *pAppInfo)
Definition: loaddlg.cpp:1128

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

◆ ItemCheckStateChanged()

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

Definition at line 705 of file gui.cpp.

706{
707 if (bUpdating)
708 return;
709
710 CAppInfo *Info = (CAppInfo *)CallbackParam;
711
712 if (bChecked)
713 {
715 }
716 else
717 {
719 ATLASSERT(Pos != NULL);
720
721 if (Pos != NULL)
722 {
724 }
725 }
726
728}
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
POSITION AddTail(INARGTYPE element)
Definition: atlcoll.h:626
void RemoveAt(_In_ POSITION pos)
Definition: atlcoll.h:748
ush Pos
Definition: deflate.h:92

Referenced by CApplicationView::ItemCheckStateChanged().

◆ LayoutCleanup()

VOID CMainWindow::LayoutCleanup ( )
private

Definition at line 215 of file gui.cpp.

216{
217 delete m_TreeView;
218 delete m_ApplicationView;
219 delete m_VSplitter;
220 delete m_StatusBar;
221 return;
222}

Referenced by ~CMainWindow().

◆ OnClose()

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

Definition at line 634 of file main.cpp.

635{
636 if (ConfirmSave())
637 {
639 }
640 return 0;
641}
BOOL DestroyWindow()
Definition: atlwin.h:462
BOOL ConfirmSave()
Definition: main.cpp:607

◆ OnCommand() [1/2]

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

Definition at line 819 of file main.cpp.

820{
821 // Disable commands while dragging mouse
823 {
824 ATLTRACE("locking!\n");
825 return 0;
826 }
827
829 switch (LOWORD(wParam))
830 {
831 case IDM_HELPINFO:
832 {
833 WCHAR infotitle[100], infotext[200];
834 ::LoadStringW(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle));
835 ::LoadStringW(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext));
836 ::ShellAboutW(m_hWnd, infotitle, infotext,
838 break;
839 }
841 DoHtmlHelpW(m_hWnd, L"%SystemRoot%\\Help\\mspaint.chm", HH_DISPLAY_TOPIC, 0);
842 break;
843 case IDM_FILEEXIT:
845 break;
846 case IDM_FILENEW:
847 if (ConfirmSave())
848 {
850 }
851 break;
852 case IDM_FILEOPEN:
853 {
854 WCHAR szFileName[MAX_LONG_PATH] = L"";
855 if (ConfirmSave() && GetOpenFileName(szFileName, _countof(szFileName)))
856 {
857 DoLoadImageFile(m_hWnd, szFileName, TRUE);
858 }
859 break;
860 }
861 case IDM_FILESAVE:
863 break;
864 case IDM_FILESAVEAS:
866 break;
868 // DUMMY: Shows the dialog only, no functionality
869 PAGESETUPDLG psd;
870 ZeroMemory(&psd, sizeof(psd));
871 psd.lStructSize = sizeof(psd);
872 psd.hwndOwner = m_hWnd;
873 PageSetupDlg(&psd);
874 break;
875 case IDM_FILEPRINT:
876 // TODO: Test whether it actually works
877 PRINTDLG pd;
878 ZeroMemory(&pd, sizeof(pd));
879 pd.lStructSize = sizeof(pd);
880 pd.hwndOwner = m_hWnd;
881 pd.hDevMode = NULL; // freed by user
882 pd.hDevNames = NULL; // freed by user
884 pd.nCopies = 1;
885 pd.nFromPage = 0xffff;
886 pd.nToPage = 0xffff;
887 pd.nMinPage = 1;
888 pd.nMaxPage = 0xffff;
889 if (PrintDlg(&pd) == TRUE)
890 {
892 DeleteDC(pd.hDC);
893 }
894 if (pd.hDevMode)
896 if (pd.hDevNames)
898 break;
899 case IDM_FILESEND:
902 {
904 }
905 break;
908 break;
911 break;
914 break;
915 case IDM_FILE1:
916 case IDM_FILE2:
917 case IDM_FILE3:
918 case IDM_FILE4:
919 {
921 if (ConfirmSave())
923 break;
924 }
925 case IDM_EDITUNDO:
926 if (textShown)
927 {
928 textEditWindow.PostMessage(WM_UNDO, 0, 0);
929 break;
930 }
933 break;
934 case IDM_EDITREDO:
935 if (textShown)
936 {
937 // There is no "WM_REDO" in EDIT control
938 break;
939 }
942 break;
943 case IDM_EDITCOPY:
944 if (textShown)
945 {
946 textEditWindow.SendMessage(WM_COPY);
947 break;
948 }
950 break;
951
953
955
956 {
958 HGLOBAL hGlobal = BitmapToClipboardDIB(hbmCopy);
959 if (hGlobal)
960 ::SetClipboardData(CF_DIB, hGlobal);
961 else
963 ::DeleteObject(hbmCopy);
964 }
965
967 break;
968 case IDM_EDITCUT:
969 if (textShown)
970 {
971 textEditWindow.SendMessage(WM_CUT);
972 break;
973 }
974 /* Copy */
976 /* Delete selection */
978 break;
979 case IDM_EDITPASTE:
980 if (textShown)
981 {
982 textEditWindow.SendMessage(WM_PASTE);
983 break;
984 }
985
986 if (!OpenClipboard())
987 break;
988
989 // In many cases, CF_ENHMETAFILE provides a better image than CF_DIB
991 {
992 HENHMETAFILE hEMF = (HENHMETAFILE)::GetClipboardData(CF_ENHMETAFILE);
993 if (hEMF)
994 {
995 HBITMAP hbm = BitmapFromHEMF(hEMF);
997 if (hbm)
998 {
1001 break;
1002 }
1003 }
1004 }
1005
1006 // In many cases, CF_DIB provides a better image than CF_BITMAP
1008 {
1010 if (hbm)
1011 {
1014 break;
1015 }
1016 }
1017
1018 // The last resort
1020 {
1022 if (hbm)
1023 {
1026 break;
1027 }
1028 }
1029
1030 // Failed to paste
1031 {
1032 CStringW strText, strTitle;
1033 strText.LoadString(IDS_CANTPASTE);
1034 strTitle.LoadString(IDS_PROGRAMNAME);
1035 MessageBox(strText, strTitle, MB_ICONINFORMATION);
1036 }
1037
1039 break;
1040 case IDM_CROPSELECTION:
1041 {
1043 if (hbmSelection)
1044 {
1045 imageModel.PushImageForUndo(hbmSelection);
1048 }
1049 break;
1050 }
1052 {
1053 if (textShown)
1054 {
1055 textEditWindow.SendMessage(WM_CLEAR);
1056 break;
1057 }
1058 switch (toolsModel.GetActiveTool())
1059 {
1060 case TOOL_FREESEL:
1061 case TOOL_RECTSEL:
1063 break;
1064
1065 case TOOL_TEXT:
1067 break;
1068 default:
1069 break;
1070 }
1071 break;
1072 }
1073 case IDM_EDITSELECTALL:
1074 {
1075 if (textShown)
1076 {
1077 textEditWindow.SendMessage(EM_SETSEL, 0, -1);
1078 break;
1079 }
1083 canvasWindow.Invalidate(TRUE);
1084 break;
1085 }
1086 case IDM_EDITCOPYTO:
1087 {
1088 WCHAR szFileName[MAX_LONG_PATH];
1089 ::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, szFileName, _countof(szFileName));
1090 if (GetSaveFileName(szFileName, _countof(szFileName)))
1091 {
1093 if (!hbmSelection)
1094 {
1096 break;
1097 }
1098 SaveDIBToFile(hbmSelection, szFileName, FALSE);
1099 DeleteObject(hbmSelection);
1100 }
1101 break;
1102 }
1103 case IDM_EDITPASTEFROM:
1104 {
1105 WCHAR szFileName[MAX_LONG_PATH] = L"";
1106 if (GetOpenFileName(szFileName, _countof(szFileName)))
1107 {
1108 HBITMAP hbmNew = DoLoadImageFile(m_hWnd, szFileName, FALSE);
1109 if (hbmNew)
1111 }
1112 break;
1113 }
1115 {
1116 COLORREF rgbColor = paletteModel.GetFgColor();
1117 if (ChooseColor(&rgbColor))
1118 paletteModel.SetFgColor(rgbColor);
1119 break;
1120 }
1123 break;
1126 break;
1128 {
1131 else
1133 break;
1134 }
1139 break;
1141 {
1142 CWaitCursor waitCursor;
1144 switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
1145 {
1146 case 1: /* flip horizontally */
1147 {
1150 else
1152 break;
1153 }
1154 case 2: /* flip vertically */
1155 {
1158 else
1160 break;
1161 }
1162 case 3: /* rotate 90 degrees */
1163 {
1166 else
1168 break;
1169 }
1170 case 4: /* rotate 180 degrees */
1171 {
1174 else
1176 break;
1177 }
1178 case 5: /* rotate 270 degrees */
1179 {
1182 else
1184 break;
1185 }
1186 }
1187 }
1188 break;
1190 {
1191 if (attributesDialog.DoModal(mainWindow.m_hWnd))
1192 {
1193 CWaitCursor waitCursor;
1195 {
1198 INT id = MessageBox(strText, strTitle, MB_ICONINFORMATION | MB_YESNOCANCEL);
1199 if (id != IDYES)
1200 break;
1201
1203 }
1204
1207 {
1209 }
1210 }
1211 break;
1212 }
1214 {
1215 if (stretchSkewDialog.DoModal(mainWindow.m_hWnd))
1216 {
1217 CWaitCursor waitCursor;
1219 {
1222 }
1223 else
1224 {
1227 }
1228 }
1229 break;
1230 }
1233 break;
1234 case IDM_IMAGECROP:
1235 {
1239 break;
1240 }
1241 case IDM_VIEWTOOLBOX:
1242 registrySettings.ShowToolBox = !toolBoxContainer.IsWindowVisible();
1245 break;
1247 registrySettings.ShowPalette = !paletteWindow.IsWindowVisible();
1250 break;
1251 case IDM_VIEWSTATUSBAR:
1255 break;
1256 case IDM_FORMATICONBAR:
1258 {
1259 if (!fontsDialog.IsWindow())
1260 {
1261 fontsDialog.Create(mainWindow);
1262 }
1265 fontsDialog.SendMessage(DM_REPOSITION, 0, 0);
1266 }
1267 break;
1268 case IDM_VIEWSHOWGRID:
1270 canvasWindow.Invalidate(FALSE);
1271 break;
1276 break;
1277
1278 case IDM_VIEWZOOM125:
1279 canvasWindow.zoomTo(125);
1280 break;
1281 case IDM_VIEWZOOM25:
1282 canvasWindow.zoomTo(250);
1283 break;
1284 case IDM_VIEWZOOM50:
1285 canvasWindow.zoomTo(500);
1286 break;
1287 case IDM_VIEWZOOM100:
1288 canvasWindow.zoomTo(1000);
1289 break;
1290 case IDM_VIEWZOOM200:
1291 canvasWindow.zoomTo(2000);
1292 break;
1293 case IDM_VIEWZOOM400:
1294 canvasWindow.zoomTo(4000);
1295 break;
1296 case IDM_VIEWZOOM800:
1297 canvasWindow.zoomTo(8000);
1298 break;
1299
1300 case IDM_VIEWFULLSCREEN:
1301 // Create and show the fullscreen window
1302 fullscreenWindow.DoCreate();
1304 break;
1305
1306 case IDM_CTRL_PLUS:
1308 break;
1309 case IDM_CTRL_MINUS:
1311 break;
1312 }
1313 return 0;
1314}
#define ATLTRACE(format,...)
Definition: atltrace.h:269
#define IDI_APPICON
Definition: resource.h:166
VOID ShowError(DWORD dwLastError)
Definition: progress.c:29
CAttributesDialog attributesDialog
Definition: dialogs.cpp:14
CFontsDialog fontsDialog
Definition: dialogs.cpp:16
CStretchSkewDialog stretchSkewDialog
Definition: dialogs.cpp:15
CMirrorRotateDialog mirrorRotateDialog
Definition: dialogs.cpp:13
BOOL g_showGrid
Definition: main.cpp:22
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
Definition: main.cpp:99
CMainWindow mainWindow
Definition: main.cpp:25
void ShowOutOfMemory(void)
Definition: main.cpp:34
static HWND DoHtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData)
Definition: main.cpp:321
#define MAX_LONG_PATH
Definition: precomp.h:47
#define IDM_EDITSELECTALL
Definition: resource.h:67
#define IDM_VIEWSTATUSBAR
Definition: resource.h:73
#define IDS_INFOTEXT
Definition: resource.h:189
#define IDS_INFOTITLE
Definition: resource.h:188
#define IDM_EDITCOPYTO
Definition: resource.h:68
#define IDM_FILESEND
Definition: resource.h:46
#define IDM_EDITDELETESELECTION
Definition: resource.h:65
#define IDM_FILEEXIT
Definition: resource.h:58
#define IDM_COLORSOLDPALETTE
Definition: resource.h:96
#define IDM_FILEPAGESETUP
Definition: resource.h:43
#define IDM_COLORSEDITPALETTE
Definition: resource.h:94
#define IDM_EDITCUT
Definition: resource.h:62
#define IDM_IMAGECROP
Definition: resource.h:88
#define IDM_VIEWZOOM800
Definition: resource.h:81
#define IDM_COLORSMODERNPALETTE
Definition: resource.h:95
#define IDM_FILE1
Definition: resource.h:53
#define IDM_FILESAVE
Definition: resource.h:37
#define IDM_EDITPASTEFROM
Definition: resource.h:69
#define IDM_EDITUNDO
Definition: resource.h:60
#define IDM_FILESAVEAS
Definition: resource.h:38
#define IDM_VIEWSHOWMINIATURE
Definition: resource.h:84
#define IDM_FILEASWALLPAPERPLANE
Definition: resource.h:48
#define IDM_CTRL_MINUS
Definition: resource.h:107
#define IDM_EDITCOPY
Definition: resource.h:63
#define IDM_FORMATICONBAR
Definition: resource.h:74
#define IDM_FILE2
Definition: resource.h:54
#define IDM_FILE4
Definition: resource.h:56
#define IDM_EDITREDO
Definition: resource.h:61
#define IDM_VIEWZOOM25
Definition: resource.h:76
#define IDS_CANTPASTE
Definition: resource.h:228
#define IDM_IMAGEINVERTCOLORS
Definition: resource.h:89
#define IDM_VIEWTOOLBOX
Definition: resource.h:71
#define IDM_IMAGEATTRIBUTES
Definition: resource.h:90
#define IDM_HELPINFO
Definition: resource.h:99
#define IDS_LOSECOLOR
Definition: resource.h:231
#define IDM_VIEWFULLSCREEN
Definition: resource.h:82
#define IDM_IMAGESTRETCHSKEW
Definition: resource.h:87
#define IDM_EDITPASTE
Definition: resource.h:64
#define IDM_FILEASWALLPAPERCENTERED
Definition: resource.h:49
#define IDM_HELPHELPTOPICS
Definition: resource.h:98
#define IDM_VIEWSHOWGRID
Definition: resource.h:83
#define IDM_IMAGEDRAWOPAQUE
Definition: resource.h:92
#define IDM_VIEWZOOM200
Definition: resource.h:79
#define IDM_FILE3
Definition: resource.h:55
#define IDM_FILENEW
Definition: resource.h:35
#define IDM_VIEWCOLORPALETTE
Definition: resource.h:72
#define IDS_CANTSENDMAIL
Definition: resource.h:230
#define IDM_VIEWZOOM400
Definition: resource.h:80
#define IDM_VIEWZOOM50
Definition: resource.h:77
#define IDM_FILEPRINT
Definition: resource.h:44
#define IDM_IMAGEDELETEIMAGE
Definition: resource.h:91
#define IDM_CROPSELECTION
Definition: resource.h:109
#define IDM_VIEWZOOM125
Definition: resource.h:75
#define ID_RECTSEL
Definition: resource.h:113
#define IDM_VIEWZOOM100
Definition: resource.h:78
#define IDM_IMAGEROTATEMIRROR
Definition: resource.h:86
#define IDM_CTRL_PLUS
Definition: resource.h:106
#define IDM_FILEOPEN
Definition: resource.h:36
#define IDM_FILEASWALLPAPERSTRETCHED
Definition: resource.h:50
BOOL OpenClipboard()
Definition: atlwin.h:1038
BOOL m_bBlackAndWhite
Definition: dialogs.h:67
BOOL m_drawing
Definition: canvas.h:43
VOID updateScrollPos(INT x=0, INT y=0)
Definition: canvas.cpp:244
VOID zoomTo(INT newZoom, LONG left=0, LONG top=0)
Definition: canvas.cpp:107
void InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
Definition: main.cpp:431
void alignChildrenToMainWindow()
Definition: main.cpp:341
HWND DoCreate(HWND hwndParent)
Definition: miniature.cpp:27
POINT percentage
Definition: dialogs.h:88
void FlipVertically()
Definition: history.cpp:284
void FlipHorizontally()
Definition: history.cpp:276
void PushBlackAndWhite()
Definition: history.cpp:336
void InvertColors()
Definition: history.cpp:263
void Redo(void)
Definition: history.cpp:96
void PushImageForUndo()
Definition: history.cpp:127
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:74
void RotateNTimes90Degrees(int iN)
Definition: history.cpp:292
HDC GetDC()
Definition: history.cpp:271
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
Definition: history.cpp:229
BOOL IsBlackAndWhite()
Definition: history.cpp:328
COLORREF GetBgColor() const
void SetFgColor(COLORREF newColor)
void SelectPalette(PAL_TYPE nPalette)
COLORREF GetFgColor() const
DWORD ShowTextTool
Definition: registry.h:41
DWORD ShowToolBox
Definition: registry.h:44
DWORD ShowPalette
Definition: registry.h:43
DWORD ShowThumbnail
Definition: registry.h:22
DWORD ShowStatusBar
Definition: registry.h:42
CStringW strFiles[MAX_RECENT_FILES]
Definition: registry.h:31
static void SetWallpaper(LPCWSTR szFileName, WallpaperStyle style)
Definition: registry.cpp:39
void RotateNTimes90Degrees(int iN)
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY)
HBITMAP GetSelectionContents()
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:249
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:254
void SpecialTweak(BOOL bMinus)
Definition: mouse.cpp:1196
void selectAll()
Definition: toolsmodel.cpp:307
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define GetSaveFileName
Definition: commdlg.h:666
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
#define PrintDlg
Definition: commdlg.h:668
#define PD_RETURNDC
Definition: commdlg.h:155
#define PageSetupDlg
Definition: commdlg.h:667
#define GetOpenFileName
Definition: commdlg.h:665
HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
Definition: dib.cpp:226
BOOL SaveDIBToFile(HBITMAP hBitmap, LPCWSTR FileName, BOOL fIsMainFile, REFGUID guidFileType)
Definition: dib.cpp:151
HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap)
Definition: dib.cpp:447
HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF)
Definition: dib.cpp:557
HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal)
Definition: dib.cpp:510
HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
Definition: dib.cpp:256
static VOID 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:57
CFullscreenWindow fullscreenWindow
Definition: fullscreen.cpp:10
pKey DeleteObject()
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define HH_DISPLAY_TOPIC
Definition: htmlhelp.h:22
CMiniatureWindow miniature
Definition: miniature.cpp:12
static HBITMAP
Definition: button.c:44
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
PaletteModel paletteModel
@ PAL_MODERN
Definition: palettemodel.h:14
@ PAL_OLDTYPE
Definition: palettemodel.h:15
#define LOWORD(l)
Definition: pedump.c:82
#define TB_CHECKBUTTON
Definition: commctrl.h:1043
#define TOOLBARCLASSNAME
Definition: commctrl.h:946
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
WORD nMaxPage
Definition: commdlg.h:474
HDC hDC
Definition: commdlg.h:469
DWORD Flags
Definition: commdlg.h:470
WORD nCopies
Definition: commdlg.h:475
WORD nFromPage
Definition: commdlg.h:471
HGLOBAL hDevMode
Definition: commdlg.h:467
WORD nToPage
Definition: commdlg.h:472
WORD nMinPage
Definition: commdlg.h:473
HGLOBAL hDevNames
Definition: commdlg.h:468
HWND hwndOwner
Definition: commdlg.h:466
DWORD lStructSize
Definition: commdlg.h:465
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
DWORD lStructSize
Definition: commdlg.h:433
HWND hwndOwner
Definition: commdlg.h:434
@ TOOL_FREESEL
Definition: toolsmodel.h:12
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
#define SRCCOPY
Definition: wingdi.h:333
BOOL WINAPI DeleteDC(_In_ HDC)
#define SW_SHOWMAXIMIZED
Definition: winuser.h:773
#define SW_HIDE
Definition: winuser.h:768
#define WM_CLOSE
Definition: winuser.h:1621
#define WM_PASTE
Definition: winuser.h:1863
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1740
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define SW_SHOWNOACTIVATE
Definition: winuser.h:774
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_CUT
Definition: winuser.h:1861
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define FindWindowEx
Definition: winuser.h:5778
#define WM_UNDO
Definition: winuser.h:1865
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define SendMessage
Definition: winuser.h:5843
#define EM_SETSEL
Definition: winuser.h:2018
#define MB_ICONINFORMATION
Definition: winuser.h:802
#define WM_COPY
Definition: winuser.h:1862
#define SW_SHOW
Definition: winuser.h:775
#define WM_CLEAR
Definition: winuser.h:1864
#define DM_REPOSITION
Definition: winuser.h:2100
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ProcessWindowMessage().

◆ OnCommand() [2/2]

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

Definition at line 488 of file gui.cpp.

489{
490 const BOOL bReload = TRUE;
491 WORD wCommand = LOWORD(wParam);
492
493 if (!lParam)
494 {
495 switch (wCommand)
496 {
497 case ID_SETTINGS:
499 break;
500
501 case ID_EXIT:
502 PostMessageW(WM_CLOSE, 0, 0);
503 break;
504
505 case ID_SEARCH:
507 break;
508
509 case ID_INSTALL:
511 {
512 if (!m_Selected.IsEmpty())
513 {
515 {
518 }
519 }
520 else
521 {
523 if (App)
524 {
526 }
527 }
528 }
529 break;
530
531 case ID_UNINSTALL:
534 break;
535
536 case ID_MODIFY:
539 break;
540
541 case ID_REGREMOVE:
544 break;
545
546 case ID_REFRESH:
548 break;
549
550 case ID_RESETDB:
553 break;
554
555 case ID_HELP:
556 MessageBoxW(L"Help not implemented yet", NULL, MB_OK);
557 break;
558
559 case ID_ABOUT:
560 ShowAboutDlg();
561 break;
562
563 case ID_CHECK_ALL:
565 break;
566
570 break;
571 }
572 }
573}
BOOL IsAvailableEnum(INT x)
Definition: appinfo.h:55
#define ID_EXIT
Definition: resource.h:10
#define ID_HELP
Definition: resource.h:26
#define ID_REFRESH
Definition: resource.h:16
#define ID_REGREMOVE
Definition: resource.h:83
#define ID_UNINSTALL
Definition: resource.h:75
#define ID_SEARCH
Definition: resource.h:86
#define ID_CHECK_ALL
Definition: resource.h:85
#define ID_ACTIVATE_APPWIZ
Definition: resource.h:89
#define ID_MODIFY
Definition: resource.h:78
#define ID_RESETDB
Definition: resource.h:84
#define ID_INSTALL
Definition: resource.h:74
#define ID_SETTINGS
Definition: resource.h:81
#define ID_ABOUT
Definition: charmap.c:17
bool IsEmpty() const
Definition: atlcoll.h:545
void RemoveAll()
Definition: atlcoll.h:727
PVOID GetFocusedItemData()
Definition: appview.cpp:1874
void SetFocusOnSearchBar()
Definition: appview.cpp:1612
BOOL RemoveSelectedAppFromRegistry()
Definition: gui.cpp:263
BOOL InstallApplication(CAppInfo *Info)
Definition: gui.cpp:733
VOID ShowAboutDlg()
Definition: gui.cpp:476
BOOL UninstallSelectedApp(BOOL bModify)
Definition: gui.cpp:284
unsigned short WORD
Definition: ntddk_ex.h:93
VOID CreateSettingsDlg(HWND hwnd)
BOOL DownloadListOfApplications(const CAtlList< CAppInfo * > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1109
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:790

◆ OnCreate()

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

Definition at line 544 of file main.cpp.

545{
546 // Loading and setting the window menu from resource
549
550 // Create the status bar
555
556 // Create the tool box
558
559 // Create the palette window
560 RECT rcEmpty = { 0, 0, 0, 0 }; // Rely on WM_SIZE
562 paletteWindow.Create(m_hWnd, rcEmpty, NULL, style, WS_EX_STATICEDGE);
563
564 // Create the canvas
566 canvasWindow.Create(m_hWnd, rcEmpty, NULL, style, WS_EX_CLIENTEDGE);
567
568 // Create and show the miniature if necessary
570 {
572 miniature.ShowWindow(SW_SHOWNOACTIVATE);
573 }
574
575 // Set icon
578
579 return 0;
580}
Arabic default style
Definition: afstyles.h:94
#define ID_MENU
Definition: resource.h:32
BOOL DoCreate(HWND hwndParent)
Definition: toolbox.cpp:80
#define WS_CHILD
Definition: pedump.c:617
#define WS_GROUP
Definition: pedump.c:633
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_HSCROLL
Definition: pedump.c:628
#define SB_SETMINHEIGHT
Definition: commctrl.h:1957
#define SBARS_SIZEGRIP
Definition: commctrl.h:1923
#define STATUSCLASSNAME
Definition: commctrl.h:1939
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
LONG_PTR LPARAM
Definition: windef.h:208
#define WS_EX_STATICEDGE
Definition: winuser.h:403
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)

◆ OnDestroy()

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

Definition at line 582 of file main.cpp.

583{
586
588
589 if (s_hHHCTRL_OCX)
590 {
594 }
595
596 SetMenu(NULL);
597 if (m_hMenu)
598 {
600 m_hMenu = NULL;
601 }
602
603 PostQuitMessage(0); /* send a WM_QUIT to the message queue */
604 return 0;
605}
static HINSTANCE s_hHHCTRL_OCX
Definition: main.cpp:29
static FN_HtmlHelpW s_pHtmlHelpW
Definition: main.cpp:30
#define FreeLibrary(x)
Definition: compat.h:748
#define HH_CLOSE_ALL
Definition: htmlhelp.h:41
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI DestroyMenu(_In_ HMENU)
struct _WINDOWPLACEMENT WINDOWPLACEMENT

◆ OnDropFiles()

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

Definition at line 531 of file main.cpp.

532{
533 WCHAR droppedfile[MAX_PATH];
534
535 HDROP hDrop = (HDROP)wParam;
536 DragQueryFile(hDrop, 0, droppedfile, _countof(droppedfile));
537 DragFinish(hDrop);
538
539 ConfirmSave() && DoLoadImageFile(m_hWnd, droppedfile, TRUE);
540
541 return 0;
542}
#define MAX_PATH
Definition: compat.h:34
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:538
#define DragQueryFile
Definition: shellapi.h:686

◆ OnGetMinMaxInfo()

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

Definition at line 779 of file main.cpp.

780{
782 mm->ptMinTrackSize = { 330, 360 };
783 return 0;
784}
POINT ptMinTrackSize
Definition: winuser.h:3630

◆ OnInitMenuPopup()

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

Definition at line 702 of file main.cpp.

703{
704 HMENU menu = (HMENU)wParam;
705 BOOL trueSelection = (selectionModel.m_bShow && toolsModel.IsSelection());
707 DWORD dwStart = 0, dwEnd = 0;
708 if (textShown)
709 textEditWindow.SendMessage(EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
710 BOOL hasTextSel = (dwStart < dwEnd);
711
712 //
713 // File menu
714 //
715 if (::GetSubMenu(GetMenu(), 0) == menu)
716 {
717 ProcessFileMenu(menu);
718 }
719
720 //
721 // Edit menu
722 //
725 EnableMenuItem(menu, IDM_EDITCUT, ENABLED_IF(textShown ? hasTextSel : trueSelection));
726 EnableMenuItem(menu, IDM_EDITCOPY, ENABLED_IF(textShown ? hasTextSel : trueSelection));
728 ENABLED_IF(textShown ? hasTextSel : trueSelection));
730 EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
732 EnableMenuItem(menu, IDM_CROPSELECTION, ENABLED_IF(trueSelection));
733
734 //
735 // View menu
736 //
751
752 //
753 // Image menu
754 //
758
759 //
760 // Palette menu
761 //
764 return 0;
765}
#define CHECKED_IF(bChecked)
Definition: precomp.h:80
#define ENABLED_IF(bEnabled)
Definition: precomp.h:84
#define IDM_EDITINVERTSELECTION
Definition: resource.h:66
HMENU GetMenu() const
Definition: atlwin.h:682
void ProcessFileMenu(HMENU hPopupMenu)
Definition: main.cpp:643
BOOL CanUndo() const
Definition: main.cpp:676
BOOL CanRedo() const
Definition: main.cpp:685
BOOL CanPaste() const
Definition: main.cpp:692
PAL_TYPE SelectedPalette()
int GetZoom() const
Definition: toolsmodel.cpp:261
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETSEL
Definition: winuser.h:1997
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)

◆ OnKeyDown()

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

Definition at line 786 of file main.cpp.

787{
788 switch (wParam)
789 {
790 case VK_ESCAPE:
791 canvasWindow.PostMessage(nMsg, wParam, lParam);
792 break;
793 case VK_LEFT:
795 break;
796 case VK_RIGHT:
798 break;
799 case VK_UP:
801 break;
802 case VK_DOWN:
804 break;
805 default:
806 break;
807 }
808 return 0;
809}
void moveSelection(INT xDelta, INT yDelta)
#define VK_UP
Definition: winuser.h:2225
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define VK_ESCAPE
Definition: winuser.h:2214

◆ OnMouseWheel()

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

Definition at line 481 of file main.cpp.

482{
483 INT zDelta = (SHORT)HIWORD(wParam);
484
485 if (::GetKeyState(VK_CONTROL) < 0) // Ctrl+Wheel
486 {
487 if (zDelta < 0)
488 {
491 }
492 else if (zDelta > 0)
493 {
496 }
497 }
498 else // Wheel only
499 {
500 UINT nCount = 3;
502 {
503#ifndef SPI_GETWHEELSCROLLCHARS
504 #define SPI_GETWHEELSCROLLCHARS 0x006C // Needed for pre-NT6 PSDK
505#endif
507 for (UINT i = 0; i < nCount; ++i)
508 {
509 if (zDelta < 0)
511 else if (zDelta > 0)
513 }
514 }
515 else
516 {
517 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &nCount, 0);
518 for (UINT i = 0; i < nCount; ++i)
519 {
520 if (zDelta < 0)
522 else if (zDelta > 0)
524 }
525 }
526 }
527
528 return 0;
529}
#define SPI_GETWHEELSCROLLCHARS
#define MAX_ZOOM
Definition: precomp.h:45
#define MIN_ZOOM
Definition: precomp.h:44
short SHORT
Definition: pedump.c:59
#define HIWORD(l)
Definition: typedefs.h:247
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1743
#define WM_VSCROLL
Definition: winuser.h:1744
#define VK_CONTROL
Definition: winuser.h:2203
#define SB_LINEDOWN
Definition: winuser.h:565
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define VK_SHIFT
Definition: winuser.h:2202
SHORT WINAPI GetAsyncKeyState(_In_ int)
SHORT WINAPI GetKeyState(_In_ int)

◆ OnSize() [1/2]

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

Definition at line 239 of file gui.cpp.

240{
241 if (wParam == SIZE_MINIMIZED)
242 return;
243
244 /* Size status bar */
245 m_StatusBar->SendMessage(WM_SIZE, 0, 0);
246
247 RECT r = {0, 0, LOWORD(lParam), HIWORD(lParam)};
248 HDWP hdwp = NULL;
250
252 if (hdwp)
253 {
254 hdwp = m_ClientPanel->OnParentSize(r, hdwp);
255 if (hdwp)
256 {
257 EndDeferWindowPos(hdwp);
258 }
259 }
260}
virtual DWORD_PTR CountSizableChildren()
Definition: rosui.h:439
virtual HDWP OnParentSize(RECT parentRect, HDWP hDwp)
Definition: rosui.h:454
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define SIZE_MINIMIZED
Definition: winuser.h:2506

◆ OnSize() [2/2]

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

Definition at line 767 of file main.cpp.

768{
769 int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
771 {
774 }
776 return 0;
777}
BOOL IsWindow() const
Definition: atlwin.h:947
#define SB_SETPARTS
Definition: commctrl.h:1954
#define test
Definition: rosglue.h:37

Referenced by ProcessWindowMessage().

◆ OnSysColorChange()

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

Definition at line 811 of file main.cpp.

812{
813 /* Redirect message to common controls */
815 ::SendMessageW(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
816 return 0;
817}
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626

◆ ProcessFileMenu()

void CMainWindow::ProcessFileMenu ( HMENU  hPopupMenu)
private

Definition at line 643 of file main.cpp.

644{
645 for (INT iItem = 0; iItem < MAX_RECENT_FILES; ++iItem)
646 RemoveMenu(hPopupMenu, IDM_FILE1 + iItem, MF_BYCOMMAND);
647
649 return;
650
652
653 INT cMenuItems = GetMenuItemCount(hPopupMenu);
654
655 for (INT iItem = 0; iItem < MAX_RECENT_FILES; ++iItem)
656 {
657 CStringW& strFile = registrySettings.strFiles[iItem];
658 if (strFile.IsEmpty())
659 break;
660
661 // Condense the lengthy pathname by using '...'
662#define MAX_RECENT_PATHNAME_DISPLAY 30
663 CPath pathFile(strFile);
664 pathFile.CompactPathEx(MAX_RECENT_PATHNAME_DISPLAY);
666
667 // Add an accelerator (by '&') to the item number for quick access
668 WCHAR szText[4 + MAX_RECENT_PATHNAME_DISPLAY + 1];
669 StringCchPrintfW(szText, _countof(szText), L"&%u %s", iItem + 1, (LPCWSTR)pathFile);
670
671 INT iMenuItem = (cMenuItems - 2) + iItem;
672 InsertMenu(hPopupMenu, iMenuItem, MF_BYPOSITION | MF_STRING, IDM_FILE1 + iItem, szText);
673 }
674}
#define MAX_RECENT_PATHNAME_DISPLAY
#define MAX_RECENT_FILES
Definition: registry.h:10
#define IDM_FILEMOSTRECENTLYUSEDFILE
Definition: resource.h:52
#define assert(x)
Definition: debug.h:53
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define MF_BYCOMMAND
Definition: winuser.h:202
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define MF_STRING
Definition: winuser.h:138
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define InsertMenu
Definition: winuser.h:5803
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by OnInitMenuPopup().

◆ ProcessWindowMessage()

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

Implements ATL::CMessageMap.

Definition at line 307 of file gui.cpp.

308{
309 theResult = 0;
310 switch (Msg)
311 {
312 case WM_CREATE:
313 if (!InitControls())
315 break;
316
317 case WM_DESTROY:
318 {
321
322 FreeLogs();
323
324 delete m_ClientPanel;
325
327 return 0;
328 }
329
330 case WM_COMMAND:
332 break;
333
334 case WM_NOTIFY:
335 {
337
338 switch (data->code)
339 {
340 case TVN_SELCHANGED:
341 {
342 if (data->hwndFrom == m_TreeView->m_hWnd)
343 {
344 switch (((LPNMTREEVIEW)lParam)->itemNew.lParam)
345 {
346 case IDS_INSTALLED:
348 break;
349
350 case IDS_APPLICATIONS:
352 break;
353
354 case IDS_UPDATES:
356 break;
357
360 break;
361
362 case IDS_CAT_AUDIO:
364 break;
365
366 case IDS_CAT_DEVEL:
368 break;
369
370 case IDS_CAT_DRIVERS:
372 break;
373
374 case IDS_CAT_EDU:
376 break;
377
378 case IDS_CAT_ENGINEER:
380 break;
381
382 case IDS_CAT_FINANCE:
384 break;
385
386 case IDS_CAT_GAMES:
388 break;
389
390 case IDS_CAT_GRAPHICS:
392 break;
393
394 case IDS_CAT_INTERNET:
396 break;
397
398 case IDS_CAT_LIBS:
400 break;
401
402 case IDS_CAT_OFFICE:
404 break;
405
406 case IDS_CAT_OTHER:
408 break;
409
410 case IDS_CAT_SCIENCE:
412 break;
413
414 case IDS_CAT_TOOLS:
416 break;
417
418 case IDS_CAT_VIDEO:
420 break;
421
422 case IDS_CAT_THEMES:
424 break;
425
428 break;
429 }
430 }
431 }
432 break;
433 }
434 }
435 break;
436
437 case WM_SIZE:
439 break;
440
441 case WM_SIZING:
442 {
443 LPRECT pRect = (LPRECT)lParam;
444
445 if (pRect->right - pRect->left < 565)
446 pRect->right = pRect->left + 565;
447
448 if (pRect->bottom - pRect->top < 300)
449 pRect->bottom = pRect->top + 300;
450
451 return TRUE;
452 }
453
455 {
456 /* Forward WM_SYSCOLORCHANGE to common controls */
458 m_TreeView->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
459 }
460 break;
461
462 case WM_TIMER:
463 if (wParam == SEARCH_TIMER_ID)
464 {
466
468 }
469 break;
470 }
471
472 return FALSE;
473}
@ ENUM_CAT_LIBS
Definition: appinfo.h:40
@ ENUM_CAT_ENGINEER
Definition: appinfo.h:35
@ ENUM_CAT_VIDEO
Definition: appinfo.h:28
@ ENUM_CAT_FINANCE
Definition: appinfo.h:36
@ ENUM_CAT_OFFICE
Definition: appinfo.h:32
@ ENUM_CAT_EDU
Definition: appinfo.h:34
@ ENUM_CAT_AUDIO
Definition: appinfo.h:27
@ ENUM_CAT_TOOLS
Definition: appinfo.h:38
@ ENUM_UPDATES
Definition: appinfo.h:46
@ ENUM_CAT_SELECTED
Definition: appinfo.h:43
@ ENUM_ALL_AVAILABLE
Definition: appinfo.h:26
@ ENUM_CAT_INTERNET
Definition: appinfo.h:31
@ ENUM_CAT_GAMES
Definition: appinfo.h:30
@ ENUM_CAT_THEMES
Definition: appinfo.h:41
@ ENUM_INSTALLED_APPLICATIONS
Definition: appinfo.h:45
@ ENUM_CAT_GRAPHICS
Definition: appinfo.h:29
@ ENUM_CAT_DEVEL
Definition: appinfo.h:33
@ ENUM_CAT_DRIVERS
Definition: appinfo.h:39
@ ENUM_CAT_SCIENCE
Definition: appinfo.h:37
@ ENUM_CAT_OTHER
Definition: appinfo.h:42
void SaveSettings(void)
Definition: settings.c:115
#define SEARCH_TIMER_ID
Definition: gui.h:21
VOID FreeLogs()
Definition: misc.cpp:215
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:767
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:819
BOOL InitControls()
Definition: gui.cpp:225
struct @1636 Msg[]
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define TVN_SELCHANGED
Definition: commctrl.h:3735
#define LPNMTREEVIEW
Definition: commctrl.h:3643
#define WM_NOTIFY
Definition: richedit.h:61
#define LPRECT
Definition: precomp.h:28
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WM_CREATE
Definition: winuser.h:1608
#define WM_TIMER
Definition: winuser.h:1742
struct tagNMHDR * LPNMHDR
#define WM_SIZING
Definition: winuser.h:1807
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

◆ RemoveSelectedAppFromRegistry()

BOOL CMainWindow::RemoveSelectedAppFromRegistry ( )
private

Definition at line 263 of file gui.cpp.

264{
266 return FALSE;
267
268 CStringW szMsgText, szMsgTitle;
269
270 if (!szMsgText.LoadStringW(IDS_APP_REG_REMOVE) || !szMsgTitle.LoadStringW(IDS_INFORMATION))
271 return FALSE;
272
274 if (!InstalledApp)
275 return FALSE;
276
277 if (MessageBoxW(szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
278 return m_Db->RemoveInstalledAppFromRegistry(InstalledApp) == ERROR_SUCCESS;
279
280 return FALSE;
281}
BOOL IsInstalledEnum(INT x)
Definition: appinfo.h:61
#define IDS_INFORMATION
Definition: resource.h:106
#define IDS_APP_REG_REMOVE
Definition: resource.h:105
static DWORD RemoveInstalledAppFromRegistry(const CAppInfo *Info)
Definition: appdb.cpp:315
#define ERROR_SUCCESS
Definition: deptool.c:10
#define MB_YESNO
Definition: winuser.h:817

Referenced by OnCommand().

◆ saveImage()

void CMainWindow::saveImage ( BOOL  overwrite)
private

Definition at line 407 of file main.cpp.

408{
410
411 // Is the extension not supported?
413 if (pchDotExt && *pchDotExt && !CImageDx::IsExtensionSupported(pchDotExt))
414 {
415 // Remove the extension
417 // No overwrite
418 overwrite = FALSE;
419 }
420
421 if (g_isAFile && overwrite)
422 {
424 }
426 {
428 }
429}
BOOL g_isAFile
Definition: main.cpp:20
static BOOL IsExtensionSupported(PWCHAR pchDotExt)
Definition: atlimagedx.h:165
void SaveImage(LPCWSTR lpFileName)
Definition: history.cpp:219
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823
uint16_t * PWCHAR
Definition: typedefs.h:56

Referenced by ConfirmSave(), and OnCommand().

◆ SearchTextChanged()

BOOL CMainWindow::SearchTextChanged ( CStringW SearchText)

Definition at line 748 of file gui.cpp.

749{
750 if (szSearchPattern == SearchText)
751 {
752 return FALSE;
753 }
754
755 szSearchPattern = SearchText;
756
757 DWORD dwDelay = 0;
758 SystemParametersInfoW(SPI_GETMENUSHOWDELAY, 0, &dwDelay, 0);
759 SetTimer(SEARCH_TIMER_ID, dwDelay);
760
761 return TRUE;
762}
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)

Referenced by CApplicationView::OnCommand().

◆ ShowAboutDlg()

VOID CMainWindow::ShowAboutDlg ( )
private

Definition at line 476 of file gui.cpp.

477{
478 CStringW szApp;
479 CStringW szAuthors;
480
481 szApp.LoadStringW(IDS_APPTITLE);
482 szAuthors.LoadStringW(IDS_APP_AUTHORS);
483 ShellAboutW(m_hWnd, szApp, szAuthors,
485}
#define IDS_APP_AUTHORS
Definition: resource.h:120
HINSTANCE hInst
Definition: dxdiag.c:13

Referenced by OnCommand().

◆ TrackPopupMenu()

VOID CMainWindow::TrackPopupMenu ( POINT  ptScreen,
INT  iSubMenu 
)

Definition at line 1316 of file main.cpp.

1317{
1319 HMENU hSubMenu = ::GetSubMenu(hMenu, iSubMenu);
1320
1323 ptScreen.x, ptScreen.y, 0, m_hWnd, NULL);
1325 if (id != 0)
1327
1328 ::DestroyMenu(hMenu);
1329}
#define ID_POPUPMENU
Definition: resource.h:33
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu)
Definition: main.cpp:1316
int32_t INT_PTR
Definition: typedefs.h:64
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define WM_NULL
Definition: winuser.h:1607
#define PostMessage
Definition: winuser.h:5832
#define TPM_RETURNCMD
Definition: winuser.h:2387

Referenced by SelectionBaseTool::OnButtonDown(), and TrackPopupMenu().

◆ UninstallSelectedApp()

BOOL CMainWindow::UninstallSelectedApp ( BOOL  bModify)
private

Definition at line 284 of file gui.cpp.

285{
287 return FALSE;
288
290 if (!InstalledApp)
291 return FALSE;
292
293 return InstalledApp->UninstallApplication(bModify ? UCF_MODIFY : UCF_NONE);
294}
@ UCF_NONE
Definition: appinfo.h:68
@ UCF_MODIFY
Definition: appinfo.h:69
virtual BOOL UninstallApplication(UninstallCommandFlags Flags)=0

Referenced by OnCommand().

◆ UpdateApplicationsList()

VOID CMainWindow::UpdateApplicationsList ( AppsCategories  EnumType,
BOOL  bReload = FALSE,
BOOL  bCheckAvailable = FALSE 
)
private

Definition at line 604 of file gui.cpp.

605{
606 bUpdating = TRUE;
607
608 if (bCheckAvailable)
610
611 if (SelectedEnumType != EnumType)
612 SelectedEnumType = EnumType;
613
614 if (bReload)
616
618 if (IsInstalledEnum(EnumType))
619 {
620 if (bReload)
622
623 // set the display type of application-view. this will remove all the item in application-view too.
625
627 m_Db->GetApps(List, EnumType);
629 }
630 else if (IsAvailableEnum(EnumType))
631 {
632 if (bReload)
634
635 // set the display type of application-view. this will remove all the item in application-view too.
637
638 // enum available softwares
639 if (EnumType == ENUM_CAT_SELECTED)
640 {
642 }
643 else
644 {
646 m_Db->GetApps(List, EnumType);
648 }
649 }
650 else
651 {
652 ATLASSERT(0 && "This should be unreachable!");
653 }
655 m_ApplicationView->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN); // force the child window to repaint
657
660 {
661 text.LoadString(IDS_NO_SEARCH_RESULTS);
662 }
664
666}
@ AppViewTypeInstalledApps
Definition: appview.h:72
@ AppViewTypeAvailableApps
Definition: appview.h:71
#define IDS_NO_SEARCH_RESULTS
Definition: resource.h:124
VOID UpdateInstalled()
Definition: appdb.cpp:236
VOID GetApps(CAtlList< CAppInfo * > &List, AppsCategories Type) const
Definition: appdb.cpp:53
BOOL SetDisplayAppType(APPLICATION_VIEW_TYPE AppType)
Definition: appview.cpp:1818
void SetRedraw(BOOL bRedraw)
Definition: appview.cpp:1605
VOID SetWatermark(const CStringW &Text)
Definition: appview.cpp:1862
VOID AddApplicationsToView(CAtlList< CAppInfo * > &List)
Definition: gui.cpp:588
VOID CheckAvailable()
Definition: gui.cpp:297
const WCHAR * text
Definition: package.c:1799
#define RDW_ALLCHILDREN
Definition: winuser.h:1221
#define RDW_INVALIDATE
Definition: winuser.h:1214

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

◆ UpdateStatusBarText()

VOID CMainWindow::UpdateStatusBarText ( )
private

Definition at line 576 of file gui.cpp.

577{
578 if (m_StatusBar)
579 {
580 CStringW szBuffer;
581
583 m_StatusBar->SetText(szBuffer);
584 }
585}
#define IDS_APPS_COUNT
Definition: resource.h:94
size_t GetCount() const
Definition: atlcoll.h:539
VOID SetText(LPCWSTR lpszText)
Definition: rosctrls.h:457

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

Member Data Documentation

◆ bAppwizMode

BOOL CMainWindow::bAppwizMode
private

Definition at line 60 of file gui.h.

Referenced by InitCategoriesList().

◆ bUpdating

BOOL CMainWindow::bUpdating = FALSE
private

Definition at line 59 of file gui.h.

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

◆ hRootItemInstalled

HTREEITEM CMainWindow::hRootItemInstalled
private

Definition at line 61 of file gui.h.

Referenced by InitCategoriesList(), and OnCommand().

◆ m_ApplicationView

◆ m_ClientPanel

CUiPanel* CMainWindow::m_ClientPanel = NULL
private

Definition at line 48 of file gui.h.

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

◆ m_Db

CAppDB* CMainWindow::m_Db
private

◆ m_hMenu

HMENU CMainWindow::m_hMenu
private

Definition at line 42 of file main.h.

Referenced by OnCreate(), and OnDestroy().

◆ m_Selected

CAtlList<CAppInfo *> CMainWindow::m_Selected
private

◆ m_StatusBar

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

Definition at line 52 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

◆ szSearchPattern

CStringW CMainWindow::szSearchPattern
private

Definition at line 63 of file gui.h.

Referenced by AddApplicationsToView(), SearchTextChanged(), and UpdateApplicationsList().


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