mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-15 18:06:06 +01:00
[Summary] Progressing the recent session templates feature.
This commit is contained in:
parent
5fa19d8b6c
commit
869b456352
10 changed files with 353 additions and 123 deletions
|
|
@ -75,12 +75,26 @@ SessionDialog::SessionDialog (WM::Proxy<TracksControlPanel>& system_configuratio
|
|||
_recent_session_button[8] = &get_waves_button ("recent_session_button_8");
|
||||
_recent_session_button[9] = &get_waves_button ("recent_session_button_9");
|
||||
|
||||
_recent_template_button[0] = &get_waves_button ("recent_template_button_0");
|
||||
_recent_template_button[1] = &get_waves_button ("recent_template_button_1");
|
||||
_recent_template_button[2] = &get_waves_button ("recent_template_button_2");
|
||||
_recent_template_button[3] = &get_waves_button ("recent_template_button_3");
|
||||
_recent_template_button[4] = &get_waves_button ("recent_template_button_4");
|
||||
_recent_template_button[5] = &get_waves_button ("recent_template_button_5");
|
||||
_recent_template_button[6] = &get_waves_button ("recent_template_button_6");
|
||||
_recent_template_button[7] = &get_waves_button ("recent_template_button_7");
|
||||
_recent_template_button[8] = &get_waves_button ("recent_template_button_8");
|
||||
_recent_template_button[9] = &get_waves_button ("recent_template_button_9");
|
||||
|
||||
for (size_t i = 0; i < MAX_RECENT_SESSION_COUNT; i++) {
|
||||
_recent_session_button[i]->signal_clicked.connect (sigc::mem_fun (*this, &SessionDialog::on_recent_session ));
|
||||
_recent_session_button[i]->signal_clicked.connect (sigc::mem_fun (*this, &SessionDialog::on_recent_object ));
|
||||
_recent_session_button[i]->signal_double_clicked.connect (sigc::mem_fun (*this, &SessionDialog::on_recent_session_double_click ));
|
||||
}
|
||||
|
||||
_open_selected_button.set_sensitive (false);
|
||||
for (size_t i = 0; i < MAX_RECENT_TEMPLATE_COUNT; i++) {
|
||||
_recent_template_button[i]->signal_clicked.connect (sigc::mem_fun (*this, &SessionDialog::on_recent_object ));
|
||||
_recent_template_button[i]->signal_double_clicked.connect (sigc::mem_fun (*this, &SessionDialog::on_recent_template_double_click ));
|
||||
}
|
||||
}
|
||||
|
||||
SessionDialog::~SessionDialog()
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class TracksControlPanel;
|
|||
|
||||
class EngineControl;
|
||||
#define MAX_RECENT_SESSION_COUNT 10
|
||||
#define MAX_RECENT_TEMPLATE_COUNT 10
|
||||
class SessionDialog : public WavesDialog {
|
||||
public:
|
||||
SessionDialog (WM::Proxy<TracksControlPanel>& system_configuration_dialog,
|
||||
|
|
@ -72,6 +73,7 @@ class SessionDialog : public WavesDialog {
|
|||
WavesButton& _open_saved_session_button;
|
||||
WavesButton& _system_configuration_button;
|
||||
WavesButton* _recent_session_button[MAX_RECENT_SESSION_COUNT];
|
||||
WavesButton* _recent_template_button[MAX_RECENT_TEMPLATE_COUNT];
|
||||
Gtk::Label& _session_details_label_1;
|
||||
Gtk::Label& _session_details_label_2;
|
||||
Gtk::Label& _session_details_label_3;
|
||||
|
|
|
|||
|
|
@ -62,12 +62,14 @@ using namespace Glib;
|
|||
using namespace PBD;
|
||||
using namespace ARDOUR;
|
||||
|
||||
#if (0) // let's keep it for a time per possible need in future.
|
||||
static string poor_mans_glob (string path)
|
||||
{
|
||||
string copy = path;
|
||||
replace_all (copy, "~", Glib::get_home_dir());
|
||||
return copy;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SessionDialog::set_engine_state_controller (EngineStateController* _engine_state_controller)
|
||||
{
|
||||
|
|
@ -85,7 +87,8 @@ void SessionDialog::redisplay ()
|
|||
}
|
||||
|
||||
redisplay_system_configuration ();
|
||||
redisplay_recent_sessions();
|
||||
redisplay_recent_sessions ();
|
||||
redisplay_recent_templates ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -127,11 +130,6 @@ SessionDialog::session_folder ()
|
|||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
SessionDialog::session_selected ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SessionDialog::on_new_session (WavesButton*)
|
||||
{
|
||||
|
|
@ -141,6 +139,14 @@ SessionDialog::on_new_session (WavesButton*)
|
|||
void
|
||||
SessionDialog::on_new_session_with_template (WavesButton*)
|
||||
{
|
||||
std::vector<std::string> template_types = boost::assign::list_of (ARDOUR::template_suffix + 1); //WOW!!!!
|
||||
std::vector<std::string> selected_files = ARDOUR::open_file_dialog(template_types, false, Config->get_default_session_parent_dir(), _("Select Template"));
|
||||
if (selected_files.empty ()) {
|
||||
set_keep_above(true);
|
||||
return;
|
||||
} else {
|
||||
_session_template_full_name = selected_files [0];
|
||||
}
|
||||
new_session (true);
|
||||
}
|
||||
|
||||
|
|
@ -184,18 +190,14 @@ SessionDialog::redisplay_recent_sessions ()
|
|||
}
|
||||
|
||||
std::vector<std::string> session_directories;
|
||||
RecentSessionsSorter cmp;
|
||||
|
||||
ARDOUR::RecentSessions rs;
|
||||
ARDOUR::read_recent_sessions (rs);
|
||||
|
||||
if (rs.empty()) {
|
||||
if (rs.empty ()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// sort them alphabetically
|
||||
// sort (rs.begin(), rs.end(), cmp);
|
||||
|
||||
for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
|
||||
session_directories.push_back ((*i).second);
|
||||
}
|
||||
|
|
@ -231,10 +233,10 @@ SessionDialog::redisplay_recent_sessions ()
|
|||
|
||||
states = Session::possible_states (dirname);
|
||||
|
||||
if (states.empty()) {
|
||||
/* no state file? */
|
||||
continue;
|
||||
}
|
||||
if (states.empty()) {
|
||||
/* no state file? */
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<string> state_file_names(get_file_names_no_extension (state_file_paths));
|
||||
|
||||
|
|
@ -252,6 +254,53 @@ SessionDialog::redisplay_recent_sessions ()
|
|||
return session_snapshot_count;
|
||||
}
|
||||
|
||||
int
|
||||
SessionDialog::redisplay_recent_templates ()
|
||||
{
|
||||
for (size_t i = 0; i < MAX_RECENT_SESSION_COUNT; i++) {
|
||||
_recent_template_button[i]->set_active_state (Gtkmm2ext::Off);
|
||||
_recent_template_button[i]->set_sensitive (false);
|
||||
}
|
||||
|
||||
std::deque<std::string> rt;
|
||||
ARDOUR::read_recent_templates (rt);
|
||||
|
||||
if (rt.empty ()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int session_template_count = 0;
|
||||
for (std::deque<std::string>::const_iterator i = rt.begin(); i != rt.end(); ++i) {
|
||||
|
||||
/* check whether template still exists and it's a regular file*/
|
||||
if (!Glib::file_test((*i).c_str(), Glib::FILE_TEST_IS_REGULAR)) {
|
||||
/* such regular file doesn't exist */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* now get available states for this session */
|
||||
_recent_template_full_name[session_template_count ] = *i;
|
||||
std::string basename = Glib::path_get_basename (*i);
|
||||
std::string::size_type pos = basename.find_last_of (".");
|
||||
if (pos != std::string::npos) {
|
||||
std::string filetype = basename.substr (pos);
|
||||
std::string template_suffix = ARDOUR::template_suffix;
|
||||
boost::to_lower (template_suffix);
|
||||
boost::to_lower (filetype);
|
||||
if (filetype == template_suffix) {
|
||||
basename = basename.substr (0, pos);
|
||||
}
|
||||
}
|
||||
_recent_template_button[session_template_count ]->set_text (basename);
|
||||
_recent_template_button[session_template_count ]->set_sensitive (true);
|
||||
|
||||
ARDOUR_UI::instance()->set_tip (*_recent_template_button[session_template_count ], *i);
|
||||
++session_template_count;
|
||||
}
|
||||
|
||||
return ++session_template_count;
|
||||
}
|
||||
|
||||
bool
|
||||
SessionDialog::on_delete_event (GdkEventAny* ev)
|
||||
{
|
||||
|
|
@ -270,50 +319,69 @@ SessionDialog::on_quit (WavesButton*)
|
|||
void
|
||||
SessionDialog::on_open_selected (WavesButton*)
|
||||
{
|
||||
hide();
|
||||
response (Gtk::RESPONSE_ACCEPT);
|
||||
switch (_selection_type) {
|
||||
case RecentSession:
|
||||
hide();
|
||||
response (Gtk::RESPONSE_ACCEPT);
|
||||
break;
|
||||
case RecentTemplate:
|
||||
new_session (true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SessionDialog::on_open_saved_session (WavesButton*)
|
||||
{
|
||||
set_keep_above(false);
|
||||
string temp_session_full_file_name = ARDOUR::open_file_dialog(Config->get_default_session_parent_dir(), _("Select Saved Session"));
|
||||
set_keep_above(true);
|
||||
string temp_session_full_file_name = ARDOUR::open_file_dialog(Config->get_default_session_parent_dir(), _("Select Saved Session"));
|
||||
set_keep_above(true);
|
||||
|
||||
if(!temp_session_full_file_name.empty()) {
|
||||
_selected_session_full_name = temp_session_full_file_name;
|
||||
for (size_t i = 0; i < MAX_RECENT_SESSION_COUNT; i++) {
|
||||
_recent_session_button[i]->set_active_state (Gtkmm2ext::Off);
|
||||
}
|
||||
_selection_type = SavedSession;
|
||||
hide ();
|
||||
response (Gtk::RESPONSE_ACCEPT);
|
||||
}
|
||||
if(!temp_session_full_file_name.empty()) {
|
||||
_selected_session_full_name = temp_session_full_file_name;
|
||||
for (size_t i = 0; i < MAX_RECENT_SESSION_COUNT; i++) {
|
||||
_recent_session_button[i]->set_active_state (Gtkmm2ext::Off);
|
||||
}
|
||||
_selection_type = SavedSession;
|
||||
hide ();
|
||||
response (Gtk::RESPONSE_ACCEPT);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SessionDialog::on_recent_session (WavesButton* clicked_button)
|
||||
SessionDialog::on_recent_object (WavesButton* clicked_button)
|
||||
{
|
||||
if (clicked_button->get_active()) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
_selected_session_full_name = "";
|
||||
_session_template_full_name = "";
|
||||
_selection_type = Nothing;
|
||||
for (size_t i = 0; i < MAX_RECENT_SESSION_COUNT; i++) {
|
||||
if (_recent_session_button[i] == clicked_button) {
|
||||
_selected_session_full_name = _recent_session_full_name[i];
|
||||
_recent_session_button[i]->set_active_state(Gtkmm2ext::ExplicitActive);
|
||||
_selection_type = RecentSession;
|
||||
} else {
|
||||
_recent_session_button[i]->set_active_state(Gtkmm2ext::Off);
|
||||
_selection_type = RecentSession;
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < MAX_RECENT_SESSION_COUNT; i++) {
|
||||
if (_recent_template_button[i] == clicked_button) {
|
||||
_session_template_full_name = _recent_template_full_name[i];
|
||||
_recent_template_button[i]->set_active_state(Gtkmm2ext::ExplicitActive);
|
||||
_selection_type = RecentTemplate;
|
||||
} else {
|
||||
_recent_template_button[i]->set_active_state(Gtkmm2ext::Off);
|
||||
}
|
||||
}
|
||||
}
|
||||
_open_selected_button.set_sensitive (_selection_type == RecentSession);
|
||||
_open_selected_button.set_sensitive ((_selection_type == RecentSession) || (_selection_type == RecentTemplate));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -326,6 +394,11 @@ SessionDialog::on_recent_session_double_click (WavesButton* button)
|
|||
response (Gtk::RESPONSE_ACCEPT);
|
||||
}
|
||||
|
||||
void
|
||||
SessionDialog::on_recent_template_double_click (WavesButton* button)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SessionDialog::on_system_configuration (WavesButton* clicked_button)
|
||||
{
|
||||
|
|
@ -372,17 +445,8 @@ void
|
|||
SessionDialog::new_session (bool with_template)
|
||||
{
|
||||
set_keep_above(false);
|
||||
if (with_template) {
|
||||
std::vector<std::string> template_types = boost::assign::list_of (ARDOUR::template_suffix + 1); //WOW!!!!
|
||||
std::vector<std::string> selected_files = ARDOUR::open_file_dialog(template_types, false, Config->get_default_session_parent_dir(), _("Select Template"));
|
||||
if (selected_files.empty ()) {
|
||||
set_keep_above(true);
|
||||
return;
|
||||
} else {
|
||||
_session_template = selected_files [0];
|
||||
}
|
||||
} else {
|
||||
_session_template.clear ();
|
||||
if (!with_template) {
|
||||
_session_template_full_name.clear ();
|
||||
}
|
||||
|
||||
std::string temp_session_full_file_name = ARDOUR::save_file_dialog(Config->get_default_session_parent_dir(),_("Create New Session"));
|
||||
|
|
|
|||
|
|
@ -25,24 +25,24 @@
|
|||
std::string session_name (bool& should_be_new);
|
||||
std::string session_folder ();
|
||||
|
||||
bool use_session_template() { return _session_template.empty () == false; }
|
||||
std::string session_template_name() { return _session_template; }
|
||||
bool use_session_template() { return _session_template_full_name.empty () == false; }
|
||||
std::string session_template_name () { return _session_template_full_name; }
|
||||
|
||||
// advanced session options
|
||||
|
||||
bool create_master_bus() const { return true; }
|
||||
int master_channel_count() const { return 2; }
|
||||
bool create_master_bus () const { return true; }
|
||||
int master_channel_count () const { return 2; }
|
||||
|
||||
bool connect_inputs() const { return true; }
|
||||
bool limit_inputs_used_for_connection() const { return false; }
|
||||
int input_limit_count() const { return 0; }
|
||||
bool connect_inputs () const { return true; }
|
||||
bool limit_inputs_used_for_connection () const { return false; }
|
||||
int input_limit_count () const { return 0; }
|
||||
|
||||
bool connect_outputs() const { return true; }
|
||||
bool limit_outputs_used_for_connection() const { return false; }
|
||||
int output_limit_count() const { return 0; }
|
||||
bool connect_outputs () const { return true; }
|
||||
bool limit_outputs_used_for_connection () const { return false; }
|
||||
int output_limit_count () const { return 0; }
|
||||
|
||||
bool connect_outs_to_master() const { return true; }
|
||||
bool connect_outs_to_physical() const { return false; }
|
||||
bool connect_outs_to_master () const { return true; }
|
||||
bool connect_outs_to_physical () const { return false; }
|
||||
void set_selected_session_full_path (std::string path) { _selected_session_full_name = path; }
|
||||
|
||||
void set_session_info (bool require_new,
|
||||
|
|
@ -56,13 +56,14 @@
|
|||
enum SessionSelectionType {
|
||||
Nothing,
|
||||
RecentSession,
|
||||
RecentTemplate,
|
||||
SavedSession,
|
||||
NewSession
|
||||
} _selection_type;
|
||||
|
||||
struct RecentSessionsSorter {
|
||||
bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
|
||||
return ARDOUR::cmp_nocase(a.first, b.first) == -1;
|
||||
return ARDOUR::cmp_nocase (a.first, b.first) == -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -71,12 +72,13 @@
|
|||
std::string _provided_session_name;
|
||||
std::string _provided_session_path;
|
||||
std::string _recent_session_full_name[MAX_RECENT_SESSION_COUNT];
|
||||
std::string _recent_template_full_name[MAX_RECENT_TEMPLATE_COUNT];
|
||||
std::string _selected_session_full_name;
|
||||
bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
|
||||
Gtk::Label _info_scroller_label;
|
||||
std::string::size_type _info_scroller_count;
|
||||
sigc::connection _info_scroller_connection;
|
||||
std::string _session_template;
|
||||
std::string _session_template_full_name;
|
||||
|
||||
// methods
|
||||
void on_quit (WavesButton*);
|
||||
|
|
@ -84,17 +86,18 @@
|
|||
void on_open_saved_session (WavesButton*);
|
||||
void on_new_session (WavesButton*);
|
||||
void on_new_session_with_template (WavesButton*);
|
||||
void on_recent_session (WavesButton*);
|
||||
void on_recent_object (WavesButton*);
|
||||
void on_recent_session_double_click (WavesButton*);
|
||||
void on_recent_template_double_click (WavesButton*);
|
||||
void on_system_configuration (WavesButton*);
|
||||
bool on_delete_event (GdkEventAny*);
|
||||
bool on_key_press_event (GdkEventKey*);
|
||||
void on_system_configuration_change();
|
||||
void on_system_configuration_change ();
|
||||
|
||||
void redisplay_system_configuration();
|
||||
int redisplay_recent_sessions ();
|
||||
void session_selected ();
|
||||
bool info_scroller_update();
|
||||
int redisplay_recent_templates ();
|
||||
bool info_scroller_update ();
|
||||
void update_recent_session_buttons ();
|
||||
void new_session (bool with_template);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
fgdisabled ="#959595"
|
||||
bordercolor="#7E7E7E"/>
|
||||
<style name="recent_session_button"
|
||||
fgnormal="#ffffff"
|
||||
fgnormal="#ffffff"
|
||||
bgnormal="#424242"
|
||||
fgactive="#ffffff"
|
||||
bgactive="#101010"
|
||||
|
|
@ -117,10 +117,11 @@
|
|||
</VBox>
|
||||
</EventBox>
|
||||
</VBox>
|
||||
<VBox spacing="1">
|
||||
<VBox>
|
||||
<Button style="generic_control"
|
||||
id="open_selected_button"
|
||||
text="Open Selected"
|
||||
state="insensitive"
|
||||
fgnormal="#ffffff"
|
||||
bgnormal="#303030"
|
||||
fgactive="#000000"
|
||||
|
|
@ -129,63 +130,128 @@
|
|||
borderwidth="0 0 0 1"
|
||||
width="195"
|
||||
height="40"/>
|
||||
<EventBox bgnormal="#303030"
|
||||
box.fill="true"
|
||||
box.expand="true">
|
||||
<VBox>
|
||||
<Label style="generic_control"
|
||||
text="Recent Sessions"
|
||||
winfont ="Arial Bold 11"
|
||||
macfont ="Helvetica Bold 11"
|
||||
box.fill="true"
|
||||
box.expand="true"/>
|
||||
<HBox box.padding="2">
|
||||
<VBox spacing="1" box.padding="5">
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_0"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_1"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_2"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_3"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_4"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_5"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_6"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_7"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_8"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_9"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<HBox spacing="1"
|
||||
box.fill="true"
|
||||
box.expand="true">
|
||||
<VBox spacing="1">
|
||||
<EventBox bgnormal="#303030"
|
||||
box.fill="true"
|
||||
box.expand="true">
|
||||
<VBox>
|
||||
<Label style="generic_control"
|
||||
text="Recent Sessions"
|
||||
winfont ="Arial Bold 11"
|
||||
macfont ="Helvetica Bold 11"
|
||||
box.fill="true"
|
||||
box.expand="true"/>
|
||||
<HBox box.padding="2">
|
||||
<VBox spacing="1" box.padding="5">
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_0"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_1"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_2"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_3"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_4"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_5"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_6"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_7"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_8"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_9"
|
||||
width="186"
|
||||
height="19"/>
|
||||
</VBox>
|
||||
</HBox>
|
||||
<HBox height="3"/>
|
||||
</VBox>
|
||||
</HBox>
|
||||
<HBox height="3"/>
|
||||
</EventBox>
|
||||
</VBox>
|
||||
</EventBox>
|
||||
<VBox spacing="1">
|
||||
<EventBox bgnormal="#303030"
|
||||
box.fill="true"
|
||||
box.expand="true">
|
||||
<VBox>
|
||||
<Label style="generic_control"
|
||||
text="Recent Templates"
|
||||
winfont ="Arial Bold 11"
|
||||
macfont ="Helvetica Bold 11"
|
||||
box.fill="true"
|
||||
box.expand="true"/>
|
||||
<HBox box.padding="2">
|
||||
<VBox spacing="1" box.padding="5">
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_0"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_1"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_2"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_3"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_4"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_5"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_6"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_7"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_8"
|
||||
width="186"
|
||||
height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_template_button_9"
|
||||
width="186"
|
||||
height="19"/>
|
||||
</VBox>
|
||||
</HBox>
|
||||
<HBox height="3"/>
|
||||
</VBox>
|
||||
</EventBox>
|
||||
</VBox>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</HBox>
|
||||
<Button style="generic_control"
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ CONFIG_VARIABLE (bool, update_editor_during_summary_drag, "update-editor-during-
|
|||
CONFIG_VARIABLE (bool, never_display_periodic_midi, "never-display-periodic-midi", true)
|
||||
CONFIG_VARIABLE (bool, sound_midi_notes, "sound-midi-notes", false)
|
||||
CONFIG_VARIABLE (uint32_t, max_recent_sessions, "max-recent-sessions", 10)
|
||||
CONFIG_VARIABLE (uint32_t, max_recent_templates, "max-recent-templates", 10)
|
||||
CONFIG_VARIABLE (double, automation_thinning_factor, "automation-thinning-factor", 20.0)
|
||||
CONFIG_VARIABLE (std::string, freesound_download_dir, "freesound-download-dir", Glib::get_home_dir() + "/Freesound/snd")
|
||||
CONFIG_VARIABLE (framecnt_t, range_location_minimum, "range-location-minimum", 128) /* samples */
|
||||
|
|
|
|||
|
|
@ -30,8 +30,11 @@ namespace ARDOUR {
|
|||
typedef std::deque<std::pair<std::string,std::string> > RecentSessions;
|
||||
|
||||
LIBARDOUR_API int read_recent_sessions (RecentSessions& rs);
|
||||
LIBARDOUR_API int read_recent_templates (std::deque<std::string>& rt);
|
||||
LIBARDOUR_API int store_recent_sessions (std::string name, std::string path);
|
||||
LIBARDOUR_API int store_recent_templates (const std::string& session_template_full_name);
|
||||
LIBARDOUR_API int write_recent_sessions (RecentSessions& rs);
|
||||
LIBARDOUR_API int write_recent_templates (std::deque<std::string>& rt);
|
||||
LIBARDOUR_API int remove_recent_sessions (const std::string& path);
|
||||
}; // namespace ARDOUR
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ using namespace PBD;
|
|||
namespace {
|
||||
|
||||
const char * const recent_file_name = "recent";
|
||||
const char * const recent_templates_file_name = "recent_templates";
|
||||
|
||||
} // anonymous
|
||||
|
||||
|
|
@ -84,6 +85,38 @@ ARDOUR::read_recent_sessions (RecentSessions& rs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::read_recent_templates (std::deque<std::string>& rt)
|
||||
{
|
||||
std::string path = Glib::build_filename (user_config_directory(), recent_templates_file_name);
|
||||
|
||||
ifstream recent (path.c_str());
|
||||
|
||||
if (!recent) {
|
||||
if (errno != ENOENT) {
|
||||
error << string_compose (_("cannot open recent template file %1 (%2)"), path, strerror (errno)) << endmsg;
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
std::string session_template_full_name;
|
||||
|
||||
getline(recent, session_template_full_name);
|
||||
|
||||
if (!recent.good()) {
|
||||
break;
|
||||
}
|
||||
|
||||
rt.push_back (session_template_full_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::write_recent_sessions (RecentSessions& rs)
|
||||
{
|
||||
|
|
@ -102,6 +135,24 @@ ARDOUR::write_recent_sessions (RecentSessions& rs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::write_recent_templates (std::deque<std::string>& rt)
|
||||
{
|
||||
std::string path = Glib::build_filename (user_config_directory(), recent_templates_file_name);
|
||||
|
||||
std::ofstream recent (path.c_str());
|
||||
|
||||
if (!recent) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (std::deque<std::string>::const_iterator i = rt.begin(); i != rt.end(); ++i) {
|
||||
recent << (*i) << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::store_recent_sessions (string name, string path)
|
||||
{
|
||||
|
|
@ -129,6 +180,28 @@ ARDOUR::store_recent_sessions (string name, string path)
|
|||
return ARDOUR::write_recent_sessions (rs);
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::store_recent_templates (const std::string& session_template_full_name)
|
||||
{
|
||||
std::deque<std::string> rt;
|
||||
|
||||
if (ARDOUR::read_recent_templates (rt) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rt.erase(remove (rt.begin(), rt.end(), session_template_full_name), rt.end());
|
||||
|
||||
rt.push_front (session_template_full_name);
|
||||
|
||||
uint32_t max_recent_templates = Config->get_max_recent_templates ();
|
||||
|
||||
if (rt.size() > max_recent_templates) {
|
||||
rt.erase( rt.begin() + max_recent_templates, rt.end ());
|
||||
}
|
||||
|
||||
return ARDOUR::write_recent_templates (rt);
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::remove_recent_sessions (const string& path)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ Session::Session (AudioEngine &eng,
|
|||
destroy ();
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
||||
|
||||
/* if a mix template was provided, then ::create() will
|
||||
* have copied it into the session and we need to load it
|
||||
* so that we have the state ready for ::set_state()
|
||||
|
|
@ -331,8 +331,11 @@ Session::Session (AudioEngine &eng,
|
|||
* of a template.
|
||||
*/
|
||||
|
||||
if (!mix_template.empty() && load_state (_current_snapshot_name)) {
|
||||
throw failed_constructor ();
|
||||
if (!mix_template.empty()) {
|
||||
if (load_state (_current_snapshot_name)) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
store_recent_templates (mix_template);
|
||||
}
|
||||
|
||||
/* load default session properties - if any */
|
||||
|
|
|
|||
|
|
@ -2028,7 +2028,6 @@ Session::XMLSourceFactory (const XMLNode& node)
|
|||
int
|
||||
Session::save_template (string template_name)
|
||||
{
|
||||
|
||||
if ((_state_of_the_state & CannotSave) || template_name.empty ()) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -2101,6 +2100,8 @@ Session::save_template (string template_name)
|
|||
}
|
||||
copy_files (plugins_dir(), template_plugin_state_path);
|
||||
}
|
||||
|
||||
store_recent_templates (template_file_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue