From: <jfa...@us...> - 2009-08-31 22:46:31
|
Revision: 23425 http://personalrobots.svn.sourceforge.net/personalrobots/?rev=23425&view=rev Author: jfaustwg Date: 2009-08-31 22:46:24 +0000 (Mon, 31 Aug 2009) Log Message: ----------- Add red background and text "Fill in topic..." if a topic property is empty (#2661) Modified Paths: -------------- pkg/trunk/stacks/visualization/rviz/src/rviz/ros_topic_property.cpp pkg/trunk/stacks/visualization/rviz/src/rviz/ros_topic_property.h Modified: pkg/trunk/stacks/visualization/rviz/src/rviz/ros_topic_property.cpp =================================================================== --- pkg/trunk/stacks/visualization/rviz/src/rviz/ros_topic_property.cpp 2009-08-31 22:30:24 UTC (rev 23424) +++ pkg/trunk/stacks/visualization/rviz/src/rviz/ros_topic_property.cpp 2009-08-31 22:46:24 UTC (rev 23425) @@ -37,9 +37,9 @@ namespace rviz { -IMPLEMENT_DYNAMIC_CLASS(ROSTopicProperty, wxLongStringProperty) +IMPLEMENT_DYNAMIC_CLASS(ROSTopicProperty, wxLongStringProperty); -bool ROSTopicDialogAdapter::DoShowDialog( wxPropertyGrid* WXUNUSED(propGrid), wxPGProperty* WXUNUSED(property) ) +bool ROSTopicDialogAdapter::DoShowDialog( wxPropertyGrid* propGrid, wxPGProperty* property ) { TopicDisplayDialog dialog(NULL, ros::Node::instance(), false, message_type_); @@ -66,7 +66,38 @@ ROSTopicProperty::ROSTopicProperty(const std::string& message_type, const wxString& label, const wxString& name, const wxString& value ) : wxLongStringProperty( label, name, value ) { + checkForEmptyValue(); } +void ROSTopicProperty::OnSetValue() +{ + checkForEmptyValue(); +} + +void ROSTopicProperty::checkForEmptyValue() +{ + wxString str = m_value.GetString(); + + wxPGCell* cell = GetCell(1); + if (!cell) + { + cell = new wxPGCell(str, wxNullBitmap, wxNullColour, wxNullColour); + SetCell(1, cell); + } + + if (str.IsEmpty()) + { + cell->SetBgCol(wxColour(255, 50, 0)); + cell->SetFgCol(wxColour(255, 255, 255)); + cell->SetText(wxT("Fill in topic here...")); + } + else + { + cell->SetBgCol(wxNullColour); + cell->SetFgCol(wxNullColour); + cell->SetText(str); + } +} + } // namespace rviz Modified: pkg/trunk/stacks/visualization/rviz/src/rviz/ros_topic_property.h =================================================================== --- pkg/trunk/stacks/visualization/rviz/src/rviz/ros_topic_property.h 2009-08-31 22:30:24 UTC (rev 23424) +++ pkg/trunk/stacks/visualization/rviz/src/rviz/ros_topic_property.h 2009-08-31 22:46:24 UTC (rev 23425) @@ -84,9 +84,13 @@ message_type_ = message_type; } + virtual void OnSetValue(); + protected: ROSTopicProperty(); + void checkForEmptyValue(); + std::string message_type_; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |