Exemple #1
0
/**
 * \brief Save the animation without asking anything.
 */
bool bf::main_frame::effective_save()
{
  bool result = m_animation_edit->validate();

  if (result)
    {
      std::string std_path( wx_to_std_string(m_animation_file) );
      std::ofstream f( std_path.c_str() );

      if (f)
        {
          animation_file_xml_writer writer;

          writer.save( f, m_animation_edit->get_value() );
          m_last_saved_animation = m_animation_edit->get_value();
          result = true;
          make_title();
        }
      else
        {
          wxMessageDialog dlg
            ( this, _("Can't open the animation file."), _("Error"), wxOK );

          dlg.ShowModal();
        }
    }

  return result;
} // main_frame::effective_save()
Exemple #2
0
/**
 * \brief Compile an animation.
 * \param anim The animation to compile.
 * \param path The path to the animation file.
 * \return true if the compilation went ok.
 */
void bf::animation_editor::compile_animation
( const animation& anim, const wxString& path ) const
{
  std::string std_path( wx_to_std_string(path) );
  std::size_t pos = std_path.rfind(".anim");

  if ( pos != std::string::npos )
    std_path = std_path.substr(0, pos);

  std_path += ".canim";

  std::ofstream f( std_path.c_str() );

  if (f)
    {
      std::string w = 
        path_configuration::get_instance().search_workspace
        ( wx_to_std_string(path) );
      workspace_environment env;
      
      if ( ! w.empty() )
        env = workspace_environment( w );

      compiled_file cf(f);
      cf << BF_MAJOR_VERSION << BF_MINOR_VERSION << BF_RELEASE_NUMBER;

      compilation_context context
        ( std::numeric_limits<unsigned int>::max(), env );
      anim.compile(cf, context);
    }
  else
    throw claw::exception("Can't open the animation file.");
} // animation_editor::compile_animation()
static svn_error_t *info_receiver_c( void *baton_, const char *path, const svn_info_t *info, apr_pool_t *pool )
{
    InfoReceiveBaton *baton = reinterpret_cast<InfoReceiveBaton *>( baton_ );

    PythonDisallowThreads callback_permission( baton->m_permission );

    if( path != NULL )
    {
        std::string std_path( path );
        if( std_path.empty() )
        {
            std_path = ".";
        }
        Py::String py_path( std_path );

        Py::Tuple py_pair( 2 );
        py_pair[0] = py_path;
        py_pair[1] = toObject(
                    *info,
                    baton->m_wrapper_info,
                    baton->m_wrapper_lock,
                    baton->m_wrapper_wc_info );

        baton->m_info_list.append( py_pair );
    }

    return SVN_NO_ERROR;
}