static void GetCommandLineInfo(CommandLineInfo& i)
{
    i.bgColor = gGlobalPrefs->mainWindowBackground;
    i.forwardSearch = gGlobalPrefs->forwardSearch;
    i.escToExit = gGlobalPrefs->escToExit;
    i.cbxMangaMode = gGlobalPrefs->comicBookUI.cbxMangaMode;
    i.textColor = GetFixedPageUiTextColor();
    i.backgroundColor = GetFixedPageUiBgColor();
    i.ParseCommandLine(GetCommandLine());
}
static void GetCommandLineInfo(CommandLineInfo& i)
{
    i.bgColor = gGlobalPrefs.bgColor;
    i.fwdSearch.offset = gGlobalPrefs.fwdSearch.offset;
    i.fwdSearch.width = gGlobalPrefs.fwdSearch.width;
    i.fwdSearch.color = gGlobalPrefs.fwdSearch.color;
    i.fwdSearch.permanent = gGlobalPrefs.fwdSearch.permanent;
    i.escToExit = gGlobalPrefs.escToExit;
    i.cbxR2L = gGlobalPrefs.cbxR2L;
    if (gGlobalPrefs.useSysColors) {
        i.colorRange[0] = GetSysColor(COLOR_WINDOWTEXT);
        i.colorRange[1] = GetSysColor(COLOR_WINDOW);
    }
    i.ParseCommandLine(GetCommandLine());
}
Exemple #3
0
static void GetCommandLineInfo(CommandLineInfo& i)
{
    i.bgColor = gUserPrefs->mainWindowBackground;
    i.forwardSearch = gUserPrefs->forwardSearch;
    i.escToExit = gUserPrefs->escToExit;
    i.cbxR2L = gGlobalPrefs->cbxR2L;
    if (gGlobalPrefs->useSysColors) {
        i.colorRange[0] = GetSysColor(COLOR_WINDOWTEXT);
        i.colorRange[1] = GetSysColor(COLOR_WINDOW);
    }
    else {
        i.colorRange[0] = gUserPrefs->textColor;
        i.colorRange[1] = gUserPrefs->pageColor;
    }
    i.ParseCommandLine(GetCommandLine());
}
static void GetCommandLineInfo(CommandLineInfo& i)
{
    i.bgColor = gGlobalPrefs->mainWindowBackground;
    i.forwardSearch = gGlobalPrefs->forwardSearch;
    i.escToExit = gGlobalPrefs->escToExit;
    i.cbxMangaMode = gGlobalPrefs->comicBookUI.cbxMangaMode;
    if (gGlobalPrefs->useSysColors) {
        i.colorRange[0] = GetSysColor(COLOR_WINDOWTEXT);
        i.colorRange[1] = GetSysColor(COLOR_WINDOW);
    }
    else {
        i.colorRange[0] = gGlobalPrefs->fixedPageUI.textColor;
        i.colorRange[1] = gGlobalPrefs->fixedPageUI.backgroundColor;
    }
    i.ParseCommandLine(GetCommandLine());
}
static void GetCommandLineInfo(CommandLineInfo& i)
{
    i.bgColor = gGlobalPrefs.bgColor;
    i.fwdSearch.offset = gGlobalPrefs.fwdSearch.offset;
    i.fwdSearch.width = gGlobalPrefs.fwdSearch.width;
    i.fwdSearch.color = gGlobalPrefs.fwdSearch.color;
    i.fwdSearch.permanent = gGlobalPrefs.fwdSearch.permanent;
    i.escToExit = gGlobalPrefs.escToExit || gUserPrefs.escToExit;
    i.cbxR2L = gGlobalPrefs.cbxR2L;
    if (gGlobalPrefs.useSysColors) {
        i.colorRange[0] = GetSysColor(COLOR_WINDOWTEXT);
        i.colorRange[1] = GetSysColor(COLOR_WINDOW);
    }
    else {
        i.colorRange[0] = gUserPrefs.textColor;
        i.colorRange[1] = gUserPrefs.pageColor;
    }
    // TODO: update with values from SumatraPDF-user.ini
    i.ParseCommandLine(GetCommandLine());
}
void ConfigureWizard::parseCommandLineInfo(const CommandLineInfo &info)
{
  _targetPage.build64bit(info.build64bit());
  _targetPage.excludeDeprecated(info.excludeDeprecated());
  _targetPage.includeIncompatibleLicense(info.includeIncompatibleLicense());
  _targetPage.includeOptional(info.includeOptional());
  _targetPage.installedSupport(info.installedSupport());
  _targetPage.quantumDepth(info.quantumDepth());
  _targetPage.solutionType(info.solutionType());
  _targetPage.useHDRI(info.useHDRI());
  _targetPage.useOpenCL(info.useOpenCL());
  _targetPage.useOpenMP(info.useOpenMP());
  _targetPage.visualStudioVersion(info.visualStudioVersion());
  _targetPage.zeroConfigurationSupport(info.zeroConfigurationSupport());
}
Exemple #7
0
static void ParseCommandLineTest() {
    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench foo.pdf");
        utassert(2 == i.pathsToBenchmark.size());
        utassert(str::Eq(L"foo.pdf", i.pathsToBenchmark.at(0)));
        utassert(nullptr == i.pathsToBenchmark.at(1));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench foo.pdf -fwdsearch-width 5");
        utassert(i.globalPrefArgs.size() == 2);
        const WCHAR* s = i.globalPrefArgs.at(0);
        utassert(str::Eq(s, L"-fwdsearch-width"));
        s = i.globalPrefArgs.at(1);
        utassert(str::Eq(s, L"5"));
        utassert(2 == i.pathsToBenchmark.size());
        utassert(str::Eq(L"foo.pdf", i.pathsToBenchmark.at(0)));
        utassert(nullptr == i.pathsToBenchmark.at(1));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench bar.pdf loadonly");
        utassert(2 == i.pathsToBenchmark.size());
        utassert(str::Eq(L"bar.pdf", i.pathsToBenchmark.at(0)));
        utassert(str::Eq(L"loadonly", i.pathsToBenchmark.at(1)));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench bar.pdf 1 -set-color-range 0x123456 #abCDef");
        utassert(i.globalPrefArgs.size() == 3);
        utassert(2 == i.pathsToBenchmark.size());
        utassert(str::Eq(L"bar.pdf", i.pathsToBenchmark.at(0)));
        utassert(str::Eq(L"1", i.pathsToBenchmark.at(1)));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench bar.pdf 1-5,3   -bench some.pdf 1,3,8-34");
        utassert(4 == i.pathsToBenchmark.size());
        utassert(str::Eq(L"bar.pdf", i.pathsToBenchmark.at(0)));
        utassert(str::Eq(L"1-5,3", i.pathsToBenchmark.at(1)));
        utassert(str::Eq(L"some.pdf", i.pathsToBenchmark.at(2)));
        utassert(str::Eq(L"1,3,8-34", i.pathsToBenchmark.at(3)));
    }

    {
        CommandLineInfo i;
        utassert(false == i.invertColors);
        i.ParseCommandLine(L"SumatraPDF.exe -presentation -bgcolor 0xaa0c13 foo.pdf -invert-colors bar.pdf");
        utassert(true == i.enterPresentation);
        utassert(true == i.invertColors);
        utassert(2 == i.fileNames.size());
        utassert(0 == i.fileNames.Find(L"foo.pdf"));
        utassert(1 == i.fileNames.Find(L"bar.pdf"));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bg-color 0xaa0c13 -invertcolors rosanna.pdf");
        utassert(true == i.invertColors);
        utassert(1 == i.fileNames.size());
        utassert(0 == i.fileNames.Find(L"rosanna.pdf"));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe \"foo \\\" bar \\\\.pdf\" un\\\"quoted.pdf");
        utassert(2 == i.fileNames.size());
        utassert(0 == i.fileNames.Find(L"foo \" bar \\\\.pdf"));
        utassert(1 == i.fileNames.Find(L"un\"quoted.pdf"));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(
            L"SumatraPDF.exe -page 37 -view continuousfacing -zoom fitcontent -scroll 45,1234 -reuse-instance");
        utassert(0 == i.fileNames.size());
        utassert(i.pageNumber == 37);
        utassert(i.startView == DM_CONTINUOUS_FACING);
        utassert(i.startZoom == ZOOM_FIT_CONTENT);
        utassert(i.startScroll.x == 45 && i.startScroll.y == 1234);
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -view \"single page\" -zoom 237.45 -scroll -21,-1");
        utassert(0 == i.fileNames.size());
        utassert(i.startView == DM_SINGLE_PAGE);
        utassert(i.startZoom == 237.45f);
        utassert(i.startScroll.x == -21 && i.startScroll.y == -1);
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -zoom 35%");
        utassert(0 == i.fileNames.size());
        utassert(i.startZoom == 35.f);
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -zoom fit-content");
        utassert(i.startZoom == ZOOM_FIT_CONTENT);
        utassert(0 == i.fileNames.size());
    }
}
static void ParseCommandLineTest()
{
    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench foo.pdf");
        utassert(2 == i.pathsToBenchmark.Count());
        utassert(str::Eq(L"foo.pdf", i.pathsToBenchmark.At(0)));
        utassert(NULL == i.pathsToBenchmark.At(1));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench foo.pdf -fwdsearch-width 5");
        utassert(5 == i.forwardSearch.highlightWidth);
        utassert(2 == i.pathsToBenchmark.Count());
        utassert(str::Eq(L"foo.pdf", i.pathsToBenchmark.At(0)));
        utassert(NULL == i.pathsToBenchmark.At(1));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench bar.pdf loadonly");
        utassert(2 == i.pathsToBenchmark.Count());
        utassert(str::Eq(L"bar.pdf", i.pathsToBenchmark.At(0)));
        utassert(str::Eq(L"loadonly", i.pathsToBenchmark.At(1)));
    }

    {
        CommandLineInfo i;
        utassert(i.textColor == WIN_COL_BLACK && i.backgroundColor == WIN_COL_WHITE);
        i.ParseCommandLine(L"SumatraPDF.exe -bench bar.pdf 1 -set-color-range 0x123456 #abCDef");
        utassert(i.textColor == RGB(0x12, 0x34, 0x56));
        utassert(i.backgroundColor == RGB(0xAB, 0xCD, 0xEF));
        utassert(2 == i.pathsToBenchmark.Count());
        utassert(str::Eq(L"bar.pdf", i.pathsToBenchmark.At(0)));
        utassert(str::Eq(L"1", i.pathsToBenchmark.At(1)));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -bench bar.pdf 1-5,3   -bench some.pdf 1,3,8-34");
        utassert(4 == i.pathsToBenchmark.Count());
        utassert(str::Eq(L"bar.pdf", i.pathsToBenchmark.At(0)));
        utassert(str::Eq(L"1-5,3", i.pathsToBenchmark.At(1)));
        utassert(str::Eq(L"some.pdf", i.pathsToBenchmark.At(2)));
        utassert(str::Eq(L"1,3,8-34", i.pathsToBenchmark.At(3)));
    }

    {
        CommandLineInfo i;
        utassert(i.textColor == WIN_COL_BLACK && i.backgroundColor == WIN_COL_WHITE);
        i.ParseCommandLine(L"SumatraPDF.exe -presentation -bgcolor 0xaa0c13 foo.pdf -invert-colors bar.pdf");
        utassert(true == i.enterPresentation);
        utassert(i.textColor == WIN_COL_WHITE && i.backgroundColor == WIN_COL_BLACK);
        utassert(1248426 == i.bgColor);
        utassert(2 == i.fileNames.Count());
        utassert(0 == i.fileNames.Find(L"foo.pdf"));
        utassert(1 == i.fileNames.Find(L"bar.pdf"));
    }

    {
        CommandLineInfo i;
        utassert(i.textColor == WIN_COL_BLACK && i.backgroundColor == WIN_COL_WHITE);
        i.ParseCommandLine(L"SumatraPDF.exe -bg-color 0xaa0c13 -invertcolors rosanna.pdf");
        utassert(i.textColor == WIN_COL_WHITE && i.backgroundColor == WIN_COL_BLACK);
        utassert(1248426 == i.bgColor);
        utassert(1 == i.fileNames.Count());
        utassert(0 == i.fileNames.Find(L"rosanna.pdf"));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe \"foo \\\" bar \\\\.pdf\" un\\\"quoted.pdf");
        utassert(2 == i.fileNames.Count());
        utassert(0 == i.fileNames.Find(L"foo \" bar \\\\.pdf"));
        utassert(1 == i.fileNames.Find(L"un\\\"quoted.pdf"));
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -page 37 -view continuousfacing -zoom fitcontent -scroll 45,1234 -reuse-instance");
        utassert(0 == i.fileNames.Count());
        utassert(i.pageNumber == 37);
        utassert(i.startView == DM_CONTINUOUS_FACING);
        utassert(i.startZoom == ZOOM_FIT_CONTENT);
        utassert(i.startScroll.x == 45 && i.startScroll.y == 1234);
    }

    {
        CommandLineInfo i;
        i.ParseCommandLine(L"SumatraPDF.exe -view \"single page\" -zoom 237.45 -scroll -21,-1");
        utassert(0 == i.fileNames.Count());
        utassert(i.startView == DM_SINGLE_PAGE);
        utassert(i.startZoom == 237.45f);
        utassert(i.startScroll.x == -21 && i.startScroll.y == -1);
    }
}