diff --git a/libs/canvas/canvas/arc.h b/libs/canvas/canvas/arc.h index e262401c43..b2588bf2f7 100644 --- a/libs/canvas/canvas/arc.h +++ b/libs/canvas/canvas/arc.h @@ -19,10 +19,10 @@ #ifndef __CANVAS_ARC_H__ #define __CANVAS_ARC_H__ -#include "canvas/visibility.h" +#include "canvas/fill.h" #include "canvas/item.h" #include "canvas/outline.h" -#include "canvas/fill.h" +#include "canvas/visibility.h" namespace ArdourCanvas { @@ -37,12 +37,12 @@ public: void render (Rect const & area, Cairo::RefPtr) const; void compute_bounding_box () const; - void set_center (Duple const &); + void set_center (Duple const &); void set_radius (Coord); void set_arc (double degrees); void set_start (double degrees); - Duple center() const { + Duple center() const { return _center; } Coord radius () const { @@ -51,17 +51,17 @@ public: double arc_degrees () const { return _arc_degrees; } - double start_degrees () const { + double start_degrees () const { return _start_degrees; } - bool covers (Duple const &) const; + bool covers (Duple const &) const; private: - Duple _center; - Coord _radius; - double _arc_degrees; - double _start_degrees; + Duple _center; + Coord _radius; + double _arc_degrees; + double _start_degrees; }; } diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index 9babb27c4b..b7060e60c0 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -29,18 +29,19 @@ #include -#include -#include #include -#include +#include +#include + #include +#include #include "pbd/signals.h" #include "gtkmm2ext/cairo_canvas.h" -#include "canvas/visibility.h" #include "canvas/root_group.h" +#include "canvas/visibility.h" namespace Gtk { class Window; @@ -107,7 +108,7 @@ public: /** Called when an item is being destroyed */ virtual void item_going_away (Item *, Rect) {} virtual void item_shown_or_hidden (Item *); - void item_visual_property_changed (Item*); + void item_visual_property_changed (Item*); void item_changed (Item *, Rect); void item_moved (Item *, Rect); @@ -134,22 +135,22 @@ public: virtual Coord height () const = 0; /** Store the coordinates of the mouse pointer in window coordinates in - @param winpos. Return true if the position was within the window, - false otherwise. - */ + * @param winpos. Return true if the position was within the window, + * false otherwise. + */ virtual bool get_mouse_position (Duple& winpos) const = 0; /** Signal to be used by items that need to track the mouse position - within the window. - */ + * within the window. + */ sigc::signal MouseMotion; sigc::signal PreRender; /** Ensures that the position given by @param winpos (in window - coordinates) is within the current window area, possibly reduced by - @param border. - */ + * coordinates) is within the current window area, possibly reduced by + * @param border. + */ Duple clamp_to_window (Duple const& winpos, Duple border = Duple()); void zoomed(); @@ -159,15 +160,15 @@ public: void dump (std::ostream&) const; /** Ask the canvas to pick the current item again, and generate - an enter event for it. - */ + * an enter event for it. + */ virtual void re_enter () = 0; virtual void start_tooltip_timeout (Item*) {} virtual void stop_tooltip_timeout () {} /** Set the timeout used to display tooltips, in milliseconds - */ + */ static void set_tooltip_timeout (uint32_t msecs); virtual Glib::RefPtr get_pango_context() = 0; @@ -269,7 +270,7 @@ private: Item * _new_current_item; /** the item that is currently grabbed, or 0 */ Item * _grabbed_item; - /** the item that currently has key focus or 0 */ + /** the item that currently has key focus or 0 */ Item * _focused_item; bool _single_exposure; diff --git a/libs/canvas/canvas/interpolated_curve.h b/libs/canvas/canvas/interpolated_curve.h index bd3d8e5da0..2faf70dde6 100644 --- a/libs/canvas/canvas/interpolated_curve.h +++ b/libs/canvas/canvas/interpolated_curve.h @@ -19,18 +19,18 @@ #ifndef __CANVAS_INTERPOLATED_CURVE_H__ #define __CANVAS_INTERPOLATED_CURVE_H__ -#include "canvas/visibility.h" #include "canvas/types.h" +#include "canvas/visibility.h" namespace ArdourCanvas { class LIBCANVAS_API InterpolatedCurve { public: - enum SplineType { - CatmullRomUniform, - CatmullRomCentripetal, - }; + enum SplineType { + CatmullRomUniform, + CatmullRomCentripetal, + }; protected: @@ -51,7 +51,7 @@ protected: * points_per_segment is less than 2. */ static void - interpolate (const Points& coordinates, uint32_t points_per_segment, SplineType curve_type, bool closed, Points& results) + interpolate (const Points& coordinates, uint32_t points_per_segment, SplineType curve_type, bool closed, Points& results) { if (points_per_segment < 2) { return; @@ -150,7 +150,7 @@ private: * position between p1 and p2 to interpolate the value. */ static double - __interpolate (double p[4], double time[4], double t) + __interpolate (double p[4], double time[4], double t) { const double L01 = p[0] * (time[1] - t) / (time[1] - time[0]) + p[1] * (t - time[0]) / (time[1] - time[0]); const double L12 = p[1] * (time[2] - t) / (time[2] - time[1]) + p[2] * (t - time[1]) / (time[2] - time[1]); @@ -180,7 +180,7 @@ private: * between the points defined by index+1 and index+2. */ static void - _interpolate (const Points& points, Points::size_type index, int points_per_segment, SplineType curve_type, Points& results) + _interpolate (const Points& points, Points::size_type index, int points_per_segment, SplineType curve_type, Points& results) { double x[4]; double y[4]; diff --git a/libs/canvas/canvas/item.h b/libs/canvas/canvas/item.h index 7af9280e5c..e71419e30c 100644 --- a/libs/canvas/canvas/item.h +++ b/libs/canvas/canvas/item.h @@ -29,11 +29,11 @@ #include "pbd/signals.h" -#include "canvas/visibility.h" -#include "canvas/types.h" #include "canvas/fill.h" -#include "canvas/outline.h" #include "canvas/lookup_table.h" +#include "canvas/outline.h" +#include "canvas/types.h" +#include "canvas/visibility.h" namespace ArdourCanvas { @@ -61,7 +61,7 @@ public: Item (Item *, Duple const& p); virtual ~Item (); - void redraw () const; + void redraw () const; /** Render this item to a Cairo context. * @param area Area to draw, in **window** coordinates @@ -94,11 +94,11 @@ public: */ virtual void add_items_at_point (Duple /*point*/, std::vector& items) const; - /** Return true if the item covers @param point, false otherwise. - * - * The point is in window coordinates - */ - virtual bool covers (Duple const &) const; + /** Return true if the item covers @param point, false otherwise. + * + * The point is in window coordinates + */ + virtual bool covers (Duple const &) const; /** Update _bounding_box and _bounding_box_dirty */ virtual void compute_bounding_box () const = 0; @@ -114,20 +114,20 @@ public: return _parent; } - uint32_t depth() const; - const Item* closest_ancestor_with (const Item& other) const; - bool common_ancestor_within (uint32_t, const Item& other) const; + uint32_t depth() const; + const Item* closest_ancestor_with (const Item& other) const; + bool common_ancestor_within (uint32_t, const Item& other) const; - /** returns true if this item is an ancestor of @param candidate, + /** returns true if this item is an ancestor of @param candidate, * and false otherwise. */ - bool is_ancestor_of (const Item& candidate) const { + bool is_ancestor_of (const Item& candidate) const { return candidate.is_descendant_of (*this); } - /** returns true if this Item is a descendant of @param candidate, + /** returns true if this Item is a descendant of @param candidate, * and false otherwise. */ - bool is_descendant_of (const Item& candidate) const; + bool is_descendant_of (const Item& candidate) const; void set_position (Duple); void set_x_position (Coord); @@ -149,15 +149,15 @@ public: void size_allocate (Rect const&); /** bounding box is the public API to get the size of the item. - If @param for_own_purposes is false, then it will return the - allocated bounding box (if there is one) in preference to the - one that would naturally be computed by the item. - */ + * If @param for_own_purposes is false, then it will return the + * allocated bounding box (if there is one) in preference to the + * one that would naturally be computed by the item. + */ Rect bounding_box (bool for_own_purposes = false) const; Rect allocation() const { return _allocation; } - Coord height() const; - Coord width() const; + Coord height() const; + Coord width() const; Duple item_to_parent (Duple const &) const; Rect item_to_parent (Rect const &) const; @@ -165,27 +165,27 @@ public: Rect parent_to_item (Rect const &) const; /* XXX: it's a pity these two aren't the same form as item_to_parent etc., - but it makes a bit of a mess in the rest of the code if they are not. - */ - void canvas_to_item (Coord &, Coord &) const; + * but it makes a bit of a mess in the rest of the code if they are not. + */ + void canvas_to_item (Coord &, Coord &) const; void item_to_canvas (Coord &, Coord &) const; - Duple canvas_to_item (Duple const&) const; + Duple canvas_to_item (Duple const&) const; Rect item_to_canvas (Rect const&) const; - Duple item_to_canvas (Duple const&) const; + Duple item_to_canvas (Duple const&) const; Rect canvas_to_item (Rect const&) const; - Duple item_to_window (Duple const&, bool rounded = true) const; - Duple window_to_item (Duple const&) const; - Rect item_to_window (Rect const&, bool rounded = true) const; - Rect window_to_item (Rect const&) const; + Duple item_to_window (Duple const&, bool rounded = true) const; + Duple window_to_item (Duple const&) const; + Rect item_to_window (Rect const&, bool rounded = true) const; + Rect window_to_item (Rect const&) const; void raise_to_top (); void raise (int); void lower_to_bottom (); virtual void hide (); - virtual void show (); + virtual void show (); /** @return true if this item is visible (ie it will be rendered), * otherwise false @@ -213,7 +213,7 @@ public: void add (Item *); void add_front (Item *); void remove (Item *); - void clear (bool with_delete = false); + void clear (bool with_delete = false); std::list const & items () const { return _items; } @@ -226,25 +226,25 @@ public: /* This is a sigc++ signal because it is solely - concerned with GUI stuff and is thus single-threaded - */ + concerned with GUI stuff and is thus single-threaded + */ template - struct EventAccumulator { - typedef T result_type; - template - result_type operator () (U first, U last) { - while (first != last) { - if (*first) { - return true; + struct EventAccumulator { + typedef T result_type; + template + result_type operator () (U first, U last) { + while (first != last) { + if (*first) { + return true; + } + ++first; + } + return false; } - ++first; - } - return false; - } - }; + }; - sigc::signal1 > Event; + sigc::signal1 > Event; #ifdef CANVAS_DEBUG std::string name; @@ -260,26 +260,26 @@ public: void start_tooltip_timeout (); void stop_tooltip_timeout (); - virtual void dump (std::ostream&) const; - std::string whatami() const; + virtual void dump (std::ostream&) const; + std::string whatami() const; protected: friend class Fill; friend class Outline; - /** To be called at the beginning of any property change that + /** To be called at the beginning of any property change that * may alter the bounding box of this item */ void begin_change (); - /** To be called at the endof any property change that + /** To be called at the endof any property change that * may alter the bounding box of this item */ void end_change (); - /** To be called at the beginning of any property change that + /** To be called at the beginning of any property change that * does NOT alter the bounding box of this item */ void begin_visual_change (); - /** To be called at the endof any property change that + /** To be called at the endof any property change that * does NOT alter the bounding box of this item */ void end_visual_change (); @@ -336,5 +336,4 @@ extern LIBCANVAS_API std::ostream& operator<< (std::ostream&, const ArdourCanvas } - #endif diff --git a/libs/canvas/canvas/line.h b/libs/canvas/canvas/line.h index f2fec79f86..e250b9f6d4 100644 --- a/libs/canvas/canvas/line.h +++ b/libs/canvas/canvas/line.h @@ -20,29 +20,29 @@ #ifndef __CANVAS_LINE_H__ #define __CANVAS_LINE_H__ -#include "canvas/visibility.h" #include "canvas/item.h" #include "canvas/outline.h" #include "canvas/poly_line.h" +#include "canvas/visibility.h" namespace ArdourCanvas { class LIBCANVAS_API Line : public Item { - public: +public: Line (Canvas*); Line (Item*); void render (Rect const & area, Cairo::RefPtr) const; void compute_bounding_box () const; - bool covers (Duple const &) const; + bool covers (Duple const &) const; void set (Duple, Duple); void set_x0 (Coord); void set_y0 (Coord); void set_x1 (Coord); void set_y1 (Coord); - void set_x (Coord, Coord); + void set_x (Coord, Coord); Coord x0 () const { return _points[0].x; diff --git a/libs/canvas/canvas/line_set.h b/libs/canvas/canvas/line_set.h index ebf31fa0f5..23e9a7f21f 100644 --- a/libs/canvas/canvas/line_set.h +++ b/libs/canvas/canvas/line_set.h @@ -23,8 +23,8 @@ #include -#include "canvas/visibility.h" #include "canvas/item.h" +#include "canvas/visibility.h" namespace ArdourCanvas { diff --git a/libs/canvas/canvas/poly_line.h b/libs/canvas/canvas/poly_line.h index 9d524be84f..557006f785 100644 --- a/libs/canvas/canvas/poly_line.h +++ b/libs/canvas/canvas/poly_line.h @@ -21,9 +21,9 @@ #ifndef __CANVAS_POLY_LINE_H__ #define __CANVAS_POLY_LINE_H__ -#include "canvas/visibility.h" -#include "canvas/poly_item.h" #include "canvas/outline.h" +#include "canvas/poly_item.h" +#include "canvas/visibility.h" namespace ArdourCanvas { @@ -39,10 +39,11 @@ public: virtual void compute_bounding_box () const; bool covers (Duple const &) const; + /** * Set the distance at which a point will be considered to be covered * by the line. For the definition of "distance" see - * utils.cc:distance_to_segment_squared() + * utils.cc \ref distance_to_segment_squared() */ void set_covers_threshold (double); diff --git a/libs/canvas/canvas/polygon.h b/libs/canvas/canvas/polygon.h index b7a0fa240c..09212ceb62 100644 --- a/libs/canvas/canvas/polygon.h +++ b/libs/canvas/canvas/polygon.h @@ -20,10 +20,10 @@ #ifndef __CANVAS_POLYGON_H__ #define __CANVAS_POLYGON_H__ -#include "canvas/visibility.h" -#include "canvas/poly_item.h" -#include "canvas/outline.h" #include "canvas/fill.h" +#include "canvas/outline.h" +#include "canvas/poly_item.h" +#include "canvas/visibility.h" namespace ArdourCanvas { @@ -32,18 +32,18 @@ class LIBCANVAS_API Polygon : public PolyItem public: Polygon (Canvas*); Polygon (Item*); - virtual ~Polygon(); + virtual ~Polygon(); void render (Rect const & area, Cairo::RefPtr) const; void compute_bounding_box () const; - bool covers (Duple const &) const; + bool covers (Duple const &) const; - protected: - mutable float* multiple; - mutable float* constant; - mutable Points::size_type cached_size; +protected: + mutable float* multiple; + mutable float* constant; + mutable Points::size_type cached_size; - void cache_shape_computation () const; + void cache_shape_computation () const; }; } diff --git a/libs/temporal/temporal/time.h b/libs/temporal/temporal/time.h index 4017eaeb2d..d75c232fe9 100644 --- a/libs/temporal/temporal/time.h +++ b/libs/temporal/temporal/time.h @@ -20,12 +20,13 @@ #define __timecode_time_h__ #include -#include #include +#include #include "temporal/visibility.h" -namespace Timecode { +namespace Timecode +{ enum Wrap { NONE = 0, @@ -55,31 +56,34 @@ struct LIBTEMPORAL_API Time { uint32_t hours; uint32_t minutes; uint32_t seconds; - uint32_t frames; ///< Timecode frames (not audio frames) - uint32_t subframes; ///< Typically unused - double rate; ///< Frame rate of this Time - static double default_rate; ///< Rate to use for default constructor - bool drop; ///< Whether this Time uses dropframe Timecode + uint32_t frames; ///< Timecode frames (not audio frames) + uint32_t subframes; ///< Typically unused + double rate; ///< Frame rate of this Time + static double default_rate; ///< Rate to use for default constructor + bool drop; ///< Whether this Time uses dropframe Timecode - Time (double a_rate = default_rate) { - negative = false; - hours = 0; - minutes = 0; - seconds = 0; - frames = 0; + Time (double a_rate = default_rate) + { + negative = false; + hours = 0; + minutes = 0; + seconds = 0; + frames = 0; subframes = 0; - rate = a_rate; - drop = (lrintf(100.f * (float)a_rate) == (long)2997); + rate = a_rate; + drop = (lrintf (100.f * (float)a_rate) == (long)2997); } - bool operator== (const Time& other) const { + bool operator== (const Time& other) const + { return negative == other.negative && hours == other.hours && minutes == other.minutes && seconds == other.seconds && frames == other.frames && subframes == other.subframes && rate == other.rate && drop == other.drop; } - std::ostream& print (std::ostream& ostr) const { + std::ostream& print (std::ostream& ostr) const + { if (negative) { ostr << '-'; } @@ -88,7 +92,6 @@ struct LIBTEMPORAL_API Time { << " @" << rate << (drop ? " drop" : " nondrop"); return ostr; } - }; Wrap LIBTEMPORAL_API increment (Time& timecode, uint32_t); @@ -103,46 +106,44 @@ void LIBTEMPORAL_API seconds_floor (Time& timecode); void LIBTEMPORAL_API minutes_floor (Time& timecode); void LIBTEMPORAL_API hours_floor (Time& timecode); -double LIBTEMPORAL_API timecode_to_frames_per_second(TimecodeFormat const t); -bool LIBTEMPORAL_API timecode_has_drop_frames(TimecodeFormat const t); +double LIBTEMPORAL_API timecode_to_frames_per_second (TimecodeFormat const t); +bool LIBTEMPORAL_API timecode_has_drop_frames (TimecodeFormat const t); std::string LIBTEMPORAL_API timecode_format_name (TimecodeFormat const t); - std::string LIBTEMPORAL_API timecode_format_time (Timecode::Time const timecode); -std::string LIBTEMPORAL_API timecode_format_sampletime ( - int64_t sample, - double sample_sample_rate, - double timecode_frames_per_second, bool timecode_drop_frames - ); +bool LIBTEMPORAL_API parse_timecode_format (std::string tc, Timecode::Time& TC); -bool LIBTEMPORAL_API parse_timecode_format(std::string tc, Timecode::Time &TC); +std::string LIBTEMPORAL_API +timecode_format_sampletime ( + int64_t sample, + double sample_sample_rate, + double timecode_frames_per_second, bool timecode_drop_frames); -void LIBTEMPORAL_API timecode_to_sample( - Timecode::Time& timecode, int64_t& sample, - bool use_offset, bool use_subframes, +void LIBTEMPORAL_API +timecode_to_sample ( + Timecode::Time& timecode, int64_t& sample, + bool use_offset, bool use_subframes, /* Note - framerate info is taken from Timecode::Time& */ - double sample_sample_rate /**< may include pull up/down */, - uint32_t subframes_per_frame /**< must not be 0 if use_subframes==true */, + double sample_sample_rate /**< may include pull up/down */, + uint32_t subframes_per_frame /**< must not be 0 if use_subframes==true */, /* optional offset - can be improved: function pointer to lazily query this*/ - bool offset_is_negative, int64_t offset_samples - ); + bool offset_is_negative, int64_t offset_samples); -void LIBTEMPORAL_API sample_to_timecode ( - int64_t sample, Timecode::Time& timecode, - bool use_offset, bool use_subframes, +void LIBTEMPORAL_API +sample_to_timecode ( + int64_t sample, Timecode::Time& timecode, + bool use_offset, bool use_subframes, /* framerate info */ - double timecode_frames_per_second, - bool timecode_drop_frames, - double sample_sample_rate/**< can include pull up/down */, - uint32_t subframes_per_frame, + double timecode_frames_per_second, + bool timecode_drop_frames, + double sample_sample_rate /**< can include pull up/down */, + uint32_t subframes_per_frame, /* optional offset - can be improved: function pointer to lazily query this*/ - bool offset_is_negative, int64_t offset_samples - ); - + bool offset_is_negative, int64_t offset_samples); } // namespace Timecode extern LIBTEMPORAL_API std::ostream& operator<< (std::ostream& ostr, const Timecode::Time& t); -#endif // __timecode_time_h__ +#endif // __timecode_time_h__