merged -r1752:HEAD from trunk

git-svn-id: svn://localhost/ardour2/branches/2.1-staging@1763 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-04-29 22:39:21 +00:00
parent 87726495c3
commit a22f25559f
16 changed files with 103 additions and 49 deletions

View File

@ -14,9 +14,9 @@ cTransportMarkerBar 0.60 0.60 0.64 1.0
cTimeStretchFill 0.89 0.71 0.71 0.59
cTimeStretchOutline 0.39 0.39 0.39 0.59
cAutomationLine 0.27 0.74 0.35 1.0
cLeftPanAutomationLine 0.77 0.24 0.01 1.0
cLeftPanAutomationLine 0.87 0.44 0.11 1.0
cRightPanAutomationLine 0.03 0.26 0.73 1.0
cRedirectAutomationLine 0.28 0.34 0.74 1.0
cRedirectAutomationLine 0.48 0.64 0.98 1.0
cControlPointFill 0 0 0 1.0
cControlPointOutline 0 0 0 1.0
cEnteredControlPointOutline 1.0 0.21 0.21 1.0

View File

@ -947,9 +947,30 @@ ARDOUR_UI::filter_ardour_session_dirs (const FileFilter::Info& info)
return S_ISREG (statbuf.st_mode);
}
bool
ARDOUR_UI::check_audioengine ()
{
if (engine) {
if (!engine->connected()) {
MessageDialog msg (_("Ardour is not connected to JACK\n"
"You cannot open or close sessions in this condition"));
msg.run ();
return false;
}
return true;
} else {
return false;
}
}
void
ARDOUR_UI::open_session ()
{
if (!check_audioengine()) {
return;
}
/* popup selector window */
if (open_session_selector == 0) {
@ -1751,9 +1772,7 @@ ARDOUR_UI::new_session (std::string predetermined_path)
string session_name;
string session_path;
if (!engine->connected()) {
MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible."));
msg.run ();
if (!check_audioengine()) {
return false;
}
@ -1768,10 +1787,8 @@ ARDOUR_UI::new_session (std::string predetermined_path)
do {
response = new_session_dialog->run ();
if (!engine->connected()) {
if (!check_audioengine()) {
new_session_dialog->hide ();
MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible."));
msg.run ();
return false;
}
@ -1964,6 +1981,10 @@ ARDOUR_UI::new_session (std::string predetermined_path)
void
ARDOUR_UI::close_session()
{
if (!check_audioengine()) {
return;
}
unload_session();
new_session ();
}
@ -1975,6 +1996,10 @@ ARDOUR_UI::load_session (const string & path, const string & snap_name, string*
int x;
session_loaded = false;
if (!check_audioengine()) {
return -1;
}
x = unload_session ();
if (x < 0) {
@ -2031,8 +2056,14 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name,
Session *new_session;
int x;
if (!check_audioengine()) {
return -1;
}
session_loaded = false;
x = unload_session ();
if (x < 0) {
return -1;
} else if (x > 0) {

View File

@ -257,6 +257,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
ARDOUR::AudioEngine *engine;
ARDOUR::Session *session;
bool check_audioengine();
Gtk::Tooltips _tooltips;
void goto_editor_window ();

View File

@ -73,7 +73,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
base_rect = new SimpleRect(*canvas_display);
base_rect->property_x1() = 0.0;
base_rect->property_y1() = 0.0;
base_rect->property_x2() = max_frames;
base_rect->property_x2() = editor.frame_to_pixel (max_frames);
base_rect->property_outline_color_rgba() = color_map[cAutomationTrackOutline];
/* outline ends and bottom */
base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8);

View File

@ -27,7 +27,7 @@
#include <pbd/convert.h>
#include <pbd/error.h>
#include <pbd/stacktrace.h>
#include <pbd/enumwriter.h>
#include <pbd/memento_command.h>
#include <glibmm/miscutils.h>
@ -2041,6 +2041,10 @@ Editor::set_state (const XMLNode& node)
edit_cursor->set_position (0);
}
if ((prop = node.property ("mixer-width"))) {
editor_mixer_strip_width = Width (string_2_enum (prop->value(), editor_mixer_strip_width));
}
if ((prop = node.property ("zoom-focus"))) {
set_zoom_focus ((ZoomFocus) atoi (prop->value()));
}
@ -2181,6 +2185,8 @@ Editor::get_state ()
node->add_child_nocopy (*geometry);
}
maybe_add_mixer_strip_width (*node);
snprintf (buf, sizeof(buf), "%d", (int) zoom_focus);
node->add_property ("zoom-focus", buf);
snprintf (buf, sizeof(buf), "%f", frames_per_unit);

View File

@ -264,6 +264,7 @@ class Editor : public PublicEditor
TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
Width editor_mixer_strip_width;
void maybe_add_mixer_strip_width (XMLNode&);
void show_editor_mixer (bool yn);
void set_selected_mixer_strip (TimeAxisView&);
void hide_track_in_display (TimeAxisView& tv);

View File

@ -20,6 +20,9 @@
#include <glibmm/miscutils.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/window_title.h>
#include <pbd/enumwriter.h>
#include <ardour/audioengine.h>
#include "editor.h"
@ -32,6 +35,7 @@
#include "i18n.h"
using namespace Gtkmm2ext;
using namespace PBD;
void
Editor::editor_mixer_button_toggled ()
@ -107,8 +111,8 @@ Editor::show_editor_mixer (bool yn)
current_mixer_strip->set_embedded (true);
current_mixer_strip->Hiding.connect (mem_fun(*this, &Editor::current_mixer_strip_hidden));
current_mixer_strip->GoingAway.connect (mem_fun(*this, &Editor::current_mixer_strip_removed));
current_mixer_strip->set_width (editor_mixer_strip_width);
current_mixer_strip->set_width (editor_mixer_strip_width, (void*) this);
global_hpacker.pack_start (*current_mixer_strip, Gtk::PACK_SHRINK );
global_hpacker.reorder_child (*current_mixer_strip, 0);
@ -355,3 +359,11 @@ Editor::session_going_away ()
session = 0;
}
void
Editor::maybe_add_mixer_strip_width (XMLNode& node)
{
if (current_mixer_strip) {
node.add_property ("mixer-width", enum_2_string (current_mixer_strip->get_width()));
}
}

View File

@ -20,6 +20,7 @@
#include <pbd/enumwriter.h>
#include "audio_clock.h"
#include "enums.h"
using namespace std;
using namespace PBD;
@ -33,6 +34,7 @@ setup_gtk_ardour_enums ()
vector<string> s;
AudioClock::Mode clock_mode;
Width width;
#define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear()
#define REGISTER_BITS(e) enum_writer.register_bits (typeid(e).name(), i, s); i.clear(); s.clear()
@ -45,4 +47,8 @@ setup_gtk_ardour_enums ()
REGISTER_CLASS_ENUM (AudioClock, Frames);
REGISTER_CLASS_ENUM (AudioClock, Off);
REGISTER (clock_mode);
REGISTER_ENUM (Wide);
REGISTER_ENUM (Narrow);
REGISTER (width);
}

View File

@ -23,6 +23,7 @@
#include <sigc++/bind.h>
#include <pbd/convert.h>
#include <pbd/enumwriter.h>
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/utils.h>
@ -112,6 +113,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt
ignore_speed_adjustment = false;
comment_window = 0;
comment_area = 0;
_width_owner = 0;
width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
@ -370,19 +372,10 @@ MixerStrip::set_stuff_from_route ()
ensure_xml_node ();
/* if width is not set, it will be set by the MixerUI or editor */
if ((prop = xml_node->property ("strip_width")) != 0) {
if (prop->value() == "wide") {
set_width (Wide);
} else if (prop->value() == "narrow") {
set_width (Narrow);
}
else {
error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg;
set_width (Wide);
}
}
else {
set_width (Wide);
set_width (Width (string_2_enum (prop->value(), _width)), this);
}
if ((prop = xml_node->property ("shown_mixer")) != 0) {
@ -398,14 +391,17 @@ MixerStrip::set_stuff_from_route ()
}
void
MixerStrip::set_width (Width w)
MixerStrip::set_width (Width w, void* owner)
{
/* always set the gpm width again, things may be hidden */
gpm.set_width (w);
panners.set_width (w);
pre_redirect_box.set_width (w);
post_redirect_box.set_width (w);
_width_owner = owner;
if (_width == w) {
return;
}
@ -413,11 +409,14 @@ MixerStrip::set_width (Width w)
ensure_xml_node ();
_width = w;
if (_width_owner == this) {
xml_node->add_property ("strip_width", enum_2_string (_width));
}
switch (w) {
case Wide:
set_size_request (-1, -1);
xml_node->add_property ("strip_width", "wide");
if (rec_enable_button) {
((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
@ -441,8 +440,6 @@ MixerStrip::set_width (Width w)
break;
case Narrow:
xml_node->add_property ("strip_width", "narrow");
if (rec_enable_button) {
((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
}
@ -1095,10 +1092,10 @@ MixerStrip::width_clicked ()
{
switch (_width) {
case Wide:
set_width (Narrow);
set_width (Narrow, this);
break;
case Narrow:
set_width (Wide);
set_width (Wide, this);
break;
}
}

View File

@ -85,12 +85,13 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
MixerStrip (Mixer_UI&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true);
~MixerStrip ();
void set_width (Width);
void set_width (Width, void* owner);
Width get_width() const { return _width; }
void* width_owner() const { return _width_owner; }
void fast_update ();
void set_embedded (bool);
ARDOUR::RouteGroup* mix_group() const;
protected:
@ -107,6 +108,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
bool _embedded;
bool _packed;
Width _width;
void* _width_owner;
Gtk::Button hide_button;
Gtk::Button width_button;

View File

@ -244,7 +244,7 @@ Mixer_UI::show_window ()
for (ri = rows.begin(); ri != rows.end(); ++ri) {
ms = (*ri)[track_columns.strip];
ms->set_width (ms->get_width());
ms->set_width (ms->get_width(), ms->width_owner());
}
_visible = true;
}
@ -274,7 +274,10 @@ Mixer_UI::add_strip (Session::RouteList& routes)
strip = new MixerStrip (*this, *session, route);
strips.push_back (strip);
strip->set_width (_strip_width);
if (strip->width_owner() != strip) {
strip->set_width (_strip_width, this);
}
show_strip (strip);
no_track_list_redisplay = true;
@ -1040,7 +1043,7 @@ Mixer_UI::set_strip_width (Width w)
_strip_width = w;
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
(*i)->set_width (w);
(*i)->set_width (w, this);
}
}

View File

@ -762,6 +762,7 @@ AudioEngine::halted (void *arg)
ae->_running = false;
ae->_buffer_size = 0;
ae->_frame_rate = 0;
ae->_jack = 0;
ae->Halted(); /* EMIT SIGNAL */
}

View File

@ -415,7 +415,7 @@ PluginInsert::automation_run (vector<Sample *>& bufs, uint32_t nbufs, nframes_t
while (nframes) {
nframes_t cnt = min (((nframes_t) floor (next_event.when) - now), nframes);
nframes_t cnt = min (((nframes_t) ceil (next_event.when) - now), nframes);
connect_and_run (bufs, nbufs, cnt, offset, true, now);

View File

@ -343,11 +343,7 @@ IO::pan (vector<Sample*>& bufs, uint32_t nbufs, nframes_t nframes, nframes_t off
memcpy (dst, bufs[0], sizeof (Sample) * nframes);
for (n = 1; n < nbufs; ++n) {
src = bufs[n];
for (nframes_t n = 0; n < nframes; ++n) {
dst[n] += src[n];
}
Session::mix_buffers_no_gain(dst,bufs[n],nframes);
}
output(0)->mark_silence (false);
@ -365,11 +361,7 @@ IO::pan (vector<Sample*>& bufs, uint32_t nbufs, nframes_t nframes, nframes_t off
}
for (n = 1; n < nbufs; ++n) {
src = bufs[n];
for (nframes_t n = 0; n < nframes; ++n) {
dst[n] += src[n] * gain_coeff;
}
Session::mix_buffers_with_gain(dst,bufs[n],nframes,gain_coeff);
}
output(0)->mark_silence (false);

View File

@ -689,7 +689,7 @@ Session::save_state (string snapshot_name, bool pending)
tmp_path += snapshot_name;
tmp_path += ".tmp";
cerr << "actually writing state to " << xml_path << endl;
// cerr << "actually writing state to " << xml_path << endl;
if (!tree.write (tmp_path)) {
error << string_compose (_("state could not be saved to %1"), tmp_path) << endmsg;

View File

@ -448,6 +448,7 @@ style "editor_hscrollbar" = "ardour_adjusters"
# make it bigger.
#
GtkRange::slider_width = 27
GtkScrollbar::slider_width = 27
}
style "ardour_progressbars" = "default_buttons_menus"