Example #1
0
void PropPanel::SetCurrentItem(vtItem *item)
{
	if (item)
	{
		m_strItem = wxString(item->m_name, wxConvUTF8);
		const char *type = item->GetValueString("type");
		if (type)
			m_strType = wxString(type, wxConvUTF8);
		else
			m_strType = _T("unknown");
		const char *subtype = item->GetValueString("subtype");
		if (subtype)
			m_strSubtype = wxString(subtype, wxConvUTF8);
		else
			m_strSubtype = _T("");
	}
	else
	{
		m_strItem = _T("");
		m_strType = _("unspecified");
	}
	m_pCurrentItem = item;

	m_bUpdating = true;
	TransferDataToWindow();
	int sel = m_pTypeChoice->FindString(m_strType);
	if (sel != -1)
		m_pTypeChoice->SetSelection(sel);
	else
		m_pTypeChoice->SetSelection(0);
	UpdateSubtypes();
	UpdateTagList();
	m_bUpdating = false;
}
Example #2
0
void FTagControlEdit::OnCreateButton(wxCommandEvent& event)
{
	FNewTagDialog oDialog(this, wxID_ANY);
	if (oDialog.ShowModal() == wxID_OK)
	{
		wxString sName = wxString(oDialog.GetTagName().c_str(), wxConvISO8859_1);
		
		UpdateTagList();
		m_pTag->SetSelection(m_pTag->FindString(sName), true);
	}
}
Example #3
0
void PropPanel::OnRemoveTag( wxCommandEvent &event )
{
	int sel = m_pTagList->GetNextItem(-1, wxLIST_NEXT_ALL,
		wxLIST_STATE_SELECTED);

	if (sel != -1)
	{
		int tagnum = m_pTagList->GetItemData(sel);
		m_pCurrentItem->RemoveTag(tagnum);
		UpdateTagList();
	}
}
Example #4
0
void PropPanel::OnAddTag( wxCommandEvent &event )
{
	GetMainFrame()->RenderingPause();
	TagDlg dlg(GetMainFrame(), -1, _T("Add New Tag"));
	if (dlg.ShowModal() == wxID_OK)
	{
		vtTag tag;
		tag.name = dlg.m_strName.mb_str();
		tag.value = dlg.m_strValue.mb_str();
		m_pCurrentItem->AddTag(tag);
		UpdateTagList();
	}
	GetMainFrame()->RenderingResume();
}
Example #5
0
bool FTagControlEdit::Create(wxWindow *parent, wxWindowID id, const wxString& sLabel)
{
	wxPanel::Create(parent, id);

	wxStaticBoxSizer* pSizer = new wxStaticBoxSizer(wxVERTICAL, this, sLabel);
	{
		m_pTag = new FListControl(this, ID_Tag, wxDefaultPosition, wxSize(150, -1)/*, wxArrayString(), wxLB_MULTIPLE*/);
		pSizer->Add(m_pTag, 0, 0, 0);
		
		pSizer->AddSpacer(5);

		m_pCreateBtn = new wxButton(this, ID_CreateBtn, wxT("Create new"), wxDefaultPosition, wxSize(150, -1));
		pSizer->Add(m_pCreateBtn, 0, 0, 0);
	}
	SetSizeHints(160, -1, 160, -1);
	SetSizerAndFit(pSizer);
	Layout();

	UpdateTagList();

	return true;
}
Example #6
0
void PropPanel::OnTagEdit( wxCommandEvent &event )
{
	GetMainFrame()->RenderingPause();

	int sel = m_pTagList->GetNextItem(-1, wxLIST_NEXT_ALL,
		wxLIST_STATE_SELECTED);

	if (sel != -1)
	{
		int tagnum = m_pTagList->GetItemData(sel);
		vtTag *tag = m_pCurrentItem->GetTag(tagnum);

		TagDlg dlg(GetMainFrame(), -1, _T("Edit Tag"));
		dlg.m_strName = wxString(tag->name, wxConvUTF8);
		dlg.m_strValue = wxString(tag->value, wxConvUTF8);
		if (dlg.ShowModal() == wxID_OK)
		{
			tag->name = dlg.m_strName.mb_str(wxConvUTF8);
			tag->value = dlg.m_strValue.mb_str(wxConvUTF8);
			UpdateTagList();
		}
	}
	GetMainFrame()->RenderingResume();
}