ReactOS 0.4.16-dev-178-g8ba6102
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 m_bAppwizMode
 
HTREEITEM hRootItemInstalled
 
CStringW szSearchPattern
 
AppsCategories SelectedEnumType
 

Friends

class CApplicationView
 

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:65
BOOL m_bAppwizMode
Definition: gui.h:61
CAppDB * m_Db
Definition: gui.h:57
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:221

Member Function Documentation

◆ AddApplicationsToView()

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

Definition at line 639 of file gui.cpp.

640{
641 POSITION CurrentListPosition = List.GetHeadPosition();
642 while (CurrentListPosition)
643 {
644 CAppInfo *Info = List.GetNext(CurrentListPosition);
647 {
648 BOOL bSelected = m_Selected.Find(Info) != NULL;
650 }
651 }
652 m_ApplicationView->AddApplication(NULL, FALSE); // Tell the list we are done
653}
BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle)
Definition: misc.cpp:437
POSITION Find(INARGTYPE element, _In_opt_ POSITION posStartAfter=NULL) const
Definition: atlcoll.h:794
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
BOOL AddApplication(CAppInfo *InstAppInfo, BOOL InitialCheckState)
Definition: appview.cpp:2063
CStringW szSearchPattern
Definition: gui.h:64
CAtlList< CAppInfo * > m_Selected
Definition: gui.h:58
CApplicationView * m_ApplicationView
Definition: gui.h:54
#define FALSE
Definition: types.h:117
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:1245
#define SWP_NOREPOSITION
Definition: winuser.h:1253
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:1246
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:1250
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
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:1986

Referenced by OnInitMenuPopup().

◆ CheckAvailable()

VOID CMainWindow::CheckAvailable ( )
private

Definition at line 303 of file gui.cpp.

304{
305 if (m_Db->GetAvailableCount() == 0)
306 {
309 }
310}
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:937
#define IDCANCEL
Definition: winuser.h:834
#define IDNO
Definition: winuser.h:839
#define MB_ICONQUESTION
Definition: winuser.h:792
#define MessageBox
Definition: winuser.h:5834
#define IDYES
Definition: winuser.h:838
#define MB_YESNOCANCEL
Definition: winuser.h:821

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

◆ Create()

HWND CMainWindow::Create ( )

Definition at line 763 of file gui.cpp.

764{
766
767 RECT r = {
771 r.right += r.left;
772 r.bottom += r.top;
773
774 return CWindowImpl::Create(
776}
#define IDS_APPTITLE
Definition: resource.h:3
#define IDS_APPWIZ_TITLE
Definition: resource.h:96
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:21
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
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by DoCreate(), and MainWindowLoop().

◆ CreateApplicationView()

BOOL CMainWindow::CreateApplicationView ( )
private

Definition at line 158 of file gui.cpp.

159{
160 m_ApplicationView = new CApplicationView(this); // pass this to ApplicationView for callback purpose
164
166}
HWND Create(HWND hwndParent)
Definition: appview.cpp:2005
CUiSplitPanel * m_VSplitter
Definition: gui.h:49
friend class CApplicationView
Definition: gui.h:55
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 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();
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
217 return b;
218}
BOOL CreateTreeView()
Definition: gui.cpp:147
BOOL CreateVSplitter()
Definition: gui.cpp:169
BOOL bUpdating
Definition: gui.h:60
CUiWindow< CStatusBar > * m_StatusBar
Definition: gui.h:52
BOOL CreateStatusBar()
Definition: gui.cpp:136
BOOL CreateApplicationView()
Definition: gui.cpp:158
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:1614

Referenced by InitControls().

◆ CreateStatusBar()

BOOL CMainWindow::CreateStatusBar ( )
private

Definition at line 136 of file gui.cpp.

137{
142
144}
#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 147 of file gui.cpp.

148{
153
154 return m_TreeView->Create(m_hWnd) != NULL;
155}
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 169 of file gui.cpp.

170{
177
178 // TODO: m_MinSecond should be calculate dynamically instead of hard-coded
180 m_VSplitter->m_Pos = 240;
182
183 return m_VSplitter->Create(m_hWnd) != NULL;
184}
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:763
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:3298
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:1212

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 746 of file gui.cpp.

747{
748 DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
749 static ATL::CWndClassInfo wc = {
750 {sizeof(WNDCLASSEX), csStyle, StartWindowProc, 0, 0, NULL,
751 LoadIconW(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCEW(IDI_MAIN)), LoadCursorW(NULL, IDC_ARROW),
753 NULL,
754 NULL,
755 IDC_ARROW,
756 TRUE,
757 0,
758 _T("")};
759 return wc;
760}
#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:2157
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5731
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127
#define COLOR_BTNFACE
Definition: winuser.h:931

◆ HandleTabOrder()

void CMainWindow::HandleTabOrder ( int  direction)

Definition at line 841 of file gui.cpp.

842{
843 ATL::CSimpleArray<HWND> TabOrderHwndList;
844
845 m_TreeView->AppendTabOrderWindow(direction, TabOrderHwndList);
846 m_ApplicationView->AppendTabOrderWindow(direction, TabOrderHwndList);
847
848 if (TabOrderHwndList.GetSize() == 0)
849 {
850 // in case the list is empty
851 return;
852 }
853
854 int FocusIndex;
855
856 if ((FocusIndex = TabOrderHwndList.Find(GetFocus())) == -1)
857 {
858 FocusIndex = 0; // focus the first window in the list
859 }
860 else
861 {
862 FocusIndex += direction;
863 FocusIndex +=
864 TabOrderHwndList.GetSize(); // FocusIndex might be negative. we don't want to mod a negative number
865 FocusIndex %= TabOrderHwndList.GetSize();
866 }
867
868 ::SetFocus(TabOrderHwndList[FocusIndex]);
869 return;
870}
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:2093
virtual VOID AppendTabOrderWindow(int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
Definition: rosui.h:546
HWND WINAPI GetFocus(void)
Definition: window.c:1865

Referenced by MainWindowLoop().

◆ InitCategoriesList()

VOID CMainWindow::InitCategoriesList ( )
private

Definition at line 95 of file gui.cpp.

96{
97 HTREEITEM hRootItemAvailable;
98
102
103 // Do not show any other categories in APPWIZ-mode.
104 if (m_bAppwizMode)
105 goto Finish;
106
108
110 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_AUDIO, IDI_CAT_AUDIO);
111 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_VIDEO, IDI_CAT_VIDEO);
113 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_GAMES, IDI_CAT_GAMES);
116 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_DEVEL, IDI_CAT_DEVEL);
117 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_EDU, IDI_CAT_EDU);
121 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_TOOLS, IDI_CAT_TOOLS);
123 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_LIBS, IDI_CAT_LIBS);
125 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_OTHER, IDI_CAT_OTHER);
126
127Finish:
130 if (!m_bAppwizMode)
131 m_TreeView->Expand(hRootItemAvailable, TVE_EXPAND);
132 m_TreeView->SelectItem(m_bAppwizMode ? hRootItemInstalled : hRootItemAvailable);
133}
#define IDS_UPDATES
Definition: resource.h:106
#define IDS_CAT_TOOLS
Definition: resource.h:194
#define IDI_CAT_FINANCE
Definition: resource.h:25
#define IDS_CAT_VIDEO
Definition: resource.h:195
#define IDS_SELECTEDFORINST
Definition: resource.h:123
#define IDS_CAT_GRAPHICS
Definition: resource.h:188
#define IDI_SELECTEDFORINST
Definition: resource.h:16
#define IDI_CAT_EDU
Definition: resource.h:23
#define IDS_AVAILABLEFORINST
Definition: resource.h:105
#define IDI_CAT_INTERNET
Definition: resource.h:28
#define IDI_CAT_LIBS
Definition: resource.h:29
#define IDS_CAT_AUDIO
Definition: resource.h:181
#define IDS_CAT_SCIENCE
Definition: resource.h:193
#define IDS_CAT_ENGINEER
Definition: resource.h:185
#define IDI_CATEGORY
Definition: resource.h:13
#define IDI_CAT_OFFICE
Definition: resource.h:30
#define IDS_CAT_LIBS
Definition: resource.h:190
#define IDS_CAT_OTHER
Definition: resource.h:192
#define IDI_CAT_GRAPHICS
Definition: resource.h:27
#define IDS_CAT_DEVEL
Definition: resource.h:182
#define IDI_APPS
Definition: resource.h:11
#define IDS_CAT_THEMES
Definition: resource.h:196
#define IDI_CAT_SCIENCE
Definition: resource.h:32
#define IDI_CAT_OTHER
Definition: resource.h:31
#define IDS_CAT_GAMES
Definition: resource.h:187
#define IDS_CAT_EDU
Definition: resource.h:184
#define IDS_CAT_INTERNET
Definition: resource.h:189
#define IDI_APPUPD
Definition: resource.h:12
#define IDI_CAT_VIDEO
Definition: resource.h:34
#define IDS_CAT_DRIVERS
Definition: resource.h:183
#define IDI_CAT_DRIVERS
Definition: resource.h:22
#define IDI_CAT_DEVEL
Definition: resource.h:21
#define IDS_CAT_OFFICE
Definition: resource.h:191
#define IDS_CAT_FINANCE
Definition: resource.h:186
#define IDI_CAT_THEMES
Definition: resource.h:35
#define IDI_CAT_GAMES
Definition: resource.h:26
#define IDS_APPLICATIONS
Definition: resource.h:107
#define IDI_CAT_ENGINEER
Definition: resource.h:24
#define IDS_INSTALLED
Definition: resource.h:104
#define IDI_CAT_TOOLS
Definition: resource.h:33
#define IDI_CAT_AUDIO
Definition: resource.h:20
HTREEITEM hRootItemInstalled
Definition: gui.h:62
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:3428
#define TVI_ROOT
Definition: commctrl.h:3373

Referenced by InitControls().

◆ InitControls()

BOOL CMainWindow::InitControls ( )
private

Definition at line 231 of file gui.cpp.

232{
233 if (CreateLayout())
234 {
237
238 return TRUE;
239 }
240
241 return FALSE;
242}
VOID UpdateStatusBarText()
Definition: gui.cpp:619
BOOL CreateLayout()
Definition: gui.cpp:187
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 809 of file gui.cpp.

810{
811 if (Info)
812 {
814 {
816 return TRUE;
817 }
818 }
819
820 return FALSE;
821}
VOID UpdateApplicationsList(AppsCategories EnumType, BOOL bReload=FALSE, BOOL bCheckAvailable=FALSE)
Definition: gui.cpp:656
BOOL DownloadApplication(CAppInfo *pAppInfo)
Definition: loaddlg.cpp:1135

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

◆ ItemCheckStateChanged()

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

Definition at line 781 of file gui.cpp.

782{
783 if (bUpdating)
784 return;
785
786 CAppInfo *Info = (CAppInfo *)CallbackParam;
787
788 if (bChecked)
789 {
791 }
792 else
793 {
795 ATLASSERT(Pos != NULL);
796
797 if (Pos != NULL)
798 {
800 }
801 }
802
804}
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
POSITION AddTail(INARGTYPE element)
Definition: atlcoll.h:629
void RemoveAt(_In_ POSITION pos)
Definition: atlcoll.h:769
ush Pos
Definition: deflate.h:92

Referenced by CApplicationView::ItemCheckStateChanged().

◆ LayoutCleanup()

VOID CMainWindow::LayoutCleanup ( )
private

Definition at line 221 of file gui.cpp.

222{
223 delete m_TreeView;
224 delete m_ApplicationView;
225 delete m_VSplitter;
226 delete m_StatusBar;
227 return;
228}

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:776
#define SW_HIDE
Definition: winuser.h:771
#define WM_CLOSE
Definition: winuser.h:1624
#define WM_PASTE
Definition: winuser.h:1866
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1743
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define SW_SHOWNOACTIVATE
Definition: winuser.h:777
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_CUT
Definition: winuser.h:1864
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define FindWindowEx
Definition: winuser.h:5790
#define WM_UNDO
Definition: winuser.h:1868
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define SendMessage
Definition: winuser.h:5855
#define EM_SETSEL
Definition: winuser.h:2021
#define MB_ICONINFORMATION
Definition: winuser.h:805
#define WM_COPY
Definition: winuser.h:1865
#define SW_SHOW
Definition: winuser.h:778
#define WM_CLEAR
Definition: winuser.h:1867
#define DM_REPOSITION
Definition: winuser.h:2103
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 531 of file gui.cpp.

532{
533 const BOOL bReload = TRUE;
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_SEARCH:
550 break;
551
552 case ID_INSTALL:
554 {
555 if (!m_Selected.IsEmpty())
556 {
558 {
561 }
562 }
563 else
564 {
566 if (App)
567 {
569 }
570 }
571 }
572 break;
573
574 case ID_UNINSTALL:
577 break;
578
579 case ID_MODIFY:
582 break;
583
584 case ID_REGREMOVE:
587 break;
588
589 case ID_REFRESH:
591 break;
592
593 case ID_RESETDB:
596 break;
597
598 case ID_HELP:
599 MessageBoxW(L"Help not implemented yet", NULL, MB_OK);
600 break;
601
602 case ID_ABOUT:
603 ShowAboutDlg();
604 break;
605
606 case ID_CHECK_ALL:
608 break;
609
613 break;
614 }
615 }
616}
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:82
#define ID_UNINSTALL
Definition: resource.h:74
#define ID_SEARCH
Definition: resource.h:85
#define ID_CHECK_ALL
Definition: resource.h:84
#define ID_ACTIVATE_APPWIZ
Definition: resource.h:88
#define ID_MODIFY
Definition: resource.h:77
#define ID_RESETDB
Definition: resource.h:83
#define ID_INSTALL
Definition: resource.h:73
#define ID_SETTINGS
Definition: resource.h:80
#define ID_ABOUT
Definition: charmap.c:17
bool IsEmpty() const
Definition: atlcoll.h:548
void RemoveAll()
Definition: atlcoll.h:748
PVOID GetFocusedItemData()
Definition: appview.cpp:2081
void SetFocusOnSearchBar()
Definition: appview.cpp:1809
BOOL RemoveSelectedAppFromRegistry()
Definition: gui.cpp:269
BOOL InstallApplication(CAppInfo *Info)
Definition: gui.cpp:809
VOID ShowAboutDlg()
Definition: gui.cpp:519
BOOL UninstallSelectedApp(BOOL bModify)
Definition: gui.cpp:290
unsigned short WORD
Definition: ntddk_ex.h:93
VOID CreateSettingsDlg(HWND hwnd)
BOOL DownloadListOfApplications(const CAtlList< CAppInfo * > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1116
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:793

◆ 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:1962
#define SBARS_SIZEGRIP
Definition: commctrl.h:1928
#define STATUSCLASSNAME
Definition: commctrl.h:1944
#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:3633

◆ 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:2000
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:2228
#define VK_LEFT
Definition: winuser.h:2227
#define VK_RIGHT
Definition: winuser.h:2229
#define VK_DOWN
Definition: winuser.h:2230
#define VK_ESCAPE
Definition: winuser.h:2217

◆ 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:4012
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1746
#define WM_VSCROLL
Definition: winuser.h:1747
#define VK_CONTROL
Definition: winuser.h:2206
#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:2205
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 245 of file gui.cpp.

246{
247 if (wParam == SIZE_MINIMIZED)
248 return;
249
250 /* Size status bar */
251 m_StatusBar->SendMessage(WM_SIZE, 0, 0);
252
253 RECT r = {0, 0, LOWORD(lParam), HIWORD(lParam)};
254 HDWP hdwp = NULL;
256
258 if (hdwp)
259 {
260 hdwp = m_ClientPanel->OnParentSize(r, hdwp);
261 if (hdwp)
262 {
263 EndDeferWindowPos(hdwp);
264 }
265 }
266}
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:2509

◆ 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:1959
#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:1629

◆ 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:5815
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 313 of file gui.cpp.

314{
315 theResult = 0;
316 switch (Msg)
317 {
318 case WM_CREATE:
319 if (!InitControls())
322 break;
323
324 case WM_DESTROY:
325 {
326 hMainWnd = NULL;
328 FreeLogs();
329
330 delete m_ClientPanel;
331
333 return 0;
334 }
335
336 case WM_CLOSE:
338 return g_Busy;
339
341 if (!g_Busy && !IsWindowVisible())
342 SendMessage(WM_CLOSE, 0, 0);
343 break;
344
345 case DM_REPOSITION:
346 EmulateDialogReposition(hwnd); // We are not a real dialog, we need help from a real one
347 break;
348
349 case WM_COMMAND:
351 break;
352
353 case WM_NOTIFY:
354 {
356
357 switch (data->code)
358 {
360 {
361 if (data->hwndFrom == m_TreeView->m_hWnd)
362 {
363 // APPWIZ-mode: forbid item collapse.
364 // FIXME: Prevent collapse (COMCTL32 is buggy)
365 // https://bugs.winehq.org/show_bug.cgi?id=53727
367 {
368 theResult = TRUE;
369 return TRUE; // Handled
370 }
371 }
372 break;
373 }
374
375 case TVN_SELCHANGED:
376 {
377 if (data->hwndFrom == m_TreeView->m_hWnd)
378 {
379 switch (((LPNMTREEVIEW)lParam)->itemNew.lParam)
380 {
381 case IDS_INSTALLED:
383 break;
384
385 case IDS_APPLICATIONS:
387 break;
388
389 case IDS_UPDATES:
391 break;
392
395 break;
396
397 case IDS_CAT_AUDIO:
399 break;
400
401 case IDS_CAT_DEVEL:
403 break;
404
405 case IDS_CAT_DRIVERS:
407 break;
408
409 case IDS_CAT_EDU:
411 break;
412
413 case IDS_CAT_ENGINEER:
415 break;
416
417 case IDS_CAT_FINANCE:
419 break;
420
421 case IDS_CAT_GAMES:
423 break;
424
425 case IDS_CAT_GRAPHICS:
427 break;
428
429 case IDS_CAT_INTERNET:
431 break;
432
433 case IDS_CAT_LIBS:
435 break;
436
437 case IDS_CAT_OFFICE:
439 break;
440
441 case IDS_CAT_OTHER:
443 break;
444
445 case IDS_CAT_SCIENCE:
447 break;
448
449 case IDS_CAT_TOOLS:
451 break;
452
453 case IDS_CAT_VIDEO:
455 break;
456
457 case IDS_CAT_THEMES:
459 break;
460
463 break;
464 }
465 }
466 }
467 break;
468 }
469 }
470 break;
471
472 case WM_SIZE:
474 break;
475
476 case WM_SIZING:
477 {
478 LPRECT pRect = (LPRECT)lParam;
479
480 if (pRect->right - pRect->left < 565)
481 pRect->right = pRect->left + 565;
482
483 if (pRect->bottom - pRect->top < 300)
484 pRect->bottom = pRect->top + 300;
485
486 return TRUE;
487 }
488
490 {
491 /* Forward WM_SYSCOLORCHANGE to common controls */
493 m_TreeView->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
494 }
495 break;
496
497 case WM_SETTINGCHANGE:
498 if (wParam == SPI_SETNONCLIENTMETRICS || wParam == SPI_SETICONMETRICS)
499 {
501 g_hDefaultPackageIcon = NULL; // Trigger imagelist recreation on next load
502 }
503 break;
504
505 case WM_TIMER:
506 if (wParam == SEARCH_TIMER_ID)
507 {
509
511 }
512 break;
513 }
514
515 return FALSE;
516}
@ 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
HICON g_hDefaultPackageIcon
Definition: appview.cpp:16
void SaveSettings(void)
Definition: settings.c:115
#define SEARCH_TIMER_ID
Definition: gui.h:21
VOID EmulateDialogReposition(HWND hwnd)
Definition: misc.cpp:49
VOID FreeLogs()
Definition: misc.cpp:243
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:231
struct @1636 Msg[]
const WCHAR * action
Definition: action.c:7509
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HWND hMainWnd
Definition: magnifier.c:32
#define TVN_SELCHANGED
Definition: commctrl.h:3740
#define LPNMTREEVIEW
Definition: commctrl.h:3648
#define TVE_TOGGLE
Definition: commctrl.h:3429
#define TVE_COLLAPSE
Definition: commctrl.h:3427
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3743
#define WM_NOTIFY_OPERATIONCOMPLETED
Definition: rapps.h:18
LONG g_Busy
Definition: winmain.cpp:17
#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:1611
#define WM_SETTINGCHANGE
Definition: winuser.h:1632
#define WM_TIMER
Definition: winuser.h:1745
struct tagNMHDR * LPNMHDR
#define WM_SIZING
Definition: winuser.h:1810
#define WM_DESTROY
Definition: winuser.h:1612
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105

◆ RemoveSelectedAppFromRegistry()

BOOL CMainWindow::RemoveSelectedAppFromRegistry ( )
private

Definition at line 269 of file gui.cpp.

270{
272 return FALSE;
273
274 CStringW szMsgText, szMsgTitle;
275
276 if (!szMsgText.LoadStringW(IDS_APP_REG_REMOVE) || !szMsgTitle.LoadStringW(IDS_INFORMATION))
277 return FALSE;
278
280 if (!InstalledApp)
281 return FALSE;
282
283 if (MessageBoxW(szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
284 return m_Db->RemoveInstalledAppFromRegistry(InstalledApp) == ERROR_SUCCESS;
285
286 return FALSE;
287}
BOOL IsInstalledEnum(INT x)
Definition: appinfo.h:61
#define IDS_INFORMATION
Definition: resource.h:112
#define IDS_APP_REG_REMOVE
Definition: resource.h:111
static DWORD RemoveInstalledAppFromRegistry(const CAppInfo *Info)
Definition: appdb.cpp:315
#define ERROR_SUCCESS
Definition: deptool.c:10
#define MB_YESNO
Definition: winuser.h:820

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 824 of file gui.cpp.

825{
826 if (szSearchPattern == SearchText)
827 {
828 return FALSE;
829 }
830
831 szSearchPattern = SearchText;
832
833 DWORD dwDelay = 0;
834 SystemParametersInfoW(SPI_GETMENUSHOWDELAY, 0, &dwDelay, 0);
835 SetTimer(SEARCH_TIMER_ID, dwDelay);
836
837 return TRUE;
838}
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 519 of file gui.cpp.

520{
521 CStringW szApp;
522 CStringW szAuthors;
523
524 szApp.LoadStringW(IDS_APPTITLE);
525 szAuthors.LoadStringW(IDS_APP_AUTHORS);
526 ShellAboutW(m_hWnd, szApp, szAuthors,
528}
#define IDS_APP_AUTHORS
Definition: resource.h:92
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:2383
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define WM_NULL
Definition: winuser.h:1610
#define PostMessage
Definition: winuser.h:5844
#define TPM_RETURNCMD
Definition: winuser.h:2390

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

◆ UninstallSelectedApp()

BOOL CMainWindow::UninstallSelectedApp ( BOOL  bModify)
private

Definition at line 290 of file gui.cpp.

291{
293 return FALSE;
294
296 if (!InstalledApp)
297 return FALSE;
298
299 return InstalledApp->UninstallApplication(bModify ? UCF_MODIFY : UCF_NONE);
300}
@ 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 656 of file gui.cpp.

657{
658 // Only installed applications should be enumerated in APPWIZ-mode.
659 if (m_bAppwizMode && !IsInstalledEnum(EnumType))
660 {
661 ATLASSERT(FALSE && "Should not be called in APPWIZ-mode");
662 return;
663 }
664
665 bUpdating = TRUE;
666
667 if (HCURSOR hCursor = LoadCursor(NULL, IDC_APPSTARTING))
668 {
669 // The database (.ini files) is parsed on the UI thread, let the user know we are busy
670 SetCursor(hCursor);
672 }
673
674 if (bCheckAvailable)
676
677 BOOL TryRestoreSelection = SelectedEnumType == EnumType;
678 if (SelectedEnumType != EnumType)
679 SelectedEnumType = EnumType;
680
682 if (TryRestoreSelection)
684
685 if (bReload)
687
689 if (IsInstalledEnum(EnumType))
690 {
691 if (bReload)
693
694 // set the display type of application-view. this will remove all the item in application-view too.
696
698 m_Db->GetApps(List, EnumType);
700 }
701 else if (IsAvailableEnum(EnumType))
702 {
703 // We shouldn't get there in APPWIZ-mode.
705
706 if (bReload)
708
709 // set the display type of application-view. this will remove all the item in application-view too.
711
712 // enum available softwares
713 if (EnumType == ENUM_CAT_SELECTED)
714 {
716 }
717 else
718 {
720 m_Db->GetApps(List, EnumType);
722 }
723 }
724 else
725 {
726 ATLASSERT(0 && "This should be unreachable!");
727 }
728
729 if (TryRestoreSelection)
730 m_ApplicationView->RestoreListSelection(RestoreSelection);
732 m_ApplicationView->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN); // force the child window to repaint
734
737 {
738 text.LoadString(IDS_NO_SEARCH_RESULTS);
739 }
741
743}
@ AppViewTypeInstalledApps
Definition: appview.h:72
@ AppViewTypeAvailableApps
Definition: appview.h:71
#define IDS_NO_SEARCH_RESULTS
Definition: resource.h:129
VOID UpdateInstalled()
Definition: appdb.cpp:236
VOID GetApps(CAtlList< CAppInfo * > &List, AppsCategories Type) const
Definition: appdb.cpp:53
VOID GetRestoreListSelectionData(RESTORELISTSELECTION &Restore)
Definition: appview.cpp:2103
VOID RestoreListSelection(const RESTORELISTSELECTION &Restore)
Definition: appview.cpp:2120
BOOL SetDisplayAppType(APPLICATION_VIEW_TYPE AppType)
Definition: appview.cpp:2016
void SetRedraw(BOOL bRedraw)
Definition: appview.cpp:1802
VOID SetWatermark(const CStringW &Text)
Definition: appview.cpp:2069
VOID AddApplicationsToView(CAtlList< CAppInfo * > &List)
Definition: gui.cpp:639
VOID CheckAvailable()
Definition: gui.cpp:303
const WCHAR * text
Definition: package.c:1794
#define MAKELONG(a, b)
Definition: typedefs.h:249
HICON HCURSOR
Definition: windef.h:299
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define RDW_ALLCHILDREN
Definition: winuser.h:1224
#define IDC_APPSTARTING
Definition: winuser.h:699
#define HTCLIENT
Definition: winuser.h:2478
#define LoadCursor
Definition: winuser.h:5824
#define WM_SETCURSOR
Definition: winuser.h:1639
#define RDW_INVALIDATE
Definition: winuser.h:1217

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

◆ UpdateStatusBarText()

VOID CMainWindow::UpdateStatusBarText ( )
private

Definition at line 619 of file gui.cpp.

620{
621 if (m_StatusBar)
622 {
623 CStringW szBuffer;
625
626 // Append the number of selected apps if not in APPWIZ-mode.
627 if (!m_bAppwizMode)
628 {
629 CStringW szBuffer2;
631 szBuffer += szBuffer2;
632 }
633
634 m_StatusBar->SetText(szBuffer);
635 }
636}
#define IDS_APPS_COUNT
Definition: resource.h:102
#define IDS_APPS_SELECT_COUNT
Definition: resource.h:103
size_t GetCount() const
Definition: atlcoll.h:542
VOID SetText(LPCWSTR lpszText)
Definition: rosctrls.h:457

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

Friends And Related Function Documentation

◆ CApplicationView

friend class CApplicationView
friend

Definition at line 55 of file gui.h.

Referenced by CreateApplicationView().

Member Data Documentation

◆ bUpdating

BOOL CMainWindow::bUpdating = FALSE
private

Definition at line 60 of file gui.h.

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

◆ hRootItemInstalled

HTREEITEM CMainWindow::hRootItemInstalled
private

Definition at line 62 of file gui.h.

Referenced by InitCategoriesList(), and OnCommand().

◆ m_ApplicationView

◆ m_bAppwizMode

◆ 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 64 of file gui.h.

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


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