Skip to content

Commit 8bae876

Browse files
authored
Merge branch 'master' into master
2 parents d9dd3c1 + 4e5495b commit 8bae876

File tree

14 files changed

+135
-43
lines changed

14 files changed

+135
-43
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88

99
jobs:
1010
build:
11+
if: "!contains(github.event.head_commit.message, 'skip ci')"
12+
1113
runs-on: windows-latest
1214

1315
steps:

Externals/crystaledit/editlib/ccrystaltextview.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ CCrystalTextView::CCrystalTextView ()
596596
, m_bIncrementalFound(false)
597597
, m_rxmatch{}
598598
, m_nRenderingMode(s_nRenderingModeDefault)
599+
, m_pCrystalRendererSaved(nullptr)
599600
{
600601
#ifdef _WIN64
601602
if (m_nRenderingMode == RENDERING_MODE_GDI)
@@ -3004,8 +3005,11 @@ OnBeginPrinting (CDC * pdc, CPrintInfo * pInfo)
30043005
void CCrystalTextView::
30053006
OnEndPrinting (CDC * pdc, CPrintInfo * pInfo)
30063007
{
3007-
m_pCrystalRenderer.reset(m_pCrystalRendererSaved);
3008-
3008+
if (m_pCrystalRendererSaved)
3009+
{
3010+
m_pCrystalRenderer.reset(m_pCrystalRendererSaved);
3011+
m_pCrystalRendererSaved = nullptr;
3012+
}
30093013
if (m_pPrintFont != nullptr)
30103014
{
30113015
delete m_pPrintFont;
@@ -3803,7 +3807,7 @@ ClientToText (const CPoint & point)
38033807
if (nPos < 0)
38043808
nPos = 0;
38053809

3806-
int nIndex = 0, nPrevIndex = 0;
3810+
int nIndex = 0;
38073811
int nCurPos = 0;
38083812
int n = 0;
38093813
int i = 0;
@@ -3829,8 +3833,6 @@ ClientToText (const CPoint & point)
38293833
if (n > nPos && i == nSubLineOffset)
38303834
break;
38313835

3832-
nPrevIndex = nIndex;
3833-
38343836
nIndex = pIterChar->next();
38353837
}
38363838

Externals/crystaledit/editlib/crystalparser.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,13 @@ void CCrystalParser::WrapLine( int nLineIndex, int nMaxLineWidth, int *anBreaks,
6262
int nLastBreakPos = 0;
6363
int nLastCharBreakPos = 0;
6464
bool bBreakable = false;
65-
TCHAR ch;
6665
WORD wCharType;
6766

6867
// m_iterChar.setText(reinterpret_cast<const UChar *>(szLine), nLineLength);
6968
// for( int i = 0; i < nLineLength; i = m_iterChar.next())
7069
for( int i = 0; i < nLineLength; i += U16_IS_SURROGATE(szLine[i]) ? 2 : 1)
7170
{
72-
ch = szLine[i];
71+
TCHAR ch = szLine[i];
7372
// remember position of whitespace for wrap
7473
if( bBreakable )
7574
{

Externals/crystaledit/editlib/cs2cs.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ skip_word (LPCTSTR s)
110110
ptrdiff_t
111111
get_coding (LPCTSTR name, type_codes *codes, int *coding)
112112
{
113-
size_t pos;
114-
115113
for (int i = 0; i < codes_count; i++)
116-
if ((pos = str_pos (name, codes[i].name)) >= 0)
114+
if (size_t pos; (pos = str_pos (name, codes[i].name)) >= 0)
117115
{
118116
*coding = i;
119117
return pos;
@@ -180,7 +178,6 @@ TCHAR iconvert_char (TCHAR ch, int source_coding, int destination_coding, bool a
180178
int
181179
iconvert (LPTSTR string, int source_coding, int destination_coding, bool alphabet_only)
182180
{
183-
ptrdiff_t posit = -2;
184181
LPCTSTR source_chars, destination_chars, cod_pos = nullptr;
185182
TCHAR ch;
186183
LPTSTR s = string;
@@ -189,7 +186,7 @@ iconvert (LPTSTR string, int source_coding, int destination_coding, bool alphabe
189186
return -1;
190187
if (source_coding < 0)
191188
{
192-
posit = fget_coding (string, &source_coding);
189+
ptrdiff_t posit = fget_coding (string, &source_coding);
193190
if (posit != 0)
194191
cod_pos = string + posit;
195192
}

Src/AboutDlg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ void CAboutDlg::Impl::DoDataExchange(CDataExchange* pDX)
8686
{
8787
CTrDialog::DoDataExchange(pDX);
8888
//{{AFX_DATA_MAP(CAboutDlg::Impl)
89+
DDX_Text(pDX, IDC_DEVELOPERS, m_p->m_info.developers);
8990
DDX_Text(pDX, IDC_COMPANY, m_p->m_info.copyright);
9091
DDX_Text(pDX, IDC_VERSION, m_p->m_info.version);
9192
//}}AFX_DATA_MAP
@@ -102,8 +103,7 @@ BOOL CAboutDlg::Impl::OnInitDialog()
102103

103104
m_font.CreatePointFont(10 * 10, _T("Tahoma"));
104105

105-
SetDlgItemText(static_cast<unsigned>(IDC_STATIC), m_p->m_info.developers);
106-
GetDlgItem(IDC_STATIC)->SetFont(&m_font);
106+
GetDlgItem(IDC_DEVELOPERS)->SetFont(&m_font);
107107
GetDlgItem(IDC_VERSION)->SetFont(&m_font);
108108

109109
String link;

Src/Common/BCMenu.cpp

Lines changed: 107 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,31 @@ int BCMenu::m_gutterWidth = 0;
5555
int BCMenu::m_arrowWidth = 0;
5656
HTHEME BCMenu::m_hTheme = nullptr;
5757

58+
static class GdiplusToken
59+
{
60+
public:
61+
GdiplusToken()
62+
{
63+
}
64+
65+
~GdiplusToken()
66+
{
67+
if (m_token != 0)
68+
Gdiplus::GdiplusShutdown(m_token);
69+
}
70+
71+
void InitGdiplus()
72+
{
73+
if (m_token == 0)
74+
{
75+
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
76+
Gdiplus::GdiplusStartup(&m_token, &gdiplusStartupInput, nullptr);
77+
}
78+
}
79+
80+
private:
81+
ULONG_PTR m_token = 0;
82+
} m_gdiplusToken;
5883

5984
// The Representation of a 32 bit color table entry
6085
#pragma pack(push)
@@ -554,29 +579,24 @@ void BCMenu::DrawItem_Theme(LPDRAWITEMSTRUCT lpDIS)
554579
bitmap = &m_AllImages;
555580
}
556581

557-
int dy = (int)(0.5+(rect.Height()-m_iconY)/2.0);
558-
dy = dy<0 ? 0 : dy;
559-
int dx = (int)(0.5+(m_checkBgWidth-m_iconX)/2.0);
560-
dx = dx<0 ? 0 : dx;
561-
562-
if(nIconNormal != -1){
563-
if((state & ODS_GRAYED)!=0){
564-
CBitmap bitmapstandard;
565-
GetBitmapFromImageList(pDC,bitmap,(int)xoffset,bitmapstandard);
566-
COLORREF transparentcol = pDC->GetPixel(rect.left+dx,rect.top+dy);
567-
if(hicolor_bitmaps)
568-
DitherBlt3(pDC,rect.left+dx,rect.top+dy,m_iconX,m_iconY,
569-
bitmapstandard,transparentcol);
570-
else
571-
DitherBlt2(pDC,rect.left+dx,rect.top+dy,m_iconX,m_iconY,
572-
bitmapstandard,0,0,transparentcol);
573-
}
574-
else{
575-
if(bitmap!=nullptr){
576-
CPoint ptImage(rect.left+dx,rect.top+dy);
577-
bitmap->Draw(pDC,(int)xoffset,ptImage,ILD_TRANSPARENT);
578-
}
579-
}
582+
int cxSMIcon = GetSystemMetrics(SM_CXSMICON);
583+
int cySMIcon = GetSystemMetrics(SM_CYSMICON);
584+
585+
if(nIconNormal != -1 && bitmap != nullptr){
586+
CImage bitmapstandard;
587+
GetBitmapFromImageList(pDC,bitmap,(int)xoffset,bitmapstandard);
588+
if((state & ODS_GRAYED)!=0)
589+
GetDisabledBitmap(bitmapstandard);
590+
m_gdiplusToken.InitGdiplus();
591+
Gdiplus::Bitmap bm(bitmapstandard.GetWidth(), bitmapstandard.GetHeight(),
592+
bitmapstandard.GetPitch(), PixelFormat32bppARGB, (BYTE *)bitmapstandard.GetBits());
593+
Gdiplus::Graphics dcDst(pDC->m_hDC);
594+
dcDst.SetInterpolationMode(Gdiplus::InterpolationModeHighQualityBicubic);
595+
Gdiplus::Rect rcDst(
596+
static_cast<int>(rect.left + (rectGutter.right - cxSMIcon) / 2.0 + 0.5),
597+
static_cast<int>(rect.top + (rect.Height() - cySMIcon) / 2.0 + 0.5),
598+
cxSMIcon, cySMIcon);
599+
dcDst.DrawImage(&bm, rcDst, 0, 0, m_iconX, m_iconY, Gdiplus::UnitPixel);
580600
}
581601
if(nIconNormal<0 && (state&ODS_CHECKED)!=0){
582602
CMenuItemInfo info;
@@ -613,7 +633,7 @@ void BCMenu::DrawItem_Theme(LPDRAWITEMSTRUCT lpDIS)
613633
if(tablocr!=-1){
614634
rightStr=strText.Mid(tablocr+1);
615635
leftStr=strText.Left(strText.Find(_T('\t')));
616-
rectt.right-=m_iconX;
636+
rectt.right-=cxSMIcon;
617637
}
618638
else leftStr=strText;
619639

@@ -632,6 +652,52 @@ void BCMenu::DrawItem_Theme(LPDRAWITEMSTRUCT lpDIS)
632652
}
633653
}
634654

655+
bool BCMenu::GetBitmapFromImageList(CDC* pDC,CImageList *imglist,int nIndex,CImage &bmp)
656+
{
657+
CDC dc;
658+
dc.CreateCompatibleDC(pDC);
659+
bmp.Create(m_iconX, -m_iconY, 32, CImage::createAlphaChannel);
660+
memset(bmp.GetBits(), 0xff, abs(bmp.GetPitch()) * m_iconY);
661+
HGDIOBJ pOldBmp = dc.SelectObject(bmp.operator HBITMAP());
662+
POINT pt = {0};
663+
SIZE sz = {m_iconX, m_iconY};
664+
665+
IMAGELISTDRAWPARAMS drawing;
666+
667+
drawing.cbSize = IMAGELISTDRAWPARAMS_V3_SIZE;
668+
drawing.himl = imglist->m_hImageList;
669+
drawing.i = nIndex;
670+
drawing.hdcDst = dc.m_hDC;
671+
drawing.x = pt.x;
672+
drawing.y = pt.y;
673+
drawing.cx = sz.cx;
674+
drawing.cy = sz.cy;
675+
drawing.xBitmap = pt.x;
676+
drawing.yBitmap = pt.y;
677+
drawing.rgbBk = CLR_NONE;
678+
drawing.rgbFg = CLR_DEFAULT;
679+
drawing.fStyle = ILD_NORMAL;
680+
drawing.dwRop = SRCCOPY;
681+
682+
ImageList_DrawIndirect(&drawing);
683+
684+
int pitch = bmp.GetPitch();
685+
BYTE *p = (BYTE *)bmp.GetBits();
686+
for (int y = 0; y < m_iconY; ++y)
687+
{
688+
for (int x = 0; x < m_iconX; ++x)
689+
{
690+
if (p[x * 4 + y * pitch + 3] == 0xff)
691+
p[x * 4 + y * pitch + 3] = 0;
692+
else
693+
p[x * 4 + y * pitch + 3] = 0xff;
694+
}
695+
}
696+
697+
dc.SelectObject( pOldBmp );
698+
return true;
699+
}
700+
635701
bool BCMenu::GetBitmapFromImageList(CDC* pDC,CImageList *imglist,int nIndex,CBitmap &bmp)
636702
{
637703
CDC dc;
@@ -1764,6 +1830,23 @@ void BCMenu::GetDisabledBitmap(CBitmap &bmp,COLORREF background)
17641830
ddc.SelectObject(pddcOldBmp);
17651831
}
17661832

1833+
void BCMenu::GetDisabledBitmap(CImage &bmp)
1834+
{
1835+
COLORREF discol=GetSysColor(COLOR_BTNSHADOW);
1836+
pBGR pcurBGR = static_cast<pBGR>(bmp.GetBits());
1837+
1838+
for(int i=0;i<bmp.GetWidth();++i){
1839+
for(int j=0;j<bmp.GetHeight();++j){
1840+
int avgcol = ((DWORD)pcurBGR->r+(DWORD)pcurBGR->g+(DWORD)pcurBGR->b)/3;
1841+
double factor = avgcol/255.0;
1842+
COLORREF newcol = LightenColor(discol,factor);
1843+
sBGR newcolBGR = {GetBValue(newcol),GetGValue(newcol),GetRValue(newcol),pcurBGR->pad};
1844+
*pcurBGR = newcolBGR;
1845+
pcurBGR++;
1846+
}
1847+
}
1848+
}
1849+
17671850
bool BCMenu::AddBitmapToImageList(CImageList *bmplist,UINT nResourceID, bool bDisabled/*= false*/)
17681851
{
17691852
bool bReturn=false;

Src/Common/BCMenu.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ typedef enum {BCMENU_NONE, BCMENU_HEAD, BCMENU_TAIL, BCMENU_BOTH} BC_Seperator;
8080
#define SetImageForPopupFromToolbar SetImageForPopupFromToolbarW
8181
#endif
8282

83-
8483
class BCMenu : public CMenu
8584
{
8685
DECLARE_DYNAMIC( BCMenu )
@@ -297,12 +296,14 @@ class BCMenu : public CMenu
297296
void DitherBlt3(CDC *drawdc, int nXDest, int nYDest, int nWidth,
298297
int nHeight, CBitmap &bmp,COLORREF bgcolor);
299298
bool GetBitmapFromImageList(CDC* pDC,CImageList *imglist,int nIndex,CBitmap &bmp);
299+
bool GetBitmapFromImageList(CDC* pDC, CImageList *imglist, int nIndex, CImage &bmp);
300300
bool ImageListDuplicate(CImageList *il,int xoffset,CImageList *newlist);
301301
static WORD NumBitmapColors(LPBITMAPINFOHEADER lpBitmap);
302302
void RemoveTopLevelOwnerDraw(void);
303303
int GetMenuStart(void);
304304
void GetTransparentBitmap(CBitmap &bmp);
305305
void GetDisabledBitmap(CBitmap &bmp,COLORREF background=0);
306+
void GetDisabledBitmap(CImage &bmp);
306307
INT_PTR AddToGlobalImageList(CImageList *il,int xoffset,int nID);
307308
INT_PTR AddToGlobalImageList(int nIconNormal,int nID);
308309
int GlobalImageListOffset(int nID);

Src/Common/RegOptionsMgr.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,14 @@ int CRegOptionsMgr::InitOption(const String& name, const varprop::VariantValue&
306306
// This just checks if the value exists, LoadValueFromReg() below actually
307307
// loads the value.
308308
DWORD type = 0;
309-
BYTE dataBuf[MAX_PATH_FULL] = {0};
310309
DWORD size = MAX_PATH_FULL;
311310
LONG retValReg;
312311
if (hKey)
312+
{
313+
BYTE dataBuf[MAX_PATH_FULL] = {0};
313314
retValReg = RegQueryValueEx(hKey, strValueName.c_str(),
314315
0, &type, dataBuf, &size);
316+
}
315317
else
316318
retValReg = ERROR_FILE_NOT_FOUND;
317319

Src/Merge.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ CAPTION "About WinMerge"
924924
FONT 8, "MS Shell Dlg", 0, 0, 0x1
925925
BEGIN
926926
CONTROL "",IDC_ABOUTBOX_ICON,"Static",SS_OWNERDRAW,0,0,366,215
927-
LTEXT "",IDC_STATIC,7,60,200,120
927+
LTEXT "",IDC_DEVELOPERS,7,60,200,120
928928
LTEXT "Version 1.0",IDC_VERSION,240,153,133,20,SS_NOPREFIX
929929
CONTROL "Visit the WinMerge HomePage!",IDC_WWW,"SysLink",LWS_IGNORERETURN | 0x1,120,220,167,10
930930
LTEXT "[VERSION COPYRIGHT GOES HERE]",IDC_COMPANY,7,172,350,42

Src/resource.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
#define IDC_WWW 1019
179179
#define IDC_IGNCASE_CHECK 1020
180180
#define IDC_COMPANY 1021
181+
#define IDC_DEVELOPERS 1022
181182
#define IDC_VER_SYS 1024
182183
#define IDC_HILITE_CHECK 1025
183184
#define IDC_IGNOREREGEXP 1026

Testing/WSLWineTest/config.xlaunch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<XLaunch WindowMode="MultiWindow" ClientMode="NoClient" LocalClient="False" Display="-1" LocalProgram="xcalc" RemoteProgram="xterm" RemotePassword="" PrivateKey="" RemoteHost="" RemoteUser="" XDMCPHost="" XDMCPBroadcast="False" XDMCPIndirect="False" Clipboard="True" ClipboardPrimary="True" ExtraParams="" Wgl="True" DisableAC="False" XDMCPTerminate="False"/>

Testing/WSLWineTest/wsl_wine_test.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cd %~dp0
2+
(tasklist | findstr vcxsrv) || "%ProgramFiles%\VcXsrv\xlaunch.exe" -run config.xlaunch || pause
3+
bash -c "DISPLAY=:0 wine ../../Build/x64/Debug/WinMergeU"

Translations/WinMerge/Galician.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is part from WinMerge <https://winmerge.org/>
1+
# This file is part from WinMerge <https://winmerge.org/>
22
# Released under the "GNU General Public License"
33
#
44
# Translators:

Translations/WinMerge/German.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4085,7 +4085,7 @@ msgid "minimal"
40854085
msgstr "Minimal"
40864086

40874087
msgid "patience"
4088-
msgstr "Geduld"
4088+
msgstr "Patience"
40894089

40904090
msgid "histogram"
40914091
msgstr "Histogramm"

0 commit comments

Comments
 (0)