mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[MSPAINT_NEW] implement fullscreen view
svn path=/trunk/; revision=68733
This commit is contained in:
parent
23b737a8f3
commit
6bc0fd7363
7 changed files with 105 additions and 0 deletions
|
@ -8,6 +8,7 @@ list(APPEND SOURCE
|
|||
dialogs.cpp
|
||||
dib.cpp
|
||||
drawing.cpp
|
||||
fullscreen.cpp
|
||||
history.cpp
|
||||
imgarea.cpp
|
||||
main.cpp
|
||||
|
|
61
reactos/base/applications/mspaint_new/fullscreen.cpp
Normal file
61
reactos/base/applications/mspaint_new/fullscreen.cpp
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* PROJECT: PAINT for ReactOS
|
||||
* LICENSE: LGPL
|
||||
* FILE: base/applications/mspaint_new/fullscreen.cpp
|
||||
* PURPOSE: Window for fullscreen view
|
||||
* PROGRAMMERS: Benedikt Freisen
|
||||
*/
|
||||
|
||||
/* INCLUDES *********************************************************/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
LRESULT CFullscreenWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON)));
|
||||
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CFullscreenWindow::OnCloseOrKeyDownOrLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
mainWindow.ShowWindow(SW_SHOW);
|
||||
ShowWindow(SW_HIDE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CFullscreenWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC = BeginPaint(&ps);
|
||||
RECT rcWnd;
|
||||
GetWindowRect(&rcWnd);
|
||||
INT cxDest = imageModel.GetWidth();
|
||||
INT cyDest = imageModel.GetHeight();
|
||||
INT xDest = (rcWnd.right - rcWnd.left - cxDest) / 2;
|
||||
INT yDest = (rcWnd.bottom - rcWnd.top - cyDest) / 2;
|
||||
BitBlt(hDC, xDest, yDest, cxDest, cyDest, imageModel.GetDC(), 0, 0, SRCCOPY);
|
||||
EndPaint(&ps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CFullscreenWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
Invalidate(TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CFullscreenWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CFullscreenWindow::OnGetText(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
// return caption of the main window, instead
|
||||
return mainWindow.SendMessage(nMsg, wParam, lParam);
|
||||
}
|
31
reactos/base/applications/mspaint_new/fullscreen.h
Normal file
31
reactos/base/applications/mspaint_new/fullscreen.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* PROJECT: PAINT for ReactOS
|
||||
* LICENSE: LGPL
|
||||
* FILE: base/applications/mspaint_new/fullscreen.h
|
||||
* PURPOSE: Window for fullscreen view
|
||||
* PROGRAMMERS: Benedikt Freisen
|
||||
*/
|
||||
|
||||
class CFullscreenWindow : public CWindowImpl<CFullscreenWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("FullscreenWindow"), CS_DBLCLKS, COLOR_BACKGROUND)
|
||||
|
||||
BEGIN_MSG_MAP(CFullscreenWindow)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
MESSAGE_HANDLER(WM_CLOSE, OnCloseOrKeyDownOrLButtonDown)
|
||||
MESSAGE_HANDLER(WM_KEYDOWN, OnCloseOrKeyDownOrLButtonDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnCloseOrKeyDownOrLButtonDown)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
||||
MESSAGE_HANDLER(WM_GETTEXT, OnGetText)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnCloseOrKeyDownOrLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnGetText(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
};
|
|
@ -73,6 +73,7 @@ extern BOOL showGrid;
|
|||
extern BOOL showMiniature;
|
||||
|
||||
class CMainWindow;
|
||||
class CFullscreenWindow;
|
||||
class CMiniatureWindow;
|
||||
class CToolBox;
|
||||
class CToolSettingsWindow;
|
||||
|
@ -84,6 +85,7 @@ class CSizeboxWindow;
|
|||
class CTextEditWindow;
|
||||
|
||||
extern CMainWindow mainWindow;
|
||||
extern CFullscreenWindow fullscreenWindow;
|
||||
extern CMiniatureWindow miniature;
|
||||
extern CToolBox toolBoxContainer;
|
||||
extern CToolSettingsWindow toolSettingsWindow;
|
||||
|
|
|
@ -66,6 +66,7 @@ BOOL showGrid = FALSE;
|
|||
BOOL showMiniature = FALSE;
|
||||
|
||||
CMainWindow mainWindow;
|
||||
CFullscreenWindow fullscreenWindow;
|
||||
CMiniatureWindow miniature;
|
||||
CToolBox toolBoxContainer;
|
||||
CToolSettingsWindow toolSettingsWindow;
|
||||
|
@ -145,6 +146,9 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument
|
|||
RECT mainWindowPos = {0, 0, 544, 375}; // FIXME: use equivalent of CW_USEDEFAULT for position
|
||||
hwnd = mainWindow.Create(HWND_DESKTOP, mainWindowPos, progtitle, WS_OVERLAPPEDWINDOW);
|
||||
|
||||
RECT fullscreenWindowPos = {0, 0, 100, 100};
|
||||
fullscreenWindow.Create(HWND_DESKTOP, fullscreenWindowPos, NULL, WS_POPUPWINDOW | WS_MAXIMIZE);
|
||||
|
||||
RECT miniaturePos = {(LONG) registrySettings.ThumbXPos, (LONG) registrySettings.ThumbYPos,
|
||||
(LONG) registrySettings.ThumbXPos + (LONG) registrySettings.ThumbWidth,
|
||||
(LONG) registrySettings.ThumbYPos + (LONG) registrySettings.ThumbHeight};
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "definitions.h"
|
||||
#include "drawing.h"
|
||||
#include "dib.h"
|
||||
#include "fullscreen.h"
|
||||
#include "globalvar.h"
|
||||
#include "history.h"
|
||||
#include "imgarea.h"
|
||||
|
|
|
@ -613,6 +613,11 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
|||
case IDM_VIEWZOOM800:
|
||||
zoomTo(8000, 0, 0);
|
||||
break;
|
||||
|
||||
case IDM_VIEWFULLSCREEN:
|
||||
fullscreenWindow.ShowWindow(SW_SHOW);
|
||||
ShowWindow(SW_HIDE);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue