Esempio n. 1
0
 engine_entry get_engine_null_entry()
 {
   return engine_entry(
       [](const data::config& config_, const boost::filesystem::path&,
          const boost::filesystem::path&, const boost::filesystem::path&,
          iface::environment_detector&, iface::displayer&, logger*) {
         return make_engine(config_.engine, not_supported(), not_supported(),
                            not_supported(), not_supported(), not_supported(),
                            not_supported());
       },
       "",
       "An engine which does not support anything. Mainly for testing "
       "purposes.");
 }
Esempio n. 2
0
 engine_entry get_engine_null_entry()
 {
   return engine_entry(
       [](const data::config& config_, const boost::filesystem::path&,
          const boost::filesystem::path&, const boost::filesystem::path&,
          iface::environment_detector&, iface::displayer&, logger*) {
         return make_engine(config_.active_shell_config().engine,
                            not_supported(), not_supported(), not_supported(),
                            not_supported(), not_supported(), not_supported(),
                            not_supported(), not_supported(),
                            supported_features());
       },
       "", data::markdown_string("An engine which does not support anything. "
                                 "Mainly for testing purposes."),
       supported_features());
 }
Esempio n. 3
0
/** Create a new project /name/ from existing template
 * /template_name/ */
bool
Project::create ( const char *name, const char *template_name )
{
    if ( exists( name ) )
    {
        WARNING( "Project already exists" );
        return false;
    }

    close();

    if ( mkdir( name, 0777 ) )
    {
        WARNING( "Cannot create project directory" );
        return false;
    }

    if ( chdir( name ) )
        FATAL( "WTF? Cannot change to new project directory" );

    mkdir( "sources", 0777 );
    creat( "history", 0666 );

    if ( ! engine )
        make_engine();

    /* TODO: copy template */

    write_info();

    if ( open( name ) == 0 )
    {
        /* add the bare essentials */
        timeline->beats_per_minute( 0, 120 );
        timeline->time( 0, 4, 4 );

        MESSAGE( "Created project \"%s\" from template \"%s\"", name, template_name );
        return true;
    }
    else
    {
        WARNING( "Failed to open newly created project" );
        return false;
    }
}
Esempio n. 4
0
/** Try to open project /name/. Returns 0 if sucsessful, an error code
 * otherwise */
int
Project::open ( const char *name )
{
    if ( ! validate( name ) )
        return E_INVALID;

    close();

    chdir( name );

    if ( ! acquire_lock( &_lockfd, ".lock" ) )
        return E_LOCKED;

    int version;
    nframes_t rate;
    char *creation_date;
    char *created_by;

    if ( ! read_info( &version, &rate, &creation_date, &created_by ) )
        return E_INVALID;

    if ( strncmp( created_by, "The Non-DAW", strlen( "The Non-DAW" ) ) && 
         strncmp( created_by, "Non-DAW", strlen( "Non-DAW" ) ) &&
         strncmp( created_by, APP_TITLE, strlen( APP_TITLE ) ) && 
         strncmp( created_by, APP_NAME, strlen( APP_NAME ) ) )
        return E_INVALID;

    if ( version > PROJECT_VERSION )
        return E_VERSION;

    if ( version < 2 )
    {
        /* FIXME: Version 1->2 adds Cursor_Sequence and Cursor_Point to default project... */
    }

    /* normally, engine will be NULL after a close or on an initial open, 
     but 'new' will have already created it to get the sample rate. */
    if ( ! engine )
        make_engine();
 
    {
        Block_Timer timer( "Replayed journal" );
        if ( ! Loggable::open( "history" ) )
            return E_INVALID;
    }

    /* /\* really a good idea? *\/ */
    /* timeline->sample_rate( rate ); */

    if ( creation_date )
    {
        strcpy( _created_on, creation_date );
        free( creation_date );
    }
    else
        *_created_on = 0;

    set_name( name );

    *_path = '\0';
    fl_filename_absolute( _path, sizeof( _path ), "." );

    _is_open = true;

    tle->load_timeline_settings();

    timeline->zoom_fit();

    MESSAGE( "Loaded project \"%s\"", name );

    return 0;
}