Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP #2663

Draft
wants to merge 66 commits into
base: master
Choose a base branch
from
Draft

WIP #2663

Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
d8c4f96
WIP
sdottaka Feb 2, 2025
2fe6978
WIP
sdottaka Feb 2, 2025
544e287
Merge branch 'master' into outputpane
sdottaka Feb 3, 2025
7d4d687
WIP
sdottaka Feb 4, 2025
3c6ffd8
WIP
sdottaka Feb 7, 2025
573cc49
Merge branch 'master' into outputpane
sdottaka Feb 11, 2025
b36f66f
WIP
sdottaka Feb 11, 2025
b5f0e47
Merge branch 'master' into outputpane
sdottaka Feb 11, 2025
d64a0fa
WIP
sdottaka Feb 11, 2025
74339bc
Merge branch 'master' into outputpane
sdottaka Feb 16, 2025
554ff77
Merge branch 'master' into outputpane
sdottaka Feb 18, 2025
a8da1cf
WIP
sdottaka Feb 21, 2025
0897948
Merge remote-tracking branch 'origin/master' into outputpane
sdottaka Feb 21, 2025
be97622
WIP
sdottaka Feb 23, 2025
649aa76
Merge branch 'master' into outputpane
sdottaka Feb 23, 2025
f83f09d
WIP
sdottaka Feb 23, 2025
7231233
WIP
sdottaka Feb 23, 2025
3a0999d
WIP
sdottaka Feb 24, 2025
e673ce6
Merge branch 'master' into outputpane
sdottaka Feb 24, 2025
77a8fd6
WIP
sdottaka Feb 25, 2025
2ffb122
WIP
sdottaka Feb 26, 2025
a1d4153
WIP
sdottaka Feb 26, 2025
9e07bbe
Merge branch 'master' into outputpane
sdottaka Feb 27, 2025
4f452ae
WIP
sdottaka Feb 27, 2025
20e584f
WIP
sdottaka Feb 27, 2025
8fa71a2
WIP
sdottaka Feb 27, 2025
04cad94
WIP
sdottaka Feb 28, 2025
39901ab
WIP
sdottaka Mar 1, 2025
c464c73
WIP
sdottaka Mar 1, 2025
4b02527
WIP
sdottaka Mar 2, 2025
0254467
WIP
sdottaka Mar 3, 2025
427eada
WIP
sdottaka Mar 4, 2025
a0ac3f9
Merge branch 'master' into outputpane
sdottaka Mar 4, 2025
1964e10
Reduce flickering when drawing the status bar
sdottaka Mar 5, 2025
aac8d08
Merge branch 'master' into outputpane
sdottaka Mar 5, 2025
51fb036
Merge branch 'master' into outputpane
sdottaka Mar 6, 2025
8dd664c
WIP
sdottaka Mar 7, 2025
80aa18c
WIP
sdottaka Mar 9, 2025
7112f43
WIP
sdottaka Mar 9, 2025
7eab4e9
WIP
sdottaka Mar 9, 2025
d66ef42
Merge remote-tracking branch 'origin/master' into outputpane
sdottaka Mar 9, 2025
a7fec1d
WIP
sdottaka Mar 9, 2025
e2fad2a
WIP
sdottaka Mar 9, 2025
9143a7d
WIP
sdottaka Mar 10, 2025
123cc26
WIP
sdottaka Mar 11, 2025
4b66b03
Merge branch 'master' into outputpane
sdottaka Mar 15, 2025
6f203a3
Merge branch 'master' into outputpane
sdottaka Mar 15, 2025
ef79b90
Merge branch 'master' into outputpane
sdottaka Mar 15, 2025
3851cac
Merge branch 'master' into outputpane
sdottaka Mar 16, 2025
cca955d
WIP
sdottaka Mar 16, 2025
611b812
WIP
sdottaka Mar 17, 2025
04cce37
Merge branch 'master' into outputpane
sdottaka Mar 17, 2025
1e05531
WIP
sdottaka Mar 18, 2025
d781dc0
WIP
sdottaka Mar 19, 2025
0130473
Merge remote-tracking branch 'origin/master' into outputpane
sdottaka Mar 19, 2025
735acfd
Merge branch 'master' into outputpane
sdottaka Mar 19, 2025
abe405e
WIP
sdottaka Mar 19, 2025
76b2416
Merge branch 'master' into outputpane
sdottaka Mar 20, 2025
bbbbccf
WIP
sdottaka Mar 20, 2025
36cf948
WIP
sdottaka Mar 20, 2025
3d4d61a
WIP
sdottaka Mar 20, 2025
2b36a5d
WIP
sdottaka Mar 20, 2025
011c07e
Merge branch 'master' into outputpane
sdottaka Mar 24, 2025
788e5e1
WIP
sdottaka Mar 25, 2025
e30656f
WIP
sdottaka Mar 25, 2025
d035ad7
Merge remote-tracking branch 'origin/master' into outputpane
sdottaka Mar 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions Externals/crystaledit/editlib/ccrystaltextview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ CCrystalTextView::CCrystalTextView ()
, m_pCrystalRendererSaved(nullptr)
, m_nColumnResizing(-1)
, m_nLineNumberUsedAsHeaders(-1)
, m_nRevMarkWidth(MARGIN_REV_WIDTH)
{
#ifdef _WIN64
if (m_nRenderingMode == RENDERING_MODE::GDI)
Expand Down Expand Up @@ -2569,8 +2570,11 @@ DrawMargin (const CRect & rect, int nLineIndex, int nLineNumber)
}

// draw line revision marks
CRect rc(rect.right - MARGIN_REV_WIDTH, rect.top, rect.right, rect.bottom);
m_pCrystalRenderer->FillSolidRectangle (rc, clrRevisionMark);
if (m_nRevMarkWidth > 0)
{
CRect rc(rect.right - m_nRevMarkWidth, rect.top, rect.right, rect.bottom);
m_pCrystalRenderer->FillSolidRectangle (rc, clrRevisionMark);
}

if (!m_bSelMargin)
return;
Expand Down Expand Up @@ -6211,7 +6215,7 @@ GetMarginWidth (CDC *pdc /*= nullptr*/)
else
{
if (pdc == nullptr || !pdc->IsPrinting ())
nMarginWidth += MARGIN_REV_WIDTH; // Space for revision marks
nMarginWidth += m_nRevMarkWidth; // Space for revision marks
}

return nMarginWidth;
Expand Down Expand Up @@ -6980,7 +6984,8 @@ CString CCrystalTextView::GetTextBufferEol(int nLine) const

void CCrystalTextView::SetMarkersContext(CCrystalTextMarkers * pMarkers)
{
pMarkers->AddView(this);
if (pMarkers)
pMarkers->AddView(this);
m_pMarkers = pMarkers;
}

Expand Down Expand Up @@ -7042,8 +7047,20 @@ void CCrystalTextView::EnsureVisible (CEPoint ptStart, CEPoint ptEnd)
//BEGIN SW
int nSubLineCount = GetSubLineCount();
int nNewTopSubLine = m_nTopSubLine;
CEPoint subLinePos;

if (ptStart != ptEnd)
{
CEPoint subLinePosEnd;
CharPosToPoint(ptEnd.y, ptEnd.x, subLinePosEnd);
subLinePosEnd.y += GetSubLineIndex(ptEnd.y);

if (subLinePosEnd.y >= nNewTopSubLine + GetScreenLines())
nNewTopSubLine = subLinePosEnd.y - GetScreenLines() + 1;
if (subLinePosEnd.y < nNewTopSubLine)
nNewTopSubLine = subLinePosEnd.y;
}

CEPoint subLinePos;
CharPosToPoint( ptStart.y, ptStart.x, subLinePos );
subLinePos.y += GetSubLineIndex( ptStart.y );

Expand Down
4 changes: 4 additions & 0 deletions Externals/crystaledit/editlib/ccrystaltextview.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ protected :
HACCEL m_hAccel;
bool m_bVertScrollBarLocked, m_bHorzScrollBarLocked;
CEPoint m_ptDraggedTextBegin, m_ptDraggedTextEnd;
int m_nRevMarkWidth;

void UpdateCaret ();
void SetAnchor (const CEPoint & ptNewAnchor);
int GetTopMarginHeight ();
Expand Down Expand Up @@ -708,6 +710,8 @@ public :
void SetTopMargin (bool bTopMargin);
bool GetSelectionMargin () const { return m_bSelMargin; }
void SetSelectionMargin (bool bSelMargin);
int GetRevisionMarkWidth() const { return m_nRevMarkWidth; }
void SetRevisionMarkWidth(int width) { m_nRevMarkWidth = width; };
bool GetViewLineNumbers() const { return m_bViewLineNumbers; }
void SetViewLineNumbers(bool bViewLineNumbers);
int GetLineUsedAsHeaders () const { return m_nLineNumberUsedAsHeaders; }
Expand Down
3 changes: 3 additions & 0 deletions Externals/crystaledit/editlib/utils/ctchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstring>
#include <cstdlib>
#include <cstdarg>
#include <ctime>

#if defined(_WIN32)
#define STRSAFE_NO_DEPRECATE
Expand Down Expand Up @@ -85,6 +86,7 @@ namespace tc
constexpr auto tcscmplogical = ::wcscmplogical;
constexpr auto tcsspn = ::wcsspn;
constexpr auto tcsdup = ::wcsdup;
constexpr auto tcsftime = wcsftime;
inline tchar_t* tcschr(const tchar_t* str, tchar_t ch) { return const_cast<tchar_t*>(::wcschr(str, ch)); }
inline tchar_t* tcsrchr(const tchar_t* str, tchar_t ch) { return const_cast<tchar_t*>(::wcsrchr(str, ch)); }
inline tchar_t* tcsstr(const tchar_t* str, const tchar_t* substr) { return const_cast<tchar_t*>(::wcsstr(str, substr)); }
Expand Down Expand Up @@ -119,6 +121,7 @@ namespace tc
constexpr auto tcscmplogical = ::strcmplogical;
constexpr auto tcsspn = ::strspn;
constexpr auto tcsdup = ::strdup;
constexpr auto tcsftime = strftime;
inline tchar_t* tcschr(const tchar_t* str, tchar_t ch) { return const_cast<tchar_t*>(::strchr(str, ch)); }
inline tchar_t* tcsrchr(const tchar_t* str, tchar_t ch) { return const_cast<tchar_t*>(::strrchr(str, ch)); }
inline tchar_t* tcsstr(const tchar_t* str, const tchar_t* substr) { return const_cast<tchar_t*>(::strstr(str, substr)); }
Expand Down
7 changes: 4 additions & 3 deletions Src/7zCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ DATE: BY: DESCRIPTION:
#include "paths.h"
#include "Environment.h"
#include "Merge7zFormatRegister.h"
#include "Logger.h"

#ifdef _DEBUG
#define new DEBUG_NEW
Expand Down Expand Up @@ -635,7 +636,7 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
}
if (res.files[0].find(path) == 0)
{
VERIFY(::DeleteFile(res.files[0].c_str()) || (LogErrorString(strutils::format(_T("DeleteFile(%s) failed"), res.files[0])), false));
VERIFY(::DeleteFile(res.files[0].c_str()) || (RootLogger::Error(strutils::format(_T("DeleteFile(%s) failed"), res.files[0])), false));
}
BSTR pTmp = piHandler->GetDefaultName(hWnd, res.files[0].c_str());
res.files[0] = ucr::toTString(pTmp);
Expand Down Expand Up @@ -667,7 +668,7 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
}
if (res.files[1].find(path) == 0)
{
VERIFY(::DeleteFile(res.files[1].c_str()) || (LogErrorString(strutils::format(_T("DeleteFile(%s) failed"), res.files[1])), false));
VERIFY(::DeleteFile(res.files[1].c_str()) || (RootLogger::Error(strutils::format(_T("DeleteFile(%s) failed"), res.files[1])), false));
}
BSTR pTmp = piHandler->GetDefaultName(hWnd, res.files[1].c_str());
res.files[1] = OLE2T(pTmp);
Expand Down Expand Up @@ -698,7 +699,7 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
}
if (res.files[2].find(path) == 0)
{
VERIFY(::DeleteFile(res.files[2].c_str()) || (LogErrorString(strutils::format(_T("DeleteFile(%s) failed"), res.files[2])), false));
VERIFY(::DeleteFile(res.files[2].c_str()) || (RootLogger::Error(strutils::format(_T("DeleteFile(%s) failed"), res.files[2])), false));
}
BSTR pTmp = piHandler->GetDefaultName(hWnd, res.files[2].c_str());
res.files[2] = OLE2T(pTmp);
Expand Down
2 changes: 1 addition & 1 deletion Src/Common/MDITabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ BOOL CMDITabBar::Create(CMDIFrameWnd* pMainFrame)

m_titleBar.Init(this);

CWnd::Create(nullptr, nullptr, WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), pMainFrame, AFX_IDW_CONTROLBAR_FIRST + 30);
CWnd::Create(nullptr, nullptr, WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), pMainFrame, AFX_IDW_CONTROLBAR_LAST - 1);

if (!m_tabCtrl.Create(pMainFrame, this))
return FALSE;
Expand Down
8 changes: 4 additions & 4 deletions Src/Common/multiformatText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "codepage_detect.h"
#include "Environment.h"
#include "TFile.h"
#include "MergeApp.h"
#include "Logger.h"

using Poco::SharedMemory;
using Poco::FileOutputStream;
Expand Down Expand Up @@ -103,7 +103,7 @@ const tchar_t *storageForPlugins::GetDestFileName()
}
catch (Exception& e)
{
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
}
}
}
Expand All @@ -125,7 +125,7 @@ void storageForPlugins::ValidateNewFile()
}
catch (Exception& e)
{
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
}
// we may reuse the temp filename
// tempFilenameDst.Empty();
Expand All @@ -142,7 +142,7 @@ void storageForPlugins::ValidateNewFile()
}
catch (Exception& e)
{
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
}
}
else
Expand Down
12 changes: 12 additions & 0 deletions Src/Common/unicoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,18 @@ String toTString(const std::string& str)
#endif
}

String toTStringFromACP(const std::string& str)
{
#ifndef UNICODE
return str;
#else
String retval;
bool lossy = false;
maketstring(retval, str.c_str(), str.length(), GetACP(), &lossy);
return retval;
#endif
}

void toUTF16(const String& tstr, std::wstring& wstr)
{
#ifdef UNICODE
Expand Down
1 change: 1 addition & 0 deletions Src/Common/unicoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void dealloc(void *ptr);

String toTString(const std::wstring& str);
String toTString(const std::string& str);
String toTStringFromACP(const std::string& str);
void toUTF16(const String& tstr, std::wstring& wstr);
inline std::wstring toUTF16(const String& tstr)
{
Expand Down
9 changes: 5 additions & 4 deletions Src/DiffTextBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ccrystaltextview.h"
#include "UniFile.h"
#include "FileLoadResult.h"
#include "Logger.h"
#include "locality.h"
#include "paths.h"
#include "OptionsDef.h"
Expand Down Expand Up @@ -366,7 +367,7 @@ int CDiffTextBuffer::LoadFromFile(const tchar_t* pszFileNameInit,
}
catch (Exception& e)
{
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
}
}
return nRetVal;
Expand Down Expand Up @@ -436,10 +437,10 @@ int CDiffTextBuffer::SaveToFile (const String& pszFileName,
{
sError = uniErr.GetError();
if (bTempFile)
LogErrorString(strutils::format(_T("Opening file %s failed: %s"),
RootLogger::Error(strutils::format(_T("Opening file %s failed: %s"),
pszFileName, sError));
else
LogErrorString(strutils::format(_T("Opening file %s failed: %s"),
RootLogger::Error(strutils::format(_T("Opening file %s failed: %s"),
sIntermediateFilename, sError));
}
return SAVE_FAILED;
Expand Down Expand Up @@ -525,7 +526,7 @@ int CDiffTextBuffer::SaveToFile (const String& pszFileName,
}
catch (Exception& e)
{
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
}
if (!bSaveSuccess)
{
Expand Down
7 changes: 4 additions & 3 deletions Src/DiffWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "Exceptions.h"
#include "parsers/crystallineparser.h"
#include "SyntaxColors.h"
#include "Logger.h"
#include "MergeApp.h"
#include "SubstitutionList.h"
#include "codepage_detect.h"
Expand Down Expand Up @@ -953,7 +954,7 @@ bool CDiffWrapper::RunFileDiff()
}
catch (Exception& e)
{
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
}
strFileTemp[file].erase();
}
Expand Down Expand Up @@ -982,7 +983,7 @@ void CDiffWrapper::AddDiffRange(DiffList *pDiffList, unsigned begin0, unsigned e
}
catch (std::exception& e)
{
AppErrorMessageBox(ucr::toTString(e.what()));
RootLogger::Error(e.what());
}
}

Expand All @@ -994,7 +995,7 @@ void CDiffWrapper::AddDiffRange(DiffList *pDiffList, DIFFRANGE &dr)
}
catch (std::exception& e)
{
AppErrorMessageBox(ucr::toTString(e.what()));
RootLogger::Error(e.what());
}
}

Expand Down
5 changes: 3 additions & 2 deletions Src/DirActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "DirActions.h"
#include "MergeApp.h"
#include "UnicodeString.h"
#include "Logger.h"
#include "7zCommon.h"
#include "ShellFileOperations.h"
#include "DiffItem.h"
Expand Down Expand Up @@ -228,7 +229,7 @@ void ConfirmActionList(const CDiffContext& ctxt, const FileActionScript & action

// Invalid operation
default:
LogErrorString(_T("Unknown fileoperation in CDirView::ConfirmActionList()"));
RootLogger::Error(_T("Unknown fileoperation in CDirView::ConfirmActionList()"));
throw "Unknown fileoperation in ConfirmActionList()";
break;
}
Expand Down Expand Up @@ -1221,7 +1222,7 @@ int UpdateCompareFlagsAfterSync(DIFFITEM& di, bool bRecursive)
/**
* @brief Update the paths of the diff items recursively.
* @param[in] nDirs Number of directories to compare.
* @param[in,out] di@Item to update the path.
* @param[in,out] di Item to update the path.
*/
void UpdatePaths(int nDirs, DIFFITEM& di)
{
Expand Down
2 changes: 2 additions & 0 deletions Src/DirDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ void CDirDoc::InitCompare(const PathContext & paths, bool bRecursive, CTempPathC
for (nIndex = 0; nIndex < m_nDirs; nIndex++)
m_pTempPathContext->m_strRoot[nIndex] = m_pCtxt->GetNormalizedPath(nIndex);
}

CMergeFrameCommon::LogComparisonStart(paths, m_strDesc, nullptr, nullptr);
}


Expand Down
4 changes: 3 additions & 1 deletion Src/DirItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "UnicodeString.h"
#include "paths.h"
#include "TFile.h"
#include "Logger.h"
#include "DebugNew.h"
#include <filesystem>

Expand Down Expand Up @@ -72,8 +73,9 @@ bool DirItem::Update(const String &sFilePath)

retVal = true;
}
catch (...)
catch (Poco::Exception& e)
{
RootLogger::Error(e.displayText());
}
}
return retVal;
Expand Down
4 changes: 3 additions & 1 deletion Src/DirView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void CDirView::OnInitialUpdate()
// Load user-selected font
if (GetOptionsMgr()->GetBool(OPT_FONT_DIRCMP + OPT_FONT_USECUSTOM))
{
m_font.CreateFontIndirect(&GetMainFrame()->m_lfDir);
m_font.CreateFontIndirect(&theApp.m_lfDir);
CWnd::SetFont(&m_font, TRUE);
}

Expand Down Expand Up @@ -2549,6 +2549,8 @@ LRESULT CDirView::OnUpdateUIMessage(WPARAM wParam, LPARAM lParam)
if (m_elapsed > TimeToSignalCompare * CLOCKS_PER_SEC)
MessageBeep(IDOK);
GetMainFrame()->StartFlashing();
CMergeFrameCommon::LogComparisonCompleted(*pDoc->GetDiffContext().m_pCompareStats);

}
else if (wParam == CDiffThread::EVENT_COMPARE_PROGRESSED)
{
Expand Down
7 changes: 4 additions & 3 deletions Src/FileTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "Environment.h"
#include "TFile.h"
#include "paths.h"
#include "Logger.h"
#include "MergeApp.h"

using Poco::Exception;
Expand Down Expand Up @@ -537,7 +538,7 @@ bool PackingInfo::Packing(int target, const String& srcFilepath, const String& d
catch (Poco::Exception& e)
{
DWORD dwErrCode = GetLastError();
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
SetLastError(dwErrCode);
return false;
}
Expand Down Expand Up @@ -954,7 +955,7 @@ bool AnyCodepageToUTF8(int codepage, String & filepath, bool bMayOverwrite)
}
catch (Exception& e)
{
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
}
}
// and change the filepath if everything works
Expand All @@ -968,7 +969,7 @@ bool AnyCodepageToUTF8(int codepage, String & filepath, bool bMayOverwrite)
}
catch (Exception& e)
{
LogErrorStringUTF8(e.displayText());
RootLogger::Error(e.displayText());
}
}

Expand Down
Loading
Loading