Skip to content

Commit

Permalink
Tiny refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
d0vgan committed May 23, 2020
1 parent 9938cff commit 1668302
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 67 deletions.
4 changes: 2 additions & 2 deletions Source/QSearch/DialogSwitcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ BOOL dlgswtchDoSwitch(int nAccelIndex)
{
if ( IsWindowVisible(hModelessDlg) )
{
RECT rcEdit;
RECT rcDlg;
RECT rcEdit = { 0, 0, 0, 0 };
RECT rcDlg = { 0, 0, 0, 0 };

GetWindowRect(ei.hWndEdit, &rcEdit);
GetWindowRect(hModelessDlg, &rcDlg);
Expand Down
132 changes: 67 additions & 65 deletions Source/QSearch/QSearchDlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,7 @@ static void fillToolInfoA(
HWND hWnd,
UINT uId)
{
RECT rect;
RECT rect = { 0, 0, 0, 0 };

GetClientRect(hWnd, &rect);

Expand All @@ -2922,7 +2922,7 @@ static void fillToolInfoW(
HWND hWnd,
UINT uId)
{
RECT rect;
RECT rect = { 0, 0, 0, 0 };

GetClientRect(hWnd, &rect);

Expand Down Expand Up @@ -4040,82 +4040,84 @@ INT_PTR CALLBACK qsearchDlgProc(HWND hDlg,
case WM_SIZE:
case WM_PAINT:
{
LONG nWidthInit;
LONG nWidthCurr;
LONG dx;
RECT rcDlgCurr = { 0, 0, 0, 0 };
RECT rcDlgCurr;

GetClientRect(hDlg, &rcDlgCurr);
nWidthCurr = rcDlgCurr.right - rcDlgCurr.left;
nWidthInit = rcDlg_0.right - rcDlg_0.left;
dx = nWidthCurr - nWidthInit;

if ( dx < 0 )
if ( GetClientRect(hDlg, &rcDlgCurr) )
{
if ( g_Options.dwEditMinWidth != 0 )
LONG nWidthInit;
LONG nWidthCurr;
LONG dx;

nWidthCurr = rcDlgCurr.right - rcDlgCurr.left;
nWidthInit = rcDlg_0.right - rcDlg_0.left;
dx = nWidthCurr - nWidthInit;

if ( dx < 0 )
{
if ( rcEdFindText_0.right - rcEdFindText_0.left + dx < (LONG) g_Options.dwEditMinWidth )
dx = rcEdFindText_0.left + g_Options.dwEditMinWidth - rcEdFindText_0.right;
if ( g_Options.dwEditMinWidth != 0 )
{
if ( rcEdFindText_0.right - rcEdFindText_0.left + dx < (LONG) g_Options.dwEditMinWidth )
dx = rcEdFindText_0.left + g_Options.dwEditMinWidth - rcEdFindText_0.right;
}
else
dx = 0;
}
else
dx = 0;
}
else // dx >= 0
{
if ( g_Options.dwEditMaxWidth != 0 )
else // dx >= 0
{
if ( rcEdFindText_0.right - rcEdFindText_0.left + dx > (LONG) g_Options.dwEditMaxWidth )
dx = rcEdFindText_0.left + g_Options.dwEditMaxWidth - rcEdFindText_0.right;
if ( g_Options.dwEditMaxWidth != 0 )
{
if ( rcEdFindText_0.right - rcEdFindText_0.left + dx > (LONG) g_Options.dwEditMaxWidth )
dx = rcEdFindText_0.left + g_Options.dwEditMaxWidth - rcEdFindText_0.right;
}
}
}

MoveWindowByDx(hStInfo, &rcStInfo_0, dx);
MoveWindowByDx(hChHighlightAll, &rcChHighlightAll_0, dx);
MoveWindowByDx(hChWholeWord, &rcChWholeWord_0, dx);
MoveWindowByDx(hChMatchCase, &rcChMatchCase_0, dx);
MoveWindowByDx(hPbProgress, &rcPbProgress_0, dx);
MoveWindowByDx(hBtFindAll, &rcBtFindAll_0, dx);
MoveWindowByDx(hBtFindPrev, &rcBtFindPrev_0, dx);
MoveWindowByDx(hBtFindNext, &rcBtFindNext_0, dx);
ResizeWindowByDx(hCbFindText, &rcCbFindText_0, dx);
ResizeWindowByDx(hEdFindText, &rcEdFindText_0, dx);

RedrawWindowByDx(hEdFindText);
RedrawWindowByDx(hCbFindText);
RedrawWindowByDx(hBtFindNext);
RedrawWindowByDx(hBtFindPrev);
RedrawWindowByDx(hBtFindAll);
RedrawWindowByDx(hPbProgress);
RedrawWindowByDx(hChMatchCase);
RedrawWindowByDx(hChWholeWord);
RedrawWindowByDx(hChHighlightAll);
RedrawWindowByDx(hStInfo);

if ( g_QSearchDlg.pDockData )
{
GetClientRect(hDlg, &g_QSearchDlg.pDockData->rcDragDrop);
}

if ( g_QSearchDlg.hFindEdit )
{
if ( g_Plugin.bOldWindows )
MoveWindowByDx(hStInfo, &rcStInfo_0, dx);
MoveWindowByDx(hChHighlightAll, &rcChHighlightAll_0, dx);
MoveWindowByDx(hChWholeWord, &rcChWholeWord_0, dx);
MoveWindowByDx(hChMatchCase, &rcChMatchCase_0, dx);
MoveWindowByDx(hPbProgress, &rcPbProgress_0, dx);
MoveWindowByDx(hBtFindAll, &rcBtFindAll_0, dx);
MoveWindowByDx(hBtFindPrev, &rcBtFindPrev_0, dx);
MoveWindowByDx(hBtFindNext, &rcBtFindNext_0, dx);
ResizeWindowByDx(hCbFindText, &rcCbFindText_0, dx);
ResizeWindowByDx(hEdFindText, &rcEdFindText_0, dx);

RedrawWindowByDx(hEdFindText);
RedrawWindowByDx(hCbFindText);
RedrawWindowByDx(hBtFindNext);
RedrawWindowByDx(hBtFindPrev);
RedrawWindowByDx(hBtFindAll);
RedrawWindowByDx(hPbProgress);
RedrawWindowByDx(hChMatchCase);
RedrawWindowByDx(hChWholeWord);
RedrawWindowByDx(hChHighlightAll);
RedrawWindowByDx(hStInfo);

if ( g_QSearchDlg.pDockData )
{
TOOLINFOA tiA;

fillToolInfoA( &tiA, LPSTR_TEXTCALLBACKA, g_QSearchDlg.hFindEdit, IDC_ED_FINDTEXT );
// LPSTR_TEXTCALLBACKA means "send TTN_GETDISPINFOA to hEdit"
SendMessage( hToolTip, TTM_NEWTOOLRECTA, 0, (LPARAM) &tiA );
GetClientRect(hDlg, &g_QSearchDlg.pDockData->rcDragDrop);
}
else

if ( g_QSearchDlg.hFindEdit )
{
TOOLINFOW tiW;
if ( g_Plugin.bOldWindows )
{
TOOLINFOA tiA;

fillToolInfoW( &tiW, LPSTR_TEXTCALLBACKW, g_QSearchDlg.hFindEdit, IDC_ED_FINDTEXT );
// LPSTR_TEXTCALLBACKW means "send TTN_GETDISPINFOW to hEdit"
SendMessageW( hToolTip, TTM_NEWTOOLRECTW, 0, (LPARAM) &tiW );
fillToolInfoA( &tiA, LPSTR_TEXTCALLBACKA, g_QSearchDlg.hFindEdit, IDC_ED_FINDTEXT );
// LPSTR_TEXTCALLBACKA means "send TTN_GETDISPINFOA to hEdit"
SendMessage( hToolTip, TTM_NEWTOOLRECTA, 0, (LPARAM) &tiA );
}
else
{
TOOLINFOW tiW;

fillToolInfoW( &tiW, LPSTR_TEXTCALLBACKW, g_QSearchDlg.hFindEdit, IDC_ED_FINDTEXT );
// LPSTR_TEXTCALLBACKW means "send TTN_GETDISPINFOW to hEdit"
SendMessageW( hToolTip, TTM_NEWTOOLRECTW, 0, (LPARAM) &tiW );
}
}
}

break;
}
}
Expand Down

0 comments on commit 1668302

Please sign in to comment.