Example #1
0
BOOL TSetupSheet::SetData()
{
	if (resId == MAIN_SHEET) {
		if (sv) {
			sv->estimateMode	= cfg->estimateMode;
			sv->ignoreErr		= cfg->ignoreErr;
			sv->enableVerify	= cfg->enableVerify;
			sv->enableAcl		= cfg->enableAcl;
			sv->enableStream	= cfg->enableStream;
			sv->speedLevel		= cfg->speedLevel;
			sv->isExtendFilter	= cfg->isExtendFilter;
			sv->enableOwdel		= cfg->enableOwdel;
		}
		CheckDlgButton(ESTIMATE_CHECK, cfg->estimateMode);
		CheckDlgButton(IGNORE_CHECK, cfg->ignoreErr);
		CheckDlgButton(VERIFY_CHECK, cfg->enableVerify);
		CheckDlgButton(ACL_CHECK, cfg->enableAcl);
		CheckDlgButton(STREAM_CHECK, cfg->enableStream);
		SendDlgItemMessage(SPEED_SLIDER, TBM_SETRANGE, 0, MAKELONG(SPEED_SUSPEND, SPEED_FULL));
		SetSpeedLevelLabel(this, cfg->speedLevel);
		CheckDlgButton(EXTENDFILTER_CHECK, cfg->isExtendFilter);
		CheckDlgButton(OWDEL_CHECK, cfg->enableOwdel);

		if ((cfg->lcid == 0x409 || GetSystemDefaultLCID() == 0x411)) {
			//::ShowWindow(GetDlgItem(LCID_CHECK), SW_SHOW);
			::EnableWindow(GetDlgItem(LCID_CHECK), TRUE);
			CheckDlgButton(LCID_CHECK, cfg->lcid == -1 || cfg->lcid == 0x411 ? FALSE : TRUE);
		}
	}
	else if (resId == IO_SHEET) {
		SetDlgItemInt(BUFSIZE_EDIT, cfg->bufSize);
		SetDlgItemInt(OVLSIZE_EDIT, cfg->maxOvlSize);
		SetDlgItemInt(OVLNUM_EDIT, cfg->maxOvlNum);
		SetDlgItemInt(MAXTRANS_EDIT, cfg->maxOvlSize * cfg->maxOvlNum);
		if (cfg->minSectorSize == 0 || cfg->minSectorSize == 4096) {
			CheckDlgButton(SECTOR4096_CHECK, cfg->minSectorSize == 4096);
		} else {
			::EnableWindow(GetDlgItem(SECTOR4096_CHECK), FALSE);
		}
		CheckDlgButton(READOSBUF_CHECK, cfg->isReadOsBuf);
		SetDlgItemInt64(NONBUFMINNTFS_EDIT, cfg->nbMinSizeNtfs);
		SetDlgItemInt64(NONBUFMINFAT_EDIT, cfg->nbMinSizeFat);
		CheckDlgButton(LARGEFETCH_CHK, cfg->largeFetch);
	}
	else if (resId == PHYSDRV_SHEET) {
		SetDlgItemText(DRIVEMAP_EDIT, cfg->driveMap);
		SendDlgItemMessage(NETDRVMODE_COMBO, CB_ADDSTRING, 0, (LPARAM)LoadStr(IDS_NETDRV_UNC));
		SendDlgItemMessage(NETDRVMODE_COMBO, CB_ADDSTRING, 0, (LPARAM)LoadStr(IDS_NETDRV_SVR));
		SendDlgItemMessage(NETDRVMODE_COMBO, CB_ADDSTRING, 0, (LPARAM)LoadStr(IDS_NETDRV_ALL));
		SendDlgItemMessage(NETDRVMODE_COMBO, CB_SETCURSEL, cfg->netDrvMode, 0);
	}
	else if (resId == PARALLEL_SHEET) {
		SetDlgItemInt(MAXRUN_EDIT, cfg->maxRunNum);
		CheckDlgButton(FORCESTART_CHECK, cfg->forceStart);
	}
	else if (resId == COPYOPT_SHEET) {
		CheckDlgButton(SAMEDIR_RENAME_CHECK, cfg->isSameDirRename);
		CheckDlgButton(EMPTYDIR_CHECK, cfg->skipEmptyDir);
		CheckDlgButton(REPARSE_CHECK, cfg->isReparse);
		::EnableWindow(GetDlgItem(REPARSE_CHECK), TRUE);
		CheckDlgButton(MOVEATTR_CHECK, cfg->enableMoveAttr);
		CheckDlgButton(SERIALMOVE_CHECK, cfg->serialMove);
		CheckDlgButton(SERIALVERIFYMOVE_CHECK, cfg->serialVerifyMove);

		SendDlgItemMessage(DLSVT_CMB, CB_ADDSTRING, 0, (LPARAM)LoadStr(IDS_DLSVT_NONE));
		SendDlgItemMessage(DLSVT_CMB, CB_ADDSTRING, 0, (LPARAM)LoadStr(IDS_DLSVT_FAT));
		SendDlgItemMessage(DLSVT_CMB, CB_ADDSTRING, 0, (LPARAM)LoadStr(IDS_DLSVT_ALWAYS));
		SendDlgItemMessage(DLSVT_CMB, CB_SETCURSEL, cfg->dlsvtMode, 0);
		SetDlgItemText(TIMEGRACE_EDIT, Fmt("%lld", cfg->timeDiffGrace));

		SendDlgItemMessage(HASH_COMBO, CB_ADDSTRING, 0, (LPARAM)"MD5");
		SendDlgItemMessage(HASH_COMBO, CB_ADDSTRING, 0, (LPARAM)"SHA-1");
		SendDlgItemMessage(HASH_COMBO, CB_ADDSTRING, 0, (LPARAM)"SHA-256");
		SendDlgItemMessage(HASH_COMBO, CB_ADDSTRING, 0, (LPARAM)"xxHash");
		SendDlgItemMessage(HASH_COMBO, CB_SETCURSEL,
			cfg->hashMode <= Cfg::SHA256 ? int(cfg->hashMode) : 3, 0);
		CheckDlgButton(VERIFYREMOVE_CHK, cfg->verifyRemove);
	}
	else if (resId == DEL_SHEET) {
		CheckDlgButton(NSA_CHECK, cfg->enableNSA);
		CheckDlgButton(DELDIR_CHECK, cfg->delDirWithFilter);
	}
	else if (resId == LOG_SHEET) {
		SetDlgItemInt(HISTORY_EDIT, cfg->maxHistoryNext);
		CheckDlgButton(ERRLOG_CHECK, cfg->isErrLog);
		CheckDlgButton(UTF8LOG_CHECK, cfg->isUtf8Log);
		::EnableWindow(GetDlgItem(UTF8LOG_CHECK), TRUE);
		CheckDlgButton(FILELOG_CHECK, cfg->fileLogMode);
		CheckDlgButton(TIMESTAMP_CHECK, (cfg->fileLogFlags & FastCopy::FILELOG_TIMESTAMP) ?
			TRUE : FALSE);
		CheckDlgButton(FILESIZE_CHECK,  (cfg->fileLogFlags & FastCopy::FILELOG_FILESIZE)  ?
			TRUE : FALSE);
		CheckDlgButton(ACLERRLOG_CHECK, cfg->aclErrLog);
		::EnableWindow(GetDlgItem(ACLERRLOG_CHECK), TRUE);
		CheckDlgButton(STREAMERRLOG_CHECK, cfg->streamErrLog);
		::EnableWindow(GetDlgItem(STREAMERRLOG_CHECK), TRUE);
	}
	else if (resId == SHELLEXT_SHEET) {
		shext = make_unique<ShellExt>(cfg, this);
	}
	else if (resId == TRAY_SHEET) {
		CheckDlgButton(TASKBAR_CHECK, cfg->taskbarMode);
		SendDlgItemMessage(PLAY_BTN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hPlayIcon);

		gwin = make_unique<TGifWin>(this);
		gwin->SetGif(TRAY_GIF);

		TRect	rc;
		::GetWindowRect(GetDlgItem(IDC_COMMENT), &rc);
		rc.ScreenToClient(hWnd);
		gwin->Create(rc.x() + 10, rc.bottom + 5);
		gwin->Show();
	}
	else if (resId == MISC_SHEET) {
		if (IsWin7()) {
			::ShowWindow(GetDlgItem(DIRSEL_CHK), SW_HIDE);
		}

		CheckDlgButton(UPDATE_CHK, cfg->updCheck ? TRUE : FALSE);
		CheckDlgButton(EXECCONFIRM_CHECK, cfg->execConfirm);
		CheckDlgButton(DIRSEL_CHK, cfg->dirSel);
		CheckDlgButton(FINISH_CHECK, (cfg->finishNotify & 1));
		CheckDlgButton(SPAN1_RADIO + cfg->infoSpan, 1);
		CheckDlgButton(PREVENTSLEEP_CHECK, cfg->preventSleep);
		CheckDlgButton(TEST_CHECK, cfg->testMode);
	}
	return	TRUE;
}