Skip to content

Commit

Permalink
Fix the issue where the caption set in the header bar is restored whe…
Browse files Browse the repository at this point in the history
…n the window is resized.
  • Loading branch information
sdottaka committed Nov 5, 2023
1 parent 3ffacf8 commit 14e9924
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
9 changes: 8 additions & 1 deletion Src/HexMergeDoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ class CHexMergeDoc : public CDocument, public IMergeDoc
void ChangeFile(int nBuffer, const String& path, int nLineIndex = -1);
void CheckFileChanged(void) override;
String GetDescription(int pane) const override { return m_strDesc[pane]; };
void SetDescription(int pane, const String& strDesc) { m_strDesc[pane] = strDesc; };
void SetDescription(int pane, const String& strDesc) {
if (m_strDesc[pane] != strDesc)
{
m_strDesc[pane] = strDesc;
if (m_nBufferType[pane] == BUFFERTYPE::NORMAL)
m_nBufferType[pane] = BUFFERTYPE::NORMAL_NAMED;
}
}
void SaveAs(int nBuffer, bool packing = true) { DoFileSaveAs(nBuffer, packing); }
String GetSaveAsPath() const { return m_strSaveAsPath; }
void SetSaveAsPath(const String& strSaveAsPath) { m_strSaveAsPath = strSaveAsPath; }
Expand Down
9 changes: 7 additions & 2 deletions Src/ImgMergeFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,13 @@ int CImgMergeFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
m_pImgMergeWindow->SetActivePane(pane);
});
m_wndFilePathBar.SetOnCaptionChangedCallback([&](int pane, const String& sText) {
m_strDesc[pane] = sText;
UpdateHeaderPath(pane);
if (m_strDesc[pane] != sText)
{
m_strDesc[pane] = sText;
if (m_nBufferType[pane] == BUFFERTYPE::NORMAL)
m_nBufferType[pane] = BUFFERTYPE::NORMAL_NAMED;
UpdateHeaderPath(pane);
}
});
m_wndFilePathBar.SetOnFileSelectedCallback([&](int pane, const String& sFilepath) {
ChangeFile(pane, sFilepath);
Expand Down
9 changes: 8 additions & 1 deletion Src/MergeDoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,14 @@ class CMergeDoc : public CDocument, public IMergeDoc
bool HasSyncPoints();
std::vector<std::vector<int> > GetSyncPointList();
String GetDescription(int pane) const override { return m_strDesc[pane]; }
void SetDescription(int pane, const String& sText) { m_strDesc[pane] = sText; }
void SetDescription(int pane, const String& sText) {
if (m_strDesc[pane] != sText)
{
m_strDesc[pane] = sText;
if (m_nBufferType[pane] == BUFFERTYPE::NORMAL)
m_nBufferType[pane] = BUFFERTYPE::NORMAL_NAMED;
}
}

// Overrides
// ClassWizard generated virtual function overrides
Expand Down
9 changes: 7 additions & 2 deletions Src/WebPageDiffFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,13 @@ int CWebPageDiffFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
m_pWebDiffWindow->SetActivePane(pane);
});
m_wndFilePathBar.SetOnCaptionChangedCallback([&](int pane, const String& sText) {
m_strDesc[pane] = sText;
UpdateHeaderPath(pane);
if (m_strDesc[pane] != sText)
{
m_strDesc[pane] = sText;
if (m_nBufferType[pane] == BUFFERTYPE::NORMAL)
m_nBufferType[pane] = BUFFERTYPE::NORMAL_NAMED;
UpdateHeaderPath(pane);
}
});

// Merge frame also has a dockable bar at the very left
Expand Down

0 comments on commit 14e9924

Please sign in to comment.