* Fix tooltips in the session import dialog

* Fix arval to run from all directories


git-svn-id: svn://localhost/ardour2/branches/3.0@5028 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sakari Bergen
2009-05-02 20:26:11 +00:00
parent c7733b443a
commit 7e48118bf1
6 changed files with 22 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/sh
. ./ardev_common.sh
. `dirname "$0"`/ardev_common.sh
export ARDOUR_RUNNING_UNDER_VALGRIND=TRUE
exec valgrind --num-callers=50 --tool=memcheck $TOP/$EXECUTABLE --novst "$@"

View File

@@ -68,6 +68,7 @@ SessionImportDialog::SessionImportDialog (ARDOUR::Session & target) :
session_browser.set_name ("SessionBrowser");
session_browser.append_column (_("Elements"), sb_cols.name);
session_browser.append_column_editable (_("Import"), sb_cols.queued);
session_browser.set_tooltip_column (3);
session_browser.get_column(0)->set_min_width (180);
session_browser.get_column(1)->set_min_width (40);
session_browser.get_column(1)->set_sizing (Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
@@ -83,10 +84,6 @@ SessionImportDialog::SessionImportDialog (ARDOUR::Session & target) :
get_vbox()->pack_start (session_scroll, false, false);
// Tooltips
session_browser.set_has_tooltip();
session_browser.signal_query_tooltip().connect(mem_fun(*this, &SessionImportDialog::query_tooltip));
// Buttons
cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
cancel_button->signal_clicked().connect (mem_fun (*this, &SessionImportDialog::end_dialog));
@@ -146,6 +143,7 @@ SessionImportDialog::fill_list ()
child[sb_cols.name] = (*element)->get_name();
child[sb_cols.queued] = false;
child[sb_cols.element] = *element;
child[sb_cols.info] = (*element)->get_info();
}
}
}
@@ -250,38 +248,12 @@ SessionImportDialog::show_info(const Gtk::TreeModel::Path& path, Gtk::TreeViewCo
}
Gtk::TreeModel::iterator cell = session_browser.get_model()->get_iter (path);
ElementPtr element = (*cell)[sb_cols.element];
string info = element->get_info();
string info = (*cell)[sb_cols.info];
Gtk::MessageDialog msg (info, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true);
msg.run();
}
bool
SessionImportDialog::query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip)
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn* column;
int cell_x, cell_y;
// Get element
session_browser.get_path_at_pos (x, y, path, column, cell_x, cell_y);
if (path.gobj() == 0) {
return false;
}
Gtk::TreeModel::iterator row = session_browser.get_model()->get_iter (path);
//--row; // FIXME Strange offset in rows, if someone figures this out, please fix
ElementPtr element = (*row)[sb_cols.element];
if (element.get() == 0) {
return false;
}
// Prepare tooltip
tooltip->set_text(element->get_info());
return true;
}
void
SessionImportDialog::end_dialog ()
{

View File

@@ -63,7 +63,6 @@ class SessionImportDialog : public ArdourDialog
void end_dialog ();
void update (string path);
void show_info(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
bool query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
std::pair<bool, string> open_rename_dialog (string text, string name);
bool open_prompt_dialog (string text);
@@ -85,8 +84,9 @@ class SessionImportDialog : public ArdourDialog
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<bool> queued;
Gtk::TreeModelColumn<ElementPtr> element;
Gtk::TreeModelColumn<std::string> info;
SessionBrowserColumns() { add (name); add (queued); add (element); }
SessionBrowserColumns() { add (name); add (queued); add (element); add (info); }
};
SessionBrowserColumns sb_cols;

View File

@@ -76,6 +76,7 @@ class AudioRegionImporter : public ElementImporter
// Interface implementation
string get_info () const;
Session::ImportStatus * get_import_status () { return &status; }
// other stuff
void add_sources_to_session ();
@@ -93,6 +94,7 @@ class AudioRegionImporter : public ElementImporter
PBD::ID old_id;
PBD::ID id;
std::list<string> filenames;
Session::ImportStatus status;
bool parse_xml_region ();
bool parse_source_xml ();

View File

@@ -27,14 +27,13 @@
#include <sigc++/signal.h>
#include "ardour/types.h"
#include "ardour/session.h"
using std::string;
class XMLTree;
namespace ARDOUR {
class Session;
/// Virtual interface class for element importers
class ElementImporter
{
@@ -53,6 +52,9 @@ class ElementImporter
*/
virtual string get_info () const = 0;
/** Gets import status, if applicable. */
virtual Session::ImportStatus * get_import_status () { return 0; }
/** Prepares to move element
*
* @return whther or not the element could be prepared for moving

View File

@@ -336,22 +336,21 @@ AudioRegionImporter::prepare_sources ()
return;
}
Session::ImportStatus status;
// Get sources that still need to be imported
for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
if (!handler.check_source (*it)) {
status.paths.push_back (*it);
}
}
// Prepare rest of import struct TODO quality
status.total = 0;
status.replace_existing_source = false;
status.done = false;
status.cancel = false;
status.freeze = false;
status.progress = 0.0;
status.quality = SrcBest;
status.quality = SrcBest; // TODO other qualities also
// Get sources that still need to be imported
for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
if (!handler.check_source (*it)) {
status.paths.push_back (*it);
status.total++;
}
}
// import files
// TODO: threading & exception handling