Merge branch 'master' into cairocanvas

Conflicts:
	gtk2_ardour/editor_canvas.cc
	gtk2_ardour/imageframe_time_axis.cc
	gtk2_ardour/imageframe_time_axis.h
	gtk2_ardour/imageframe_time_axis_group.cc
	gtk2_ardour/imageframe_time_axis_group.h
	gtk2_ardour/imageframe_time_axis_view.cc
	gtk2_ardour/imageframe_time_axis_view.h
	gtk2_ardour/imageframe_view.cc
	gtk2_ardour/imageframe_view.h
	gtk2_ardour/marker_time_axis.cc
	gtk2_ardour/marker_time_axis.h
	gtk2_ardour/marker_time_axis_view.cc
	gtk2_ardour/marker_time_axis_view.h
	gtk2_ardour/marker_view.cc
	gtk2_ardour/marker_view.h
	gtk2_ardour/video_image_frame.cc
	gtk2_ardour/visual_time_axis.cc
	gtk2_ardour/visual_time_axis.h
	libs/canvas/canvas/circle.h
This commit is contained in:
Robin Gareus 2013-06-14 21:09:24 +02:00
commit 11619a37bf
34 changed files with 134 additions and 6416 deletions

View File

@ -1,166 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_image_comp_h__
#define __ardour_image_comp_h__
#include <string>
namespace ardourvis
{
/** Simple version number */
const int32_t MSG_VERSION = 1 ;
/** the default port we use */
const int32_t DEFAULT_PORT = 30000 ;
/** the maximum buffer size we will use to send receive a message (image data handled differently) */
const int32_t MAX_MSG_SIZE = 256 ;
/** the number of characters used for a value describing the characters within a textual data element */
const int32_t TEXT_SIZE_CHARS = 3 ;
/** the number of characters we use for time values within a message */
const int32_t TIME_VALUE_CHARS = 10 ;
/** the number of charachters we use for other value data, ie image width/height values */
const int32_t IMAGE_SIZE_CHARS = 3 ;
/** the number of characters used to for the size of the image data message */
const int32_t IMAGE_DATA_MESSAGE_SIZE_CHARS = 32 ;
// ------------------------------------------------------------------------- //
// Main Actions
// we join the action chars with items to create the message
// with the exception of the return values, all messages begin with one
// of these message parts
/** Insert an Item */
const std::string INSERT_ITEM = "IN" ;
/** Remove an Item */
const std::string REMOVE_ITEM = "RM" ;
/** Rename a named item */
const std::string RENAME_ITEM = "MV" ;
/** Request some aditional data */
const std::string REQUEST_DATA = "RQ" ;
/** Return of a data request */
const std::string RETURN_DATA = "RD" ;
/** Update a item */
const std::string ITEM_UPDATE = "IU" ;
/** Select an Item */
const std::string ITEM_SELECTED = "IS" ;
/** Sesion Action */
const std::string SESSION_ACTION = "SA" ;
/** Sesion Action */
const std::string SHUTDOWN = "SD" ;
// ------------------------------------------------------------------------- //
// Return values
const std::string RETURN_TRUE = "RT1" ;
const std::string RETURN_FALSE = "RT0" ;
// ------------------------------------------------------------------------- //
// Updateable attributes
/** Update the position of a time axis item */
const std::string POSITION_CHANGE = "PC" ;
/** Update the duration of a time axis item */
const std::string DURATION_CHANGE = "DC" ;
/** Enable the position lock constraint no a time axis item */
const std::string POSITION_LOCK_CHANGE = "PL" ;
/** Enable the duration lock constraint no a time axis item */
const std::string DURATION_LOCK_CHANGE = "PL" ;
/** Update the Maximum duration of a time axis item (_Upper _Duration) */
const std::string MAX_DURATION_CHANGE = "UD" ;
/** Enable the Maximum duration constraint of a time axis item (_Enable _Upper (Duration)) */
const std::string MAX_DURATION_ENABLE_CHANGE = "EU" ;
/** Update the Minimum duration of a time axis item (_Lowerr _Duration) */
const std::string MIN_DURATION_CHANGE = "LD" ;
/** Enable the Minimum duration constraint of a time axis item (_Enable _Lower (Duration)) */
const std::string MIN_DURATION_ENABLE_CHANGE = "EL" ;
/** Refresh the image data of an imageframe item (original image has been altered?) */
const std::string IMAGE_REFRESH = "IR" ;
/** the session sample rate has changed */
const std::string SAMPLE_RATE_CHANGE = "RC" ;
// ------------------------------------------------------------------------- //
// Requestable data items
/** RGB data of the iamge */
// this is probably a bad choice of string !
const std::string IMAGE_RGB_DATA = "ID" ;
/** the (path) name of the Ardour session */
const std::string SESSION_NAME = "SN" ;
/** the current sample rate */
const std::string SAMPLE_RATE = "SR" ;
/** the (path) name of the image compositor session */
const std::string COMPOSITOR_SESSION = "CS" ;
// ------------------------------------------------------------------------- //
// Session Actions - follwed by session path
/** Close a session */
const std::string CLOSE_SESSION = "CS" ;
/** Open a session */
const std::string OPEN_SESSION = "OS" ;
// ------------------------------------------------------------------------- //
// Items
const std::string IMAGEFRAME_TIME_AXIS = "IT" ;
const std::string MARKER_TIME_AXIS = "MT" ;
const std::string IMAGEFRAME_ITEM = "II" ;
const std::string MARKER_ITEM = "MI" ;
/** or an ImageFrameTimeAxisGroup */
const std::string IMAGEFRAME_GROUP = "IG" ;
} /* namespace ardour_visual */
#endif /* __ardour_image_comp_socket_h__ */

View File

@ -177,14 +177,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_internal_edit (bool yn);
bool toggle_internal_editing_from_double_click (GdkEvent*);
#ifdef WITH_CMT
void add_imageframe_time_axis(const std::string & track_name, void*) ;
void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
void connect_to_image_compositor() ;
void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
TimeAxisView* get_named_time_axis(const std::string & name) ;
#endif /* WITH_CMT */
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
void add_to_idle_resize (TimeAxisView*, int32_t);
@ -1420,15 +1412,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void queue_visual_videotimeline_update ();
void embed_audio_from_video (std::string, framepos_t n = 0);
bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
PBD::Signal0<void> EditorFreeze;
PBD::Signal0<void> EditorThaw;
@ -1885,47 +1868,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void nudge_track (bool use_edit_point, bool forwards);
#ifdef WITH_CMT
void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
ImageFrameSocketHandler* image_socket_listener ;
#endif
static const int32_t default_width = 995;
static const int32_t default_height = 765;

View File

@ -53,18 +53,6 @@ enum ItemType {
RightFrameHandle,
StartCrossFadeItem,
EndCrossFadeItem,
#ifdef WITH_CMT
MarkerViewItem,
MarkerTimeAxisItem,
MarkerViewHandleStartItem,
MarkerViewHandleEndItem,
ImageFrameItem,
ImageFrameTimeAxisItem,
ImageFrameHandleStartItem,
ImageFrameHandleEndItem,
#endif
CrossfadeViewItem,
/* don't remove this */

View File

@ -1,330 +0,0 @@
/* This file is not used at the moment. It includes code related to export a
* multiplication graph system that can be used together with the code in
* libs/ardour/export_multiplication.cc and libs/ardour/ardour/export_multiplication.h
* - Sakari Bergen 6.8.2008 -
*/
/*
Copyright (C) 2008 Paul Davis
Author: Sakari Bergen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "export_multiplicator.h"
#include <cassert>
#include "pbd/compose.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace PBD;
#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
ExportMultiplicator::ExportMultiplicator () :
graph (0)
{
add (table);
}
ExportMultiplicator::~ExportMultiplicator ()
{}
void
ExportMultiplicator::set_manager (boost::shared_ptr<ARDOUR::ExportProfileManager> _manager)
{
manager = _manager;
manager->GraphChanged.connect (sigc::mem_fun (*this, &ExportMultiplicator::redraw));
redraw();
}
void
ExportMultiplicator::redraw ()
{
if (!manager) { return; }
graph = &manager->get_graph();
/* Empty table */
table.foreach (sigc::mem_fun (table, &Gtk::Table::remove));
widget_map.clear();
/* Calculate table dimensions */
uint32_t max_width = 0;
GraphLevel max_level = NoLevel;
if (graph->timespans.size() > max_width) {
max_width = graph->timespans.size();
max_level = Timespans;
}
if (graph->channel_configs.size() > max_width) {
max_width = graph->channel_configs.size();
max_level = ChannelConfigs;
}
if (graph->formats.size() > max_width) {
max_width = graph->formats.size();
max_level = Formats;
}
if (graph->filenames.size() > max_width) {
max_width = graph->filenames.size();
max_level = Filenames;
}
table.resize (4, max_width);
std::cout << "Table width: " << max_width << std::endl;
/* Fill table */
for (list<ExportProfileManager::TimespanNodePtr>::const_iterator it = graph->timespans.begin(); it != graph->timespans.end(); ++it) {
draw_timespan (*it, get_bounds (it->get(), Timespans, max_level));
}
for (list<ExportProfileManager::ChannelConfigNodePtr>::const_iterator it = graph->channel_configs.begin(); it != graph->channel_configs.end(); ++it) {
draw_channel_config (*it, get_bounds (it->get(), ChannelConfigs, max_level));
}
for (list<ExportProfileManager::FormatNodePtr>::const_iterator it = graph->formats.begin(); it != graph->formats.end(); ++it) {
draw_format (*it, get_bounds (it->get(), Formats, max_level));
}
for (list<ExportProfileManager::FilenameNodePtr>::const_iterator it = graph->filenames.begin(); it != graph->filenames.end(); ++it) {
draw_filename (*it, get_bounds (it->get(), Filenames, max_level));
}
show_all_children ();
}
std::pair<uint32_t, uint32_t>
ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, GraphLevel current_level, GraphLevel max_level) const
{
assert (current_level != NoLevel && max_level != NoLevel && graph);
uint32_t left_bound = 0;
uint32_t right_bound = 0;
bool left_bound_found = false;
bool (ExportProfileManager::GraphNode::*relation_func) (ExportProfileManager::GraphNode const *) const;
if (max_level < current_level) {
std::cout << "using 'is_ancestor_of'" << std::endl;
relation_func = &ExportProfileManager::GraphNode::is_ancestor_of;
} else if (max_level > current_level) {
std::cout << "using 'is_descendant_of'" << std::endl;
relation_func = &ExportProfileManager::GraphNode::is_descendant_of;
} else {
std::cout << "using 'equals'" << std::endl;
relation_func = &ExportProfileManager::GraphNode::equals;
}
switch (max_level) {
case Timespans:
for (list<ExportProfileManager::TimespanNodePtr>::const_iterator it = graph->timespans.begin(); it != graph->timespans.end(); ++it) {
if (CALL_MEMBER_FN(**it, relation_func) (node)) {
left_bound_found = true;
} else if (!left_bound_found) {
++left_bound;
}
if (left_bound_found && !CALL_MEMBER_FN(**it, relation_func) (node)) {
break;
} else {
++right_bound;
}
}
break;
case ChannelConfigs:
for (list<ExportProfileManager::ChannelConfigNodePtr>::const_iterator it = graph->channel_configs.begin(); it != graph->channel_configs.end(); ++it) {
if (CALL_MEMBER_FN(**it, relation_func) (node)) {
left_bound_found = true;
} else if (!left_bound_found) {
++left_bound;
}
if (left_bound_found && !CALL_MEMBER_FN(**it, relation_func) (node)) {
break;
} else {
++right_bound;
}
}
break;
case Formats:
for (list<ExportProfileManager::FormatNodePtr>::const_iterator it = graph->formats.begin(); it != graph->formats.end(); ++it) {
if (CALL_MEMBER_FN(**it, relation_func) (node)) {
left_bound_found = true;
} else if (!left_bound_found) {
++left_bound;
}
if (left_bound_found && !CALL_MEMBER_FN(**it, relation_func) (node)) {
break;
} else {
++right_bound;
}
}
break;
case Filenames:
for (list<ExportProfileManager::FilenameNodePtr>::const_iterator it = graph->filenames.begin(); it != graph->filenames.end(); ++it) {
if (CALL_MEMBER_FN(**it, relation_func) (node)) {
std::cout << "filename relation check returned true" << std::endl;
left_bound_found = true;
} else if (!left_bound_found) {
std::cout << "filename relation check returned false" << std::endl;
++left_bound;
}
if (left_bound_found && !CALL_MEMBER_FN(**it, relation_func) (node)) {
break;
} else {
++right_bound;
}
}
break;
case NoLevel:
// Not reached !
break;
}
return std::pair<uint32_t, uint32_t> (left_bound, right_bound);
}
void
ExportMultiplicator::draw_timespan (ARDOUR::ExportProfileManager::TimespanNodePtr node, std::pair<uint32_t, uint32_t> bounds)
{
ButtonWidget * button = Gtk::manage (new ButtonWidget (string_compose ("Timespan %1", node->id()), manager, node.get()));
get_hbox (TablePosition (bounds.first, bounds.second, Timespans))->pack_end (*button, true, true);
}
void
ExportMultiplicator::draw_channel_config (ARDOUR::ExportProfileManager::ChannelConfigNodePtr node, std::pair<uint32_t, uint32_t> bounds)
{
ButtonWidget * button = Gtk::manage (new ButtonWidget (string_compose ("Channel config %1", node->id()), manager, node.get()));
get_hbox (TablePosition (bounds.first, bounds.second, ChannelConfigs))->pack_end (*button, true, true);
}
void
ExportMultiplicator::draw_format (ARDOUR::ExportProfileManager::FormatNodePtr node, std::pair<uint32_t, uint32_t> bounds)
{
ButtonWidget * button = Gtk::manage (new ButtonWidget (string_compose ("Format %1", node->id()), manager, node.get()));
get_hbox (TablePosition (bounds.first, bounds.second, Formats))->pack_end (*button, true, true);
}
void
ExportMultiplicator::draw_filename (ARDOUR::ExportProfileManager::FilenameNodePtr node, std::pair<uint32_t, uint32_t> bounds)
{
ButtonWidget * button = Gtk::manage (new ButtonWidget (string_compose ("Filename %1", node->id()), manager, node.get()));
get_hbox (TablePosition (bounds.first, bounds.second, Filenames))->pack_end (*button, true, true);
}
boost::shared_ptr<Gtk::HBox>
ExportMultiplicator::get_hbox (TablePosition position)
{
WidgetMap::iterator it = widget_map.find (position);
if (it != widget_map.end()) { return it->second; }
boost::shared_ptr<Gtk::HBox> widget = widget_map.insert (WidgetPair (position, boost::shared_ptr<Gtk::HBox> (new Gtk::HBox ()))).first->second;
table.attach (*widget, position.left, position.right, position.row - 1, position.row);
return widget;
}
ExportMultiplicator::ButtonWidget::ButtonWidget (std::string name, boost::shared_ptr<ExportProfileManager> m, ExportProfileManager::GraphNode * node) :
label (name),
node (node),
split_position (0.5)
{
manager = m;
menu_actions = Gtk::ActionGroup::create();
menu_actions->add (Gtk::Action::create ("Split", _("_Split here")), sigc::mem_fun (*this, &ExportMultiplicator::ButtonWidget::split));
menu_actions->add (Gtk::Action::create ("Remove", _("_Remove")), sigc::mem_fun (*this, &ExportMultiplicator::ButtonWidget::remove));
ui_manager = Gtk::UIManager::create();
ui_manager->insert_action_group (menu_actions);
std::string ui_info =
"<ui>"
" <popup name='PopupMenu'>"
" <menuitem action='Split'/>"
" <menuitem action='Remove'/>"
" </popup>"
"</ui>";
ui_manager->add_ui_from_string (ui_info);
menu = dynamic_cast<Gtk::Menu*> (ui_manager->get_widget ("/PopupMenu"));
add_events (Gdk::BUTTON_PRESS_MASK);
signal_button_press_event ().connect (sigc::mem_fun (*this, &ExportMultiplicator::ButtonWidget::on_button_press_event));
modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("#0000"));
set_border_width (1);
vbox.pack_start (label, true, true, 4);
add (vbox);
}
bool
ExportMultiplicator::ButtonWidget::on_button_press_event (GdkEventButton* event)
{
if(event->type != GDK_BUTTON_PRESS) { return false; }
if (event->button == 1) {
node->select (!node->selected ());
if (node->selected ()) {
unset_bg (Gtk::STATE_NORMAL);
modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("#194756"));
} else {
unset_bg (Gtk::STATE_NORMAL);
modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("#0000"));
}
return true;
} else if (event->button == 3) {
int x, y;
get_pointer (x, y);
split_position = (float) x / get_width();
menu->popup (event->button, event->time);
return true;
}
return false;
}
void
ExportMultiplicator::ButtonWidget::split ()
{
manager->split_node (node, split_position);
}
void
ExportMultiplicator::ButtonWidget::remove ()
{
manager->remove_node (node);
}

View File

@ -1,120 +0,0 @@
/* This file is not used at the moment. It includes code related to export a
* multiplication graph system that can be used together with the code in
* libs/ardour/export_multiplication.cc and libs/ardour/ardour/export_multiplication.h
* - Sakari Bergen 6.8.2008 -
*/
/*
Copyright (C) 2008 Paul Davis
Author: Sakari Bergen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __export_multiplicator_h__
#define __export_multiplicator_h__
#include <utility>
#include <map>
#include "ardour/export_profile_manager.h"
#include <gtkmm.h>
#include <boost/shared_ptr.hpp>
using ARDOUR::ExportProfileManager;
class ExportMultiplicator : public Gtk::EventBox {
public:
ExportMultiplicator ();
~ExportMultiplicator ();
void set_manager (boost::shared_ptr<ExportProfileManager> _manager);
private:
boost::shared_ptr<ExportProfileManager> manager;
ExportProfileManager::MultiplicationGraph const * graph;
/* Drawing stuff */
Gtk::Table table;
void redraw ();
enum GraphLevel {
NoLevel = 0,
Timespans = 1,
ChannelConfigs = 2,
Formats = 3,
Filenames = 4
};
std::pair<uint32_t, uint32_t> get_bounds (ExportProfileManager::GraphNode * node, GraphLevel current_level, GraphLevel max_level) const;
void draw_timespan (ExportProfileManager::TimespanNodePtr node, std::pair<uint32_t, uint32_t> bounds);
void draw_channel_config (ExportProfileManager::ChannelConfigNodePtr node, std::pair<uint32_t, uint32_t> bounds);
void draw_format (ExportProfileManager::FormatNodePtr node, std::pair<uint32_t, uint32_t> bounds);
void draw_filename (ExportProfileManager::FilenameNodePtr node, std::pair<uint32_t, uint32_t> bounds);
struct TablePosition {
uint32_t left;
uint32_t right;
uint32_t row;
TablePosition (uint32_t left, uint32_t right, uint32_t row) :
left (left), right (right), row (row) {}
bool operator== (TablePosition const & other) const { return (row == other.row && left == other.left && right == other.right); }
bool operator< (TablePosition const & other) const { return (row < other.row || left < other.left || right < other.right); }
};
typedef std::map<TablePosition, boost::shared_ptr<Gtk::HBox> > WidgetMap;
typedef std::pair<TablePosition, boost::shared_ptr<Gtk::HBox> > WidgetPair;
boost::shared_ptr<Gtk::HBox> get_hbox (TablePosition position);
WidgetMap widget_map;
/* Button Widget */
class ButtonWidget : public Gtk::EventBox {
public:
ButtonWidget (std::string name, boost::shared_ptr<ExportProfileManager> m, ExportProfileManager::GraphNode * node);
private:
Gtk::Label label;
Gtk::VBox vbox;
bool on_button_press_event (GdkEventButton* event);
void split ();
void remove ();
boost::shared_ptr<ExportProfileManager> manager;
ExportProfileManager::GraphNode * node;
float split_position;
/* Context menu */
Glib::RefPtr<Gtk::ActionGroup> menu_actions;
Glib::RefPtr<Gtk::UIManager> ui_manager;
Gtk::Menu * menu;
};
};
#endif /* __export_multiplicator_h__ */

View File

@ -1,66 +0,0 @@
/*
Copyright (C) 2000-2007 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// -*- c++ -*-
#ifndef _LIBGNOMECANVASMM_IMAGEFRAME_P_H
#define _LIBGNOMECANVASMM_IMAGEFRAME_P_H
#include <glibmm/class.h>
namespace Gnome
{
namespace Canvas
{
class ImageFrame_Class : public Glib::Class
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef ImageFrame CppObjectType;
typedef GnomeCanvasImageFrame BaseObjectType;
typedef GnomeCanvasImageFrameClass BaseClassType;
typedef Shape_Class CppClassParent;
typedef GnomeCanvasItemClass BaseClassParent;
friend class ImageFrame;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
const Glib::Class& init();
static void class_init_function(void* g_class, void* class_data);
static Glib::ObjectBase* wrap_new(GObject*);
protected:
//Callbacks (default signal handlers):
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
//You could prevent the original default signal handlers being called by overriding the *_impl method.
//Callbacks (virtual functions):
};
} // namespace Canvas
} // namespace Gnome
#endif /* _LIBGNOMECANVASMM_IMAGEFRAME_P_H */

View File

@ -1,703 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_gtk_imageframe_socket_handler_h__
#define __ardour_gtk_imageframe_socket_handler_h__
#include <string>
#include <list>
#include "ardour_image_compositor_socket.h"
class TimeAxisViewItem ;
class ImageFrameView ;
class MarkerView ;
class ImageFrameTimeAxisGroup ;
class Editor ;
/**
* ImageFrameSocketHandler defines the handler between Ardour and an Image Compositor
* As this is purely visual, we do all processing within the main gtk loop via
* message passing through a socket.
*
*/
class ImageFrameSocketHandler : public sigc::trackable
{
public:
/**
* Constructs a new ImageFrameSocketHandler to handle communication between Ardour and the Image Compositor
*
* @param ed the PublicEditor
*/
ImageFrameSocketHandler(PublicEditor& ed) ;
/**
* Descructor
* this will shutdown the socket if open
*/
virtual ~ImageFrameSocketHandler() ;
/**
* Returns the instance of the ImageFrameSocketHandler
* the instance should first be created with createInstance
*
* @return the instance of the ImageFrameSocketHandler
*/
static ImageFrameSocketHandler* get_instance() ;
/**
* call back to handle doing the processing work
* This method is added to the gdk main loop and called when there is data
* upon the socket.
*
*/
static void image_socket_callback(void *arg, int32_t fd, GdkInputCondition cond) ;
/**
* Attempt to connect to the image compositor on the specified host and port
*
* @param hostIp the ip address of the image compositor host
* @param port the oprt number to attemp the connection on
* @return true if the connection was a succees
* false otherwise
*/
bool connect(const char * hostIp, int32_t port) ;
/**
* Closes the connection to th Image Compositor
*
*/
void close_connection() ;
/**
* Returns true if this ImagFrameSocketHandler is currently connected to rthe image compositor
*
* @return true if connected to the image compositor
*/
bool is_connected() ;
/**
* Sets the tag used to describe this input within gtk
* this is returned when gdk_input_add is called and is required to remove the input
*
* @param tag the gdk input tag of this input
*/
void set_gdk_input_tag(int tag) ;
/**
* Returns the gdk input tag of this input
*
* @return the gdk input tag of this input
* @see setGdkInputTag
*/
int get_gdk_input_tag() ;
/**
* Returns the socket file descriptor
*
* @return the Sockt file descriptor
*/
int get_socket_descriptor() ;
//---------------------------------------------------------------------------------------//
// Handle Sending messages to the Image Compositor
//----------------------------
// ImageFrameTimeAxis Messages
/**
* Sends a message stating that the named image frame time axis has been removed
*
* @param track_id the unique id of the removed image frame time axis
* @param src the identity of the object that initiated the change
*/
void send_imageframe_time_axis_removed(const std::string & track_id, void* src) ;
/**
* Sends a message indicating that an ImageFrameTimeAxis has been renamed
*
* @param new_id the new name, or Id, of the track
* @param old_id the old name, or Id, of the track
* @param src the identity of the object that initiated the change
* @param time_axis the time axis that has changed
*/
void send_imageframe_time_axis_renamed(const std::string & new_id, const std::string & old_id, void* src, ImageFrameTimeAxis* time_axis) ;
//------------------------
// MarkerTimeAxis Messages
/**
* Sends a message stating that the named marker time axis has been removed
*
* @param track_id the unique id of the removed image frame time axis
* @param src the identity of the object that initiated the change
*/
void send_marker_time_axis_removed(const std::string & track_id, void* src) ;
/**
* Sends a message indicating that an MarkerTimeAxis has been renamed
*
* @param new_id the new name, or Id, of the track
* @param old_id the old name, or Id, of the track
* @param src the identity of the object that initiated the change
* @param time_axis the time axis that has changed
*/
void send_marker_time_axis_renamed(const std::string & new_id, const std::string & old_id, void* src, MarkerTimeAxis* time_axis) ;
//---------------------------------
// ImageFrameTimeAxisGroup Messages
/**
* Sends a message stating that the group has been removed
*
* @param group_id the unique id of the removed image frame time axis
* @param src the identity of the object that initiated the change
* @param group the group that has changed
*/
void send_imageframe_time_axis_group_removed(const std::string & group_id, void* src, ImageFrameTimeAxisGroup* group) ;
/**
* Send a message indicating that an ImageFrameTimeAxisGroup has been renamed
*
* @param new_id the new name, or Id, of the group
* @param old_id the old name, or Id, of the group
* @param src the identity of the object that initiated the change
* @param group the group that has changed
*/
void send_imageframe_time_axis_group_renamed(const std::string & new_id, const std::string & old_id, void* src, ImageFrameTimeAxisGroup* group) ;
//---------------------------------
// ImageFrameView Messages
/**
* Send an Image Frame View Item position changed message
*
* @param pos the new position value
* @param src the identity of the object that initiated the change
* @param item the time axis item whos position has changed
*/
void send_imageframe_view_position_change(nframes_t pos, void* src, ImageFrameView* item) ;
/**
* Send a Image Frame View item duration changed message
*
* @param dur the the new duration value
* @param src the identity of the object that initiated the change
* @param item the item which has had a duration change
*/
void send_imageframe_view_duration_change(nframes_t dur, void* src, ImageFrameView* item) ;
/**
* Send a message indicating that an ImageFrameView has been renamed
*
* @param item the ImageFrameView which has been renamed
* @param src the identity of the object that initiated the change
* @param item the renamed item
*/
void send_imageframe_view_renamed(const std::string & new_id, const std::string & old_id, void* src, ImageFrameView* item) ;
/**
* Send a message indicating that an ImageFrameView item has been removed message
*
* @param item_id the id of the item that was removed
* @param src the identity of the object that initiated the change
* @param item the removed item
*/
void send_imageframe_view_removed(const std::string & item_id, void* src, ImageFrameView* item) ;
//---------------------------------
// MarkerView Messages
/**
* Send a Marker View Item position changed message
*
* @param pos the new position value
* @param src the identity of the object that initiated the change
* @param item the time axis item whos position has changed
*/
void send_marker_view_position_change(nframes_t pos, void* src, MarkerView* item) ;
/**
* Send a Marker View item duration changed message
*
* @param dur the new duration value
* @param src the identity of the object that initiated the change
* @param item the time axis item whos position has changed
*/
void send_marker_view_duration_change(nframes_t dur, void* src, MarkerView* item) ;
/**
* Send a message indicating that a MarkerView has been renamed
*
* @param new_id the new_id of the object
* @param old_id the old_id of the object
* @param src the identity of the object that initiated the change
* @param item the MarkerView which has been renamed
*/
void send_marker_view_renamed(const std::string & new_id, const std::string & old_id, void* src, MarkerView* item) ;
/**
* Send a message indicating that a MarkerView item has been removed message
*
* @param item_id the id of the item that was removed
* @param src the identity of the object that initiated the change
* @param item the MarkerView which has been removed
*/
void send_marker_view_removed(const std::string & item_id, void* src, MarkerView* item) ;
//---------------------------------------------------------------------------------------//
// Emitted Signals
/** Emitted if the socket connection is shutdown at the other end */
sigc::signal<void> CompositorSocketShutdown ;
/** Emitted as a generic error is captured from the socket connection to the animatic compositor */
sigc::signal<void> CompositorSocketError ;
protected:
private:
/* I dont like friends :-( */
friend class Editor;
/**
* Create an new instance of the ImageFrameSocketHandler, if one does not already exist
*
* @param ed the Ardour PublicEditor
*/
static ImageFrameSocketHandler* create_instance(PublicEditor& ed) ;
//---------------------------------------------------------------------------------------//
// Message breakdown ie avoid a big if...then...else
/**
* Handle insert item requests
*
* @param msg the received message
*/
void handle_insert_message(const char* msg) ;
/**
* Handle remove item requests
*
* @param msg the received message
*/
void handle_remove_message(const char* msg) ;
/**
* Handle rename item requests
*
* @param msg the received message
*/
void handle_rename_message(const char* msg) ;
/**
* Handle a request for session information
*
* @param msg the received message
*/
void handle_request_data(const char* msg) ;
/**
* Handle the update of a particular item
*
* @param msg the received message
*/
void handle_item_update_message(const char* msg) ;
/**
* Handle the selection of an Item
*
* @param msg the received message
*/
void handle_item_selected(const char* msg) ;
/**
* Handle s session action message
*
* @param msg the received message
*/
void handle_session_action(const char* msg) ;
//---------------------------------------------------------------------------------------//
// handlers for specific insert procedures
/**
* Handle the insertion of a new ImaegFrameTimeAxis
*
* @param msg the received message
*/
void handle_insert_imageframe_time_axis(const char* msg) ;
/**
* Handle the insertion of a new MarkerTimeAxis
*
* @param msg the received message
*/
void handle_insert_marker_time_axis(const char* msg) ;
/**
* Handle the insertion of a time axis group (a scene)
*
* @param msg the received message
*/
void handle_insert_imageframe_group(const char* msg) ;
/**
* Handle the insertion of a new ImageFrameItem
*
* @param msg the received message
*/
void handle_insert_imageframe_view(const char* msg) ;
/**
* Handle the insertion of a new MarkerItem
*
* @param msg the received message
*/
void handle_insert_marker_view(const char* msg) ;
//---------------------------------------------------------------------------------------//
// handlers for specific removal procedures
/**
* Handle the removal of an ImageTimeAxis
*
* @param msg the received message
*/
void handle_remove_imageframe_time_axis(const char* msg) ;
/**
* Handle the removal of an MarkerTimeAxis
*
* @param msg the received message
*/
void handle_remove_marker_time_axis(const char* msg) ;
/**
* Handle the removal of an ImageFrameTimeAxisGroup
*
* @param msg the received message
*/
void handle_remove_imageframe_time_axis_group(const char* msg) ;
/**
* Handle the removal of an ImageFrameItem
*
* @param msg the received message
*/
void handle_remove_imageframe_view(const char* msg) ;
/**
* Handle the removal of an MarkerItem
*
* @param msg the received message
*/
void handle_remove_marker_view(const char* msg) ;
//---------------------------------------------------------------------------------------//
// handlers for the specific rename procedures
/**
* Handle the renaming of an ImageTimeAxis
*
* @param msg the received message
*/
void handle_rename_imageframe_time_axis(const char* msg) ;
/**
* Handle the renaming of an MarkerTimeAxis
*
* @param msg the received message
*/
void handle_rename_marker_time_axis(const char* msg) ;
/**
* Handle the renaming of an ImageFrameItem
*
* @param msg the received message
*/
void handle_rename_imageframe_time_axis_group(const char* msg) ;
/**
* Handle the renaming of an ImageFrameItem
*
* @param msg the received message
*/
void handle_rename_imageframe_view(const char* msg) ;
/**
* Handle the renaming of an Marker
*
* @param msg the received message
*/
void handle_rename_marker_view(const char* msg) ;
//---------------------------------------------------------------------------------------//
// handlers for data request
/**
* Handle a request for the sessnio naem fo the current session
* We return a failure state if no session is open
*
* @param msg the received message
*/
void handle_session_name_request(const char* msg) ;
//---------------------------------------------------------------------------------------//
// handlers for specific item update changes
/**
* Handle ImageFrameView positional changes
*
* @param msg the received message
*/
void handle_imageframe_view_position_update(const char* msg) ;
/**
* Handle ImageFrameView Duration changes
*
* @param msg the received message
*/
void handle_imageframe_view_duration_update(const char* msg) ;
/**
* Handle ImageFrameView Position Lock Constraint changes
*
* @param msg the received message
*/
void handle_imageframe_position_lock_update(const char* msg) ;
/**
* Handle ImageFrameView Maximum Duration changes
*
* @param msg the received message
*/
void handle_imageframe_view_max_duration_update(const char* msg) ;
/**
* Handle image frame max duration enable constraint changes
*
* @param msg the received message
*/
void handle_imageframe_view_max_duration_enable_update(const char* msg) ;
/**
* Handle ImageFrameView Minimum Duration changes
*
* @param msg the received message
*/
void handle_imageframe_view_min_duration_update(const char* msg) ;
/**
* Handle image frame min duration enable constraint changes
*
* @param msg the received message
*/
void handle_imageframe_view_min_duration_enable_update(const char* msg) ;
/**
* Handle MarkerView position changes
*
* @param msg the received message
*/
void handle_marker_view_position_update(const char* msg) ;
/**
* Handle MarkerView duration changes
*
* @param msg the received message
*/
void handle_marker_view_duration_update(const char* msg) ;
/**
* Handle MarkerView Position Lock Constraint changes
*
* @param msg the received message
*/
void handle_marker_view_position_lock_update(const char* msg) ;
/**
* Handle MarkerView maximum duration changes
*
* @param msg the received message
*/
void handle_marker_view_max_duration_update(const char* msg) ;
/**
* Handle MarkerView minimum duration changes
*
* @param msg the received message
*/
void handle_marker_view_min_duration_update(const char* msg) ;
//---------------------------------------------------------------------------------------//
// handlers for Session Actions
/**
* Handle the opening of a named audio session
*
* @param msg the received message
*/
void handle_open_session(const char* msg) ;
/**
* Handle the closing of a named audio session
*
* @param msg the received message
*/
void handle_closed_session(const char* msg) ;
//---------------------------------------------------------------------------------------//
// handlers for the shutdown of the Image Compositor
/**
* Handle the shutdown message from the image compositor
*
* @param msg the received message
*/
void handle_shutdown(const char* msg) ;
//---------------------------------------------------------------------------------------//
// convenince methods to break up messages
/**
* Returns part of the received message as a std::string
*
* @param start the start character
* @param num_chars the number of characters to read
* @param the message to break apart
* @return the sub std::string of the message
*/
std::string get_message_part(int start, int32_t num_chars, const char* msg) ;
/**
* break up am image item description message
* we break the mesage up into the parent Image Track id and size,
* the parent group id and size, and the image id and size
*
* @param track_id
* @param track_id_size
* @param scene_id
* @param scene_id_size
* @param item_id
* @param item_id_size
*/
void decompose_imageframe_item_desc(const char* msg, int& position, std::string& track_id, int& track_id_size, std::string& scene_id, int& scene_id_size, std::string& item_id, int& item_id_size) ;
/**
* Compose a description of the specified image frame view
* The description consists of the parent track name size and name,
* the parent group name size and name, and the item name size and name
*
* @param ifv the item to compose a description of
* @param buffer the buffer to write the description
*/
void compose_imageframe_item_desc(ImageFrameView* ifv, std::ostringstream& buffer) ;
/**
* Compose a description of the specified marker view
* The description consists of the parent track name size and name,
* and the item name size and name
*
* @param mv the item to compose a description of
* @param buffer the buffer to write the description
*/
void compose_marker_item_desc(MarkerView* mv, std::ostringstream& buffer) ;
/**
* Returns the ImageFrameView from the specified description
* The errcode parameter is used to indicate the item which caused
* an error on failure of this method
* 0 = suces
* 1 = the track item was not found
* 2 = the group item was not found
* 3 = the imageframe item was not found
*
* @paran track_id the track on which the item is placed
* @param group_id the group in which the item is a member
* @param item_id the id of the item
* @param int32_t reference used for error codes on failure
* @param errmsg populated with a description of the error on failure
* @return the described item on success, 0 otherwise
*/
ImageFrameView* get_imageframe_view_from_desc(const std::string & track_id, const std::string & group_ud, const std::string & item_id, int& errcode, std::string& errmsg) ;
//---------------------------------------------------------------------------------------//
// Convenince Message Send Methods
/**
* Sends a message throught the socket
*
* @param msg the message to send
* @return the return value of the socket call
*/
int send_message(const std::string & msg) ;
/**
* Reads a message from the Socket
*
* @param msg a std::string to populate with the received message
* @return the return value from the socket call
*/
int read_message(std::string& msg) ;
/**
* Convenience method to compose and send a success messasge back to the Image Compositor
*
*/
void send_return_success() ;
/**
* Convenience method to compose and send a failure messasge back to the Image Compositor
*
* @param msg the failure message
*/
void send_return_failure(const std::string& msg) ;
//---------------------------------------------------------------------------------------//
// Memebr Data
/** Our instance of the socket handler, singleton */
static ImageFrameSocketHandler* _instance ;
/** The Ardour PublicEditor */
PublicEditor& thePublicEditor ;
/** the socket file descriptor */
int theArdourToCompositorSocket ;
/** This stores the 'tag' returned from gdk_input_add, which is required for removing the input */
int theGdkInputTag ;
} ; /* class ImageFrameSocketHandler */
#endif /* __ardour_gtk_imageframe_socket_handler_h__ */

View File

@ -1,420 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string>
#include <algorithm>
#include "pbd/error.h"
#include <gtkmm/menu.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/gtk_ui.h>
#include "ardour/session.h"
#include "ardour/utils.h"
#include "public_editor.h"
#include "imageframe_time_axis.h"
#include "enums.h"
#include "imageframe_time_axis_view.h"
#include "imageframe_time_axis_group.h"
#include "marker_time_axis_view.h"
#include "imageframe_view.h"
#include "marker_time_axis.h"
#include "marker_view.h"
#include "gui_thread.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace PBD;
using namespace Gtk;
/**
* Constructs a new ImageFrameTimeAxis.
*
* @param track_id the track name/id
* @param ed the PublicEditor
* @param sess the current session
* @param canvas the parent canvas item
*/
ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas)
: AxisView(sess),
VisualTimeAxis(track_id, ed, sess, canvas)
{
_color = unique_random_color() ;
selection_group = new ArdourCanvas::Group (*canvas_display);
selection_group->hide();
// intialize our data items
y_position = -1 ;
/* create our new image frame view */
view = new ImageFrameTimeAxisView(*this) ;
/* create the Image Frame Edit Menu */
create_imageframe_menu() ;
// set the initial time axis text label
label_view() ;
// set the initial height of this time axis
set_height(hNormal) ;
TimeAxisView::CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxis::remove_time_axis_view, this, _1), gui_context());
}
/**
* Destructor
* Responsible for destroying any child image items that may have been added to thie time axis
*/
ImageFrameTimeAxis::~ImageFrameTimeAxis ()
{
CatchDeletion (this);
// Destroy all the marker views we may have associaited with this TimeAxis
for(MarkerTimeAxisList::iterator iter = marker_time_axis_list.begin(); iter != marker_time_axis_list.end(); ++iter)
{
MarkerTimeAxis* mta = *iter ;
MarkerTimeAxisList::iterator next = iter ;
next++ ;
marker_time_axis_list.erase(iter) ;
delete mta ;
mta = 0 ;
iter = next ;
}
delete image_action_menu ;
image_action_menu = 0 ;
delete selection_group;
selection_group = 0 ;
// Destroy our Axis View helper
delete view ;
view = 0 ;
}
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of this TrackView to one of ths TrackHeghts
*
* @param h
*/
void
ImageFrameTimeAxis::set_height (uint32_t h)
{
VisualTimeAxis::set_height(h) ;
// tell out view helper of the change too
if(view != 0)
{
view->set_height((double) height) ;
}
// tell those interested that we have had our height changed
gui_changed("track_height",(void*)0); /* EMIT_SIGNAL */
}
/**
* Sets the number of frames per pixel that are used.
* This is used to determine the siezes of items upon this time axis
*
* @param fpp the number of frames per pixel
*/
void
ImageFrameTimeAxis::set_samples_per_pixel (double fpp)
{
TimeAxisView::set_samples_per_pixel (editor.get_current_zoom ());
if (view) {
view->set_samples_per_pixel (fpp);
}
}
/**
* Returns the available height for images to be drawn onto
*
* @return the available height for an image item to be drawn onto
*/
int
ImageFrameTimeAxis::get_image_display_height()
{
return(height - (gint)TimeAxisViewItem::NAME_HIGHLIGHT_SIZE) ;
}
/**
* Show the popup edit menu
*
* @param button the mouse button pressed
* @param time when to show the popup
* @param clicked_imageframe the ImageFrameItem that the event ocured upon, or 0 if none
* @param with_item true if an item has been selected upon the time axis, used to set context menu
*/
void
ImageFrameTimeAxis::popup_imageframe_edit_menu(int button, int32_t time, ImageFrameView* clicked_imageframe, bool with_item)
{
if (!imageframe_menu)
{
create_imageframe_menu() ;
}
if(with_item)
{
imageframe_item_menu->set_sensitive(true) ;
}
else
{
imageframe_item_menu->set_sensitive(false) ;
}
imageframe_menu->popup(button,time) ;
}
/**
* convenience method to select a new track color and apply it to the view and view items
*
*/
void
ImageFrameTimeAxis::select_track_color()
{
if (choose_time_axis_color())
{
if (view)
{
view->apply_color (_color) ;
}
}
}
/**
* Handles the building of the popup menu
*/
void
ImageFrameTimeAxis::build_display_menu()
{
using namespace Menu_Helpers;
using Gtk::Menu;
/* get the size menu ready */
build_size_menu();
/* prepare it */
TimeAxisView::build_display_menu () ;
/* now fill it with our stuff */
MenuList& items = display_menu->items();
items.push_back (MenuElem (_("Rename"), sigc::mem_fun(*this, &ImageFrameTimeAxis::start_time_axis_rename)));
image_action_menu = new Menu() ;
image_action_menu->set_name ("ArdourContextMenu");
MenuList image_items = image_action_menu->items() ;
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Height"), *size_menu));
items.push_back (MenuElem (_("Color"), sigc::mem_fun(*this, &ImageFrameTimeAxis::select_track_color)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Remove"), sigc::bind(sigc::mem_fun(*this, &VisualTimeAxis::remove_this_time_axis), (void*)this))) ;
}
/**
* handles the building of the ImageFrameView sub menu
*/
void
ImageFrameTimeAxis::create_imageframe_menu()
{
using namespace Menu_Helpers;
using Gtk::Menu;
imageframe_menu = manage(new Menu) ;
imageframe_menu->set_name ("ArdourContextMenu");
MenuList& items = imageframe_menu->items();
imageframe_item_menu = manage(new Menu) ;
imageframe_item_menu->set_name ("ArdourContextMenu");
MenuList& imageframe_sub_items = imageframe_item_menu->items() ;
/* duration menu */
Menu* duration_menu = manage(new Menu) ;
duration_menu->set_name ("ArdourContextMenu");
MenuList& duration_items = duration_menu->items() ;
if(view)
{
duration_items.push_back(MenuElem (_("0.5 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 0.5))) ;
duration_items.push_back(MenuElem (_("1 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 1.0))) ;
duration_items.push_back(MenuElem (_("1.5 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 1.5))) ;
duration_items.push_back(MenuElem (_("2 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 2.0))) ;
duration_items.push_back(MenuElem (_("2.5 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 2.5))) ;
duration_items.push_back(MenuElem (_("3 seconds"), sigc::bind (sigc::mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 3.0))) ;
//duration_items.push_back(SeparatorElem()) ;
//duration_items.push_back(MenuElem (_("custom"), sigc::mem_fun(*this, &ImageFrameTimeAxis::set_imageframe_duration_custom))) ;
}
imageframe_sub_items.push_back(MenuElem(_("Duration (sec)"), *duration_menu)) ;
imageframe_sub_items.push_back(SeparatorElem()) ;
if(view)
{
imageframe_sub_items.push_back(MenuElem (_("Remove Frame"), sigc::bind(sigc::mem_fun (view, &ImageFrameTimeAxisView::remove_selected_imageframe_item), (void*)this))) ;
}
items.push_back(MenuElem(_("Image Frame"), *imageframe_item_menu)) ;
items.push_back(MenuElem (_("Rename Track"), sigc::mem_fun(*this,&ImageFrameTimeAxis::start_time_axis_rename))) ;
imageframe_menu->show_all() ;
}
//---------------------------------------------------------------------------------------//
// Marker Time Axis Methods
/**
* Add a MarkerTimeAxis to the ilst of MarkerTimeAxis' associated with this ImageFrameTimeAxis
*
* @param marker_track the MarkerTimeAxis to add
* @param src the identity of the object that initiated the change
* @return true if the addition was a success,
* false otherwise
*/
bool
ImageFrameTimeAxis::add_marker_time_axis(MarkerTimeAxis* marker_track, void* src)
{
bool ret = false ;
if(get_named_marker_time_axis(marker_track->name()) != 0)
{
ret = false ;
}
else
{
marker_time_axis_list.push_back(marker_track) ;
MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */
ret = true ;
}
return(ret) ;
}
/**
* Returns the named MarkerTimeAxis associated with this ImageFrameTimeAxis
*
* @param track_id the track_id of the MarkerTimeAxis to search for
* @return the named markerTimeAxis, or 0 if the named MarkerTimeAxis is not associated with this ImageFrameTimeAxis
*/
MarkerTimeAxis*
ImageFrameTimeAxis::get_named_marker_time_axis(const string & track_id)
{
MarkerTimeAxis* mta = 0 ;
for (MarkerTimeAxisList::iterator i = marker_time_axis_list.begin(); i != marker_time_axis_list.end(); ++i)
{
if (((MarkerTimeAxis*)*i)->name() == track_id)
{
mta = ((MarkerTimeAxis*)*i) ;
break ;
}
}
return(mta) ;
}
/**
* Removes the named markerTimeAxis from those associated with this ImageFrameTimeAxis
*
* @param track_id the track id of the MarkerTimeAxis to remove
* @param src the identity of the object that initiated the change
* @return the removed MarkerTimeAxis
*/
MarkerTimeAxis*
ImageFrameTimeAxis::remove_named_marker_time_axis(const string & track_id, void* src)
{
MarkerTimeAxis* mta = 0 ;
for(MarkerTimeAxisList::iterator i = marker_time_axis_list.begin(); i != marker_time_axis_list.end(); ++i)
{
if (((MarkerTimeAxis*)*i)->name() == track_id)
{
mta = ((MarkerTimeAxis*)*i) ;
// the iterator is invalid after this call, so we can no longer use it as is.
marker_time_axis_list.erase(i) ;
MarkerTimeAxisRemoved(mta->name(), src) ; /* EMIT_SIGNAL */
break ;
}
}
return(mta) ;
}
/**
* Removes the specified MarkerTimeAxis from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis
* Note that the MarkerTimeAxis is not deleted, only removed from the list os associated tracks
*
* @param mta the TimeAxis to remove
* @param src the identity of the object that initiated the change
*/
void
ImageFrameTimeAxis::remove_time_axis_view (TimeAxisView* tav)
{
MarkerTimeAxisView* mtav = dynamic_cast<MarkerTimeAxisView*> (tav);
if (!mtav) {
return;
}
MarkerTimeAxisList::iterator i;
if ((i = find (marker_time_axis_list.begin(), marker_time_axis_list.end(), mta)) != marker_time_axis_list.end()) {
// note that we dont delete the object itself, we just remove it from our list
marker_time_axis_list.erase(i) ;
MarkerTimeAxisRemoved (mta->name(), src) ; /* EMIT_SIGNAL */
}
}
//---------------------------------------------------------------------------------------//
// Parent/Child helper object accessors
/**
* Returns the view helper of this TimeAxis
*
* @return the view helper of this TimeAxis
*/
ImageFrameTimeAxisView*
ImageFrameTimeAxis::get_view()
{
return(view) ;
}

View File

@ -1,195 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_imageframe_time_axis_h__
#define __ardour_imageframe_time_axis_h__
#include <list>
#include "ardour_dialog.h"
#include "enums.h"
#include "time_axis_view.h"
#include "visual_time_axis.h"
namespace ARDOUR
{
class Session ;
}
namespace Gtk {
class Menu;
}
class PublicEditor ;
class ImageFrameView ;
class ImageFrameTimeAxisView ;
class MarkersTimeAxisView ;
class MarkerTimeAxis;
/**
* ImageFrameTimeAxis defines a visual time axis view for holding and arranging image items.
*
*/
class ImageFrameTimeAxis : public VisualTimeAxis
{
public:
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new ImageFrameTimeAxis.
*
* @param track_id the track name/id
* @param ed the PublicEditor
* @param sess the current session
* @param canvas the parent canvas item
*/
ImageFrameTimeAxis(const std::string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ;
/**
* Destructor
* Responsible for destroying any child image items that may have been added to thie time axis
*/
virtual ~ImageFrameTimeAxis() ;
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of this TrackView to one of ths TrackHeghts
*
* @param h the number of pixels to set the height too
*/
virtual void set_height(uint32_t h) ;
virtual void set_samples_per_pixel (double);
/**
* Returns the available height for images to be drawn onto
*
* @return the available height for an image item to be drawn onto
*/
int get_image_display_height() ;
/**
* Show the popup edit menu
*
* @param button the mouse button pressed
* @param time when to show the popup
* @param clicked_imageframe the ImageFrameItem that the event ocured upon, or 0 if none
* @param with_item true if an item has been selected upon the time axis, used to set context menu
*/
void popup_imageframe_edit_menu(int button, int32_t time, ImageFrameView* clicked_imageframe, bool with_item) ;
//---------------------------------------------------------------------------------------//
// Marker Time Axis Methods
/**
* Add a MarkerTimeAxis to the ilst of MarkerTimeAxis' associated with this ImageFrameTimeAxis
*
* @param marker_track the MarkerTimeAxis to add
* @param src the identity of the object that initiated the change
* @return true if the addition was a success,
* false otherwise
*/
bool add_marker_time_axis(MarkerTimeAxis* marker_track, void* src) ;
/**
* Returns the named MarkerTimeAxis associated with this ImageFrameTimeAxis
*
* @param track_id the track_id of the MarkerTimeAxis to search for
* @return the named markerTimeAxis, or 0 if the named MarkerTimeAxis is not associated with this ImageFrameTimeAxis
*/
MarkerTimeAxis* get_named_marker_time_axis(const std::string & track_id) ;
/**
* Removes the named markerTimeAxis from those associated with this ImageFrameTimeAxis
*
* @param track_id the track id of the MarkerTimeAxis to remove
* @param src the identity of the object that initiated the change
* @return the removed MarkerTimeAxis
*/
MarkerTimeAxis* remove_named_marker_time_axis(const std::string & track_id, void* src) ;
/**
* Potentially removes a MarkerTimeAxisView from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis
*
* @param tav the TimeAxis to remove
* @param src the identity of the object that initiated the change
*/
void remove_time_axis_view (TimeAxisView* av);
//---------------------------------------------------------------------------------------//
// Parent/Child helper object accessors
/**
* Returns the view helper of this TimeAxis
*
* @return the view helper of this TimeAxis
*/
ImageFrameTimeAxisView* get_view() ;
//---------------------------------------------------------------------------------//
// Emitted Signals
/** Emitted when a Marker Time Axis is Added, or associated with, this time axis */
sigc::signal<void,MarkerTimeAxis*,void*> MarkerTimeAxisAdded ;
/** Emitted when a Marker Time Axis is removed, from this time axis */
sigc::signal<void,std::string,void*> MarkerTimeAxisRemoved ;
protected:
private:
/**
* convenience method to select a new track color and apply it to the view and view items
*
*/
void select_track_color() ;
/**
* Handles the building of the popup menu
*/
virtual void build_display_menu() ;
/**
* handles the building of the ImageFrameView sub menu
*/
void create_imageframe_menu() ;
/* We may have multiple marker views, but each marker view should only be associated with one timeaxisview */
typedef std::list<MarkerTimeAxis*> MarkerTimeAxisList ;
MarkerTimeAxisList marker_time_axis_list;
/* the TimeAxis view helper */
ImageFrameTimeAxisView *view ;
// popup menu widgets
Gtk::Menu *image_action_menu ;
Gtk::Menu *imageframe_menu ;
Gtk::Menu *imageframe_item_menu ;
}; /* class ImageFrameTimeAxis */
#endif /* __ardour_imageframe_time_axis_h__ */

View File

@ -1,458 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <algorithm>
#include <gtkmm.h>
#include <gtkmm2ext/gtk_ui.h>
#include "imageframe_time_axis_group.h"
#include "imageframe_time_axis_view.h"
#include "imageframe_view.h"
#include "imageframe_time_axis.h"
#include "region_selection.h"
#include "public_editor.h"
#include "gui_thread.h"
#include "i18n.h"
using namespace ARDOUR;
PBD::Signal1<void,ImageFrameTimeAxisGroup*> ImageFrameTimeAxisGroup::CatchDeletion;
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new ImageFrameTimeAxisGroup.
*
* @param iftav the parent ImageFrameTimeAxis of this view helper
* @param group_id the unique name/id of this group
*/
ImageFrameTimeAxisGroup::ImageFrameTimeAxisGroup(ImageFrameTimeAxisView& iftav, const string & group_id)
: _view_helper(iftav), _group_id(group_id)
{
selected_imageframe_item = 0;
is_selected = false;
ImageFrameView::CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxisGroup::remove_imageframe_item, this, _1), gui_context());
}
/**
* Destructor
* Responsible for destroying any Items that may have been added to this group
*
*/
ImageFrameTimeAxisGroup::~ImageFrameTimeAxisGroup()
{
// Destroy all the ImageFramViews that we have
for(ImageFrameViewList::iterator iter = imageframe_views.begin(); iter != imageframe_views.end(); ++iter)
{
ImageFrameView* ifv = *iter;
ImageFrameViewList::iterator next = iter;
next++;
imageframe_views.erase(iter);
delete ifv;
ifv = 0;
iter = next;
}
CatchDeletion; /* EMIT_SIGNAL */
}
//---------------------------------------------------------------------------------------//
// Name/Id Accessors/Mutators
/**
* Set the name/Id of this group.
*
* @param new_name the new name of this group
* @param src the identity of the object that initiated the change
*/
void
ImageFrameTimeAxisGroup::set_group_name(const string & new_name, void* src)
{
if(_group_id != new_name)
{
std::string temp_name = _group_id;
_group_id = new_name;
NameChanged(_group_id, temp_name, src); /* EMIT_SIGNAL */
}
}
/**
* Returns the id of this group
* The group id must be unique upon a time axis
*
* @return the id of this group
*/
std::string
ImageFrameTimeAxisGroup::get_group_name() const
{
return(_group_id);
}
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of the time axis view and the item upon it
*
* @param height the new height
*/
int
ImageFrameTimeAxisGroup::set_item_heights(gdouble h)
{
/* limit the values to something sane-ish */
if (h < 10.0 || h > 1000.0)
{
return(-1);
}
// set the heights of all the imaeg frame views within the group
for(ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); ++citer)
{
(*citer)->set_height(h);
}
return(0);
}
/**
* Sets the current samples per unit.
* this method tells each item upon the time axis of the change
*
* @param spu the new samples per canvas unit value
*/
int
ImageFrameTimeAxisGroup::set_item_samples_per_pixel (double fpp)
{
if (fpp < 1.0) {
return -1;
}
for (ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); ++citer) {
(*citer)->set_samples_per_pixel (fpp);
}
return 0;
}
/**
* Sets the color of the items contained uopn this view helper
*
* @param color the new base color
*/
void
ImageFrameTimeAxisGroup::apply_item_color(Gdk::Color& color)
{
region_color = color;
for(ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); citer++)
{
(*citer)->set_color (region_color);
}
}
//---------------------------------------------------------------------------------------//
// child ImageFrameView methods
/**
* Adds an ImageFrameView to the list of items upon this time axis view helper
* the new ImageFrameView is returned
*
* @param item_id the unique id of the new item
* @param image_id the id/name of the image data we are usin
* @param start the position the new item should be placed upon the time line
* @param duration the duration the new item should be placed upon the timeline
* @param rgb_data the rgb data of the image
* @param width the original image width of the rgb_data (not the size to display)
* @param height the irigianl height of the rgb_data
* @param num_channels the number of channles within the rgb_data
* @param src the identity of the object that initiated the change
*/
ImageFrameView*
ImageFrameTimeAxisGroup::add_imageframe_item(const string & frame_id, framepos_t start, framecnt_t duration, unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels, void* src)
{
ImageFrameView* ifv = 0;
//check that there is not already an imageframe with that id
if(get_named_imageframe_item(frame_id) == 0)
{
ifv = new ImageFrameView(frame_id,
_view_helper.canvas_item()->property_parent(),
&(_view_helper.trackview()),
this,
_view_helper.trackview().editor.get_current_zoom(),
region_color,
start,
duration,
rgb_data,
width,
height,
num_channels);
imageframe_views.push_front(ifv);
ImageFrameAdded(ifv, src); /* EMIT_SIGNAL */
}
return(ifv);
}
/**
* Returns the named ImageFrameView or 0 if the named view does not exist on this view helper
*
* @param item_id the unique id of the item to search for
* @return the named ImageFrameView, or 0 if it is not held upon this view
*/
ImageFrameView*
ImageFrameTimeAxisGroup::get_named_imageframe_item(const string & frame_id)
{
ImageFrameView* ifv = 0;
for (ImageFrameViewList::const_iterator i = imageframe_views.begin(); i != imageframe_views.end(); ++i)
{
if (((ImageFrameView*)*i)->get_item_name() == frame_id)
{
ifv = ((ImageFrameView*)*i);
break;
}
}
return(ifv);
}
/**
* Removes the currently selected ImageFrameView
*
* @param src the identity of the object that initiated the change
* @todo need to remoev this, the selected item within group is no longer
* used in favour of a time axis selected item
* @see add_imageframe_view
*/
void
ImageFrameTimeAxisGroup::remove_selected_imageframe_item(void* src)
{
std::string frame_id;
if(selected_imageframe_item)
{
ImageFrameViewList::iterator i;
if((i = find(imageframe_views.begin(), imageframe_views.end(), selected_imageframe_item)) != imageframe_views.end())
{
imageframe_views.erase(i);
frame_id = selected_imageframe_item->get_item_name();
// note that we delete the item here
delete(selected_imageframe_item);
selected_imageframe_item = 0;
std::string track_id = _view_helper.trackview().name();
ImageFrameRemoved(track_id, _group_id, frame_id, src); /* EMIT_SIGNAL */
}
}
else
{
//cerr << "No Selected ImageFrame" << endl;
}
}
/**
* Removes and returns the named ImageFrameView from the list of ImageFrameViews held by this view helper
*
* @param item_id the ImageFrameView unique id to remove
* @param src the identity of the object that initiated the change
* @see add_imageframe_view
*/
ImageFrameView*
ImageFrameTimeAxisGroup::remove_named_imageframe_item(const string & frame_id, void* src)
{
ImageFrameView* removed = 0;
for(ImageFrameViewList::iterator iter = imageframe_views.begin(); iter != imageframe_views.end(); ++iter)
{
ImageFrameView* tempItem = *iter;
if(tempItem->get_item_name() == frame_id)
{
removed = tempItem;
imageframe_views.erase(iter);
if (removed == selected_imageframe_item)
{
selected_imageframe_item = 0;
}
std::string track_id = _view_helper.trackview().name();
ImageFrameRemoved(track_id, _group_id, frame_id, src); /* EMIT_SIGNAL */
// break from the for loop
break;
}
iter++;
}
return(removed);
}
/**
* Removes ifv from the list of ImageFrameViews upon this TimeAxis.
* if ifv is not upon this TimeAxis, this method takes no action
*
* @param ifv the ImageFrameView to remove
*/
void
ImageFrameTimeAxisGroup::remove_imageframe_item (ImageFrameView* ifv)
{
ENSURE_GUI_THREAD (*this, &ImageFrameTimeAxisGroup::remove_imageframe_item, ifv, src)
ImageFrameViewList::iterator i;
if((i = find (imageframe_views.begin(), imageframe_views.end(), ifv)) != imageframe_views.end()) {
imageframe_views.erase(i);
std::string frame_id = ifv->get_item_name();
std::string track_id = _view_helper.trackview().name();
ImageFrameRemoved(track_id, _group_id, frame_id, src); /* EMIT_SIGNAL */
}
}
//---------------------------------------------------------------------------------------//
// Selected group methods
/**
* Sets the currently selected item upon this time axis
*
* @param ifv the item to set selected
*/
//void
//ImageFrameTimeAxisGroup::set_selected_imageframe_item(ImageFrameView* ifv)
//{
// if(selected_imageframe_item)
// {
// selected_imageframe_item->set_selected(false, this);
// }
//
// selected_imageframe_item = ifv;
//
// if(!ifv->get_selected())
// {
// selected_imageframe_item->set_selected(true, this);
// }
//}
/**
* Sets the currently selected item upon this time axis to the named item
*
* @param item_id the name/id of the item to set selected
*/
//void
//ImageFrameTimeAxisGroup::set_selected_imageframe_item(std::string frame_id)
//{
// selected_imageframe_item = get_named_imageframe_item(frame_id);
//}
/**
* Returns the currently selected item upon this time axis
*
* @return the currently selected item pon this time axis
*/
// ImageFrameView*
// ImageFrameTimeAxisGroup::get_selected_imageframe_item()
// {
// return(selected_imageframe_item);
// }
/**
* Returns whether this grou pis currently selected
*
* @returns true if this group is currently selected
*/
bool
ImageFrameTimeAxisGroup::get_selected() const
{
return(is_selected);
}
/**
* Sets he selected state of this group
*
* @param yn set true if this group is selected, false otherwise
*/
void
ImageFrameTimeAxisGroup::set_selected(bool yn)
{
is_selected = yn;
}
//---------------------------------------------------------------------------------------//
// Handle time axis removal
/**
* Handles the Removal of this VisualTimeAxis
* This _needs_ to be called to alert others of the removal properly, ie where the source
* of the removal came from.
*
* XXX Although im not too happy about this method of doing things, I cant think of a cleaner method
* just now to capture the source of the removal
*
* @param src the identity of the object that initiated the change
*/
void
ImageFrameTimeAxisGroup::remove_this_group(void* src)
{
/*
defer to idle loop, otherwise we'll delete this object
while we're still inside this function ...
*/
Glib::signal_idle().connect(sigc::bind(ptr_fun(&ImageFrameTimeAxisGroup::idle_remove_this_group), this, src));
}
/**
* Callback used to remove this group during the gtk idle loop
* This is used to avoid deleting the obejct while inside the remove_this_group
* method
*
* @param group the ImageFrameTimeAxisGroup to remove
* @param src the identity of the object that initiated the change
*/
gint
ImageFrameTimeAxisGroup::idle_remove_this_group(ImageFrameTimeAxisGroup* group, void* src)
{
delete group;
group = 0;
group->GroupRemoved(group->get_group_name(), src); /* EMIT_SIGNAL */
return(false);
}

View File

@ -1,293 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_imageframe_time_axis_group_h__
#define __ardour_imageframe_time_axis_group_h__
#include <list>
#include <cmath>
#include <gdkmm/color.h>
#include <jack/jack.h>
#include "ardour/types.h"
#include "imageframe_time_axis_view.h"
class PublicEditor ;
class ImageFrameView ;
/**
* ImageFrameTimeAxisGroup defines a group/scene of ImageFrame view that can appear upon a time axis
* At the moment this is a bit bare, we really want to add some kind of time constraints upon
* items atht are added to the group, ie bounded by the start and end of the scene, which itself
* needs fleshed out.
* A viewable object may also be useful...
*
*/
class ImageFrameTimeAxisGroup : public sigc::trackable
{
public:
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new ImageFrameTimeAxisGroup.
*
* @param iftav the parent ImageFrameTimeAxis of this view helper
* @param group_id the unique name/id of this group
*/
ImageFrameTimeAxisGroup(ImageFrameTimeAxisView& iftav, const std::string & group_id) ;
/**
* Destructor
* Responsible for destroying any Items that may have been added to this group
*
*/
virtual ~ImageFrameTimeAxisGroup() ;
//---------------------------------------------------------------------------------------//
// Name/Id Accessors/Mutators
/**
* Set the name/Id of this group.
*
* @param new_name the new name of this group
* @param src the identity of the object that initiated the change
*/
void set_group_name(const std::string & new_name, void* src) ;
/**
* Returns the id of this group
* The group id must be unique upon a time axis
*
* @return the id of this group
*/
std::string get_group_name() const ;
//---------------------------------------------------------------------------------------//
// Parent/Child helper object accessors
/**
* Returns the TimeAxisView thatt his object is acting as a helper for
*
* @return the TimeAxisView that this object is acting as a view helper for
*/
ImageFrameTimeAxisView& get_view() const { return _view_helper ; }
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of the time axis view and the item upon it
*
* @param height the new height
*/
int set_item_heights(gdouble) ;
int set_item_samples_per_pixel (double);
/**
* Sets the color of the items contained uopn this view helper
*
* @param color the new base color
*/
void apply_item_color(Gdk::Color&) ;
//---------------------------------------------------------------------------------------//
// child ImageFrameView methods
/**
* Adds an ImageFrameView to the list of items upon this time axis view helper
* the new ImageFrameView is returned
*
* @param item_id the unique id of the new item
* @param image_id the id/name of the image data we are usin
* @param start the position the new item should be placed upon the time line
* @param duration the duration the new item should be placed upon the timeline
* @param rgb_data the rgb data of the image
* @param width the original image width of the rgb_data (not the size to display)
* @param height the irigianl height of the rgb_data
* @param num_channels the number of channles within the rgb_data
* @param src the identity of the object that initiated the change
*/
ImageFrameView* add_imageframe_item(const std::string & item_id, nframes_t start, nframes_t duration, unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels, void* src) ;
/**
* Returns the named ImageFrameView or 0 if the named view does not exist on this view helper
*
* @param item_id the unique id of the item to search for
* @return the named ImageFrameView, or 0 if it is not held upon this view
*/
ImageFrameView* get_named_imageframe_item(const std::string & item_id) ;
/**
* Removes the currently selected ImageFrameView
*
* @param src the identity of the object that initiated the change
* @see add_imageframe_view
*/
void remove_selected_imageframe_item(void* src) ;
/**
* Removes and returns the named ImageFrameView from the list of ImageFrameViews held by this view helper
*
* @param item_id the ImageFrameView unique id to remove
* @param src the identity of the object that initiated the change
* @see add_imageframe_view
*/
ImageFrameView* remove_named_imageframe_item(const std::string & item_id, void* src) ;
/**
* Removes ifv from the list of ImageFrameViews upon this TimeAxis.
* if ifv is not upon this TimeAxis, this method takes no action
*
* @param ifv the ImageFrameView to remove
*/
void remove_imageframe_item(ImageFrameView*, void* src) ;
//---------------------------------------------------------------------------------------//
// Selected group methods
// removed in favour of a track level selectewd item
// this is simply easier to manage a singularly selected item, rather than
// a selected item within each group
/**
* Sets the currently selected item upon this time axis
*
* @param ifv the item to set selected
*/
//void set_selected_imageframe_item(ImageFrameView* ifv) ;
/**
* Sets the currently selected item upon this time axis to the named item
*
* @param item_id the name/id of the item to set selected
*/
//void set_selected_imageframe_item(std::string item_id) ;
/**
* Returns the currently selected item upon this time axis
*
* @return the currently selected item pon this time axis
*/
//ImageFrameView* get_selected_imageframe_item() ;
/**
* Returns whether this grou pis currently selected
*
* @returns true if this group is currently selected
*/
bool get_selected() const ;
/**
* Sets he selected state of this group
*
* @param yn set true if this group is selected, false otherwise
*/
void set_selected(bool yn) ;
//---------------------------------------------------------------------------------------//
// Handle group removal
/**
* Handles the Removal of this VisualTimeAxis
* This _needs_ to be called to alert others of the removal properly, ie where the source
* of the removal came from.
*
* XXX Although im not too happy about this method of doing things, I cant think of a cleaner method
* just now to capture the source of the removal
*
* @param src the identity of the object that initiated the change
*/
virtual void remove_this_group(void* src) ;
//---------------------------------------------------------------------------------//
// Emitted Signals
static sigc::signal<void,ImageFrameTimeAxisGroup*> CatchDeletion;
/**
* Emitted when this Group has been removed
* This is different to the CatchDeletion signal in that this signal
* is emitted during the deletion of this Time Axis, and not during
* the destructor, this allows us to capture the source of the deletion
* event
*/
sigc::signal<void,std::string,void*> GroupRemoved ;
/** Emitted when we have changed the name of this TimeAxis */
sigc::signal<void,std::string,std::string,void*> NameChanged ;
/** Emitted when an ImageFrameView is added to this group */
sigc::signal<void, ImageFrameView*, void*> ImageFrameAdded ;
/** Emitted when an ImageFrameView is removed from this group */
sigc::signal<void, const std::string &, const std::string &, const std::string &, void*> ImageFrameRemoved ;
protected:
private:
/**
* convenience method to re-get the samples per unit and tell items upon this view
*
*/
void reset_samples_per_pixel ();
/**
* Callback used to remove this group during the gtk idle loop
* This is used to avoid deleting the obejct while inside the remove_this_group
* method
*
* @param group the ImageFrameTimeAxisGroup to remove
* @param src the identity of the object that initiated the change
*/
static gint idle_remove_this_group(ImageFrameTimeAxisGroup* group, void* src) ;
/** The list of ImageFrameViews held by this view helper */
typedef std::list<ImageFrameView *> ImageFrameViewList ;
ImageFrameViewList imageframe_views ;
/** the currently selected time axis item upon this time axis */
ImageFrameView* selected_imageframe_item ;
/** the view helper that this object is acting as a container upon on */
ImageFrameTimeAxisView& _view_helper ;
/** the is of this group */
std::string _group_id ;
/* XXX why are these different? */
Gdk::Color region_color ;
uint32_t stream_base_color ;
/** indicates if this group is currently selected */
bool is_selected ;
} ; /* class ImageFrameTimeAxisGroup */
#endif /* __ardour_imageframe_time_axis_group_h__ */

View File

@ -1,435 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <algorithm>
#include <gtkmm.h>
#include <gtkmm2ext/gtk_ui.h>
#include "imageframe_time_axis_view.h"
#include "imageframe_time_axis_group.h"
#include "imageframe_view.h"
#include "imageframe_time_axis.h"
#include "region_selection.h"
#include "public_editor.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "ardour_ui.h"
#include "i18n.h"
using namespace ARDOUR ;
using namespace Editing;
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new ImageFrameTimeAxisView.
*
* @param ifta the parent ImageFrameTimeAxis of this view helper
*/
ImageFrameTimeAxisView::ImageFrameTimeAxisView (ImageFrameTimeAxis& tv)
: _trackview (tv),
canvas_group (*_trackview.canvas_display),
canvas_rect (canvas_group, 0.0, 0.0, 1000000.0, tv.current_height())
{
region_color = _trackview.color() ;
stream_base_color = ARDOUR_UI::config()->get_canvasvar_ImageTrack() ;
canvas_rect.property_outline_color_rgba() = ARDOUR_UI::config()->get_canvasvar_ImageTrack();
canvas_rect.property_fill_color_rgba() = stream_base_color;
canvas_rect.signal_event().connect (sigc::bind (sigc::mem_fun (_trackview.editor, &PublicEditor::canvas_imageframe_view_event), (ArdourCanvas::Item*) &canvas_rect, &tv));
_samples_per_pixel = _trackview.editor.get_current_zoom() ;
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &ImageFrameTimeAxisView::reset_samples_per_pixel)) ;
selected_imageframe_group = 0 ;
selected_imageframe_view = 0 ;
ImageFrameTimeAxisGroup::CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxisView::remove_imageframe_group, this, _1), gui_context());
}
/**
* Destructor
* Responsible for destroying all items tat may have been added to this time axis
*/
ImageFrameTimeAxisView::~ImageFrameTimeAxisView()
{
// Destroy all the ImageFrameGroups that we have
for(ImageFrameGroupList::iterator iter = imageframe_groups.begin(); iter != imageframe_groups.end(); ++iter)
{
ImageFrameTimeAxisGroup* iftag = (*iter) ;
ImageFrameGroupList::iterator next = iter ;
next++ ;
// remove the front element
imageframe_groups.erase(iter) ;
delete iftag ;
iftag = 0 ;
iter = next ;
}
}
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of the time axis view and the item upon it
*
* @param height the new height
*/
int
ImageFrameTimeAxisView::set_height (gdouble h)
{
/* limit the values to something sane-ish */
if (h < 10.0 || h > 1000.0) {
return(-1) ;
}
canvas_rect.property_y2() = h ;
for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer)
{
(*citer)->set_item_heights(h) ;
}
return(0) ;
}
/**
* Sets the position of this view helper on the canvas
*
* @param x the x position upon the canvas
* @param y the y position npon the canvas
*/
int
ImageFrameTimeAxisView::set_position (gdouble x, gdouble y)
{
canvas_group.property_x() = x;
canvas_group.property_y() = y;
return 0;
}
/**
* Sets the current samples per unit.
* this method tells each item upon the time axis of the change
*
* @param spu the new samples per canvas unit value
*/
int
ImageFrameTimeAxisView::set_samples_per_pixel (double fpp)
{
if (fpp < 1.0) {
return -1;
}
_samples_per_pixel = fpp;
for (ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer) {
(*citer)->set_item_samples_per_pixels (fpp);
}
return 0;
}
/**
* Sets the color of the items contained uopn this view helper
*
* @param color the new base color
*/
void
ImageFrameTimeAxisView::apply_color(Gdk::Color& color)
{
region_color = color ;
for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); citer++)
{
(*citer)->apply_item_color(region_color) ;
}
}
/**
* convenience method to re-get the samples per unit and tell items upon this view
*
*/
void
ImageFrameTimeAxisView::reset_samples_per_pixel ()
{
set_samples_per_pixel (_trackview.editor.get_current_zoom());
}
//---------------------------------------------------------------------------------------//
// Child ImageFrameTimeAxisGroup Accessors/Mutators
/**
* Adds an ImageFrameTimeAxisGroup to the list of items upon this time axis view helper
* the new ImageFrameTimeAxisGroup is returned
*
* @param group_id the unique id of the new group
* @param src the identity of the object that initiated the change
*/
ImageFrameTimeAxisGroup*
ImageFrameTimeAxisView::add_imageframe_group(std::string group_id, void* src)
{
ImageFrameTimeAxisGroup* iftag = 0 ;
//check that there is not already a group with that id
if(get_named_imageframe_group(group_id) != 0)
{
// iftag = 0 ;
}
else
{
iftag = new ImageFrameTimeAxisGroup(*this, group_id) ;
imageframe_groups.push_front(iftag) ;
ImageFrameGroupAdded(iftag, src) ; /* EMIT_SIGNAL */
}
return(iftag) ;
}
/**
* Returns the named ImageFrameTimeAxisGroup or 0 if the named group does not exist on this view helper
*
* @param group_id the unique id of the group to search for
* @return the named ImageFrameTimeAxisGroup, or 0 if it is not held upon this view
*/
ImageFrameTimeAxisGroup*
ImageFrameTimeAxisView::get_named_imageframe_group(std::string group_id)
{
ImageFrameTimeAxisGroup* iftag = 0 ;
for(ImageFrameGroupList::iterator i = imageframe_groups.begin(); i != imageframe_groups.end(); ++i)
{
if (((ImageFrameTimeAxisGroup*)*i)->get_group_name() == group_id)
{
iftag = ((ImageFrameTimeAxisGroup*)*i) ;
break ;
}
}
return(iftag) ;
}
/**
* Removes and returns the named ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroup held by this view helper
*
* @param group_id the ImageFrameTimeAxisGroup unique id to remove
* @param src the identity of the object that initiated the change
* @see add_imageframe_group
*/
ImageFrameTimeAxisGroup*
ImageFrameTimeAxisView::remove_named_imageframe_group(std::string group_id, void* src)
{
ImageFrameTimeAxisGroup* removed = 0 ;
for(ImageFrameGroupList::iterator iter = imageframe_groups.begin(); iter != imageframe_groups.end(); ++iter)
{
if(((ImageFrameTimeAxisGroup*)*iter)->get_group_name() == group_id)
{
removed = (*iter) ;
imageframe_groups.erase(iter) ;
if(removed == selected_imageframe_group)
{
selected_imageframe_group = 0 ;
}
ImageFrameGroupRemoved(removed->get_group_name(), src) ; /* EMIT_SIGNAL */
// break from the for loop
break ;
}
iter++ ;
}
return(removed) ;
}
/**
* Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis.
*
* @param iftag the ImageFrameView to remove
*/
void
ImageFrameTimeAxisView::remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src)
{
ENSURE_GUI_THREAD (*this, &ImageFrameTimeAxisView::remove_imageframe_group, iftag, src)
ImageFrameGroupList::iterator i;
if((i = find (imageframe_groups.begin(), imageframe_groups.end(), iftag)) != imageframe_groups.end())
{
imageframe_groups.erase(i) ;
ImageFrameGroupRemoved(iftag->get_group_name(), src) ; /* EMIT_SIGNAL */
}
}
//---------------------------------------------------------------------------------------//
// Selected group methods
/**
* Sets the currently selected group upon this time axis
*
* @param ifv the item to set selected
*/
void
ImageFrameTimeAxisView::set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag)
{
if(selected_imageframe_group)
{
selected_imageframe_group->set_selected(false) ;
}
selected_imageframe_group = iftag ;
selected_imageframe_group->set_selected(true) ;
}
/**
* Clears the currently selected image frame group unpo this time axis
*
*/
void
ImageFrameTimeAxisView::clear_selected_imageframe_group()
{
if(selected_imageframe_group)
{
selected_imageframe_group->set_selected(false) ;
}
selected_imageframe_group = 0 ;
}
/**
* Returns the currently selected group upon this time axis
*
* @return the currently selected group upon this time axis
*/
ImageFrameTimeAxisGroup*
ImageFrameTimeAxisView::get_selected_imageframe_group() const
{
return(selected_imageframe_group) ;
}
//---------------------------------------------------------------------------------------//
// Selected item methods
/**
* Sets the currently selected imag frame view item
*
* @param iftag the group the selected item is part
* @param ifv the selected item
*/
void
ImageFrameTimeAxisView::set_selected_imageframe_view(ImageFrameTimeAxisGroup* iftag, ImageFrameView* ifv)
{
set_selected_imageframe_group(iftag) ;
if(selected_imageframe_view)
{
selected_imageframe_view->set_selected(false) ;
}
selected_imageframe_view = ifv ;
selected_imageframe_view->set_selected(true) ;
}
/**
* Clears the currently selected image frame view item
*
*/
void
ImageFrameTimeAxisView::clear_selected_imageframe_item(bool clear_group)
{
if(clear_group)
{
clear_selected_imageframe_group() ;
}
if(selected_imageframe_view)
{
selected_imageframe_view->set_selected(false) ;
}
selected_imageframe_view = 0 ;
}
/**
* Returns the currently selected image frame view item upon this time axis
*
* @return the currently selected image frame view item
*/
ImageFrameView*
ImageFrameTimeAxisView::get_selected_imageframe_view() const
{
return(selected_imageframe_view) ;
}
void
ImageFrameTimeAxisView::set_imageframe_duration_sec(double sec)
{
if (selected_imageframe_group && selected_imageframe_view) {
selected_imageframe_view->set_duration ((sec * _trackview.editor.session()->frame_rate()), this);
}
}
/**
* Removes the currently selected ImageFrame view item
*
* @param src the identity of the object that initiated the change
* @see add_imageframe_group
*/
void
ImageFrameTimeAxisView::remove_selected_imageframe_item(void* src)
{
if(selected_imageframe_group && selected_imageframe_view)
{
ImageFrameView* temp_item = selected_imageframe_view ;
selected_imageframe_group->remove_imageframe_item(temp_item, src) ;
// XXX although we have removed the item from the group, we need the group id still set within the
// item as the remove method requires this data when telling others about the deletion
// to fully specify the item we need the track, group and item id
selected_imageframe_view->remove_this_item(src) ;
clear_selected_imageframe_item(false) ;
}
}

View File

@ -1,259 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_imageframe_time_axis_view_h__
#define __ardour_imageframe_time_axis_view_h__
#include <list>
#include <cmath>
#include <gdkmm/color.h>
#include <jack/jack.h>
class PublicEditor ;
class ImageFrameTimeAxis ;
class ImageFrameView ;
class ImageFrameTimeAxisGroup ;
/**
* ImageFrameTimeAxisView defines the time axis view helper
* This object is responsible for the time axis canvas view, and
* maintains the list of items that have been added to it
*
*/
class ImageFrameTimeAxisView : public sigc::trackable
{
public:
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new ImageFrameTimeAxisView.
*
* @param ifta the parent ImageFrameTimeAxis of this view helper
*/
ImageFrameTimeAxisView(ImageFrameTimeAxis& ifta) ;
/**
* Destructor
* Responsible for destroying all items tat may have been added to this time axis
*/
~ImageFrameTimeAxisView () ;
//---------------------------------------------------------------------------------------//
// Parent/Child helper object accessors
/**
* Returns the TimeAxisView thatt his object is acting as a helper for
*
* @return the TimeAxisView that this object is acting as a view helper for
*/
ImageFrameTimeAxis& trackview() { return _trackview; }
/**
*
*/
ArdourCanvas::Group * canvas_item() { return &canvas_group; }
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of the time axis view and the item upon it
*
* @param height the new height
*/
int set_height(gdouble) ;
/**
* Sets the position of this view helper on the canvas
*
* @param x the x position upon the canvas
* @param y the y position upon the canvas
*/
int set_position(gdouble x, gdouble y) ;
int set_samples_per_pixel (double);
double get_samples_per_pixel () { return _samples_per_pixel; }
/**
* Sets the color of the items contained uopn this view helper
*
* @param color the new base color
*/
void apply_color (Gdk::Color&) ;
//---------------------------------------------------------------------------------------//
// Child ImageFrameTimeAxisGroup Accessors/Mutators
/**
* Adds an ImageFrameTimeAxisGroup to the list of items upon this time axis view helper
* the new ImageFrameTimeAxisGroup is returned
*
* @param group_id the unique id of the new group
* @param src the identity of the object that initiated the change
*/
ImageFrameTimeAxisGroup* add_imageframe_group(std::string group_id, void* src) ;
/**
* Returns the named ImageFrameTimeAxisGroup or 0 if the named group does not exist on this view helper
*
* @param group_id the unique id of the group to search for
* @return the named ImageFrameTimeAxisGroup, or 0 if it is not held upon this view
*/
ImageFrameTimeAxisGroup* get_named_imageframe_group(std::string group_id) ;
/**
* Removes and returns the named ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroup held by this view helper
*
* @param group_id the ImageFrameTimeAxisGroup unique id to remove
* @param src the identity of the object that initiated the change
* @see add_imageframe_group
*/
ImageFrameTimeAxisGroup* remove_named_imageframe_group(std::string group_id, void* src) ;
/**
* Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis.
*
* @param iftag the ImageFrameView to remove
*/
void remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src) ;
//---------------------------------------------------------------------------------------//
// Selected group methods
/**
* Sets the currently selected group upon this time axis
*
* @param ifv the item to set selected
*/
void set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag) ;
/**
* Clears the currently selected image frame group unpo this time axis
*
*/
void clear_selected_imageframe_group() ;
/**
* Returns the currently selected group upon this time axis
*
* @return the currently selected group upon this time axis
*/
ImageFrameTimeAxisGroup* get_selected_imageframe_group() const ;
/**
* Sets the duration of the selected ImageFrameView to the specified number of seconds
*
* @param sec the duration to set the ImageFrameView to, in seconds
*/
void set_imageframe_duration_sec(double sec) ;
//---------------------------------------------------------------------------------------//
// Selected item methods
/**
* Sets the currently selected image frame view item
*
* @param iftag the group the selected item is part
* @param ifv the selected item
*/
void set_selected_imageframe_view(ImageFrameTimeAxisGroup* iftag, ImageFrameView* ifv) ;
/**
* Clears the currently selected image frame view item
*
* @param clear_group set true if the selected parent group of the item should be cleared also
*/
void clear_selected_imageframe_item(bool clear_group) ;
/**
* Returns the currently selected image frame view item upon this time axis
*
* @return the currently selected image frame view item
*/
ImageFrameView* get_selected_imageframe_view() const ;
/**
* Removes the currently selected ImageFrameTimeAxisGroup
*
* @param src the identity of the object that initiated the change
* @see add_imageframe_group
*/
void remove_selected_imageframe_item(void* src) ;
//---------------------------------------------------------------------------------//
// Emitted Signals
/** Emitted when and ImageFrameGroup is added to this time axis */
sigc::signal<void,ImageFrameTimeAxisGroup*,void*> ImageFrameGroupAdded ;
/** Emitted when an ImageFrameGroup is removed from this time axis */
sigc::signal<void,std::string,void*> ImageFrameGroupRemoved ;
protected:
private:
/**
* convenience method to re-get the samples per unit and tell items upon this view
*/
void reset_samples_per_pixel ();
/**
* The list of ImageFrameViews held by this view helper */
typedef std::list<ImageFrameTimeAxisGroup *> ImageFrameGroupList ;
ImageFrameGroupList imageframe_groups ;
/** the currently selected time axis item upon this time axis */
ImageFrameTimeAxisGroup* selected_imageframe_group ;
/**
* thecurrently selected image frame view
* we keep this here so that we only have one per view, not one per group
*/
ImageFrameView* selected_imageframe_view ;
/* the TimeAxisView that this object is acting as the view helper for */
ImageFrameTimeAxis& _trackview ;
ArdourCanvas::Group canvas_group ;
ArdourCanvas::Rectangle canvas_rect; /* frame around the whole thing */
/** the current frames per pixel */
double _samples_per_pixel;
/* XXX why are these different? */
Gdk::Color region_color ;
uint32_t stream_base_color ;
} ; /* class ImageFrameTimeAxisView */
#endif /* __ardour_imageframe_time_axis_view_h__ */

View File

@ -1,370 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <algorithm>
#include <cmath>
#include <gtkmm.h>
#include <gtkmm2ext/gtk_ui.h>
#include "imageframe_time_axis.h"
#include "imageframe_time_axis_group.h"
#include "marker_time_axis.h"
#include "marker_time_axis_view.h"
#include "public_editor.h"
#include "utils.h"
#include "imageframe_view.h"
#include "imageframe.h"
#include "gui_thread.h"
using namespace ARDOUR;
using namespace Gtk;
sigc::signal<void,ImageFrameView*> ImageFrameView::GoingAway;
/**
* Constructs a new ImageFrameView upon the canvas
*
* @param item_id unique id of this item
* @param parent the parent canvas item
* @param tv the time axis view that this item is to be placed upon
* @param group the ImageFrameGroup that this item is a member of
* @param spu the current samples per canvas unit
* @param start the start frame ogf this item
* @param duration the duration of this item
* @param rgb_data the rgb data of the image
* @param width the width of the original rgb_data image data
* @param height the width of the origianl rgb_data image data
* @param num_channels the number of color channels within rgb_data
*/
ImageFrameView::ImageFrameView(const string & item_id,
ArdourCanvas::Group *parent,
ImageFrameTimeAxis* tv,
ImageFrameTimeAxisGroup* item_group,
double spu,
Gdk::Color& basic_color,
framepos_t start,
framecnt_t duration,
unsigned char* rgb_data,
uint32_t width,
uint32_t height,
uint32_t num_channels)
: TimeAxisViewItem(item_id, *parent, *tv, spu, basic_color, start, duration,
TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText|
TimeAxisViewItem::ShowNameHighlight|
TimeAxisViewItem::ShowFrame|
TimeAxisViewItem::ShowHandles))
{
the_parent_group = item_group;
set_name_text(item_id);
image_data_width = width;
image_data_height = height;
image_data_num_channels = num_channels;
//This should be art_free'd once the ArtPixBuf is destroyed - this should happen when we destroy the imageframe canvas item
unsigned char* the_rgb_data = (unsigned char*) art_alloc(width*height*num_channels);
memcpy(the_rgb_data, rgb_data, (width*height*num_channels));
ArtPixBuf* pbuf;
pbuf = art_pixbuf_new_rgba(the_rgb_data, width, height, (num_channels * width));
imageframe = 0;
//calculate our image width based on the track height
double im_ratio = (double)width/(double)height;
double im_width = ((double)(trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE) * im_ratio);
imageframe = new ImageFrame (*group, pbuf, 1.0, 1.0, ANCHOR_NW, im_width, (trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE));
frame_handle_start->signal_event().connect (sigc::bind (sigc::mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_start_handle_event), frame_handle_start, this));
frame_handle_end->signal_event().connect (sigc::bind (sigc::mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_end_handle_event), frame_handle_end, this));
group->signal_event().connect (sigc::bind (sigc::mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_item_view_event), imageframe, this));
frame_handle_start->raise_to_top();
frame_handle_end->raise_to_top();
set_position(start, this);
set_duration(duration, this);
MarkerView::CatchDeletion.connect (*this, boost::bind (&ImageFrameView::remove_marker_view_item, this, _1), gui_context());
}
/**
* Destructor
* Reposible for removing and destroying all marker items associated with this item
*/
ImageFrameView::~ImageFrameView()
{
CatchDeletion (this);
// destroy any marker items we have associated with this item
for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter)
{
MarkerView* mv = (*iter);
MarkerViewList::iterator next = iter;
next++;
// remove the item from our marker list
// the current iterator becomes invalid after this point, so we cannot call next upon it
// luckily enough, we already have next
marker_view_list.erase(iter);
// remove the item from the marker time axis
MarkerTimeAxisView* mtav = dynamic_cast<MarkerTimeAxis*>(&mv->get_time_axis_view())->get_view();
if(mtav)
{
mtav->remove_marker_view(mv, this);
}
mv->set_marked_item(0);
delete mv;
mv = 0;
// set our iterator to next, as we have invalided the current iterator with the call to erase
iter = next;
}
// if we are the currently selected item withi the parent track, we need to se-select
if(the_parent_group)
{
if(the_parent_group->get_view().get_selected_imageframe_view() == this)
{
the_parent_group->get_view().clear_selected_imageframe_item(false);
}
}
delete imageframe;
imageframe = 0;
}
//---------------------------------------------------------------------------------------//
// Position and duration Accessors/Mutators
/**
* Set the position of this item to the specified value
*
* @param pos the new position
* @param src the identity of the object that initiated the change
* @return true if the position change was a success, false otherwise
*/
bool
ImageFrameView::set_position(framepos_t pos, void* src, double* delta)
{
framepos_t old_pos = frame_position;
// do the standard stuff
bool ret = TimeAxisViewItem::set_position(pos, src, delta);
// everything went ok with the standard stuff?
if (ret) {
/* move each of our associated markers with this ImageFrameView */
for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i)
{
// calculate the offset of the marker
MarkerView* mv = (MarkerView*)*i;
framepos_t marker_old_pos = mv->get_position();
mv->set_position(pos + (marker_old_pos - old_pos), src);
}
}
return(ret);
}
/**
* Sets the duration of this item
*
* @param dur the new duration of this item
* @param src the identity of the object that initiated the change
* @return true if the duration change was succesful, false otherwise
*/
bool
ImageFrameView::set_duration(framepos_t dur, void* src)
{
/* do the standard stuff */
bool ret = TimeAxisViewItem::set_duration(dur, src);
// eveything went ok with the standard stuff?
if(ret)
{
/* handle setting the sizes of our canvas itesm based on the new duration */
imageframe->property_drawwidth() = trackview.editor.sample_to_pixel(get_duration());
}
return(ret);
}
//---------------------------------------------------------------------------------------//
// Parent Component Methods
/**
* Sets the parent ImageFrameTimeAxisGroup of thie item
* each Item must be part of exactly one group (or 'scene') upon the timeline
*
* @param group the new parent group
*/
void
ImageFrameView::set_time_axis_group(ImageFrameTimeAxisGroup* group)
{
the_parent_group = group;
}
/**
* Returns the parent group of this item
*
* @return the parent group of this item
*/
ImageFrameTimeAxisGroup*
ImageFrameView::get_time_axis_group()
{
return(the_parent_group);
}
//---------------------------------------------------------------------------------------//
// ui methods
/**
* Set the height of this item
*
* @param h the new height
*/
void
ImageFrameView::set_height (gdouble h)
{
// set the image size
// @todo might have to re-get the image data, for a large height...hmmm.
double im_ratio = (double)image_data_width/(double)image_data_height;
imageframe->property_width() = (h - TimeAxisViewItem::NAME_Y_OFFSET) * im_ratio;
imageframe->property_height() = h - TimeAxisViewItem::NAME_Y_OFFSET;
frame->raise_to_top();
imageframe->raise_to_top();
name_highlight->raise_to_top();
name_text->raise_to_top();
frame_handle_start->raise_to_top();
frame_handle_end->raise_to_top();
name_text->property_y() = h - TimeAxisViewItem::NAME_Y_OFFSET;
frame->property_y2() = h;
name_highlight->property_y1() = (gdouble) h - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
name_highlight->property_y2() = (gdouble) h - 1.0;
}
//---------------------------------------------------------------------------------------//
// MarkerView methods
/**
* Adds a markerView to the list of marker views associated with this item
*
* @param item the marker item to add
* @param src the identity of the object that initiated the change
*/
void
ImageFrameView::add_marker_view_item(MarkerView* item, void* src)
{
marker_view_list.push_back(item);
MarkerViewAdded(item, src); /* EMIT_SIGNAL */
}
/**
* Removes the named marker view from the list of marker view associated with this item
* The Marker view is not destroyed on removal, so the caller must handle the item themself
*
* @param markId the id/name of the item to remove
* @param src the identity of the object that initiated the change
* @return the removed marker item
*/
MarkerView*
ImageFrameView::remove_named_marker_view_item(const string & markerId, void* src)
{
MarkerView* mv = 0;
MarkerViewList::iterator i = marker_view_list.begin();
while(i != marker_view_list.end())
{
if (((MarkerView*)*i)->get_item_name() == markerId)
{
mv = (*i);
marker_view_list.erase(i);
MarkerViewRemoved(mv,src); /* EMIT_SIGNAL */
// iterator is now invalid, but since we should only ever have
// one item with the specified name, things are ok, and we can
// break from the while loop
break;
}
i++;
}
return(mv);
}
/**
* Removes item from the list of marker views assocaited with this item
* This method will do nothing if item if not assiciated with this item
*
* @param item the item to remove
* @param src the identity of the object that initiated the change
*/
void
ImageFrameView::remove_marker_view_item (MarkerView* mv)
{
ENSURE_GUI_THREAD (*this, &ImageFrameView::remove_marker_view_item, mv, src)
MarkerViewList::iterator i;
if ((i = find (marker_view_list.begin(), marker_view_list.end(), mv)) != marker_view_list.end()) {
marker_view_list.erase(i);
MarkerViewRemoved (mv, src); /* EMIT_SIGNAL */
}
}
/**
* Determines if the named marker is one of those associated with this item
*
* @param markId the id/name of the item to search for
*/
bool
ImageFrameView::has_marker_view_item(const string & mname)
{
bool result = false;
for (MarkerViewList::const_iterator ci = marker_view_list.begin(); ci != marker_view_list.end(); ++ci)
{
if (((MarkerView*)*ci)->get_item_name() == mname)
{
result = true;
// found the item, so we can break the for loop
break;
}
}
return(result);
}

View File

@ -1,210 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __gtk_ardour_imageframe_view_h__
#define __gtk_ardour_imageframe_view_h__
#include <string>
#include <gdkmm/color.h>
#include <sigc++/signal.h>
#include <list>
#include "enums.h"
#include "time_axis_view_item.h"
#include "marker_view.h"
class ImageFrameTimeAxis;
class ImageFrameTimeAxisGroup ;
/**
* An ImageFrameItem to display an image upon the ardour time line
*
*/
class ImageFrameView : public TimeAxisViewItem
{
public:
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new ImageFrameView upon the canvas
*
* @param item_id unique id of this item
* @param parent the parent canvas item
* @param tv the time axis view that this item is to be placed upon
* @param group the ImageFrameGroup that this item is a member of
* @param spu the current samples per canvas unit
* @param start the start frame ogf this item
* @param duration the duration of this item
* @param rgb_data the rgb data of the image
* @param width the width of the original rgb_data image data
* @param height the width of the origianl rgb_data image data
* @param num_channels the number of color channels within rgb_data
*/
ImageFrameView(const std::string & item_id,
ArdourCanvas::Group *parent,
ImageFrameTimeAxis *tv,
ImageFrameTimeAxisGroup* group,
double spu,
Gdk::Color& base_color,
framepos_t start,
framecnt_t duration,
unsigned char* rgb_data,
uint32_t width,
uint32_t height,
uint32_t num_channels) ;
/**
* Destructor
* Reposible for removing and destroying all marker items associated with this item
*/
~ImageFrameView() ;
static PBD::Signal1<void,ImageFrameView*> CatchDeletion;
//---------------------------------------------------------------------------------------//
// Position and duration Accessors/Mutators
/**
* Set the position of this item to the specified value
*
* @param pos the new position
* @param src the identity of the object that initiated the change
* @return true if the position change was a success, false otherwise
*/
virtual bool set_position(framepos_t pos, void* src, double* delta = 0) ;
/**
* Sets the duration of this item
*
* @param dur the new duration of this item
* @param src the identity of the object that initiated the change
* @return true if the duration change was succesful, false otherwise
*/
virtual bool set_duration(framepos_t dur, void* src) ;
//---------------------------------------------------------------------------------------//
// Parent Component Methods
/**
* Sets the parent ImageFrameTimeAxisGroup of thie item
* each Item must be part of exactly one group (or 'scene') upon the timeline
*
* @param group the new parent group
*/
void set_time_axis_group(ImageFrameTimeAxisGroup* group) ;
/**
* Returns the parent group of this item
*
* @return the parent group of this item
*/
ImageFrameTimeAxisGroup* get_time_axis_group() ;
//---------------------------------------------------------------------------------------//
// ui methods
/**
* Set the height of this item
*
* @param h the new height
*/
virtual void set_height(gdouble h) ;
//---------------------------------------------------------------------------------------//
// MarkerView methods
/**
* Adds a markerView to the list of marker views associated with this item
*
* @param item the marker item to add
* @param src the identity of the object that initiated the change
*/
void add_marker_view_item(MarkerView* item, void* src) ;
/**
* Removes the named marker view from the list of marker view associated with this item
* The Marker view is not destroyed on removal, so the caller must handle the item themself
*
* @param markId the id/name of the item to remove
* @param src the identity of the object that initiated the change
* @return the removed marker item
*/
MarkerView* remove_named_marker_view_item(const std::string & markId, void* src) ;
/**
* Removes item from the list of marker views assocaited with this item
* This method will do nothing if item if not assiciated with this item
* The Marker view is not destroyed on removal, so the caller must handle the item themself
*
* @param item the item to remove
* @param src the identity of the object that initiated the change
*/
void remove_marker_view_item(MarkerView* item, void* src) ;
/**
* Determines if the named marker is one of those associated with this item
*
* @param markId the id/name of the item to search for
*/
bool has_marker_view_item(const std::string & markId) ;
//---------------------------------------------------------------------------------//
// Emitted Signals
/** Emitted when a marker Item is added to this Item */
sigc::signal<void,MarkerView*,void*> MarkerViewAdded ;
/** Emitted when a Marker Item is added to this Item */
sigc::signal<void,MarkerView*,void*> MarkerViewRemoved ;
private:
/** the list of MarkerViews associated with this item */
typedef std::list<MarkerView*> MarkerViewList ;
MarkerViewList marker_view_list ;
/** The parent group that this item is a member of */
ImageFrameTimeAxisGroup* the_parent_group ;
// ------- Image data -----------
/** the image data that we display */
//unsigned char* the_rgb_data ;
/** The width of the image contained within the_rgb_data */
uint32_t image_data_width ;
/** The height of the image contained within the_rgb_data */
uint32_t image_data_height ;
/** the number of channels contained in the_rgb_data */
uint32_t image_data_num_channels ;
// ------- Our canvas element -----------
/** the CanvasImageFrame to display the image */
ArdourCanvas::ImageFrame* imageframe ;
} ; /* class ImageFrameView */
#endif /* __gtk_ardour_imageframe_view_h__ */

View File

@ -1,222 +0,0 @@
/*
Copyright (C) 2000-2007 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <gtkmm/box.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm2ext/dndtreeview.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/treestore.h>
#include <gtkmm/treepath.h>
#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <jack/jack.h>
using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace Glib;
struct ModelColumns : public TreeModel::ColumnRecord {
ModelColumns() {
add (used);
add (text);
add (port);
}
TreeModelColumn<bool> used;
TreeModelColumn<string> text;
TreeModelColumn<jack_port_t*> port;
};
jack_client_t* jack;
void
fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns)
{
RefPtr<TreeModel> old = display->get_model();
display->set_model (RefPtr<TreeStore>(0));
model->clear ();
const char ** ports;
typedef map<string,vector<pair<string,string> > > PortMap;
PortMap portmap;
PortMap::iterator i;
ports = jack_get_ports (jack, "", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput);
if (ports == 0) {
goto out;
}
/* find all the client names and group their ports into a list-by-client */
for (int n = 0; ports[n]; ++n) {
pair<string,vector<pair<string,string> > > newpair;
pair<string,string> strpair;
std::pair<PortMap::iterator,bool> result;
string str = ports[n];
string::size_type pos;
string portname;
pos = str.find (':');
newpair.first = str.substr (0, pos);
portname = str.substr (pos+1);
/* this may or may not succeed at actually inserting.
we don't care, however: we just want an iterator
that gives us either the inserted element or
the existing one with the same name.
*/
result = portmap.insert (newpair);
strpair.first = portname;
strpair.second = str;
result.first->second.push_back (strpair);
}
for (i = portmap.begin(); i != portmap.end(); ++i) {
/* i->first is a client name, i->second is a PortMap of all of its ports */
TreeModel::Row parent = *(model->append());
parent[columns->used] = false;
parent[columns->text] = i->first;
parent[columns->port] = 0;
for (vector<pair<string,string> >::iterator s = i->second.begin(); s != i->second.end(); ++s) {
/* s->first is a port name */
TreeModel::Row row = *(model->append (parent.children()));
row[columns->used] = ((random()%2) == 1);
row[columns->text] = s->first;
row[columns->port] = (jack_port_t*) random();
}
}
out:
display->set_model (old);
}
void
selection_changed (RefPtr<TreeModel> model, TreeView* display, ModelColumns* columns)
{
// TreeSelection::ListHandle_Path selection = display->get_selection()->get_selected_rows ();
//
// for (TreeSelection::ListHandle_Path::iterator x = selection.begin(); x != selection.end(); ++x) {
// cerr << "selected: " << (*(model->get_iter (*x)))[columns->text] << endl;
// }
}
bool
selection_filter (const RefPtr<TreeModel>& model, const TreeModel::Path& path, bool yn, ModelColumns* columns)
{
return (*(model->get_iter (path)))[columns->port] != 0;
}
void
object_drop (string type, uint32_t cnt, void** ptr)
{
cerr << "Got an object drop of " << cnt << " pointer(s) of type " << type << endl;
}
int
main (int argc, char* argv[])
{
Main app (&argc, &argv);
Window win;
VBox vpacker;
HBox hpacker;
Button rescan ("rescan");
ScrolledWindow scrollerA;
ScrolledWindow scrollerB;
DnDTreeView displayA;
DnDTreeView displayB;
ModelColumns columns;
if ((jack = jack_client_new ("itest")) == NULL) {
return -1;
}
RefPtr<TreeStore> modelA = TreeStore::create (columns);
RefPtr<TreeStore> modelB = TreeStore::create (columns);
displayA.set_model (modelA);
displayA.append_column ("Use", columns.used);
displayA.append_column ("Source/Port", columns.text);
displayA.set_reorderable (true);
displayA.add_object_drag (columns.port.index(), "ports");
displayA.signal_object_drop.connect (ptr_fun (object_drop));
displayA.get_selection()->set_mode (SELECTION_MULTIPLE);
displayA.get_selection()->set_select_function (sigc::bind (ptr_fun (selection_filter), &columns));
displayA.get_selection()->signal_changed().connect (sigc::bind (ptr_fun (selection_changed), modelA, &displayA, &columns));
displayB.set_model (modelB);
displayB.append_column ("Use", columns.used);
displayB.append_column ("Source/Port", columns.text);
displayB.set_reorderable (true);
displayB.add_object_drag (columns.port.index(), "ports");
displayB.signal_object_drop.connect (ptr_fun (object_drop));
displayB.get_selection()->set_mode (SELECTION_MULTIPLE);
displayB.get_selection()->set_select_function (sigc::bind (ptr_fun (selection_filter), &columns));
displayB.get_selection()->signal_changed().connect (sigc::bind (ptr_fun (selection_changed), modelB, &displayB, &columns));
scrollerA.add (displayA);
scrollerB.add (displayB);
hpacker.pack_start (scrollerA);
hpacker.pack_start (scrollerB);
vpacker.pack_start (hpacker);
vpacker.pack_start (rescan, false, false);
win.add (vpacker);
win.set_size_request (500, 400);
win.show_all ();
rescan.signal_clicked().connect (sigc::bind (ptr_fun (fill_it), modelA, &displayA, &columns));
rescan.signal_clicked().connect (sigc::bind (ptr_fun (fill_it), modelB, &displayB, &columns));
fill_it (modelA, &displayA, &columns);
fill_it (modelB, &displayB, &columns);
displayA.expand_all();
displayB.expand_all();
app.run ();
jack_client_close (jack);
}

View File

@ -1,280 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string>
#include "pbd/error.h"
#include <gtkmm/menu.h>
#include <gtkmm2ext/utils.h>
#include "ardour/session.h"
#include "ardour/utils.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "imageframe_time_axis.h"
#include "selection.h"
#include "imageframe_time_axis_view.h"
#include "marker_time_axis_view.h"
#include "imageframe_view.h"
#include "marker_time_axis.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace PBD;
using namespace Gtk;
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new MarkerTimeAxis
*
* @param ed the PublicEditor
* @param sess the current session
* @param canvas the parent canvas item
* @param name the name/id of this time axis
* @param tav the associated track view that this MarkerTimeAxis is marking up
*/
MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas, const string & name, TimeAxisView* tav)
: AxisView(sess),
VisualTimeAxis(name, ed, sess, canvas)
{
/* the TimeAxisView these markers are associated with */
marked_time_axis = tav ;
_color = unique_random_color() ;
time_axis_name = name ;
selection_group = new Group (*canvas_display);
selection_group->hide();
// intialize our data items
marker_menu = 0 ;
y_position = -1 ;
/* create our new marker time axis strip view */
view = new MarkerTimeAxisView(*this) ;
// set the initial time axis text label
label_view() ;
// set the initial height of this time axis
set_height(hSmall) ;
}
/**
* Destructor
* Responsible for destroying any marker items upon this time axis
*/
MarkerTimeAxis::~MarkerTimeAxis()
{
CatchDeletion (this); /* EMIT_SIGNAL */
// destroy the view helper
// this handles removing and destroying individual marker items
if(view) {
delete view ;
view = 0 ;
}
}
//---------------------------------------------------------------------------------------//
// ui methods & data
void
MarkerTimeAxis::set_height (uint32_t h)
{
VisualTimeAxis::set_height(h) ;
// tell out view helper of the change too
if (view != 0)
{
view->set_height((double) height) ;
}
// tell those interested that we have had our height changed
gui_changed("track_height",(void*)0) ; /* EMIT_SIGNAL */
}
/**
* Sets the number of frames per pixel that are used.
* This is used to determine the sizes of items upon this time axis
*
* @param spu the number of frames per pixel
*/
void
MarkerTimeAxis::set_samples_per_pixel (double fpp)
{
TimeAxisView::set_samples_per_pixel (editor.get_current_zoom());
if (view) {
view->set_samples_per_pixel (fpp);
}
}
/**
* Show the popup edit menu
*
* @param button the mouse button pressed
* @param time when to show the popup
* @param clicked_mv the MarkerView that the event ocured upon, or 0 if none
* @param with_item true if an item has been selected upon the time axis, used to set context menu
*/
void
MarkerTimeAxis::popup_marker_time_axis_edit_menu(int button, int32_t time, MarkerView* clicked_mv, bool with_item)
{
if (!marker_menu)
{
build_marker_menu() ;
}
if (with_item)
{
marker_item_menu->set_sensitive(true) ;
}
else
{
marker_item_menu->set_sensitive(false) ;
}
marker_menu->popup(button,time) ;
}
/**
* convenience method to select a new track color and apply it to the view and view items
*
*/
void
MarkerTimeAxis::select_track_color()
{
if(VisualTimeAxis::choose_time_axis_color())
{
if(view)
{
view->apply_color(_color) ;
}
}
}
/**
* Handles the building of the popup menu
*/
void
MarkerTimeAxis::build_display_menu()
{
using namespace Menu_Helpers;
/* get the size menu ready */
build_size_menu() ;
/* prepare it */
TimeAxisView::build_display_menu();
/* now fill it with our stuff */
MenuList& items = display_menu->items();
items.push_back(MenuElem (_("Rename"), sigc::mem_fun(*this, &VisualTimeAxis::start_time_axis_rename)));
items.push_back(SeparatorElem()) ;
items.push_back(MenuElem (_("Height"), *size_menu));
items.push_back(MenuElem (_("Color"), sigc::mem_fun(*this, &MarkerTimeAxis::select_track_color)));
items.push_back(SeparatorElem()) ;
items.push_back(MenuElem (_("Remove"), sigc::bind(sigc::mem_fun(*this, &MarkerTimeAxis::remove_this_time_axis), (void*)this)));
}
/**
* handles the building of the MarkerView sub menu
*/
void
MarkerTimeAxis::build_marker_menu()
{
using namespace Menu_Helpers;
using Gtk::Menu;
marker_menu = manage(new Menu) ;
marker_menu->set_name ("ArdourContextMenu");
MenuList& items = marker_menu->items();
marker_item_menu = manage(new Menu) ;
marker_item_menu->set_name ("ArdourContextMenu");
MenuList& marker_sub_items = marker_item_menu->items() ;
/* duration menu */
Menu* duration_menu = manage(new Menu) ;
duration_menu->set_name ("ArdourContextMenu");
MenuList& duration_items = duration_menu->items() ;
if(view)
{
duration_items.push_back(MenuElem (_("1 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.0))) ;
duration_items.push_back(MenuElem (_("1.5 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.5))) ;
duration_items.push_back(MenuElem (_("2 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.0))) ;
duration_items.push_back(MenuElem (_("2.5 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.5))) ;
duration_items.push_back(MenuElem (_("3 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 3.0))) ;
}
//duration_items.push_back(SeparatorElem()) ;
//duration_items.push_back(MenuElem (_("custom"), sigc::mem_fun(*this, &ImageFrameTimeAxis::set_marker_duration_custom))) ;
marker_sub_items.push_back(MenuElem(_("Duration (sec)"), *duration_menu)) ;
marker_sub_items.push_back(SeparatorElem()) ;
marker_sub_items.push_back(MenuElem (_("Remove Marker"), sigc::bind(sigc::mem_fun(view, &MarkerTimeAxisView::remove_selected_marker_view),(void*)this))) ;
items.push_back(MenuElem(_("Marker"), *marker_item_menu)) ;
items.push_back(MenuElem (_("Rename Track"), sigc::mem_fun(*this,&MarkerTimeAxis::start_time_axis_rename))) ;
marker_menu->show_all() ;
}
/**
* Returns the view helper of this TimeAxis
*
* @return the view helper of this TimeAxis
*/
MarkerTimeAxisView*
MarkerTimeAxis::get_view()
{
return(view) ;
}
/**
* Returns the TimeAxisView that this markerTimeAxis is marking up
*
* @return the TimeAXisView that this MarkerTimeAxis is marking
*/
TimeAxisView*
MarkerTimeAxis::get_marked_time_axis()
{
return(marked_time_axis) ;
}

View File

@ -1,148 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_marker_time_axis_h__
#define __ardour_marker_time_axis_h__
#include <string>
#include "ardour_dialog.h"
#include "route_ui.h"
#include "enums.h"
#include "time_axis_view.h"
#include "visual_time_axis.h"
namespace ARDOUR {
class Session;
}
class PublicEditor;
class ImageFrameView ;
class ImageFrameTimeAxisView ;
class MarkerTimeAxisView ;
class MarkerView ;
/**
* MarkerTimeAxis defines a visual time axis for holding marker items associated with other time axis, and time axis items.
*
* The intention of this time axis is to allow markers with duration to be arranged on the time line
* to add additional timing information to items on an associated time axis, for instance the addition
* of effect duration and timings
*/
class MarkerTimeAxis : public VisualTimeAxis
{
public:
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new MarkerTimeAxis
*
* @param ed the PublicEditor
* @param sess the current session
* @param canvas the parent canvas item
* @param name the name/id of this time axis
* @param tav the associated track view that this MarkerTimeAxis is marking up
*/
MarkerTimeAxis(PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas, const std::string & name, TimeAxisView* tav) ;
/**
* Destructor
* Responsible for destroying any marker items upon this time axis
*/
virtual ~MarkerTimeAxis() ;
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of this TrackView to one of the defined TrackHeights
*
* @param h the number of pixels to set the height to
*/
virtual void set_height(uint32_t h) ;
virtual void set_samples_per_pixel (double);
/**
* Show the popup edit menu
*
* @param button the mouse button pressed
* @param time when to show the popup
* @param clicked_mv the MarkerView that the event ocured upon, or 0 if none
* @param with_item true if an item has been selected upon the time axis, used to set context menu
*/
void popup_marker_time_axis_edit_menu(int button, int32_t time, MarkerView* clicked_mv, bool with_item) ;
//---------------------------------------------------------------------------------------//
// Parent/Child helper object accessors
/**
* Returns the view helper of this TimeAxis
*
* @return the view helper of this TimeAxis
*/
MarkerTimeAxisView* get_view() ;
/**
* Returns the TimeAxisView that this markerTimeAxis is marking up
*
* @return the TimeAXisView that this MarkerTimeAxis is marking
*/
TimeAxisView* get_marked_time_axis() ;
private:
/**
* convenience method to select a new track color and apply it to the view and view items
*
*/
void select_track_color() ;
/**
* Handles the building of the popup menu
*/
virtual void build_display_menu() ;
/**
* handles the building of the MarkerView sub menu
*/
void build_marker_menu() ;
/** The associated TimeAxis that this MarkerTimeAxis is marking up */
TimeAxisView* marked_time_axis ;
/** Our time axis view helper */
MarkerTimeAxisView *view ;
/** the popup menu available by clicking upon this time axis */
Gtk::Menu *marker_menu ;
/** specialized sub menu available when clicking upon and item upon this time axis */
Gtk::Menu *marker_item_menu ;
} ; /* class MarkerTimeAxis */
#endif /* __ardour_imageframe_time_axis_h__ */

View File

@ -1,388 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <algorithm>
#include <gtkmm.h>
#include <gtkmm2ext/gtk_ui.h>
#include "marker_time_axis_view.h"
#include "marker_time_axis.h"
#include "marker_view.h"
#include "imageframe_view.h"
#include "imageframe_time_axis.h"
#include "public_editor.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "ardour_ui.h"
#include "i18n.h"
using namespace ARDOUR ;
using namespace Editing;
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Construct a new MarkerTimeAxisView helper time axis helper
*
* @param mta the TimeAxsiView that this objbect is the helper for
*/
MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
: _trackview (tv)
{
region_color = _trackview.color();
stream_base_color = ARDOUR_UI::config()->get_canvasvar_MarkerTrack();
canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display);
canvas_rect = new ArdourCanvas::Rectangle (*canvas_group);
canvas_rect->property_x1() = 0.0;
canvas_rect->property_y1() = 0.0;
canvas_rect->property_x2() = max_framepos;
canvas_rect->property_y2() = (double)20;
canvas_rect->property_outline_color_rgba() = ARDOUR_UI::config()->get_canvasvar_MarkerTrack();
canvas_rect->property_fill_color_rgba() = stream_base_color;
canvas_rect->signal_event().connect (sigc::bind (sigc::mem_fun (_trackview.editor, &PublicEditor::canvas_marker_time_axis_view_event), canvas_rect, &_trackview));
_samples_per_pixel = _trackview.editor.get_current_zoom() ;
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_pixel));
MarkerView::CatchDeletion.connect (*this, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, _1), gui_context());
}
/**
* Destructor
* Reposinsibly for destroying all marker items that may have been added to this time axis view
*
*/
MarkerTimeAxisView::~MarkerTimeAxisView()
{
// destroy everything upon this view
for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter)
{
MarkerView* mv = (*iter) ;
MarkerViewList::iterator next = iter ;
next++ ;
marker_view_list.erase(iter) ;
delete mv ;
mv = 0 ;
iter = next ;
}
delete canvas_rect;
canvas_rect = 0 ;
delete canvas_group;
canvas_group = 0 ;
}
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of the time axis view and the item upon it
*
* @param height the new height
*/
int
MarkerTimeAxisView::set_height(gdouble h)
{
if (h < 10.0 || h > 1000.0) {
return -1;
}
canvas_rect->property_y2() = h;
for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) {
(*i)->set_y_position_and_height(0, h);
}
return 0;
}
/**
* Sets the position of this view helper on the canvas
*
* @param x the x position upon the canvas
* @param y the y position upon the canvas
*/
int
MarkerTimeAxisView::set_position(gdouble x, gdouble y)
{
canvas_group->property_x() = x;
canvas_group->property_y() = y;
return 0;
}
/**
* Sets the current frames per pixel.
* this method tells each item upon the time axis of the change
*
* @param fpp the new frames per pixel value
*/
int
MarkerTimeAxisView::set_samples_per_pixel (double fpp)
{
if (spp < 1.0) {
return -1;
}
_samples_per_pixel = fpp;
for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) {
(*i)->set_samples_per_pixel (spp);
}
return 0;
}
/**
* Sets the color of the items contained upon this view helper
*
* @param color the new base color
*/
void
MarkerTimeAxisView::apply_color(Gdk::Color& color)
{
region_color = color;
for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); i++)
{
(*i)->set_color (region_color) ;
}
}
//---------------------------------------------------------------------------------------//
// Child MarkerView Accessors/Mutators
/**
* Adds a marker view to the list of items upon this time axis view helper
* the new MarkerView is returned
*
* @param ifv the ImageFrameView that the new item is marking up
* @param mark_text the text to be displayed uopn the new marker item
* @param mark_id the unique id of the new item
* @param start the position the new item should be placed upon the time line
* @param duration the duration the new item should be placed upon the timeline
* @param src the identity of the object that initiated the change
*/
MarkerView*
MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, framepos_t start, framecnt_t dur, void* src)
{
if(ifv->has_marker_view_item(mark_id))
{
return(0) ;
}
MarkerView* mv = new MarkerView(canvas_group,
&_trackview,
ifv,
_trackview.editor.get_current_zoom(),
region_color,
mark_type,
mark_id,
start,
dur) ;
ifv->add_marker_view_item(mv, src) ;
marker_view_list.push_front(mv) ;
MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */
return(mv) ;
}
/**
* Returns the named MarkerView or 0 if the named marker does not exist
*
* @param item_id the unique id of the item to search for
* @return the named MarkerView, or 0 if it is not held upon this view
*/
MarkerView*
MarkerTimeAxisView::get_named_marker_view(std::string item_id)
{
MarkerView* mv = 0 ;
for(MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i)
{
if(((MarkerView*)*i)->get_item_name() == item_id)
{
mv = ((MarkerView*)*i) ;
break ;
}
}
return(mv) ;
}
/**
* Removes the currently selected MarverView
* Note that this method actually destroys the MarkerView too.
* We assume that since we own the object, we are allowed to do this
*
* @param src the identity of the object that initiated the change
* @see add_marker_view
*/
void
MarkerTimeAxisView::remove_selected_marker_view(void* src)
{
std::string removed ;
if (selected_time_axis_item)
{
MarkerViewList::iterator i ;
if((i = find (marker_view_list.begin(), marker_view_list.end(), selected_time_axis_item)) != marker_view_list.end())
{
marker_view_list.erase(i) ;
MarkerViewRemoved(selected_time_axis_item->get_item_name(),src) ; /* EMIT_SIGNAL */
delete(selected_time_axis_item) ;
selected_time_axis_item = 0 ;
}
}
else
{
//No selected marker view
}
}
/**
* Removes and returns the named MarkerView from the list of MarkerView held by this view helper
*
* @param item_id the MarkerView unique id to remove
* @param src the identity of the object that initiated the change
* @see add_marker_view
*/
MarkerView*
MarkerTimeAxisView::remove_named_marker_view(std::string item_id, void* src)
{
MarkerView* mv = 0 ;
MarkerViewList::iterator i = marker_view_list.begin() ;
for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter)
{
if(((MarkerView*)*i)->get_item_name() == item_id)
{
mv = ((MarkerView*)*i) ;
marker_view_list.erase(i) ;
MarkerViewRemoved(mv->get_item_name(), src) ; /* EMIT_SIGNAL */
// break from the for loop
break;
}
i++ ;
}
return(mv) ;
}
/**
* Removes mv from the list of MarkerView upon this TimeAxis
*
* @param mv the MarkerView to remove
* @param src the identity of the object that initiated the change
*/
void
MarkerTimeAxisView::remove_marker_view (MarkerView* mv)
{
ENSURE_GUI_THREAD (*this, &MarkerTimeAxisView::remove_marker_view, mv, src)
MarkerViewList::iterator i;
if((i = find (marker_view_list.begin(), marker_view_list.end(), mv)) != marker_view_list.end()) {
marker_view_list.erase(i) ;
// Assume this remove happened locally, else use remove_named_marker_time_axis
// let listeners know that the named MarkerTimeAxis has been removed
MarkerViewRemoved(mv->get_item_name(), src) ; /* EMIT_SIGNAL */
}
}
/**
* Sets the duration of the selected MarkerView to the specified number of seconds
*
* @param sec the duration to set the MArkerView to, in seconds
*/
void
MarkerTimeAxisView::set_marker_duration_sec(double sec)
{
if(get_selected_time_axis_item() != 0)
{
get_selected_time_axis_item()->set_duration((sec * _trackview.editor.session()->frame_rate()), this);
}
}
//---------------------------------------------------------------------------------------//
// Selected item methods
/**
* Sets the currently selected item upon this time axis
*
* @param mv the item to set selected
*/
void
MarkerTimeAxisView::set_selected_time_axis_item(MarkerView* mv)
{
selected_time_axis_item = mv ;
}
/**
* Clears any selected item upon this time axis
*
*/
void
MarkerTimeAxisView::clear_selected_time_axis_item()
{
selected_time_axis_item = 0 ;
}
/**
* Returnsthe currently selected item upon this time axis
*
* @return the currently selected item pon this time axis
*/
MarkerView*
MarkerTimeAxisView::get_selected_time_axis_item()
{
return(selected_time_axis_item) ;
}
/**
* convenience method to re-get the samples per unit and tell items upon this view
*
*/
void
MarkerTimeAxisView::reset_samples_per_pixel ()
{
set_samples_per_pixel (_trackview.editor.get_current_zoom());
}

View File

@ -1,230 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_marker_time_axis_view_h__
#define __ardour_marker_time_axis_view_h__
#include <list>
#include <gdkmm/color.h>
#include "ardour/location.h"
class PublicEditor;
class MarkerTimeAxis;
class ImageFrameView ;
class MarkerView ;
class TimeAxisView ;
class TimeAxisViewItem ;
/**
* A view helper for handling MarkerView objects.
* This object is responsible for the time axis canvas view, and
* maintains the list of items that have been added to it
*/
class MarkerTimeAxisView : public sigc::trackable
{
public:
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Construct a new MarkerTimeAxisView helper time axis helper
*
* @param mta the TimeAxsiView that this objbect is the helper for
*/
MarkerTimeAxisView(MarkerTimeAxis& mta) ;
/**
* Destructor
* Reposinsibly for destroying all marker items that may have been added to this time axis view
*
*/
~MarkerTimeAxisView () ;
//---------------------------------------------------------------------------------------//
// Parent/Child helper object accessors
/**
* Returns the TimeAxisView thatt his object is acting as a helper for
*
* @return the TimeAxisView that this object is acting as a view helper for
*/
MarkerTimeAxis& trackview() { return _trackview; }
/**
*
*/
ArdourCanvas::Item *canvas_item() { return canvas_group; }
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of the time axis view and the item upon it
*
* @param height the new height
*/
int set_height(gdouble height) ;
/**
* Sets the position of this view helper on the canvas
*
* @param x the x position upon the canvas
* @param y the y position upon the canvas
*/
int set_position(gdouble x, gdouble y) ;
int set_samples_per_pixel (double);
/**
* Returns the current samples per unit of this time axis view helper
*
* @return the current samples per unit of this time axis view helper
*/
gdouble get_samples_per_pixel() { return _samples_per_pixel; }
/**
* Sets the color of the items contained upon this view helper
*
* @param color the new base color
*/
void apply_color(Gdk::Color& color) ;
//---------------------------------------------------------------------------------------//
// Child MarkerView Accessors/Mutators
/**
* Adds a marker view to the list of items upon this time axis view helper
* the new MarkerView is returned
*
* @param ifv the ImageFrameView that the new item is marking up
* @param mark_text the text to be displayed uopn the new marker item
* @param mark_id the unique id of the new item
* @param start the position the new item should be placed upon the time line
* @param duration the duration the new item should be placed upon the timeline
* @param src the identity of the object that initiated the change
*/
MarkerView* add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, nframes_t start, nframes_t dur, void* src) ;
/**
* Returns the named MarkerView or 0 if the named marker does not exist
*
* @param item_id the unique id of the item to search for
* @return the named MarkerView, or 0 if it is not held upon this view
*/
MarkerView* get_named_marker_view(std::string item_id) ;
/**
* Removes the currently selected MarverView
* Note that this method actually destroys the MarkerView too.
* We assume that since we own the object, we are allowed to do this
*
* @param src the identity of the object that initiated the change
* @see add_marker_view
*/
void remove_selected_marker_view(void* src) ;
/**
* Removes and returns the named MarkerView from the list of MarkerView held by this view helper
*
* @param item_id the MarkerView unique id to remove
* @param src the identity of the object that initiated the change
* @see add_marker_view
*/
MarkerView* remove_named_marker_view(std::string item_id, void* src) ;
/**
* Removes mv from the list of MarkerView upon this TimeAxis
*
* @param mv the MarkerView to remove
* @param src the identity of the object that initiated the change
*/
void remove_marker_view(MarkerView* item, void* src) ;
//---------------------------------------------------------------------------------------//
// Selected item methods
/**
* Sets the currently selected item upon this time axis
*
* @param mv the item to set selected
*/
void set_selected_time_axis_item(MarkerView* mv) ;
/**
* Clears any selected item upon this time axis
*
*/
void clear_selected_time_axis_item() ;
/**
* Returnsthe currently selected item upon this time axis
*
* @return the currently selected item pon this time axis
*/
MarkerView* get_selected_time_axis_item() ;
/**
* Sets the duration of the selected MarkerView to the specified number of seconds
*
* @param sec the duration to set the MArkerView to, in seconds
*/
void set_marker_duration_sec(double sec) ;
//---------------------------------------------------------------------------------//
// Emitted Signals
/** Emitted when a MarkerView is Added */
sigc::signal<void,MarkerView*,void*> MarkerViewAdded ;
/** Emitted when a MarkerView Item is removed */
sigc::signal<void,std::string,void*> MarkerViewRemoved ;
private:
/**
* convenience method to re-get the samples per unit and tell items upon this view
*
*/
void reset_samples_per_pixel() ;
/** The list of items held by this time axis view helper */
typedef std::list<MarkerView *> MarkerViewList ;
MarkerViewList marker_view_list;
/** the currently selected time axis item upon this time axis */
MarkerView* selected_time_axis_item ;
/* the TimeAxisView that this object is acting as the view helper for */
MarkerTimeAxis& _trackview ;
ArdourCanvas::Group *canvas_group ;
ArdourCanvas::Rectangle *canvas_rect; /* frame around the whole thing */
/** the current frames per pixel */
double _samples_per_pixel;
/* XXX why are these different? */
Gdk::Color region_color;
uint32_t stream_base_color;
}; /* class MarkerTimeAxisView */
#endif /* __ardour_marker_time_axis_view_h__ */

View File

@ -1,134 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtkmm.h>
#include "imageframe_time_axis.h"
#include "imageframe_view.h"
#include "public_editor.h"
#include "marker_view.h"
using namespace ARDOUR ;
PBD::Signal1<void,MarkerView*> MarkerView::CatchDeletion
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new MarkerView
*
* @param parent the parent canvas item
* @param tv the parent TimeAxisView of this item
* @param tavi the TimeAxisViewItem that this item is to be assciated (marking) with
* @param spu the current samples per unit
* @param base_color
* @param mark_type the marker type/name text, eg fade out, pan up etc.
* @param mark_id unique name/id of this item
* @param start the start time of this item
* @param duration the duration of this item
*/
MarkerView::MarkerView(ArdourCanvas::Group *parent,
TimeAxisView* tv,
ImageFrameView* marked,
double spu,
Gdk::Color& basic_color,
std::string mark_type,
std::string mark_id,
framepos_t start,
framecnt_t duration)
: TimeAxisViewItem(mark_id, *parent,*tv,spu,basic_color,start,duration)
{
mark_type_text = mark_type ;
marked_item = marked ;
// set the canvas item text to the marker type, not the id
set_name_text(mark_type_text) ;
// hook up our canvas events
if (frame_handle_start) {
frame_handle_start->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_start_handle_event), frame_handle_start, this));
frame_handle_end->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_end_handle_event), frame_handle_end, this));
}
group->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_item_view_event), group, this));
set_position(start, this) ;
set_duration(duration, this) ;
}
/**
* Destructor
* Destroys this Marker Item and removes the association between itself and the item it is marking.
*/
MarkerView::~MarkerView()
{
// remove the association our marked may still have to us
if(marked_item)
{
marked_item->remove_marker_view_item(this, this) ;
}
}
//---------------------------------------------------------------------------------------//
// Marker Type Methods
/**
* Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc.
*
* @param type_text the marker type text of this item
*/
void
MarkerView::set_mark_type_text(std::string type_text)
{
mark_type_text = type_text ;
MarkTypeChanged(mark_type_text, this) ; /* EMIT_SIGNAL */
}
/**
* Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc.
*
* @return the marker type text of this item
*/
std::string
MarkerView::get_mark_type_text() const
{
return(mark_type_text) ;
}
//---------------------------------------------------------------------------------------//
// Marked Item Methods
ImageFrameView*
MarkerView::set_marked_item(ImageFrameView* item)
{
ImageFrameView* temp = marked_item ;
marked_item = item ;
MarkedItemChanged(marked_item, this) ; /* EMIT_SIGNAL */
return(temp) ;
}
ImageFrameView*
MarkerView::get_marked_item()
{
return(marked_item) ;
}

View File

@ -1,135 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __gtk_ardour_marker_view_h__
#define __gtk_ardour_marker_view_h__
#include <string>
#include "time_axis_view_item.h"
namespace Gdk {
class Color;
}
class MarkerTimeAxisView ;
class ImageFrameView ;
/**
* MarkerView defines a marker item that may be placed upon a MarkerTimeAxis.
*
* The aim of the MarkerView is to provide additional timing details for visual based time axis.
* The MarkerView item is associated with one other TimeAxisViewItem and has a start and a duration.
*/
class MarkerView : public TimeAxisViewItem
{
public:
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Constructs a new MarkerView
*
* @param parent the parent canvas item
* @param tv the parent TimeAxisView of this item
* @param marked the Item that this item is to be assciated (marking) with
* @param spu the current samples per unit
* @param base_color
* @param mark_type the marker type/name text, eg fade out, pan up etc.
* @param mark_id unique name/id of this item
* @param start the start time of this item
* @param duration the duration of this item
*/
MarkerView(ArdourCanvas::Group *parent,
TimeAxisView *tv,
ImageFrameView* marked,
double spu,
Gdk::Color& base_color,
std::string mark_type,
std::string mark_id,
nframes_t start,
nframes_t duration) ;
/**
* Destructor
* Destroys this Marker Item and removes the association between itself and the item it is marking.
*/
~MarkerView() ;
static PBD::Signal1<void,MarkerView*> CatchDeletion;
//---------------------------------------------------------------------------------------//
// Marker Type Methods
/**
* Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc.
*
* @param type_text the marker type text of this item
*/
void set_mark_type_text(std::string type_text) ;
/**
* Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc.
*
* @return the marker type text of this item
*/
std::string get_mark_type_text() const ;
//---------------------------------------------------------------------------------------//
// Marked Item Methods
/**
* Returns the time axis item being marked by this item
*
* @return the time axis item being marked by this item
*/
ImageFrameView* get_marked_item() ;
/**
* Sets the time axis item being marker by this item
*
* @param item the time axis item to be marked by this item
* @return the previously marked item, or 0 if no previous marked item exists
*/
ImageFrameView* set_marked_item(ImageFrameView* item) ;
//---------------------------------------------------------------------------------//
// Emitted Signals
/** Emitted when the mark type text is changed */
sigc::signal<void,std::string,void*> MarkTypeChanged ;
/** Emitted when the Marked Item is changed */
sigc::signal<void,ImageFrameView*,void*> MarkedItemChanged ;
protected:
private:
/** the unique name/id of this item */
std::string mark_type_text ;
/* a pointer to the time axis item this marker is assoiated(marking up) with */
ImageFrameView* marked_item ;
} ; /* class MarkerView */
#endif /* __gtk_ardour_imageframe_view_h__ */

View File

@ -69,11 +69,7 @@ class AutomationTimeAxisView;
class ControlPoint;
class DragManager;
class Editor;
class ImageFrameTimeAxis;
class ImageFrameView;
class Marker;
class MarkerTimeAxis;
class MarkerView;
class MeterMarker;
class MouseCursors;
class PlaylistSelector;
@ -351,17 +347,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
virtual bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
#ifdef WITH_CMT
virtual bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
virtual bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*) = 0;
virtual bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
virtual bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0;
virtual bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*) = 0;
virtual bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
virtual bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
#endif
static const int window_border_width;
static const int container_border_width;
static const int vertical_spacing;

View File

@ -211,7 +211,7 @@ TranscodeFfmpeg::probe ()
}
} else if (i->at(5) == X_("codec_type=audio")) { /* new ffprobe */
AudioStream as;
FFAudioStream as;
for (std::vector<std::string>::iterator kv = i->begin(); kv != i->end(); ++kv) {
const size_t kvsep = kv->find('=');
if(kvsep == std::string::npos) continue;

View File

@ -25,12 +25,12 @@
#include "system_exec.h"
/* TODO: use a namespace here ? */
struct AudioStream {
struct FFAudioStream {
std::string name;
std::string stream_id;
uint32_t channels;
};
typedef std::vector<AudioStream> AudioStreams;
typedef std::vector<FFAudioStream> AudioStreams;
typedef std::map<std::string,std::string> FFSettings;
/** @class TranscodeFfmpeg

View File

@ -314,3 +314,71 @@ video_draw_cross (Glib::RefPtr<Gdk::Pixbuf> img)
if (n_channels>3) p[3] = 255;
}
}
extern "C" {
#include <curl/curl.h>
struct MemoryStruct {
char *data;
size_t size;
};
static size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) {
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)data;
mem->data = (char *)realloc(mem->data, mem->size + realsize + 1);
if (mem->data) {
memcpy(&(mem->data[mem->size]), ptr, realsize);
mem->size += realsize;
mem->data[mem->size] = 0;
}
return realsize;
}
char *curl_http_get (const char *u, int *status) {
CURL *curl;
CURLcode res;
struct MemoryStruct chunk;
long int httpstatus;
if (status) *status = 0;
//usleep(500000); return NULL; // TEST & DEBUG
if (strncmp("http://", u, 7)) return NULL;
chunk.data=NULL;
chunk.size=0;
curl = curl_easy_init();
if(!curl) return NULL;
curl_easy_setopt(curl, CURLOPT_URL, u);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
curl_easy_setopt(curl, CURLOPT_USERAGENT, ARDOUR_USER_AGENT);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, ARDOUR_CURL_TIMEOUT);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
#ifdef CURLERRORDEBUG
char curlerror[CURL_ERROR_SIZE] = "";
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlerror);
#endif
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpstatus);
curl_easy_cleanup(curl);
if (status) *status = httpstatus;
if (res) {
#ifdef CURLERRORDEBUG
printf("curl_http_get() failed: %s\n", curlerror);
#endif
return NULL;
}
if (httpstatus != 200) {
free (chunk.data);
chunk.data = NULL;
}
return (chunk.data);
}
} /* end extern "C" */

View File

@ -53,4 +53,8 @@ bool video_query_info (
double &video_aspect_ratio
);
extern "C" {
char *curl_http_get (const char *u, int *status);
}
#endif /* __gtk_ardour_video_utils_h__ */

View File

@ -292,69 +292,3 @@ VideoImageFrame::http_get_again(framepos_t /*fn*/) {
http_get_thread(this);
}
extern "C" {
#include <curl/curl.h>
struct MemoryStruct {
char *data;
size_t size;
};
static size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) {
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)data;
mem->data = (char *)realloc(mem->data, mem->size + realsize + 1);
if (mem->data) {
memcpy(&(mem->data[mem->size]), ptr, realsize);
mem->size += realsize;
mem->data[mem->size] = 0;
}
return realsize;
}
char *curl_http_get (const char *u, int *status) {
CURL *curl;
CURLcode res;
struct MemoryStruct chunk;
long int httpstatus;
if (status) *status = 0;
if (strncmp("http://", u, 7)) return NULL;
chunk.data=NULL;
chunk.size=0;
curl = curl_easy_init();
if(!curl) return NULL;
curl_easy_setopt(curl, CURLOPT_URL, u);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
curl_easy_setopt(curl, CURLOPT_USERAGENT, ARDOUR_USER_AGENT);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, ARDOUR_CURL_TIMEOUT);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
#ifdef CURLERRORDEBUG
char curlerror[CURL_ERROR_SIZE] = "";
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlerror);
#endif
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpstatus);
curl_easy_cleanup(curl);
if (status) *status = httpstatus;
if (res) {
#ifdef CURLERRORDEBUG
printf("curl_http_get() failed: %s\n", curlerror);
#endif
return NULL;
}
if (httpstatus != 200) {
free (chunk.data);
chunk.data = NULL;
}
return (chunk.data);
}
} /* end extern "C" */

View File

@ -108,8 +108,4 @@ class VideoImageFrame : public sigc::trackable
};
extern "C" {
char *curl_http_get (const char *u, int *status);
}
#endif /* __ardour_video_image_frame_h__ */

View File

@ -1,418 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include "pbd/error.h"
#include "pbd/stl_delete.h"
#include "pbd/whitespace.h"
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/selector.h>
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/choice.h>
#include "ardour/session.h"
#include "ardour/utils.h"
#include "ardour/processor.h"
#include "ardour/location.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "imageframe_time_axis.h"
#include "imageframe_time_axis_view.h"
#include "marker_time_axis_view.h"
#include "imageframe_view.h"
#include "marker_time_axis.h"
#include "marker_view.h"
#include "utils.h"
#include "prompter.h"
#include "rgb_macros.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace PBD;
using namespace Gtk;
/**
* Abstract Constructor for base visual time axis classes
*
* @param name the name/Id of thie TimeAxis
* @param ed the Ardour PublicEditor
* @param sess the current session
* @param canvas the parent canvas object
*/
VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas)
: AxisView(sess),
TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
visual_button (_("v")),
size_button (_("h"))
{
time_axis_name = name ;
_color = unique_random_color() ;
name_entry.signal_activate().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_changed)) ;
name_entry.signal_button_press_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_button_press_handler)) ;
name_entry.signal_button_release_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_button_release_handler)) ;
name_entry.signal_key_release_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_key_release_handler)) ;
size_button.set_name("TrackSizeButton") ;
visual_button.set_name("TrackVisualButton") ;
hide_button.set_name("TrackRemoveButton") ;
hide_button.add(*(Gtk::manage(new Gtk::Image(get_xpm("small_x.xpm")))));
size_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VisualTimeAxis::size_click)) ;
visual_button.signal_clicked().connect (sigc::mem_fun (*this, &VisualTimeAxis::visual_click)) ;
hide_button.signal_clicked().connect (sigc::mem_fun (*this, &VisualTimeAxis::hide_click)) ;
ARDOUR_UI::instance()->set_tip(size_button,_("Display Height")) ;
ARDOUR_UI::instance()->set_tip(visual_button, _("Visual options")) ;
ARDOUR_UI::instance()->set_tip(hide_button, _("Hide this track")) ;
controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
/* remove focus from the buttons */
size_button.unset_flags(Gtk::CAN_FOCUS) ;
hide_button.unset_flags(Gtk::CAN_FOCUS) ;
visual_button.unset_flags(Gtk::CAN_FOCUS) ;
set_height (hNormal) ;
}
/**
* VisualTimeAxis Destructor
*
*/
VisualTimeAxis::~VisualTimeAxis()
{
}
//---------------------------------------------------------------------------------------//
// Name/Id Accessors/Mutators
void
VisualTimeAxis::set_time_axis_name(const string & name, void* src)
{
std::string old_name = time_axis_name ;
if(name != time_axis_name)
{
time_axis_name = name ;
label_view() ;
editor.route_name_changed(this) ;
NameChanged(time_axis_name, old_name, src) ; /* EMIT_SIGNAL */
}
}
std::string
VisualTimeAxis::name() const
{
return(time_axis_name) ;
}
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of this TrackView to one of the defined TrackHeghts
*
* @param h
*/
void
VisualTimeAxis::set_height(uint32_t h)
{
TimeAxisView::set_height(h);
if (h >= hNormal) {
other_button_hbox.show_all() ;
} else if (h >= hSmaller) {
other_button_hbox.hide_all() ;
} else if (h >= hSmall) {
other_button_hbox.hide_all() ;
}
}
/**
* Handle the visuals button click
*
*/
void
VisualTimeAxis::visual_click()
{
popup_display_menu(0);
}
/**
* Handle the hide buttons click
*
*/
void
VisualTimeAxis::hide_click()
{
// LAME fix for hide_button display refresh
hide_button.set_sensitive(false);
editor.hide_track_in_display (*this);
hide_button.set_sensitive(true);
}
/**
* Allows the selection of a new color for this TimeAxis
*
*/
void
VisualTimeAxis::select_track_color ()
{
if(choose_time_axis_color())
{
//Does nothing at this abstract point
}
}
/**
* Provides a color chooser for the selection of a new time axis color.
*
*/
bool
VisualTimeAxis::choose_time_axis_color()
{
bool picked ;
Gdk::Color color ;
gdouble current[4] ;
Gdk::Color current_color ;
current[0] = _color.get_red() / 65535.0 ;
current[1] = _color.get_green() / 65535.0 ;
current[2] = _color.get_blue() / 65535.0 ;
current[3] = 1.0 ;
current_color.set_rgb_p (current[0],current[1],current[2]);
color = Gtkmm2ext::UI::instance()->get_color(_("Color Selection"),picked, &current_color) ;
if (picked)
{
set_time_axis_color(color) ;
}
return(picked) ;
}
/**
* Sets the color of this TimeAxis to the specified color c
*
* @param c the new TimeAxis color
*/
void
VisualTimeAxis::set_time_axis_color(Gdk::Color c)
{
_color = c ;
}
void
VisualTimeAxis::set_selected_regionviews (RegionSelection& regions)
{
// Not handled by purely visual TimeAxis
}
//---------------------------------------------------------------------------------------//
// Handle time axis removal
/**
* Handles the Removal of this VisualTimeAxis
*
* @param src the identity of the object that initiated the change
*/
void
VisualTimeAxis::remove_this_time_axis(void* src)
{
vector<string> choices;
std::string prompt = string_compose (_("Do you really want to remove track \"%1\" ?\n\nYou may also lose the playlist used by this track.\n\n(This action cannot be undone, and the session file will be overwritten)"), time_axis_name);
choices.push_back (_("No, do nothing."));
choices.push_back (_("Yes, remove it."));
Gtkmm2ext::Choice prompter (prompt, choices);
if (prompter.run () == 1) {
/*
defer to idle loop, otherwise we'll delete this object
while we're still inside this function ...
*/
Glib::signal_idle().connect(sigc::bind(sigc::ptr_fun(&VisualTimeAxis::idle_remove_this_time_axis), this, src));
}
}
/**
* Callback used to remove this time axis during the gtk idle loop
* This is used to avoid deleting the obejct while inside the remove_this_time_axis
* method
*
* @param ta the VisualTimeAxis to remove
* @param src the identity of the object that initiated the change
*/
gint
VisualTimeAxis::idle_remove_this_time_axis(VisualTimeAxis* ta, void* src)
{
ta->VisualTimeAxisRemoved(ta->name(), src) ; /* EMIT_SIGNAL */
delete ta ;
ta = 0 ;
return(false) ;
}
//---------------------------------------------------------------------------------------//
// Handle TimeAxis rename
/**
* Construct a new prompt to receive a new name for this TimeAxis
*
* @see finish_time_axis_rename()
*/
void
VisualTimeAxis::start_time_axis_rename()
{
ArdourPrompter name_prompter;
name_prompter.set_prompt (_("new name: ")) ;
name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
name_prompter.show_all() ;
switch (name_prompter.run ()) {
case Gtk::RESPONSE_ACCEPT:
string result;
name_prompter.get_result (result);
if (result.length()) {
if (editor.get_named_time_axis(result) != 0) {
ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
return ;
}
set_time_axis_name(result, this) ;
}
}
label_view() ;
}
/**
* Handles the new name for this TimeAxis from the name prompt
*
* @see start_time_axis_rename()
*/
void
VisualTimeAxis::label_view()
{
name_label.set_text (time_axis_name);
name_entry.set_text (time_axis_name);
ARDOUR_UI::instance()->set_tip (name_entry, Glib::Markup::escape_text (time_axis_name));
}
//---------------------------------------------------------------------------------------//
// Handle name entry signals
void
VisualTimeAxis::name_entry_changed()
{
TimeAxisView::name_entry_changed ();
string x = name_entry.get_text ();
if (x == time_axis_name) {
return;
}
strip_whitespace_edges(x);
if (x.length() == 0) {
name_entry.set_text (time_axis_name);
return;
}
if (!editor.get_named_time_axis(x)) {
set_time_axis_name (x, this);
} else {
ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
name_entry.set_text(time_axis_name);
}
}
bool
VisualTimeAxis::name_entry_button_press_handler(GdkEventButton *ev)
{
if (ev->button == 3) {
return true;
}
return false
}
bool
VisualTimeAxis::name_entry_button_release_handler(GdkEventButton *ev)
{
return false;
}
bool
VisualTimeAxis::name_entry_key_release_handler(GdkEventKey* ev)
{
switch (ev->keyval) {
case GDK_Tab:
case GDK_Up:
case GDK_Down:
name_entry_changed ();
return true;
default:
break;
}
return false;
}
//---------------------------------------------------------------------------------------//
// Super class methods not handled by VisualTimeAxis
void
VisualTimeAxis::show_timestretch (framepos_t start, framepos_t end, int layers, int layer)
{
// Not handled by purely visual TimeAxis
}
void
VisualTimeAxis::hide_timestretch()
{
// Not handled by purely visual TimeAxis
}

View File

@ -1,262 +0,0 @@
/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_visual_time_axis_h__
#define __ardour_visual_time_axis_h__
#include <gtkmm/box.h>
#include <gtkmm/button.h>
#include <gtkmm2ext/selector.h>
#include "ardour_dialog.h"
#include "route_ui.h"
#include "enums.h"
#include "time_axis_view.h"
namespace ARDOUR
{
class Session ;
}
class PublicEditor;
class ImageFrameView;
class ImageFrameTimeAxisView;
class MarkersTimeAxisView;
class TimeSelection;
class RegionSelection;
class MarkerTimeAxis;
class TimeAxisViewStrip;
/**
* Base Abstact Class for TimeAxis views that operate purely within the visual domain.
*
* This class provides many of the common methods required for visual TimeAxis views. The aim is
* to provide an abstract layer during the developmnt of the visual based time axis'. Many of these
* methods have a better home further up the class heirarchy, and in fact some are replication of
* methods found within RouteUI. This, however, has been required due to various problems with previous
* versions of g++, mainly 2.95, which are not correctly handling virtual methods, virtual base classes,
* and virtual methods when used with Multiple Inheritance. Perhaps these could be combined once the
* compilers all agree on hos do to do stuff...
*/
class VisualTimeAxis : public TimeAxisView
{
public:
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* VisualTimeAxis Destructor
*
*/
virtual ~VisualTimeAxis() ;
//---------------------------------------------------------------------------------------//
// Name/Id Accessors/Mutators
/**
* Returns the name of this TimeAxis
*
* @return the name of this TimeAxis
*/
virtual std::string name() const ;
/**
* Sets the name of this TimeAxis
*
* @param name the new name of this TimeAxis
* @param src the identity of the object that initiated the change
*/
virtual void set_time_axis_name(const std::string & name, void* src) ;
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of this TrackView to one of the defined TrackHeghts
*
* @param h the number of pixels to set the height to
*/
virtual void set_height (uint32_t);
//---------------------------------------------------------------------------------------//
// Selection Methods
// selection methods are not handled by visual time axis object yet...
/**
* Not implemented
*/
virtual void set_selected_regionviews(RegionSelection&) ;
//---------------------------------------------------------------------------------//
// Emitted Signals
/**
* Emitted when we have changed the gui, and what we have shanged
*/
sigc::signal<void,const std::string &,void*> gui_changed ;
/**
* Emitted when this Visual Time Axis has been removed
* This is different to the CatchDeletion signal in that this signal
* is emitted during the deletion of this Time Axis, and not during
* the destructor, this allows us to capture the source of the deletion
* event
*/
sigc::signal<void,const std::string &,void*> VisualTimeAxisRemoved ;
/**
* Emitted when we have changed the name of this TimeAxis
*/
sigc::signal<void,const std::string &,const std::string &,void*> NameChanged ;
/**
* Emitted when this time axis has been selected for removal
*/
//sigc::signal<void,std::std::string,void*> VisualTimeAxisRemoved ;
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
/**
* Abstract Constructor for base visual time axis classes
*
* @param name the name/Id of thie TimeAxis
* @param ed the Ardour PublicEditor
* @param sess the current session
* @param canvas the parent canvas object
*/
VisualTimeAxis(const std::string & name, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ;
//---------------------------------------------------------------------------------------//
// Handle time axis removal
/**
* Handles the Removal of this VisualTimeAxis
*
* @param src the identity of the object that initiated the change
*/
virtual void remove_this_time_axis(void* src) ;
/**
* Callback used to remove this time axis during the gtk idle loop
* This is used to avoid deleting the obejct while inside the remove_this_time_axis
* method
*
* @param ta the VisualTimeAxis to remove
* @param src the identity of the object that initiated the change
*/
static gint idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) ;
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Handle the visuals button click
*
*/
void visual_click() ;
/**
* Handle the hide buttons click
*
*/
void hide_click() ;
/**
* Allows the selection of a new color for this TimeAxis
*
*/
virtual void select_track_color() ;
/**
* Provides a color chooser for the selection of a new time axis color.
*
*/
bool choose_time_axis_color() ;
/**
* Sets the color of this TimeAxis to the specified color c
*
* @param c the new TimeAxis color
*/
void set_time_axis_color(Gdk::Color c) ;
//---------------------------------------------------------------------------------------//
// Handle TimeAxis rename
/**
* Construct a new prompt to receive a new name for this TimeAxis
*
* @see finish_time_axis_rename()
*/
void start_time_axis_rename() ;
/**
* Handles the new name for this TimeAxis from the name prompt
*
* @see start_time_axis_rename()
*/
virtual void label_view() ;
//---------------------------------------------------------------------------------------//
// Handle name entry signals
void name_entry_changed() ;
bool name_entry_key_release_handler(GdkEventKey*) ;
//---------------------------------------------------------------------------------------//
// VisualTimeAxis Widgets
Gtk::HBox other_button_hbox ;
Gtk::Button hide_button ;
Gtk::Button visual_button ;
Gtk::Button size_button ;
/** the name of this TimeAxis object */
std::string time_axis_name ;
//---------------------------------------------------------------------------------------//
// Super class methods not handled by VisualTimeAxis
/**
* Not handled by purely Visual TimeAxis
*
* @todo should VisualTimeAxis handle this?
*/
void show_timestretch (nframes_t start, nframes_t end, int layers, int layer);
/**
* Not handle by purely visual TimeAxis
* @see show_timestratch
*/
virtual void hide_timestretch() ;
private:
};
#endif /* __ardour_visual_time_axis_h__ */

View File

@ -126,6 +126,7 @@ public:
LilvNode* lv2_InputPort;
LilvNode* lv2_OutputPort;
LilvNode* lv2_enumeration;
LilvNode* lv2_freewheeling;
LilvNode* lv2_inPlaceBroken;
LilvNode* lv2_integer;
LilvNode* lv2_reportsLatency;
@ -1336,6 +1337,17 @@ LV2Plugin::describe_parameter(Evoral::Parameter which)
lilv_plugin_get_port_by_index(_impl->plugin, which.id()), _world.ext_notOnGUI)) {
return X_("hidden");
}
if (lilv_port_has_property(_impl->plugin,
lilv_plugin_get_port_by_index(_impl->plugin, which.id()), _world.lv2_freewheeling)) {
return X_("hidden");
}
if (lilv_port_has_property(_impl->plugin,
lilv_plugin_get_port_by_index(_impl->plugin, which.id()), _world.lv2_sampleRate)) {
return X_("hidden");
}
if (lilv_port_has_property(_impl->plugin,
lilv_plugin_get_port_by_index(_impl->plugin, which.id()), _world.lv2_reportsLatency)) {
return X_("latency");
@ -1902,6 +1914,7 @@ LV2World::LV2World()
lv2_sampleRate = lilv_new_uri(world, LV2_CORE__sampleRate);
lv2_toggled = lilv_new_uri(world, LV2_CORE__toggled);
lv2_enumeration = lilv_new_uri(world, LV2_CORE__enumeration);
lv2_freewheeling = lilv_new_uri(world, LV2_CORE__freeWheeling);
midi_MidiEvent = lilv_new_uri(world, LILV_URI_MIDI_EVENT);
rdfs_comment = lilv_new_uri(world, LILV_NS_RDFS "comment");
rsz_minimumSize = lilv_new_uri(world, LV2_RESIZE_PORT__minimumSize);
@ -1919,6 +1932,7 @@ LV2World::~LV2World()
lilv_node_free(rdfs_comment);
lilv_node_free(midi_MidiEvent);
lilv_node_free(lv2_enumeration);
lilv_node_free(lv2_freewheeling);
lilv_node_free(lv2_toggled);
lilv_node_free(lv2_sampleRate);
lilv_node_free(lv2_reportsLatency);

View File

@ -14,6 +14,11 @@ ARDOURSTACK_ROOT=$HOME/a3/inst
# the waf build tree to use when copying built/generated files
BUILD_ROOT=../../build
# where harvid and xjadeo binaries are cached
if test -z "$CACHEDIR" -o ! -d "$CACHEDIR"; then
CACHEDIR=`pwd`
fi
MIXBUS=
WITH_LADSPA=0
WITH_HARVID=
@ -24,6 +29,7 @@ EXTERNAL_JACK=
VENDOR=Ardour ;
BUILDTYPE=""
if [ $# -eq 0 ] ; then
echo ""
echo "ERROR - Please specify build type"
@ -529,12 +535,24 @@ done
if test x$WITH_HARVID != x ; then
cd $APPBIN
HARVID_VERSION=$(curl http://ardour.org/files/video-tools/harvid_version.txt)
curl -L http://ardour.org/files/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
| tar -x -z --exclude=README --exclude=harvid.1 --strip-components=1 || exit 1
XJADEO_VERSION=$(curl http://ardour.org/files/video-tools/xjadeo_version.txt)
curl -L http://ardour.org/files/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
| tar -x -z --exclude=README --exclude=xjadeo.1 --strip-components=1 || exit 1
HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
rsync -Pa \
rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
"$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
rsync -Pa \
rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
"$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
tar -x -z \
--exclude=README --exclude=harvid.1 --strip-components=1 \
-f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
tar -x -z \
--exclude=README --exclude=xjadeo.1 --strip-components=1 \
-f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
mv xjadeo xjremote
cd -
fi

View File

@ -6,6 +6,11 @@ GTKSTACK_ROOT=$HOME/gtk/inst
ARDOURSTACK_ROOT=$HOME/a3/inst
BUILD_ROOT=../../build
# where harvid and xjadeo binaries are cached
if test -z "$CACHEDIR" -o ! -d "$CACHEDIR"; then
CACHEDIR=`pwd`
fi
SAE=
MIXBUS=
WITH_HARVID=
@ -506,19 +511,25 @@ fi
if test x$WITH_HARVID != x ; then
echo "installing video tools.."
# TODO move files to http://ardour.org/files/ - symlink 'latest'
HARVID_VERSION=$(curl http://ardour.org/files/video-tools/harvid_version.txt)
XJADEO_VERSION=$(curl http://ardour.org/files/video-tools/xjadeo_version.txt)
HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
echo "copying harvid and xjadeo ..."
curl -L -o "$PRODUCT_PKG_DIR/xjadeo-${XJADEO_VERSION:1}.dmg" "http://sourceforge.net/projects/xjadeo/files/xjadeo/${XJADEO_VERSION}/jadeo-${XJADEO_VERSION:1}.dmg/download"
curl -L "http://ardour.org/files/video-tools/harvid-osx-${HARVID_VERSION}.tgz"\
| tar -x -z -C $PRODUCT_PKG_DIR/$APPROOT
ls -l "$PRODUCT_PKG_DIR/xjadeo-${XJADEO_VERSION:1}.dmg"
JADEO=$(hdiutil attach "$PRODUCT_PKG_DIR/xjadeo-${XJADEO_VERSION:1}.dmg" | grep Apple_HFS | grep dev/ | cut -f 3)
rsync -Pa \
rsync://ardour.org/video-tools/harvid-osx-${HARVID_VERSION}.tgz \
"$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
rsync -Pa \
rsync://ardour.org/video-tools/jadeo-${XJADEO_VERSION:1}.dmg \
"$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg"
tar -x -z \
-C $PRODUCT_PKG_DIR/$APPROOT \
-f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
JADEO=$(hdiutil attach "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg" | grep Apple_HFS | grep dev/ | cut -f 3)
cp -r "${JADEO}/Jadeo.app" "$PRODUCT_PKG_DIR/"
hdiutil detach "${JADEO}"
rm "$PRODUCT_PKG_DIR/xjadeo-${XJADEO_VERSION:1}.dmg"
DMGWINBOTTOM=580
YPOS=$[ $DMGWINBOTTOM - 300 ]
@ -600,7 +611,7 @@ hdiutil eject "${DiskDevice}"
hdiutil convert -format UDZO "${TMPDMG}" -imagekey zlib-level=9 -o "${UC_DMG}"
# Delete the temporary files
rm "$TMPDMG"
rmdir "$MNTPATH"
rm -rf "$MNTPATH"
echo "setting file icon ..."