ReactOS 0.4.16-dev-1078-g21d3e29
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 ()
 

Static Public Attributes

static HWND m_hLastFocus = NULL
 
static bool m_PendingInstalledViewRefresh = false
 
- Static Public Attributes inherited from ATL::CWindow
static RECT rcDefault
 

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
 

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

88{
89}
@ ENUM_ALL_INSTALLED
Definition: appinfo.h:45
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 91 of file gui.cpp.

92{
94}
VOID LayoutCleanup()
Definition: gui.cpp:223

Member Function Documentation

◆ AddApplicationsToView()

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

Definition at line 667 of file gui.cpp.

668{
669 POSITION CurrentListPosition = List.GetHeadPosition();
670 while (CurrentListPosition)
671 {
672 CAppInfo *Info = List.GetNext(CurrentListPosition);
675 {
676 BOOL bSelected = m_Selected.Find(Info) != NULL;
678 }
679 }
680 m_ApplicationView->AddApplication(NULL, FALSE); // Tell the list we are done
681}
BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle)
Definition: misc.cpp:504
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:2089
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:1253
#define SWP_NOREPOSITION
Definition: winuser.h:1261
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:1254
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:1258
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:1994

Referenced by OnInitMenuPopup().

◆ CheckAvailable()

VOID CMainWindow::CheckAvailable ( )
private

Definition at line 305 of file gui.cpp.

306{
307 if (m_Db->GetAvailableCount() == 0)
308 {
312 }
313}
VOID UpdateAvailable()
Definition: appdb.cpp:130
size_t GetAvailableCount() const
Definition: appdb.h:53
VOID RemoveCached()
Definition: appdb.cpp:300
rwlock_t lock
Definition: tcpcore.h:0

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:1743
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:721
void saveImage(BOOL overwrite)
Definition: main.cpp:407
BOOL IsImageSaved() const
Definition: history.cpp:227
#define PathFindFileName
Definition: shlwapi.h:946
#define IDCANCEL
Definition: winuser.h:842
#define IDNO
Definition: winuser.h:847
#define MB_ICONQUESTION
Definition: winuser.h:800
#define MessageBox
Definition: winuser.h:5842
#define IDYES
Definition: winuser.h:846
#define MB_YESNOCANCEL
Definition: winuser.h:829

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

◆ Create()

HWND CMainWindow::Create ( )

Definition at line 797 of file gui.cpp.

798{
800
801 RECT r = {
805 r.right += r.left;
806 r.bottom += r.top;
807
808 return CWindowImpl::Create(
810}
#define IDS_APPTITLE
Definition: resource.h:3
#define IDS_APPWIZ_TITLE
Definition: resource.h:97
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 160 of file gui.cpp.

161{
162 m_ApplicationView = new CApplicationView(this); // pass this to ApplicationView for callback purpose
166
168}
HWND Create(HWND hwndParent)
Definition: appview.cpp:2033
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 189 of file gui.cpp.

190{
191 BOOL b = TRUE;
192 bUpdating = TRUE;
193
194 m_ClientPanel = new CUiPanel();
197
198 // Top level
199 b = b && CreateStatusBar();
200 b = b && CreateVSplitter();
201
202 // Inside V Splitter
203 b = b && CreateTreeView();
205
206 if (b)
207 {
208 RECT rBottom;
209
210 /* Size status bar */
211 m_StatusBar->SendMessageW(WM_SIZE, 0, 0);
212
213 ::GetWindowRect(m_StatusBar->m_hWnd, &rBottom);
214
215 m_VSplitter->m_Margin.bottom = rBottom.bottom - rBottom.top;
216 }
217
219 return b;
220}
BOOL CreateTreeView()
Definition: gui.cpp:149
BOOL CreateVSplitter()
Definition: gui.cpp:171
BOOL bUpdating
Definition: gui.h:60
CUiWindow< CStatusBar > * m_StatusBar
Definition: gui.h:52
BOOL CreateStatusBar()
Definition: gui.cpp:138
BOOL CreateApplicationView()
Definition: gui.cpp:160
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:1622

Referenced by InitControls().

◆ CreateStatusBar()

BOOL CMainWindow::CreateStatusBar ( )
private

Definition at line 138 of file gui.cpp.

139{
144
146}
#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 149 of file gui.cpp.

150{
155
156 return m_TreeView->Create(m_hWnd) != NULL;
157}
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 171 of file gui.cpp.

172{
179
180 // TODO: m_MinSecond should be calculate dynamically instead of hard-coded
182 m_VSplitter->m_Pos = 240;
184
185 return m_VSplitter->Create(m_hWnd) != NULL;
186}
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:797
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:3306
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:1220

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

781{
782 DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
783 static ATL::CWndClassInfo wc = {
784 {sizeof(WNDCLASSEX), csStyle, StartWindowProc, 0, 0, NULL,
785 LoadIconW(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCEW(IDI_MAIN)), LoadCursorW(NULL, IDC_ARROW),
787 NULL,
788 NULL,
789 IDC_ARROW,
790 TRUE,
791 0,
792 _T("")};
793 return wc;
794}
#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:666
#define CS_HREDRAW
Definition: winuser.h:661
#define IDC_ARROW
Definition: winuser.h:695
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2442
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5739
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2412
#define COLOR_BTNFACE
Definition: winuser.h:939

◆ HandleTabOrder()

void CMainWindow::HandleTabOrder ( int  direction)

Definition at line 866 of file gui.cpp.

867{
868 ATL::CSimpleArray<HWND> TabOrderHwndList;
869
870 m_TreeView->AppendTabOrderWindow(direction, TabOrderHwndList);
871 m_ApplicationView->AppendTabOrderWindow(direction, TabOrderHwndList);
872
873 if (TabOrderHwndList.GetSize() == 0)
874 {
875 // in case the list is empty
876 return;
877 }
878
879 int FocusIndex;
880
881 if ((FocusIndex = TabOrderHwndList.Find(GetFocus())) == -1)
882 {
883 FocusIndex = 0; // focus the first window in the list
884 }
885 else
886 {
887 FocusIndex += direction;
888 FocusIndex +=
889 TabOrderHwndList.GetSize(); // FocusIndex might be negative. we don't want to mod a negative number
890 FocusIndex %= TabOrderHwndList.GetSize();
891 }
892
893 ::SetFocus(TabOrderHwndList[FocusIndex]);
894 return;
895}
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:2119
virtual VOID AppendTabOrderWindow(int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
Definition: rosui.h:546
HWND WINAPI GetFocus(void)
Definition: window.c:1875

Referenced by MainWindowLoop(), and ProcessWindowMessage().

◆ InitCategoriesList()

VOID CMainWindow::InitCategoriesList ( )
private

Definition at line 97 of file gui.cpp.

98{
99 HTREEITEM hRootItemAvailable;
100
104
105 // Do not show any other categories in APPWIZ-mode.
106 if (m_bAppwizMode)
107 goto Finish;
108
110
112 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_AUDIO, IDI_CAT_AUDIO);
113 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_VIDEO, IDI_CAT_VIDEO);
115 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_GAMES, IDI_CAT_GAMES);
118 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_DEVEL, IDI_CAT_DEVEL);
119 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_EDU, IDI_CAT_EDU);
123 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_TOOLS, IDI_CAT_TOOLS);
125 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_LIBS, IDI_CAT_LIBS);
127 m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_OTHER, IDI_CAT_OTHER);
128
129Finish:
132 if (!m_bAppwizMode)
133 m_TreeView->Expand(hRootItemAvailable, TVE_EXPAND);
134 m_TreeView->SelectItem(m_bAppwizMode ? hRootItemInstalled : hRootItemAvailable);
135}
#define IDS_UPDATES
Definition: resource.h:107
#define IDS_CAT_TOOLS
Definition: resource.h:199
#define IDI_CAT_FINANCE
Definition: resource.h:26
#define IDS_CAT_VIDEO
Definition: resource.h:200
#define IDS_SELECTEDFORINST
Definition: resource.h:124
#define IDS_CAT_GRAPHICS
Definition: resource.h:193
#define IDI_SELECTEDFORINST
Definition: resource.h:17
#define IDI_CAT_EDU
Definition: resource.h:24
#define IDS_AVAILABLEFORINST
Definition: resource.h:106
#define IDI_CAT_INTERNET
Definition: resource.h:29
#define IDI_CAT_LIBS
Definition: resource.h:30
#define IDS_CAT_AUDIO
Definition: resource.h:186
#define IDS_CAT_SCIENCE
Definition: resource.h:198
#define IDS_CAT_ENGINEER
Definition: resource.h:190
#define IDI_CATEGORY
Definition: resource.h:14
#define IDI_CAT_OFFICE
Definition: resource.h:31
#define IDS_CAT_LIBS
Definition: resource.h:195
#define IDS_CAT_OTHER
Definition: resource.h:197
#define IDI_CAT_GRAPHICS
Definition: resource.h:28
#define IDS_CAT_DEVEL
Definition: resource.h:187
#define IDI_APPS
Definition: resource.h:12
#define IDS_CAT_THEMES
Definition: resource.h:201
#define IDI_CAT_SCIENCE
Definition: resource.h:33
#define IDI_CAT_OTHER
Definition: resource.h:32
#define IDS_CAT_GAMES
Definition: resource.h:192
#define IDS_CAT_EDU
Definition: resource.h:189
#define IDS_CAT_INTERNET
Definition: resource.h:194
#define IDI_APPUPD
Definition: resource.h:13
#define IDI_CAT_VIDEO
Definition: resource.h:35
#define IDS_CAT_DRIVERS
Definition: resource.h:188
#define IDI_CAT_DRIVERS
Definition: resource.h:23
#define IDI_CAT_DEVEL
Definition: resource.h:22
#define IDS_CAT_OFFICE
Definition: resource.h:196
#define IDS_CAT_FINANCE
Definition: resource.h:191
#define IDI_CAT_THEMES
Definition: resource.h:36
#define IDI_CAT_GAMES
Definition: resource.h:27
#define IDS_APPLICATIONS
Definition: resource.h:108
#define IDI_CAT_ENGINEER
Definition: resource.h:25
#define IDS_INSTALLED
Definition: resource.h:105
#define IDI_CAT_TOOLS
Definition: resource.h:34
#define IDI_CAT_AUDIO
Definition: resource.h:21
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 233 of file gui.cpp.

234{
235 if (CreateLayout())
236 {
239
240 return TRUE;
241 }
242
243 return FALSE;
244}
VOID UpdateStatusBarText()
Definition: gui.cpp:647
BOOL CreateLayout()
Definition: gui.cpp:189
VOID InitCategoriesList()
Definition: gui.cpp:97

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:256
void NotifyImageChanged()
Definition: history.cpp:23
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:193
int GetHeight() const
Definition: history.cpp:261
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 843 of file gui.cpp.

844{
845 return Info && DownloadApplication(Info);
846}
BOOL DownloadApplication(CAppInfo *pAppInfo)
Definition: loaddlg.cpp:1164

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

◆ ItemCheckStateChanged()

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

Definition at line 815 of file gui.cpp.

816{
817 if (bUpdating)
818 return;
819
820 CAppInfo *Info = (CAppInfo *)CallbackParam;
821
822 if (bChecked)
823 {
825 }
826 else
827 {
829 ATLASSERT(Pos != NULL);
830
831 if (Pos != NULL)
832 {
834 }
835 }
836
838}
#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 223 of file gui.cpp.

224{
225 delete m_TreeView;
226 delete m_ApplicationView;
227 delete m_VSplitter;
228 delete m_StatusBar;
229 return;
230}

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 {
961 ::SetClipboardData(CF_DIB, hGlobal);
962 }
963 else
964 {
967 }
968 ::DeleteObject(hbmCopy);
969 }
970
972 break;
973 case IDM_EDITCUT:
974 if (textShown)
975 {
976 textEditWindow.SendMessage(WM_CUT);
977 break;
978 }
979 /* Copy */
981 /* Delete selection */
983 break;
984 case IDM_EDITPASTE:
985 if (textShown)
986 {
987 textEditWindow.SendMessage(WM_PASTE);
988 break;
989 }
990
991 if (!OpenClipboard())
992 break;
993
994 // In many cases, CF_ENHMETAFILE provides a better image than CF_DIB
996 {
997 HENHMETAFILE hEMF = (HENHMETAFILE)::GetClipboardData(CF_ENHMETAFILE);
998 if (hEMF)
999 {
1000 HBITMAP hbm = BitmapFromHEMF(hEMF);
1001 ::DeleteEnhMetaFile(hEMF);
1002 if (hbm)
1003 {
1006 break;
1007 }
1008 }
1009 }
1010
1011 // In many cases, CF_DIB provides a better image than CF_BITMAP
1013 {
1015 if (hbm)
1016 {
1019 break;
1020 }
1021 }
1022
1023 // The last resort
1025 {
1027 if (hbm)
1028 {
1031 break;
1032 }
1033 }
1034
1035 // Failed to paste
1036 {
1037 CStringW strText, strTitle;
1038 strText.LoadString(IDS_CANTPASTE);
1039 strTitle.LoadString(IDS_PROGRAMNAME);
1040 MessageBox(strText, strTitle, MB_ICONINFORMATION);
1041 }
1042
1044 break;
1045 case IDM_CROPSELECTION:
1046 {
1048 if (hbmSelection)
1049 {
1050 imageModel.PushImageForUndo(hbmSelection);
1053 }
1054 break;
1055 }
1057 {
1058 if (textShown)
1059 {
1060 textEditWindow.SendMessage(WM_CLEAR);
1061 break;
1062 }
1063 switch (toolsModel.GetActiveTool())
1064 {
1065 case TOOL_FREESEL:
1066 case TOOL_RECTSEL:
1068 break;
1069
1070 case TOOL_TEXT:
1072 break;
1073 default:
1074 break;
1075 }
1076 break;
1077 }
1078 case IDM_EDITSELECTALL:
1079 {
1080 if (textShown)
1081 {
1082 textEditWindow.SendMessage(EM_SETSEL, 0, -1);
1083 break;
1084 }
1088 canvasWindow.Invalidate(TRUE);
1089 break;
1090 }
1091 case IDM_EDITCOPYTO:
1092 {
1093 WCHAR szFileName[MAX_LONG_PATH];
1094 ::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, szFileName, _countof(szFileName));
1095 if (GetSaveFileName(szFileName, _countof(szFileName)))
1096 {
1098 if (!hbmSelection)
1099 {
1102 break;
1103 }
1104 SaveDIBToFile(hbmSelection, szFileName, FALSE);
1105 DeleteObject(hbmSelection);
1106 }
1107 break;
1108 }
1109 case IDM_EDITPASTEFROM:
1110 {
1111 WCHAR szFileName[MAX_LONG_PATH] = L"";
1112 if (GetOpenFileName(szFileName, _countof(szFileName)))
1113 {
1114 HBITMAP hbmNew = DoLoadImageFile(m_hWnd, szFileName, FALSE);
1115 if (hbmNew)
1117 }
1118 break;
1119 }
1121 {
1122 COLORREF rgbColor = paletteModel.GetFgColor();
1123 if (ChooseColor(&rgbColor))
1124 paletteModel.SetFgColor(rgbColor);
1125 break;
1126 }
1129 break;
1132 break;
1134 {
1137 else
1139 break;
1140 }
1145 break;
1147 {
1148 CWaitCursor waitCursor;
1150 switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
1151 {
1152 case 1: /* flip horizontally */
1153 {
1156 else
1158 break;
1159 }
1160 case 2: /* flip vertically */
1161 {
1164 else
1166 break;
1167 }
1168 case 3: /* rotate 90 degrees */
1169 {
1172 else
1174 break;
1175 }
1176 case 4: /* rotate 180 degrees */
1177 {
1180 else
1182 break;
1183 }
1184 case 5: /* rotate 270 degrees */
1185 {
1188 else
1190 break;
1191 }
1192 }
1193 }
1194 break;
1196 {
1197 if (attributesDialog.DoModal(mainWindow.m_hWnd))
1198 {
1199 CWaitCursor waitCursor;
1201 {
1204 INT id = MessageBox(strText, strTitle, MB_ICONINFORMATION | MB_YESNOCANCEL);
1205 if (id != IDYES)
1206 break;
1207
1209 }
1210
1213 {
1215 }
1216 }
1217 break;
1218 }
1220 {
1221 if (stretchSkewDialog.DoModal(mainWindow.m_hWnd))
1222 {
1223 CWaitCursor waitCursor;
1225 {
1228 }
1229 else
1230 {
1233 }
1234 }
1235 break;
1236 }
1239 break;
1240 case IDM_IMAGECROP:
1241 {
1245 break;
1246 }
1247 case IDM_VIEWTOOLBOX:
1248 registrySettings.ShowToolBox = !toolBoxContainer.IsWindowVisible();
1251 break;
1253 registrySettings.ShowPalette = !paletteWindow.IsWindowVisible();
1256 break;
1257 case IDM_VIEWSTATUSBAR:
1261 break;
1262 case IDM_FORMATICONBAR:
1264 {
1265 if (!fontsDialog.IsWindow())
1266 {
1267 fontsDialog.Create(mainWindow);
1268 }
1271 fontsDialog.SendMessage(DM_REPOSITION, 0, 0);
1272 }
1273 break;
1274 case IDM_VIEWSHOWGRID:
1276 canvasWindow.Invalidate(FALSE);
1277 break;
1282 break;
1283
1284 case IDM_VIEWZOOM125:
1285 canvasWindow.zoomTo(125);
1286 break;
1287 case IDM_VIEWZOOM25:
1288 canvasWindow.zoomTo(250);
1289 break;
1290 case IDM_VIEWZOOM50:
1291 canvasWindow.zoomTo(500);
1292 break;
1293 case IDM_VIEWZOOM100:
1294 canvasWindow.zoomTo(1000);
1295 break;
1296 case IDM_VIEWZOOM200:
1297 canvasWindow.zoomTo(2000);
1298 break;
1299 case IDM_VIEWZOOM400:
1300 canvasWindow.zoomTo(4000);
1301 break;
1302 case IDM_VIEWZOOM800:
1303 canvasWindow.zoomTo(8000);
1304 break;
1305
1306 case IDM_VIEWFULLSCREEN:
1307 // Create and show the fullscreen window
1308 fullscreenWindow.DoCreate();
1310 break;
1311
1312 case IDM_CTRL_PLUS:
1314 break;
1315 case IDM_CTRL_MINUS:
1317 break;
1318 }
1319 return 0;
1320}
#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:251
VOID zoomTo(INT newZoom, LONG left=0, LONG top=0)
Definition: canvas.cpp:102
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:287
void FlipHorizontally()
Definition: history.cpp:279
void PushBlackAndWhite()
Definition: history.cpp:339
void InvertColors()
Definition: history.cpp:266
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:295
HDC GetDC()
Definition: history.cpp:274
void ClearHistory(void)
Definition: history.cpp:116
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
Definition: history.cpp:232
BOOL IsBlackAndWhite()
Definition: history.cpp:331
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:448
HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF)
Definition: dib.cpp:558
HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal)
Definition: dib.cpp:511
HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
Definition: dib.cpp:257
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:784
#define SW_HIDE
Definition: winuser.h:779
#define WM_CLOSE
Definition: winuser.h:1632
#define WM_PASTE
Definition: winuser.h:1874
#define MAKELPARAM(l, h)
Definition: winuser.h:4019
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1751
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_CUT
Definition: winuser.h:1872
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define FindWindowEx
Definition: winuser.h:5798
#define WM_UNDO
Definition: winuser.h:1876
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define SendMessage
Definition: winuser.h:5863
#define EM_SETSEL
Definition: winuser.h:2029
#define MB_ICONINFORMATION
Definition: winuser.h:813
#define WM_COPY
Definition: winuser.h:1873
#define SW_SHOW
Definition: winuser.h:786
#define WM_CLEAR
Definition: winuser.h:1875
#define DM_REPOSITION
Definition: winuser.h:2111
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 556 of file gui.cpp.

557{
558 const BOOL bReload = TRUE;
559 WORD wCommand = LOWORD(wParam);
560
561 if (!lParam)
562 {
563 switch (wCommand)
564 {
565 case ID_SETTINGS:
567 break;
568
569 case ID_EXIT:
570 PostMessageW(WM_CLOSE, 0, 0);
571 break;
572
573 case ID_SEARCH:
575 break;
576
577 case ID_INSTALL:
579 {
580 if (!m_Selected.IsEmpty())
581 {
583 {
586 }
587 }
588 else
589 {
591 if (App)
592 {
594 }
595 }
596 }
597 break;
598
599 case ID_UNINSTALL:
602 break;
603
604 case ID_MODIFY:
607 break;
608
609 case ID_REGREMOVE:
612 break;
613
614 case ID_REFRESH:
616 break;
617
618 case ID_RESETDB:
619 {
623 break;
624 }
625
626 case ID_HELP:
627 MessageBoxW(L"Help not implemented yet", NULL, MB_OK);
628 break;
629
630 case ID_ABOUT:
631 ShowAboutDlg();
632 break;
633
634 case ID_CHECK_ALL:
636 break;
637
641 break;
642 }
643 }
644}
BOOL IsAvailableEnum(INT x)
Definition: appinfo.h:56
#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:548
void RemoveAll()
Definition: atlcoll.h:748
PVOID GetFocusedItemData()
Definition: appview.cpp:2107
void SetFocusOnSearchBar()
Definition: appview.cpp:1837
BOOL RemoveSelectedAppFromRegistry()
Definition: gui.cpp:271
VOID UpdateApplicationsList(AppsCategories EnumType, BOOL bReload=FALSE, BOOL bCheckAvailable=FALSE)
Definition: gui.cpp:684
BOOL InstallApplication(CAppInfo *Info)
Definition: gui.cpp:843
VOID ShowAboutDlg()
Definition: gui.cpp:544
BOOL UninstallSelectedApp(BOOL bModify)
Definition: gui.cpp:292
unsigned short WORD
Definition: ntddk_ex.h:93
VOID CreateSettingsDlg(HWND hwnd)
BOOL DownloadListOfApplications(const CAtlList< CAppInfo * > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:1145
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:801

◆ 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:726

◆ 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:3641

◆ 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:2008
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:2236
#define VK_LEFT
Definition: winuser.h:2235
#define VK_RIGHT
Definition: winuser.h:2237
#define VK_DOWN
Definition: winuser.h:2238
#define VK_ESCAPE
Definition: winuser.h:2225

◆ 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:4020
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1754
#define WM_VSCROLL
Definition: winuser.h:1755
#define VK_CONTROL
Definition: winuser.h:2214
#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:2213
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 247 of file gui.cpp.

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

◆ 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:1637

◆ 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:5823
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 316 of file gui.cpp.

317{
318 theResult = 0;
319 switch (Msg)
320 {
321 case WM_CREATE:
322 if (!InitControls())
325 break;
326
327 case WM_DESTROY:
328 {
329 hMainWnd = NULL;
331 FreeLogs();
332
333 delete m_ClientPanel;
334
336 return 0;
337 }
338
339 case WM_CLOSE:
341 return g_Busy;
342
344 if (!g_Busy && !IsWindowVisible())
345 SendMessage(WM_CLOSE, 0, 0);
346 break;
347
349 m_PendingInstalledViewRefresh = true; // Something just installed, our uninstall list is probably outdated
351 break;
352
353 case DM_REPOSITION:
354 EmulateDialogReposition(hwnd); // We are not a real dialog, we need help from a real one
355 break;
356
357 case WM_ACTIVATE:
358 if (LOWORD(wParam) == WA_INACTIVE)
360 break;
361
362 case WM_SETFOCUS:
363 if (m_hLastFocus)
365 break;
366
367 case WM_NEXTDLGCTL:
368 if (!LOWORD(lParam))
369 HandleTabOrder(wParam ? -1 : 1);
370 else if (wParam)
372 break;
373
374 case WM_COMMAND:
376 break;
377
378 case WM_NOTIFY:
379 {
381
382 switch (data->code)
383 {
385 {
386 if (data->hwndFrom == m_TreeView->m_hWnd)
387 {
388 // APPWIZ-mode: forbid item collapse.
389 // FIXME: Prevent collapse (COMCTL32 is buggy)
390 // https://bugs.winehq.org/show_bug.cgi?id=53727
392 {
393 theResult = TRUE;
394 return TRUE; // Handled
395 }
396 }
397 break;
398 }
399
400 case TVN_SELCHANGED:
401 {
402 if (data->hwndFrom == m_TreeView->m_hWnd)
403 {
404 switch (((LPNMTREEVIEW)lParam)->itemNew.lParam)
405 {
406 case IDS_INSTALLED:
408 break;
409
410 case IDS_APPLICATIONS:
412 break;
413
414 case IDS_UPDATES:
416 break;
417
420 break;
421
422 case IDS_CAT_AUDIO:
424 break;
425
426 case IDS_CAT_DEVEL:
428 break;
429
430 case IDS_CAT_DRIVERS:
432 break;
433
434 case IDS_CAT_EDU:
436 break;
437
438 case IDS_CAT_ENGINEER:
440 break;
441
442 case IDS_CAT_FINANCE:
444 break;
445
446 case IDS_CAT_GAMES:
448 break;
449
450 case IDS_CAT_GRAPHICS:
452 break;
453
454 case IDS_CAT_INTERNET:
456 break;
457
458 case IDS_CAT_LIBS:
460 break;
461
462 case IDS_CAT_OFFICE:
464 break;
465
466 case IDS_CAT_OTHER:
468 break;
469
470 case IDS_CAT_SCIENCE:
472 break;
473
474 case IDS_CAT_TOOLS:
476 break;
477
478 case IDS_CAT_VIDEO:
480 break;
481
482 case IDS_CAT_THEMES:
484 break;
485
488 break;
489 }
490 }
491 }
492 break;
493 }
494 }
495 break;
496
497 case WM_SIZE:
499 break;
500
501 case WM_SIZING:
502 {
503 LPRECT pRect = (LPRECT)lParam;
504
505 if (pRect->right - pRect->left < 565)
506 pRect->right = pRect->left + 565;
507
508 if (pRect->bottom - pRect->top < 300)
509 pRect->bottom = pRect->top + 300;
510
511 return TRUE;
512 }
513
515 {
516 /* Forward WM_SYSCOLORCHANGE to common controls */
518 m_TreeView->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
519 }
520 break;
521
522 case WM_SETTINGCHANGE:
523 if (wParam == SPI_SETNONCLIENTMETRICS || wParam == SPI_SETICONMETRICS)
524 {
526 g_hDefaultPackageIcon = NULL; // Trigger imagelist recreation on next load
527 }
528 break;
529
530 case WM_TIMER:
531 if (wParam == SEARCH_TIMER_ID)
532 {
534
536 }
537 break;
538 }
539
540 return FALSE;
541}
@ 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:47
@ 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:46
@ 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:61
VOID FreeLogs()
Definition: misc.cpp:310
void RefreshAvailableItem(PCWSTR PackageName)
Definition: appview.cpp:1821
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:767
static bool m_PendingInstalledViewRefresh
Definition: gui.h:69
void HandleTabOrder(int direction)
Definition: gui.cpp:866
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:819
BOOL InitControls()
Definition: gui.cpp:233
static HWND m_hLastFocus
Definition: gui.h:68
struct @1680 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:19
#define WM_NOTIFY_INSTALLERFINISHED
Definition: rapps.h:20
LONG g_Busy
Definition: winmain.cpp:17
#define WM_NOTIFY
Definition: richedit.h:61
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define LPRECT
Definition: precomp.h:28
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WM_CREATE
Definition: winuser.h:1619
#define WM_SETFOCUS
Definition: winuser.h:1624
#define WA_INACTIVE
Definition: winuser.h:2633
#define WM_NEXTDLGCTL
Definition: winuser.h:1654
#define WM_ACTIVATE
Definition: winuser.h:1623
#define WM_SETTINGCHANGE
Definition: winuser.h:1640
#define WM_TIMER
Definition: winuser.h:1753
struct tagNMHDR * LPNMHDR
#define WM_SIZING
Definition: winuser.h:1818
#define WM_DESTROY
Definition: winuser.h:1620
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2390

◆ RemoveSelectedAppFromRegistry()

BOOL CMainWindow::RemoveSelectedAppFromRegistry ( )
private

Definition at line 271 of file gui.cpp.

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

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:222
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 849 of file gui.cpp.

850{
851 if (szSearchPattern == SearchText)
852 {
853 return FALSE;
854 }
855
856 szSearchPattern = SearchText;
857
858 DWORD dwDelay = 0;
859 SystemParametersInfoW(SPI_GETMENUSHOWDELAY, 0, &dwDelay, 0);
860 SetTimer(SEARCH_TIMER_ID, dwDelay);
861
862 return TRUE;
863}
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 544 of file gui.cpp.

545{
546 CStringW szApp;
547 CStringW szAuthors;
548
549 szApp.LoadStringW(IDS_APPTITLE);
550 szAuthors.LoadStringW(IDS_APP_AUTHORS);
551 ShellAboutW(m_hWnd, szApp, szAuthors,
553}
#define IDS_APP_AUTHORS
Definition: resource.h:93
HINSTANCE hInst
Definition: dxdiag.c:13

Referenced by OnCommand().

◆ TrackPopupMenu()

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

Definition at line 1322 of file main.cpp.

1323{
1325 HMENU hSubMenu = ::GetSubMenu(hMenu, iSubMenu);
1326
1329 ptScreen.x, ptScreen.y, 0, m_hWnd, NULL);
1331 if (id != 0)
1333
1334 ::DestroyMenu(hMenu);
1335}
#define ID_POPUPMENU
Definition: resource.h:33
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu)
Definition: main.cpp:1322
int32_t INT_PTR
Definition: typedefs.h:64
#define TPM_RIGHTBUTTON
Definition: winuser.h:2391
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define WM_NULL
Definition: winuser.h:1618
#define PostMessage
Definition: winuser.h:5852
#define TPM_RETURNCMD
Definition: winuser.h:2398

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

◆ UninstallSelectedApp()

BOOL CMainWindow::UninstallSelectedApp ( BOOL  bModify)
private

Definition at line 292 of file gui.cpp.

293{
295 return FALSE;
296
298 if (!InstalledApp)
299 return FALSE;
300
301 return InstalledApp->UninstallApplication(bModify ? UCF_MODIFY : UCF_NONE);
302}
@ UCF_NONE
Definition: appinfo.h:75
@ UCF_MODIFY
Definition: appinfo.h:76
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 684 of file gui.cpp.

685{
686 // Only installed applications should be enumerated in APPWIZ-mode.
687 if (m_bAppwizMode && !IsInstalledEnum(EnumType))
688 {
689 ATLASSERT(FALSE && "Should not be called in APPWIZ-mode");
690 return;
691 }
692
693 bUpdating = TRUE;
694
695 if (HCURSOR hCursor = LoadCursor(NULL, IDC_APPSTARTING))
696 {
697 // The database (.ini files) is parsed on the UI thread, let the user know we are busy
698 SetCursor(hCursor);
700 }
701
702 if (bCheckAvailable)
704
706 {
708 bReload = TRUE; // Reload because we are switching from Available to Installed after something installed
709 }
710
711 BOOL TryRestoreSelection = SelectedEnumType == EnumType;
712 if (SelectedEnumType != EnumType)
713 SelectedEnumType = EnumType;
714
716 if (TryRestoreSelection)
718
719 if (bReload)
721
723 if (IsInstalledEnum(EnumType))
724 {
725 if (bReload)
727
728 // set the display type of application-view. this will remove all the item in application-view too.
730
732 m_Db->GetApps(List, EnumType);
734 }
735 else if (IsAvailableEnum(EnumType))
736 {
737 // We shouldn't get there in APPWIZ-mode.
739
740 if (bReload)
742
743 // set the display type of application-view. this will remove all the item in application-view too.
745
746 // enum available softwares
747 if (EnumType == ENUM_CAT_SELECTED)
748 {
750 }
751 else
752 {
754 m_Db->GetApps(List, EnumType);
756 }
757 }
758 else
759 {
760 ATLASSERT(0 && "This should be unreachable!");
761 }
762
763 if (TryRestoreSelection)
764 m_ApplicationView->RestoreListSelection(RestoreSelection);
766 m_ApplicationView->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN); // force the child window to repaint
768
771 {
772 text.LoadString(IDS_NO_SEARCH_RESULTS);
773 }
775
777}
@ AppViewTypeInstalledApps
Definition: appview.h:72
@ AppViewTypeAvailableApps
Definition: appview.h:71
#define IDS_NO_SEARCH_RESULTS
Definition: resource.h:130
VOID UpdateInstalled()
Definition: appdb.cpp:245
VOID GetApps(CAtlList< CAppInfo * > &List, AppsCategories Type) const
Definition: appdb.cpp:62
VOID GetRestoreListSelectionData(RESTORELISTSELECTION &Restore)
Definition: appview.cpp:2129
VOID RestoreListSelection(const RESTORELISTSELECTION &Restore)
Definition: appview.cpp:2146
BOOL SetDisplayAppType(APPLICATION_VIEW_TYPE AppType)
Definition: appview.cpp:2044
void SetRedraw(BOOL bRedraw)
Definition: appview.cpp:1814
VOID SetWatermark(const CStringW &Text)
Definition: appview.cpp:2095
VOID AddApplicationsToView(CAtlList< CAppInfo * > &List)
Definition: gui.cpp:667
VOID CheckAvailable()
Definition: gui.cpp:305
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:1786
#define RDW_ALLCHILDREN
Definition: winuser.h:1232
#define IDC_APPSTARTING
Definition: winuser.h:707
#define HTCLIENT
Definition: winuser.h:2486
#define LoadCursor
Definition: winuser.h:5832
#define WM_SETCURSOR
Definition: winuser.h:1647
#define RDW_INVALIDATE
Definition: winuser.h:1225

Referenced by OnCommand(), and ProcessWindowMessage().

◆ UpdateStatusBarText()

VOID CMainWindow::UpdateStatusBarText ( )
private

Definition at line 647 of file gui.cpp.

648{
649 if (m_StatusBar)
650 {
651 CStringW szBuffer;
653
654 // Append the number of selected apps if not in APPWIZ-mode.
655 if (!m_bAppwizMode)
656 {
657 CStringW szBuffer2;
659 szBuffer += szBuffer2;
660 }
661
662 m_StatusBar->SetText(szBuffer);
663 }
664}
#define IDS_APPS_COUNT
Definition: resource.h:103
#define IDS_APPS_SELECT_COUNT
Definition: resource.h:104
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

◆ 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_hLastFocus

HWND CMainWindow::m_hLastFocus = NULL
static

Definition at line 68 of file gui.h.

Referenced by ProcessWindowMessage().

◆ m_hMenu

HMENU CMainWindow::m_hMenu
private

Definition at line 42 of file main.h.

Referenced by OnCreate(), and OnDestroy().

◆ m_PendingInstalledViewRefresh

bool CMainWindow::m_PendingInstalledViewRefresh = false
static

Definition at line 69 of file gui.h.

Referenced by ProcessWindowMessage(), and UpdateApplicationsList().

◆ m_Selected

◆ 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

AppsCategories CMainWindow::SelectedEnumType
private

◆ 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: