1 // TortoiseIDiff - an image diff viewer in TortoiseSVN
3 // Copyright (C) 2006-2007,2009, 2011-2012 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "BaseWindow.h"
21 #include "PicWindow.h"
23 #include "TortoiseIDiff.h"
25 #define SPLITTER_BORDER 2
27 #define WINDOW_MINHEIGHT 200
28 #define WINDOW_MINWIDTH 200
31 * \ingroup TortoiseIDiff
32 * The main window of TortoiseIDiff.
33 * Hosts the two image views, the menu, toolbar, slider, ...
35 class CMainWindow
: public CWindow
38 CMainWindow(HINSTANCE hInst
, const WNDCLASSEX
* wcx
= NULL
) : CWindow(hInst
, wcx
)
49 , bLinkedPositions(true)
51 , transparentColor(::GetSysColor(COLOR_WINDOW
))
52 , m_BlendType(CPicWindow::BLEND_ALPHA
)
55 SetWindowTitle((LPCTSTR
)ResString(hResource
, IDS_APP_TITLE
));
59 * Registers the window class and creates the window.
61 bool RegisterAndCreateWindow();
64 * Sets the image path and title for the left image view.
66 void SetLeft(tstring leftpath
, tstring lefttitle
) {leftpicpath
=leftpath
; leftpictitle
=lefttitle
;}
68 * Sets the image path and the title for the right image view.
70 void SetRight(tstring rightpath
, tstring righttitle
) {rightpicpath
=rightpath
; rightpictitle
=righttitle
;}
73 /// the message handler for this window
74 LRESULT CALLBACK
WinMsgHandler(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
75 /// Handles all the WM_COMMAND window messages (e.g. menu commands)
76 LRESULT
DoCommand(int id
);
78 /// Positions the child windows. Call this after the window sizes/positions have changed.
79 void PositionChildren(RECT
* clientrect
= NULL
);
80 /// Shows the "Open images" dialog where the user can select the images to diff
82 static BOOL CALLBACK
OpenDlgProc(HWND hwndDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
);
83 static bool AskForFile(HWND owner
, TCHAR
* path
);
86 void DrawXorBar(HDC hdc
, int x1
, int y1
, int width
, int height
);
87 LRESULT
Splitter_OnLButtonDown(HWND hwnd
, UINT iMsg
, WPARAM wParam
, LPARAM lParam
);
88 LRESULT
Splitter_OnLButtonUp(HWND hwnd
, UINT iMsg
, WPARAM wParam
, LPARAM lParam
);
89 LRESULT
Splitter_OnMouseMove(HWND hwnd
, UINT iMsg
, WPARAM wParam
, LPARAM lParam
);
90 void Splitter_CaptureChanged();
95 HIMAGELIST hToolbarImgList
;
97 // command line params
98 static tstring leftpicpath
;
99 static tstring leftpictitle
;
101 static tstring rightpicpath
;
102 static tstring rightpictitle
;
105 CPicWindow picWindow1
;
106 CPicWindow picWindow2
;
108 COLORREF transparentColor
;
120 bool bLinkedPositions
;
122 CPicWindow::BlendType m_BlendType
;