* Fix tooltips in the session import dialog
authorSakari Bergen <sakari.bergen@beatwaves.net>
Sat, 2 May 2009 20:26:11 +0000 (20:26 +0000)
committerSakari Bergen <sakari.bergen@beatwaves.net>
Sat, 2 May 2009 20:26:11 +0000 (20:26 +0000)
* Fix arval to run from all directories

git-svn-id: svn://localhost/ardour2/branches/3.0@5028 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/arval
gtk2_ardour/session_import_dialog.cc
gtk2_ardour/session_import_dialog.h
libs/ardour/ardour/audio_region_importer.h
libs/ardour/ardour/element_importer.h
libs/ardour/audio_region_importer.cc

index 8f227944703dd66a2ad09a4c166a476f01c8457e..b9c0298c8fb1d1bb55be237b27170b3f6d157202 100755 (executable)
@@ -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 "$@"
index d6f2826abf4a9a061efd4f32bb7beae609205f3a..2d1f6a100776c3ac9b6469ab49a6ca57eff3d124 100644 (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 ()
 {
index e095dbaea06aa281c2e3f6b18ffc98c70be3f838..cf1f5b0a4ec246ce5c9156293e8f75f80f645534 100644 (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;
index 03067c465d1b621a6fe3427d8824fba8bc7baf71..ec70627428872db72cae37f6bfe49eae1783c18c 100644 (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 ();
index 0a2d5d3fb3c9675152f38035d8eaffb3b65e4767..04f46f7a03c217fc0ec935485e3d39dae2949d69 100644 (file)
 #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
index bea61d81e3915789e2232180adf34d658f33de2f..90fc7bac4d88478031e3cd9ff26675dc1256259e 100644 (file)
@@ -336,23 +336,22 @@ AudioRegionImporter::prepare_sources ()
                return;
        }
        
-       Session::ImportStatus status;
+       status.total = 0;
+       status.replace_existing_source = false;
+       status.done = false;
+       status.cancel = false;
+       status.freeze = false;
+       status.progress = 0.0;
+       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++;
                }
        }
        
-       // Prepare rest of import struct TODO quality
-       status.replace_existing_source = false;
-       status.done = false;
-       status.cancel = false;
-       status.freeze = false;
-       status.progress = 0.0;
-       status.quality = SrcBest;
-       
        // import files
        // TODO: threading & exception handling
        session.import_audiofiles (status);