--- C:/DOCUME~1/Bogdan/LOCALS~1/Temp/SumatraPDF-revBASE.svn004.tmp.cpp Wed Nov 25 01:11:30 2009 +++ C:/vc/sumatrapdf/src/SumatraPDF.cpp Wed Nov 25 01:05:22 2009 @@ -95,6 +95,8 @@ #define ABOUT_BG_COLOR RGB(255,242,0) #endif +#define COL_FWDSEARCH_BG RGB(101,129,255) + #define FRAME_CLASS_NAME _T("SUMATRA_PDF_FRAME") #define CANVAS_CLASS_NAME _T("SUMATRA_PDF_CANVAS") #define ABOUT_CLASS_NAME _T("SUMATRA_PDF_ABOUT") @@ -199,6 +201,9 @@ DEFAULT_WIN_POS, // int m_windowDy 1, // int m_showToc 0, // int m_globalPrefsOnly + 0, // int m_fwdsearchOffset + COL_FWDSEARCH_BG, // int m_fwdsearchColor + 15, // int m_fwdsearchWidth }; typedef struct ToolbarButtonInfo { @@ -2738,7 +2743,7 @@ DrawText(hdc, txt, lstrlen(txt), r, DT_CENTER | DT_VCENTER | DT_SINGLELINE); } -static void PaintTransparentRectangle(WindowInfo *win, HDC hdc, RectI *rect, DWORD selectionColor, int margin = 1) { +static void PaintTransparentRectangle(WindowInfo *win, HDC hdc, RectI *rect, DWORD selectionColor, int margin = 1, int fwdsearch = 0) { HBITMAP hbitmap; // bitmap handle BITMAPINFO bmi; // bitmap header VOID *pvBits; // pointer to DIB section @@ -2773,7 +2778,10 @@ bf.SourceConstantAlpha = 0x5f; bf.AlphaFormat = AC_SRC_ALPHA; - AlphaBlend(hdc, rect->x, rect->y, rect->dx, rect->dy, rectDC, 0, 0, rect->dx, rect->dy, bf); + if (fwdsearch && gGlobalPrefs.m_fwdsearchOffset > 0) + AlphaBlend(hdc, gGlobalPrefs.m_fwdsearchOffset, rect->y-4, 15, rect->dy+8, rectDC, 0, 0, rect->dx, rect->dy, bf); + else + AlphaBlend(hdc, rect->x, rect->y, rect->dx, rect->dy, rectDC, 0, 0, rect->dx, rect->dy, bf); DeleteObject (hbitmap); DeleteDC (rectDC); } @@ -2811,7 +2819,10 @@ if (!pageInfo->visible) return; - const DWORD selectionColorBlue = 0xffAFBEFF; + const DWORD selectionColorBlue = 0xff000000 | + (GetRValue(gGlobalPrefs.m_fwdsearchColor) << 16) | + (GetGValue(gGlobalPrefs.m_fwdsearchColor) << 8) | + GetBValue(gGlobalPrefs.m_fwdsearchColor); RectD recD; RectI recI; @@ -2822,7 +2833,7 @@ RectD_FromRectI (&recD, &win->fwdsearchmarkRects[i]); win->dm->rectCvtUserToScreen (win->fwdsearchmarkPage, &recD); RectI_FromRectD (&recI, &recD); - PaintTransparentRectangle(win, hdc, &recI, selectionColorBlue, 0); + PaintTransparentRectangle(win, hdc, &recI, selectionColorBlue, 0, 1); } } @@ -7004,7 +7015,7 @@ #define is_arg(txt) tstr_ieq(_T(txt), currArg->str) /* Parse 'txt' as hex color and set it as background color */ -static void ParseBgColor(const TCHAR* txt) +static void ParseBgColor(int *destColor, const TCHAR* txt) { if (tstr_startswith(txt, _T("0x"))) txt += 2; @@ -7021,8 +7032,7 @@ return; if (*txt) return; - int col = RGB(r,g,b); - gGlobalPrefs.m_bgColor = col; + *destColor = RGB(r,g,b); } HDDEDATA CALLBACK DdeCallback(UINT uType, @@ -7254,13 +7264,25 @@ } else if (is_arg("-bgcolor") && currArg->next) { currArg = currArg->next; - ParseBgColor(currArg->str); + ParseBgColor(&gGlobalPrefs.m_bgColor, currArg->str); } else if (is_arg("-inverse-search") && currArg->next) { currArg = currArg->next; free(gGlobalPrefs.m_inverseSearchCmdLine); gGlobalPrefs.m_inverseSearchCmdLine = tstr_dup(currArg->str); } + else if (is_arg("-fwdsearch-offset") && currArg->next) { + currArg = currArg->next; + gGlobalPrefs.m_fwdsearchOffset = _ttoi(currArg->str); + } + else if (is_arg("-fwdsearch-width") && currArg->next) { + currArg = currArg->next; + gGlobalPrefs.m_fwdsearchWidth = _ttoi(currArg->str); + } + else if (is_arg("-fwdsearch-color") && currArg->next) { + currArg = currArg->next; + ParseBgColor(&gGlobalPrefs.m_fwdsearchColor, currArg->str); + } else if (is_arg("-esc-to-exit")) { gGlobalPrefs.m_escToExit = TRUE; }