fix horrendous indentation. Doesn't anybody have any standards around here?

This commit is contained in:
Paul Davis 2014-12-16 12:29:32 -05:00
parent 3a5e349c9c
commit e95d95c19e

View file

@ -1,19 +1,19 @@
/*
Copyright (C) 2001 Paul Davis
Copyright (C) 2001 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
@ -92,13 +92,13 @@ RangeMarker::RangeMarker (ARDOUR::Location* l, PublicEditor& editor, ArdourCanva
: Marker (l, editor, parent, height, rgba, text, Range, start, true)
, _end_frame (end)
, _end_line (0)
, _start_handler (0)
, _end_handler (0)
, _start_handler (0)
, _end_handler (0)
{
assert (start < end);
/* Marker::Marker calls these but will not have used our versions since it is a constructor.
*/
*/
set_position (start, end);
setup_line ();
@ -206,29 +206,29 @@ RangeMarker::_set_position (framepos_t start, framepos_t end)
void
RangeMarker::setup_line ()
{
Marker::setup_line ();
Marker::setup_line ();
if (!_end_line) {
if (!_end_line) {
_end_line = new ArdourCanvas::Line (editor.get_hscroll_group());
_end_line->set_ignore_events (true);
_end_line->set_y1 (ArdourCanvas::COORD_MAX);
}
}
/* line at the end (the start line is handled by Marker */
/* line at the end (the start line is handled by Marker */
/* lines in a different canvas (scroll)group so we have to convert the position
into a different coordinate system.
*/
/* lines in a different canvas (scroll)group so we have to convert the position
into a different coordinate system.
*/
ArdourCanvas::Duple h = _name_background->item_to_canvas (ArdourCanvas::Duple (0.0, _height));
ArdourCanvas::Duple g = group->canvas_origin();
ArdourCanvas::Duple h = _name_background->item_to_canvas (ArdourCanvas::Duple (0.0, _height));
ArdourCanvas::Duple g = group->canvas_origin();
/* merge and adjust them */
/* merge and adjust them */
g.x += _name_background->x1();
g.y = h.y;
g.x += _name_background->x1();
g.y = h.y;
ArdourCanvas::Duple d = _end_line->canvas_to_item (g);
ArdourCanvas::Duple d = _end_line->canvas_to_item (g);
_end_line->set_y0 (d.y - 2.0); /* bottom of marker, in the right coordinate system */
_end_line->set_x0 (d.x - 1.0);
@ -270,16 +270,16 @@ RangeMarker::bounds_changed ()
void
RangeMarker::canvas_height_set (double h)
{
if (_end_line) {
/* h is already in the right coordinate system since it is an absolute height */
_end_line->set_y1 (h);
}
if (_end_line) {
/* h is already in the right coordinate system since it is an absolute height */
_end_line->set_y1 (h);
}
}
void
RangeMarker::setup_name_display ()
{
/* No need to adjust name background size here, since it is always the same */
/* No need to adjust name background size here, since it is always the same */
if (_name.empty()) {
if (_name_item) {
@ -304,24 +304,24 @@ Marker::Marker (ARDOUR::Location* l, PublicEditor& ed, ArdourCanvas::Container&
Type type, framepos_t start_pos, bool handle_events)
: editor (ed)
, _location (l)
, _location (l)
, _parent (&parent)
, group (0)
, mark (0)
, _name_item (0)
, group (0)
, mark (0)
, _name_item (0)
, _start_line (0)
, _scene_change_rect (0)
, _scene_change_text (0)
, _marker_lock_text (0)
, frame_position (start_pos)
, _scene_change_rect (0)
, _scene_change_text (0)
, _marker_lock_text (0)
, frame_position (start_pos)
, _type (type)
, _shown (false)
, _height (height)
, _height (height)
, _color (rgba)
, _left_label_limit (DBL_MAX)
, _right_label_limit (DBL_MAX)
, _label_offset (0)
, _have_scene_change (l ? l->scene_change() : false)
, _have_scene_change (l ? l->scene_change() : false)
{
unit_position = editor.sample_to_pixel (frame_position);
@ -334,7 +334,7 @@ Marker::Marker (ARDOUR::Location* l, PublicEditor& ed, ArdourCanvas::Container&
_name_background->set_y0 (0.0);
_name_background->set_y1 (_height - 1.0);
_label_offset = name_padding;
_label_offset = name_padding;
/* setup name pixbuf sizes */
name_font = Pango::FontDescription (ARDOUR_UI::config()->get_canvasvar_SmallBoldFont());
@ -354,25 +354,25 @@ Marker::Marker (ARDOUR::Location* l, PublicEditor& ed, ArdourCanvas::Container&
}
set_name (annotation);
setup_line ();
pick_basic_color (rgba);
use_color ();
setup_line ();
pick_basic_color (rgba);
use_color ();
if (_location) {
if (_location) {
/* Listen to region properties that we care about */
/* Listen to region properties that we care about */
_location->FlagsChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::flags_changed, this), gui_context());
_location->NameChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::name_changed, this), gui_context());
_location->StartChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::bounds_changed, this), gui_context());
_location->EndChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::bounds_changed, this), gui_context());
_location->Changed.connect (location_connections, invalidator(*this), boost::bind (&Marker::bounds_changed, this), gui_context());
_location->SceneChangeChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::scene_change_changed, this), gui_context());
_location->LockChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::setup_name_display, this), gui_context());
_location->FlagsChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::flags_changed, this), gui_context());
_location->NameChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::name_changed, this), gui_context());
_location->StartChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::bounds_changed, this), gui_context());
_location->EndChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::bounds_changed, this), gui_context());
_location->Changed.connect (location_connections, invalidator(*this), boost::bind (&Marker::bounds_changed, this), gui_context());
_location->SceneChangeChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::scene_change_changed, this), gui_context());
_location->LockChanged.connect (location_connections, invalidator(*this), boost::bind (&Marker::setup_name_display, this), gui_context());
/* connect to scene change active signal if there is a scene change */
connect_to_scene_change_signals ();
}
/* connect to scene change active signal if there is a scene change */
connect_to_scene_change_signals ();
}
}
Marker::~Marker ()
@ -575,12 +575,12 @@ Marker::setup_name_display ()
{
double limit = _left_label_limit;
_label_offset = name_padding;
_label_offset = name_padding;
if (_name.empty()) {
if (_name_item) {
_name_item->hide ();
_name_item->hide ();
}
_name_background->set_x0 (0);
@ -597,84 +597,84 @@ Marker::setup_name_display ()
#ifdef __APPLE__
int font_width_compensation = 4;
#else
int font_width_compensation = 0;
int font_width_compensation = 0;
#endif // __APPLE__
if (!_name_item) {
_name_item = new ArdourCanvas::Text (group);
CANVAS_DEBUG_NAME (_name_item, string_compose ("Marker::_name_item for %1", _name));
_name_item->set_font_description (name_font);
_name_item->set_color (ArdourCanvas::contrasting_text_color (_color));
_name_item = new ArdourCanvas::Text (group);
CANVAS_DEBUG_NAME (_name_item, string_compose ("Marker::_name_item for %1", _name));
_name_item->set_font_description (name_font);
_name_item->set_color (ArdourCanvas::contrasting_text_color (_color));
}
if (!_marker_lock_text) {
_marker_lock_text = new ArdourCanvas::Text (group);
CANVAS_DEBUG_NAME (_marker_lock_text, string_compose ("Marker::_marker_lock_text for %1", _name));
_marker_lock_text->set_font_description (name_font);
_marker_lock_text->set_color (ArdourCanvas::contrasting_text_color (_color));
_marker_lock_text->set (X_("Locked"));
_marker_lock_text = new ArdourCanvas::Text (group);
CANVAS_DEBUG_NAME (_marker_lock_text, string_compose ("Marker::_marker_lock_text for %1", _name));
_marker_lock_text->set_font_description (name_font);
_marker_lock_text->set_color (ArdourCanvas::contrasting_text_color (_color));
_marker_lock_text->set (X_("Locked"));
}
int marker_lock_text_width = 0;
if (_location && _location->locked() ) {
int lock_height;
int lock_width;
int lock_height;
int lock_width;
_marker_lock_text->set_position (ArdourCanvas::Duple (2.0, (_height / 2.0) - (name_height / 2.0) - 1.0));
_marker_lock_text->show();
_marker_lock_text->set_position (ArdourCanvas::Duple (2.0, (_height / 2.0) - (name_height / 2.0) - 1.0));
_marker_lock_text->show();
pixel_size (X_("Locked"), name_font, lock_width, lock_height);
marker_lock_text_width = _marker_lock_text->position().x + lock_width + font_width_compensation;
pixel_size (X_("Locked"), name_font, lock_width, lock_height);
marker_lock_text_width = _marker_lock_text->position().x + lock_width + font_width_compensation;
_label_offset = name_padding + marker_lock_text_width;
_label_offset = name_padding + marker_lock_text_width;
} else {
_marker_lock_text->hide();
_marker_lock_text->hide();
}
if (_have_scene_change && _location && _location->scene_change()->active()) {
/* coordinates of rect that will surround "MIDI" */
ArdourCanvas::Rect r;
int midi_height;
int midi_width;
ArdourCanvas::Rect r;
int midi_height;
int midi_width;
pixel_size (X_("MIDI"), name_font, midi_width, midi_height);
pixel_size (X_("MIDI"), name_font, midi_width, midi_height);
r.x0 = marker_lock_text_width + 2.0;
r.x1 = r.x0 + midi_width + font_width_compensation + 3.0; // 3 pixels after signlar
r.x0 = marker_lock_text_width + 2.0;
r.x1 = r.x0 + midi_width + font_width_compensation + 3.0; // 3 pixels after signlar
if (_scene_change_text == 0) {
_scene_change_rect = new ArdourCanvas::Rectangle (group);
_scene_change_text = new ArdourCanvas::Text (group);
if (_scene_change_text == 0) {
_scene_change_rect = new ArdourCanvas::Rectangle (group);
_scene_change_text = new ArdourCanvas::Text (group);
_scene_change_rect->set_fill (false);
_scene_change_text->set_font_description (name_font);
_scene_change_text->set (X_("MIDI"));
}
_scene_change_rect->set_fill (false);
_scene_change_text->set_font_description (name_font);
_scene_change_text->set (X_("MIDI"));
}
/* move name label over */
_label_offset = name_padding + r.x1;
/* move name label over */
_label_offset = name_padding + r.x1;
/**/
/**/
/* 4 pixels left margin, place it in the vertical middle, plus or minus
*/
_scene_change_text->set_position (ArdourCanvas::Duple (r.x0 + 2.0, (_height / 2.0) - (name_height / 2.0) - 1.0));
/* 4 pixels left margin, place it in the vertical middle, plus or minus
*/
_scene_change_text->set_position (ArdourCanvas::Duple (r.x0 + 2.0, (_height / 2.0) - (name_height / 2.0) - 1.0));
r.y0 = _scene_change_text->position().y - 2.0;
r.y1 = r.y0 + name_height + 4.0;
r.y0 = _scene_change_text->position().y - 2.0;
r.y1 = r.y0 + name_height + 4.0;
_scene_change_rect->set (r);
scene_change_width = r.x1 - r.x0;
_scene_change_rect->set (r);
scene_change_width = r.x1 - r.x0;
} else {
if (_scene_change_text) {
delete _scene_change_text;
delete _scene_change_rect;
_scene_change_text = 0;
_scene_change_rect = 0;
}
if (_scene_change_text) {
delete _scene_change_text;
delete _scene_change_rect;
_scene_change_text = 0;
_scene_change_rect = 0;
}
}
double name_text_width = pixel_width (_name, name_font) + font_width_compensation;
@ -685,7 +685,7 @@ Marker::setup_name_display ()
_name_item->clamp_width (name_width);
if (_name_item->text() != _name) {
_name_item->set (_name);
_name_item->set (_name);
}
_name_background->set_x0 (_name_item->position().x - _label_offset);
@ -729,7 +729,7 @@ Marker::hide ()
void
Marker::use_color ()
{
if (mark) {
if (mark) {
mark->set_fill_color (_color);
mark->set_outline_color (_color);
}
@ -766,7 +766,7 @@ Marker::use_color ()
_scene_change_text->set_color (contrast);
}
if (_marker_lock_text) {
_marker_lock_text->set_color (contrast);
_marker_lock_text->set_color (contrast);
}
}