summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-01-29 20:02:43 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-01-29 20:02:43 +0000
commit9e8082aad6645f67cb18ea608abb6a854fd268d0 (patch)
tree4b6c7cfe6e8171d26d4c33287bbb259ed252c8b8
parent433f2cfb437e189a5114338c70967815a6d9d02a (diff)
small change to region creation for make-mono-regions; add untested short_path(); fix double-redraws when canvas zoom/position changes
git-svn-id: svn://localhost/ardour2/trunk@1396 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rwxr-xr-xgtk2_ardour/ardbg1
-rwxr-xr-xgtk2_ardour/ardev1
-rw-r--r--gtk2_ardour/editor.cc9
-rw-r--r--gtk2_ardour/editor.h4
-rw-r--r--gtk2_ardour/editor_audio_import.cc4
-rw-r--r--gtk2_ardour/editor_canvas.cc9
-rw-r--r--gtk2_ardour/editor_rulers.cc2
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc27
-rw-r--r--gtk2_ardour/utils.cc32
-rw-r--r--gtk2_ardour/utils.h1
-rw-r--r--libs/ardour/audioregion.cc9
-rw-r--r--libs/ardour/sndfilesource.cc2
-rw-r--r--libs/pbd/stacktrace.cc6
13 files changed, 81 insertions, 26 deletions
diff --git a/gtk2_ardour/ardbg b/gtk2_ardour/ardbg
index 95466a42b8..ab99296f45 100755
--- a/gtk2_ardour/ardbg
+++ b/gtk2_ardour/ardbg
@@ -1,4 +1,5 @@
#!/bin/sh
dir=`dirname "$0"`
. $dir/ardev_common.sh
+LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
exec gdb $EXECUTABLE $*
diff --git a/gtk2_ardour/ardev b/gtk2_ardour/ardev
index ff68e11fbe..5dd8fc9d13 100755
--- a/gtk2_ardour/ardev
+++ b/gtk2_ardour/ardev
@@ -1,3 +1,4 @@
#!/bin/sh
. `dirname "$0"`/ardev_common.sh
+LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
exec $EXECUTABLE $*
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index fec951f9d2..cae06c0612 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -1071,7 +1071,7 @@ Editor::connect_to_session (Session *t)
session_connections.push_back (session->SMPTEOffsetChanged.connect (mem_fun(*this, &Editor::update_just_smpte)));
- session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
+ session_connections.push_back (session->tempo_map().StateChanged.connect (bind (mem_fun(*this, &Editor::tempo_map_changed), false)));
edit_groups_changed ();
@@ -3625,7 +3625,8 @@ Editor::canvas_horizontally_scrolled ()
{
/* this is the core function that controls horizontal scrolling of the canvas. it is called
whenever the horizontal_adjustment emits its "value_changed" signal. it executes in an
- idle handler.
+ idle handler, which is important because tempo_map_changed() should issue redraws immediately
+ and not defer them to an idle handler.
*/
leftmost_frame = (nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
@@ -3637,7 +3638,7 @@ Editor::canvas_horizontally_scrolled ()
}
update_fixed_rulers ();
- tempo_map_changed (Change (0));
+ tempo_map_changed (Change (0), true);
}
void
@@ -3686,7 +3687,7 @@ Editor::idle_visual_changer ()
/* the signal handler will do the rest */
} else {
update_fixed_rulers();
- tempo_map_changed (Change (0));
+ tempo_map_changed (Change (0), true);
}
}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 43f170f679..bf960f9f8e 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1174,7 +1174,7 @@ class Editor : public PublicEditor
Gtk::Allocation canvas_allocation;
bool canvas_idle_queued;
void track_canvas_allocate (Gtk::Allocation alloc);
- bool track_canvas_idle ();
+ bool track_canvas_size_allocated ();
void set_edit_cursor (GdkEvent* event);
void set_playhead_cursor (GdkEvent* event);
@@ -1275,7 +1275,7 @@ class Editor : public PublicEditor
void remove_metric_marks ();
void draw_metric_marks (const ARDOUR::Metrics& metrics);
- void tempo_map_changed (ARDOUR::Change);
+ void tempo_map_changed (ARDOUR::Change, bool immediate_redraw);
void redisplay_tempo ();
void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false);
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index 2a8f2a4516..28911b8ea6 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -40,6 +40,7 @@
#include "sfdb_ui.h"
#include "editing.h"
#include "audio_time_axis.h"
+#include "utils.h"
#include "i18n.h"
@@ -315,7 +316,8 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi
choices.push_back (_("Embed all without questions"));
Gtkmm2ext::Choice rate_choice (
- string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path),
+ string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"),
+ short_path (path, 40)),
choices, false);
int resx = rate_choice.run ();
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 3f70322573..87e593b0ea 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -280,7 +280,7 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
if (!initial_ruler_update_required) {
if (!canvas_idle_queued) {
/* call this first so that we do stuff before any pending redraw */
- Glib::signal_idle().connect (mem_fun (*this, &Editor::track_canvas_idle), false);
+ Glib::signal_idle().connect (mem_fun (*this, &Editor::track_canvas_size_allocated), false);
canvas_idle_queued = true;
}
return;
@@ -288,11 +288,11 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
initial_ruler_update_required = false;
- track_canvas_idle ();
+ track_canvas_size_allocated ();
}
bool
-Editor::track_canvas_idle ()
+Editor::track_canvas_size_allocated ()
{
if (canvas_idle_queued) {
canvas_idle_queued = false;
@@ -321,7 +321,6 @@ Editor::track_canvas_idle ()
full_canvas_height = height;
}
-
zoom_range_clock.set ((nframes_t) floor ((canvas_width * frames_per_unit)));
edit_cursor->set_position (edit_cursor->current_frame);
playhead_cursor->set_position (playhead_cursor->current_frame);
@@ -363,7 +362,7 @@ Editor::track_canvas_idle ()
}
update_fixed_rulers();
- tempo_map_changed (Change (0));
+ tempo_map_changed (Change (0), true);
Resized (); /* EMIT_SIGNAL */
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 7f6ac56d5b..30bcff093a 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -705,7 +705,7 @@ Editor::update_ruler_visibility ()
update_fixed_rulers();
//update_tempo_based_rulers();
- tempo_map_changed(Change (0));
+ tempo_map_changed(Change (0), false);
time_canvas_event_box.show_all();
time_button_event_box.show_all();
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index da856aa8a4..7647de8ca6 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -94,13 +94,13 @@ Editor::draw_metric_marks (const Metrics& metrics)
}
void
-Editor::tempo_map_changed (Change ignored)
+Editor::tempo_map_changed (Change ignored, bool immediate_redraw)
{
if (!session) {
return;
}
- ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored));
+ ENSURE_GUI_THREAD(bind (mem_fun (*this, &Editor::tempo_map_changed), ignored, immediate_redraw));
BBT_Time previous_beat, next_beat; // the beats previous to the leftmost frame and after the rightmost frame
@@ -135,18 +135,27 @@ Editor::tempo_map_changed (Change ignored)
current_bbt_points = 0;
}
- redisplay_tempo ();
+ if (immediate_redraw) {
+
+ hide_measures ();
+
+ if (session && current_bbt_points) {
+ draw_measures ();
+ }
+
+ } else {
+
+ if (session && current_bbt_points) {
+ Glib::signal_idle().connect (mem_fun (*this, &Editor::lazy_hide_and_draw_measures));
+ } else {
+ hide_measures ();
+ }
+ }
}
void
Editor::redisplay_tempo ()
{
-
- if (session && current_bbt_points) {
- Glib::signal_idle().connect (mem_fun (*this, &Editor::lazy_hide_and_draw_measures));
- } else {
- hide_measures ();
- }
}
void
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 887494829e..238622ea38 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -547,3 +547,35 @@ key_is_legal_for_numeric_entry (guint keyval)
return false;
}
+ustring
+short_path (ustring path, uint32_t target_characters)
+{
+ ustring::size_type slash;
+ ustring::size_type len = path.length();
+
+ if (len <= target_characters) {
+ return path;
+ }
+
+
+ slash = path.find_last_of ('/');
+
+ if (len - slash > target_characters) {
+ /* even the filename itself is too long, so just return it - its
+ the best we can do
+ */
+ return path.substr (slash);
+ }
+
+ uint32_t so_far = (len - slash) + 4; // allow for .../
+ uint32_t space_for = target_characters - so_far;
+
+ if (slash < target_characters) {
+ return path;
+ }
+
+ string res = ".../";
+ res += path.substr (slash - space_for);
+
+ return res;
+}
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index 6d5ff0702d..d24024ffab 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -81,5 +81,6 @@ static std::map<std::string, Glib::RefPtr<Gdk::Pixbuf> > xpm_map;
const char* const *get_xpm_data (std::string path);
std::string longest (std::vector<std::string>&);
bool key_is_legal_for_numeric_entry (guint keyval);
+Glib::ustring short_path (Glib::ustring, uint32_t target_characters);
#endif /* __ardour_gtk_utils_h__ */
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 9f76b0f19e..bc66f0d6b0 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -1051,10 +1051,15 @@ AudioRegion::separate_by_channel (Session& session, vector<boost::shared_ptr<Aud
new_name += ('0' + n + 1);
}
- /* create a copy with just one source */
+ /* create a copy with just one source. prevent if from being thought of as "whole file" even if
+ it covers the entire source file(s).
+ */
+
+ Flag f = Flag (_flags & ~WholeFile);
- boost::shared_ptr<Region> r = RegionFactory::create (srcs, _start, _length, new_name, _layer, _flags);
+ boost::shared_ptr<Region> r = RegionFactory::create (srcs, _start, _length, new_name, _layer, f);
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
+ cerr << "new region name is " << ar->name() << endl;
v.push_back (ar);
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 850aa6bc6c..629b3e4158 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -50,8 +50,6 @@ SndFileSource::SndFileSource (Session& s, const XMLNode& node)
{
init ();
- cerr << "SndFileSource @ " << _path << " channel = " << channel << endl;
-
if (open()) {
throw failed_constructor ();
}
diff --git a/libs/pbd/stacktrace.cc b/libs/pbd/stacktrace.cc
index a653fe3033..82a78c6fe2 100644
--- a/libs/pbd/stacktrace.cc
+++ b/libs/pbd/stacktrace.cc
@@ -39,4 +39,10 @@ PBD::stacktrace (std::ostream& out, int levels)
out << "stack tracing is not enabled on this platform" << std::endl;
}
+void
+c_stacktrace ()
+{
+ PBD::stacktrace (cout);
+}
+
#endif /* HAVE_EXECINFO */