diff --git a/src/gui/model/parent-track.hpp b/src/gui/model/parent-track.hpp index 6d5b0481a..89967eccc 100644 --- a/src/gui/model/parent-track.hpp +++ b/src/gui/model/parent-track.hpp @@ -89,7 +89,7 @@ public: protected: /** - * The internal list of child tracks of this paremt. + * The internal list of child tracks of this parent. **/ lumiera::observable_list< boost::shared_ptr > tracks; }; diff --git a/src/gui/widgets/timeline/timeline-clip-track.cpp b/src/gui/widgets/timeline/timeline-clip-track.cpp index 2b2bbb875..92a2f4511 100644 --- a/src/gui/widgets/timeline/timeline-clip-track.cpp +++ b/src/gui/widgets/timeline/timeline-clip-track.cpp @@ -20,6 +20,9 @@ * *****************************************************/ +#include + +#include "timeline-clip.hpp" #include "timeline-clip-track.hpp" #include "timeline-view-window.hpp" @@ -28,19 +31,26 @@ using namespace Gtk; namespace gui { namespace widgets { namespace timeline { - + ClipTrack::ClipTrack(TimelineWidget &timeline_widget, boost::shared_ptr track) : Track(timeline_widget, track) { + // TEST CODE: add a clip to the track + boost::shared_ptr model_clip(new model::Clip()); + boost::shared_ptr timeline_clip(new timeline::Clip(model_clip)); + clips.push_back(timeline_clip); + // END TEST CODE } void ClipTrack::draw_track(Cairo::RefPtr cairo, TimelineViewWindow* const window) const { - - + REQUIRE(cairo); + REQUIRE(window); + + // Draw a rectangle to let us know it works? :-) cairo->rectangle(window->time_to_x(0), 1, window->time_to_x(500000) - window->time_to_x(0), get_height() - 2); @@ -50,6 +60,12 @@ ClipTrack::draw_track(Cairo::RefPtr cairo, cairo->set_source_rgb(0.25, 0.25, 0.25); cairo->stroke(); + + // Draw all clips + BOOST_FOREACH(boost::shared_ptr c, clips) + { + c->draw_clip(cairo, window); + } } } // namespace timeline diff --git a/src/gui/widgets/timeline/timeline-clip-track.hpp b/src/gui/widgets/timeline/timeline-clip-track.hpp index f6947fbe8..90f63fc7d 100644 --- a/src/gui/widgets/timeline/timeline-clip-track.hpp +++ b/src/gui/widgets/timeline/timeline-clip-track.hpp @@ -28,6 +28,8 @@ #ifndef TIMELINE_CLIP_TRACK_HPP #define TIMELINE_CLIP_TRACK_HPP +#include + #include "timeline-track.hpp" #include "../../model/clip-track.hpp" @@ -46,7 +48,9 @@ public: void draw_track(Cairo::RefPtr cairo, TimelineViewWindow* const window) const; - + +private: + std::vector > clips; }; } // namespace timeline diff --git a/src/gui/widgets/timeline/timeline-clip.cpp b/src/gui/widgets/timeline/timeline-clip.cpp index 47826f077..dc93ccbb5 100644 --- a/src/gui/widgets/timeline/timeline-clip.cpp +++ b/src/gui/widgets/timeline/timeline-clip.cpp @@ -26,11 +26,52 @@ namespace gui { namespace widgets { namespace timeline { -Clip::Clip() +Clip::Clip(boost::shared_ptr clip) + : model_clip(clip) { - + REQUIRE(model_clip); } +void +Clip::draw_clip(Cairo::RefPtr cr, + TimelineViewWindow* const window) const +{ + REQUIRE(cr); + REQUIRE(window); + + int x = window->time_to_x(1000000); + int width = window->time_to_x(2000000) - window->time_to_x(1000000); + + // Draw a rectangle for the clip + cr->rectangle(x, 1, width, 100-2); + + // TODO: get duration from the model::Clip + // TODO: get height from the Timeline::Track + + cr->set_source_rgb(0.4, 0.4, 0.4); + cr->fill_preserve(); + + cr->set_source_rgb(0.25, 0.25, 0.25); + cr->stroke(); + + // Show the clip name + cr->rectangle(x, 1, width, 100-2); + cr->clip(); + + cr->move_to(x + 3, 15); + cr->set_source_rgb(1.0, 1.0, 1.0); + Cairo::RefPtr font = + Cairo::ToyFontFace::create("Bitstream Charter", + Cairo::FONT_SLANT_NORMAL, + Cairo::FONT_WEIGHT_NORMAL); + cr->set_font_face(font); + cr->set_font_size(11); + cr->show_text("Track"); // TODO: get clip name from model + + // TODO: Show thumbnails for clip +} + + } // namespace timeline } // namespace widgets } // namespace gui diff --git a/src/gui/widgets/timeline/timeline-clip.hpp b/src/gui/widgets/timeline/timeline-clip.hpp index 46cc751be..c08d87c66 100644 --- a/src/gui/widgets/timeline/timeline-clip.hpp +++ b/src/gui/widgets/timeline/timeline-clip.hpp @@ -23,7 +23,11 @@ ** This file contains the definition of timeline clip object */ + +#include "../../gtk-lumiera.hpp" #include "../../model/clip.hpp" +#include "timeline-view-window.hpp" +#include "include/logging.h" #ifndef TIMELINE_CLIP_HPP #define TIMELINE_CLIP_HPP @@ -35,11 +39,16 @@ namespace timeline { class Clip : public model::Clip { public: - Clip(); + Clip(boost::shared_ptr clip); + void draw_clip(Cairo::RefPtr cairo, + TimelineViewWindow* const window) const; + +private: + + boost::shared_ptr model_clip; }; - } // namespace timeline } // namespace widgets } // namespace gui