// Licence:
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "propeditor.h"
-#endif
-
-#include <wx/wx.h>
+// 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"
CreateControls(this);
}
-ctPropertyEditor::~ctPropertyEditor()
-{
-}
-
void ctPropertyEditor::CreateControls(wxWindow* parent)
{
m_elementTitleTextCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
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 );
// TODO: find sash pos from last time
int sashPos = 100;
- m_splitterWindow = new wxSplitterWindow(parent, ctID_PROPERTY_EDITOR_SPLITTER, wxDefaultPosition, wxSize(500, 400), wxSP_3DSASH|wxSP_FULLSASH/*|wxCLIP_CHILDREN*/ |wxBORDER_NONE|wxNO_FULL_REPAINT_ON_RESIZE);
+ m_splitterWindow = new wxSplitterWindow(parent, ctID_PROPERTY_EDITOR_SPLITTER, wxDefaultPosition, wxSize(500, 400), wxSP_3DSASH/*|wxCLIP_CHILDREN*/ |wxBORDER_NONE|wxNO_FULL_REPAINT_ON_RESIZE);
m_splitterWindow->SetMinimumPaneSize(10);
m_propertyDescriptionWindow = new wxHtmlWindow(m_splitterWindow, ctID_ATTRIBUTE_EDITOR_DESCRIPTION, wxDefaultPosition, wxSize(200, 60), wxSUNKEN_BORDER);
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,
{
m_attributeEditorGrid->ClearAttributes();
m_propertyDescriptionWindow->SetPage(WrapDescription(wxEmptyString));
- m_elementTitleTextCtrl->SetValue(_T(""));
+ m_elementTitleTextCtrl->SetValue(wxEmptyString);
}
/// Handles detailed editing event.
int row;
ctProperty* prop = FindSelectedProperty(row);
- if (!prop || prop->GetEditorType().IsEmpty())
+ if (!prop || prop->GetEditorType().empty())
return false;
return true;
}
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)
{
{
UpdateTitle();
- wxNode* node = m_item->GetProperties().GetList().GetFirst();
+ wxObjectList::compatibility_iterator node = m_item->GetProperties().GetList().GetFirst();
int i = 0;
while (node)
{
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);
}
m_attributeEditorGrid->SetCellEditor(row, 1,
new ctGridCellTextEditor);
}
-
+
return true;
}
bool ctPropertyEditor::EditDefaultProperty(ctConfigItem* item)
{
wxString defaultPropertyName = item->GetDefaultProperty();
- if (!defaultPropertyName.IsEmpty())
+ if (!defaultPropertyName.empty())
{
ctProperty* prop = item->GetProperties().FindProperty(defaultPropertyName);
if (prop)
if (selRow > -1)
{
row = selRow;
-
+
if (selRow < (int) m_item->GetProperties().GetCount())
{
ctProperty* prop = m_item->GetProperties().GetNth(selRow);
}
if (row == -1)
{
- wxString str = WrapDescription(wxEmptyString);
+ wxString str = WrapDescription(wxEmptyString);
m_propertyDescriptionWindow->SetPage(str);
}
else
ctProperty* prop = FindProperty(row);
if (prop)
{
- wxString str = WrapDescription(m_item->GetDescription(prop));
+ wxString str = WrapDescription(m_item->GetDescription(prop));
m_propertyDescriptionWindow->SetPage(str);
}
}
wxColour col = ctDESCRIPTION_BACKGROUND_COLOUR;
wxString colStr = apColourToHexString(col);
colStr = wxT("#") + colStr;
-
+
wxString str;
str << _T("<HTML><BODY BGCOLOR=\"") << colStr << wxT("\"><FONT SIZE=-1>") ;
str << s;
str << _T("</FONT></BODY></HTML>");
-
- return str;
+
+ return str;
}
/// Intercept cell data change event.
// 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.
AddControls(this, msg);
Centre();
}
-
+
bool ctMultiLineTextEditor::AddControls(wxWindow* parent, const wxString& msg)
{
wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
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 );
item4->Add( 5, 5, 1, wxALIGN_CENTRE|wxALL, 5 );
- wxButton *item5 = new wxButton( parent, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
- item5->SetDefault();
+ wxButton *item5 = new wxButton( parent, wxID_OK);
item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 );
- wxButton *item6 = new wxButton( parent, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
+ wxButton *item6 = new wxButton( parent, wxID_CANCEL);
item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
item3->SetFocus();
- ((wxButton*) FindWindow(wxID_OK))->SetDefault();
+ item5->SetDefault();
- parent->SetAutoLayout( true );
parent->SetSizer(item0);
item0->Fit(parent);