Use labs() for long instead of abs()
[ardour.git] / gtk2_ardour / editor_sources.h
index 89b5e418d9861f3889f98542e14ce585e78e715a..109ba82b3bd2e8d6262a8f797a498b43b60a8c7c 100644 (file)
@@ -1,21 +1,20 @@
 /*
-    Copyright (C) 2000-2009 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2018-2019 Ben Loftis <ben@harrisonconsoles.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 #ifndef __gtk_ardour_editor_sources_h__
 #define __gtk_ardour_editor_sources_h__
 
@@ -44,11 +43,11 @@ public:
        }
 
        void clear ();
-
+       
        void selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
 
-       boost::shared_ptr<ARDOUR::Source> get_dragged_source ();
-       boost::shared_ptr<ARDOUR::Source> get_single_selection ();
+       boost::shared_ptr<ARDOUR::Region> get_dragged_region ();
+       boost::shared_ptr<ARDOUR::Region> get_single_selection ();
 
        void block_change_connection (bool b) {
                _change_connection.block (b);
@@ -58,7 +57,9 @@ public:
                _display.get_selection()->unselect_all ();
        }
 
-       void remove_unused_regions ();
+       //user actions
+       void remove_selected_sources ();
+       void recover_selected_sources();
 
        XMLNode& get_state () const;
        void set_state (const XMLNode &);
@@ -68,16 +69,18 @@ private:
        struct Columns : public Gtk::TreeModel::ColumnRecord {
                Columns () {
                        add (name);
+                       add (tags);
                        add (take_id);
                        add (natural_pos);
                        add (path);
                        add (color_);
-                       add (source);
+                       add (region);
                        add (natural_s);
                }
 
                Gtk::TreeModelColumn<std::string> name;
-               Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Source> > source;
+               Gtk::TreeModelColumn<std::string> tags;
+               Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
                Gtk::TreeModelColumn<Gdk::Color> color_;
                Gtk::TreeModelColumn<std::string> natural_pos;
                Gtk::TreeModelColumn<std::string> path;
@@ -91,16 +94,18 @@ private:
 
        void freeze_tree_model ();
        void thaw_tree_model ();
-       void source_changed (boost::shared_ptr<ARDOUR::Source>);
-       void populate_row (Gtk::TreeModel::Row row, boost::shared_ptr<ARDOUR::Source> source);
+       void source_changed (boost::shared_ptr<ARDOUR::Region>);
+       void populate_row (Gtk::TreeModel::Row row, boost::shared_ptr<ARDOUR::Region> region);
        void selection_changed ();
 
        sigc::connection _change_connection;
 
-       bool selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
-
        Gtk::Widget* old_focus;
 
+       Gtk::CellEditable* tags_editable;
+       void tag_editing_started (Gtk::CellEditable*, const Glib::ustring&);
+       void tag_edit (const std::string&, const std::string&);
+
        bool key_press (GdkEventKey *);
        bool button_press (GdkEventButton *);
 
@@ -113,35 +118,44 @@ private:
 
        void format_position (ARDOUR::samplepos_t pos, char* buf, size_t bufsize, bool onoff = true);
 
-       void add_source (boost::shared_ptr<ARDOUR::Source>);
+       void add_source (boost::shared_ptr<ARDOUR::Region>);
        void remove_source (boost::shared_ptr<ARDOUR::Source>);
 
-       void update_all_rows ();
+       void clock_format_changed ();
+
+       void redisplay ();
+
+       void suspend_redisplay () {
+               _no_redisplay = true;
+       }
+
+       void resume_redisplay () {
+               _no_redisplay = false;
+               redisplay ();
+       }
 
        void drag_data_received (
                Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
                );
 
-       Glib::RefPtr<Gtk::Action> remove_unused_regions_action () const;  //TODO: what is the equivalent?
-
        Gtk::Menu* _menu;
        Gtk::ScrolledWindow _scroller;
        Gtk::Frame _frame;
 
-       Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Source> > _display;  //TODO .. try changing this to region
+       Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > _display;
 
        Glib::RefPtr<Gtk::TreeStore> _model;
 
        PBD::ScopedConnection source_property_connection;
-
-       PBD::ScopedConnection source_added_connection;
-       PBD::ScopedConnection source_removed_connection;
+       PBD::ScopedConnection add_source_connection;
+       PBD::ScopedConnection remove_source_connection;
 
        PBD::ScopedConnection editor_freeze_connection;
        PBD::ScopedConnection editor_thaw_connection;
 
        Selection* _selection;
-
+       
+       bool _no_redisplay;
 };
 
 #endif /* __gtk_ardour_editor_regions_h__ */