Session Metadata: add a Description field.
* This is a multi-line text field. * If the session is a template, we might show this in the New Session dialog.
This commit is contained in:
parent
a1143a0ed6
commit
0a0eec2adc
|
@ -88,7 +88,7 @@ Gtk::Widget &
|
|||
TextMetadataField::name_widget ()
|
||||
{
|
||||
label = Gtk::manage (new Gtk::Label(_name + ':'));
|
||||
label->set_alignment (1, 0.5);
|
||||
label->set_alignment (1, 0);
|
||||
return *label;
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,44 @@ TextMetadataField::update_value ()
|
|||
_value = entry->get_text ();
|
||||
}
|
||||
|
||||
/* LongTextMetadataField */
|
||||
|
||||
LongTextMetadataField::LongTextMetadataField (Getter getter, Setter setter, string const & field_name, guint width ) :
|
||||
TextMetadataField (getter, setter, field_name, width)
|
||||
{
|
||||
tview = 0;
|
||||
label = 0;
|
||||
value_label = 0;
|
||||
}
|
||||
|
||||
MetadataPtr
|
||||
LongTextMetadataField::copy ()
|
||||
{
|
||||
return MetadataPtr (new TextMetadataField (getter, setter, _name, width));
|
||||
}
|
||||
|
||||
Gtk::Widget &
|
||||
LongTextMetadataField::edit_widget ()
|
||||
{
|
||||
tview = Gtk::manage (new Gtk::TextView());
|
||||
|
||||
tview->get_buffer()->set_text (_value);
|
||||
tview->set_wrap_mode (Gtk::WRAP_WORD);
|
||||
tview->set_size_request (-1, 400);
|
||||
tview->set_editable (true);
|
||||
|
||||
Glib::RefPtr<Gtk::TextBuffer> tb (tview->get_buffer());
|
||||
tb->signal_changed().connect (sigc::mem_fun(*this, &LongTextMetadataField::update_value));
|
||||
|
||||
return *tview;
|
||||
}
|
||||
|
||||
void
|
||||
LongTextMetadataField::update_value ()
|
||||
{
|
||||
_value = tview->get_buffer()->get_text ();
|
||||
}
|
||||
|
||||
/* NumberMetadataField */
|
||||
|
||||
NumberMetadataField::NumberMetadataField (Getter getter, Setter setter, string const & field_name, guint numbers, guint width) :
|
||||
|
@ -167,7 +205,7 @@ Gtk::Widget &
|
|||
NumberMetadataField::name_widget ()
|
||||
{
|
||||
label = Gtk::manage (new Gtk::Label(_name + ':'));
|
||||
label->set_alignment (1, 0.5);
|
||||
label->set_alignment (1, 0);
|
||||
return *label;
|
||||
}
|
||||
|
||||
|
@ -307,7 +345,7 @@ Gtk::Widget &
|
|||
EAN13MetadataField::name_widget ()
|
||||
{
|
||||
label = Gtk::manage (new Gtk::Label(_name + ':'));
|
||||
label->set_alignment (1, 0.5);
|
||||
label->set_alignment (1, 0);
|
||||
return *label;
|
||||
}
|
||||
|
||||
|
@ -569,6 +607,7 @@ SessionMetadataDialog<DataSet>::init_data ( bool skip_user )
|
|||
init_album_data ();
|
||||
init_people_data ();
|
||||
init_school_data ();
|
||||
init_description_data ();
|
||||
|
||||
for (DataSetList::iterator it = data_list.begin(); it != data_list.end(); ++it) {
|
||||
(*it)->set_session (_session);
|
||||
|
@ -666,6 +705,20 @@ SessionMetadataDialog<DataSet>::init_user_data ()
|
|||
|
||||
}
|
||||
|
||||
template <typename DataSet>
|
||||
void
|
||||
SessionMetadataDialog<DataSet>::init_description_data ()
|
||||
{
|
||||
DataSetPtr data_set (new DataSet (_("Description")));
|
||||
data_list.push_back (data_set);
|
||||
|
||||
MetadataPtr ptr;
|
||||
|
||||
ptr = MetadataPtr (new LongTextMetadataField (&ARDOUR::SessionMetadata::description, &ARDOUR::SessionMetadata::set_description, _("Description")));
|
||||
data_set->add_data_field (ptr);
|
||||
}
|
||||
|
||||
|
||||
template <typename DataSet>
|
||||
void
|
||||
SessionMetadataDialog<DataSet>::init_track_data ()
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <gtkmm/liststore.h>
|
||||
#include <gtkmm/notebook.h>
|
||||
#include <gtkmm/table.h>
|
||||
#include <gtkmm/textview.h>
|
||||
#include <gtkmm/treemodel.h>
|
||||
#include <gtkmm/treeview.h>
|
||||
|
||||
|
@ -75,7 +76,7 @@ protected:
|
|||
/// MetadataField that contains text
|
||||
class TextMetadataField : public MetadataField
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
typedef std::string (ARDOUR::SessionMetadata::*Getter) () const;
|
||||
typedef void (ARDOUR::SessionMetadata::*Setter) (std::string const &);
|
||||
public:
|
||||
|
@ -88,7 +89,7 @@ public:
|
|||
Gtk::Widget & name_widget ();
|
||||
Gtk::Widget & value_widget ();
|
||||
Gtk::Widget & edit_widget ();
|
||||
private:
|
||||
protected:
|
||||
void update_value ();
|
||||
|
||||
Getter getter;
|
||||
|
@ -101,6 +102,20 @@ private:
|
|||
guint width;
|
||||
};
|
||||
|
||||
/// MetadataField that contains longform text
|
||||
class LongTextMetadataField : public TextMetadataField
|
||||
{
|
||||
public:
|
||||
LongTextMetadataField (Getter getter, Setter setter, std::string const & field_name, guint width = 50);
|
||||
MetadataPtr copy ();
|
||||
|
||||
Gtk::Widget & edit_widget ();
|
||||
private:
|
||||
void update_value ();
|
||||
|
||||
Gtk::TextView* tview;
|
||||
};
|
||||
|
||||
/// MetadataField that accepts only numbers
|
||||
class NumberMetadataField : public MetadataField
|
||||
{
|
||||
|
@ -286,6 +301,7 @@ protected:
|
|||
|
||||
private:
|
||||
void init_user_data ();
|
||||
void init_description_data ();
|
||||
void init_track_data ();
|
||||
void init_album_data ();
|
||||
void init_people_data ();
|
||||
|
|
|
@ -446,6 +446,7 @@ void RouteTemplateManager::init ()
|
|||
_progress_bar.hide ();
|
||||
}
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
void
|
||||
SessionTemplateManager::rename_template (TreeModel::iterator& item, const Glib::ustring& new_name_)
|
||||
|
|
|
@ -46,6 +46,8 @@ class LIBARDOUR_API SessionMetadata : public PBD::StatefulDestructible
|
|||
~SessionMetadata ();
|
||||
|
||||
/*** Accessing ***/
|
||||
std::string description () const;
|
||||
|
||||
std::string comment () const;
|
||||
std::string copyright () const;
|
||||
std::string isrc () const;
|
||||
|
@ -88,6 +90,7 @@ class LIBARDOUR_API SessionMetadata : public PBD::StatefulDestructible
|
|||
std::string country () const;
|
||||
|
||||
/*** Editing ***/
|
||||
void set_description (const std::string &);
|
||||
void set_comment (const std::string &);
|
||||
void set_copyright (const std::string &);
|
||||
void set_isrc (const std::string &);
|
||||
|
|
|
@ -31,6 +31,9 @@ SessionMetadata *SessionMetadata::_metadata = NULL; //singleton instance
|
|||
SessionMetadata::SessionMetadata ()
|
||||
{
|
||||
/*** General ***/
|
||||
map.insert (Property ("description", ""));
|
||||
|
||||
/*** Track/Song Data ***/
|
||||
map.insert (Property ("comment", ""));
|
||||
map.insert (Property ("copyright", ""));
|
||||
map.insert (Property ("isrc", ""));
|
||||
|
@ -222,6 +225,12 @@ SessionMetadata::get_user_state ()
|
|||
}
|
||||
|
||||
/*** Accessing ***/
|
||||
string
|
||||
SessionMetadata::description () const
|
||||
{
|
||||
return get_value("description");
|
||||
}
|
||||
|
||||
string
|
||||
SessionMetadata::comment () const
|
||||
{
|
||||
|
@ -430,6 +439,12 @@ SessionMetadata::country () const
|
|||
|
||||
|
||||
/*** Editing ***/
|
||||
void
|
||||
SessionMetadata::set_description (const string & v)
|
||||
{
|
||||
set_value ("description", v);
|
||||
}
|
||||
|
||||
void
|
||||
SessionMetadata::set_comment (const string & v)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user