Enable lock/unlock and disable/enable individual tracks in the GUI
This commit is contained in:
parent
fd6492d745
commit
9a881c95df
2 changed files with 53 additions and 3 deletions
|
|
@ -40,8 +40,10 @@ Track::Track(TimelineWidget &timeline_widget,
|
|||
shared_ptr<model::Track> track) :
|
||||
timelineWidget(timeline_widget),
|
||||
model_track(track),
|
||||
enabled(true),
|
||||
expanded(true),
|
||||
expandDirection(None),
|
||||
locked(false),
|
||||
headerWidget(*this),
|
||||
enableButton(Gtk::StockID("track_enabled"), WindowManager::MenuIconSize),
|
||||
lockButton(Gtk::StockID("track_unlocked"), WindowManager::MenuIconSize)
|
||||
|
|
@ -51,8 +53,8 @@ Track::Track(TimelineWidget &timeline_widget,
|
|||
titleMenuButton.set_relief(RELIEF_HALF);
|
||||
titleMenuButton.unset_flags(CAN_FOCUS);
|
||||
|
||||
buttonBar.append(enableButton);
|
||||
buttonBar.append(lockButton);
|
||||
buttonBar.append(enableButton, mem_fun(this, &Track::on_enable));
|
||||
buttonBar.append(lockButton, mem_fun(this, &Track::on_lock));
|
||||
|
||||
headerWidget.set_child_widget(headerBox);
|
||||
|
||||
|
|
@ -71,6 +73,10 @@ Track::Track(TimelineWidget &timeline_widget,
|
|||
|
||||
update_name();
|
||||
|
||||
// Setup tooltips
|
||||
enableButton.set_tooltip_text(_("Disable track"));
|
||||
lockButton.set_tooltip_text(_("Lock track"));
|
||||
|
||||
// Setup the context menu
|
||||
Menu::MenuList& context_list = contextMenu.items();
|
||||
//context_list.push_back( Menu_Helpers::MenuElem(_("_Add Track"),
|
||||
|
|
@ -226,6 +232,38 @@ Track::update_name()
|
|||
titleMenuButton.set_label(model_track->get_name());
|
||||
}
|
||||
|
||||
void
|
||||
Track::on_enable()
|
||||
{
|
||||
enabled = !enabled;
|
||||
if (enabled)
|
||||
{
|
||||
enableButton.set_stock_id(Gtk::StockID("track_enabled"), WindowManager::MenuIconSize);
|
||||
enableButton.set_tooltip_text(_("Disable track"));
|
||||
}
|
||||
else
|
||||
{
|
||||
enableButton.set_stock_id(Gtk::StockID("track_disabled"), WindowManager::MenuIconSize);
|
||||
enableButton.set_tooltip_text(_("Enable track"));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Track::on_lock()
|
||||
{
|
||||
locked = !locked;
|
||||
if (locked)
|
||||
{
|
||||
lockButton.set_stock_id(Gtk::StockID("track_locked"), WindowManager::MenuIconSize);
|
||||
lockButton.set_tooltip_text(_("Unlock track"));
|
||||
}
|
||||
else
|
||||
{
|
||||
lockButton.set_stock_id(Gtk::StockID("track_unlocked"), WindowManager::MenuIconSize);
|
||||
lockButton.set_tooltip_text(_("Lock track"));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Track::on_set_name()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ private:
|
|||
private:
|
||||
|
||||
//----- Event Handlers -----//
|
||||
void on_enable();
|
||||
void on_lock();
|
||||
void on_set_name();
|
||||
|
||||
/**
|
||||
|
|
@ -157,12 +159,17 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
/**
|
||||
* True if this track is enabled.
|
||||
*/
|
||||
bool enabled;
|
||||
|
||||
/**
|
||||
* This bool is true if this branch is expanded. false if it is
|
||||
* collapsed.
|
||||
**/
|
||||
bool expanded;
|
||||
|
||||
|
||||
/**
|
||||
* This enum specifies which direction the expand/collapse animation
|
||||
* is moving - if any.
|
||||
|
|
@ -187,6 +194,11 @@ private:
|
|||
**/
|
||||
boost::scoped_ptr<Glib::Timer> expand_timer;
|
||||
|
||||
/**
|
||||
* True if this track is locked.
|
||||
*/
|
||||
bool locked;
|
||||
|
||||
//----- Header Widgets ------//
|
||||
|
||||
timeline::TimelineHeaderWidget headerWidget;
|
||||
|
|
|
|||
Loading…
Reference in a new issue