X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a62da4c56f4bbfcd42ba85ba2a7b0dc6c5bc2af9..a0086878b09ea394de9f5746a5e8f066a3d12dec:/contrib/utils/wxrcedit/pe_adv.cpp diff --git a/contrib/utils/wxrcedit/pe_adv.cpp b/contrib/utils/wxrcedit/pe_adv.cpp index 415ea6e5c1..4f7b59f398 100644 --- a/contrib/utils/wxrcedit/pe_adv.cpp +++ b/contrib/utils/wxrcedit/pe_adv.cpp @@ -94,9 +94,13 @@ void PropEditCtrlChoice::WriteValue() -void PropEditCtrlChoice::OnChoice(wxCommandEvent& event) +void PropEditCtrlChoice::OnChoice(wxCommandEvent& WXUNUSED(event)) { - if (CanSave()) WriteValue(); + if (CanSave()) + { + WriteValue(); + EditorFrame::Get()->NotifyChanged(CHANGED_PROPS); + } } @@ -109,11 +113,12 @@ void PropEditCtrlColor::OnDetails() wxString txt = m_TextCtrl->GetValue(); long unsigned tmp; - if (txt.Length() == 7 && txt[0] == _T('#') && + if (txt.Length() == 7 && txt[0u] == _T('#') && wxSscanf(txt.c_str(), _T("#%lX"), &tmp) == 1) clr = wxColour((tmp & 0xFF0000) >> 16, (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF)); + clr = wxGetColourFromUser(NULL, clr); if (clr.Ok()) { @@ -161,6 +166,7 @@ void PropEditCtrlFlags::OnDetails() dlg.SetSizer(sz); dlg.SetAutoLayout(TRUE); + dlg.Layout(); for (i = 0; i < arr.GetCount(); i++) lbox->Append(arr[i]); @@ -193,3 +199,62 @@ void PropEditCtrlFlags::OnDetails() } + + + + + + +wxString PropEditCtrlFile::GetFileTypes() +{ + return m_PropInfo->MoreInfo; +} + + + +void PropEditCtrlFile::OnDetails() +{ + wxString txt = m_TextCtrl->GetValue(); + txt = wxPathOnly(EditorFrame::Get()->GetFileName()) + _T("/") + txt; + wxString name = wxFileSelector(_("Choose file"), + wxPathOnly(txt), + wxFileNameFromPath(txt), + _T(""), + GetFileTypes(), + wxOPEN | wxFILE_MUST_EXIST); + if (!name) return; + + // compute relative path: + wxArrayString axrc, afile; + wxStringTokenizer tkn; + tkn.SetString(name, _T("/\\")); + while (tkn.HasMoreTokens()) afile.Add(tkn.GetNextToken()); + tkn.SetString(EditorFrame::Get()->GetFileName(), _T("/\\")); + while (tkn.HasMoreTokens()) axrc.Add(tkn.GetNextToken()); + + if (afile.GetCount() == 0 || axrc.GetCount() == 0) + txt = name; + else + { + while (axrc[0] == afile[0]) + { + afile.RemoveAt(0u); + axrc.RemoveAt(0u); + } + size_t i; + txt.Empty(); + for (i = 0; i < axrc.GetCount()-1/*w/o filename*/; i++) txt << _T("../"); + for (i = 0; i < afile.GetCount(); i++) txt << afile[i] << _T("/"); + txt.RemoveLast(); + } + + m_TextCtrl->SetValue(txt); + WriteValue(); +} + + + +wxString PropEditCtrlImageFile::GetFileTypes() +{ + return _("GIF files (*.gif)|*.gif|JPEG files (*.jpg)|*.jpg|PNG files (*.png)|*.png|BMP files (*.bmp)|*.bmp|All files (*)|*"); +}