Fix insane formatting (how did this even happen? copy paste from an email diff or something?).

git-svn-id: svn://localhost/ardour2/branches/3.0@4631 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-02-19 00:25:24 +00:00
parent df329436ea
commit 2e1332f74f

View file

@ -1,4 +1,4 @@
/*
/*
Copyright (C) 2000 Paul Davis
This program is free software; you can redistribute it and/or modify
@ -15,71 +15,71 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
*/
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <list>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <list>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/canvas.h>
#include <libgnomecanvasmm/item.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/canvas.h>
#include <libgnomecanvasmm/item.h>
#include <pbd/error.h>
#include <pbd/error.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/selector.h>
#include <gtkmm2ext/stop_signal.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/selector.h>
#include <gtkmm2ext/stop_signal.h>
#include <ardour/session.h>
#include <ardour/utils.h>
#include <ardour/ladspa_plugin.h>
#include <ardour/processor.h>
#include <ardour/location.h>
#include <ardour/session.h>
#include <ardour/utils.h>
#include <ardour/ladspa_plugin.h>
#include <ardour/processor.h>
#include <ardour/location.h>
#include "ardour_ui.h"
#include "public_editor.h"
#include "time_axis_view.h"
#include "region_view.h"
#include "ghostregion.h"
#include "simplerect.h"
#include "simpleline.h"
#include "selection.h"
#include "keyboard.h"
#include "rgb_macros.h"
#include "utils.h"
#include "streamview.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "time_axis_view.h"
#include "region_view.h"
#include "ghostregion.h"
#include "simplerect.h"
#include "simpleline.h"
#include "selection.h"
#include "keyboard.h"
#include "rgb_macros.h"
#include "utils.h"
#include "streamview.h"
#include "i18n.h"
#include "i18n.h"
using namespace Gtk;
using namespace Gdk;
using namespace sigc;
using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
using namespace ArdourCanvas;
using namespace Gtk;
using namespace Gdk;
using namespace sigc;
using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
using namespace ArdourCanvas;
const double trim_handle_size = 6.0; /* pixels */
const double trim_handle_size = 6.0; /* pixels */
uint32_t TimeAxisView::hLargest = 0;
uint32_t TimeAxisView::hLarge = 0;
uint32_t TimeAxisView::hLarger = 0;
uint32_t TimeAxisView::hNormal = 0;
uint32_t TimeAxisView::hSmaller = 0;
uint32_t TimeAxisView::hSmall = 0;
bool TimeAxisView::need_size_info = true;
int const TimeAxisView::_max_order = 512;
uint32_t TimeAxisView::hLargest = 0;
uint32_t TimeAxisView::hLarge = 0;
uint32_t TimeAxisView::hLarger = 0;
uint32_t TimeAxisView::hNormal = 0;
uint32_t TimeAxisView::hSmaller = 0;
uint32_t TimeAxisView::hSmall = 0;
bool TimeAxisView::need_size_info = true;
int const TimeAxisView::_max_order = 512;
TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& canvas)
TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& canvas)
: AxisView (sess),
controls_table (2, 8),
_y_position (0),
_editor (ed),
_order (0)
{
{
if (need_size_info) {
compute_controls_size_info ();
need_size_info = false;
@ -180,10 +180,10 @@
// controls_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
ColorsChanged.connect (mem_fun (*this, &TimeAxisView::color_handler));
}
}
TimeAxisView::~TimeAxisView()
{
TimeAxisView::~TimeAxisView()
{
in_destructor = true;
for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
@ -218,18 +218,18 @@
delete display_menu;
display_menu = 0;
}
}
/** Display this TimeAxisView as the nth component of the parent box, at y.
*
* @param y y position.
* @param nth index for this TimeAxisView, increased if this view has children.
* @param parent parent component.
* @return height of this TimeAxisView.
*/
guint32
TimeAxisView::show_at (double y, int& nth, VBox *parent)
{
*
* @param y y position.
* @param nth index for this TimeAxisView, increased if this view has children.
* @param parent parent component.
* @return height of this TimeAxisView.
*/
guint32
TimeAxisView::show_at (double y, int& nth, VBox *parent)
{
if (control_parent) {
control_parent->reorder_child (controls_hbox, nth);
} else {
@ -273,11 +273,11 @@
}
return _effective_height;
}
}
void
TimeAxisView::clip_to_viewport ()
{
void
TimeAxisView::clip_to_viewport ()
{
if (_marked_for_display) {
if (_y_position + _effective_height < _editor.get_trackview_group_vertical_offset () || _y_position > _editor.get_trackview_group_vertical_offset () + _canvas_display->get_canvas()->get_height()) {
_canvas_background->hide ();
@ -288,11 +288,11 @@
_canvas_display->show ();
}
return;
}
}
bool
TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
{
bool
TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
{
switch (ev->direction) {
case GDK_SCROLL_UP:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
@ -320,11 +320,11 @@
}
return false;
}
}
bool
TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
{
bool
TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
{
switch (ev->button) {
case 1:
selection_click (ev);
@ -336,18 +336,18 @@
}
return true;
}
}
void
TimeAxisView::selection_click (GdkEventButton* ev)
{
void
TimeAxisView::selection_click (GdkEventButton* ev)
{
Selection::Operation op = Keyboard::selection_type (ev->state);
_editor.set_selected_track (*this, op, false);
}
}
void
TimeAxisView::hide ()
{
void
TimeAxisView::hide ()
{
if (_hidden) {
return;
}
@ -375,11 +375,11 @@
_editor.get_selection().remove (this);
Hiding ();
}
}
void
TimeAxisView::step_height (bool bigger)
{
void
TimeAxisView::step_height (bool bigger)
{
static const uint32_t step = 20;
if (bigger) {
@ -391,21 +391,21 @@
set_height (hSmall);
}
}
}
}
void
TimeAxisView::set_heights (uint32_t h)
{
void
TimeAxisView::set_heights (uint32_t h)
{
TrackSelection& ts (_editor.get_selection().tracks);
for (TrackSelection::iterator i = ts.begin(); i != ts.end(); ++i) {
(*i)->set_height (h);
}
}
}
void
TimeAxisView::set_height(uint32_t h)
{
void
TimeAxisView::set_height(uint32_t h)
{
controls_ebox.property_height_request () = h;
height = h;
@ -419,11 +419,11 @@
}
reshow_feature_lines ();
}
}
bool
TimeAxisView::name_entry_key_release (GdkEventKey* ev)
{
bool
TimeAxisView::name_entry_key_release (GdkEventKey* ev)
{
PublicEditor::TrackViewList *allviews = 0;
PublicEditor::TrackViewList::iterator i;
@ -478,7 +478,7 @@
break;
}
#ifdef TIMEOUT_NAME_EDIT
#ifdef TIMEOUT_NAME_EDIT
/* adapt the timeout to reflect the user's typing speed */
guint32 name_entry_timeout;
@ -497,22 +497,22 @@
name_entry_key_timeout.disconnect();
name_entry_key_timeout = Glib::signal_timeout().connect (mem_fun (*this, &TimeAxisView::name_entry_key_timed_out), name_entry_timeout);
#endif
#endif
return false;
}
}
bool
TimeAxisView::name_entry_focus_in (GdkEventFocus* ev)
{
bool
TimeAxisView::name_entry_focus_in (GdkEventFocus* ev)
{
name_entry.select_region (0, -1);
name_entry.set_name ("EditorActiveTrackNameDisplay");
return false;
}
}
bool
TimeAxisView::name_entry_focus_out (GdkEventFocus* ev)
{
bool
TimeAxisView::name_entry_focus_out (GdkEventFocus* ev)
{
/* clean up */
last_name_entry_key_press_event = 0;
@ -525,86 +525,86 @@
name_entry_changed ();
return false;
}
}
bool
TimeAxisView::name_entry_key_timed_out ()
{
bool
TimeAxisView::name_entry_key_timed_out ()
{
name_entry_activated();
return false;
}
}
void
TimeAxisView::name_entry_activated ()
{
void
TimeAxisView::name_entry_activated ()
{
controls_ebox.grab_focus();
}
}
void
TimeAxisView::name_entry_changed ()
{
}
void
TimeAxisView::name_entry_changed ()
{
}
bool
TimeAxisView::name_entry_button_press (GdkEventButton *ev)
{
bool
TimeAxisView::name_entry_button_press (GdkEventButton *ev)
{
if (ev->button == 3) {
return true;
}
return false;
}
}
bool
TimeAxisView::name_entry_button_release (GdkEventButton *ev)
{
bool
TimeAxisView::name_entry_button_release (GdkEventButton *ev)
{
if (ev->button == 3) {
popup_display_menu (ev->time);
return true;
}
return false;
}
}
void
TimeAxisView::conditionally_add_to_selection ()
{
void
TimeAxisView::conditionally_add_to_selection ()
{
Selection& s (_editor.get_selection ());
if (!s.selected (this)) {
_editor.set_selected_track (*this, Selection::Set);
}
}
}
void
TimeAxisView::popup_display_menu (guint32 when)
{
void
TimeAxisView::popup_display_menu (guint32 when)
{
if (display_menu == 0) {
build_display_menu ();
}
conditionally_add_to_selection ();
display_menu->popup (1, when);
}
}
gint
TimeAxisView::size_click (GdkEventButton *ev)
{
gint
TimeAxisView::size_click (GdkEventButton *ev)
{
conditionally_add_to_selection ();
popup_size_menu (ev->time);
return TRUE;
}
}
void
TimeAxisView::popup_size_menu (guint32 when)
{
void
TimeAxisView::popup_size_menu (guint32 when)
{
if (size_menu == 0) {
build_size_menu ();
}
size_menu->popup (1, when);
}
}
void
TimeAxisView::set_selected (bool yn)
{
void
TimeAxisView::set_selected (bool yn)
{
if (yn == _selected) {
return;
}
@ -638,11 +638,11 @@
}
resizer.queue_draw ();
}
}
void
TimeAxisView::build_size_menu ()
{
void
TimeAxisView::build_size_menu ()
{
using namespace Menu_Helpers;
size_menu = new Menu;
@ -655,22 +655,22 @@
items.push_back (MenuElem (_("Normal"), bind (mem_fun (*this, &TimeAxisView::set_heights), hNormal)));
items.push_back (MenuElem (_("Smaller"), bind (mem_fun (*this, &TimeAxisView::set_heights),hSmaller)));
items.push_back (MenuElem (_("Small"), bind (mem_fun (*this, &TimeAxisView::set_heights), hSmall)));
}
}
void
TimeAxisView::build_display_menu ()
{
void
TimeAxisView::build_display_menu ()
{
using namespace Menu_Helpers;
display_menu = new Menu;
display_menu->set_name ("ArdourContextMenu");
// Just let implementing classes define what goes into the manu
}
}
void
TimeAxisView::set_samples_per_unit (double spu)
{
void
TimeAxisView::set_samples_per_unit (double spu)
{
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->set_samples_per_unit (spu);
}
@ -682,27 +682,27 @@
(*l)->property_x1() = _editor.frame_to_pixel (*i);
(*l)->property_x2() = _editor.frame_to_pixel (*i);
}
}
}
void
TimeAxisView::show_timestretch (nframes_t start, nframes_t end)
{
void
TimeAxisView::show_timestretch (nframes_t start, nframes_t end)
{
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->show_timestretch (start, end);
}
}
}
void
TimeAxisView::hide_timestretch ()
{
void
TimeAxisView::hide_timestretch ()
{
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->hide_timestretch ();
}
}
}
void
TimeAxisView::show_selection (TimeSelection& ts)
{
void
TimeAxisView::show_selection (TimeSelection& ts)
{
double x1;
double x2;
double y2;
@ -767,21 +767,21 @@
rect->rect->show ();
used_selection_rects.push_back (rect);
}
}
}
void
TimeAxisView::reshow_selection (TimeSelection& ts)
{
void
TimeAxisView::reshow_selection (TimeSelection& ts)
{
show_selection (ts);
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->show_selection (ts);
}
}
}
void
TimeAxisView::hide_selection ()
{
void
TimeAxisView::hide_selection ()
{
if (canvas_item_visible (selection_group)) {
while (!used_selection_rects.empty()) {
free_selection_rects.push_front (used_selection_rects.front());
@ -796,11 +796,11 @@
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->hide_selection ();
}
}
}
void
TimeAxisView::order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top)
{
void
TimeAxisView::order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top)
{
/* find the selection rect this is for. we have the item corresponding to one
of the trim handles.
*/
@ -819,11 +819,11 @@
break;
}
}
}
}
SelectionRect *
TimeAxisView::get_selection_rect (uint32_t id)
{
SelectionRect *
TimeAxisView::get_selection_rect (uint32_t id)
{
SelectionRect *rect;
/* check to see if we already have a visible rect for this particular selection ID */
@ -881,56 +881,57 @@
rect->id = id;
free_selection_rects.pop_front();
return rect;
}
}
struct null_deleter { void operator()(void const *) const {} };
struct null_deleter { void operator()(void const *) const {} };
bool
TimeAxisView::is_child (TimeAxisView* tav)
{
bool
TimeAxisView::is_child (TimeAxisView* tav)
{
return find (children.begin(), children.end(), boost::shared_ptr<TimeAxisView>(tav, null_deleter())) != children.end();
}
}
void
TimeAxisView::add_child (boost::shared_ptr<TimeAxisView> child)
{
void
TimeAxisView::add_child (boost::shared_ptr<TimeAxisView> child)
{
children.push_back (child);
}
}
void
TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
{
void
TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
{
Children::iterator i;
if ((i = find (children.begin(), children.end(), child)) != children.end()) {
children.erase (i);
}
}
}
void
TimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& result)
{
void
TimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& result)
{
return;
}
}
void
TimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& result)
{
void
TimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& result)
{
return;
}
}
void
TimeAxisView::add_ghost (RegionView* rv) {
void
TimeAxisView::add_ghost (RegionView* rv)
{
GhostRegion* gr = rv->add_ghost (*this);
if(gr) {
ghosts.push_back(gr);
gr->GoingAway.connect (mem_fun(*this, &TimeAxisView::erase_ghost));
}
}
}
void
TimeAxisView::remove_ghost (RegionView* rv) {
void
TimeAxisView::remove_ghost (RegionView* rv) {
rv->remove_ghost_in (*this);
}