2005-11-15 22:23:41 -05:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000-2003 Paul Davis
|
2005-11-15 22:23:41 -05:00
|
|
|
Written by Colin Law, CMT, Glasgow
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "imageframe_view.h"
|
|
|
|
#include "imageframe_time_axis.h"
|
|
|
|
#include "imageframe_time_axis_view.h"
|
|
|
|
#include "imageframe_time_axis_group.h"
|
|
|
|
#include "marker_time_axis_view.h"
|
|
|
|
#include "marker_time_axis.h"
|
|
|
|
#include "marker_view.h"
|
|
|
|
#include "editor.h"
|
|
|
|
#include "i18n.h"
|
2005-11-15 22:20:54 -05:00
|
|
|
#include "canvas_impl.h"
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/error.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
|
|
|
#include "imageframe_socket_handler.h"
|
|
|
|
#include "ardour_image_compositor_socket.h"
|
|
|
|
#include "public_editor.h"
|
2009-12-21 13:23:07 -05:00
|
|
|
#include "gui_thread.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
using namespace Gtk;
|
Large nasty commit in the form of a 5000 line patch chock-full of completely
unecessary changes. (Sorry, doing a "sprint" based thing, this is the end of the first one)
Achieved MIDI track and bus creation, associated Jack port and diskstream creation, and minimal GUI stuff for creating them. Should be set to start work on actually recording and playing midi to/from disk now.
Relevant (significant) changes:
- Creation of a Buffer class. Base class is type agnostic so things can point to a buffer but not care what kind it is (otherwise it'd be a template). Derived into AudioBuffer and MidiBuffer, with a type tag because checking type is necessary in parts of the code where dynamic_cast wouldn't be wise. Originally I considered this a hack, but passing around a type proved to be a very good solution to all the other problems (below). There is a 1:1 mapping between jack port data types and ardour Buffer types (with a conversion function), but that's easily removed if it ever becomes necessary. Having the type scoped in the Buffer class is maybe not the best spot for it, but whatever (this is proof of concept kinda stuff right now...)
- IO now has a "default" port type (passed to the constructor and stored as a member), used by ensure_io (and similar) to create n ports. IO::register_***_port has a type argument that defaults to the default type if not passed. Rationale: previous IO API is identical, no changes needed to existing code, but path is paved for multiple port types in one IO, which we will need for eg synth plugin inserts, among other things. This is not quite ideal (best would be to only have the two port register functions and have them take a type), but the alternative is a lot of work (namely destroying the 'ensure' functions and everything that uses them) for very little gain. (I am convinced after quite a few tries at the whiteboard that subclassing IO in any way is not a feasible option, look at it's inheritance diagram in Doxygen and you can see why)
- AudioEngine::register_audio_input_port is now register_input_port and takes a type argument. Ditto for output.
- (Most significant change) AudioDiskstream abstracted into Distream, and sibling MidiDiskstream created. Very much still a work in progress, but Diskstream is there to switch references over to (most already are), which is the important part. It is still unclear what the MIDI diskstream's relation to channels is, but I'm pretty sure they will be single channel only (so SMF Type 0) since noone can come up with a reason otherwise.
- MidiTrack creation. Same thing as AudioTrack but with a different default type basically. No big deal here.
- Random cleanups and variable renamings etc. because I have OCD and can't help myself. :)
Known broken: Loading of sessions containing MIDI tracks.
git-svn-id: svn://localhost/ardour2/branches/midi@641 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-26 12:01:34 -04:00
|
|
|
using namespace PBD;
|
2009-10-01 21:49:57 -04:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
TimeAxisView*
|
|
|
|
Editor::get_named_time_axis(const string & name)
|
|
|
|
{
|
|
|
|
TimeAxisView* tav = 0 ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-10-01 21:49:57 -04:00
|
|
|
for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i)
|
|
|
|
{
|
|
|
|
if (((TimeAxisView*)*i)->name() == name)
|
|
|
|
{
|
|
|
|
tav = ((TimeAxisView*)*i) ;
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return(tav) ;
|
|
|
|
}
|
2005-11-15 22:20:54 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* <CMT Additions file="editor.cc"> */
|
|
|
|
|
|
|
|
void
|
2005-12-22 07:23:54 -05:00
|
|
|
Editor::add_imageframe_time_axis(const string & track_name, void* src)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
// check for duplicate name
|
|
|
|
if(get_named_time_axis(track_name))
|
|
|
|
{
|
|
|
|
warning << "Repeated time axis name" << std::endl ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-12-12 10:02:15 -05:00
|
|
|
Gtkmm2ext::UI::instance()->call_slot (boost::bind (&Editor::handle_new_imageframe_time_axis_view, this,track_name, src));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::connect_to_image_compositor()
|
|
|
|
{
|
|
|
|
if(image_socket_listener == 0)
|
|
|
|
{
|
|
|
|
image_socket_listener = ImageFrameSocketHandler::create_instance(*this) ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if(image_socket_listener->is_connected() == true)
|
|
|
|
{
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX should really put this somewhere safe
|
2005-12-24 08:07:36 -05:00
|
|
|
const char * host_ip = "127.0.0.1" ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-12-24 08:07:36 -05:00
|
|
|
bool retcode = image_socket_listener->connect(host_ip, ardourvis::DEFAULT_PORT) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if(retcode == false)
|
|
|
|
{
|
|
|
|
// XXX need to get some return status here
|
|
|
|
warning << "Image Compositor Connection attempt failed" << std::endl ;
|
|
|
|
return ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// add the socket to the gui loop, and keep the retuned tag value of the input
|
|
|
|
gint tag = gdk_input_add(image_socket_listener->get_socket_descriptor(), GDK_INPUT_READ,ImageFrameSocketHandler::image_socket_callback,image_socket_listener) ;
|
|
|
|
image_socket_listener->set_gdk_input_tag(tag) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item)
|
|
|
|
{
|
2005-12-12 15:54:55 -05:00
|
|
|
// GTK2FIX
|
2010-09-17 14:20:37 -04:00
|
|
|
//framepos_t offset = static_cast<framepos_t>(frames_per_unit * (edit_hscroll_slider_width/2)) ;
|
|
|
|
framepos_t offset = 0;
|
2005-12-12 15:54:55 -05:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t x_pos = 0 ;
|
2007-01-09 18:24:54 -05:00
|
|
|
|
|
|
|
if (item->get_position() < offset) {
|
2005-09-25 14:42:24 -04:00
|
|
|
x_pos = 0 ;
|
2007-01-09 18:24:54 -05:00
|
|
|
} else {
|
|
|
|
x_pos = item->get_position() - offset + (item->get_duration() / 2);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-01-11 15:36:35 -05:00
|
|
|
reset_x_origin (x_pos);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-12-22 07:23:54 -05:00
|
|
|
Editor::add_imageframe_marker_time_axis(const string & track_name, TimeAxisView* marked_track, void* src)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
// Can we only sigc::bind 2 data Items?
|
|
|
|
// @todo we really want to sigc::bind the src attribute too, for the moment tracks can only be added remotely,
|
2005-09-25 14:42:24 -04:00
|
|
|
// so this is not too much of an issue, however will need to be looked at again
|
2009-12-12 10:02:15 -05:00
|
|
|
Gtkmm2ext::UI::instance()->call_slot (boost::bind (&Editor::handle_new_imageframe_marker_time_axis_view, this, track_name, marked_track));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-08-16 16:36:14 -04:00
|
|
|
ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if(ifta)
|
|
|
|
{
|
|
|
|
ImageFrameTimeAxisGroup* iftag = ifta->get_view()->get_selected_imageframe_group() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if(iftag)
|
|
|
|
{
|
|
|
|
ImageFrameView* selected_ifv = ifta->get_view()->get_selected_imageframe_view() ;
|
|
|
|
ifta->popup_imageframe_edit_menu(button, time, selected_ifv, with_item) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-08-16 16:36:14 -04:00
|
|
|
MarkerTimeAxis* mta = dynamic_cast<MarkerTimeAxis*>(clicked_axisview) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if(mta)
|
|
|
|
{
|
|
|
|
MarkerView* selected_mv = mta->get_view()->get_selected_time_axis_item() ;
|
|
|
|
if(selected_mv)
|
|
|
|
{
|
|
|
|
mta->popup_marker_time_axis_edit_menu(button,time, selected_mv, with_item) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* </CMT Additions file="editor.cc"> */
|
|
|
|
|
|
|
|
/* <CMT Additions file="editor_canvas_events.cc"> */
|
2005-11-15 22:20:54 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_imageframe_item_view_event (GdkEvent *event, ArdourCanvas::Item* item, ImageFrameView *ifv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE ;
|
|
|
|
ImageFrameTimeAxisGroup* iftag = 0 ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2006-08-16 16:36:14 -04:00
|
|
|
clicked_axisview = &ifv->get_time_axis_view();
|
2005-09-25 14:42:24 -04:00
|
|
|
iftag = ifv->get_time_axis_group() ;
|
2006-08-16 16:36:14 -04:00
|
|
|
dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview)->get_view()->set_selected_imageframe_view(iftag, ifv);
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler (item, event, ImageFrameItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, ImageFrameItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, ImageFrameItem) ;
|
|
|
|
break ;
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
return(ret) ;
|
|
|
|
}
|
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_imageframe_start_handle_event (GdkEvent *event, ArdourCanvas::Item* item, ImageFrameView *ifv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE ;
|
|
|
|
ImageFrameTimeAxisGroup* iftag = 0 ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2006-08-16 16:36:14 -04:00
|
|
|
clicked_axisview = &ifv->get_time_axis_view() ;
|
2005-09-25 14:42:24 -04:00
|
|
|
iftag = ifv->get_time_axis_group() ;
|
2006-08-16 16:36:14 -04:00
|
|
|
dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview)->get_view()->set_selected_imageframe_view(iftag, ifv);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler (item, event, ImageFrameHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, ImageFrameHandleStartItem) ;
|
|
|
|
break;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, ImageFrameHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, ImageFrameHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, ImageFrameHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
return(ret) ;
|
|
|
|
}
|
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_imageframe_end_handle_event (GdkEvent *event, ArdourCanvas::Item* item, ImageFrameView *ifv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE ;
|
|
|
|
ImageFrameTimeAxisGroup* iftag = 0 ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2006-08-16 16:36:14 -04:00
|
|
|
clicked_axisview = &ifv->get_time_axis_view() ;
|
2005-09-25 14:42:24 -04:00
|
|
|
iftag = ifv->get_time_axis_group() ;
|
2006-08-16 16:36:14 -04:00
|
|
|
dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview)->get_view()->set_selected_imageframe_view(iftag, ifv);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler (item, event, ImageFrameHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, ImageFrameHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, ImageFrameHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, ImageFrameHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, ImageFrameHandleEndItem);
|
|
|
|
break ;
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
return(ret) ;
|
|
|
|
}
|
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_imageframe_view_event (GdkEvent* event, ArdourCanvas::Item* item, ImageFrameTimeAxis* ifta)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE ;
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2006-08-16 16:36:14 -04:00
|
|
|
clicked_axisview = ifta ;
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler (item, event, ImageFrameTimeAxisItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, ImageFrameTimeAxisItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
break ;
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
return(ret) ;
|
|
|
|
}
|
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_marker_time_axis_view_event (GdkEvent* event, ArdourCanvas::Item* item, MarkerTimeAxis* mta)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE ;
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2006-08-16 16:36:14 -04:00
|
|
|
clicked_axisview = mta ;
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler(item, event, MarkerTimeAxisItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler(item, event, MarkerTimeAxisItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
return(ret) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_markerview_item_view_event (GdkEvent* event, ArdourCanvas::Item* item, MarkerView* mta)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE ;
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2006-08-16 16:36:14 -04:00
|
|
|
clicked_axisview = &mta->get_time_axis_view() ;
|
|
|
|
dynamic_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->set_selected_time_axis_item(mta);
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler(item, event, MarkerViewItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler(item, event, MarkerViewItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler(item, event, MarkerViewItem) ;
|
|
|
|
break ;
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
return(ret) ;
|
|
|
|
}
|
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_markerview_start_handle_event (GdkEvent* event, ArdourCanvas::Item* item, MarkerView* mta)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE ;
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2006-08-16 16:36:14 -04:00
|
|
|
clicked_axisview = &mta->get_time_axis_view() ;
|
|
|
|
dynamic_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->set_selected_time_axis_item(mta) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler(item, event, MarkerViewHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler(item, event, MarkerViewHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler(item, event, MarkerViewHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler(item, event, MarkerViewHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler(item, event, MarkerViewHandleStartItem) ;
|
|
|
|
break ;
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
return(ret) ;
|
|
|
|
}
|
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_markerview_end_handle_event (GdkEvent* event, ArdourCanvas::Item* item, MarkerView* mta)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE ;
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2006-08-16 16:36:14 -04:00
|
|
|
clicked_axisview = &mta->get_time_axis_view() ;
|
|
|
|
dynamic_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->set_selected_time_axis_item(mta) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler(item, event, MarkerViewHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler(item, event, MarkerViewHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler(item, event, MarkerViewHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler(item, event, MarkerViewHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler(item, event, MarkerViewHandleEndItem) ;
|
|
|
|
break ;
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
|
|
|
return(ret) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* </CMT Additions file="editor_canvas_events.cc"> */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* <CMT Additions file="editor_mouse.cc"> */
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::start_imageframe_grab(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-08-16 16:36:14 -04:00
|
|
|
ImageFrameView* ifv = ((ImageFrameTimeAxis*)clicked_axisview)->get_view()->get_selected_imageframe_view() ;
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.copy = false ;
|
|
|
|
drag_info.item = item ;
|
|
|
|
drag_info.data = ifv ;
|
|
|
|
drag_info.motion_callback = &Editor::imageframe_drag_motion_callback;
|
|
|
|
drag_info.finished_callback = &Editor::timeaxis_item_drag_finished_callback;
|
|
|
|
drag_info.last_frame_position = ifv->get_position() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
drag_info.source_trackview = &ifv->get_time_axis_view() ;
|
|
|
|
drag_info.dest_trackview = drag_info.source_trackview;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* this is subtle. raising the regionview itself won't help,
|
|
|
|
because raise_to_top() just puts the item on the top of
|
|
|
|
its parent's stack. so, we need to put the trackview canvas_display group
|
|
|
|
on the top, since its parent is the whole canvas.
|
|
|
|
|
|
|
|
however, this hides the measure bars within that particular trackview,
|
|
|
|
so move them to the top afterwards.
|
|
|
|
*/
|
|
|
|
|
2005-11-12 17:07:07 -05:00
|
|
|
drag_info.item->raise_to_top();
|
2008-04-11 10:06:50 -04:00
|
|
|
drag_info.source_trackview->canvas_display->raise_to_top();
|
2005-11-12 17:07:07 -05:00
|
|
|
//time_line_group->raise_to_top();
|
|
|
|
cursor_group->raise_to_top ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
start_grab(event) ;
|
|
|
|
|
|
|
|
drag_info.pointer_frame_offset = pixel_to_frame(drag_info.grab_x) - drag_info.last_frame_position;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::start_markerview_grab(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-08-16 16:36:14 -04:00
|
|
|
MarkerView* mv = ((MarkerTimeAxis*)clicked_axisview)->get_view()->get_selected_time_axis_item() ;
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.copy = false ;
|
|
|
|
drag_info.item = item ;
|
|
|
|
drag_info.data = mv ;
|
|
|
|
drag_info.motion_callback = &Editor::markerview_drag_motion_callback;
|
|
|
|
drag_info.finished_callback = &Editor::timeaxis_item_drag_finished_callback;
|
|
|
|
drag_info.last_frame_position = mv->get_position() ;
|
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
drag_info.source_trackview = &mv->get_time_axis_view() ;
|
|
|
|
drag_info.dest_trackview = drag_info.source_trackview;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* this is subtle. raising the regionview itself won't help,
|
|
|
|
because raise_to_top() just puts the item on the top of
|
|
|
|
its parent's stack. so, we need to put the trackview canvas_display group
|
|
|
|
on the top, since its parent is the whole canvas.
|
|
|
|
|
|
|
|
however, this hides the measure bars within that particular trackview,
|
|
|
|
so move them to the top afterwards.
|
|
|
|
*/
|
|
|
|
|
2005-11-12 17:07:07 -05:00
|
|
|
drag_info.item->raise_to_top();
|
2008-04-11 10:06:50 -04:00
|
|
|
drag_info.source_trackview->canvas_display->raise_to_top();
|
2005-11-12 17:07:07 -05:00
|
|
|
//time_line_group->raise_to_top();
|
|
|
|
cursor_group->raise_to_top ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
start_grab(event) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.pointer_frame_offset = pixel_to_frame(drag_info.grab_x) - drag_info.last_frame_position ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
double cx, cy ;
|
|
|
|
|
|
|
|
MarkerView* mv = reinterpret_cast<MarkerView*>(drag_info.data) ;
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t pending_region_position ;
|
|
|
|
framepos_t pointer_frame ;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
pointer_frame = event_frame(event, &cx, &cy) ;
|
|
|
|
|
|
|
|
snap_to(pointer_frame) ;
|
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
if (pointer_frame > (framepos_t) drag_info.pointer_frame_offset)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
pending_region_position = pointer_frame - drag_info.pointer_frame_offset ;
|
|
|
|
snap_to(pending_region_position) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// we dont allow marker items to extend beyond, or in front of the marked items so
|
|
|
|
// cap the value to the marked items position and duration
|
2009-10-14 12:10:01 -04:00
|
|
|
if((pending_region_position + mv->get_duration()) >= ((mv->get_marked_item()->get_position()) + (mv->get_marked_item()->get_duration())))
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
pending_region_position = (mv->get_marked_item()->get_position() + mv->get_marked_item()->get_duration()) - (mv->get_duration()) ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
else if(pending_region_position <= mv->get_marked_item()->get_position())
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
pending_region_position = mv->get_marked_item()->get_position() ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pending_region_position = mv->get_marked_item()->get_position() ;
|
|
|
|
}
|
|
|
|
|
|
|
|
drag_info.last_frame_position = pending_region_position ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// we treat this as a special case, usually we want to send the identitiy of the caller
|
|
|
|
// but in this case, that would trigger our socket handler to handle the event, sending
|
|
|
|
// notification to the image compositor. This would be fine, except that we have not
|
|
|
|
// finished the drag, we therefore do not want to sent notification until we have
|
|
|
|
// completed the drag, only then do we want the image compositor notofied.
|
|
|
|
// We therefore set the caller identity to the special case of 0
|
|
|
|
mv->set_position(pending_region_position, 0) ;
|
|
|
|
|
|
|
|
show_verbose_time_cursor(pending_region_position) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
double cx, cy ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
ImageFrameView* ifv = reinterpret_cast<ImageFrameView*>(drag_info.data) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t pending_region_position;
|
|
|
|
framepos_t pointer_frame;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
pointer_frame = event_frame(event, &cx, &cy) ;
|
|
|
|
|
|
|
|
snap_to(pointer_frame) ;
|
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
if (pointer_frame > (framepos_t) drag_info.pointer_frame_offset)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
pending_region_position = pointer_frame - drag_info.pointer_frame_offset ;
|
|
|
|
snap_to(pending_region_position) ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pending_region_position = 0 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
drag_info.grab_x = cx;
|
|
|
|
//drag_info.last_frame_position = pending_region_position ;
|
|
|
|
drag_info.current_pointer_frame = pending_region_position ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// we treat this as a special case, usually we want to send the identitiy of the caller
|
|
|
|
// but in this case, that would trigger our socket handler to handle the event, sending
|
|
|
|
// notification to the image compositor. This would be fine, except that we have not
|
|
|
|
// finished the drag, we therefore do not want to sent notification until we have
|
|
|
|
// completed the drag, only then do we want the image compositor notofied.
|
|
|
|
// We therefore set the caller identity to the special case of 0
|
|
|
|
ifv->set_position(pending_region_position, 0) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
show_verbose_time_cursor(pending_region_position) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t where ;
|
2005-09-25 14:42:24 -04:00
|
|
|
TimeAxisViewItem* tavi = reinterpret_cast<TimeAxisViewItem*>(drag_info.data) ;
|
|
|
|
|
|
|
|
bool item_x_movement = (drag_info.last_frame_position != tavi->get_position()) ;
|
|
|
|
|
|
|
|
hide_verbose_canvas_cursor() ;
|
|
|
|
|
|
|
|
/* no x or y movement either means the regionview hasn't been moved, or has been moved
|
|
|
|
but is back in it's original position/trackview.*/
|
|
|
|
|
|
|
|
if(!item_x_movement && event && event->type == GDK_BUTTON_RELEASE)
|
|
|
|
{
|
|
|
|
/* No motion: either set the current region, or align the clicked region
|
|
|
|
with the current one.
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(item_x_movement)
|
|
|
|
{
|
|
|
|
/* base the new region position on the current position of the regionview.*/
|
|
|
|
where = drag_info.current_pointer_frame ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// final call to set position after the motion to tell interested parties of the new position
|
|
|
|
tavi->set_position(where, this) ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//where = tavi->get_position() ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
// get the selected item from the parent time axis
|
2006-08-16 16:36:14 -04:00
|
|
|
ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
if(ifta)
|
|
|
|
{
|
|
|
|
ImageFrameView* ifv = ifta->get_view()->get_selected_imageframe_view() ;
|
|
|
|
|
|
|
|
if (ifv == 0) {
|
|
|
|
fatal << _("programming error: no ImageFrameView selected") << endmsg;
|
|
|
|
/*NOTREACHED*/
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
drag_info.item = ifv->get_canvas_frame() ;
|
|
|
|
drag_info.data = ifv;
|
|
|
|
drag_info.grab_x = event->motion.x;
|
|
|
|
drag_info.cumulative_x_drag = 0;
|
|
|
|
drag_info.motion_callback = &Editor::imageframe_start_handle_trim_motion ;
|
|
|
|
drag_info.finished_callback = &Editor::imageframe_start_handle_end_trim ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
start_grab(event) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
show_verbose_time_cursor(ifv->get_position(), 10) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
// get the selected item from the parent time axis
|
2006-08-16 16:36:14 -04:00
|
|
|
ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if(ifta)
|
|
|
|
{
|
|
|
|
ImageFrameView* ifv = ifta->get_view()->get_selected_imageframe_view() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (ifv == 0)
|
|
|
|
{
|
|
|
|
fatal << _("programming error: no ImageFrameView selected") << endmsg ;
|
|
|
|
/*NOTREACHED*/
|
|
|
|
return ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.item = ifv->get_canvas_frame() ;
|
|
|
|
drag_info.data = ifv ;
|
|
|
|
drag_info.grab_x = event->motion.x ;
|
|
|
|
drag_info.cumulative_x_drag = 0 ;
|
|
|
|
drag_info.motion_callback = &Editor::imageframe_end_handle_trim_motion ;
|
|
|
|
drag_info.finished_callback = &Editor::imageframe_end_handle_end_trim ;
|
|
|
|
|
|
|
|
start_grab(event, trimmer_cursor) ;
|
|
|
|
|
|
|
|
show_verbose_time_cursor(ifv->get_position() + ifv->get_duration(), 10) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
ImageFrameView* ifv = reinterpret_cast<ImageFrameView*> (drag_info.data) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t start = 0 ;
|
|
|
|
framepos_t end = 0 ;
|
|
|
|
framepos_t pointer_frame = event_frame(event) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// chekc th eposition of the item is not locked
|
|
|
|
if(!ifv->get_position_locked()) {
|
|
|
|
snap_to(pointer_frame) ;
|
|
|
|
|
|
|
|
if(pointer_frame != drag_info.last_pointer_frame) {
|
|
|
|
start = ifv->get_position() ;
|
|
|
|
end = ifv->get_position() + ifv->get_duration() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (pointer_frame > end) {
|
|
|
|
start = end ;
|
|
|
|
} else {
|
|
|
|
start = pointer_frame ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// are we getting bigger or smaller?
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t new_dur_val = end - start ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// start handle, so a smaller pointer frame increases our component size
|
2009-10-14 12:10:01 -04:00
|
|
|
if(pointer_frame <= drag_info.grab_frame)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if(ifv->get_max_duration_active() && (new_dur_val > ifv->get_max_duration()))
|
|
|
|
{
|
|
|
|
new_dur_val = ifv->get_max_duration() ;
|
|
|
|
start = end - new_dur_val ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// current values are ok
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(ifv->get_min_duration_active() && (new_dur_val < ifv->get_min_duration()))
|
|
|
|
{
|
|
|
|
new_dur_val = ifv->get_min_duration() ;
|
|
|
|
start = end - new_dur_val ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// current values are ok
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.last_pointer_frame = pointer_frame ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* re-calculatethe duration and position of the imageframeview */
|
|
|
|
drag_info.cumulative_x_drag = new_dur_val ;
|
|
|
|
|
|
|
|
// we treat this as a special case, usually we want to send the identitiy of the caller
|
|
|
|
// but in this case, that would trigger our socket handler to handle the event, sending
|
|
|
|
// notification to the image compositor. This would be fine, except that we have not
|
|
|
|
// finished the drag, we therefore do not want to sent notification until we have
|
|
|
|
// completed the drag, only then do we want the image compositor notofied.
|
|
|
|
// We therefore set the caller identity to the special case of 0
|
|
|
|
ifv->set_duration(new_dur_val, 0) ;
|
|
|
|
ifv->set_position(start, 0) ;
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
show_verbose_time_cursor(start, 10) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
ImageFrameView* ifv = reinterpret_cast<ImageFrameView *> (drag_info.data) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (drag_info.cumulative_x_drag == 0)
|
|
|
|
{
|
|
|
|
/* just a click */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t temp = ifv->get_position() + ifv->get_duration() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
ifv->set_position((framepos_t) (temp - drag_info.cumulative_x_drag), this) ;
|
|
|
|
ifv->set_duration((framepos_t) drag_info.cumulative_x_drag, this) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
ImageFrameView* ifv = reinterpret_cast<ImageFrameView *> (drag_info.data) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t start = 0 ;
|
|
|
|
framepos_t end = 0 ;
|
|
|
|
framepos_t pointer_frame = event_frame(event) ;
|
|
|
|
framepos_t new_dur_val = 0 ;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
snap_to(pointer_frame) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (pointer_frame != drag_info.last_pointer_frame)
|
|
|
|
{
|
|
|
|
start = ifv->get_position() ;
|
|
|
|
end = ifv->get_position() + ifv->get_duration() ;
|
|
|
|
if (pointer_frame < start)
|
|
|
|
{
|
|
|
|
end = start ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
end = pointer_frame ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
new_dur_val = end - start ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// are we getting bigger or smaller?
|
|
|
|
if(pointer_frame >= drag_info.last_pointer_frame)
|
|
|
|
{
|
|
|
|
if(ifv->get_max_duration_active() && (new_dur_val > ifv->get_max_duration()))
|
|
|
|
{
|
|
|
|
new_dur_val = ifv->get_max_duration() ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(ifv->get_min_duration_active() && (new_dur_val < ifv->get_min_duration()))
|
|
|
|
{
|
|
|
|
new_dur_val = ifv->get_min_duration() ;
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.last_pointer_frame = pointer_frame ;
|
|
|
|
drag_info.cumulative_x_drag = new_dur_val ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// we treat this as a special case, usually we want to send the identitiy of the caller
|
|
|
|
// but in this case, that would trigger our socket handler to handle the event, sending
|
|
|
|
// notification to the image compositor. This would be fine, except that we have not
|
|
|
|
// finished the drag, we therefore do not want to sent notification until we have
|
|
|
|
// completed the drag, only then do we want the image compositor notofied.
|
|
|
|
// We therefore set the caller identity to the special case of 0
|
|
|
|
ifv->set_duration(new_dur_val, 0) ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
show_verbose_time_cursor(new_dur_val, 10) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::imageframe_end_handle_end_trim (ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
ImageFrameView* ifv = reinterpret_cast<ImageFrameView *> (drag_info.data) ;
|
|
|
|
|
|
|
|
if (drag_info.cumulative_x_drag == 0)
|
|
|
|
{
|
|
|
|
/* just a click */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t new_duration = (framepos_t)drag_info.cumulative_x_drag ;
|
2005-09-25 14:42:24 -04:00
|
|
|
if((new_duration <= ifv->get_max_duration()) && (new_duration >= ifv->get_min_duration()))
|
|
|
|
{
|
|
|
|
ifv->set_duration(new_duration, this) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-08-16 16:36:14 -04:00
|
|
|
MarkerView* mv = reinterpret_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->get_selected_time_axis_item() ;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (mv == 0)
|
|
|
|
{
|
|
|
|
fatal << _("programming error: no MarkerView selected") << endmsg ;
|
|
|
|
/*NOTREACHED*/
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
drag_info.item = mv->get_canvas_frame() ;
|
|
|
|
drag_info.data = mv;
|
|
|
|
drag_info.grab_x = event->motion.x;
|
|
|
|
|
|
|
|
drag_info.cumulative_x_drag = 0 ;
|
|
|
|
drag_info.motion_callback = &Editor::markerview_start_handle_trim_motion ;
|
|
|
|
drag_info.finished_callback = &Editor::markerview_start_handle_end_trim ;
|
|
|
|
|
|
|
|
start_grab(event, trimmer_cursor) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-08-16 16:36:14 -04:00
|
|
|
MarkerView* mv = reinterpret_cast<MarkerTimeAxis*>(clicked_axisview)->get_view()->get_selected_time_axis_item() ;
|
2005-09-25 14:42:24 -04:00
|
|
|
if (mv == 0)
|
|
|
|
{
|
|
|
|
fatal << _("programming error: no MarkerView selected") << endmsg ;
|
|
|
|
/*NOTREACHED*/
|
|
|
|
return ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.item = mv->get_canvas_frame() ;
|
|
|
|
drag_info.data = mv ;
|
|
|
|
drag_info.grab_x = event->motion.x ;
|
|
|
|
drag_info.cumulative_x_drag = 0 ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.motion_callback = &Editor::markerview_end_handle_trim_motion ;
|
|
|
|
drag_info.finished_callback = &Editor::markerview_end_handle_end_trim ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
start_grab(event, trimmer_cursor) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t start = 0 ;
|
|
|
|
framepos_t end = 0 ;
|
|
|
|
framepos_t pointer_frame = event_frame(event) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// chekc th eposition of the item is not locked
|
|
|
|
if(!mv->get_position_locked())
|
|
|
|
{
|
|
|
|
snap_to(pointer_frame) ;
|
|
|
|
if(pointer_frame != drag_info.last_pointer_frame)
|
|
|
|
{
|
|
|
|
start = mv->get_position() ;
|
|
|
|
end = mv->get_position() + mv->get_duration() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (pointer_frame > end)
|
|
|
|
{
|
|
|
|
start = end ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
start = pointer_frame ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// are we getting bigger or smaller?
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t new_dur_val = end - start ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if(pointer_frame <= drag_info.grab_frame)
|
|
|
|
{
|
|
|
|
if(mv->get_max_duration_active() && (new_dur_val > mv->get_max_duration()))
|
|
|
|
{
|
|
|
|
new_dur_val = mv->get_max_duration() ;
|
|
|
|
start = end - new_dur_val ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// current values are ok
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(mv->get_min_duration_active() && (new_dur_val < mv->get_min_duration()))
|
|
|
|
{
|
|
|
|
new_dur_val = mv->get_min_duration() ;
|
|
|
|
start = end - new_dur_val ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// current values are ok
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
drag_info.last_pointer_frame = pointer_frame ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* re-calculatethe duration and position of the imageframeview */
|
|
|
|
drag_info.cumulative_x_drag = new_dur_val ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// we treat this as a special case, usually we want to send the identitiy of the caller
|
|
|
|
// but in this case, that would trigger our socket handler to handle the event, sending
|
|
|
|
// notification to the image compositor. This would be fine, except that we have not
|
|
|
|
// finished the drag, we therefore do not want to sent notification until we have
|
|
|
|
// completed the drag, only then do we want the image compositor notofied.
|
|
|
|
// We therefore set the caller identity to the special case of 0
|
|
|
|
mv->set_duration(new_dur_val, 0) ;
|
|
|
|
mv->set_position(start, 0) ;
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
show_verbose_time_cursor(start, 10) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (drag_info.cumulative_x_drag == 0)
|
|
|
|
{
|
|
|
|
/* just a click */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t temp = mv->get_position() + mv->get_duration() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
mv->set_position((framepos_t) (temp - drag_info.cumulative_x_drag), this) ;
|
|
|
|
mv->set_duration((framepos_t) drag_info.cumulative_x_drag, this) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t start = 0 ;
|
|
|
|
framepos_t end = 0 ;
|
|
|
|
framepos_t pointer_frame = event_frame(event) ;
|
|
|
|
framepos_t new_dur_val = 0 ;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
snap_to(pointer_frame) ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (pointer_frame != drag_info.last_pointer_frame)
|
|
|
|
{
|
|
|
|
start = mv->get_position() ;
|
|
|
|
end = mv->get_position() + mv->get_duration() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if(pointer_frame < start)
|
|
|
|
{
|
|
|
|
end = start ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
end = pointer_frame ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
new_dur_val = end - start ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// are we getting bigger or smaller?
|
|
|
|
if(pointer_frame >= drag_info.last_pointer_frame)
|
|
|
|
{
|
|
|
|
// we cant extend beyond the item we are marking
|
|
|
|
ImageFrameView* marked_item = mv->get_marked_item() ;
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t marked_end = marked_item->get_position() + marked_item->get_duration() ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if(mv->get_max_duration_active() && (new_dur_val > mv->get_max_duration()))
|
|
|
|
{
|
|
|
|
if((start + mv->get_max_duration()) > marked_end)
|
|
|
|
{
|
|
|
|
new_dur_val = marked_end - start ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_dur_val = mv->get_max_duration() ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(end > marked_end)
|
|
|
|
{
|
|
|
|
new_dur_val = marked_end - start ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(mv->get_min_duration_active() && (new_dur_val < mv->get_min_duration()))
|
|
|
|
{
|
|
|
|
new_dur_val = mv->get_min_duration() ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
drag_info.last_pointer_frame = pointer_frame ;
|
|
|
|
drag_info.cumulative_x_drag = new_dur_val ;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// we treat this as a special case, usually we want to send the identitiy of the caller
|
|
|
|
// but in this case, that would trigger our socket handler to handle the event, sending
|
|
|
|
// notification to the image compositor. This would be fine, except that we have not
|
|
|
|
// finished the drag, we therefore do not want to sent notification until we have
|
|
|
|
// completed the drag, only then do we want the image compositor notofied.
|
|
|
|
// We therefore set the caller identity to the special case of 0
|
|
|
|
mv->set_duration(new_dur_val, 0) ;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
show_verbose_time_cursor(new_dur_val, 10) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-23 12:21:12 -05:00
|
|
|
Editor::markerview_end_handle_end_trim (ArdourCanvas::Item* item, GdkEvent* event)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ;
|
|
|
|
|
|
|
|
if (drag_info.cumulative_x_drag == 0)
|
|
|
|
{
|
|
|
|
/* just a click */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-17 14:20:37 -04:00
|
|
|
framepos_t new_duration = (framepos_t)drag_info.cumulative_x_drag ;
|
2005-09-25 14:42:24 -04:00
|
|
|
mv->set_duration(new_duration, this) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* </CMT Additions file="editor_mouse.cc"> */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* <CMT Additions file="editor_route_list.cc"> */
|
|
|
|
|
|
|
|
void
|
2005-12-22 07:23:54 -05:00
|
|
|
Editor::handle_new_imageframe_time_axis_view(const string & track_name, void* src)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
ImageFrameTimeAxis* iftav ;
|
2008-03-17 16:54:03 -04:00
|
|
|
iftav = new ImageFrameTimeAxis(track_name, *this, *session, *track_canvas) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
iftav->set_time_axis_name(track_name, this) ;
|
|
|
|
track_views.push_back(iftav) ;
|
2005-11-12 17:07:07 -05:00
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
TreeModel::Row row = *(route_display_model->append());
|
2005-11-12 17:07:07 -05:00
|
|
|
|
|
|
|
row[route_display_columns.text] = iftav->name();
|
|
|
|
row[route_display_columns.tv] = iftav;
|
2005-12-29 19:34:21 -05:00
|
|
|
route_list_display.get_selection()->select (row);
|
2005-11-12 17:07:07 -05:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
iftav->gui_changed.connect(sigc::mem_fun(*this, &Editor::handle_gui_changes)) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-12-22 07:23:54 -05:00
|
|
|
Editor::handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
MarkerTimeAxis* mta = new MarkerTimeAxis (*this, *this->session(), *track_canvas, track_name, marked_track) ;
|
2005-09-25 14:42:24 -04:00
|
|
|
((ImageFrameTimeAxis*)marked_track)->add_marker_time_axis(mta, this) ;
|
|
|
|
track_views.push_back(mta) ;
|
2005-11-12 17:07:07 -05:00
|
|
|
|
2005-11-15 22:20:54 -05:00
|
|
|
TreeModel::Row row = *(route_display_model->append());
|
2005-11-12 17:07:07 -05:00
|
|
|
|
|
|
|
row[route_display_columns.text] = mta->name();
|
|
|
|
row[route_display_columns.tv] = mta;
|
2005-12-29 19:34:21 -05:00
|
|
|
route_list_display.get_selection()->select (row);
|
2009-12-25 16:06:52 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
|
|
|
|
/* </CMT Additions file="editor_route_list.cc"> */
|