changes to get cairocanvas branch to build on OS X, with its stupid nil and Rect macros, plus some const_cast<> and unused variable fixes that should really be in master but will have to wait till we rebase master

This commit is contained in:
Paul Davis 2013-04-12 21:46:44 -04:00
parent b05968fb4e
commit 4e84bc3a39
10 changed files with 48 additions and 35 deletions

View file

@ -3334,7 +3334,7 @@ FeatureLineDrag::motion (GdkEvent*, bool)
cx = 0; cx = 0;
} }
boost::optional<Rect> bbox = _line->bounding_box (); boost::optional<ArdourCanvas::Rect> bbox = _line->bounding_box ();
assert (bbox); assert (bbox);
_line->set (ArdourCanvas::Duple (cx, 2.0), ArdourCanvas::Duple (cx, bbox.get().height ())); _line->set (ArdourCanvas::Duple (cx, 2.0), ArdourCanvas::Duple (cx, bbox.get().height ()));

View file

@ -244,7 +244,7 @@ bind_key(PianoKeyboard *pk, const char *key, int note)
{ {
assert(pk->key_bindings != NULL); assert(pk->key_bindings != NULL);
g_hash_table_insert(pk->key_bindings, (gpointer)key, (gpointer)((intptr_t)note)); g_hash_table_insert(pk->key_bindings, key, (gpointer)((intptr_t)note));
} }
static void static void
@ -360,6 +360,8 @@ keyboard_event_handler(GtkWidget *mk, GdkEventKey *event, gpointer ignored)
GdkKeymapKey kk; GdkKeymapKey kk;
PianoKeyboard *pk = PIANO_KEYBOARD(mk); PianoKeyboard *pk = PIANO_KEYBOARD(mk);
(void) ignored;
/* We're not using event->keyval, because we need keyval with level set to 0. /* We're not using event->keyval, because we need keyval with level set to 0.
E.g. if user holds Shift and presses '7', we want to get a '7', not '&'. */ E.g. if user holds Shift and presses '7', we want to get a '7', not '&'. */
kk.keycode = event->hardware_keycode; kk.keycode = event->hardware_keycode;
@ -440,6 +442,8 @@ mouse_button_event_handler(PianoKeyboard *pk, GdkEventButton *event, gpointer ig
int note = get_note_for_xy(pk, x, y); int note = get_note_for_xy(pk, x, y);
(void) ignored;
if (event->button != 1) if (event->button != 1)
return TRUE; return TRUE;
@ -477,6 +481,8 @@ mouse_motion_event_handler(PianoKeyboard *pk, GdkEventMotion *event, gpointer ig
{ {
int note; int note;
(void) ignored;
if ((event->state & GDK_BUTTON1_MASK) == 0) if ((event->state & GDK_BUTTON1_MASK) == 0)
return TRUE; return TRUE;
@ -529,6 +535,8 @@ piano_keyboard_expose(GtkWidget *widget, GdkEventExpose *event)
static void static void
piano_keyboard_size_request(GtkWidget* w, GtkRequisition *requisition) piano_keyboard_size_request(GtkWidget* w, GtkRequisition *requisition)
{ {
(void) w;
requisition->width = PIANO_KEYBOARD_DEFAULT_WIDTH; requisition->width = PIANO_KEYBOARD_DEFAULT_WIDTH;
requisition->height = PIANO_KEYBOARD_DEFAULT_HEIGHT; requisition->height = PIANO_KEYBOARD_DEFAULT_HEIGHT;
} }

View file

@ -48,7 +48,7 @@ Hit::move_event (double dx, double dy)
Coord Coord
Hit::x0 () const Hit::x0 () const
{ {
boost::optional<Rect> bbox = _polygon->bounding_box (); boost::optional<ArdourCanvas::Rect> bbox = _polygon->bounding_box ();
assert (bbox); assert (bbox);
return bbox.get().x0; return bbox.get().x0;
} }
@ -56,7 +56,7 @@ Hit::x0 () const
Coord Coord
Hit::x1 () const Hit::x1 () const
{ {
boost::optional<Rect> bbox = _polygon->bounding_box (); boost::optional<ArdourCanvas::Rect> bbox = _polygon->bounding_box ();
assert (bbox); assert (bbox);
return bbox.get().x1; return bbox.get().x1;
} }
@ -64,7 +64,7 @@ Hit::x1 () const
Coord Coord
Hit::y0 () const Hit::y0 () const
{ {
boost::optional<Rect> bbox = _polygon->bounding_box (); boost::optional<ArdourCanvas::Rect> bbox = _polygon->bounding_box ();
assert (bbox); assert (bbox);
return bbox.get().y0; return bbox.get().y0;
} }
@ -72,7 +72,7 @@ Hit::y0 () const
Coord Coord
Hit::y1 () const Hit::y1 () const
{ {
boost::optional<Rect> bbox = _polygon->bounding_box (); boost::optional<ArdourCanvas::Rect> bbox = _polygon->bounding_box ();
assert (bbox); assert (bbox);
return bbox.get().y1; return bbox.get().y1;
} }

View file

@ -362,9 +362,9 @@ MidiTracer::tracer (Parser&, byte* msg, size_t len)
fifo.write (&buf, 1); fifo.write (&buf, 1);
if (g_atomic_int_get (&_update_queued) == 0) { if (g_atomic_int_get (const_cast<gint*>(&_update_queued)) == 0) {
gui_context()->call_slot (invalidator (*this), boost::bind (&MidiTracer::update, this)); gui_context()->call_slot (invalidator (*this), boost::bind (&MidiTracer::update, this));
g_atomic_int_inc (&_update_queued); g_atomic_int_inc (const_cast<gint*>(&_update_queued));
} }
} }
@ -372,7 +372,7 @@ void
MidiTracer::update () MidiTracer::update ()
{ {
bool updated = false; bool updated = false;
g_atomic_int_dec_and_test (&_update_queued); g_atomic_int_dec_and_test (const_cast<gint*>(&_update_queued));
RefPtr<TextBuffer> buf (text.get_buffer()); RefPtr<TextBuffer> buf (text.get_buffer());

View file

@ -279,7 +279,7 @@ NoteBase::set_mouse_fractions (GdkEvent* ev)
return; return;
} }
boost::optional<Rect> bbox = _item->bounding_box (); boost::optional<ArdourCanvas::Rect> bbox = _item->bounding_box ();
assert (bbox); assert (bbox);
_item->canvas_to_item (ix, iy); _item->canvas_to_item (ix, iy);

View file

@ -232,7 +232,7 @@ Graph::trigger (GraphNode* n)
void void
Graph::dec_ref() Graph::dec_ref()
{ {
if (g_atomic_int_dec_and_test (&_finished_refcount)) { if (g_atomic_int_dec_and_test (const_cast<gint*> (&_finished_refcount))) {
/* We have run all the nodes that are at the `output' end of /* We have run all the nodes that are at the `output' end of
the graph, so there is nothing more to do this time around. the graph, so there is nothing more to do this time around.

View file

@ -588,7 +588,7 @@ LTC_Slave::approximate_current_delta() const
if (last_timestamp == 0 || engine_dll_initstate == 0) { if (last_timestamp == 0 || engine_dll_initstate == 0) {
snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012"); snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012");
} else if ((monotonic_cnt - last_timestamp) > 2 * frames_per_ltc_frame) { } else if ((monotonic_cnt - last_timestamp) > 2 * frames_per_ltc_frame) {
snprintf(delta, sizeof(delta), _("flywheel")); snprintf(delta, sizeof(delta), "%s", _("flywheel"));
} else { } else {
snprintf(delta, sizeof(delta), "\u0394<span foreground=\"green\" face=\"monospace\" >%s%s%" PRIi64 "</span>sm", snprintf(delta, sizeof(delta), "\u0394<span foreground=\"green\" face=\"monospace\" >%s%s%" PRIi64 "</span>sm",
LEADINGZERO(abs(current_delta)), PLUSMINUS(-current_delta), abs(current_delta)); LEADINGZERO(abs(current_delta)), PLUSMINUS(-current_delta), abs(current_delta));

View file

@ -202,8 +202,8 @@ MidiDiskstream::non_realtime_input_change ()
seek (_session.transport_frame()); seek (_session.transport_frame());
} }
g_atomic_int_set(&_frames_pending_write, 0); g_atomic_int_set(const_cast<gint*>(&_frames_pending_write), 0);
g_atomic_int_set(&_num_captured_loops, 0); g_atomic_int_set(const_cast<gint*>(&_num_captured_loops), 0);
} }
int int
@ -376,8 +376,8 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t
} }
_write_source->mark_write_starting_now( _write_source->mark_write_starting_now(
capture_start_frame, capture_captured, loop_length); capture_start_frame, capture_captured, loop_length);
g_atomic_int_set(&_frames_pending_write, 0); g_atomic_int_set(const_cast<gint*>(&_frames_pending_write), 0);
g_atomic_int_set(&_num_captured_loops, 0); g_atomic_int_set(const_cast<gint*>(&_num_captured_loops), 0);
was_recording = true; was_recording = true;
} }
} }
@ -446,7 +446,7 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t
break; break;
} }
} }
g_atomic_int_add(&_frames_pending_write, nframes); g_atomic_int_add(const_cast<gint*>(&_frames_pending_write), nframes);
if (buf.size() != 0) { if (buf.size() != 0) {
Glib::Threads::Mutex::Lock lm (_gui_feed_buffer_mutex, Glib::Threads::TRY_LOCK); Glib::Threads::Mutex::Lock lm (_gui_feed_buffer_mutex, Glib::Threads::TRY_LOCK);
@ -785,7 +785,7 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush)
return 0; return 0;
} }
const framecnt_t total = g_atomic_int_get(&_frames_pending_write); const framecnt_t total = g_atomic_int_get(const_cast<gint*>(&_frames_pending_write));
if (total == 0 || if (total == 0 ||
_capture_buf->read_space() == 0 || _capture_buf->read_space() == 0 ||
@ -794,7 +794,7 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush)
} }
/* if there are 2+ chunks of disk i/o possible for /* if there are 2+ chunks of disk i/o possible for
this track, let the caller know so that it can arrange this track), let the caller know so that it can arrange
for us to be called again, ASAP. for us to be called again, ASAP.
if we are forcing a flush, then if there is* any* extra if we are forcing a flush, then if there is* any* extra
@ -820,7 +820,7 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush)
error << string_compose(_("MidiDiskstream %1: cannot write to disk"), id()) << endmsg; error << string_compose(_("MidiDiskstream %1: cannot write to disk"), id()) << endmsg;
return -1; return -1;
} }
g_atomic_int_add(&_frames_pending_write, -to_write); g_atomic_int_add(const_cast<gint*>(&_frames_pending_write), -to_write);
} }
out: out:
@ -1030,7 +1030,7 @@ MidiDiskstream::transport_looped (framepos_t)
the Source and/or entirely after the capture is finished. the Source and/or entirely after the capture is finished.
*/ */
if (was_recording) { if (was_recording) {
g_atomic_int_add(&_num_captured_loops, 1); g_atomic_int_add(const_cast<gint*>(&_num_captured_loops), 1);
} }
} }

View file

@ -61,8 +61,8 @@ Item::~Item ()
} }
} }
Rect ArdourCanvas::Rect
Item::item_to_parent (Rect const & r) const Item::item_to_parent (ArdourCanvas::Rect const & r) const
{ {
return r.translate (_position); return r.translate (_position);
} }
@ -71,8 +71,8 @@ Item::item_to_parent (Rect const & r) const
void void
Item::set_position (Duple p) Item::set_position (Duple p)
{ {
boost::optional<Rect> bbox = bounding_box (); boost::optional<ArdourCanvas::Rect> bbox = bounding_box ();
boost::optional<Rect> pre_change_parent_bounding_box; boost::optional<ArdourCanvas::Rect> pre_change_parent_bounding_box;
if (bbox) { if (bbox) {
pre_change_parent_bounding_box = item_to_parent (bbox.get()); pre_change_parent_bounding_box = item_to_parent (bbox.get());
@ -146,8 +146,8 @@ Item::parent_to_item (Duple const & d) const
return d.translate (- _position); return d.translate (- _position);
} }
Rect ArdourCanvas::Rect
Item::parent_to_item (Rect const & d) const Item::parent_to_item (ArdourCanvas::Rect const & d) const
{ {
return d.translate (- _position); return d.translate (- _position);
} }
@ -180,7 +180,7 @@ Item::grab_focus ()
} }
/** @return Bounding box in this item's coordinates */ /** @return Bounding box in this item's coordinates */
boost::optional<Rect> boost::optional<ArdourCanvas::Rect>
Item::bounding_box () const Item::bounding_box () const
{ {
if (_bounding_box_dirty) { if (_bounding_box_dirty) {
@ -194,7 +194,7 @@ Item::bounding_box () const
Coord Coord
Item::height () const Item::height () const
{ {
boost::optional<Rect> bb = bounding_box(); boost::optional<ArdourCanvas::Rect> bb = bounding_box();
if (bb) { if (bb) {
return bb->height (); return bb->height ();
@ -205,7 +205,7 @@ Item::height () const
Coord Coord
Item::width () const Item::width () const
{ {
boost::optional<Rect> bb = bounding_box().get(); boost::optional<ArdourCanvas::Rect> bb = bounding_box().get();
if (bb) { if (bb) {
return bb->width (); return bb->width ();
@ -314,10 +314,10 @@ Item::canvas_to_item (Coord& x, Coord& y) const
y = d.y; y = d.y;
} }
Rect ArdourCanvas::Rect
Item::item_to_canvas (Rect const & area) const Item::item_to_canvas (ArdourCanvas::Rect const & area) const
{ {
Rect r = area; ArdourCanvas::Rect r = area;
Item const * i = this; Item const * i = this;
while (i) { while (i) {
@ -337,7 +337,7 @@ Item::set_ignore_events (bool ignore)
void void
Item::dump (ostream& o) const Item::dump (ostream& o) const
{ {
boost::optional<Rect> bb = bounding_box(); boost::optional<ArdourCanvas::Rect> bb = bounding_box();
o << _canvas->indent() << whatami() << ' ' << this; o << _canvas->indent() << whatami() << ' ' << this;

View file

@ -22,6 +22,11 @@
#include <list> #include <list>
#include <map> #include <map>
#ifdef nil
#undef nil
#endif
#include <glibmm/threads.h> #include <glibmm/threads.h>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>