コード例 #1
0
ファイル: Setup.cpp プロジェクト: guowei8412/upp-mirror
void FontSelectManager::Set(Font f) {
	int fi = f.GetFace();
	if(!face->HasKey(fi)) {
		fi = face->FindValue(f.GetFaceName());
		if(fi < 0)
			fi = Font::COURIER;
		else
			fi = face->GetKey(fi);
	}
	face->SetData(fi);
	FaceSelect();
	height->SetData(f.GetHeight());
	for(int i = 0; i < height->GetCount(); i++) {
		int q = height->GetKey(i);
		if(f.GetHeight() <= q) {
			height->SetData(q);
			break;
		}
	}
	*bold = f.IsBold();
	*italic = f.IsItalic();
	*naa = f.IsNonAntiAliased();
}
コード例 #2
0
void PropertiesWindow::Property(const String& id, const String& label, const String& type,
	const Array<String>& prop)
{
	if (type == "Option")
	{
		EditIntSpinEx* p = &_Properties.Create<EditIntSpinEx>(id);
		p->Min(0).Max(1);

		if (prop.GetCount())
		{
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "EditInt")
	{
		EditInt* p = &_Properties.Create<EditInt>(id);
		if (prop.GetCount())
		{
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "EditField")
	{
		EditField* p = &_Properties.Create<EditField>(id);
		if (prop.GetCount())
		{
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "EditTabs")
	{
		EditTabs* p = &_Properties.Create<EditTabs>(id);
		p->WhenEndEdit = THISBACK1(OnEndEdit, 0);
		if (prop.GetCount())
		{
			p->SetLabel(t_("Change tabs..."));
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "EditColumns")
	{
		EditColumns* p = &_Properties.Create<EditColumns>(id);
		p->WhenEndEdit = THISBACK1(OnEndEdit, 0);
		if (prop.GetCount())
		{
			p->SetLabel(t_("Change columns..."));
			p->SetData(prop[0]);
			_Options.AddRow(label, AsString(prop[0]));
		}
	}

	if (type == "DropList")
	{
		if (prop.GetCount() < 2) return;

		DropList* p = &_Properties.Create<DropList>(id);
		for (int i = 1; i < prop.GetCount(); ++i)
			p->Add(prop[i]);

		if (prop.GetCount())
		{
			String option = prop[ prop[0].IsEmpty() ? 1 : 0 ];
			_Options.AddRow(label, option);
			p->SetData(option);
		}
	}
}