'gtk2_ardour' - Add namespaces + casting where necessary + general bits of 'correctness' to keep MSVC happy

This commit is contained in:
John Emmas 2013-10-03 09:06:56 +01:00
parent d382925fba
commit f8574fc39d
17 changed files with 26 additions and 27 deletions

View File

@ -1128,7 +1128,7 @@ AudioClock::set_minsec (framepos_t when, bool /*force*/)
mins = (int) floor (left / (_session->frame_rate() * 60.0f)); mins = (int) floor (left / (_session->frame_rate() * 60.0f));
left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f); left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f);
secs = (int) floor (left / (float) _session->frame_rate()); secs = (int) floor (left / (float) _session->frame_rate());
left -= (framecnt_t) floor (secs * _session->frame_rate()); left -= (framecnt_t) floor ((double)(secs * _session->frame_rate()));
millisecs = floor (left * 1000.0 / (float) _session->frame_rate()); millisecs = floor (left * 1000.0 / (float) _session->frame_rate());
if (negative) { if (negative) {

View File

@ -652,7 +652,7 @@ Editor::start_canvas_autoscroll (int dx, int dy)
autoscroll_x = dx; autoscroll_x = dx;
autoscroll_y = dy; autoscroll_y = dy;
autoscroll_x_distance = (framepos_t) floor (current_page_samples()/50.0); autoscroll_x_distance = (framepos_t) floor (current_page_samples()/50.0);
autoscroll_y_distance = fabs (dy * 5); /* pixels */ autoscroll_y_distance = fabs ((double)dy * 5); /* pixels */
autoscroll_cnt = 0; autoscroll_cnt = 0;
/* do it right now, which will start the repeated callbacks */ /* do it right now, which will start the repeated callbacks */

View File

@ -1498,7 +1498,7 @@ RegionCreateDrag::motion (GdkEvent* event, bool first_move)
place snapped notes at the start of the region. place snapped notes at the start of the region.
*/ */
framecnt_t const len = (framecnt_t) fabs (f - grab_frame () - 1); framecnt_t const len = (framecnt_t) fabs ((double)(f - grab_frame () - 1));
_region->set_length (len < 1 ? 1 : len); _region->set_length (len < 1 ? 1 : len);
} }
} }
@ -4357,7 +4357,7 @@ NoteDrag::motion (GdkEvent *, bool)
uint8_t new_note = min (max (_primary->note()->note() + note_delta, 0), 127); uint8_t new_note = min (max (_primary->note()->note() + note_delta, 0), 127);
snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (new_note).c_str(), snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (new_note).c_str(),
(int) floor (new_note)); (int) floor ((double)new_note));
show_verbose_cursor_text (buf); show_verbose_cursor_text (buf);
} }
@ -4861,7 +4861,7 @@ NoteCreateDrag::finished (GdkEvent*, bool had_movement)
} }
framepos_t const start = min (_note[0], _note[1]); framepos_t const start = min (_note[0], _note[1]);
framecnt_t length = (framecnt_t) fabs (_note[0] - _note[1]); framecnt_t length = (framecnt_t) fabs ((double)(_note[0] - _note[1]));
framecnt_t const g = grid_frames (start); framecnt_t const g = grid_frames (start);
double const one_tick = 1 / Timecode::BBT_Time::ticks_per_beat; double const one_tick = 1 / Timecode::BBT_Time::ticks_per_beat;

View File

@ -3473,7 +3473,7 @@ Editor::freeze_route ()
/* wait for just a little while, because the above call is asynchronous */ /* wait for just a little while, because the above call is asynchronous */
::usleep (250000); Glib::usleep (250000);
if (clicked_routeview == 0 || !clicked_routeview->is_audio_track()) { if (clicked_routeview == 0 || !clicked_routeview->is_audio_track()) {
return; return;

View File

@ -50,7 +50,7 @@ ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, Profi
option_hbox.pack_start (time_format_label, false, false, 0); option_hbox.pack_start (time_format_label, false, false, 0);
option_hbox.pack_start (time_format_combo, false, false, 6); option_hbox.pack_start (time_format_combo, false, false, 6);
Gtk::Button* b = manage (new Gtk::Button (_("Select All"))); Gtk::Button* b = Gtk::manage (new Gtk::Button (_("Select All")));
b->signal_clicked().connect ( b->signal_clicked().connect (
sigc::bind ( sigc::bind (
sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), true sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), true
@ -58,7 +58,7 @@ ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, Profi
); );
option_hbox.pack_start (*b, false, false, 6); option_hbox.pack_start (*b, false, false, 6);
b = manage (new Gtk::Button (_("Deselect All"))); b = Gtk::manage (new Gtk::Button (_("Deselect All")));
b->signal_clicked().connect ( b->signal_clicked().connect (
sigc::bind ( sigc::bind (
sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), false sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), false
@ -305,7 +305,7 @@ ExportTimespanSelector::ms_str (framecnt_t frames) const
mins = (int) floor (left / (_session->frame_rate() * 60.0f)); mins = (int) floor (left / (_session->frame_rate() * 60.0f));
left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f); left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f);
secs = (int) floor (left / (float) _session->frame_rate()); secs = (int) floor (left / (float) _session->frame_rate());
left -= (framecnt_t) floor (secs * _session->frame_rate()); left -= (framecnt_t) floor ((double)(secs * _session->frame_rate()));
sec_promilles = (int) (left * 1000 / (float) _session->frame_rate() + 0.5); sec_promilles = (int) (left * 1000 / (float) _session->frame_rate() + 0.5);
oss << std::setfill('0') << std::right << oss << std::setfill('0') << std::right <<

View File

@ -18,8 +18,8 @@
*/ */
#include <fft_result.h> #include "fft_result.h"
#include <fft_graph.h> #include "fft_graph.h"
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <string> #include <string>

View File

@ -198,9 +198,8 @@ gtk_custom_ruler_set_property (GObject *object,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
(void) pspec;
GtkCustomRuler *ruler = GTK_CUSTOM_RULER (object); GtkCustomRuler *ruler = GTK_CUSTOM_RULER (object);
(void) pspec;
switch (prop_id) switch (prop_id)
{ {

View File

@ -35,7 +35,7 @@ Hit::Hit (
bool with_events) bool with_events)
: NoteBase (region, with_events, note) : NoteBase (region, with_events, note)
{ {
_polygon = new Polygon (group); _polygon = new ArdourCanvas::Polygon (group);
set_item (_polygon); set_item (_polygon);
} }

View File

@ -3073,7 +3073,7 @@ MidiRegionView::nudge_notes (bool forward)
return; return;
} }
Evoral::MusicalTime delta = region_frames_to_region_beats (fabs (distance)); Evoral::MusicalTime delta = region_frames_to_region_beats (fabs ((double)distance));
if (!forward) { if (!forward) {
delta = -delta; delta = -delta;

View File

@ -215,7 +215,7 @@ MidiTracer::tracer (Parser&, byte* msg, size_t len)
s = snprintf (buf, bufsize, "+%02" PRId64 ":%06" PRId64, (int64_t) delta.tv_sec, (int64_t) delta.tv_usec); s = snprintf (buf, bufsize, "+%02" PRId64 ":%06" PRId64, (int64_t) delta.tv_sec, (int64_t) delta.tv_usec);
bufsize -= s; bufsize -= s;
} else { } else {
localtime_r (&tv.tv_sec, &now); localtime_r ((const time_t*)&tv.tv_sec, &now);
s = strftime (buf, bufsize, "%H:%M:%S", &now); s = strftime (buf, bufsize, "%H:%M:%S", &now);
bufsize -= s; bufsize -= s;
s += snprintf (&buf[s], bufsize, ".%06" PRId64, (int64_t) tv.tv_usec); s += snprintf (&buf[s], bufsize, ".%06" PRId64, (int64_t) tv.tv_usec);

View File

@ -35,7 +35,7 @@ Note::Note (
) )
: NoteBase (region, with_events, note) : NoteBase (region, with_events, note)
{ {
_rectangle = new Rectangle (group); _rectangle = new ArdourCanvas::Rectangle (group);
_rectangle->name = "note"; _rectangle->name = "note";
set_item (_rectangle); set_item (_rectangle);
} }

View File

@ -527,7 +527,7 @@ public:
_dpi_adjustment (50, 50, 250, 1, 10), _dpi_adjustment (50, 50, 250, 1, 10),
_dpi_slider (_dpi_adjustment) _dpi_slider (_dpi_adjustment)
{ {
_dpi_adjustment.set_value (floor (_rc_config->get_font_scale () / 1024)); _dpi_adjustment.set_value (floor ((double)(_rc_config->get_font_scale () / 1024)));
Label* l = manage (new Label (_("Font scaling:"))); Label* l = manage (new Label (_("Font scaling:")));
l->set_name ("OptionsLabel"); l->set_name ("OptionsLabel");
@ -546,7 +546,7 @@ public:
void parameter_changed (string const & p) void parameter_changed (string const & p)
{ {
if (p == "font-scale") { if (p == "font-scale") {
_dpi_adjustment.set_value (floor (_rc_config->get_font_scale() / 1024)); _dpi_adjustment.set_value (floor ((double)(_rc_config->get_font_scale() / 1024)));
} }
} }

View File

@ -49,7 +49,7 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session* s
_vbox.pack_start (_hbox, false, false, false); _vbox.pack_start (_hbox, false, false, false);
io = manage (new IOSelector (parent, session, r->output())); io = Gtk::manage (new IOSelector (parent, session, r->output()));
pack_start (_vbox, false, false); pack_start (_vbox, false, false);

View File

@ -57,7 +57,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session
// users (among others) // users (among others)
// _vbox.pack_start (_panners, false, false); // _vbox.pack_start (_panners, false, false);
io = manage (new IOSelector (parent, session, s->output())); io = Gtk::manage (new IOSelector (parent, session, s->output()));
pack_start (_vbox, false, false); pack_start (_vbox, false, false);

View File

@ -192,7 +192,7 @@ TranscodeFfmpeg::probe ()
h * 3600.0 h * 3600.0
+ m * 60.0 + m * 60.0
+ s * 1.0 + s * 1.0
+ atoi(f) / pow(10, strlen(f)) + atoi(f) / pow((double)10, (int)strlen(f))
)); ));
} }
} else if (key == X_("duration_ts") && m_fps == 0 && timebase !=0 ) { } else if (key == X_("duration_ts") && m_fps == 0 && timebase !=0 ) {
@ -543,7 +543,7 @@ TranscodeFfmpeg::ffmpegparse_a (std::string d, size_t /* s */)
h * 3600.0 h * 3600.0
+ m * 60.0 + m * 60.0
+ s * 1.0 + s * 1.0
+ atoi(f) / pow(10, strlen(f)) + atoi(f) / pow((double)10, (int)strlen(f))
)); ));
p = p * m_fps / 100.0; p = p * m_fps / 100.0;
if (p > m_duration ) { p = m_duration; } if (p > m_duration ) { p = m_duration; }

View File

@ -347,17 +347,17 @@ VideoTimeLine::update_video_timeline()
assert (vtl_dist > 0); assert (vtl_dist > 0);
assert (apv > 0); assert (apv > 0);
leftmost_video_frame = floor (floor((leftmost_sample - video_start_offset - video_offset ) / vtl_dist) * vtl_dist / apv); leftmost_video_frame = floor (floor((long double)(leftmost_sample - video_start_offset - video_offset ) / vtl_dist) * vtl_dist / apv);
vtl_start = rint (video_offset + video_start_offset + leftmost_video_frame * apv); vtl_start = rint (video_offset + video_start_offset + leftmost_video_frame * apv);
visible_video_frames = 2 + ceil(editor->current_page_samples() / vtl_dist); /* +2 left+right partial frames */ visible_video_frames = 2 + ceil((double)editor->current_page_samples() / vtl_dist); /* +2 left+right partial frames */
/* expand timeline (cache next/prev page images) */ /* expand timeline (cache next/prev page images) */
vtl_start -= visible_video_frames * vtl_dist; vtl_start -= visible_video_frames * vtl_dist;
visible_video_frames *=3; visible_video_frames *=3;
if (vtl_start < video_offset ) { if (vtl_start < video_offset ) {
visible_video_frames += ceil(vtl_start/vtl_dist); visible_video_frames += ceil((double)vtl_start/vtl_dist);
vtl_start = video_offset; vtl_start = video_offset;
} }

View File

@ -159,7 +159,7 @@ class ProxyWithConstructor: public ProxyBase {
return 0; return 0;
} }
_window = creator (); _window = dynamic_cast<Gtk::Window*> (creator ());
if (_window) { if (_window) {
setup (); setup ();