X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4fe30bceff0445f540e639d2b6d3977d56b34020..17a7bf57f8fcc8cb3e286bb2d5a0eb41e71b327b:/utils/configtool/src/propeditor.cpp?ds=inline diff --git a/utils/configtool/src/propeditor.cpp b/utils/configtool/src/propeditor.cpp index d184199412..933d0de280 100644 --- a/utils/configtool/src/propeditor.cpp +++ b/utils/configtool/src/propeditor.cpp @@ -13,23 +13,29 @@ #pragma implementation "propeditor.h" #endif -#include +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif -#include "wx/html/htmlwin.h" +#ifndef WX_PRECOMP + #include "wx/grid.h" #include "wx/filedlg.h" + +#endif + +#include "wx/html/htmlwin.h" #include "wx/tokenzr.h" #include "wx/valgen.h" - #include "propeditor.h" #include "symbols.h" #include "utils.h" #include "configtooldoc.h" #include "configitemselector.h" + #include "bitmaps/ellipsis.xpm" @@ -59,10 +65,6 @@ ctPropertyEditor::ctPropertyEditor(wxWindow *parent, wxWindowID id, const wxPoin CreateControls(this); } -ctPropertyEditor::~ctPropertyEditor() -{ -} - void ctPropertyEditor::CreateControls(wxWindow* parent) { m_elementTitleTextCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); @@ -75,8 +77,8 @@ void ctPropertyEditor::CreateControls(wxWindow* parent) wxTextCtrl *item2 = m_elementTitleTextCtrl; item1->Add( item2, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - wxButton *item3a = new wxButton( parent, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS, wxT("Edit...")); - item1->Add( item3a, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ); + m_attributeEditorEditDetails = new wxButton( parent, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS, wxT("Edit...")); + item1->Add( m_attributeEditorEditDetails, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); @@ -99,14 +101,13 @@ void ctPropertyEditor::CreateControls(wxWindow* parent) item0->Add( m_splitterWindow, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); - this->SetAutoLayout(true); this->SetSizer( item0 ); /// Add help text m_elementTitleTextCtrl->SetHelpText(_("The title of the property being edited.")); - FindWindow(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS)->SetHelpText(_("Click to use an appropriate editor for the selected property (if any).")); - FindWindow(ctID_ATTRIBUTE_EDITOR_GRID)->SetHelpText(_("Shows the properties of the selected item.")); - FindWindow(ctID_ATTRIBUTE_EDITOR_DESCRIPTION)->SetHelpText(_("Shows a description of the selected property, or a summary of the whole item.")); + m_attributeEditorEditDetails->SetHelpText(_("Click to use an appropriate editor for the selected property (if any).")); + m_attributeEditorGrid->SetHelpText(_("Shows the properties of the selected item.")); + m_propertyDescriptionWindow->SetHelpText(_("Shows a description of the selected property, or a summary of the whole item.")); /// Set up the grid to display properties m_attributeEditorGrid->RegisterDataType(ctGRID_VALUE_STRING, @@ -159,7 +160,7 @@ void ctPropertyEditor::ClearEditor() { m_attributeEditorGrid->ClearAttributes(); m_propertyDescriptionWindow->SetPage(WrapDescription(wxEmptyString)); - m_elementTitleTextCtrl->SetValue(_T("")); + m_elementTitleTextCtrl->SetValue(wxEmptyString); } /// Handles detailed editing event. @@ -206,7 +207,7 @@ void ctPropertyEditor::ShowItem(ctConfigItem* item) m_attributeEditorGrid->AppendRows(m_item->GetProperties().GetCount()); - wxNode* node = m_item->GetProperties().GetList().GetFirst(); + wxObjectList::compatibility_iterator node = m_item->GetProperties().GetList().GetFirst(); int i = 0; while (node) { @@ -256,7 +257,7 @@ void ctPropertyEditor::UpdateItem() { UpdateTitle(); - wxNode* node = m_item->GetProperties().GetList().GetFirst(); + wxObjectList::compatibility_iterator node = m_item->GetProperties().GetList().GetFirst(); int i = 0; while (node) { @@ -294,13 +295,13 @@ bool ctPropertyEditor::DisplayProperty(int row, ctProperty* prop, bool valueOnly if (!m_item->CanEditProperty(prop->GetName())) { m_attributeEditorGrid->SetReadOnly(row, 1); - + wxColour col(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); m_attributeEditorGrid->SetCellTextColour(row, 1, col); } else { - m_attributeEditorGrid->SetReadOnly(row, 1, false); + m_attributeEditorGrid->SetReadOnly(row, 1, false); m_attributeEditorGrid->SetCellTextColour(row, 1, * wxBLACK); } @@ -346,7 +347,7 @@ bool ctPropertyEditor::DisplayProperty(int row, ctProperty* prop, bool valueOnly m_attributeEditorGrid->SetCellEditor(row, 1, new ctGridCellTextEditor); } - + return true; } @@ -411,7 +412,7 @@ ctProperty* ctPropertyEditor::FindSelectedProperty(int& row) if (selRow > -1) { row = selRow; - + if (selRow < (int) m_item->GetProperties().GetCount()) { ctProperty* prop = m_item->GetProperties().GetNth(selRow); @@ -536,7 +537,7 @@ void ctPropertyEditor::UpdateDescription(int row) } if (row == -1) { - wxString str = WrapDescription(wxEmptyString); + wxString str = WrapDescription(wxEmptyString); m_propertyDescriptionWindow->SetPage(str); } else @@ -544,7 +545,7 @@ void ctPropertyEditor::UpdateDescription(int row) ctProperty* prop = FindProperty(row); if (prop) { - wxString str = WrapDescription(m_item->GetDescription(prop)); + wxString str = WrapDescription(m_item->GetDescription(prop)); m_propertyDescriptionWindow->SetPage(str); } } @@ -557,13 +558,13 @@ wxString ctPropertyEditor::WrapDescription(const wxString& s) wxColour col = ctDESCRIPTION_BACKGROUND_COLOUR; wxString colStr = apColourToHexString(col); colStr = wxT("#") + colStr; - + wxString str; str << _T("") ; str << s; str << _T(""); - - return str; + + return str; } /// Intercept cell data change event. @@ -655,13 +656,13 @@ void ctPropertyEditor::ApplyPropertyValue(ctConfigItem* item, ctProperty* proper // Apply the new value property->GetVariant() = variant; - item->ApplyProperty(property, oldValue); + item->ApplyProperty(property, oldValue); item->Modify(); - + UpdateItem(); wxString menuLabel(_T("Change ") + property->GetName()); - + // This won't do anything first time Do is applied, // since we've already done the action for this property. // But when we Undo or Redo, the changed properties will be applied. @@ -791,7 +792,7 @@ ctMultiLineTextEditor::ctMultiLineTextEditor( wxWindow *parent, wxWindowID id, c AddControls(this, msg); Centre(); } - + bool ctMultiLineTextEditor::AddControls(wxWindow* parent, const wxString& msg) { wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); @@ -801,7 +802,7 @@ bool ctMultiLineTextEditor::AddControls(wxWindow* parent, const wxString& msg) wxStaticText *item2 = new wxStaticText( parent, wxID_STATIC, msg, wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT, 5 ); - wxTextCtrl *item3 = new wxTextCtrl( parent, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(330,180), wxTE_MULTILINE|wxTE_RICH ); + wxTextCtrl *item3 = new wxTextCtrl( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(330,180), wxTE_MULTILINE|wxTE_RICH ); item1->Add( item3, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxBoxSizer *item4 = new wxBoxSizer( wxHORIZONTAL ); @@ -809,7 +810,6 @@ bool ctMultiLineTextEditor::AddControls(wxWindow* parent, const wxString& msg) item4->Add( 5, 5, 1, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item5 = new wxButton( parent, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - item5->SetDefault(); item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item6 = new wxButton( parent, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -824,9 +824,8 @@ bool ctMultiLineTextEditor::AddControls(wxWindow* parent, const wxString& msg) item3->SetFocus(); - ((wxButton*) FindWindow(wxID_OK))->SetDefault(); + item5->SetDefault(); - parent->SetAutoLayout( true ); parent->SetSizer(item0); item0->Fit(parent);