#include "streamview.h"
#include "regionview.h"
+#include "taperegionview.h"
#include "audio_time_axis.h"
#include "canvas-waveview.h"
#include "canvas-simplerect.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "utils.h"
+#include "color.h"
using namespace ARDOUR;
using namespace Editing;
/* set_position() will position the group */
- //GTK2FIX -- how to get the group? is the canvas display really a group?
- //canvas_group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(_trackview.canvas_display),
- // gnome_canvas_group_get_type (),
- // NULL);
canvas_group = new ArdourCanvas::Group(*_trackview.canvas_display);
- //canvas_rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_group),
- // gnome_canvas_simplerect_get_type(),
- // "x1", 0.0,
- // "y1", 0.0,
- // "x2", 1000000.0,
- // "y2", (double) tv.height,
- // "outline_color_rgba", color_map[cAudioTrackOutline],
- // /* outline ends and bottom */
- // "outline_what", (guint32) (0x1|0x2|0x8),
- // "fill_color_rgba", stream_base_color,
- // ] NULL);
canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group);
canvas_rect->property_x1() = 0.0;
canvas_rect->property_y1() = 0.0;
canvas_rect->property_x2() = 1000000.0;
canvas_rect->property_y2() = (double) tv.height;
canvas_rect->property_outline_color_rgba() = color_map[cAudioTrackOutline];
- /* outline ends and bottom */
- canvas_rect->property_outline_what() = (guint32) (0x1|0x2|0x8);
+ canvas_rect->property_outline_what() = (guint32) (0x1|0x2|0x8); // outline ends and bottom
canvas_rect->property_fill_color_rgba() = stream_base_color;
canvas_rect->signal_event().connect (bind (mem_fun (_trackview.editor, &PublicEditor::canvas_stream_view_event), canvas_rect, &_trackview));
rec_active = false;
use_rec_regions = tv.editor.show_waveforms_recording ();
last_rec_peak_frame = 0;
+
+ ColorChanged.connect (mem_fun (*this, &StreamView::color_handler));
}
StreamView::~StreamView ()
return;
}
}
+
+ switch (_trackview.audio_track()->mode()) {
+ case Normal:
+ region_view = new AudioRegionView (canvas_group, _trackview, *region,
+ _samples_per_unit, region_color);
+ break;
+ case Destructive:
+ region_view = new TapeAudioRegionView (canvas_group, _trackview, *region,
+ _samples_per_unit, region_color);
+ break;
+ }
- region_view = new AudioRegionView (canvas_group,
- _trackview,
- *region,
- _samples_per_unit,
- _amplitude_above_axis,
- region_color,
- wait_for_waves);
-
+ region_view->init (_amplitude_above_axis, region_color, wait_for_waves);
region_views.push_front (region_view);
/* follow global waveform setting */
{
ENSURE_GUI_THREAD(bind (mem_fun (*this, &StreamView::remove_rec_region), r));
- if (!Gtkmm2ext::UI::instance()->caller_is_gui_thread()) {
+ if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) {
fatal << "region deleted from non-GUI thread!" << endmsg;
/*NOTREACHED*/
}
{
bool selected;
+ // cerr << _trackview.name() << " (selected = " << regions.size() << ")" << endl;
for (list<AudioRegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
selected = false;
}
}
+ // cerr << "\tregion " << (*i)->region.name() << " selected = " << selected << endl;
(*i)->set_selected (selected, this);
}
}
// cerr << "\trolling\n";
- if (!rec_active
- && _trackview.session().record_status() == Session::Recording
- && _trackview.get_diskstream()->record_enabled()) {
+ if (!rec_active &&
+ _trackview.session().record_status() == Session::Recording &&
+ _trackview.get_diskstream()->record_enabled()) {
+
+ if (_trackview.audio_track()->mode() == Normal && use_rec_regions && rec_regions.size() == rec_rects.size()) {
- if (use_rec_regions && rec_regions.size() == rec_rects.size()) {
/* add a new region, but don't bother if they set use_rec_regions mid-record */
AudioRegion::SourceList sources;
DiskStream& ds = at->disk_stream();
jack_nframes_t frame_pos = ds.current_capture_start ();
gdouble xstart = _trackview.editor.frame_to_pixel (frame_pos);
- gdouble xend = xstart;
+ gdouble xend;
+ uint32_t fill_color;
+
+ switch (_trackview.audio_track()->mode()) {
+ case Normal:
+ xend = xstart;
+ fill_color = color_map[cRecordingRectFill];
+ break;
+
+ case Destructive:
+ xend = xstart + 2;
+ fill_color = color_map[cRecordingRectFill];
+ /* make the recording rect translucent to allow
+ the user to see the peak data coming in, etc.
+ */
+ fill_color = UINT_RGBA_CHANGE_A (fill_color, 120);
+ break;
+ }
ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*canvas_group);
rec_rect->property_x1() = xstart;
rec_rect->property_x2() = xend;
rec_rect->property_y2() = (double) _trackview.height - 1;
rec_rect->property_outline_color_rgba() = color_map[cRecordingRectOutline];
- rec_rect->property_fill_color_rgba() = color_map[cRecordingRectFill];
+ rec_rect->property_fill_color_rgba() = fill_color;
RecBoxInfo recbox;
recbox.rectangle = rec_rect;
void
StreamView::update_rec_box ()
{
- /* only update the last box */
if (rec_active && rec_rects.size() > 0) {
+ /* only update the last box */
RecBoxInfo & rect = rec_rects.back();
jack_nframes_t at = _trackview.get_diskstream()->current_capture_end();
+ double xstart;
+ double xend;
+
+ switch (_trackview.audio_track()->mode()) {
+ case Normal:
+ rect.length = at - rect.start;
+ xstart = _trackview.editor.frame_to_pixel (rect.start);
+ xend = _trackview.editor.frame_to_pixel (at);
+ break;
+
+ case Destructive:
+ rect.length = 2;
+ xstart = _trackview.editor.frame_to_pixel (_trackview.get_diskstream()->current_capture_start());
+ xend = _trackview.editor.frame_to_pixel (at);
+ break;
+ }
- rect.length = at - rect.start;
-
- gdouble xstart = _trackview.editor.frame_to_pixel ( rect.start );
- gdouble xend = _trackview.editor.frame_to_pixel ( at );
-
rect.rectangle->property_x1() = xstart;
rect.rectangle->property_x2() = xend;
}
}
-
+
AudioRegionView*
StreamView::find_view (const AudioRegion& region)
{
}
}
}
+
+void
+StreamView::color_handler (ColorID id, uint32_t val)
+{
+ switch (id) {
+ case cAudioTrackBase:
+ if (_trackview.is_audio_track()) {
+ canvas_rect->property_fill_color_rgba() = val;
+ }
+ break;
+ case cAudioBusBase:
+ if (!_trackview.is_audio_track()) {
+ canvas_rect->property_fill_color_rgba() = val;
+ }
+ break;
+ case cAudioTrackOutline:
+ canvas_rect->property_outline_color_rgba() = val;
+ break;
+
+ default:
+ break;
+ }
+}