OSDN Git Service

Fix a crash problem when the Diff algorithm is set to something other than default...
[winmerge-jp/winmerge-jp.git] / Src / MergeStatusBar.h
1 /////////////////////////////////////////////////////////////////////////////
2 //    WinMerge:  an interactive diff/merge utility
3 //    Copyright (C) 1997  Dean P. Grimm
4 //    SPDX-License-Identifier: GPL-2.0-or-later
5 /////////////////////////////////////////////////////////////////////////////
6 /** 
7  * @file  MergeStatusBar.h
8  *
9  * @brief Interface of the CMergeStatusBar class.
10  *
11  */
12 #pragma once
13
14 #include "MergeEditStatus.h"
15 #include "OptionsDiffColors.h"
16 #include "UnicodeString.h"
17
18 class CMergeStatusBar : public CStatusBar
19 {
20 public : 
21         CMergeStatusBar();
22         ~CMergeStatusBar();
23
24         BOOL Create(CWnd* pParentWnd);
25         void Resize(int widths[]);
26         void SetPaneCount(int nPanes) { m_nPanes = nPanes; }
27         void UpdateResources();
28         IMergeEditStatus* GetIMergeEditStatus(int nPane) { return &m_status[nPane]; }
29         void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
30
31 protected:
32         afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
33         DECLARE_MESSAGE_MAP();
34
35 private:
36         // this dialog uses custom edit boxes
37         int m_nPanes;
38         COLORSETTINGS m_cachedColors;
39         bool m_bDiff[4];
40         unsigned m_dispFlags[4];
41
42 protected:
43         // Object that displays status line info for one side of a merge view
44         class MergeStatus : public IMergeEditStatus
45         {
46         public:
47                 // ctr
48                 MergeStatus();
49                 // Implement MergeEditStatus
50                 void SetLineInfo(const tchar_t* szLine, int nColumn, int nColumns,
51                         int nChar, int nChars, int nSelectedLines, int nSelectedChars, const tchar_t* szEol, int nCodepage, bool bHasBom) override;
52                 void UpdateResources();
53         protected:
54                 void Update();
55         public:
56                 CMergeStatusBar* m_pWndStatusBar;
57                 int m_base; /**< 0 for left, 1 for right */
58         private:
59                 String m_sLine;
60                 int m_nColumn; /**< Current column, tab-expanded */
61                 int m_nColumns; /**< Amount of columns, tab-expanded */
62                 int m_nChar; /**< Current char */
63                 int m_nChars; /**< Amount of chars in line */
64                 int m_nCodepage;
65                 int m_nSelectedLines;
66                 int m_nSelectedChars;
67                 bool m_bHasBom;
68                 String m_sEol;
69                 String m_sEolDisplay;
70                 String m_sCodepageName;
71         };
72         friend class MergeStatus; // MergeStatus accesses status bar
73         MergeStatus m_status[3];
74 };