Added a name dialog for track
This commit is contained in:
parent
ea89f27668
commit
7a838fc4eb
8 changed files with 46 additions and 25 deletions
|
|
@ -30,8 +30,8 @@ using namespace Glib;
|
||||||
namespace gui {
|
namespace gui {
|
||||||
namespace dialogs {
|
namespace dialogs {
|
||||||
|
|
||||||
NameChooser::NameChooser(Window &parent, Glib::ustring title,
|
NameChooser::NameChooser(Window &parent, const Glib::ustring title,
|
||||||
Glib::ustring default_name) :
|
const Glib::ustring default_name) :
|
||||||
Dialog::Dialog(title, parent, true),
|
Dialog::Dialog(title, parent, true),
|
||||||
caption(_("Name:"))
|
caption(_("Name:"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ public:
|
||||||
* @param default_name The name that will be shown by default in the
|
* @param default_name The name that will be shown by default in the
|
||||||
* edit box of the dialog.
|
* edit box of the dialog.
|
||||||
**/
|
**/
|
||||||
NameChooser(Gtk::Window &parent, Glib::ustring title,
|
NameChooser(Gtk::Window &parent, const Glib::ustring title,
|
||||||
Glib::ustring default_name);
|
const Glib::ustring default_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current name of the chosen in the dialog.
|
* Gets the current name of the chosen in the dialog.
|
||||||
|
|
|
||||||
|
|
@ -41,17 +41,5 @@ ParentTrack::get_child_track_list()
|
||||||
return tracks;
|
return tracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Glib::ustring
|
|
||||||
ParentTrack::get_name() const
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ParentTrack::set_name(const Glib::ustring &name)
|
|
||||||
{
|
|
||||||
this->name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace model
|
} // namespace model
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,6 @@ public:
|
||||||
lumiera::observable_list< boost::shared_ptr<Track> >&
|
lumiera::observable_list< boost::shared_ptr<Track> >&
|
||||||
get_child_track_list();
|
get_child_track_list();
|
||||||
|
|
||||||
const Glib::ustring get_name() const;
|
|
||||||
|
|
||||||
void set_name(const Glib::ustring &name);
|
|
||||||
|
|
||||||
private:
|
|
||||||
//----- Data -----//
|
|
||||||
Glib::ustring name;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
lumiera::observable_list< boost::shared_ptr<Track> > tracks;
|
lumiera::observable_list< boost::shared_ptr<Track> > tracks;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -38,5 +38,17 @@ Track::get_child_tracks() const
|
||||||
return Track::NoChildren;
|
return Track::NoChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Glib::ustring
|
||||||
|
Track::get_name() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Track::set_name(const Glib::ustring &name)
|
||||||
|
{
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace model
|
} // namespace model
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,14 @@ public:
|
||||||
virtual std::list< boost::shared_ptr<Track> >
|
virtual std::list< boost::shared_ptr<Track> >
|
||||||
get_child_tracks() const;
|
get_child_tracks() const;
|
||||||
|
|
||||||
|
const Glib::ustring get_name() const;
|
||||||
|
|
||||||
|
void set_name(const Glib::ustring &name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//----- Data -----//
|
||||||
|
Glib::ustring name;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const std::list< boost::shared_ptr<Track> > NoChildren;
|
static const std::list< boost::shared_ptr<Track> > NoChildren;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "timeline-track.hpp"
|
#include "timeline-track.hpp"
|
||||||
#include "../timeline-widget.hpp"
|
#include "../timeline-widget.hpp"
|
||||||
#include "../../window-manager.hpp"
|
#include "../../window-manager.hpp"
|
||||||
|
#include "../../dialogs/name-chooser.hpp"
|
||||||
|
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
|
|
@ -65,7 +66,7 @@ Track::Track(TimelineWidget &timeline_widget) :
|
||||||
// Setup the title menu
|
// Setup the title menu
|
||||||
Menu::MenuList& title_list = titleMenuButton.get_menu().items();
|
Menu::MenuList& title_list = titleMenuButton.get_menu().items();
|
||||||
title_list.push_back( Menu_Helpers::MenuElem(_("_Name..."),
|
title_list.push_back( Menu_Helpers::MenuElem(_("_Name..."),
|
||||||
mem_fun(this, &Track::on_remove_track) ) );
|
mem_fun(this, &Track::on_set_name) ) );
|
||||||
|
|
||||||
// Setup the context menu
|
// Setup the context menu
|
||||||
Menu::MenuList& context_list = contextMenu.items();
|
Menu::MenuList& context_list = contextMenu.items();
|
||||||
|
|
@ -105,6 +106,24 @@ Track::show_header_context_menu(guint button, guint32 time)
|
||||||
contextMenu.popup(button, time);
|
contextMenu.popup(button, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Track::on_set_name()
|
||||||
|
{
|
||||||
|
shared_ptr<model::Track> model_track =
|
||||||
|
timelineWidget.lookup_model_track(this);
|
||||||
|
REQUIRE(model_track);
|
||||||
|
|
||||||
|
Gtk::Window *window = dynamic_cast<Window*>(
|
||||||
|
timelineWidget.get_toplevel());
|
||||||
|
REQUIRE(window != NULL);
|
||||||
|
|
||||||
|
dialogs::NameChooser dialog(*window,
|
||||||
|
_("Set Track Name"), model_track->get_name());
|
||||||
|
|
||||||
|
if(dialog.run() == RESPONSE_OK)
|
||||||
|
model_track->set_name(dialog.get_name());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Track::on_remove_track()
|
Track::on_remove_track()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void on_set_name();
|
||||||
|
|
||||||
void on_remove_track();
|
void on_remove_track();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue