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
)
54 , hToolbarImgList(NULL
)
56 SetWindowTitle((LPCTSTR
)ResString(hResource
, IDS_APP_TITLE
));
60 * Registers the window class and creates the window.
62 bool RegisterAndCreateWindow();
65 * Sets the image path and title for the left image view.
67 void SetLeft(tstring leftpath
, tstring lefttitle
) {leftpicpath
=leftpath
; leftpictitle
=lefttitle
;}
69 * Sets the image path and the title for the right image view.
71 void SetRight(tstring rightpath
, tstring righttitle
) {rightpicpath
=rightpath
; rightpictitle
=righttitle
;}
74 /// the message handler for this window
75 LRESULT CALLBACK
WinMsgHandler(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
76 /// Handles all the WM_COMMAND window messages (e.g. menu commands)
77 LRESULT
DoCommand(int id
);
79 /// Positions the child windows. Call this after the window sizes/positions have changed.
80 void PositionChildren(RECT
* clientrect
= NULL
);
81 /// Shows the "Open images" dialog where the user can select the images to diff
83 static BOOL CALLBACK
OpenDlgProc(HWND hwndDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
);
84 static bool AskForFile(HWND owner
, TCHAR
* path
);
87 void DrawXorBar(HDC hdc
, int x1
, int y1
, int width
, int height
);
88 LRESULT
Splitter_OnLButtonDown(HWND hwnd
, UINT iMsg
, WPARAM wParam
, LPARAM lParam
);
89 LRESULT
Splitter_OnLButtonUp(HWND hwnd
, UINT iMsg
, WPARAM wParam
, LPARAM lParam
);
90 LRESULT
Splitter_OnMouseMove(HWND hwnd
, UINT iMsg
, WPARAM wParam
, LPARAM lParam
);
91 void Splitter_CaptureChanged();
96 HIMAGELIST hToolbarImgList
;
98 // command line params
99 static tstring leftpicpath
;
100 static tstring leftpictitle
;
102 static tstring rightpicpath
;
103 static tstring rightpictitle
;
106 CPicWindow picWindow1
;
107 CPicWindow picWindow2
;
109 COLORREF transparentColor
;
121 bool bLinkedPositions
;
123 CPicWindow::BlendType m_BlendType
;