Ejemplo n.º 1
0
/**
 * \brief Set the properties of the layer.
 * \param lay The layer from which we take the info.
 *
 * The new width is max(lay.get_width(), s_min_width), and the new height
 * max(lay.get_height(), s_min_height).
 */
void bf::layer_properties_frame::fill_from( const layer& lay )
{
  m_fit_level->SetValue( lay.fits_level() );
  m_width->SetValue
    ( wxString::Format(wxT("%d"), std::max(lay.get_width(), s_min_width)) );
  m_height->SetValue
    ( wxString::Format(wxT("%d"), std::max(lay.get_height(), s_min_height)) );

  m_height->Enable( !lay.fits_level() );
  m_width->Enable( !lay.fits_level() );
  m_name->SetValue( std_to_wx_string(lay.get_name()) );
  m_tag->SetValue( std_to_wx_string(lay.get_tag()) );

  unsigned int i=0;
  bool found = false;
  const wxString ref( std_to_wx_string(lay.get_class_name()) );

  while ( !found && (i!=m_class_name->GetCount()) )
    if ( m_class_name->GetString(i) == ref )
      found = true;
    else
      ++i;

  if ( found )
    m_class_name->SetSelection(i);
  else
    m_class_name->SetSelection(0);
} // layer_properties_frame::set_layer_size()