[MSPAINT] Realize context menu on canvas (#5352)

- Add actions on Right-Click.
- Add ID_POPUPMENU resource menu.
- Use TrackPopupMenu to show the context menu.
- Improve CMainWindow::OnInitMenuPopup to display context menu.
- Add SelectionModel::m_bContentChanged flag to indicate whether the selection content is changed.
- Fix IDM_IMAGEINVERTCOLORS and IDM_IMAGEROTATEMIRROR commands.
CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-19 07:51:19 +09:00 committed by GitHub
parent 0972f71d9a
commit 7aadc1e1fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 725 additions and 62 deletions

View file

@ -272,6 +272,11 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
CanvasToImage(pt);
StartSelectionDrag(hitSelection, pt);
}
else
{
canvasWindow.ClientToScreen(&pt);
mainWindow.TrackPopupMenu(pt, 0);
}
return 0;
}

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -102,6 +102,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -92,6 +92,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -92,6 +92,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -92,6 +92,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -92,6 +92,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -78,7 +78,7 @@ BEGIN
POPUP "画像(&I)"
BEGIN
MENUITEM "回転と反転(&M)\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "伸縮/傾斜(&S)\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "伸縮傾斜(&S)\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "切り取り(&C)", IDM_IMAGECROP
MENUITEM "色の反転(&I)\tCtrl+I", IDM_IMAGEINVERTCOLORS
MENUITEM "画像の属性(&A)\tCtrl+E", IDM_IMAGEATTRIBUTES
@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "切り取り(&T)\tCtrl+X", IDM_EDITCUT
MENUITEM "コピー(&C)\tCtrl+C", IDM_EDITCOPY
MENUITEM "貼り付け(&P)\tCtrl+V", IDM_EDITPASTE
MENUITEM "選択範囲の削除(&L)\tDel", IDM_EDITDELETESELECTION
MENUITEM "すべて選択(&A)\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "ファイルへコピー(&O)...", IDM_EDITCOPYTO
MENUITEM "ファイルから貼り付け(&F)...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "回転と反転(&M)\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "伸縮と傾斜(&S)\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "色の反転(&I)\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -101,6 +101,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^O", IDM_FILENEW

View file

@ -101,6 +101,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -92,6 +92,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -101,6 +101,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -92,6 +92,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -102,6 +102,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -100,6 +100,25 @@ BEGIN
END
END
ID_POPUPMENU MENU
BEGIN
POPUP "Popup #0"
BEGIN
MENUITEM "C&ut\tCtrl+X", IDM_EDITCUT
MENUITEM "Copy\tCtrl+C", IDM_EDITCOPY
MENUITEM "&Paste\tCtrl+V", IDM_EDITPASTE
MENUITEM "De&lete selection\tDel", IDM_EDITDELETESELECTION
MENUITEM "Select &All\tCtrl+A", IDM_EDITSELECTALL
MENUITEM SEPARATOR
MENUITEM "C&opy to...", IDM_EDITCOPYTO
MENUITEM "Paste &from...", IDM_EDITPASTEFROM
MENUITEM SEPARATOR
MENUITEM "Rotate/&Mirror...\tCtrl+R", IDM_IMAGEROTATEMIRROR
MENUITEM "&Stretch/Skew...\tCtrl+W", IDM_IMAGESTRETCHSKEW
MENUITEM "&Invert colors\tCtrl+I", IDM_IMAGEINVERTCOLORS
END
END
ID_ACCELERATORS ACCELERATORS
BEGIN
"^N", IDM_FILENEW

View file

@ -181,6 +181,12 @@ struct FreeSelTool : ToolBase
}
imageModel.NotifyImageChanged();
}
else
{
POINT pt = { x, y };
canvasWindow.ClientToScreen(&pt);
mainWindow.TrackPopupMenu(pt, 0);
}
}
void OnFinishDraw() override
@ -249,14 +255,19 @@ struct RectSelTool : ToolBase
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
{
POINT pt = { x, y };
if (bLeftButton)
{
POINT pt = { x, y };
imageModel.Bound(pt);
selectionModel.SetRectFromPoints(g_ptStart, pt);
selectionModel.m_bShow = !selectionModel.m_rc.IsRectEmpty();
imageModel.NotifyImageChanged();
}
else
{
canvasWindow.ClientToScreen(&pt);
mainWindow.TrackPopupMenu(pt, 0);
}
}
void OnFinishDraw() override
@ -565,10 +576,13 @@ struct TextTool : ToolBase
selectionModel.SetRectFromPoints(g_ptStart, pt);
BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);
if (bTextBoxShown && textEditWindow.GetWindowTextLength() > 0)
if (bTextBoxShown)
{
if (textEditWindow.GetWindowTextLength() > 0)
{
imageModel.PushImageForUndo();
draw(m_hdc);
}
if (::IsRectEmpty(&selectionModel.m_rc))
{
quit();
@ -610,9 +624,12 @@ struct TextTool : ToolBase
}
void OnFinishDraw() override
{
if (textEditWindow.GetWindowTextLength() > 0)
{
imageModel.PushImageForUndo();
draw(m_hdc);
}
quit();
ToolBase::OnFinishDraw();
}

View file

@ -30,6 +30,7 @@
#define IDI_VERTSKEW 538
#define ID_MENU 501
#define ID_POPUPMENU 502
#define IDM_FILENEW 201
#define IDM_FILEOPEN 202

View file

@ -19,6 +19,7 @@ SelectionModel::SelectionModel()
, m_ptStack(NULL)
, m_iPtSP(0)
, m_bShow(FALSE)
, m_bContentChanged(FALSE)
{
::SetRectEmpty(&m_rc);
::SetRectEmpty(&m_rcOld);
@ -123,6 +124,14 @@ void SelectionModel::DrawBackgroundRect(HDC hDCImage, COLORREF crBg)
Rect(hDCImage, m_rcOld.left, m_rcOld.top, m_rcOld.right, m_rcOld.bottom, crBg, crBg, 0, 1);
}
void SelectionModel::DrawBackground(HDC hDCImage)
{
if (toolsModel.GetActiveTool() == TOOL_FREESEL)
DrawBackgroundPoly(hDCImage, paletteModel.GetBgColor());
else
DrawBackgroundRect(hDCImage, paletteModel.GetBgColor());
}
void SelectionModel::DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTransparent)
{
CRect rc = m_rc;
@ -187,7 +196,8 @@ void SelectionModel::Landing()
m_bShow = FALSE;
if (!::EqualRect(m_rc, m_rcOld) && !::IsRectEmpty(m_rc) && !::IsRectEmpty(m_rcOld))
if (m_bContentChanged ||
(!::EqualRect(m_rc, m_rcOld) && !::IsRectEmpty(m_rc) && !::IsRectEmpty(m_rcOld)))
{
imageModel.PushImageForUndo();
@ -208,9 +218,7 @@ void SelectionModel::InsertFromHBITMAP(HBITMAP hBm, INT x, INT y)
m_rc.right = x + GetDIBWidth(hBm);
m_rc.bottom = y + GetDIBHeight(hBm);
// If m_rc and m_rcOld were same, the image cannot be pasted to the canvas.
// See also SelectionModel::Landing
::SetRect(&m_rcOld, -2, -2, -1, -1); // Outside of image
NotifyContentChanged();
ClearMask();
}
@ -234,7 +242,7 @@ void SelectionModel::FlipHorizontally()
}
::DeleteDC(hdcMem);
imageModel.NotifyImageChanged();
NotifyContentChanged();
}
void SelectionModel::FlipVertically()
@ -256,7 +264,7 @@ void SelectionModel::FlipVertically()
}
::DeleteDC(hdcMem);
imageModel.NotifyImageChanged();
NotifyContentChanged();
}
void SelectionModel::RotateNTimes90Degrees(int iN)
@ -267,9 +275,10 @@ void SelectionModel::RotateNTimes90Degrees(int iN)
switch (iN)
{
case 1:
case 3:
case 1: /* rotate 90 degrees */
case 3: /* rotate 270 degrees */
TakeOff();
if (m_hbmColor)
{
hbmOld = ::SelectObject(hdcMem, m_hbmColor);
@ -286,10 +295,13 @@ void SelectionModel::RotateNTimes90Degrees(int iN)
::DeleteObject(m_hbmMask);
m_hbmMask = hbm;
}
SwapWidthAndHeight();
break;
case 2:
case 2: /* rotate 180 degrees */
TakeOff();
if (m_hbmColor)
{
hbmOld = ::SelectObject(hdcMem, m_hbmColor);
@ -308,7 +320,7 @@ void SelectionModel::RotateNTimes90Degrees(int iN)
}
::DeleteDC(hdcMem);
imageModel.NotifyImageChanged();
NotifyContentChanged();
}
void SelectionModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY)
@ -351,7 +363,7 @@ void SelectionModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int
::DeleteDC(hDC);
m_bShow = TRUE;
imageModel.NotifyImageChanged();
NotifyContentChanged();
}
HBITMAP SelectionModel::CopyBitmap()
@ -442,12 +454,11 @@ void SelectionModel::ClearColor()
void SelectionModel::HideSelection()
{
m_bShow = FALSE;
m_bShow = m_bContentChanged = FALSE;
ClearColor();
ClearMask();
::SetRectEmpty(&m_rc);
::SetRectEmpty(&m_rcOld);
imageModel.NotifyImageChanged();
}
@ -457,12 +468,39 @@ void SelectionModel::DeleteSelection()
return;
TakeOff();
imageModel.PushImageForUndo();
if (toolsModel.GetActiveTool() == TOOL_FREESEL)
DrawBackgroundPoly(imageModel.GetDC(), paletteModel.GetBgColor());
else
DrawBackgroundRect(imageModel.GetDC(), paletteModel.GetBgColor());
DrawBackground(imageModel.GetDC());
HideSelection();
}
void SelectionModel::InvertSelection()
{
TakeOff();
BITMAP bm;
::GetObject(m_hbmColor, sizeof(bm), &bm);
HDC hdc = ::CreateCompatibleDC(NULL);
HGDIOBJ hbmOld = ::SelectObject(hdc, m_hbmColor);
RECT rc = { 0, 0, bm.bmWidth, bm.bmHeight };
::InvertRect(hdc, &rc);
::SelectObject(hdc, hbmOld);
::DeleteDC(hdc);
NotifyContentChanged();
}
void SelectionModel::NotifyContentChanged()
{
m_bContentChanged = TRUE;
imageModel.NotifyImageChanged();
}
void SelectionModel::SwapWidthAndHeight()
{
INT cx = m_rc.Width();
INT cy = m_rc.Height();
m_rc.right = m_rc.left + cy;
m_rc.bottom = m_rc.top + cx;
}

View file

@ -20,6 +20,7 @@ private:
public:
COLORREF m_rgbBack = RGB(255, 255, 255);
BOOL m_bShow;
BOOL m_bContentChanged;
CRect m_rc; // in image pixel coordinates
POINT m_ptHit; // in image pixel coordinates
CRect m_rcOld; // in image pixel coordinates
@ -42,6 +43,7 @@ public:
HBITMAP CopyBitmap();
void GetSelectionContents(HDC hDCImage);
void DrawFramePoly(HDC hDCImage);
void DrawBackground(HDC hDCImage);
void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg);
void DrawBackgroundRect(HDC hDCImage, COLORREF crBg);
void DrawSelection(HDC hDCImage, COLORREF crBg = 0, BOOL bBgTransparent = FALSE);
@ -52,14 +54,17 @@ public:
void FlipVertically();
void RotateNTimes90Degrees(int iN);
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY);
void InvertSelection();
void Dragging(CANVAS_HITTEST hit, POINT pt);
void ClearMask();
void ClearColor();
void NotifyContentChanged();
private:
SelectionModel(const SelectionModel&);
SelectionModel& operator=(const SelectionModel&);
void ShiftPtStack(INT dx, INT dy);
void SwapWidthAndHeight();
};

View file

@ -424,16 +424,21 @@ LRESULT CMainWindow::OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BO
((toolsModel.GetActiveTool() == TOOL_FREESEL) || (toolsModel.GetActiveTool() == TOOL_RECTSEL)));
BOOL textShown = (toolsModel.GetActiveTool() == TOOL_TEXT && ::IsWindowVisible(textEditWindow));
DWORD dwStart = 0, dwEnd = 0;
if (::IsWindowVisible(textEditWindow))
if (textShown)
textEditWindow.SendMessage(EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
BOOL hasTextSel = (dwStart < dwEnd);
switch (lParam)
//
// File menu
//
if (::GetSubMenu(GetMenu(), 0) == menu)
{
case 0: /* File menu */
ProcessFileMenu((HMENU)wParam);
break;
case 1: /* Edit menu */
ProcessFileMenu(menu);
}
//
// Edit menu
//
EnableMenuItem(menu, IDM_EDITUNDO,
ENABLED_IF(textShown ? textEditWindow.SendMessage(EM_CANUNDO) : imageModel.CanUndo()));
EnableMenuItem(menu, IDM_EDITREDO, ENABLED_IF(textShown ? FALSE : imageModel.CanRedo()));
@ -448,23 +453,15 @@ LRESULT CMainWindow::OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BO
::IsClipboardFormatAvailable(CF_ENHMETAFILE) ||
::IsClipboardFormatAvailable(CF_DIB) ||
::IsClipboardFormatAvailable(CF_BITMAP)));
break;
case 2: /* View menu */
//
// View menu
//
CheckMenuItem(menu, IDM_VIEWTOOLBOX, CHECKED_IF(::IsWindowVisible(toolBoxContainer)));
CheckMenuItem(menu, IDM_VIEWCOLORPALETTE, CHECKED_IF(::IsWindowVisible(paletteWindow)));
CheckMenuItem(menu, IDM_VIEWSTATUSBAR, CHECKED_IF(::IsWindowVisible(g_hStatusBar)));
CheckMenuItem(menu, IDM_FORMATICONBAR, CHECKED_IF(::IsWindowVisible(fontsDialog)));
EnableMenuItem(menu, IDM_FORMATICONBAR, ENABLED_IF(toolsModel.GetActiveTool() == TOOL_TEXT));
CheckMenuItem(menu, IDM_VIEWSHOWGRID, CHECKED_IF(g_showGrid));
CheckMenuItem(menu, IDM_VIEWSHOWMINIATURE, CHECKED_IF(registrySettings.ShowThumbnail));
break;
case 3: /* Image menu */
EnableMenuItem(menu, IDM_IMAGECROP, ENABLED_IF(selectionModel.m_bShow));
CheckMenuItem(menu, IDM_IMAGEDRAWOPAQUE, CHECKED_IF(!toolsModel.IsBackgroundTransparent()));
break;
}
CheckMenuItem(menu, IDM_VIEWZOOM125, CHECKED_IF(toolsModel.GetZoom() == 125));
CheckMenuItem(menu, IDM_VIEWZOOM25, CHECKED_IF(toolsModel.GetZoom() == 250));
CheckMenuItem(menu, IDM_VIEWZOOM50, CHECKED_IF(toolsModel.GetZoom() == 500));
@ -472,7 +469,19 @@ LRESULT CMainWindow::OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BO
CheckMenuItem(menu, IDM_VIEWZOOM200, CHECKED_IF(toolsModel.GetZoom() == 2000));
CheckMenuItem(menu, IDM_VIEWZOOM400, CHECKED_IF(toolsModel.GetZoom() == 4000));
CheckMenuItem(menu, IDM_VIEWZOOM800, CHECKED_IF(toolsModel.GetZoom() == 8000));
CheckMenuItem(menu, IDM_VIEWSHOWGRID, CHECKED_IF(g_showGrid));
CheckMenuItem(menu, IDM_VIEWSHOWMINIATURE, CHECKED_IF(registrySettings.ShowThumbnail));
//
// Image menu
//
EnableMenuItem(menu, IDM_IMAGECROP, ENABLED_IF(selectionModel.m_bShow));
EnableMenuItem(menu, IDM_IMAGEDELETEIMAGE, ENABLED_IF(!selectionModel.m_bShow));
CheckMenuItem(menu, IDM_IMAGEDRAWOPAQUE, CHECKED_IF(!toolsModel.IsBackgroundTransparent()));
//
// Palette menu
//
CheckMenuItem(menu, IDM_COLORSMODERNPALETTE, CHECKED_IF(paletteModel.SelectedPalette() == PAL_MODERN));
CheckMenuItem(menu, IDM_COLORSOLDPALETTE, CHECKED_IF(paletteModel.SelectedPalette() == PAL_OLDTYPE));
return 0;
@ -858,6 +867,9 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
break;
case IDM_IMAGEINVERTCOLORS:
{
if (selectionModel.m_bShow)
selectionModel.InvertSelection();
else
imageModel.InvertColors();
break;
}
@ -997,8 +1009,22 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
// Create and show the fullscreen window
fullscreenWindow.DoCreate();
fullscreenWindow.ShowWindow(SW_SHOWMAXIMIZED);
ShowWindow(SW_HIDE);
break;
}
return 0;
}
VOID CMainWindow::TrackPopupMenu(POINT ptScreen, INT iSubMenu)
{
HMENU hMenu = ::LoadMenuW(g_hinstExe, MAKEINTRESOURCEW(ID_POPUPMENU));
HMENU hSubMenu = ::GetSubMenu(hMenu, iSubMenu);
::SetForegroundWindow(m_hWnd);
INT_PTR id = ::TrackPopupMenu(hSubMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD,
ptScreen.x, ptScreen.y, 0, m_hWnd, NULL);
PostMessage(WM_NULL);
if (id != 0)
PostMessage(WM_COMMAND, id);
::DestroyMenu(hMenu);
}

View file

@ -34,6 +34,7 @@ public:
BOOL GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile);
BOOL GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile);
BOOL ChooseColor(IN OUT COLORREF *prgbColor);
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu);
private:
HMENU m_hMenu;