X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aaa2b34e816810e376a2cd471755c11713bcd481..b388e8cdec4f45124f31525e651a5e335965e4be:/contrib/utils/wxrcedit/pe_adv.cpp diff --git a/contrib/utils/wxrcedit/pe_adv.cpp b/contrib/utils/wxrcedit/pe_adv.cpp index c5776cbb42..e89206d328 100644 --- a/contrib/utils/wxrcedit/pe_adv.cpp +++ b/contrib/utils/wxrcedit/pe_adv.cpp @@ -36,7 +36,7 @@ wxWindow* PropEditCtrlFont::CreateEditCtrl() { PropEditCtrlTxt::CreateEditCtrl(); - m_TextCtrl->Enable(FALSE); + m_TextCtrl->Disable(); return m_TextCtrl; } @@ -61,18 +61,18 @@ wxTreeItemId PropEditCtrlFont::CreateTreeEntry(wxTreeItemId parent, const Proper BEGIN_EVENT_TABLE(PropEditCtrlChoice, PropEditCtrl) - EVT_CHOICE(-1, PropEditCtrlChoice::OnChoice) + EVT_CHOICE(wxID_ANY, PropEditCtrlChoice::OnChoice) END_EVENT_TABLE() wxWindow* PropEditCtrlChoice::CreateEditCtrl() { - m_Choice = new wxChoice(this, -1); - + m_Choice = new wxChoice(this, wxID_ANY); + return m_Choice; } - + void PropEditCtrlChoice::ReadValue() { wxStringTokenizer tkn(m_PropInfo->MoreInfo, _T(",")); @@ -94,12 +94,12 @@ void PropEditCtrlChoice::WriteValue() -void PropEditCtrlChoice::OnChoice(wxCommandEvent& event) +void PropEditCtrlChoice::OnChoice(wxCommandEvent& WXUNUSED(event)) { - if (CanSave()) + if (CanSave()) { WriteValue(); - EditorFrame::Get()->NotifyChanged(CHANGED_PROPS); + EditorFrame::Get()->NotifyChanged(CHANGED_PROPS); } } @@ -112,12 +112,13 @@ void PropEditCtrlColor::OnDetails() wxColour clr; 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 = wxColour((unsigned char)((tmp & 0xFF0000) >> 16), + (unsigned char)((tmp & 0x00FF00) >> 8), + (unsigned char)((tmp & 0x0000FF))); + clr = wxGetColourFromUser(NULL, clr); if (clr.Ok()) { @@ -142,19 +143,19 @@ void PropEditCtrlFlags::OnDetails() wxArrayString arr; size_t i; int j; - + wxStringTokenizer tkn(m_PropInfo->MoreInfo, _T(",")); while (tkn.HasMoreTokens()) arr.Add(tkn.GetNextToken()); wxConfigBase *cfg = wxConfigBase::Get(); - - wxDialog dlg(m_PropFrame, -1, _("Flags"), - wxPoint(cfg->Read(_T("flagsdlg_x"), -1), cfg->Read(_T("flagsdlg_y"), -1)), + + wxDialog dlg(m_PropFrame, wxID_ANY, _("Flags"), + wxPoint(cfg->Read(_T("flagsdlg_x"), wxDefaultCoord), cfg->Read(_T("flagsdlg_y"), wxDefaultCoord)), wxSize(cfg->Read(_T("flagsdlg_w"), 300), cfg->Read(_T("flagsdlg_h"), 300)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); wxSizer *sz = new wxBoxSizer(wxVERTICAL); - wxCheckListBox *lbox = new wxCheckListBox(&dlg, -1); + wxCheckListBox *lbox = new wxCheckListBox(&dlg, wxID_ANY); sz->Add(lbox, 1, wxEXPAND | wxALL, 10); wxSizer *sz2 = new wxBoxSizer(wxHORIZONTAL); wxButton *btnok = new wxButton(&dlg, wxID_OK, _("OK")); @@ -164,12 +165,11 @@ void PropEditCtrlFlags::OnDetails() sz->Add(sz2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10); dlg.SetSizer(sz); - dlg.SetAutoLayout(TRUE); dlg.Layout(); - + for (i = 0; i < arr.GetCount(); i++) lbox->Append(arr[i]); - + tkn.SetString(txt, _T("| ")); while (tkn.HasMoreTokens()) { @@ -177,16 +177,16 @@ void PropEditCtrlFlags::OnDetails() j = arr.Index(t); if (j != wxNOT_FOUND) lbox->Check(j); } - - + + if (dlg.ShowModal() != wxID_OK) return; - + txt.Empty(); - + for (i = 0; i < arr.GetCount(); i++) if (lbox->IsChecked(i)) txt << arr[i] << _T('|'); - if (!txt.IsEmpty()) txt.RemoveLast(); + if (!txt.empty()) txt.RemoveLast(); m_TextCtrl->SetValue(txt); WriteValue(); @@ -215,14 +215,14 @@ void PropEditCtrlFile::OnDetails() { wxString txt = m_TextCtrl->GetValue(); txt = wxPathOnly(EditorFrame::Get()->GetFileName()) + _T("/") + txt; - wxString name = wxFileSelector(_("Choose file"), + wxString name = wxFileSelector(_("Choose file"), wxPathOnly(txt), wxFileNameFromPath(txt), - _T(""), + wxEmptyString, GetFileTypes(), wxOPEN | wxFILE_MUST_EXIST); if (!name) return; - + // compute relative path: wxArrayString axrc, afile; wxStringTokenizer tkn; @@ -230,15 +230,15 @@ void PropEditCtrlFile::OnDetails() 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.Remove(0u); - axrc.Remove(0u); + afile.RemoveAt(0u); + axrc.RemoveAt(0u); } size_t i; txt.Empty(); @@ -255,9 +255,5 @@ void PropEditCtrlFile::OnDetails() wxString PropEditCtrlImageFile::GetFileTypes() { - return _("GIF files (*.gif)|*.gif|" - "JPEG files (*.jpg)|*.jpg|" - "PNG files (*.png)|*.png|" - "BMP files (*.bmp)|*.bmp|" - "All files (*)|*"); + return _("GIF files (*.gif)|*.gif|JPEG files (*.jpg)|*.jpg|PNG files (*.png)|*.png|BMP files (*.bmp)|*.bmp|All files (*)|*"); }