Skip to content

Commit ea0cc1c

Browse files
Doug-Lyonslearn-more
authored andcommitted
[BROWSEUI] Apply a hack to prevent truncating the address bar text.
CORE-13003
1 parent e49ef25 commit ea0cc1c

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

dll/win32/browseui/addressband.cpp

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ CAddressBand::CAddressBand()
4343
fGoButton = NULL;
4444
fComboBox = NULL;
4545
fGoButtonShown = false;
46+
fAdjustNeeded = 0;
4647
}
4748

4849
CAddressBand::~CAddressBand()
@@ -66,7 +67,10 @@ HRESULT STDMETHODCALLTYPE CAddressBand::GetBandInfo(DWORD dwBandID, DWORD dwView
6667
{
6768
if (pdbi->dwMask & DBIM_MINSIZE)
6869
{
69-
pdbi->ptMinSize.x = 100;
70+
if (fGoButtonShown)
71+
pdbi->ptMinSize.x = 100;
72+
else
73+
pdbi->ptMinSize.x = 150;
7074
pdbi->ptMinSize.y = 22;
7175
}
7276
if (pdbi->dwMask & DBIM_MAXSIZE)
@@ -81,7 +85,10 @@ HRESULT STDMETHODCALLTYPE CAddressBand::GetBandInfo(DWORD dwBandID, DWORD dwView
8185
}
8286
if (pdbi->dwMask & DBIM_ACTUAL)
8387
{
84-
pdbi->ptActual.x = 100;
88+
if (fGoButtonShown)
89+
pdbi->ptActual.x = 100;
90+
else
91+
pdbi->ptActual.x = 150;
8592
pdbi->ptActual.y = 22;
8693
}
8794
if (pdbi->dwMask & DBIM_TITLE)
@@ -451,6 +458,8 @@ LRESULT CAddressBand::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHan
451458
long newHeight;
452459
long newWidth;
453460

461+
fAdjustNeeded = 1;
462+
454463
if (fGoButtonShown == false)
455464
{
456465
bHandled = FALSE;
@@ -505,6 +514,24 @@ LRESULT CAddressBand::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPara
505514
positionInfoCopy = *reinterpret_cast<WINDOWPOS *>(lParam);
506515
newHeight = positionInfoCopy.cy;
507516
newWidth = positionInfoCopy.cx;
517+
518+
/*
519+
Sometimes when we get here newWidth = 100 which comes from GetBandInfo and is less than the 200 that we need.
520+
We need room for the "Address" text (50 pixels), the "GoButton" (50 pixels), the left and right borders (30 pixels)
521+
the icon (20 pixels) and the ComboBox (50 pixels) for handling the text of the current directory. This is 200 pixels.
522+
When newWidth = 100 the Addressband ComboBox will only have a single character because it becomes 2 pixels wide.
523+
The hack below readjusts the width to the minimum required to allow seeing the whole text and prints out a debug message.
524+
*/
525+
526+
if ((newWidth < 200) && (newWidth != 0))
527+
{
528+
if (fAdjustNeeded == 1)
529+
{
530+
ERR("CORE-13003 HACK: Addressband ComboBox width readjusted from %ld to 200.\n", newWidth);
531+
newWidth = 200;
532+
fAdjustNeeded = 0;
533+
}
534+
}
508535
SendMessage(fGoButton, TB_GETITEMRECT, 0, reinterpret_cast<LPARAM>(&buttonBounds));
509536

510537
buttonWidth = buttonBounds.right - buttonBounds.left;

dll/win32/browseui/addressband.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class CAddressBand :
4343
bool fGoButtonShown;
4444
HIMAGELIST m_himlNormal;
4545
HIMAGELIST m_himlHot;
46+
INT fAdjustNeeded;
4647

4748
public:
4849
CAddressBand();

0 commit comments

Comments
 (0)