pulled latest translations from Transifex
[TortoiseGit.git] / src / TortoiseIDiff / MainWindow.h
blobfd5a9af44e33f8b6a3fe9e49b9308b081c5f5158
1 // TortoiseIDiff - an image diff viewer in TortoiseSVN
3 // Copyright (C) 2006-2007,2009, 2011 - 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.
19 #pragma once
20 #include "BaseWindow.h"
21 #include "PicWindow.h"
22 #include "commctrl.h"
23 #include "TortoiseIDiff.h"
25 #define SPLITTER_BORDER 2
27 #define WINDOW_MINHEIGHT 200
28 #define WINDOW_MINWIDTH 200
30 /**
31 * \ingroup TortoiseIDiff
32 * The main window of TortoiseIDiff.
33 * Hosts the two image views, the menu, toolbar, slider, ...
35 class CMainWindow : public CWindow
37 public:
38 CMainWindow(HINSTANCE hInst, const WNDCLASSEX* wcx = NULL) : CWindow(hInst, wcx)
39 , picWindow1(hInst)
40 , picWindow2(hInst)
41 , oldx(-4)
42 , oldy(-4)
43 , bMoved(false)
44 , bDragMode(false)
45 , nSplitterPos(100)
46 , bOverlap(false)
47 , bShowInfo(false)
48 , bVertical(false)
49 , bLinkedPositions(true)
50 , bFitSizes(false)
51 , transparentColor(::GetSysColor(COLOR_WINDOW))
52 , m_BlendType(CPicWindow::BLEND_ALPHA)
54 SetWindowTitle((LPCTSTR)ResString(hResource, IDS_APP_TITLE));
57 /**
58 * Registers the window class and creates the window.
60 bool RegisterAndCreateWindow();
62 /**
63 * Sets the image path and title for the left image view.
65 void SetLeft(tstring leftpath, tstring lefttitle) {leftpicpath=leftpath; leftpictitle=lefttitle;}
66 /**
67 * Sets the image path and the title for the right image view.
69 void SetRight(tstring rightpath, tstring righttitle) {rightpicpath=rightpath; rightpictitle=righttitle;}
71 protected:
72 /// the message handler for this window
73 LRESULT CALLBACK WinMsgHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
74 /// Handles all the WM_COMMAND window messages (e.g. menu commands)
75 LRESULT DoCommand(int id);
77 /// Positions the child windows. Call this after the window sizes/positions have changed.
78 void PositionChildren(RECT * clientrect = NULL);
79 /// Shows the "Open images" dialog where the user can select the images to diff
80 bool OpenDialog();
81 static BOOL CALLBACK OpenDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);
82 static bool AskForFile(HWND owner, TCHAR * path);
84 // splitter methods
85 void DrawXorBar(HDC hdc, int x1, int y1, int width, int height);
86 LRESULT Splitter_OnLButtonDown(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
87 LRESULT Splitter_OnLButtonUp(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
88 LRESULT Splitter_OnMouseMove(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
89 void Splitter_CaptureChanged();
91 // toolbar
92 bool CreateToolbar();
93 HWND hwndTB;
94 HIMAGELIST hToolbarImgList;
96 // command line params
97 static tstring leftpicpath;
98 static tstring leftpictitle;
100 static tstring rightpicpath;
101 static tstring rightpictitle;
103 // image data
104 CPicWindow picWindow1;
105 CPicWindow picWindow2;
106 bool bShowInfo;
107 COLORREF transparentColor;
109 // splitter data
110 int oldx;
111 int oldy;
112 bool bMoved;
113 bool bDragMode;
114 int nSplitterPos;
116 // one/two pane view
117 bool bOverlap;
118 bool bVertical;
119 bool bLinkedPositions;
120 bool bFitSizes;
121 CPicWindow::BlendType m_BlendType;