Structure-Change: now able to turn the widgets within DisplayFrame into ViewHooked
...and implemented the base case (=Recursion) of the corresponding ViewHook(s)
This commit is contained in:
parent
c5d0ddb01b
commit
e4049534fa
7 changed files with 593 additions and 1030 deletions
|
|
@ -278,7 +278,7 @@ namespace util {
|
||||||
* in any sequential collection */
|
* in any sequential collection */
|
||||||
template <typename SEQ>
|
template <typename SEQ>
|
||||||
inline typename SEQ::iterator
|
inline typename SEQ::iterator
|
||||||
removeall (SEQ& coll, typename SEQ::value_type& val)
|
removeall (SEQ& coll, typename SEQ::value_type const& val)
|
||||||
{
|
{
|
||||||
typename SEQ::iterator collEnd = coll.end();
|
typename SEQ::iterator collEnd = coll.end();
|
||||||
return coll.erase (std::remove (coll.begin(), collEnd, val),
|
return coll.erase (std::remove (coll.begin(), collEnd, val),
|
||||||
|
|
|
||||||
|
|
@ -95,24 +95,17 @@ namespace timeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
TrackBody::attachSubTrack (TrackBody* subBody)
|
|
||||||
{
|
|
||||||
REQUIRE (subBody);
|
|
||||||
subTracks_.push_back (subBody); /////////////////////////////////////////////////////TICKET #1199 : this can not possibly work; we need a way to retain the order of tracks, and we need to detach tracks...
|
|
||||||
|
|
||||||
// detect changes of the track structure
|
|
||||||
subBody->signalStructureChange_ = signalStructureChange_;
|
|
||||||
signalStructureChange_(); // this _is_ such a change
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ==== Interface: ViewHook ===== */
|
/* ==== Interface: ViewHook ===== */
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackBody::hook (TrackBody& subBody, int xPos, int yPos)
|
TrackBody::hook (TrackBody& subBody, int xPos, int yPos)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED ("attach sub-TrackBody");
|
REQUIRE (xPos==0 && yPos==0, "arbitrary positioning of TrackBody contradicts the concept of track-profile."); ///TODO remove that API
|
||||||
|
subTracks_.push_back (&subBody);
|
||||||
|
|
||||||
|
// notify presentation code of the changed structure
|
||||||
|
subBody.signalStructureChange_ = signalStructureChange_;
|
||||||
|
signalStructureChange_(); // this _is_ such a change
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -124,13 +117,16 @@ namespace timeline {
|
||||||
void
|
void
|
||||||
TrackBody::remove (TrackBody& subBody)
|
TrackBody::remove (TrackBody& subBody)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED ("detach sub-TrackBody");
|
util::removeall (subTracks_, &subBody);
|
||||||
|
signalStructureChange_();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackBody::rehook (ViewHooked<TrackBody>& subBody) noexcept
|
TrackBody::rehook (ViewHooked<TrackBody>& subBody) noexcept
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED ("re-attach sub-TrackBody");
|
util::removeall (subTracks_, &subBody);
|
||||||
|
subTracks_.push_back (&subBody);
|
||||||
|
signalStructureChange_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ namespace timeline {
|
||||||
|
|
||||||
void setTrackName (cuString&);
|
void setTrackName (cuString&);
|
||||||
uint establishTrackSpace (TrackProfile&);
|
uint establishTrackSpace (TrackProfile&);
|
||||||
void attachSubTrack (TrackBody*);
|
|
||||||
uint calcRulerHeight();
|
uint calcRulerHeight();
|
||||||
uint calcHeight();
|
uint calcHeight();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,15 +94,31 @@ namespace timeline {
|
||||||
* the whole structure has to be re-built accordingly.
|
* the whole structure has to be re-built accordingly.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
TrackHeadWidget::injectSubFork (TrackHeadWidget& subForkHead)
|
TrackHeadWidget::attachSubFork (TrackHeadWidget& subForkHead)
|
||||||
{
|
{
|
||||||
++childCnt_;
|
++childCnt_;
|
||||||
this->attach (subForkHead, 1, childCnt_, 1,1);
|
this->attach (subForkHead, 1, childCnt_, 1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal remove a complete sub-fork from display.
|
||||||
|
* @remarks due to the automatic ref-counting system of GTK+, it is sufficient
|
||||||
|
* just to remove the entry from the `Gtk::Container` baseclass, which
|
||||||
|
* automatically decrements the refcount; alternatively we could as well
|
||||||
|
* destroy the Gtkmm wrapper-Object (i.e. the `Gtk::Widget` subclass),
|
||||||
|
* since this also destroys the underlying `gobj` and automatically
|
||||||
|
* detaches it from any container.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
TrackHeadWidget::detachSubFork (TrackHeadWidget& subForkHead)
|
||||||
|
{
|
||||||
|
--childCnt_;
|
||||||
|
this->remove (subForkHead);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackHeadWidget::clearSubFork()
|
TrackHeadWidget::clearFork()
|
||||||
{
|
{
|
||||||
while (childCnt_ > 0)
|
while (childCnt_ > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -117,7 +133,8 @@ namespace timeline {
|
||||||
void
|
void
|
||||||
TrackHeadWidget::hook (TrackHeadWidget& subHead, int xPos, int yPos)
|
TrackHeadWidget::hook (TrackHeadWidget& subHead, int xPos, int yPos)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED ("attach sub-TrackHead");
|
REQUIRE (xPos==0 && yPos==0, "selection of arbitrary row not yet implemented");
|
||||||
|
attachSubFork (subHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -129,13 +146,22 @@ namespace timeline {
|
||||||
void
|
void
|
||||||
TrackHeadWidget::remove (TrackHeadWidget& subHead)
|
TrackHeadWidget::remove (TrackHeadWidget& subHead)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED ("detach sub-TrackHead");
|
detachSubFork (subHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @remark This implementation will not interfere with the widget's lifecycle.
|
||||||
|
* The widget with all its children is just detached from presentation (leaving an
|
||||||
|
* empty grid cell), and immediately re-attached into the "bottom most" cell, as
|
||||||
|
* given by the current childCnt_
|
||||||
|
* @note in theory it is possible to end up with several widgets in a single cell,
|
||||||
|
* and GTK can handle that. Given our actual usage of these functions, such should
|
||||||
|
* never happen, since we manage all widgets as slave of the model::Tangible in charge.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
TrackHeadWidget::rehook (ViewHooked<TrackHeadWidget>& hookedSubHead) noexcept
|
TrackHeadWidget::rehook (ViewHooked<TrackHeadWidget>& hookedSubHead) noexcept
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED ("re-attach sub-TrackHead");
|
detachSubFork (hookedSubHead);
|
||||||
|
attachSubFork (hookedSubHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,14 +91,15 @@ namespace timeline {
|
||||||
~TrackHeadWidget();
|
~TrackHeadWidget();
|
||||||
|
|
||||||
void setTrackName (cuString&);
|
void setTrackName (cuString&);
|
||||||
|
|
||||||
/** Integrate the control area for a nested sub track fork. */
|
|
||||||
void injectSubFork (TrackHeadWidget& subForkHead);
|
|
||||||
|
|
||||||
/** Discard all nested sub track display widgets. */
|
|
||||||
void clearSubFork();
|
|
||||||
|
|
||||||
private:/* ===== Internals ===== */
|
private:/* ===== Internals ===== */
|
||||||
|
|
||||||
|
/** Integrate the control area for a nested sub track fork. */
|
||||||
|
void attachSubFork (TrackHeadWidget& subForkHead);
|
||||||
|
void detachSubFork (TrackHeadWidget& subForkHead);
|
||||||
|
|
||||||
|
/** Discard all nested sub track display widgets. */
|
||||||
|
void clearFork();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,8 @@ namespace timeline {
|
||||||
, public DisplayViewHooks
|
, public DisplayViewHooks
|
||||||
, public CanvasOffsetHook
|
, public CanvasOffsetHook
|
||||||
{
|
{
|
||||||
TrackHeadWidget head_;
|
ViewHooked<TrackHeadWidget> head_;
|
||||||
TrackBody body_;
|
ViewHooked<TrackBody> body_;
|
||||||
|
|
||||||
/* ==== Interface: DisplayViewHooks===== */
|
/* ==== Interface: DisplayViewHooks===== */
|
||||||
|
|
||||||
|
|
@ -149,8 +149,8 @@ namespace timeline {
|
||||||
public:
|
public:
|
||||||
DisplayFrame (DisplayViewHooks& displayAnchor)
|
DisplayFrame (DisplayViewHooks& displayAnchor)
|
||||||
: CanvasOffsetHook{displayAnchor.getClipHook()}
|
: CanvasOffsetHook{displayAnchor.getClipHook()}
|
||||||
, head_{}
|
, head_{displayAnchor.getHeadHook()}
|
||||||
, body_{}
|
, body_{displayAnchor.getBodyHook()}
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -159,13 +159,6 @@ namespace timeline {
|
||||||
head_.setTrackName (name);
|
head_.setTrackName (name);
|
||||||
body_.setTrackName (name); ///////////////////////////////////TICKET #1017 -- TODO 11/18 : not clear yet if TrackBody needs to know its name
|
body_.setTrackName (name); ///////////////////////////////////TICKET #1017 -- TODO 11/18 : not clear yet if TrackBody needs to know its name
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
injectSubTrack (TrackHeadWidget& subHead, TrackBody& subBody)
|
|
||||||
{
|
|
||||||
head_.injectSubFork (subHead);
|
|
||||||
body_.attachSubTrack (&subBody);
|
|
||||||
}
|
|
||||||
|
|
||||||
vector<unique_ptr<RulerTrack>>&
|
vector<unique_ptr<RulerTrack>>&
|
||||||
bindRulers()
|
bindRulers()
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue