13
0

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
This commit is contained in:
Paul Davis 2007-01-29 20:02:43 +00:00
parent 433f2cfb43
commit 9e8082aad6
13 changed files with 81 additions and 26 deletions

View File

@ -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 $*

View File

@ -1,3 +1,4 @@
#!/bin/sh
. `dirname "$0"`/ardev_common.sh
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
exec $EXECUTABLE $*

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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 ();

View File

@ -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 */

View File

@ -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();

View File

@ -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

View File

@ -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;
}

View File

@ -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__ */

View File

@ -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).
*/
boost::shared_ptr<Region> r = RegionFactory::create (srcs, _start, _length, new_name, _layer, _flags);
Flag f = Flag (_flags & ~WholeFile);
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);

View File

@ -50,8 +50,6 @@ SndFileSource::SndFileSource (Session& s, const XMLNode& node)
{
init ();
cerr << "SndFileSource @ " << _path << " channel = " << channel << endl;
if (open()) {
throw failed_constructor ();
}

View File

@ -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 */