13
0

missing dialog cleanups and logic improvements

git-svn-id: svn://localhost/ardour2/branches/3.0@7990 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-11-09 23:50:20 +00:00
parent 84ddf22169
commit 429ff2547b
4 changed files with 39 additions and 28 deletions

View File

@ -32,13 +32,12 @@ using namespace PBD;
MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataType type)
: ArdourDialog (_("Missing File!"), true, false)
, filetype (type)
, chooser (FILE_CHOOSER_ACTION_SELECT_FOLDER)
, chooser (_("Select a folder to search"), FILE_CHOOSER_ACTION_SELECT_FOLDER)
, use_chosen (_("Add chosen folder to search path, and try again"))
, choice_group (use_chosen.get_group())
, use_chosen_and_no_more_questions (choice_group, _("Add chosen folder to search path, try again but don't ask me again"), false)
, stop_loading_button (choice_group, _("Stop loading this session"), false)
, all_missing_ok (choice_group, _("This and all other missing files are OK"), false)
, this_missing_ok (choice_group, _("This missing file is OK"), false)
, all_missing_ok (choice_group, _("Skip all missing files"), false)
, this_missing_ok (choice_group, _("Skip this file"), false)
{
set_session (s);
@ -48,22 +47,28 @@ MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataT
switch (type) {
case DataType::AUDIO:
typestr = _("An audio");
typestr = _("audio");
break;
case DataType::MIDI:
typestr = _("A MIDI");
typestr = _("MIDI");
break;
}
string dirstr;
dirstr = s->source_search_path (type);
cerr << "Search path = " << dirstr << endl;
replace_all (dirstr, ":", "\n");
msg.set_markup (string_compose (_("%1 file (\"%2\") cannot be found.\n\n\
Currently, Ardour has searched in the following folders for this file:\n\n\
<tt>%3</tt>\n\n\
The following options are available:"), typestr, path, dirstr));
msg.set_justify (JUSTIFY_CENTER);
msg.set_markup (string_compose (_("Ardour cannot find the %1 file\n\n<i>%2</i>\n\nin any of these folders:\n\n\
<tt>%3</tt>\n\n"), typestr, path, dirstr));
HBox* hbox = manage (new HBox);
hbox->pack_start (msg, false, true);
hbox->show ();
get_vbox()->pack_start (*hbox, false, false);
VBox* button_packer_box = manage (new VBox);
@ -71,7 +76,6 @@ The following options are available:"), typestr, path, dirstr));
button_packer_box->set_border_width (12);
button_packer_box->pack_start (use_chosen, false, false);
button_packer_box->pack_start (use_chosen_and_no_more_questions, false, false);
button_packer_box->pack_start (this_missing_ok, false, false);
button_packer_box->pack_start (all_missing_ok, false, false);
button_packer_box->pack_start (stop_loading_button, false, false);
@ -79,21 +83,30 @@ The following options are available:"), typestr, path, dirstr));
button_packer_box->show_all ();
get_vbox()->set_spacing (6);
get_vbox()->set_border_width (12);
get_vbox()->set_border_width (25);
get_vbox()->set_homogeneous (false);
get_vbox()->pack_start (msg, false, false);
HBox* hbox = manage (new HBox);
hbox = manage (new HBox);
hbox->pack_start (*button_packer_box, false, true);
hbox->show ();
get_vbox()->pack_start (*hbox, false, false);
get_vbox()->pack_start (chooser, true, true);
hbox = manage (new HBox);
Label* label = manage (new Label);
label->set_text (_("Click to choose an additional folder"));
hbox->set_spacing (6);
hbox->set_border_width (12);
hbox->pack_start (*label, false, false);
hbox->pack_start (chooser, true, true);
hbox->show_all ();
get_vbox()->pack_start (*hbox, true, true);
msg.show ();
chooser.set_size_request (-1, 300);
chooser.show ();
chooser.set_current_folder (Glib::get_home_dir());
chooser.set_create_folders (false);
}
@ -143,17 +156,11 @@ MissingFileDialog::add_chosen ()
int
MissingFileDialog::get_action ()
{
if (use_chosen.get_active ()) {
add_chosen ();
return 0;
}
if (use_chosen_and_no_more_questions.get_active()) {
add_chosen ();
return 2;
}
if (this_missing_ok.get_active()) {
return -1;
}

View File

@ -3,7 +3,7 @@
#include <string>
#include <gtkmm/label.h>
#include <gtkmm/filechooserwidget.h>
#include <gtkmm/filechooserbutton.h>
#include <gtkmm/radiobutton.h>
#include "ardour/types.h"
@ -24,7 +24,7 @@ class MissingFileDialog : public ArdourDialog
private:
ARDOUR::DataType filetype;
Gtk::FileChooserWidget chooser;
Gtk::FileChooserButton chooser;
Gtk::RadioButton use_chosen;
Gtk::RadioButton::Group choice_group;
Gtk::RadioButton use_chosen_and_no_more_questions;

View File

@ -103,13 +103,13 @@ FileSource::init (const string& pathstr, bool must_exist)
}
}
set_within_session_from_path (pathstr);
set_within_session_from_path (_path);
if (!within_session()) {
_session.ensure_search_path_includes (Glib::path_get_dirname (pathstr), _type);
_session.ensure_search_path_includes (Glib::path_get_dirname (_path), _type);
}
_name = Glib::path_get_basename (pathstr);
_name = Glib::path_get_basename (_path);
if (_file_is_new && must_exist) {
return -1;

View File

@ -4141,6 +4141,10 @@ Session::ensure_search_path_includes (const string& path, DataType type)
string search_path;
vector<string> dirs;
if (path == ".") {
return;
}
switch (type) {
case DataType::AUDIO:
search_path = config.get_audio_search_path ();