Beispiel #1
0
bool BrowseDlg::setPath(const tstring& aPath, bool forced) {
	if (aPath.empty())
		return false;

	checkinit();

	auto target = Text::toT(Util::validatePath(Text::fromT(aPath)));

	// Prefill the filename
	auto fileName = Util::getFileName(target);
	if (!fileName.empty()) {
		pfd->SetFileName(fileName.c_str());
	}

	// Set the given directory
	CComPtr<IShellItem> psiFolder;
	if (SUCCEEDED(SHCreateItemFromParsingName(Util::getFilePath(target).c_str(), NULL, IID_PPV_ARGS(&psiFolder)))) {
		if (forced) {
			check(pfd->SetFolder(psiFolder));
		} else {
			check(pfd->SetDefaultFolder(psiFolder));
		}
	}

	return true;
}
Beispiel #2
0
int
main(int argc, char *argv[])
{
	checkinit(argc, argv);
	zcheckbinopi64(hebi_zaddi, "%Z + %lld", 0);
	return 0;
}
Beispiel #3
0
int
main(int argc, char *argv[])
{
	checkinit(argc, argv);
	zcheckbinop(hebi_zmul, "%Z * %Z", 0);
	return 0;
}
Beispiel #4
0
int
main(int argc, char *argv[])
{
	checkinit(argc, argv);
	zcheckbinopu64(hebi_zsubu, "%Z - %llu", 0);
	return 0;
}
Beispiel #5
0
int
main(int argc, char *argv[])
{
	checkinit(argc, argv);
	zcheckunaryop(hebi_zneg, "-(%Z)", 0);
	return 0;
}
Beispiel #6
0
int
main(int argc, char *argv[])
{
	checkinit(argc, argv);
	bcwrite(abs_script);
	zcheckbinop(hebi_zaddmag, "abs(%Z) + abs(%Z)", 0);
	return 0;
}
Beispiel #7
0
int
main(int argc, char *argv[])
{
	checkinit(argc, argv);
	bcwrite(cmp_script);
	zcheckbinopi64(zcmpi_wrapper, "cmp(%Z, %lld)", 0);
	return 0;
}
Beispiel #8
0
int
main(int argc, char *argv[])
{
	check_max_perm = 64;
	check_scale_perm = 2;
	checkinit(argc, argv);
	bcwrite(or_script);
	zcheckbinop(hebi_zor, "or(%Z, %Z)", 0);
	return 0;
}
Beispiel #9
0
bool BrowseDlg::show(tstring& target) {
	checkinit();

	// Show the dialog
	auto hr = pfd->Show(m_hwnd);
	if (SUCCEEDED(hr)) {
		// Obtain the result once the user clicks 
		// the 'Open' button.
		// The result is an IShellItem object.
		IShellItem *psiResult;
		hr = pfd->GetResult(&psiResult);
		if (SUCCEEDED(hr)) {
			// Copy the path
			PWSTR pszFilePath = NULL;
			hr = psiResult->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
			if (SUCCEEDED(hr)) {
				target = Text::toT(Util::validatePath(Text::fromT(pszFilePath), type == DIALOG_SELECT_FOLDER));
			}
			psiResult->Release();
		}
	}

	return SUCCEEDED(hr);
}
Beispiel #10
0
bool BrowseDlg::setTitle(const tstring& aTitle) {
	checkinit();
	check(pfd->SetTitle(aTitle.c_str()));
	return true;
}
Beispiel #11
0
bool BrowseDlg::setTypeIndex(int aIndex) {
	checkinit();
	check(pfd->SetFileTypeIndex(aIndex));
	return true;
}
Beispiel #12
0
bool BrowseDlg::setOkLabel(const tstring& aText) {
	checkinit();
	check(pfd->SetOkButtonLabel(aText.c_str()));
	return true;
}
Beispiel #13
0
bool BrowseDlg::setFileName(const tstring& aName) {
	checkinit();
	check(pfd->SetFileName(aName.c_str()));
	return true;
}
Beispiel #14
0
bool BrowseDlg::setTypes(int typeCount, const COMDLG_FILTERSPEC* types) {
	checkinit();
	check(pfd->SetFileTypes(typeCount, types));
	return true;
}