fix up conflicts after merge with master
0
foo
|
|
@ -185,7 +185,8 @@ static const char* translators[] = {
|
|||
\n\tRobert Schwede <schwede@ironshark.com>\
|
||||
\n\tBenjamin Scherrer <realhangman@web.de>\
|
||||
\n\tEdgar Aichinger <edogawa@aon.at>\
|
||||
\n\tRichard Oax <richard@pagliacciempire.de>\n"),
|
||||
\n\tRichard Oax <richard@pagliacciempire.de>\
|
||||
\n\tRobin Gloster <robin@loc-com.de>\n"),
|
||||
N_("Italian:\n\tFilippo Pappalardo <filippo@email.it>\n\tRaffaele Morelli <raffaele.morelli@gmail.com>\n"),
|
||||
N_("Portuguese:\n\tRui Nuno Capela <rncbc@rncbc.org>\n"),
|
||||
N_("Brazilian Portuguese:\n\tAlexander da Franca Fernandes <alexander@nautae.eti.br>\
|
||||
|
|
@ -590,6 +591,11 @@ About::About ()
|
|||
get_action_area()->add (*config_button);
|
||||
get_action_area()->reorder_child (*config_button, 0);
|
||||
config_button->signal_clicked().connect (mem_fun (*this, &About::show_config_info));
|
||||
|
||||
Gtk::Button *btn = static_cast<Gtk::Button*>(get_widget_for_response(Gtk::RESPONSE_CANCEL));
|
||||
if (btn) {
|
||||
btn->signal_clicked().connect(sigc::mem_fun(static_cast<Gtk::Window*>(this), &Gtk::Window::hide));
|
||||
}
|
||||
}
|
||||
|
||||
About::~About ()
|
||||
|
|
|
|||
|
|
@ -22,9 +22,11 @@
|
|||
|
||||
#include <gtkmm/aboutdialog.h>
|
||||
|
||||
#include "ardour/session_handle.h"
|
||||
|
||||
class ConfigInfoDialog;
|
||||
|
||||
class About : public Gtk::AboutDialog
|
||||
class About : public Gtk::AboutDialog, public ARDOUR::SessionHandlePtr
|
||||
{
|
||||
public:
|
||||
About ();
|
||||
|
|
|
|||
|
|
@ -63,13 +63,18 @@ vector<RefPtr<Gtk::Action> > ActionManager::jack_opposite_sensitive_actions;
|
|||
vector<RefPtr<Gtk::Action> > ActionManager::transport_sensitive_actions;
|
||||
vector<RefPtr<Gtk::Action> > ActionManager::edit_point_in_region_sensitive_actions;
|
||||
|
||||
static Glib::RefPtr<UIManager> ui_manager;
|
||||
|
||||
void
|
||||
ActionManager::init ()
|
||||
{
|
||||
std::string ui_file;
|
||||
|
||||
ui_manager = UIManager::create ();
|
||||
}
|
||||
|
||||
void
|
||||
ActionManager::load_menus ()
|
||||
{
|
||||
std::string ui_file;
|
||||
|
||||
find_file_in_search_path (ardour_config_search_path(), "ardour.menus", ui_file);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ namespace ActionManager {
|
|||
/* Ardour specific */
|
||||
|
||||
extern void init ();
|
||||
extern void load_menus ();
|
||||
|
||||
extern std::vector<Glib::RefPtr<Gtk::Action> > session_sensitive_actions;
|
||||
extern std::vector<Glib::RefPtr<Gtk::Action> > write_sensitive_actions;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ using namespace ARDOUR;
|
|||
|
||||
std::vector<std::string> AddRouteDialog::channel_combo_strings;
|
||||
|
||||
AddRouteDialog::AddRouteDialog (Session* s)
|
||||
AddRouteDialog::AddRouteDialog ()
|
||||
: ArdourDialog (_("Add Track or Bus"))
|
||||
, routes_adjustment (1, 1, 128, 1, 4)
|
||||
, routes_spinner (routes_adjustment)
|
||||
|
|
@ -57,10 +57,7 @@ AddRouteDialog::AddRouteDialog (Session* s)
|
|||
, mode_label (_("Track mode:"))
|
||||
, instrument_label (_("Instrument:"))
|
||||
{
|
||||
set_session (s);
|
||||
|
||||
set_name ("AddRouteDialog");
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
set_modal (true);
|
||||
set_skip_taskbar_hint (true);
|
||||
set_resizable (false);
|
||||
|
|
@ -497,7 +494,7 @@ AddRouteDialog::add_route_group (RouteGroup* g)
|
|||
RouteGroup*
|
||||
AddRouteDialog::route_group ()
|
||||
{
|
||||
if (route_group_combo.get_active_row_number () == 2) {
|
||||
if (!_session || route_group_combo.get_active_row_number () == 2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -514,7 +511,9 @@ AddRouteDialog::refill_route_groups ()
|
|||
|
||||
route_group_combo.append_text (_("No Group"));
|
||||
|
||||
if (_session) {
|
||||
_session->foreach_route_group (sigc::mem_fun (*this, &AddRouteDialog::add_route_group));
|
||||
}
|
||||
|
||||
route_group_combo.set_active (2);
|
||||
}
|
||||
|
|
@ -535,7 +534,9 @@ AddRouteDialog::group_changed ()
|
|||
delete g;
|
||||
route_group_combo.set_active (2);
|
||||
} else {
|
||||
if (_session) {
|
||||
_session->add_route_group (g);
|
||||
}
|
||||
add_route_group (g);
|
||||
route_group_combo.set_active (3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Editor;
|
|||
class AddRouteDialog : public ArdourDialog
|
||||
{
|
||||
public:
|
||||
AddRouteDialog (ARDOUR::Session*);
|
||||
AddRouteDialog ();
|
||||
~AddRouteDialog ();
|
||||
|
||||
enum TypeWanted {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ AddVideoDialog::AddVideoDialog (Session* s)
|
|||
{
|
||||
set_session (s);
|
||||
set_name ("AddVideoDialog");
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
set_modal (true);
|
||||
set_skip_taskbar_hint (true);
|
||||
set_resizable (true);
|
||||
|
|
|
|||
|
|
@ -34,4 +34,5 @@ export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces
|
|||
# DYLD_LIBRARY_PATH is for darwin.
|
||||
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
|
||||
ARDOURVERSION=@VERSION@
|
||||
EXECUTABLE=@EXECUTABLE@
|
||||
|
|
|
|||
|
|
@ -35,9 +35,10 @@
|
|||
<menuitem action='addExistingAudioFiles'/>
|
||||
<!--menuitem action='importFromSession'/-->
|
||||
|
||||
#ifndef NOVIDEOTIMELINE
|
||||
<menuitem action='OpenVideo'/>
|
||||
<menuitem action='CloseVideo'/>
|
||||
|
||||
#endif
|
||||
<menu name='Export' action='Export'>
|
||||
<menuitem action='ExportAudio'/>
|
||||
<menuitem action='StemExport'/>
|
||||
|
|
@ -47,16 +48,16 @@
|
|||
<menuitem action='CleanupUnused'/>
|
||||
<menuitem action='FlushWastebasket'/>
|
||||
</menu>
|
||||
<separator/>
|
||||
<menuitem action='toggle-session-options-editor'/>
|
||||
#ifdef GTKOSX
|
||||
<menuitem action='toggle-about'/>
|
||||
<menuitem action='toggle-rc-options-editor'/>
|
||||
#endif
|
||||
#ifndef GTKOSX
|
||||
<separator/>
|
||||
#endif
|
||||
<menuitem action='ToggleSessionOptionsEditor'/>
|
||||
#ifdef GTKOSX
|
||||
<menuitem action='ToggleRCOptionsEditor'/>
|
||||
<menuitem action='About'/>
|
||||
#endif
|
||||
<separator/>
|
||||
<menuitem action='Quit'/>
|
||||
#endif
|
||||
</menu>
|
||||
|
||||
<menu name='Transport' action='Transport'>
|
||||
|
|
@ -231,7 +232,7 @@
|
|||
<menuitem action='set-mouse-mode-object-range'/>
|
||||
#ifndef GTKOSX
|
||||
<separator/>
|
||||
<menuitem action='ToggleRCOptionsEditor'/>
|
||||
<menuitem action='toggle-rc-options-editor'/>
|
||||
#endif
|
||||
</menu>
|
||||
|
||||
|
|
@ -281,7 +282,9 @@
|
|||
<menuitem action='snap-regions-to-grid'/>
|
||||
<menuitem action='toggle-region-lock'/>
|
||||
<menuitem action='toggle-region-lock-style'/>
|
||||
#ifndef NOVIDEOTIMELINE
|
||||
<menuitem action='toggle-region-video-lock'/>
|
||||
#endif
|
||||
<menuitem action='set-region-sync-position'/>
|
||||
<menuitem action='remove-region-sync'/>
|
||||
<menuitem action='nudge-forward'/>
|
||||
|
|
@ -434,7 +437,9 @@
|
|||
<menuitem action="toggle-cd-marker-ruler"/>
|
||||
<menuitem action="toggle-marker-ruler"/>
|
||||
<separator/>
|
||||
#ifndef NOVIDEOTIMELINE
|
||||
<menuitem action="toggle-video-ruler"/>
|
||||
#endif
|
||||
</menu>
|
||||
<menu action="VideoMonitorMenu">
|
||||
<menuitem action="zoom-vmon-100"/>
|
||||
|
|
@ -510,12 +515,12 @@
|
|||
|
||||
<separator/>
|
||||
|
||||
<menuitem action='ToggleInspector'/>
|
||||
<menuitem action='ToggleLocations'/>
|
||||
<menuitem action='ToggleKeyEditor'/>
|
||||
<menuitem action='ToggleBundleManager'/>
|
||||
<menuitem action='ToggleThemeManager'/>
|
||||
<menuitem action='ToggleBigClock'/>
|
||||
<menuitem action='toggle-inspector'/>
|
||||
<menuitem action='toggle-locations'/>
|
||||
<menuitem action='toggle-key-editor'/>
|
||||
<menuitem action='toggle-bundle-manager'/>
|
||||
<menuitem action='toggle-theme-manager'/>
|
||||
<menuitem action='toggle-big-clock'/>
|
||||
<menuitem action='toggle-speaker-config'/>
|
||||
|
||||
<separator/>
|
||||
|
|
@ -531,7 +536,7 @@
|
|||
</menu>
|
||||
<menu name='Help' action='Help'>
|
||||
#ifndef GTKOSX
|
||||
<menuitem action='About'/>
|
||||
<menuitem action='toggle-about'/>
|
||||
#endif
|
||||
<menuitem action='Chat'/>
|
||||
<menuitem action='Manual'/>
|
||||
|
|
@ -552,8 +557,10 @@
|
|||
<menuitem action="toggle-marker-ruler"/>
|
||||
<menuitem action="toggle-cd-marker-ruler"/>
|
||||
<menuitem action="toggle-loop-punch-ruler"/>
|
||||
#ifndef NOVIDEOTIMELINE
|
||||
<separator/>
|
||||
<menuitem action="toggle-video-ruler"/>
|
||||
#endif
|
||||
</popup>
|
||||
|
||||
<popup name='ProcessorMenu'>
|
||||
|
|
@ -649,7 +656,9 @@
|
|||
<menuitem action='naturalize-region'/>
|
||||
<menuitem action='toggle-region-lock'/>
|
||||
<menuitem action='toggle-region-lock-style'/>
|
||||
#ifndef NOVIDEOTIMELINE
|
||||
<menuitem action='toggle-region-video-lock'/>
|
||||
#endif
|
||||
<menuitem action='snap-regions-to-grid'/>
|
||||
<menuitem action='set-region-sync-position'/>
|
||||
<menuitem action='remove-region-sync'/>
|
||||
|
|
|
|||
|
|
@ -736,6 +736,11 @@ style "midi_track_metrics" = "midi_track_base"
|
|||
font_name = "@FONT_TINY@"
|
||||
}
|
||||
|
||||
style "audiomidi_track_metrics" = "midi_track_base"
|
||||
{
|
||||
font_name = "@FONT_TINY@"
|
||||
}
|
||||
|
||||
style "audio_bus_metrics" = "audio_bus_base"
|
||||
{
|
||||
font_name = "@FONT_TINY@"
|
||||
|
|
@ -751,6 +756,11 @@ style "midi_track_metrics_inactive" = "track_controls_inactive"
|
|||
font_name = "@FONT_TINY@"
|
||||
}
|
||||
|
||||
style "audiomidi_track_metrics_inactive" = "track_controls_inactive"
|
||||
{
|
||||
font_name = "@FONT_TINY@"
|
||||
}
|
||||
|
||||
style "audio_bus_metrics_inactive" = "track_controls_inactive"
|
||||
{
|
||||
font_name = "@FONT_TINY@"
|
||||
|
|
|
|||
|
|
@ -23,20 +23,23 @@
|
|||
#include <gtkmm2ext/doi.h>
|
||||
|
||||
#include "ardour_dialog.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "keyboard.h"
|
||||
#include "splash.h"
|
||||
#include "utils.h"
|
||||
#include "window_manager.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Gtk;
|
||||
using namespace Gtkmm2ext;
|
||||
|
||||
sigc::signal<void> ArdourDialog::CloseAllDialogs;
|
||||
|
||||
ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
|
||||
: Dialog (title, modal, use_seperator)
|
||||
, proxy (0)
|
||||
, _splash_pushed (false)
|
||||
{
|
||||
init ();
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
}
|
||||
|
||||
ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool use_seperator)
|
||||
|
|
@ -56,6 +59,13 @@ ArdourDialog::~ArdourDialog ()
|
|||
spl->pop_front();
|
||||
}
|
||||
}
|
||||
WM::Manager::instance().remove (proxy);
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourDialog::on_key_press_event (GdkEventKey* ev)
|
||||
{
|
||||
return relay_key_press (ev, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -94,12 +104,28 @@ ArdourDialog::on_show ()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourDialog::on_delete_event (GdkEventAny*)
|
||||
{
|
||||
hide ();
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ArdourDialog::init ()
|
||||
{
|
||||
set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
|
||||
set_border_width (10);
|
||||
CloseAllDialogs.connect (
|
||||
sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response),
|
||||
RESPONSE_CANCEL));
|
||||
|
||||
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
|
||||
|
||||
Gtk::Window* parent = WM::Manager::instance().transient_parent();
|
||||
|
||||
if (parent) {
|
||||
set_transient_for (*parent);
|
||||
}
|
||||
|
||||
ARDOUR_UI::CloseAllDialogs.connect (sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL));
|
||||
|
||||
proxy = new WM::ProxyTemporary (get_title(), this);
|
||||
WM::Manager::instance().register_window (proxy);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@
|
|||
|
||||
#include "ardour/session_handle.h"
|
||||
|
||||
namespace WM {
|
||||
class ProxyTemporary;
|
||||
}
|
||||
|
||||
/*
|
||||
* This virtual parent class is so that each dialog box uses the
|
||||
* same mechanism to declare its closing. It shares a common
|
||||
|
|
@ -40,12 +44,13 @@ class ArdourDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr
|
|||
|
||||
bool on_enter_notify_event (GdkEventCrossing*);
|
||||
bool on_leave_notify_event (GdkEventCrossing*);
|
||||
bool on_delete_event (GdkEventAny*);
|
||||
bool on_key_press_event (GdkEventKey*);
|
||||
void on_unmap ();
|
||||
void on_show ();
|
||||
|
||||
static void close_all_dialogs () { CloseAllDialogs(); }
|
||||
|
||||
private:
|
||||
WM::ProxyTemporary* proxy;
|
||||
bool _splash_pushed;
|
||||
void init ();
|
||||
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
|
@ -21,18 +21,17 @@
|
|||
#include "gtk2ardour-config.h"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <cerrno>
|
||||
#include <fstream>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <cerrno>
|
||||
#include <fstream>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -90,6 +89,7 @@ typedef uint64_t microseconds_t;
|
|||
#include "ambiguous_file_dialog.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "audio_clock.h"
|
||||
#include "big_clock_window.h"
|
||||
#include "bundle_manager.h"
|
||||
#include "engine_dialog.h"
|
||||
#include "gain_meter.h"
|
||||
|
|
@ -97,6 +97,7 @@ typedef uint64_t microseconds_t;
|
|||
#include "gui_object.h"
|
||||
#include "gui_thread.h"
|
||||
#include "keyboard.h"
|
||||
#include "keyeditor.h"
|
||||
#include "location_ui.h"
|
||||
#include "main_clock.h"
|
||||
#include "missing_file_dialog.h"
|
||||
|
|
@ -108,8 +109,11 @@ typedef uint64_t microseconds_t;
|
|||
#include "processor_box.h"
|
||||
#include "prompter.h"
|
||||
#include "public_editor.h"
|
||||
#include "rc_option_editor.h"
|
||||
#include "route_time_axis.h"
|
||||
#include "route_params_ui.h"
|
||||
#include "session_metadata_dialog.h"
|
||||
#include "session_option_editor.h"
|
||||
#include "shuttle_control.h"
|
||||
#include "speaker_dialog.h"
|
||||
#include "splash.h"
|
||||
|
|
@ -117,7 +121,6 @@ typedef uint64_t microseconds_t;
|
|||
#include "theme_manager.h"
|
||||
#include "time_axis_view_item.h"
|
||||
#include "utils.h"
|
||||
#include "window_proxy.h"
|
||||
#include "video_server_dialog.h"
|
||||
#include "add_video_dialog.h"
|
||||
#include "transcode_video_dialog.h"
|
||||
|
|
@ -138,12 +141,14 @@ sigc::signal<void,bool> ARDOUR_UI::Blink;
|
|||
sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
|
||||
sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
|
||||
sigc::signal<void, framepos_t, bool, framepos_t> ARDOUR_UI::Clock;
|
||||
sigc::signal<void> ARDOUR_UI::CloseAllDialogs;
|
||||
|
||||
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
||||
|
||||
: Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp)
|
||||
|
||||
, gui_object_state (new GUIObjectState)
|
||||
|
||||
, primary_clock (new MainClock (X_("primary"), false, X_("transport"), true, true, true, false, true))
|
||||
, secondary_clock (new MainClock (X_("secondary"), false, X_("secondary"), true, true, false, false, true))
|
||||
|
||||
|
|
@ -151,6 +156,14 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||
|
||||
, big_clock (new AudioClock (X_("bigclock"), false, "big", true, true, false, false))
|
||||
|
||||
/* start of private members */
|
||||
|
||||
, _startup (0)
|
||||
, engine (0)
|
||||
, nsm (0)
|
||||
, _was_dirty (false)
|
||||
, _mixer_on_top (false)
|
||||
|
||||
/* transport */
|
||||
|
||||
, roll_controllable (new TransportControllable ("transport roll", *this, TransportControllable::Roll))
|
||||
|
|
@ -169,6 +182,21 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||
, solo_alert_button (_("solo"))
|
||||
, feedback_alert_button (_("feedback"))
|
||||
|
||||
, speaker_config_window (X_("speaker-config"), _("Speaker Configuration"))
|
||||
, theme_manager (X_("theme-manager"), _("Theme Manager"))
|
||||
, key_editor (X_("key-editor"), _("Key Bindings"))
|
||||
, rc_option_editor (X_("rc-options-editor"), _("Preferences"))
|
||||
, add_route_dialog (X_("add-routes"), _("Add Tracks/Busses"))
|
||||
, about (X_("about"), _("About"))
|
||||
, location_ui (X_("locations"), _("Locations"))
|
||||
, route_params (X_("inspector"), _("Tracks and Busses"))
|
||||
, session_option_editor (X_("session-options-editor"), _("Properties"), boost::bind (&ARDOUR_UI::create_session_option_editor, this))
|
||||
, add_video_dialog (X_("add-video"), _("Add Tracks/Busses"), boost::bind (&ARDOUR_UI::create_add_video_dialog, this))
|
||||
, bundle_manager (X_("bundle-manager"), _("Bundle Manager"), boost::bind (&ARDOUR_UI::create_bundle_manager, this))
|
||||
, big_clock_window (X_("big-clock"), _("Big Clock"), boost::bind (&ARDOUR_UI::create_big_clock_window, this))
|
||||
, audio_port_matrix (X_("audio-connection-manager"), _("Audio Connections"), boost::bind (&ARDOUR_UI::create_global_port_matrix, this, ARDOUR::DataType::AUDIO))
|
||||
, midi_port_matrix (X_("midi-connection-manager"), _("MIDI Connections"), boost::bind (&ARDOUR_UI::create_global_port_matrix, this, ARDOUR::DataType::MIDI))
|
||||
|
||||
, error_log_button (_("Errors"))
|
||||
|
||||
, _status_bar_visibility (X_("status-bar"))
|
||||
|
|
@ -177,45 +205,27 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||
{
|
||||
Gtkmm2ext::init(localedir);
|
||||
|
||||
about = 0;
|
||||
splash = 0;
|
||||
_startup = 0;
|
||||
|
||||
if (theArdourUI == 0) {
|
||||
theArdourUI = this;
|
||||
}
|
||||
|
||||
ui_config = new UIConfiguration();
|
||||
theme_manager = new ThemeManager();
|
||||
|
||||
key_editor = 0;
|
||||
|
||||
editor = 0;
|
||||
mixer = 0;
|
||||
editor = 0;
|
||||
engine = 0;
|
||||
_session_is_new = false;
|
||||
big_clock_window = 0;
|
||||
big_clock_height = 0;
|
||||
big_clock_resize_in_progress = false;
|
||||
session_selector_window = 0;
|
||||
last_key_press_time = 0;
|
||||
add_route_dialog = 0;
|
||||
add_video_dialog = 0;
|
||||
video_server_process = 0;
|
||||
route_params = 0;
|
||||
bundle_manager = 0;
|
||||
rc_option_editor = 0;
|
||||
session_option_editor = 0;
|
||||
location_ui = 0;
|
||||
open_session_selector = 0;
|
||||
have_configure_timeout = false;
|
||||
have_disk_speed_dialog_displayed = false;
|
||||
session_loaded = false;
|
||||
ignore_dual_punch = false;
|
||||
original_big_clock_width = -1;
|
||||
original_big_clock_height = -1;
|
||||
original_big_clock_font_size = 0;
|
||||
|
||||
roll_button.set_controllable (roll_controllable);
|
||||
stop_button.set_controllable (stop_controllable);
|
||||
|
|
@ -309,25 +319,52 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||
|
||||
TimeAxisViewItem::set_constant_heights ();
|
||||
|
||||
/* Set this up so that our window proxies can register actions */
|
||||
|
||||
ActionManager::init ();
|
||||
|
||||
/* The following must happen after ARDOUR::init() so that Config is set up */
|
||||
|
||||
location_ui = new ActionWindowProxy<LocationUIWindow> (X_("locations"), Config->extra_xml (X_("UI")), X_("ToggleLocations"));
|
||||
big_clock_window = new ActionWindowProxy<Gtk::Window> (X_("bigclock"), Config->extra_xml (X_("UI")), X_("ToggleBigClock"));
|
||||
speaker_config_window = new ActionWindowProxy<SpeakerDialog> (X_("speakerconf"), Config->extra_xml (X_("UI")), X_("toggle-speaker-config"));
|
||||
const XMLNode* ui_xml = Config->extra_xml (X_("UI"));
|
||||
|
||||
for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
|
||||
_global_port_matrix[*i] = new ActionWindowProxy<GlobalPortMatrixWindow> (
|
||||
string_compose ("GlobalPortMatrix-%1", (*i).to_string()),
|
||||
Config->extra_xml (X_("UI")),
|
||||
string_compose ("toggle-%1-connection-manager", (*i).to_string())
|
||||
);
|
||||
if (ui_xml) {
|
||||
theme_manager.set_state (*ui_xml);
|
||||
key_editor.set_state (*ui_xml);
|
||||
rc_option_editor.set_state (*ui_xml);
|
||||
session_option_editor.set_state (*ui_xml);
|
||||
speaker_config_window.set_state (*ui_xml);
|
||||
about.set_state (*ui_xml);
|
||||
add_route_dialog.set_state (*ui_xml);
|
||||
add_video_dialog.set_state (*ui_xml);
|
||||
route_params.set_state (*ui_xml);
|
||||
bundle_manager.set_state (*ui_xml);
|
||||
location_ui.set_state (*ui_xml);
|
||||
big_clock_window.set_state (*ui_xml);
|
||||
audio_port_matrix.set_state (*ui_xml);
|
||||
midi_port_matrix.set_state (*ui_xml);
|
||||
}
|
||||
|
||||
setup_clock ();
|
||||
WM::Manager::instance().register_window (&theme_manager);
|
||||
WM::Manager::instance().register_window (&key_editor);
|
||||
WM::Manager::instance().register_window (&rc_option_editor);
|
||||
WM::Manager::instance().register_window (&session_option_editor);
|
||||
WM::Manager::instance().register_window (&speaker_config_window);
|
||||
WM::Manager::instance().register_window (&about);
|
||||
WM::Manager::instance().register_window (&add_route_dialog);
|
||||
WM::Manager::instance().register_window (&add_video_dialog);
|
||||
WM::Manager::instance().register_window (&route_params);
|
||||
WM::Manager::instance().register_window (&bundle_manager);
|
||||
WM::Manager::instance().register_window (&location_ui);
|
||||
WM::Manager::instance().register_window (&big_clock_window);
|
||||
WM::Manager::instance().register_window (&audio_port_matrix);
|
||||
WM::Manager::instance().register_window (&midi_port_matrix);
|
||||
|
||||
SpeakerDialog* s = new SpeakerDialog ();
|
||||
s->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/toggle-speaker-config")));
|
||||
speaker_config_window->set (s);
|
||||
/* We need to instantiate the theme manager because it loads our
|
||||
theme files. This should really change so that its window
|
||||
and its functionality are separate
|
||||
*/
|
||||
|
||||
(void) theme_manager.get (true);
|
||||
|
||||
starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup));
|
||||
stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown));
|
||||
|
|
@ -338,6 +375,15 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||
DPIReset.connect (sigc::mem_fun (*this, &ARDOUR_UI::resize_text_widgets));
|
||||
}
|
||||
|
||||
GlobalPortMatrixWindow*
|
||||
ARDOUR_UI::create_global_port_matrix (ARDOUR::DataType type)
|
||||
{
|
||||
if (!_session) {
|
||||
return 0;
|
||||
}
|
||||
return new GlobalPortMatrixWindow (_session, type);
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR_UI::create_engine ()
|
||||
{
|
||||
|
|
@ -378,12 +424,10 @@ ARDOUR_UI::post_engine ()
|
|||
|
||||
ARDOUR::init_post_engine ();
|
||||
|
||||
/* load up the UI manager */
|
||||
|
||||
ActionManager::init ();
|
||||
|
||||
_tooltips.enable();
|
||||
|
||||
ActionManager::load_menus ();
|
||||
|
||||
if (setup_windows ()) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
|
@ -467,10 +511,7 @@ ARDOUR_UI::~ARDOUR_UI ()
|
|||
delete keyboard;
|
||||
delete editor;
|
||||
delete mixer;
|
||||
delete add_route_dialog;
|
||||
if (add_video_dialog) {
|
||||
delete add_video_dialog;
|
||||
}
|
||||
|
||||
stop_video_server();
|
||||
}
|
||||
|
||||
|
|
@ -657,7 +698,6 @@ ARDOUR_UI::startup ()
|
|||
app->ready ();
|
||||
|
||||
nsm_url = getenv ("NSM_URL");
|
||||
nsm = 0;
|
||||
|
||||
if (nsm_url) {
|
||||
nsm = new NSM_Client;
|
||||
|
|
@ -717,14 +757,7 @@ ARDOUR_UI::startup ()
|
|||
|
||||
goto_editor_window ();
|
||||
|
||||
/* Add the window proxies here; their addition may cause windows to be opened, and we want them
|
||||
to be opened on top of the editor window that goto_editor_window() just opened.
|
||||
*/
|
||||
add_window_proxy (location_ui);
|
||||
add_window_proxy (big_clock_window);
|
||||
for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
|
||||
add_window_proxy (_global_port_matrix[*i]);
|
||||
}
|
||||
WM::Manager::instance().show_visible ();
|
||||
|
||||
/* We have to do this here since goto_editor_window() ends up calling show_all() on the
|
||||
* editor window, and we may want stuff to be hidden.
|
||||
|
|
@ -784,13 +817,13 @@ ARDOUR_UI::check_memory_locking ()
|
|||
"runs out of memory. \n\n"
|
||||
"You can view the memory limit with 'ulimit -l', "
|
||||
"and it is normally controlled by %2"),
|
||||
PROGRAM_NAME).c_str(),
|
||||
PROGRAM_NAME,
|
||||
#ifdef __FreeBSD__
|
||||
X_("/etc/login.conf")
|
||||
#else
|
||||
X_(" /etc/security/limits.conf")
|
||||
#endif
|
||||
);
|
||||
).c_str());
|
||||
|
||||
msg.set_default_response (RESPONSE_OK);
|
||||
|
||||
|
|
@ -879,6 +912,8 @@ If you still wish to quit, please use the\n\n\
|
|||
*/
|
||||
save_ardour_state ();
|
||||
|
||||
close_all_dialogs ();
|
||||
|
||||
loading_message (string_compose (_("Please wait while %1 cleans up..."), PROGRAM_NAME));
|
||||
|
||||
if (_session) {
|
||||
|
|
@ -889,7 +924,6 @@ If you still wish to quit, please use the\n\n\
|
|||
_session = 0;
|
||||
}
|
||||
|
||||
ArdourDialog::close_all_dialogs ();
|
||||
engine->stop (true);
|
||||
|
||||
if (Profile->get_soundgrid()) {
|
||||
|
|
@ -941,7 +975,6 @@ ARDOUR_UI::ask_about_saving_session (const vector<string>& actions)
|
|||
window.get_vbox()->pack_start (dhbox);
|
||||
|
||||
window.set_name (_("Prompter"));
|
||||
window.set_position (Gtk::WIN_POS_MOUSE);
|
||||
window.set_modal (true);
|
||||
window.set_resizable (false);
|
||||
|
||||
|
|
@ -1375,8 +1408,6 @@ ARDOUR_UI::open_recent_session ()
|
|||
|
||||
while (true) {
|
||||
|
||||
session_selector_window->set_position (WIN_POS_MOUSE);
|
||||
|
||||
ResponseType r = (ResponseType) session_selector_window->run ();
|
||||
|
||||
switch (r) {
|
||||
|
|
@ -2314,11 +2345,7 @@ ARDOUR_UI::save_state (const string & name, bool switch_to_it)
|
|||
{
|
||||
XMLNode* node = new XMLNode (X_("UI"));
|
||||
|
||||
for (list<WindowProxyBase*>::iterator i = _window_proxies.begin(); i != _window_proxies.end(); ++i) {
|
||||
if (!(*i)->rc_configured()) {
|
||||
node->add_child_nocopy (*((*i)->get_state ()));
|
||||
}
|
||||
}
|
||||
WM::Manager::instance().add_state (*node);
|
||||
|
||||
node->add_child_nocopy (gui_object_state->get_state());
|
||||
|
||||
|
|
@ -2953,18 +2980,6 @@ ARDOUR_UI::launch_chat ()
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::show_about ()
|
||||
{
|
||||
if (about == 0) {
|
||||
about = new About;
|
||||
about->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::about_signal_response));
|
||||
}
|
||||
|
||||
about->set_transient_for(*editor);
|
||||
about->show_all ();
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::launch_manual ()
|
||||
{
|
||||
|
|
@ -2977,21 +2992,6 @@ ARDOUR_UI::launch_reference ()
|
|||
PBD::open_uri (Config->get_reference_manual_url());
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::hide_about ()
|
||||
{
|
||||
if (about) {
|
||||
about->get_window()->set_cursor ();
|
||||
about->hide ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::about_signal_response (int /*response*/)
|
||||
{
|
||||
hide_about();
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::loading_message (const std::string& msg)
|
||||
{
|
||||
|
|
@ -3252,19 +3252,15 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
|
|||
return;
|
||||
}
|
||||
|
||||
if (add_route_dialog == 0) {
|
||||
add_route_dialog = new AddRouteDialog (_session);
|
||||
add_route_dialog->set_position (WIN_POS_MOUSE);
|
||||
if (float_window) {
|
||||
add_route_dialog->set_transient_for (*float_window);
|
||||
}
|
||||
}
|
||||
|
||||
if (add_route_dialog->is_visible()) {
|
||||
/* we're already doing this */
|
||||
return;
|
||||
}
|
||||
|
||||
if (float_window) {
|
||||
add_route_dialog->set_transient_for (*float_window);
|
||||
}
|
||||
|
||||
ResponseType r = (ResponseType) add_route_dialog->run ();
|
||||
|
||||
add_route_dialog->hide();
|
||||
|
|
@ -3436,9 +3432,28 @@ ARDOUR_UI::start_video_server (Gtk::Window* float_window, bool popup_msg)
|
|||
Config->set_video_advanced_setup(true);
|
||||
}
|
||||
|
||||
if (video_server_process) {
|
||||
delete video_server_process;
|
||||
}
|
||||
|
||||
video_server_process = new SystemExec(icsd_exec, argp);
|
||||
video_server_process->start();
|
||||
sleep(1);
|
||||
if (video_server_process->start()) {
|
||||
warning << _("Cannot launch the video-server") << endmsg;
|
||||
continue;
|
||||
}
|
||||
int timeout = 120; // 6 sec
|
||||
while (!ARDOUR_UI::instance()->video_timeline->check_server()) {
|
||||
usleep (50000);
|
||||
if (--timeout <= 0 || !video_server_process->is_running()) break;
|
||||
}
|
||||
if (timeout <= 0) {
|
||||
warning << _("Video-server was started but does not respond to requests...") << endmsg;
|
||||
} else {
|
||||
if (!ARDOUR_UI::instance()->video_timeline->check_server_docroot()) {
|
||||
delete video_server_process;
|
||||
video_server_process = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3455,23 +3470,25 @@ ARDOUR_UI::add_video (Gtk::Window* float_window)
|
|||
return;
|
||||
}
|
||||
|
||||
if (add_video_dialog == 0) {
|
||||
add_video_dialog = new AddVideoDialog (_session);
|
||||
if (float_window) {
|
||||
add_video_dialog->set_transient_for (*float_window);
|
||||
}
|
||||
}
|
||||
|
||||
if (add_video_dialog->is_visible()) {
|
||||
/* we're already doing this */
|
||||
return;
|
||||
}
|
||||
|
||||
ResponseType r = (ResponseType) add_video_dialog->run ();
|
||||
add_video_dialog->hide();
|
||||
if (r != RESPONSE_ACCEPT) { return; }
|
||||
|
||||
bool local_file;
|
||||
bool local_file, orig_local_file;
|
||||
std::string path = add_video_dialog->file_name(local_file);
|
||||
|
||||
std::string orig_path = path;
|
||||
orig_local_file = local_file;
|
||||
|
||||
bool auto_set_session_fps = add_video_dialog->auto_set_session_fps();
|
||||
|
||||
if (local_file && !Glib::file_test(path, Glib::FILE_TEST_EXISTS)) {
|
||||
|
|
@ -3530,6 +3547,11 @@ ARDOUR_UI::add_video (Gtk::Window* float_window)
|
|||
node->add_property (X_("Filename"), path);
|
||||
node->add_property (X_("AutoFPS"), auto_set_session_fps?X_("1"):X_("0"));
|
||||
node->add_property (X_("LocalFile"), local_file?X_("1"):X_("0"));
|
||||
if (orig_local_file) {
|
||||
node->add_property (X_("OriginalVideoFile"), orig_path);
|
||||
} else {
|
||||
node->remove_property (X_("OriginalVideoFile"));
|
||||
}
|
||||
_session->add_extra_xml (*node);
|
||||
_session->set_dirty ();
|
||||
|
||||
|
|
@ -3840,13 +3862,12 @@ ARDOUR_UI::update_transport_clocks (framepos_t pos)
|
|||
secondary_clock->set (pos);
|
||||
}
|
||||
|
||||
if (big_clock_window->get()) {
|
||||
if (big_clock_window) {
|
||||
big_clock->set (pos);
|
||||
}
|
||||
ARDOUR_UI::instance()->video_timeline->manual_seek_video_monitor(pos);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ARDOUR_UI::step_edit_status_change (bool yn)
|
||||
{
|
||||
|
|
@ -3867,7 +3888,7 @@ ARDOUR_UI::record_state_changed ()
|
|||
{
|
||||
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed);
|
||||
|
||||
if (!_session || !big_clock_window->get()) {
|
||||
if (!_session || !big_clock_window) {
|
||||
/* why bother - the clock isn't visible */
|
||||
return;
|
||||
}
|
||||
|
|
@ -4006,26 +4027,6 @@ ARDOUR_UI::setup_profile ()
|
|||
}
|
||||
}
|
||||
|
||||
/** Add a window proxy to our list, so that its state will be saved.
|
||||
* This call also causes the window to be created and opened if its
|
||||
* state was saved as `visible'.
|
||||
*/
|
||||
void
|
||||
ARDOUR_UI::add_window_proxy (WindowProxyBase* p)
|
||||
{
|
||||
_window_proxies.push_back (p);
|
||||
p->maybe_show ();
|
||||
}
|
||||
|
||||
/** Remove a window proxy from our list. Must be called if a WindowProxy
|
||||
* is deleted, to prevent hanging pointers.
|
||||
*/
|
||||
void
|
||||
ARDOUR_UI::remove_window_proxy (WindowProxyBase* p)
|
||||
{
|
||||
_window_proxies.remove (p);
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR_UI::missing_file (Session*s, std::string str, DataType type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,14 +67,15 @@
|
|||
|
||||
#include "video_timeline.h"
|
||||
|
||||
#include "ardour_dialog.h"
|
||||
#include "ardour_button.h"
|
||||
#include "ardour_dialog.h"
|
||||
#include "ardour_window.h"
|
||||
#include "editing.h"
|
||||
#include "nsm.h"
|
||||
#include "ui_config.h"
|
||||
#include "window_proxy.h"
|
||||
#include "enums.h"
|
||||
#include "visibility_group.h"
|
||||
#include "window_manager.h"
|
||||
|
||||
class About;
|
||||
class AddRouteDialog;
|
||||
|
|
@ -84,6 +85,7 @@ class SystemExec;
|
|||
class ArdourStartup;
|
||||
class ArdourKeyboard;
|
||||
class AudioClock;
|
||||
class BigClockWindow;
|
||||
class BundleManager;
|
||||
class ButtonJoiner;
|
||||
class ConnectionEditor;
|
||||
|
|
@ -101,7 +103,6 @@ class SpeakerDialog;
|
|||
class ThemeManager;
|
||||
class TimeInfoBox;
|
||||
class MidiTracer;
|
||||
class WindowProxyBase;
|
||||
class GlobalPortMatrixWindow;
|
||||
class GUIObjectState;
|
||||
|
||||
|
|
@ -165,14 +166,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
PublicEditor& the_editor(){return *editor;}
|
||||
Mixer_UI* the_mixer() { return mixer; }
|
||||
|
||||
void toggle_key_editor ();
|
||||
void toggle_location_window ();
|
||||
void toggle_theme_manager ();
|
||||
void toggle_bundle_manager ();
|
||||
void toggle_big_clock_window ();
|
||||
void toggle_speaker_config_window ();
|
||||
void new_midi_tracer_window ();
|
||||
void toggle_route_params_window ();
|
||||
void toggle_editing_space();
|
||||
void toggle_keep_tearoffs();
|
||||
|
||||
|
|
@ -189,6 +183,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
*/
|
||||
static sigc::signal<void, framepos_t, bool, framepos_t> Clock;
|
||||
|
||||
static void close_all_dialogs () { CloseAllDialogs(); }
|
||||
static sigc::signal<void> CloseAllDialogs;
|
||||
|
||||
XMLNode* editor_settings() const;
|
||||
XMLNode* mixer_settings () const;
|
||||
XMLNode* keyboard_settings () const;
|
||||
|
|
@ -206,6 +203,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
MainClock* primary_clock;
|
||||
MainClock* secondary_clock;
|
||||
void focus_on_clock ();
|
||||
AudioClock* big_clock;
|
||||
|
||||
TimeInfoBox* time_info_box;
|
||||
|
||||
|
|
@ -272,9 +270,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
|
||||
void set_shuttle_fract (double);
|
||||
|
||||
void add_window_proxy (WindowProxyBase *);
|
||||
void remove_window_proxy (WindowProxyBase *);
|
||||
|
||||
void get_process_buffers ();
|
||||
void drop_process_buffers ();
|
||||
|
||||
|
|
@ -306,6 +301,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
Gtk::Tooltips _tooltips;
|
||||
NSM_Client *nsm;
|
||||
bool _was_dirty;
|
||||
bool _mixer_on_top;
|
||||
|
||||
void goto_editor_window ();
|
||||
void goto_mixer_window ();
|
||||
|
|
@ -353,27 +349,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
void start_clocking ();
|
||||
void stop_clocking ();
|
||||
|
||||
void manage_window (Gtk::Window&);
|
||||
|
||||
AudioClock* big_clock;
|
||||
ActionWindowProxy<Gtk::Window>* big_clock_window;
|
||||
int original_big_clock_width;
|
||||
int original_big_clock_height;
|
||||
double original_big_clock_font_size;
|
||||
|
||||
void big_clock_size_allocate (Gtk::Allocation&);
|
||||
bool idle_big_clock_text_resizer (int width, int height);
|
||||
void big_clock_realized ();
|
||||
bool big_clock_resize_in_progress;
|
||||
int big_clock_height;
|
||||
void big_clock_catch_focus ();
|
||||
void big_clock_reset_aspect_ratio ();
|
||||
|
||||
void float_big_clock (Gtk::Window* parent);
|
||||
bool main_window_state_event_handler (GdkEventWindowState*, bool window_was_editor);
|
||||
|
||||
ActionWindowProxy<SpeakerDialog>* speaker_config_window;
|
||||
|
||||
void update_transport_clocks (framepos_t pos);
|
||||
void record_state_changed ();
|
||||
|
||||
|
|
@ -593,41 +570,40 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
PublicEditor *editor;
|
||||
int create_editor ();
|
||||
|
||||
RouteParams_UI *route_params;
|
||||
int create_route_params ();
|
||||
/* Dialogs that can be created via new<T> */
|
||||
|
||||
BundleManager *bundle_manager;
|
||||
void create_bundle_manager ();
|
||||
WM::Proxy<SpeakerDialog> speaker_config_window;
|
||||
WM::Proxy<ThemeManager> theme_manager;
|
||||
WM::Proxy<KeyEditor> key_editor;
|
||||
WM::Proxy<RCOptionEditor> rc_option_editor;
|
||||
WM::Proxy<AddRouteDialog> add_route_dialog;
|
||||
WM::Proxy<About> about;
|
||||
WM::Proxy<LocationUIWindow> location_ui;
|
||||
WM::Proxy<RouteParams_UI> route_params;
|
||||
|
||||
ActionWindowProxy<LocationUIWindow>* location_ui;
|
||||
int create_location_ui ();
|
||||
void handle_locations_change (ARDOUR::Location*);
|
||||
/* Windows/Dialogs that require a creator method */
|
||||
|
||||
ActionWindowProxy<GlobalPortMatrixWindow>* _global_port_matrix[ARDOUR::DataType::num_types];
|
||||
void toggle_global_port_matrix (ARDOUR::DataType);
|
||||
WM::ProxyWithConstructor<SessionOptionEditor> session_option_editor;
|
||||
WM::ProxyWithConstructor<AddVideoDialog> add_video_dialog;
|
||||
WM::ProxyWithConstructor<BundleManager> bundle_manager;
|
||||
WM::ProxyWithConstructor<BigClockWindow> big_clock_window;
|
||||
WM::ProxyWithConstructor<GlobalPortMatrixWindow> audio_port_matrix;
|
||||
WM::ProxyWithConstructor<GlobalPortMatrixWindow> midi_port_matrix;
|
||||
|
||||
/* creator methods */
|
||||
|
||||
SessionOptionEditor* create_session_option_editor ();
|
||||
BundleManager* create_bundle_manager ();
|
||||
AddVideoDialog* create_add_video_dialog ();
|
||||
BigClockWindow* create_big_clock_window();
|
||||
GlobalPortMatrixWindow* create_global_port_matrix (ARDOUR::DataType);
|
||||
|
||||
static UIConfiguration *ui_config;
|
||||
ThemeManager *theme_manager;
|
||||
|
||||
/* Key bindings editor */
|
||||
|
||||
KeyEditor *key_editor;
|
||||
|
||||
/* RC Options window */
|
||||
|
||||
RCOptionEditor *rc_option_editor;
|
||||
|
||||
SessionOptionEditor *session_option_editor;
|
||||
|
||||
/* route dialog */
|
||||
|
||||
AddRouteDialog *add_route_dialog;
|
||||
|
||||
/* video dialog */
|
||||
|
||||
AddVideoDialog *add_video_dialog;
|
||||
SystemExec *video_server_process;
|
||||
|
||||
void handle_locations_change (ARDOUR::Location*);
|
||||
|
||||
/* Keyboard Handling */
|
||||
|
||||
ArdourKeyboard* keyboard;
|
||||
|
|
@ -641,7 +617,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
uint32_t rec_enabled_streams;
|
||||
void count_recenabled_streams (ARDOUR::Route&);
|
||||
|
||||
About* about;
|
||||
Splash* splash;
|
||||
|
||||
void pop_back_splash (Gtk::Window&);
|
||||
|
|
@ -727,8 +702,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
void queue_finish ();
|
||||
void fontconfig_dialog ();
|
||||
|
||||
std::list<WindowProxyBase*> _window_proxies;
|
||||
|
||||
int missing_file (ARDOUR::Session*s, std::string str, ARDOUR::DataType type);
|
||||
int ambiguous_file (std::string file, std::string path, std::vector<std::string> hits);
|
||||
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ ARDOUR_UI::setup_windows ()
|
|||
|
||||
we_have_dependents ();
|
||||
|
||||
theme_manager->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleThemeManager")));
|
||||
|
||||
#ifdef TOP_MENUBAR
|
||||
HBox* status_bar_packer = manage (new HBox);
|
||||
EventBox* status_bar_event_box = manage (new EventBox);
|
||||
|
|
@ -430,14 +428,6 @@ ARDOUR_UI::setup_transport ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::manage_window (Window& win)
|
||||
{
|
||||
win.signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), &win));
|
||||
win.signal_enter_notify_event().connect (sigc::bind (sigc::mem_fun (Keyboard::the_keyboard(), &Keyboard::enter_window), &win));
|
||||
win.signal_leave_notify_event().connect (sigc::bind (sigc::mem_fun (Keyboard::the_keyboard(), &Keyboard::leave_window), &win));
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::detach_tearoff (Box* b, Widget* w)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,118 +85,6 @@ ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
|
|||
s->restore_history ("");
|
||||
}
|
||||
|
||||
static bool
|
||||
_hide_splash (gpointer arg)
|
||||
{
|
||||
((ARDOUR_UI*)arg)->hide_splash();
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::goto_editor_window ()
|
||||
{
|
||||
if (splash && splash->is_visible()) {
|
||||
// in 2 seconds, hide the splash screen
|
||||
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (_hide_splash), this), 2000);
|
||||
}
|
||||
|
||||
editor->show_window ();
|
||||
editor->present ();
|
||||
flush_pending ();
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::goto_mixer_window ()
|
||||
{
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gdk::Window> win = editor->get_window ();
|
||||
Glib::RefPtr<Gdk::Screen> screen;
|
||||
|
||||
if (win) {
|
||||
screen = win->get_screen();
|
||||
} else {
|
||||
screen = Gdk::Screen::get_default();
|
||||
}
|
||||
|
||||
if (screen && screen->get_height() < 700) {
|
||||
Gtk::MessageDialog msg (_("This screen is not tall enough to display the mixer window"));
|
||||
msg.run ();
|
||||
return;
|
||||
}
|
||||
|
||||
mixer->show_window ();
|
||||
mixer->present ();
|
||||
flush_pending ();
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_mixer_window ()
|
||||
{
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
|
||||
if (!act) {
|
||||
return;
|
||||
}
|
||||
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
goto_mixer_window ();
|
||||
} else {
|
||||
mixer->hide ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_editor_mixer ()
|
||||
{
|
||||
if (editor && mixer) {
|
||||
|
||||
if (editor->get_screen() != mixer->get_screen()) {
|
||||
// different screens, so don't do anything
|
||||
return;
|
||||
}
|
||||
|
||||
/* See if they are obscuring each other */
|
||||
|
||||
gint ex, ey, ew, eh;
|
||||
gint mx, my, mw, mh;
|
||||
|
||||
editor->get_position (ex, ey);
|
||||
editor->get_size (ew, eh);
|
||||
|
||||
mixer->get_position (mx, my);
|
||||
mixer->get_size (mw, mh);
|
||||
|
||||
GdkRectangle e;
|
||||
GdkRectangle m;
|
||||
GdkRectangle r;
|
||||
|
||||
e.x = ex;
|
||||
e.y = ey;
|
||||
e.width = ew;
|
||||
e.height = eh;
|
||||
|
||||
m.x = mx;
|
||||
m.y = my;
|
||||
m.width = mw;
|
||||
m.height = mh;
|
||||
|
||||
if (!gdk_rectangle_intersect (&e, &m, &r)) {
|
||||
/* they do not intersect so do not toggle */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mixer && mixer->fully_visible()) {
|
||||
goto_editor_window ();
|
||||
} else {
|
||||
goto_mixer_window ();
|
||||
}
|
||||
}
|
||||
|
||||
/** The main editor window has been closed */
|
||||
gint
|
||||
ARDOUR_UI::exit_on_main_window_close (GdkEventAny * /*ev*/)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@
|
|||
|
||||
#include "actions.h"
|
||||
#include "add_route_dialog.h"
|
||||
#include "add_video_dialog.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "big_clock_window.h"
|
||||
#include "bundle_manager.h"
|
||||
#include "global_port_matrix.h"
|
||||
#include "gui_object.h"
|
||||
|
|
@ -45,6 +47,7 @@
|
|||
#include "shuttle_control.h"
|
||||
#include "session_option_editor.h"
|
||||
#include "speaker_dialog.h"
|
||||
#include "splash.h"
|
||||
#include "sfdb_ui.h"
|
||||
#include "theme_manager.h"
|
||||
#include "time_info_box.h"
|
||||
|
|
@ -62,14 +65,20 @@ ARDOUR_UI::set_session (Session *s)
|
|||
{
|
||||
SessionHandlePtr::set_session (s);
|
||||
|
||||
for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
|
||||
GlobalPortMatrixWindow* w;
|
||||
if ((w = _global_port_matrix[*i]->get()) != 0) {
|
||||
w->set_session (s);
|
||||
}
|
||||
if (audio_port_matrix) {
|
||||
audio_port_matrix->set_session (s);
|
||||
}
|
||||
|
||||
if (midi_port_matrix) {
|
||||
midi_port_matrix->set_session (s);
|
||||
}
|
||||
|
||||
|
||||
if (!_session) {
|
||||
/* Session option editor cannot exist across change-of-session */
|
||||
session_option_editor.drop_window ();
|
||||
/* Ditto for AddVideoDialog */
|
||||
add_video_dialog.drop_window ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -86,37 +95,12 @@ ARDOUR_UI::set_session (Session *s)
|
|||
}
|
||||
|
||||
AutomationWatch::instance().set_session (s);
|
||||
|
||||
if (location_ui->get()) {
|
||||
location_ui->get()->set_session(s);
|
||||
}
|
||||
|
||||
if (speaker_config_window->get()) {
|
||||
speaker_config_window->get()->set_speakers (s->get_speakers());
|
||||
}
|
||||
|
||||
if (route_params) {
|
||||
route_params->set_session (s);
|
||||
}
|
||||
|
||||
if (add_route_dialog) {
|
||||
add_route_dialog->set_session (s);
|
||||
}
|
||||
|
||||
if (session_option_editor) {
|
||||
session_option_editor->set_session (s);
|
||||
}
|
||||
WM::Manager::instance().set_session (s);
|
||||
|
||||
if (shuttle_box) {
|
||||
shuttle_box->set_session (s);
|
||||
}
|
||||
|
||||
for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
|
||||
if (_global_port_matrix[*i]->get()) {
|
||||
_global_port_matrix[*i]->get()->set_session (_session);
|
||||
}
|
||||
}
|
||||
|
||||
primary_clock->set_session (s);
|
||||
secondary_clock->set_session (s);
|
||||
big_clock->set_session (s);
|
||||
|
|
@ -267,34 +251,149 @@ ARDOUR_UI::unload_session (bool hide_stuff)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_big_clock_window ()
|
||||
static bool
|
||||
_hide_splash (gpointer arg)
|
||||
{
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleBigClock"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
((ARDOUR_UI*)arg)->hide_splash();
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::goto_editor_window ()
|
||||
{
|
||||
if (splash && splash->is_visible()) {
|
||||
// in 2 seconds, hide the splash screen
|
||||
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (_hide_splash), this), 2000);
|
||||
}
|
||||
|
||||
editor->show_window ();
|
||||
editor->present ();
|
||||
/* mixer should now be on top */
|
||||
WM::Manager::instance().set_transient_for (editor);
|
||||
_mixer_on_top = false;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::goto_mixer_window ()
|
||||
{
|
||||
Glib::RefPtr<Gdk::Window> win;
|
||||
Glib::RefPtr<Gdk::Screen> screen;
|
||||
|
||||
if (editor) {
|
||||
win = editor->get_window ();
|
||||
}
|
||||
|
||||
if (win) {
|
||||
screen = win->get_screen();
|
||||
} else {
|
||||
screen = Gdk::Screen::get_default();
|
||||
}
|
||||
|
||||
if (screen && screen->get_height() < 700) {
|
||||
Gtk::MessageDialog msg (_("This screen is not tall enough to display the mixer window"));
|
||||
msg.run ();
|
||||
return;
|
||||
}
|
||||
|
||||
mixer->show_window ();
|
||||
mixer->present ();
|
||||
/* mixer should now be on top */
|
||||
WM::Manager::instance().set_transient_for (mixer);
|
||||
_mixer_on_top = true;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_mixer_window ()
|
||||
{
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
|
||||
if (!act) {
|
||||
return;
|
||||
}
|
||||
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
big_clock_window->get()->show_all ();
|
||||
big_clock_window->get()->present ();
|
||||
goto_mixer_window ();
|
||||
} else {
|
||||
big_clock_window->get()->hide ();
|
||||
}
|
||||
mixer->hide ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_speaker_config_window ()
|
||||
ARDOUR_UI::toggle_editor_mixer ()
|
||||
{
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-speaker-config"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
bool obscuring = false;
|
||||
/* currently, if windows are on different
|
||||
screens then we do nothing; but in the
|
||||
future we may want to bring the window
|
||||
to the front or something, so I'm leaving this
|
||||
variable for future use
|
||||
*/
|
||||
bool same_screen = true;
|
||||
|
||||
if (tact->get_active()) {
|
||||
speaker_config_window->get()->show_all ();
|
||||
speaker_config_window->get()->present ();
|
||||
if (editor && mixer) {
|
||||
|
||||
/* remeber: Screen != Monitor (Screen is a separately rendered
|
||||
* continuous geometry that make include 1 or more monitors.
|
||||
*/
|
||||
|
||||
if (editor->get_screen() != mixer->get_screen() && (mixer->get_screen() != 0) && (editor->get_screen() != 0)) {
|
||||
// different screens, so don't do anything
|
||||
same_screen = false;
|
||||
} else {
|
||||
speaker_config_window->get()->hide ();
|
||||
// they are on the same screen, see if they are obscuring each other
|
||||
|
||||
gint ex, ey, ew, eh;
|
||||
gint mx, my, mw, mh;
|
||||
|
||||
editor->get_position (ex, ey);
|
||||
editor->get_size (ew, eh);
|
||||
|
||||
mixer->get_position (mx, my);
|
||||
mixer->get_size (mw, mh);
|
||||
|
||||
GdkRectangle e;
|
||||
GdkRectangle m;
|
||||
GdkRectangle r;
|
||||
|
||||
e.x = ex;
|
||||
e.y = ey;
|
||||
e.width = ew;
|
||||
e.height = eh;
|
||||
|
||||
m.x = mx;
|
||||
m.y = my;
|
||||
m.width = mw;
|
||||
m.height = mh;
|
||||
|
||||
if (gdk_rectangle_intersect (&e, &m, &r)) {
|
||||
obscuring = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mixer && !mixer->not_visible() && mixer->property_has_toplevel_focus()) {
|
||||
if (obscuring && same_screen) {
|
||||
goto_editor_window();
|
||||
}
|
||||
} else if (editor && !editor->not_visible() && editor->property_has_toplevel_focus()) {
|
||||
if (obscuring && same_screen) {
|
||||
goto_mixer_window();
|
||||
}
|
||||
} else if (mixer && mixer->not_visible()) {
|
||||
if (obscuring && same_screen) {
|
||||
goto_mixer_window ();
|
||||
}
|
||||
} else if (editor && editor->not_visible()) {
|
||||
if (obscuring && same_screen) {
|
||||
goto_editor_window ();
|
||||
}
|
||||
} else if (obscuring && same_screen) {
|
||||
//it's unclear what to do here, so just do the opposite of what we did last time (old behavior)
|
||||
if (_mixer_on_top) {
|
||||
goto_editor_window ();
|
||||
} else {
|
||||
goto_mixer_window ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -315,7 +414,6 @@ ARDOUR_UI::new_midi_tracer_window ()
|
|||
if (i == _midi_tracer_windows.end()) {
|
||||
/* all our MIDITracer windows are visible; make a new one */
|
||||
MidiTracer* t = new MidiTracer ();
|
||||
manage_window (*t);
|
||||
t->show_all ();
|
||||
_midi_tracer_windows.push_back (t);
|
||||
} else {
|
||||
|
|
@ -324,173 +422,28 @@ ARDOUR_UI::new_midi_tracer_window ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_rc_options_window ()
|
||||
{
|
||||
if (rc_option_editor == 0) {
|
||||
rc_option_editor = new RCOptionEditor;
|
||||
rc_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleRCOptionsEditor")));
|
||||
rc_option_editor->set_session (_session);
|
||||
}
|
||||
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleRCOptionsEditor"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
rc_option_editor->show_all ();
|
||||
rc_option_editor->present ();
|
||||
} else {
|
||||
rc_option_editor->hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_session_options_window ()
|
||||
{
|
||||
if (session_option_editor == 0) {
|
||||
session_option_editor = new SessionOptionEditor (_session);
|
||||
session_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleSessionOptionsEditor")));
|
||||
}
|
||||
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleSessionOptionsEditor"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
session_option_editor->show_all ();
|
||||
session_option_editor->present ();
|
||||
} else {
|
||||
session_option_editor->hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR_UI::create_location_ui ()
|
||||
{
|
||||
if (location_ui->get() == 0) {
|
||||
location_ui->set (new LocationUIWindow ());
|
||||
location_ui->get()->set_session (_session);
|
||||
location_ui->get()->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleLocations")));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_location_window ()
|
||||
{
|
||||
if (create_location_ui()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleLocations"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
location_ui->get()->show_all ();
|
||||
location_ui->get()->present ();
|
||||
} else {
|
||||
location_ui->get()->hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_key_editor ()
|
||||
{
|
||||
if (key_editor == 0) {
|
||||
key_editor = new KeyEditor;
|
||||
key_editor->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleKeyEditor")));
|
||||
}
|
||||
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleKeyEditor"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
key_editor->show_all ();
|
||||
key_editor->present ();
|
||||
} else {
|
||||
key_editor->hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_theme_manager ()
|
||||
{
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleThemeManager"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
theme_manager->show_all ();
|
||||
theme_manager->present ();
|
||||
} else {
|
||||
theme_manager->hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BundleManager*
|
||||
ARDOUR_UI::create_bundle_manager ()
|
||||
{
|
||||
if (bundle_manager == 0) {
|
||||
bundle_manager = new BundleManager (_session);
|
||||
bundle_manager->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBundleManager")));
|
||||
}
|
||||
return new BundleManager (_session);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_bundle_manager ()
|
||||
AddVideoDialog*
|
||||
ARDOUR_UI::create_add_video_dialog ()
|
||||
{
|
||||
create_bundle_manager ();
|
||||
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleBundleManager"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
bundle_manager->show_all ();
|
||||
bundle_manager->present ();
|
||||
} else {
|
||||
bundle_manager->hide ();
|
||||
}
|
||||
}
|
||||
return new AddVideoDialog (_session);
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR_UI::create_route_params ()
|
||||
SessionOptionEditor*
|
||||
ARDOUR_UI::create_session_option_editor ()
|
||||
{
|
||||
if (route_params == 0) {
|
||||
route_params = new RouteParams_UI ();
|
||||
route_params->set_session (_session);
|
||||
route_params->signal_unmap().connect (sigc::bind(sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleInspector")));
|
||||
}
|
||||
return 0;
|
||||
return new SessionOptionEditor (_session);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_route_params_window ()
|
||||
BigClockWindow*
|
||||
ARDOUR_UI::create_big_clock_window ()
|
||||
{
|
||||
if (create_route_params ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleInspector"));
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
route_params->show_all ();
|
||||
route_params->present ();
|
||||
} else {
|
||||
route_params->hide ();
|
||||
}
|
||||
}
|
||||
return new BigClockWindow (*big_clock);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -512,14 +465,18 @@ ARDOUR_UI::main_window_state_event_handler (GdkEventWindowState* ev, bool window
|
|||
|
||||
if ((ev->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) &&
|
||||
(ev->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
|
||||
float_big_clock (editor);
|
||||
if (big_clock_window) {
|
||||
big_clock_window->set_transient_for (*editor);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ((ev->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) &&
|
||||
(ev->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
|
||||
float_big_clock (mixer);
|
||||
if (big_clock_window) {
|
||||
big_clock_window->set_transient_for (*mixer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
#include "mixer_ui.h"
|
||||
#include "startup.h"
|
||||
#include "utils.h"
|
||||
#include "window_proxy.h"
|
||||
#include "window_manager.h"
|
||||
#include "global_port_matrix.h"
|
||||
#include "location_ui.h"
|
||||
#include "main_clock.h"
|
||||
|
|
@ -137,22 +137,11 @@ ARDOUR_UI::install_actions ()
|
|||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_action (main_actions, X_("CloseVideo"), _("Remove Video"),
|
||||
sigc::mem_fun (*this, &ARDOUR_UI::remove_video));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act->set_sensitive (false);
|
||||
act = ActionManager::register_action (main_actions, X_("ExportVideo"), _("Export To Video File"),
|
||||
sigc::mem_fun (*editor, &PublicEditor::export_video));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
|
||||
#ifdef WITH_CMT
|
||||
|
||||
std::string anicomp_file_path;
|
||||
|
||||
if (PBD::find_file_in_search_path (Glib::getenv("PATH"), "AniComp", anicomp_file_path)) {
|
||||
act = ActionManager::register_action (main_actions, X_("aniConnect"), _("Connect"), (sigc::mem_fun (*editor, &PublicEditor::connect_to_image_compositor)));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
act = ActionManager::register_action (main_actions, X_("Snapshot"), _("Snapshot..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
ActionManager::write_sensitive_actions.push_back (act);
|
||||
|
|
@ -240,42 +229,14 @@ ARDOUR_UI::install_actions ()
|
|||
|
||||
ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), S_("Window|Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window));
|
||||
ActionManager::register_action (common_actions, X_("toggle-editor-mixer"), _("Toggle Editor+Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_editor_mixer));
|
||||
ActionManager::register_toggle_action (common_actions, X_("ToggleRCOptionsEditor"), _("Preferences"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window));
|
||||
ActionManager::register_toggle_action (common_actions, X_("ToggleSessionOptionsEditor"), _("Properties"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_options_window));
|
||||
act = ActionManager::register_toggle_action (common_actions, X_("ToggleInspector"), _("Tracks and Busses"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_route_params_window));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_toggle_action (common_actions, X_("ToggleLocations"), _("Locations"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_location_window));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_toggle_action (common_actions, X_("ToggleBigClock"), _("Big Clock"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_big_clock_window));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_toggle_action (common_actions, X_("toggle-speaker-config"), _("Speaker Configuration"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_speaker_config_window));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_toggle_action (common_actions, X_("toggle-audio-connection-manager"), _("Audio Connection Manager"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::toggle_global_port_matrix), ARDOUR::DataType::AUDIO));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_toggle_action (common_actions, X_("toggle-midi-connection-manager"), _("MIDI Connection Manager"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::toggle_global_port_matrix), ARDOUR::DataType::MIDI));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
|
||||
act = ActionManager::register_action (common_actions, X_("NewMIDITracer"), _("MIDI Tracer"), sigc::mem_fun(*this, &ARDOUR_UI::new_midi_tracer_window));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
ActionManager::register_action (common_actions, X_("About"), _("About"), sigc::mem_fun(*this, &ARDOUR_UI::show_about));
|
||||
ActionManager::register_action (common_actions, X_("Chat"), _("Chat"), sigc::mem_fun(*this, &ARDOUR_UI::launch_chat));
|
||||
/** TRANSLATORS: This is `Manual' in the sense of an instruction book that tells a user how to use Ardour */
|
||||
ActionManager::register_action (common_actions, X_("Manual"), S_("Help|Manual"), mem_fun(*this, &ARDOUR_UI::launch_manual));
|
||||
ActionManager::register_action (common_actions, X_("Reference"), _("Reference"), mem_fun(*this, &ARDOUR_UI::launch_reference));
|
||||
ActionManager::register_toggle_action (common_actions, X_("ToggleThemeManager"), _("Theme Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_theme_manager));
|
||||
ActionManager::register_toggle_action (common_actions, X_("ToggleKeyEditor"), _("Key Bindings"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_key_editor));
|
||||
ActionManager::register_toggle_action (common_actions, X_("ToggleBundleManager"), _("Bundle Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_bundle_manager));
|
||||
|
||||
#if 0
|
||||
act = ActionManager::register_action (common_actions, X_("AddAudioTrack"), _("Add Audio Track"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::session_add_audio_track), 1, 1, ARDOUR::Normal, (ARDOUR::RouteGroup *) 0, 1));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_action (common_actions, X_("AddAudioBus"), _("Add Audio Bus"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::session_add_audio_bus), 1, 1, (ARDOUR::RouteGroup *) 0, 1));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_action (common_actions, X_("AddMIDITrack"), _("Add MIDI Track"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::session_add_midi_track), (ARDOUR::RouteGroup *) 0, 1));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
//act = ActionManager::register_action (common_actions, X_("AddMidiBus"), _("Add Midi Bus"), sigc::mem_fun(*this, &ARDOUR_UI::session_add_midi_bus));
|
||||
//ActionManager::session_sensitive_actions.push_back (act);
|
||||
#endif
|
||||
act = ActionManager::register_action (common_actions, X_("Save"), _("Save"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::save_state), string(""), false));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
ActionManager::write_sensitive_actions.push_back (act);
|
||||
|
|
@ -612,156 +573,32 @@ ARDOUR_UI::use_menubar_as_top_menubar ()
|
|||
Gtk::Widget* widget;
|
||||
Application* app = Application::instance ();
|
||||
|
||||
/* Quit will be taken of separately */
|
||||
/* the addresses ("/ui/Main...") used below are based on the menu definitions in the menus file
|
||||
*/
|
||||
|
||||
/* Quit will be taken care of separately */
|
||||
|
||||
if ((widget = ActionManager::get_widget ("/ui/Main/Session/Quit"))) {
|
||||
widget->hide ();
|
||||
}
|
||||
|
||||
/* Put items for About and Preferences into App menu (the
|
||||
* ardour.menus.in file does not list them for OS X)
|
||||
*/
|
||||
|
||||
GtkApplicationMenuGroup* group = app->add_app_menu_group ();
|
||||
|
||||
if ((widget = ActionManager::get_widget ("/ui/Main/Session/About"))) {
|
||||
if ((widget = ActionManager::get_widget ("/ui/Main/Session/toggle-about"))) {
|
||||
app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
|
||||
}
|
||||
|
||||
if ((widget = ActionManager::get_widget ("/ui/Main/Session/ToggleRCOptionsEditor"))) {
|
||||
if ((widget = ActionManager::get_widget ("/ui/Main/Session/toggle-rc-options-editor"))) {
|
||||
app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
|
||||
}
|
||||
|
||||
app->set_menu_bar (*menu_bar);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::big_clock_catch_focus ()
|
||||
{
|
||||
PublicEditor::instance().reset_focus ();
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::setup_clock ()
|
||||
{
|
||||
ARDOUR_UI::Clock.connect (sigc::mem_fun (big_clock, &AudioClock::set));
|
||||
|
||||
big_clock->set_corner_radius (0.0);
|
||||
big_clock->mode_changed.connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_reset_aspect_ratio));
|
||||
|
||||
big_clock_window->set (new Window (WINDOW_TOPLEVEL), false);
|
||||
|
||||
big_clock_window->get()->set_keep_above (true);
|
||||
big_clock_window->get()->set_border_width (0);
|
||||
big_clock_window->get()->add (*big_clock);
|
||||
|
||||
big_clock_window->get()->set_title (_("Big Clock"));
|
||||
big_clock_window->get()->signal_realize().connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_realized));
|
||||
big_clock_window->get()->signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), big_clock_window->get()), false);
|
||||
big_clock_window->get()->signal_size_allocate().connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_size_allocate));
|
||||
|
||||
big_clock_window->get()->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBigClock")));
|
||||
big_clock_window->get()->signal_unmap().connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_catch_focus));
|
||||
|
||||
manage_window (*big_clock_window->get());
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::big_clock_reset_aspect_ratio ()
|
||||
{
|
||||
Gtk::Requisition req;
|
||||
big_clock->size_request (req);
|
||||
float aspect = req.width/(float)req.height;
|
||||
Gdk::Geometry geom;
|
||||
|
||||
geom.min_aspect = aspect;
|
||||
geom.max_aspect = aspect;
|
||||
|
||||
big_clock_window->get()->set_geometry_hints (*big_clock, geom, Gdk::HINT_ASPECT);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::big_clock_realized ()
|
||||
{
|
||||
int x, y, w, d;
|
||||
|
||||
set_decoration (big_clock_window->get(), (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
||||
big_clock_window->get()->get_window()->get_geometry (x, y, w, big_clock_height, d);
|
||||
|
||||
big_clock_reset_aspect_ratio ();
|
||||
|
||||
original_big_clock_height = big_clock_height;
|
||||
original_big_clock_width = w;
|
||||
|
||||
Pango::FontDescription fd (big_clock->get_style()->get_font());
|
||||
original_big_clock_font_size = fd.get_size ();
|
||||
|
||||
if (!fd.get_size_is_absolute ()) {
|
||||
original_big_clock_font_size /= PANGO_SCALE;
|
||||
}
|
||||
|
||||
big_clock_window->setup ();
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::float_big_clock (Gtk::Window* parent)
|
||||
{
|
||||
if (big_clock_window->get()) {
|
||||
if (parent) {
|
||||
big_clock_window->get()->set_transient_for (*parent);
|
||||
} else {
|
||||
gtk_window_set_transient_for (big_clock_window->get()->gobj(), (GtkWindow*) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::big_clock_size_allocate (Gtk::Allocation&)
|
||||
{
|
||||
if (!big_clock_resize_in_progress) {
|
||||
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::idle_big_clock_text_resizer), 0, 0));
|
||||
big_clock_resize_in_progress = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ARDOUR_UI::idle_big_clock_text_resizer (int, int)
|
||||
{
|
||||
big_clock_resize_in_progress = false;
|
||||
|
||||
Glib::RefPtr<Gdk::Window> win = big_clock_window->get()->get_window();
|
||||
Pango::FontDescription fd (big_clock->get_style()->get_font());
|
||||
int current_size = fd.get_size ();
|
||||
int x, y, w, h, d;
|
||||
|
||||
if (!fd.get_size_is_absolute ()) {
|
||||
current_size /= PANGO_SCALE;
|
||||
}
|
||||
|
||||
win->get_geometry (x, y, w, h, d);
|
||||
|
||||
double scale = min (((double) w / (double) original_big_clock_width),
|
||||
((double) h / (double) original_big_clock_height));
|
||||
|
||||
int size = (int) lrintf (original_big_clock_font_size * scale);
|
||||
|
||||
if (size != current_size) {
|
||||
|
||||
string family = fd.get_family();
|
||||
char buf[family.length()+16];
|
||||
snprintf (buf, family.length()+16, "%s %d", family.c_str(), size);
|
||||
|
||||
try {
|
||||
Pango::FontDescription fd (buf);
|
||||
Glib::RefPtr<Gtk::RcStyle> rcstyle = big_clock->get_modifier_style ();
|
||||
rcstyle->set_font (fd);
|
||||
big_clock->modify_style (rcstyle);
|
||||
}
|
||||
|
||||
catch (...) {
|
||||
/* oh well, do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::save_ardour_state ()
|
||||
{
|
||||
|
|
@ -780,11 +617,9 @@ ARDOUR_UI::save_ardour_state ()
|
|||
XMLNode* window_node = new XMLNode (X_("UI"));
|
||||
window_node->add_property (_status_bar_visibility.get_state_name().c_str(), _status_bar_visibility.get_state_value ());
|
||||
|
||||
for (list<WindowProxyBase*>::iterator i = _window_proxies.begin(); i != _window_proxies.end(); ++i) {
|
||||
if ((*i)->rc_configured()) {
|
||||
window_node->add_child_nocopy (*((*i)->get_state ()));
|
||||
}
|
||||
}
|
||||
/* Windows */
|
||||
|
||||
WM::Manager::instance().add_state (*window_node);
|
||||
|
||||
/* tearoffs */
|
||||
|
||||
|
|
@ -826,42 +661,20 @@ ARDOUR_UI::save_ardour_state ()
|
|||
if (_session) {
|
||||
_session->add_instant_xml (enode);
|
||||
_session->add_instant_xml (mnode);
|
||||
if (location_ui->get ()) {
|
||||
_session->add_instant_xml (location_ui->get()->ui().get_state ());
|
||||
if (location_ui) {
|
||||
_session->add_instant_xml (location_ui->ui().get_state ());
|
||||
}
|
||||
} else {
|
||||
Config->add_instant_xml (enode);
|
||||
Config->add_instant_xml (mnode);
|
||||
if (location_ui->get ()) {
|
||||
Config->add_instant_xml (location_ui->get()->ui().get_state ());
|
||||
if (location_ui) {
|
||||
Config->add_instant_xml (location_ui->ui().get_state ());
|
||||
}
|
||||
}
|
||||
|
||||
Keyboard::save_keybindings ();
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::toggle_global_port_matrix (ARDOUR::DataType t)
|
||||
{
|
||||
std::string const action = string_compose ("toggle-%1-connection-manager", t.to_string ());
|
||||
|
||||
if (_global_port_matrix[t]->get() == 0) {
|
||||
_global_port_matrix[t]->set (new GlobalPortMatrixWindow (_session, t));
|
||||
_global_port_matrix[t]->get()->signal_unmap().connect(sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), string_compose (X_("<Actions>/Common/%1"), action)));
|
||||
}
|
||||
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Common"), action.c_str());
|
||||
if (act) {
|
||||
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
|
||||
|
||||
if (tact->get_active()) {
|
||||
_global_port_matrix[t]->get()->present ();
|
||||
} else {
|
||||
_global_port_matrix[t]->get()->hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::resize_text_widgets ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@
|
|||
is to cut down on the nasty compile times for these classes.
|
||||
*/
|
||||
|
||||
#include "actions.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "mixer_ui.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@
|
|||
#include <gtkmm2ext/doi.h>
|
||||
|
||||
#include "ardour_window.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "keyboard.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Gtk;
|
||||
|
|
@ -35,6 +37,7 @@ ArdourWindow::ArdourWindow (string title)
|
|||
{
|
||||
set_title (title);
|
||||
init ();
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
}
|
||||
|
||||
ArdourWindow::ArdourWindow (Gtk::Window& parent, string /*title*/)
|
||||
|
|
@ -48,6 +51,13 @@ ArdourWindow::ArdourWindow (Gtk::Window& parent, string /*title*/)
|
|||
|
||||
ArdourWindow::~ArdourWindow ()
|
||||
{
|
||||
WM::Manager::instance().remove (proxy);
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourWindow::on_key_press_event (GdkEventKey* ev)
|
||||
{
|
||||
return relay_key_press (ev, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -71,9 +81,43 @@ ArdourWindow::on_unmap ()
|
|||
Window::on_unmap ();
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourWindow::on_delete_event (GdkEventAny*)
|
||||
{
|
||||
hide ();
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ArdourWindow::init ()
|
||||
{
|
||||
set_border_width (10);
|
||||
|
||||
/* ArdourWindows are not dialogs (they have no "OK" or "Close" button) but
|
||||
they should be considered part of the same "window level" as a dialog. This
|
||||
works on X11 and Quartz, in that:
|
||||
|
||||
(a) utility & dialog windows are considered to be part of the same level
|
||||
(b) they will float above normal windows without any particular effort
|
||||
(c) present()-ing them will make a utility float over a dialog or
|
||||
vice versa.
|
||||
*/
|
||||
|
||||
if (ARDOUR_UI::instance()->config()->all_floating_windows_are_dialogs.get()) {
|
||||
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
|
||||
} else {
|
||||
set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
|
||||
}
|
||||
|
||||
Gtk::Window* parent = WM::Manager::instance().transient_parent();
|
||||
|
||||
if (parent) {
|
||||
set_transient_for (*parent);
|
||||
}
|
||||
|
||||
ARDOUR_UI::CloseAllDialogs.connect (sigc::mem_fun (*this, &ArdourWindow::hide));
|
||||
|
||||
proxy = new WM::ProxyTemporary (get_title(), this);
|
||||
WM::Manager::instance().register_window (proxy);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@
|
|||
|
||||
#include "ardour/session_handle.h"
|
||||
|
||||
namespace WM {
|
||||
class ProxyTemporary;
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual parent class is so that each window uses the
|
||||
* same mechanism to declare its closing. It shares a common
|
||||
|
|
@ -42,9 +46,12 @@ class ArdourWindow : public Gtk::Window, public ARDOUR::SessionHandlePtr, public
|
|||
|
||||
bool on_enter_notify_event (GdkEventCrossing*);
|
||||
bool on_leave_notify_event (GdkEventCrossing*);
|
||||
bool on_delete_event (GdkEventAny *);
|
||||
bool on_key_press_event (GdkEventKey*);
|
||||
void on_unmap ();
|
||||
|
||||
private:
|
||||
WM::ProxyTemporary* proxy;
|
||||
void init ();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -76,9 +76,6 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
|
|||
void lower_box_realized ();
|
||||
void cocoa_view_resized ();
|
||||
void on_realize ();
|
||||
bool on_map_event (GdkEventAny*);
|
||||
bool on_focus_in_event (GdkEventFocus*);
|
||||
bool on_focus_out_event (GdkEventFocus*);
|
||||
void forward_key_event (GdkEventKey*);
|
||||
|
||||
bool on_window_show (const std::string& /*title*/);
|
||||
|
|
@ -105,6 +102,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
|
|||
|
||||
NSWindow* cocoa_window;
|
||||
NSView* au_view;
|
||||
NSRect last_au_frame;
|
||||
|
||||
/* Carbon */
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,26 @@ static const gchar* _automation_mode_strings[] = {
|
|||
0
|
||||
};
|
||||
|
||||
static void
|
||||
dump_view_tree (NSView* view, int depth)
|
||||
{
|
||||
NSArray* subviews = [view subviews];
|
||||
unsigned long cnt = [subviews count];
|
||||
|
||||
for (int d = 0; d < depth; d++) {
|
||||
cerr << '\t';
|
||||
}
|
||||
NSRect frame = [view frame];
|
||||
cerr << " view @ " << frame.origin.x << ", " << frame.origin.y
|
||||
<< ' ' << frame.size.width << " x " << frame.size.height
|
||||
<< endl;
|
||||
|
||||
for (unsigned long i = 0; i < cnt; ++i) {
|
||||
NSView* subview = [subviews objectAtIndex:i];
|
||||
dump_view_tree (subview, depth+1);
|
||||
}
|
||||
}
|
||||
|
||||
@implementation NotificationObject
|
||||
|
||||
- (NotificationObject*) initWithPluginUI: (AUPluginUI*) apluginui andCocoaParent: (NSWindow*) cp andTopLevelParent: (NSWindow*) tlp
|
||||
|
|
@ -413,14 +433,11 @@ AUPluginUI::cocoa_view_resized ()
|
|||
{
|
||||
GtkRequisition topsize = top_box.size_request ();
|
||||
NSWindow* window = get_nswindow ();
|
||||
NSSize oldContentSize= [window contentRectForFrameRect:[window frame]].size;
|
||||
NSSize newContentSize= [au_view frame].size;
|
||||
NSRect windowFrame= [window frame];
|
||||
NSRect new_frame = [au_view frame];
|
||||
|
||||
oldContentSize.height -= topsize.height;
|
||||
|
||||
float dy = oldContentSize.height - newContentSize.height;
|
||||
float dx = oldContentSize.width - newContentSize.width;
|
||||
float dy = last_au_frame.size.height - new_frame.size.height;
|
||||
float dx = last_au_frame.size.width - new_frame.size.width;
|
||||
|
||||
windowFrame.origin.y += dy;
|
||||
windowFrame.origin.x += dx;
|
||||
|
|
@ -435,11 +452,29 @@ AUPluginUI::cocoa_view_resized ()
|
|||
|
||||
[au_view setAutoresizingMask:NSViewNotSizable];
|
||||
[window setFrame:windowFrame display:1];
|
||||
|
||||
/* Some stupid AU Views change the origin of the original AU View
|
||||
when they are resized (I'm looking at you AUSampler). If the origin
|
||||
has been moved, move it back.
|
||||
*/
|
||||
|
||||
if (last_au_frame.origin.x != new_frame.origin.x ||
|
||||
last_au_frame.origin.y != new_frame.origin.y) {
|
||||
new_frame.origin = last_au_frame.origin;
|
||||
[au_view setFrame:new_frame];
|
||||
/* also be sure to redraw the topbox because this can
|
||||
also go wrong.
|
||||
*/
|
||||
top_box.queue_draw ();
|
||||
}
|
||||
|
||||
[au_view setAutoresizingMask:old_auto_resize];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:_notify
|
||||
selector:@selector(auViewResized:) name:NSViewFrameDidChangeNotification
|
||||
object:au_view];
|
||||
|
||||
last_au_frame = new_frame;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -533,7 +568,6 @@ AUPluginUI::activate ()
|
|||
#ifdef WITH_CARBON
|
||||
ActivateWindow (carbon_window, TRUE);
|
||||
#endif
|
||||
// [cocoa_parent makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -629,6 +663,8 @@ AUPluginUI::parent_cocoa_window ()
|
|||
[au_view setFrameOrigin:origin];
|
||||
[view addSubview:au_view positioned:NSWindowBelow relativeTo:nil];
|
||||
|
||||
last_au_frame = [au_view frame];
|
||||
|
||||
// watch for size changes of the view
|
||||
|
||||
_notify = [ [NotificationObject alloc] initWithPluginUI:this andCocoaParent:nil andTopLevelParent:win ];
|
||||
|
|
@ -640,23 +676,6 @@ AUPluginUI::parent_cocoa_window ()
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
dump_view_tree (NSView* view, int depth)
|
||||
{
|
||||
NSArray* subviews = [view subviews];
|
||||
unsigned long cnt = [subviews count];
|
||||
|
||||
for (int d = 0; d < depth; d++) {
|
||||
cerr << '\t';
|
||||
}
|
||||
cerr << " view @ " << view << endl;
|
||||
|
||||
for (unsigned long i = 0; i < cnt; ++i) {
|
||||
NSView* subview = [subviews objectAtIndex:i];
|
||||
dump_view_tree (subview, depth+1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AUPluginUI::forward_key_event (GdkEventKey* ev)
|
||||
{
|
||||
|
|
@ -702,12 +721,6 @@ AUPluginUI::lower_box_realized ()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AUPluginUI::on_map_event (GdkEventAny*)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
AUPluginUI::on_window_hide ()
|
||||
{
|
||||
|
|
@ -717,8 +730,14 @@ AUPluginUI::on_window_hide ()
|
|||
ActivateWindow (carbon_window, FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
hide_all ();
|
||||
|
||||
#if 0
|
||||
NSArray* wins = [NSApp windows];
|
||||
for (uint32_t i = 0; i < [wins count]; i++) {
|
||||
id win = [wins objectAtIndex:i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -760,19 +779,4 @@ create_au_gui (boost::shared_ptr<PluginInsert> plugin_insert, VBox** box)
|
|||
return aup;
|
||||
}
|
||||
|
||||
bool
|
||||
AUPluginUI::on_focus_in_event (GdkEventFocus*)
|
||||
{
|
||||
//cerr << "au plugin focus in\n";
|
||||
//Keyboard::magic_widget_grab_focus ();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
AUPluginUI::on_focus_out_event (GdkEventFocus*)
|
||||
{
|
||||
//cerr << "au plugin focus out\n";
|
||||
//Keyboard::magic_widget_drop_focus ();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1270,7 +1270,6 @@ AudioRegionView::show_region_editor ()
|
|||
}
|
||||
|
||||
editor->present ();
|
||||
editor->set_position (Gtk::WIN_POS_MOUSE);
|
||||
editor->show_all();
|
||||
}
|
||||
|
||||
|
|
|
|||
158
gtk2_ardour/big_clock_window.cc
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
Copyright (C) 20002-2013 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 <string>
|
||||
|
||||
#include "ardour_ui.h"
|
||||
#include "audio_clock.h"
|
||||
#include "big_clock_window.h"
|
||||
#include "public_editor.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
using std::min;
|
||||
using std::string;
|
||||
|
||||
BigClockWindow::BigClockWindow (AudioClock& c)
|
||||
: ArdourWindow (_("Big Clock"))
|
||||
, clock (c)
|
||||
, resize_in_progress (false)
|
||||
, original_height (0)
|
||||
, original_width (0)
|
||||
, original_font_size (0)
|
||||
{
|
||||
ARDOUR_UI::Clock.connect (sigc::mem_fun (clock, &AudioClock::set));
|
||||
|
||||
clock.set_corner_radius (0.0);
|
||||
clock.mode_changed.connect (sigc::mem_fun (*this, &BigClockWindow::reset_aspect_ratio));
|
||||
|
||||
set_keep_above (true);
|
||||
set_border_width (0);
|
||||
add (clock);
|
||||
clock.show_all ();
|
||||
}
|
||||
|
||||
void
|
||||
BigClockWindow::on_unmap ()
|
||||
{
|
||||
ArdourWindow::on_unmap ();
|
||||
|
||||
PublicEditor::instance().reset_focus ();
|
||||
}
|
||||
|
||||
bool
|
||||
BigClockWindow::on_key_press_event (GdkEventKey* ev)
|
||||
{
|
||||
return relay_key_press (ev, this);
|
||||
}
|
||||
|
||||
void
|
||||
BigClockWindow::on_realize ()
|
||||
{
|
||||
int x, y, w, d, h;
|
||||
|
||||
ArdourWindow::on_realize ();
|
||||
|
||||
get_window()->set_decorations (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH);
|
||||
get_window()->get_geometry (x, y, w, h, d);
|
||||
|
||||
reset_aspect_ratio ();
|
||||
|
||||
original_height = h;
|
||||
original_width = w;
|
||||
|
||||
Pango::FontDescription fd (clock.get_style()->get_font());
|
||||
original_font_size = fd.get_size ();
|
||||
|
||||
if (!fd.get_size_is_absolute ()) {
|
||||
original_font_size /= PANGO_SCALE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BigClockWindow::on_size_allocate (Gtk::Allocation& alloc)
|
||||
{
|
||||
ArdourWindow::on_size_allocate (alloc);
|
||||
|
||||
if (!resize_in_progress) {
|
||||
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &BigClockWindow::text_resizer), 0, 0));
|
||||
resize_in_progress = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BigClockWindow::reset_aspect_ratio ()
|
||||
{
|
||||
Gtk::Requisition req;
|
||||
|
||||
clock.size_request (req);
|
||||
|
||||
float aspect = req.width/(float)req.height;
|
||||
Gdk::Geometry geom;
|
||||
|
||||
geom.min_aspect = aspect;
|
||||
geom.max_aspect = aspect;
|
||||
|
||||
set_geometry_hints (clock, geom, Gdk::HINT_ASPECT);
|
||||
}
|
||||
|
||||
bool
|
||||
BigClockWindow::text_resizer (int, int)
|
||||
{
|
||||
resize_in_progress = false;
|
||||
|
||||
Glib::RefPtr<Gdk::Window> win = get_window();
|
||||
Pango::FontDescription fd (clock.get_style()->get_font());
|
||||
int current_size = fd.get_size ();
|
||||
int x, y, w, h, d;
|
||||
|
||||
if (!fd.get_size_is_absolute ()) {
|
||||
current_size /= PANGO_SCALE;
|
||||
}
|
||||
|
||||
win->get_geometry (x, y, w, h, d);
|
||||
|
||||
double scale = min (((double) w / (double) original_width),
|
||||
((double) h / (double) original_height));
|
||||
|
||||
int size = (int) lrintf (original_font_size * scale);
|
||||
|
||||
if (size != current_size) {
|
||||
|
||||
string family = fd.get_family();
|
||||
char buf[family.length()+16];
|
||||
snprintf (buf, family.length()+16, "%s %d", family.c_str(), size);
|
||||
|
||||
try {
|
||||
Pango::FontDescription fd (buf);
|
||||
Glib::RefPtr<Gtk::RcStyle> rcstyle = clock.get_modifier_style ();
|
||||
rcstyle->set_font (fd);
|
||||
clock.modify_style (rcstyle);
|
||||
}
|
||||
|
||||
catch (...) {
|
||||
/* oh well, do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
49
gtk2_ardour/big_clock_window.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
Copyright (C) 2013 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 __bigclock_window_h__
|
||||
#define __bigclock_window_h__
|
||||
|
||||
#include "ardour_window.h"
|
||||
|
||||
class AudioClock;
|
||||
|
||||
class BigClockWindow : public ArdourWindow
|
||||
{
|
||||
public:
|
||||
BigClockWindow (AudioClock&);
|
||||
|
||||
private:
|
||||
AudioClock& clock;
|
||||
bool resize_in_progress;
|
||||
int original_height;
|
||||
int original_width;
|
||||
int original_font_size;
|
||||
|
||||
void on_size_allocate (Gtk::Allocation&);
|
||||
void on_realize ();
|
||||
void on_unmap ();
|
||||
bool on_key_press_event (GdkEventKey*);
|
||||
|
||||
bool text_resizer (int, int);
|
||||
void reset_aspect_ratio ();
|
||||
};
|
||||
|
||||
#endif // __ardour_window_h__
|
||||
|
||||
|
|
@ -115,7 +115,6 @@ BundleEditorMatrix::add_channel (boost::shared_ptr<Bundle> b, DataType t)
|
|||
if (b == _bundle) {
|
||||
|
||||
NameChannelDialog d;
|
||||
d.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
if (d.run () != Gtk::RESPONSE_ACCEPT) {
|
||||
return;
|
||||
|
|
@ -162,7 +161,6 @@ void
|
|||
BundleEditorMatrix::rename_channel (BundleChannel bc)
|
||||
{
|
||||
NameChannelDialog d (bc.bundle, bc.channel);
|
||||
d.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
if (d.run () != Gtk::RESPONSE_ACCEPT) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,586 +0,0 @@
|
|||
/* Image item type for GnomeCanvas widget
|
||||
*
|
||||
* GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is
|
||||
* copyrighted by the Regents of the University of California, Sun Microsystems, and other parties.
|
||||
*
|
||||
* Copyright (C) 1998 The Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena <federico@nuclecu.unam.mx>
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h> /* for memcpy() */
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include "libart_lgpl/art_misc.h"
|
||||
#include "libart_lgpl/art_affine.h"
|
||||
#include "libart_lgpl/art_pixbuf.h"
|
||||
#include "libart_lgpl/art_rgb_pixbuf_affine.h"
|
||||
#include "canvas-imageframe.h"
|
||||
#include <libgnomecanvas/gnome-canvas-util.h>
|
||||
#include "gettext.h"
|
||||
#define _(Text) dgettext (PACKAGE,Text)
|
||||
|
||||
//GTK2FIX
|
||||
//#include <libgnomecanvas/gnome-canvastypebuiltins.h>
|
||||
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PIXBUF,
|
||||
PROP_X,
|
||||
PROP_Y,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT,
|
||||
PROP_DRAWWIDTH,
|
||||
PROP_ANCHOR
|
||||
};
|
||||
|
||||
|
||||
static void gnome_canvas_imageframe_class_init(GnomeCanvasImageFrameClass* class) ;
|
||||
static void gnome_canvas_imageframe_init(GnomeCanvasImageFrame* image) ;
|
||||
static void gnome_canvas_imageframe_destroy(GtkObject* object) ;
|
||||
static void gnome_canvas_imageframe_set_property(GObject* object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gnome_canvas_imageframe_get_property(GObject* object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gnome_canvas_imageframe_update(GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) ;
|
||||
static void gnome_canvas_imageframe_realize(GnomeCanvasItem *item) ;
|
||||
static void gnome_canvas_imageframe_unrealize(GnomeCanvasItem *item) ;
|
||||
static void gnome_canvas_imageframe_draw(GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) ;
|
||||
static double gnome_canvas_imageframe_point(GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item) ;
|
||||
static void gnome_canvas_imageframe_bounds(GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) ;
|
||||
static void gnome_canvas_imageframe_render(GnomeCanvasItem *item, GnomeCanvasBuf *buf) ;
|
||||
|
||||
static GnomeCanvasItemClass *parent_class;
|
||||
|
||||
|
||||
GType
|
||||
gnome_canvas_imageframe_get_type (void)
|
||||
{
|
||||
static GType imageframe_type = 0;
|
||||
|
||||
if (!imageframe_type) {
|
||||
GtkTypeInfo imageframe_info = {
|
||||
"GnomeCanvasImageFrame",
|
||||
sizeof (GnomeCanvasImageFrame),
|
||||
sizeof (GnomeCanvasImageFrameClass),
|
||||
(GtkClassInitFunc) gnome_canvas_imageframe_class_init,
|
||||
(GtkObjectInitFunc) gnome_canvas_imageframe_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
imageframe_type = gtk_type_unique (gnome_canvas_item_get_type (), &imageframe_info);
|
||||
}
|
||||
|
||||
return imageframe_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GnomeCanvasItemClass *item_class;
|
||||
|
||||
gobject_class = (GObjectClass *) class;
|
||||
object_class = (GtkObjectClass *) class;
|
||||
item_class = (GnomeCanvasItemClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (gnome_canvas_item_get_type ());
|
||||
|
||||
gobject_class->set_property = gnome_canvas_imageframe_set_property;
|
||||
gobject_class->get_property = gnome_canvas_imageframe_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PIXBUF,
|
||||
g_param_spec_pointer ("pixbuf",
|
||||
_("pixbuf"),
|
||||
_("the pixbuf"),
|
||||
G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_X,
|
||||
g_param_spec_double ("x",
|
||||
_("x"),
|
||||
_("x coordinate of upper left corner of rect"),
|
||||
-G_MAXDOUBLE,
|
||||
G_MAXDOUBLE,
|
||||
0.0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_Y,
|
||||
g_param_spec_double ("y",
|
||||
_("y"),
|
||||
_("y coordinate of upper left corner of rect "),
|
||||
-G_MAXDOUBLE,
|
||||
G_MAXDOUBLE,
|
||||
0.0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_WIDTH,
|
||||
g_param_spec_double ("width",
|
||||
_("width"),
|
||||
_("the width"),
|
||||
-G_MAXDOUBLE,
|
||||
G_MAXDOUBLE,
|
||||
0.0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DRAWWIDTH,
|
||||
g_param_spec_double ("drawwidth",
|
||||
_("drawwidth"),
|
||||
_("drawn width"),
|
||||
-G_MAXDOUBLE,
|
||||
G_MAXDOUBLE,
|
||||
0.0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HEIGHT,
|
||||
g_param_spec_double ("height",
|
||||
_("height"),
|
||||
_("the height"),
|
||||
-G_MAXDOUBLE,
|
||||
G_MAXDOUBLE,
|
||||
0.0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ANCHOR,
|
||||
g_param_spec_enum ("anchor",
|
||||
_("anchor"),
|
||||
_("the anchor"),
|
||||
GTK_TYPE_ANCHOR_TYPE,
|
||||
GTK_ANCHOR_NW,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
object_class->destroy = gnome_canvas_imageframe_destroy;
|
||||
|
||||
item_class->update = gnome_canvas_imageframe_update;
|
||||
item_class->realize = gnome_canvas_imageframe_realize;
|
||||
item_class->unrealize = gnome_canvas_imageframe_unrealize;
|
||||
item_class->draw = gnome_canvas_imageframe_draw;
|
||||
item_class->point = gnome_canvas_imageframe_point;
|
||||
item_class->bounds = gnome_canvas_imageframe_bounds;
|
||||
item_class->render = gnome_canvas_imageframe_render;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_init (GnomeCanvasImageFrame *image)
|
||||
{
|
||||
image->x = 0.0;
|
||||
image->y = 0.0;
|
||||
image->width = 0.0;
|
||||
image->height = 0.0;
|
||||
image->drawwidth = 0.0;
|
||||
image->anchor = GTK_ANCHOR_CENTER;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_destroy (GtkObject *object)
|
||||
{
|
||||
GnomeCanvasImageFrame *image;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GNOME_CANVAS_IS_CANVAS_IMAGEFRAME (object));
|
||||
|
||||
image = GNOME_CANVAS_IMAGEFRAME (object);
|
||||
|
||||
image->cwidth = 0;
|
||||
image->cheight = 0;
|
||||
|
||||
if (image->pixbuf)
|
||||
{
|
||||
art_pixbuf_free (image->pixbuf);
|
||||
image->pixbuf = NULL;
|
||||
}
|
||||
|
||||
if(GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
{
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get's the image bounds expressed as item-relative coordinates. */
|
||||
static void
|
||||
get_bounds_item_relative (GnomeCanvasImageFrame *image, double *px1, double *py1, double *px2, double *py2)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
double x, y;
|
||||
|
||||
item = GNOME_CANVAS_ITEM (image);
|
||||
|
||||
/* Get item coordinates */
|
||||
|
||||
x = image->x;
|
||||
y = image->y;
|
||||
|
||||
/* Anchor image */
|
||||
|
||||
switch (image->anchor) {
|
||||
case GTK_ANCHOR_NW:
|
||||
case GTK_ANCHOR_W:
|
||||
case GTK_ANCHOR_SW:
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_N:
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GTK_ANCHOR_S:
|
||||
x -= image->width / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NE:
|
||||
case GTK_ANCHOR_E:
|
||||
case GTK_ANCHOR_SE:
|
||||
x -= image->width;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (image->anchor) {
|
||||
case GTK_ANCHOR_NW:
|
||||
case GTK_ANCHOR_N:
|
||||
case GTK_ANCHOR_NE:
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_W:
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GTK_ANCHOR_E:
|
||||
y -= image->height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SW:
|
||||
case GTK_ANCHOR_S:
|
||||
case GTK_ANCHOR_SE:
|
||||
y -= image->height;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Bounds */
|
||||
|
||||
*px1 = x;
|
||||
*py1 = y;
|
||||
*px2 = x + image->width;
|
||||
*py2 = y + image->height;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
GnomeCanvasImageFrame *image;
|
||||
int update;
|
||||
int calc_bounds;
|
||||
|
||||
item = GNOME_CANVAS_ITEM (object);
|
||||
image = GNOME_CANVAS_IMAGEFRAME (object);
|
||||
|
||||
update = FALSE;
|
||||
calc_bounds = FALSE;
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PIXBUF:
|
||||
if (item->canvas->aa && g_value_get_pointer (value)) {
|
||||
if (image->pixbuf != NULL)
|
||||
art_pixbuf_free (image->pixbuf);
|
||||
image->pixbuf = g_value_get_pointer (value);
|
||||
}
|
||||
update = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_X:
|
||||
image->x = g_value_get_double (value);
|
||||
update = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_Y:
|
||||
image->y = g_value_get_double (value);
|
||||
update = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
image->width = fabs (g_value_get_double (value));
|
||||
update = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
image->height = fabs (g_value_get_double (value));
|
||||
update = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_DRAWWIDTH:
|
||||
image->drawwidth = fabs (g_value_get_double (value));
|
||||
update = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_ANCHOR:
|
||||
image->anchor = g_value_get_enum (value);
|
||||
update = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (update)
|
||||
gnome_canvas_item_request_update (item);
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GnomeCanvasImageFrame *image;
|
||||
|
||||
image = GNOME_CANVAS_IMAGEFRAME (object);
|
||||
|
||||
switch (prop_id) {
|
||||
|
||||
case PROP_X:
|
||||
g_value_set_double (value, image->x);
|
||||
break;
|
||||
|
||||
case PROP_Y:
|
||||
g_value_set_double (value, image->y);
|
||||
break;
|
||||
|
||||
case PROP_WIDTH:
|
||||
g_value_set_double (value, image->width);
|
||||
break;
|
||||
|
||||
case PROP_HEIGHT:
|
||||
g_value_set_double (value, image->height);
|
||||
break;
|
||||
|
||||
case PROP_DRAWWIDTH:
|
||||
g_value_set_double (value, image->drawwidth);
|
||||
break;
|
||||
|
||||
case PROP_ANCHOR:
|
||||
g_value_set_enum (value, image->anchor);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
|
||||
{
|
||||
GnomeCanvasImageFrame *image;
|
||||
ArtDRect i_bbox, c_bbox;
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
|
||||
image = GNOME_CANVAS_IMAGEFRAME (item);
|
||||
|
||||
if (parent_class->update)
|
||||
(* parent_class->update) (item, affine, clip_path, flags);
|
||||
|
||||
/* only works for non-rotated, non-skewed transforms */
|
||||
image->cwidth = (int) (image->width * affine[0] + 0.5);
|
||||
image->cheight = (int) (image->height * affine[3] + 0.5);
|
||||
|
||||
if (image->pixbuf) {
|
||||
image->need_recalc = TRUE ;
|
||||
}
|
||||
|
||||
get_bounds_item_relative (image, &i_bbox.x0, &i_bbox.y0, &i_bbox.x1, &i_bbox.y1);
|
||||
art_drect_affine_transform (&c_bbox, &i_bbox, affine);
|
||||
|
||||
/* these values only make sense in the non-rotated, non-skewed case */
|
||||
image->cx = c_bbox.x0;
|
||||
image->cy = c_bbox.y0;
|
||||
|
||||
/* add a fudge factor */
|
||||
c_bbox.x0--;
|
||||
c_bbox.y0--;
|
||||
c_bbox.x1++;
|
||||
c_bbox.y1++;
|
||||
|
||||
gnome_canvas_update_bbox (item, c_bbox.x0, c_bbox.y0, c_bbox.x1, c_bbox.y1);
|
||||
|
||||
if (image->pixbuf) {
|
||||
w = image->pixbuf->width;
|
||||
h = image->pixbuf->height;
|
||||
}
|
||||
|
||||
image->affine[0] = (affine[0] * image->width) / w;
|
||||
image->affine[1] = (affine[1] * image->height) / h;
|
||||
image->affine[2] = (affine[2] * image->width) / w;
|
||||
image->affine[3] = (affine[3] * image->height) / h;
|
||||
image->affine[4] = i_bbox.x0 * affine[0] + i_bbox.y0 * affine[2] + affine[4];
|
||||
image->affine[5] = i_bbox.x0 * affine[1] + i_bbox.y0 * affine[3] + affine[5];
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_realize (GnomeCanvasItem *item)
|
||||
{
|
||||
GnomeCanvasImageFrame *image;
|
||||
|
||||
image = GNOME_CANVAS_IMAGEFRAME (item);
|
||||
|
||||
if (parent_class->realize)
|
||||
(* parent_class->realize) (item);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_unrealize (GnomeCanvasItem *item)
|
||||
{
|
||||
GnomeCanvasImageFrame *image;
|
||||
|
||||
image = GNOME_CANVAS_IMAGEFRAME(item);
|
||||
|
||||
if (parent_class->unrealize)
|
||||
(* parent_class->unrealize) (item);
|
||||
}
|
||||
|
||||
static void
|
||||
recalc_if_needed (GnomeCanvasImageFrame *image)
|
||||
{}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
static double
|
||||
gnome_canvas_imageframe_point (GnomeCanvasItem *item, double x, double y,
|
||||
int cx, int cy, GnomeCanvasItem **actual_item)
|
||||
{
|
||||
GnomeCanvasImageFrame *image;
|
||||
int x1, y1, x2, y2;
|
||||
int dx, dy;
|
||||
|
||||
image = GNOME_CANVAS_IMAGEFRAME (item);
|
||||
|
||||
*actual_item = item;
|
||||
|
||||
recalc_if_needed (image);
|
||||
|
||||
x1 = image->cx - item->canvas->close_enough;
|
||||
y1 = image->cy - item->canvas->close_enough;
|
||||
x2 = image->cx + image->cwidth - 1 + item->canvas->close_enough;
|
||||
y2 = image->cy + image->cheight - 1 + item->canvas->close_enough;
|
||||
|
||||
/* Hard case: is point inside image's gravity region? */
|
||||
|
||||
//if ((cx >= x1) && (cy >= y1) && (cx <= x2) && (cy <= y2))
|
||||
//return dist_to_mask (image, cx, cy) / item->canvas->pixels_per_unit;
|
||||
|
||||
/* Point is outside image */
|
||||
|
||||
x1 += item->canvas->close_enough;
|
||||
y1 += item->canvas->close_enough;
|
||||
x2 -= item->canvas->close_enough;
|
||||
y2 -= item->canvas->close_enough;
|
||||
|
||||
if (cx < x1)
|
||||
dx = x1 - cx;
|
||||
else if (cx > x2)
|
||||
dx = cx - x2;
|
||||
else
|
||||
dx = 0;
|
||||
|
||||
if (cy < y1)
|
||||
dy = y1 - cy;
|
||||
else if (cy > y2)
|
||||
dy = cy - y2;
|
||||
else
|
||||
dy = 0;
|
||||
|
||||
return sqrt (dx * dx + dy * dy) / item->canvas->pixels_per_unit;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
|
||||
{
|
||||
GnomeCanvasImageFrame *image;
|
||||
|
||||
image = GNOME_CANVAS_IMAGEFRAME (item);
|
||||
|
||||
*x1 = image->x;
|
||||
*y1 = image->y;
|
||||
|
||||
switch (image->anchor) {
|
||||
case GTK_ANCHOR_NW:
|
||||
case GTK_ANCHOR_W:
|
||||
case GTK_ANCHOR_SW:
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_N:
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GTK_ANCHOR_S:
|
||||
*x1 -= image->width / 2.0;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NE:
|
||||
case GTK_ANCHOR_E:
|
||||
case GTK_ANCHOR_SE:
|
||||
*x1 -= image->width;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (image->anchor) {
|
||||
case GTK_ANCHOR_NW:
|
||||
case GTK_ANCHOR_N:
|
||||
case GTK_ANCHOR_NE:
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_W:
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GTK_ANCHOR_E:
|
||||
*y1 -= image->height / 2.0;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SW:
|
||||
case GTK_ANCHOR_S:
|
||||
case GTK_ANCHOR_SE:
|
||||
*y1 -= image->height;
|
||||
break;
|
||||
}
|
||||
|
||||
*x2 = *x1 + image->width;
|
||||
*y2 = *y1 + image->height;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_canvas_imageframe_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
|
||||
{
|
||||
GnomeCanvasImageFrame *image;
|
||||
|
||||
image = GNOME_CANVAS_IMAGEFRAME (item);
|
||||
|
||||
gnome_canvas_buf_ensure_buf (buf);
|
||||
|
||||
#ifdef VERBOSE
|
||||
{
|
||||
char str[128];
|
||||
art_affine_to_string (str, image->affine);
|
||||
g_print ("gnome_canvas_imageframe_render %s\n", str);
|
||||
}
|
||||
#endif
|
||||
|
||||
art_rgb_pixbuf_affine (buf->buf,
|
||||
buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
|
||||
buf->buf_rowstride,
|
||||
image->pixbuf,
|
||||
image->affine,
|
||||
ART_FILTER_NEAREST, NULL);
|
||||
|
||||
buf->is_bg = 0;
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/* Image item type for GnomeCanvas widget
|
||||
*
|
||||
* GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is
|
||||
* copyrighted by the Regents of the University of California, Sun Microsystems, and other parties.
|
||||
*
|
||||
* Copyright (C) 1998 The Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena <federico@nuclecu.unam.mx>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GNOME_CANVAS_IMAGEFRAME_H__
|
||||
#define __GNOME_CANVAS_IMAGEFRAME_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libgnomecanvas/libgnomecanvas.h>
|
||||
#include <gtk/gtkenums.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <libart_lgpl/art_misc.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <libart_lgpl/art_pixbuf.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
/* Image item for the canvas. Images are positioned by anchoring them to a point.
|
||||
* The following arguments are available:
|
||||
*
|
||||
* name type read/write description
|
||||
* ------------------------------------------------------------------------------------------
|
||||
* pixbuf ArtPixBuf* W Pointer to an ArtPixBuf (aa-mode)
|
||||
* x double RW X coordinate of anchor point
|
||||
* y double RW Y coordinate of anchor point
|
||||
* width double RW Width to scale image to, in canvas units
|
||||
* height double RW Height to scale image to, in canvas units
|
||||
* drawwidth double RW Width to scale image to, in canvas units
|
||||
* anchor GtkAnchorType RW Anchor side for the image
|
||||
*/
|
||||
|
||||
|
||||
#define GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME (gnome_canvas_imageframe_get_type ())
|
||||
#define GNOME_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_CAST ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrame))
|
||||
#define GNOME_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrameClass))
|
||||
#define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_TYPE ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME))
|
||||
#define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME))
|
||||
|
||||
|
||||
typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame;
|
||||
typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass;
|
||||
|
||||
struct _GnomeCanvasImageFrame {
|
||||
GnomeCanvasItem item;
|
||||
|
||||
double x, y; /* Position at anchor, item relative */
|
||||
double width, height; /* Size of image, item relative */
|
||||
double drawwidth ; /* the amount of the image we draw width-wise (0-drawwidth)*/
|
||||
GtkAnchorType anchor; /* Anchor side for image */
|
||||
|
||||
int cx, cy; /* Top-left canvas coordinates for display */
|
||||
int cwidth, cheight; /* Rendered size in pixels */
|
||||
|
||||
uint32_t need_recalc : 1; /* Do we need to rescale the image? */
|
||||
|
||||
ArtPixBuf *pixbuf; /* A pixbuf, for aa rendering */
|
||||
double affine[6]; /* The item -> canvas affine */
|
||||
};
|
||||
|
||||
struct _GnomeCanvasImageFrameClass {
|
||||
GnomeCanvasItemClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
/* Standard Gtk function */
|
||||
GtkType gnome_canvas_imageframe_get_type (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
@ -22,7 +22,6 @@
|
|||
#include "gtkmm2ext/keyboard.h"
|
||||
|
||||
#include "canvas-note-event.h"
|
||||
#include "midi_channel_selector.h"
|
||||
#include "midi_region_view.h"
|
||||
#include "public_editor.h"
|
||||
#include "editing_syms.h"
|
||||
|
|
@ -49,7 +48,6 @@ CanvasNoteEvent::CanvasNoteEvent(MidiRegionView& region, Item* item, const boost
|
|||
: _region(region)
|
||||
, _item(item)
|
||||
, _text(0)
|
||||
, _channel_selector_widget()
|
||||
, _state(None)
|
||||
, _note(note)
|
||||
, _selected(false)
|
||||
|
|
@ -68,8 +66,6 @@ CanvasNoteEvent::~CanvasNoteEvent()
|
|||
_text->hide();
|
||||
delete _text;
|
||||
}
|
||||
|
||||
delete _channel_selector_widget;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -129,55 +125,9 @@ void
|
|||
CanvasNoteEvent::on_channel_change(uint8_t channel)
|
||||
{
|
||||
_region.note_selected(this, true);
|
||||
hide_channel_selector();
|
||||
_region.change_channel(channel);
|
||||
}
|
||||
|
||||
void
|
||||
CanvasNoteEvent::show_channel_selector(void)
|
||||
{
|
||||
if (_channel_selector_widget == 0) {
|
||||
|
||||
if(_region.channel_selector_scoped_note() != 0){
|
||||
_region.channel_selector_scoped_note()->hide_channel_selector();
|
||||
_region.set_channel_selector_scoped_note(0);
|
||||
}
|
||||
|
||||
SingleMidiChannelSelector* _channel_selector = new SingleMidiChannelSelector(_note->channel());
|
||||
_channel_selector->show_all();
|
||||
_channel_selector->channel_selected.connect(
|
||||
sigc::mem_fun(this, &CanvasNoteEvent::on_channel_change));
|
||||
|
||||
_channel_selector->clicked.connect (
|
||||
sigc::mem_fun (this, &CanvasNoteEvent::hide_channel_selector));
|
||||
|
||||
_channel_selector_widget = new Widget(*(_item->property_parent()),
|
||||
x1(),
|
||||
y2() + 2,
|
||||
(Gtk::Widget &) *_channel_selector);
|
||||
|
||||
_channel_selector_widget->hide();
|
||||
_channel_selector_widget->property_height() = 100;
|
||||
_channel_selector_widget->property_width() = 100;
|
||||
_channel_selector_widget->raise_to_top();
|
||||
_channel_selector_widget->show();
|
||||
|
||||
_region.set_channel_selector_scoped_note(this);
|
||||
} else {
|
||||
hide_channel_selector();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CanvasNoteEvent::hide_channel_selector(void)
|
||||
{
|
||||
if (_channel_selector_widget) {
|
||||
_channel_selector_widget->hide();
|
||||
delete _channel_selector_widget;
|
||||
_channel_selector_widget = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CanvasNoteEvent::set_selected(bool selected)
|
||||
{
|
||||
|
|
@ -191,12 +141,6 @@ CanvasNoteEvent::set_selected(bool selected)
|
|||
|
||||
if (_selected && active) {
|
||||
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get()));
|
||||
|
||||
if(_region.channel_selector_scoped_note() != 0){
|
||||
_region.channel_selector_scoped_note()->hide_channel_selector();
|
||||
_region.set_channel_selector_scoped_note(0);
|
||||
}
|
||||
|
||||
set_fill_color (base_color ());
|
||||
|
||||
} else {
|
||||
|
|
@ -208,8 +152,6 @@ CanvasNoteEvent::set_selected(bool selected)
|
|||
set_fill_color(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get());
|
||||
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get()));
|
||||
}
|
||||
|
||||
hide_channel_selector();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +280,7 @@ CanvasNoteEvent::on_event(GdkEvent* ev)
|
|||
case GDK_BUTTON_PRESS:
|
||||
set_mouse_fractions (ev);
|
||||
if (ev->button.button == 3 && Keyboard::no_modifiers_active (ev->button.state) && _selected) {
|
||||
show_channel_selector();
|
||||
_region.get_time_axis_view().editor().edit_notes (_region);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -89,9 +89,6 @@ class CanvasNoteEvent : virtual public sigc::trackable
|
|||
/** Channel selection changed */
|
||||
void on_channel_selection_change(uint16_t selection);
|
||||
|
||||
void show_channel_selector();
|
||||
void hide_channel_selector();
|
||||
|
||||
virtual void set_outline_color(uint32_t c) = 0;
|
||||
virtual void set_fill_color(uint32_t c) = 0;
|
||||
|
||||
|
|
@ -151,7 +148,6 @@ class CanvasNoteEvent : virtual public sigc::trackable
|
|||
MidiRegionView& _region;
|
||||
Item* const _item;
|
||||
NoEventText* _text;
|
||||
Widget* _channel_selector_widget;
|
||||
State _state;
|
||||
const boost::shared_ptr<NoteType> _note;
|
||||
bool _selected;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ namespace Gnome {
|
|||
class Line;
|
||||
class Points;
|
||||
class Pixbuf;
|
||||
class ImageFrame;
|
||||
class LineSet;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@ CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr<Crossfade> xf, d
|
|||
|
||||
set_wmclass (X_("ardour_automationedit"), PROGRAM_NAME);
|
||||
set_name ("CrossfadeEditWindow");
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
add_accel_group (ActionManager::ui_manager->get_accel_group());
|
||||
|
||||
|
|
|
|||
|
|
@ -146,16 +146,13 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<ArdourCanvas::CanvasNote
|
|||
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_ACCEPT);
|
||||
set_default_response (Gtk::RESPONSE_ACCEPT);
|
||||
|
||||
show_all ();
|
||||
}
|
||||
|
||||
int
|
||||
EditNoteDialog::run ()
|
||||
void
|
||||
EditNoteDialog::done (int r)
|
||||
{
|
||||
int const r = Dialog::run ();
|
||||
if (r != RESPONSE_ACCEPT) {
|
||||
return r;
|
||||
return;
|
||||
}
|
||||
|
||||
/* These calls mean that if a value is entered using the keyboard
|
||||
|
|
@ -227,6 +224,4 @@ EditNoteDialog::run ()
|
|||
for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
|
||||
(*i)->set_selected ((*i)->selected()); // change color
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class EditNoteDialog : public ArdourDialog
|
|||
public:
|
||||
EditNoteDialog (MidiRegionView *, std::set<Gnome::Canvas::CanvasNoteEvent*>);
|
||||
|
||||
int run ();
|
||||
void done (int);
|
||||
|
||||
private:
|
||||
MidiRegionView* _region_view;
|
||||
|
|
|
|||
|
|
@ -119,10 +119,6 @@
|
|||
|
||||
#include "i18n.h"
|
||||
|
||||
#ifdef WITH_CMT
|
||||
#include "imageframe_socket_handler.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
|
|
@ -233,8 +229,7 @@ pane_size_watcher (Paned* pane)
|
|||
}
|
||||
|
||||
Editor::Editor ()
|
||||
: VisibilityTracker (*((Gtk::Window*) this))
|
||||
, _join_object_range_state (JOIN_OBJECT_RANGE_NONE)
|
||||
: _join_object_range_state (JOIN_OBJECT_RANGE_NONE)
|
||||
|
||||
/* time display buttons */
|
||||
, minsec_label (_("Mins:Secs"))
|
||||
|
|
@ -266,10 +261,6 @@ Editor::Editor ()
|
|||
|
||||
, _toolbar_viewport (*manage (new Gtk::Adjustment (0, 0, 1e10)), *manage (new Gtk::Adjustment (0, 0, 1e10)))
|
||||
|
||||
#ifdef WITH_CMT
|
||||
, image_socket_listener(0)
|
||||
#endif
|
||||
|
||||
/* nudge */
|
||||
|
||||
, nudge_clock (new AudioClock (X_("nudge"), false, X_("nudge"), true, false, true))
|
||||
|
|
@ -767,18 +758,6 @@ Editor::Editor ()
|
|||
|
||||
Editor::~Editor()
|
||||
{
|
||||
#ifdef WITH_CMT
|
||||
if(image_socket_listener) {
|
||||
if(image_socket_listener->is_connected())
|
||||
{
|
||||
image_socket_listener->close_connection() ;
|
||||
}
|
||||
|
||||
delete image_socket_listener ;
|
||||
image_socket_listener = 0 ;
|
||||
}
|
||||
#endif
|
||||
|
||||
delete button_bindings;
|
||||
delete _routes;
|
||||
delete _route_groups;
|
||||
|
|
@ -3146,12 +3125,12 @@ Editor::convert_drop_to_paths (
|
|||
*/
|
||||
|
||||
string txt = data.get_text();
|
||||
const char* p;
|
||||
char* p;
|
||||
const char* q;
|
||||
|
||||
p = (const char *) malloc (txt.length() + 1);
|
||||
txt.copy (const_cast<char *> (p), txt.length(), 0);
|
||||
const_cast<char*>(p)[txt.length()] = '\0';
|
||||
p = (char *) malloc (txt.length() + 1);
|
||||
txt.copy (p, txt.length(), 0);
|
||||
p[txt.length()] = '\0';
|
||||
|
||||
while (p)
|
||||
{
|
||||
|
|
@ -3331,8 +3310,6 @@ Editor::duplicate_range (bool with_dialog)
|
|||
win.add_button (_("Duplicate"), RESPONSE_ACCEPT);
|
||||
win.set_default_response (RESPONSE_ACCEPT);
|
||||
|
||||
win.set_position (WIN_POS_MOUSE);
|
||||
|
||||
spinner.grab_focus ();
|
||||
|
||||
switch (win.run ()) {
|
||||
|
|
@ -5409,7 +5386,6 @@ Editor::change_region_layering_order (bool from_context_menu)
|
|||
|
||||
if (layering_order_editor == 0) {
|
||||
layering_order_editor = new RegionLayeringOrderEditor (*this);
|
||||
layering_order_editor->set_position (WIN_POS_MOUSE);
|
||||
}
|
||||
|
||||
layering_order_editor->set_context (clicked_routeview->name(), _session, clicked_routeview, pl, position);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
#include "gtkmm2ext/dndtreeview.h"
|
||||
#include "gtkmm2ext/stateful_button.h"
|
||||
#include "gtkmm2ext/bindings.h"
|
||||
#include "gtkmm2ext/visibility_tracker.h"
|
||||
|
||||
#include "pbd/stateful.h"
|
||||
#include "pbd/signals.h"
|
||||
|
|
@ -62,7 +61,6 @@
|
|||
#include "editor_items.h"
|
||||
#include "region_selection.h"
|
||||
#include "canvas.h"
|
||||
#include "window_proxy.h"
|
||||
|
||||
namespace Gnome {
|
||||
namespace Canvas {
|
||||
|
|
@ -109,13 +107,24 @@ class BundleManager;
|
|||
class ButtonJoiner;
|
||||
class ControlPoint;
|
||||
class DragManager;
|
||||
class EditNoteDialog;
|
||||
class EditorCursor;
|
||||
class EditorGroupTabs;
|
||||
class EditorLocations;
|
||||
class EditorRegions;
|
||||
class EditorRoutes;
|
||||
class EditorRouteGroups;
|
||||
class EditorSnapshots;
|
||||
class EditorSummary;
|
||||
class GroupedButtons;
|
||||
class GUIObjectState;
|
||||
class Marker;
|
||||
class MidiRegionView;
|
||||
class MixerStrip;
|
||||
class MouseCursors;
|
||||
class PlaylistSelector;
|
||||
class PluginSelector;
|
||||
class ProgressReporter;
|
||||
class RhythmFerret;
|
||||
class Selection;
|
||||
class SoundFileOmega;
|
||||
|
|
@ -124,30 +133,10 @@ class TempoLines;
|
|||
class TimeAxisView;
|
||||
class TimeFXDialog;
|
||||
class TimeSelection;
|
||||
class EditorGroupTabs;
|
||||
class EditorRoutes;
|
||||
class EditorRouteGroups;
|
||||
class EditorRegions;
|
||||
class EditorLocations;
|
||||
class EditorSnapshots;
|
||||
class EditorSummary;
|
||||
class RegionLayeringOrderEditor;
|
||||
class ProgressReporter;
|
||||
class EditorCursor;
|
||||
class MouseCursors;
|
||||
class VerboseCursor;
|
||||
|
||||
/* <CMT Additions> */
|
||||
class ImageFrameView;
|
||||
class ImageFrameTimeAxisView;
|
||||
class ImageFrameTimeAxis;
|
||||
class MarkerTimeAxis ;
|
||||
class MarkerView ;
|
||||
class ImageFrameSocketHandler ;
|
||||
class TimeAxisViewItem ;
|
||||
/* </CMT Additions> */
|
||||
|
||||
class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public Gtkmm2ext::VisibilityTracker
|
||||
class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
|
||||
{
|
||||
public:
|
||||
Editor ();
|
||||
|
|
@ -199,14 +188,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);
|
||||
|
||||
|
|
@ -936,6 +917,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
Glib::RefPtr<Gtk::Action> xjadeo_zoom_100;
|
||||
void set_xjadeo_proc ();
|
||||
void toggle_xjadeo_proc (int state=-1);
|
||||
void set_close_video_sensitive (bool onoff);
|
||||
void set_xjadeo_sensitive (bool onoff);
|
||||
void set_xjadeo_viewoption (int);
|
||||
void toggle_xjadeo_viewoption (int what, int state=-1);
|
||||
|
|
@ -1464,15 +1446,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;
|
||||
|
||||
|
|
@ -1541,7 +1514,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
void edit_tempo_marker (ArdourCanvas::Item*);
|
||||
void edit_meter_marker (ArdourCanvas::Item*);
|
||||
void edit_control_point (ArdourCanvas::Item*);
|
||||
void edit_notes (std::set<Gnome::Canvas::CanvasNoteEvent *> const &);
|
||||
void edit_notes (TimeAxisViewItem&);
|
||||
|
||||
void marker_menu_edit ();
|
||||
void marker_menu_remove ();
|
||||
|
|
@ -1922,47 +1895,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;
|
||||
|
||||
|
|
@ -2139,7 +2071,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
bool _following_mixer_selection;
|
||||
|
||||
int time_fx (ARDOUR::RegionList&, float val, bool pitching);
|
||||
|
||||
void note_edit_done (int, EditNoteDialog*);
|
||||
void toggle_sound_midi_notes ();
|
||||
|
||||
/** Flag for a bit of a hack wrt control point selection; see set_selected_control_point_from_click */
|
||||
|
|
|
|||
|
|
@ -773,6 +773,15 @@ Editor::set_group_tabs ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_close_video_sensitive (bool onoff)
|
||||
{
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Main"), X_("CloseVideo"));
|
||||
if (act) {
|
||||
act->set_sensitive (onoff);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_xjadeo_sensitive (bool onoff)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,11 +37,9 @@
|
|||
#include "waveview.h"
|
||||
#include "simplerect.h"
|
||||
#include "simpleline.h"
|
||||
#include "imageframe.h"
|
||||
#include "waveview_p.h"
|
||||
#include "simplerect_p.h"
|
||||
#include "simpleline_p.h"
|
||||
#include "imageframe_p.h"
|
||||
#include "canvas_impl.h"
|
||||
#include "canvas-noevent-text.h"
|
||||
#include "editing.h"
|
||||
|
|
@ -89,14 +87,12 @@ static void ardour_canvas_type_init()
|
|||
Glib::wrap_register(gnome_canvas_simpleline_get_type(), &Gnome::Canvas::SimpleLine_Class::wrap_new);
|
||||
Glib::wrap_register(gnome_canvas_simplerect_get_type(), &Gnome::Canvas::SimpleRect_Class::wrap_new);
|
||||
Glib::wrap_register(gnome_canvas_waveview_get_type(), &Gnome::Canvas::WaveView_Class::wrap_new);
|
||||
// Glib::wrap_register(gnome_canvas_imageframe_get_type(), &Gnome::Canvas::ImageFrame_Class::wrap_new);
|
||||
|
||||
// Register the gtkmm gtypes:
|
||||
|
||||
(void) Gnome::Canvas::WaveView::get_type();
|
||||
(void) Gnome::Canvas::SimpleLine::get_type();
|
||||
(void) Gnome::Canvas::SimpleRect::get_type();
|
||||
(void) Gnome::Canvas::ImageFrame::get_type();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -66,17 +66,17 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
|
|||
retry:
|
||||
switch (direction) {
|
||||
case GDK_SCROLL_UP:
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
|
||||
//for mouse-wheel zoom, force zoom-focus to mouse
|
||||
Editing::ZoomFocus temp_focus = zoom_focus;
|
||||
zoom_focus = Editing::ZoomFocusMouse;
|
||||
temporal_zoom_step (false);
|
||||
zoom_focus = temp_focus;
|
||||
return true;
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
|
||||
direction = GDK_SCROLL_LEFT;
|
||||
goto retry;
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
|
||||
if (!current_stepping_trackview) {
|
||||
step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
|
||||
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize);
|
||||
|
|
@ -95,17 +95,17 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
|
|||
break;
|
||||
|
||||
case GDK_SCROLL_DOWN:
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
|
||||
//for mouse-wheel zoom, force zoom-focus to mouse
|
||||
Editing::ZoomFocus temp_focus = zoom_focus;
|
||||
zoom_focus = Editing::ZoomFocusMouse;
|
||||
temporal_zoom_step (true);
|
||||
zoom_focus = temp_focus;
|
||||
return true;
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
|
||||
direction = GDK_SCROLL_RIGHT;
|
||||
goto retry;
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
|
||||
if (!current_stepping_trackview) {
|
||||
step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
|
||||
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp
|
|||
|
||||
switch (item_type) {
|
||||
case RegionItem:
|
||||
if (!get_smart_mode() || (_join_object_range_state == JOIN_OBJECT_RANGE_OBJECT)) {
|
||||
if (!get_smart_mode() || (_join_object_range_state != JOIN_OBJECT_RANGE_RANGE)) {
|
||||
if (press) {
|
||||
if (mouse_mode != MouseRange) {
|
||||
set_selected_regionview_from_click (press, op);
|
||||
|
|
@ -861,8 +861,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
|
||||
case RegionViewNameHighlight:
|
||||
if (!clicked_regionview->region()->locked()) {
|
||||
RegionSelection s = get_equivalent_regions (selection->regions, Properties::select.property_id);
|
||||
_drags->set (new TrimDrag (this, item, clicked_regionview, s.by_layer()), event);
|
||||
_drags->set (new TrimDrag (this, item, clicked_regionview, selection->regions.by_layer()), event);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -935,15 +934,13 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
switch (item_type) {
|
||||
case FadeInHandleItem:
|
||||
{
|
||||
RegionSelection s = get_equivalent_regions (selection->regions, Properties::select.property_id);
|
||||
_drags->set (new FadeInDrag (this, item, reinterpret_cast<RegionView*> (item->get_data("regionview")), s), event, _cursors->fade_in);
|
||||
_drags->set (new FadeInDrag (this, item, reinterpret_cast<RegionView*> (item->get_data("regionview")), selection->regions), event, _cursors->fade_in);
|
||||
return true;
|
||||
}
|
||||
|
||||
case FadeOutHandleItem:
|
||||
{
|
||||
RegionSelection s = get_equivalent_regions (selection->regions, Properties::select.property_id);
|
||||
_drags->set (new FadeOutDrag (this, item, reinterpret_cast<RegionView*> (item->get_data("regionview")), s), event, _cursors->fade_out);
|
||||
_drags->set (new FadeOutDrag (this, item, reinterpret_cast<RegionView*> (item->get_data("regionview")), selection->regions), event, _cursors->fade_out);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -951,8 +948,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
case EndCrossFadeItem:
|
||||
/* we might allow user to grab inside the fade to trim a region with preserve_fade_anchor. for not this is not fully implemented */
|
||||
// if (!clicked_regionview->region()->locked()) {
|
||||
// RegionSelection s = get_equivalent_regions (selection->regions, Properties::edit.property_id);
|
||||
// _drags->set (new TrimDrag (this, item, clicked_regionview, s.by_layer(), true), event);
|
||||
// _drags->set (new TrimDrag (this, item, clicked_regionview, selection->regions.by_layer(), true), event);
|
||||
// return true;
|
||||
// }
|
||||
break;
|
||||
|
|
@ -978,10 +974,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
}
|
||||
|
||||
if (internal_editing ()) {
|
||||
if (event->type == GDK_2BUTTON_PRESS && event->button.button == 1) {
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("MouseMode"), X_("toggle-internal-edit"));
|
||||
act->activate ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1006,8 +998,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
case LeftFrameHandle:
|
||||
case RightFrameHandle:
|
||||
if (!clicked_regionview->region()->locked()) {
|
||||
RegionSelection s = get_equivalent_regions (selection->regions, Properties::select.property_id);
|
||||
_drags->set (new TrimDrag (this, item, clicked_regionview, s.by_layer()), event);
|
||||
_drags->set (new TrimDrag (this, item, clicked_regionview, selection->regions.by_layer()), event);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1015,8 +1006,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
case RegionViewName:
|
||||
{
|
||||
/* rename happens on edit clicks */
|
||||
RegionSelection s = get_equivalent_regions (selection->regions, Properties::select.property_id);
|
||||
_drags->set (new TrimDrag (this, clicked_regionview->get_name_highlight(), clicked_regionview, s.by_layer()), event);
|
||||
_drags->set (new TrimDrag (this, clicked_regionview->get_name_highlight(), clicked_regionview, selection->regions.by_layer()), event);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1115,31 +1105,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef WITH_CMT
|
||||
case ImageFrameHandleStartItem:
|
||||
imageframe_start_handle_op(item, event) ;
|
||||
return(true) ;
|
||||
break ;
|
||||
case ImageFrameHandleEndItem:
|
||||
imageframe_end_handle_op(item, event) ;
|
||||
return(true) ;
|
||||
break ;
|
||||
case MarkerViewHandleStartItem:
|
||||
markerview_item_start_handle_op(item, event) ;
|
||||
return(true) ;
|
||||
break ;
|
||||
case MarkerViewHandleEndItem:
|
||||
markerview_item_end_handle_op(item, event) ;
|
||||
return(true) ;
|
||||
break ;
|
||||
case MarkerViewItem:
|
||||
start_markerview_grab(item, event) ;
|
||||
break ;
|
||||
case ImageFrameItem:
|
||||
start_imageframe_grab(item, event) ;
|
||||
break ;
|
||||
#endif
|
||||
|
||||
case MarkerBarItem:
|
||||
|
||||
break;
|
||||
|
|
@ -1485,14 +1450,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
edit_control_point (item);
|
||||
break;
|
||||
|
||||
case NoteItem:
|
||||
{
|
||||
ArdourCanvas::CanvasNoteEvent* e = dynamic_cast<ArdourCanvas::CanvasNoteEvent*> (item);
|
||||
assert (e);
|
||||
edit_notes (e->region_view().selection ());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1576,21 +1533,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
popup_control_point_context_menu (item, event);
|
||||
break;
|
||||
|
||||
#ifdef WITH_CMT
|
||||
case ImageFrameItem:
|
||||
popup_imageframe_edit_menu(1, event->button.time, item, true) ;
|
||||
break ;
|
||||
case ImageFrameTimeAxisItem:
|
||||
popup_imageframe_edit_menu(1, event->button.time, item, false) ;
|
||||
break ;
|
||||
case MarkerViewItem:
|
||||
popup_marker_time_axis_edit_menu(1, event->button.time, item, true) ;
|
||||
break ;
|
||||
case MarkerTimeAxisItem:
|
||||
popup_marker_time_axis_edit_menu(1, event->button.time, item, false) ;
|
||||
break ;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1869,19 +1811,11 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
|||
break;
|
||||
|
||||
case StartSelectionTrimItem:
|
||||
#ifdef WITH_CMT
|
||||
case ImageFrameHandleStartItem:
|
||||
case MarkerViewHandleStartItem:
|
||||
#endif
|
||||
if (is_drawable()) {
|
||||
set_canvas_cursor (_cursors->left_side_trim);
|
||||
}
|
||||
break;
|
||||
case EndSelectionTrimItem:
|
||||
#ifdef WITH_CMT
|
||||
case ImageFrameHandleEndItem:
|
||||
case MarkerViewHandleEndItem:
|
||||
#endif
|
||||
if (is_drawable()) {
|
||||
set_canvas_cursor (_cursors->right_side_trim);
|
||||
}
|
||||
|
|
@ -2055,13 +1989,6 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
|
|||
case EndSelectionTrimItem:
|
||||
case PlayheadCursorItem:
|
||||
|
||||
#ifdef WITH_CMT
|
||||
case ImageFrameHandleStartItem:
|
||||
case ImageFrameHandleEndItem:
|
||||
case MarkerViewHandleStartItem:
|
||||
case MarkerViewHandleEndItem:
|
||||
#endif
|
||||
|
||||
_over_region_trim_target = false;
|
||||
|
||||
if (is_drawable()) {
|
||||
|
|
@ -2348,7 +2275,6 @@ Editor::edit_control_point (ArdourCanvas::Item* item)
|
|||
}
|
||||
|
||||
ControlPointDialog d (p);
|
||||
d.set_position (Gtk::WIN_POS_MOUSE);
|
||||
ensure_float (d);
|
||||
|
||||
if (d.run () != RESPONSE_ACCEPT) {
|
||||
|
|
@ -2359,19 +2285,33 @@ Editor::edit_control_point (ArdourCanvas::Item* item)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::edit_notes (MidiRegionView::Selection const & s)
|
||||
Editor::edit_notes (TimeAxisViewItem& tavi)
|
||||
{
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(&tavi);
|
||||
|
||||
if (!mrv) {
|
||||
return;
|
||||
}
|
||||
|
||||
MidiRegionView::Selection const & s = mrv->selection();
|
||||
|
||||
if (s.empty ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
EditNoteDialog d (&(*s.begin())->region_view(), s);
|
||||
d.set_position (Gtk::WIN_POS_MOUSE);
|
||||
ensure_float (d);
|
||||
EditNoteDialog* d = new EditNoteDialog (&(*s.begin())->region_view(), s);
|
||||
d->show_all ();
|
||||
ensure_float (*d);
|
||||
|
||||
d.run ();
|
||||
d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &Editor::note_edit_done), d));
|
||||
}
|
||||
|
||||
void
|
||||
Editor::note_edit_done (int r, EditNoteDialog* d)
|
||||
{
|
||||
d->done (r);
|
||||
delete d;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::visible_order_range (int* low, int* high) const
|
||||
|
|
@ -2652,8 +2592,7 @@ Editor::add_region_drag (ArdourCanvas::Item* item, GdkEvent*, RegionView* region
|
|||
if (Config->get_edit_mode() == Splice) {
|
||||
_drags->add (new RegionSpliceDrag (this, item, region_view, selection->regions.by_layer()));
|
||||
} else {
|
||||
RegionSelection s = get_equivalent_regions (selection->regions, ARDOUR::Properties::select.property_id);
|
||||
_drags->add (new RegionMoveDrag (this, item, region_view, s.by_layer(), false, false));
|
||||
_drags->add (new RegionMoveDrag (this, item, region_view, selection->regions.by_layer(), false, false));
|
||||
}
|
||||
|
||||
/* sync the canvas to what we think is its current state */
|
||||
|
|
@ -2671,8 +2610,7 @@ Editor::add_region_copy_drag (ArdourCanvas::Item* item, GdkEvent*, RegionView* r
|
|||
|
||||
_region_motion_group->raise_to_top ();
|
||||
|
||||
RegionSelection s = get_equivalent_regions (selection->regions, ARDOUR::Properties::select.property_id);
|
||||
_drags->add (new RegionMoveDrag (this, item, region_view, s.by_layer(), false, true));
|
||||
_drags->add (new RegionMoveDrag (this, item, region_view, selection->regions.by_layer(), false, true));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -2688,8 +2626,7 @@ Editor::add_region_brush_drag (ArdourCanvas::Item* item, GdkEvent*, RegionView*
|
|||
return;
|
||||
}
|
||||
|
||||
RegionSelection s = get_equivalent_regions (selection->regions, ARDOUR::Properties::select.property_id);
|
||||
_drags->add (new RegionMoveDrag (this, item, region_view, s.by_layer(), true, false));
|
||||
_drags->add (new RegionMoveDrag (this, item, region_view, selection->regions.by_layer(), true, false));
|
||||
|
||||
begin_reversible_command (Operations::drag_region_brush);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2383,7 +2383,6 @@ Editor::rename_region ()
|
|||
d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
||||
|
||||
d.set_size_request (300, -1);
|
||||
d.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
entry.set_text (rs.front()->region()->name());
|
||||
entry.select_region (0, -1);
|
||||
|
|
|
|||
|
|
@ -623,45 +623,55 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev)
|
|||
double x = xr.first;
|
||||
double y = yr.first;
|
||||
|
||||
double amount = 8;
|
||||
|
||||
if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
|
||||
amount = 64;
|
||||
} else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
|
||||
amount = 1;
|
||||
}
|
||||
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
|
||||
|
||||
/* secondary-wheel == left-right scrolling */
|
||||
|
||||
if (ev->direction == GDK_SCROLL_UP) {
|
||||
x -= amount;
|
||||
} else if (ev->direction == GDK_SCROLL_DOWN) {
|
||||
x += amount;
|
||||
}
|
||||
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
||||
|
||||
/* primary-wheel == zoom */
|
||||
|
||||
if (ev->direction == GDK_SCROLL_UP) {
|
||||
switch (ev->direction) {
|
||||
case GDK_SCROLL_UP:
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
|
||||
x -= 64;
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
|
||||
_editor->temporal_zoom_step (false);
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
|
||||
yr.first += 4;
|
||||
yr.second -= 4;
|
||||
set_editor (xr, yr);
|
||||
return true;
|
||||
} else {
|
||||
y -= 8;
|
||||
}
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
|
||||
x += 64;
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
|
||||
_editor->temporal_zoom_step (true);
|
||||
}
|
||||
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
|
||||
yr.first -= 4;
|
||||
yr.second += 4;
|
||||
set_editor (xr, yr);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (ev->direction == GDK_SCROLL_DOWN) {
|
||||
y += amount;
|
||||
} else if (ev->direction == GDK_SCROLL_UP) {
|
||||
y -= amount;
|
||||
} else if (ev->direction == GDK_SCROLL_LEFT) {
|
||||
x -= amount;
|
||||
} else if (ev->direction == GDK_SCROLL_RIGHT) {
|
||||
x += amount;
|
||||
y += 8;
|
||||
}
|
||||
break;
|
||||
case GDK_SCROLL_LEFT:
|
||||
if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
|
||||
x -= 64;
|
||||
} else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
|
||||
x -= 1;
|
||||
} else {
|
||||
x -= 8;
|
||||
}
|
||||
break;
|
||||
case GDK_SCROLL_RIGHT:
|
||||
if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
|
||||
x += 64;
|
||||
} else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
|
||||
x += 1;
|
||||
} else {
|
||||
x += 8;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
set_editor (x, y);
|
||||
|
|
|
|||
|
|
@ -207,7 +207,6 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
|
|||
TempoMap& map(_session->tempo_map());
|
||||
TempoDialog tempo_dialog (map, frame, _("add"));
|
||||
|
||||
tempo_dialog.set_position (Gtk::WIN_POS_MOUSE);
|
||||
//this causes compiz to display no border.
|
||||
//tempo_dialog.signal_realize().connect (sigc::bind (sigc::ptr_fun (set_decoration), &tempo_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
|
||||
|
||||
|
|
@ -250,8 +249,6 @@ Editor::mouse_add_new_meter_event (framepos_t frame)
|
|||
TempoMap& map(_session->tempo_map());
|
||||
MeterDialog meter_dialog (map, frame, _("add"));
|
||||
|
||||
meter_dialog.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
//this causes compiz to display no border..
|
||||
//meter_dialog.signal_realize().connect (sigc::bind (sigc::ptr_fun (set_decoration), &meter_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
|
||||
|
||||
|
|
@ -307,8 +304,6 @@ Editor::edit_meter_section (MeterSection* section)
|
|||
{
|
||||
MeterDialog meter_dialog (*section, _("done"));
|
||||
|
||||
meter_dialog.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
ensure_float (meter_dialog);
|
||||
|
||||
switch (meter_dialog.run()) {
|
||||
|
|
@ -339,8 +334,6 @@ Editor::edit_tempo_section (TempoSection* section)
|
|||
{
|
||||
TempoDialog tempo_dialog (*section, _("done"));
|
||||
|
||||
tempo_dialog.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
ensure_float (tempo_dialog);
|
||||
|
||||
switch (tempo_dialog.run ()) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "export_video_infobox.h"
|
||||
#include "interthread_progress_window.h"
|
||||
|
||||
#include "pbd/openuri.h"
|
||||
#include "i18n.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -125,10 +126,17 @@ Editor::export_video ()
|
|||
{
|
||||
if (ARDOUR::Config->get_show_video_export_info()) {
|
||||
ExportVideoInfobox infobox (_session);
|
||||
infobox.run();
|
||||
Gtk::ResponseType rv = (Gtk::ResponseType) infobox.run();
|
||||
if (infobox.show_again()) {
|
||||
ARDOUR::Config->set_show_video_export_info(false);
|
||||
}
|
||||
switch (rv) {
|
||||
case GTK_RESPONSE_YES:
|
||||
PBD::open_uri (ARDOUR::Config->get_reference_manual_url() + "/video-timeline/operations/#export");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ExportVideoDialog dialog (*this, _session);
|
||||
Gtk::ResponseType r = (Gtk::ResponseType) dialog.run();
|
||||
|
|
|
|||
|
|
@ -110,8 +110,10 @@ PortExportChannelSelector::fill_route_list ()
|
|||
|
||||
/* Add master bus and then everything else */
|
||||
|
||||
if (_session->master_out()) {
|
||||
ARDOUR::IO* master = _session->master_out()->output().get();
|
||||
channel_view.add_route (master);
|
||||
}
|
||||
|
||||
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
|
||||
if ((*it)->is_master () || (*it)->is_monitor ()) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ ExportFormatSelector::ExportFormatSelector () :
|
|||
new_button.set_name ("PaddedButton");
|
||||
|
||||
edit_button.signal_clicked().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*this, &ExportFormatSelector::open_edit_dialog), false)));
|
||||
remove_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatSelector::remove_format));
|
||||
remove_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatSelector::remove_format), true));
|
||||
new_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatSelector::add_new_format));
|
||||
|
||||
/* Format combo */
|
||||
|
|
@ -122,7 +122,7 @@ ExportFormatSelector::add_new_format ()
|
|||
FormatPtr new_format = state->format = NewFormat (state->format);
|
||||
|
||||
if (open_edit_dialog (true) != Gtk::RESPONSE_APPLY) {
|
||||
remove_format();
|
||||
remove_format(false);
|
||||
if (state->list->empty()) {
|
||||
state->format.reset ();
|
||||
}
|
||||
|
|
@ -130,11 +130,26 @@ ExportFormatSelector::add_new_format ()
|
|||
}
|
||||
|
||||
void
|
||||
ExportFormatSelector::remove_format ()
|
||||
ExportFormatSelector::remove_format (bool called_from_button)
|
||||
{
|
||||
if (called_from_button) {
|
||||
Gtk::MessageDialog dialog (_("Do you really want to remove the format?"),
|
||||
false,
|
||||
Gtk::MESSAGE_QUESTION,
|
||||
Gtk::BUTTONS_YES_NO);
|
||||
|
||||
if (Gtk::RESPONSE_YES != dialog.run ()) {
|
||||
/* User has selected "no" or closed the dialog, better
|
||||
* abort
|
||||
*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FormatPtr remove;
|
||||
Gtk::TreeModel::iterator it = format_combo.get_active();
|
||||
remove = it->get_value (format_cols.format);
|
||||
|
||||
FormatRemoved (remove);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class ExportFormatSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
|
|||
|
||||
void select_format (FormatPtr f);
|
||||
void add_new_format ();
|
||||
void remove_format ();
|
||||
void remove_format (bool called_from_button = false);
|
||||
int open_edit_dialog (bool new_dialog = false);
|
||||
void update_format_combo ();
|
||||
void update_format_description ();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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__ */
|
||||
|
|
@ -153,6 +153,18 @@ ExportPresetSelector::remove_current ()
|
|||
{
|
||||
if (!profile_manager) { return; }
|
||||
|
||||
Gtk::MessageDialog dialog (_("Do you really want to remove this preset?"),
|
||||
false,
|
||||
Gtk::MESSAGE_QUESTION,
|
||||
Gtk::BUTTONS_YES_NO);
|
||||
|
||||
if (Gtk::RESPONSE_YES != dialog.run ()) {
|
||||
/* User has selected "no" or closed the dialog, better
|
||||
* abort
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
profile_manager->remove_preset();
|
||||
entry.get_entry()->set_text ("");
|
||||
sync_with_manager ();
|
||||
|
|
|
|||
|
|
@ -120,9 +120,7 @@ ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc)
|
|||
ExportTimespanPtr span = _session->get_export_handler()->add_timespan();
|
||||
|
||||
std::string id;
|
||||
if (loc == state->session_range.get()) {
|
||||
id = "session";
|
||||
} else if (loc == state->selection_range.get()) {
|
||||
if (loc == state->selection_range.get()) {
|
||||
id = "selection";
|
||||
} else {
|
||||
id = loc->id().to_s();
|
||||
|
|
@ -367,9 +365,7 @@ ExportTimespanSelectorSingle::fill_range_list ()
|
|||
if (!state) { return; }
|
||||
|
||||
std::string id;
|
||||
if (!range_id.compare (X_("session"))) {
|
||||
id = state->session_range->id().to_s();
|
||||
} else if (!range_id.compare (X_("selection"))) {
|
||||
if (!range_id.compare (X_("selection"))) {
|
||||
id = state->selection_range->id().to_s();
|
||||
} else {
|
||||
id = range_id;
|
||||
|
|
@ -459,9 +455,8 @@ ExportTimespanSelectorMultiple::set_selection_from_state ()
|
|||
for (tree_it = range_list->children().begin(); tree_it != range_list->children().end(); ++tree_it) {
|
||||
Location * loc = tree_it->get_value (range_cols.location);
|
||||
|
||||
if ((!id.compare ("session") && loc == state->session_range.get()) ||
|
||||
(!id.compare ("selection") && loc == state->selection_range.get()) ||
|
||||
(!id.compare (loc->id().to_s()))) {
|
||||
if ((id == "selection" && loc == state->selection_range.get()) ||
|
||||
(id == loc->id().to_s())) {
|
||||
tree_it->set_value (range_cols.selected, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s)
|
|||
set_session (s);
|
||||
|
||||
set_name ("ExportVideoDialog");
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
set_modal (true);
|
||||
set_skip_taskbar_hint (true);
|
||||
set_resizable (false);
|
||||
|
|
@ -142,13 +141,13 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s)
|
|||
vbox->pack_start (*path_hbox, false, false, 2);
|
||||
|
||||
insnd_combo.set_name ("PaddedButton");
|
||||
insnd_combo.append_text("from ardour session-start to session-end");
|
||||
insnd_combo.append_text (string_compose (_("from the %1 session's start to the session's end"), PROGRAM_NAME));
|
||||
|
||||
frameoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
|
||||
if (av_offset < 0 ) {
|
||||
insnd_combo.append_text("from 00:00:00:00 to video-end");
|
||||
insnd_combo.append_text (_("from 00:00:00:00 to the video's end"));
|
||||
} else {
|
||||
insnd_combo.append_text("from video-start to video-end");
|
||||
insnd_combo.append_text (_("from the video's start to the video's end"));
|
||||
}
|
||||
insnd_combo.set_active(0);
|
||||
|
||||
|
|
@ -156,12 +155,29 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s)
|
|||
outfn_path_entry.set_text (_session->session_directory().export_path() + G_DIR_SEPARATOR +"export.avi");
|
||||
|
||||
XMLNode* node = _session->extra_xml (X_("Videotimeline"));
|
||||
if (node && node->property(X_("Filename"))) {
|
||||
if (node) {
|
||||
bool filenameset = false;
|
||||
if (node->property(X_("OriginalVideoFile"))) {
|
||||
std::string filename = node->property(X_("OriginalVideoFile"))->value();
|
||||
if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
|
||||
invid_path_entry.set_text (filename);
|
||||
filenameset = true;
|
||||
}
|
||||
}
|
||||
else if (!filenameset
|
||||
&& node->property(X_("Filename"))
|
||||
&& node->property(X_("LocalFile"))
|
||||
&& node->property(X_("LocalFile"))->value() == X_("1")
|
||||
) {
|
||||
std::string filename = node->property(X_("Filename"))->value();
|
||||
if (filename.at(0) != G_DIR_SEPARATOR) {
|
||||
filename = Glib::build_filename (_session->session_directory().video_path(), filename);
|
||||
}
|
||||
if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
|
||||
invid_path_entry.set_text (filename);
|
||||
filenameset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
l = manage (new Label (_("<b>Settings:</b>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
|
||||
|
|
@ -417,7 +433,7 @@ ExportVideoDialog::launch_export ()
|
|||
cancel_button->hide();
|
||||
transcode_button.hide();
|
||||
pbar.set_size_request(300,-1);
|
||||
pbar.set_text(_("Exporting Audio.."));
|
||||
pbar.set_text(_("Exporting Audio..."));
|
||||
progress_box->show();
|
||||
aborted = false;
|
||||
twopass = twopass_checkbox.get_active();
|
||||
|
|
@ -542,7 +558,7 @@ ExportVideoDialog::launch_export ()
|
|||
Gtk::Dialog::response(RESPONSE_CANCEL);
|
||||
return;
|
||||
}
|
||||
pbar.set_text (_("Encoding Video.."));
|
||||
pbar.set_text (_("Encoding Video..."));
|
||||
encode_pass(1);
|
||||
}
|
||||
|
||||
|
|
@ -582,7 +598,7 @@ ExportVideoDialog::encode_pass (int pass)
|
|||
ffs["-acodec"] = audio_codec_combo.get_active_text();
|
||||
|
||||
if (video_bitrate_combo.get_active_text() == "retain" ) {
|
||||
ffs["-sameq"] = "-y"; // we use '-y' as dummy parameter for non key/value options
|
||||
ffs["-qscale"] = "0";
|
||||
} else {
|
||||
ffs["-b:v"] = video_bitrate_combo.get_active_text();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ ExportVideoInfobox::ExportVideoInfobox (Session* s)
|
|||
set_session (s);
|
||||
|
||||
set_name ("ExportVideoInfobox");
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
set_modal (true);
|
||||
set_skip_taskbar_hint (true);
|
||||
set_resizable (false);
|
||||
|
|
@ -44,7 +43,11 @@ ExportVideoInfobox::ExportVideoInfobox (Session* s)
|
|||
l = manage (new Label (_("<b>Video Export Info</b>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
|
||||
l->set_use_markup ();
|
||||
vbox->pack_start (*l, false, true);
|
||||
l = manage (new Label (_("Ardour video export is not recommended for mastering!\nWhile 'ffmpeg' (which is used by ardour) can produce high-quality files, this export lacks the possibility to tweak many settings. We recommend to use 'winff', 'devede' or 'dvdauthor' to mux & master. Nevertheless this video-export comes in handy to do quick snapshots, intermediates, dailies or online videos.\n\nThe soundtrack is created from the master-bus of the current Ardour session.\n\nThe video soure defaults to the file used in the video timeline, which may not the best quality to start with, you should the original video file.\n\nIf the export-range is longer than the original video, black video frames are prefixed and/or appended. This process may fail with non-standard pixel-aspect-ratios.\n\nThe file-format is determined by the extension that you choose for the output file (.avi, .mov, .flv, .ogv,...)\nNote: not all combinations of format+codec+settings produce files which are according so spec. e.g. flv files require sample-rates of 22.1kHz or 44.1kHz, mpeg containers can not be used with ac3 audio-codec, etc. If in doubt, use one of the built-in presets."), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
|
||||
l = manage (new Label (
|
||||
string_compose(
|
||||
_("Video encoding is a non-trivial task with many details.\n\nPlease see the manual at %1/video-timeline/operations/#export.\n\nOpen Manual in Browser? "),
|
||||
Config->get_reference_manual_url()
|
||||
), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
|
||||
l->set_size_request(700,-1);
|
||||
l->set_line_wrap();
|
||||
vbox->pack_start (*l, false, true,4);
|
||||
|
|
@ -57,7 +60,8 @@ ExportVideoInfobox::ExportVideoInfobox (Session* s)
|
|||
|
||||
showagain_checkbox.set_active(false);
|
||||
show_all_children ();
|
||||
add_button (Stock::OK, RESPONSE_ACCEPT);
|
||||
add_button (Stock::YES, RESPONSE_YES);
|
||||
add_button (Stock::NO, RESPONSE_NO);
|
||||
}
|
||||
|
||||
ExportVideoInfobox::~ExportVideoInfobox ()
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ class ExportVideoInfobox : public ArdourDialog
|
|||
bool show_again () { return showagain_checkbox.get_active(); }
|
||||
|
||||
private:
|
||||
//void on_show ();
|
||||
Gtk::CheckButton showagain_checkbox;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "ardour/dB.h"
|
||||
#include "ardour/utils.h"
|
||||
|
||||
#include <pangomm.h>
|
||||
#include <gtkmm/style.h>
|
||||
#include <gdkmm/color.h>
|
||||
#include <gtkmm2ext/utils.h>
|
||||
|
|
@ -47,6 +48,8 @@
|
|||
#include "ardour/session.h"
|
||||
#include "ardour/route.h"
|
||||
#include "ardour/meter.h"
|
||||
#include "ardour/audio_track.h"
|
||||
#include "ardour/midi_track.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -236,7 +239,7 @@ GainMeterBase::setup_gain_adjustment ()
|
|||
|
||||
ignore_toggle = true;
|
||||
|
||||
if (_amp->output_streams().n_midi() == 0) {
|
||||
if (_amp->output_streams().n_midi() <= _amp->output_streams().n_audio()) {
|
||||
_data_type = DataType::AUDIO;
|
||||
gain_adjustment.set_lower (0.0);
|
||||
gain_adjustment.set_upper (1.0);
|
||||
|
|
@ -860,7 +863,7 @@ GainMeter::GainMeter (Session* s, int fader_length)
|
|||
gain_display_box.pack_start (gain_display, true, true);
|
||||
|
||||
meter_metric_area.set_name ("AudioTrackMetrics");
|
||||
set_size_request_to_display_given_text (meter_metric_area, "-127", 0, 0);
|
||||
set_size_request_to_display_given_text (meter_metric_area, "-127", 1, 0);
|
||||
|
||||
gain_automation_style_button.set_name ("mixer strip button");
|
||||
gain_automation_state_button.set_name ("mixer strip button");
|
||||
|
|
@ -952,7 +955,32 @@ GainMeter::render_metrics (Gtk::Widget& w, vector<DataType> types)
|
|||
|
||||
cairo_surface_t* surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height);
|
||||
cairo_t* cr = cairo_create (surface);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout (w.gobj(), "");
|
||||
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(w.get_pango_context());
|
||||
|
||||
|
||||
Pango::AttrList audio_font_attributes;
|
||||
Pango::AttrList midi_font_attributes;
|
||||
|
||||
Pango::AttrFontDesc* font_attr;
|
||||
Pango::FontDescription font;
|
||||
|
||||
font = Pango::FontDescription (""); // use defaults
|
||||
//font = get_font_for_style("gain-fader");
|
||||
//font = w.get_style()->get_font();
|
||||
|
||||
font.set_weight (Pango::WEIGHT_NORMAL);
|
||||
font.set_size (10.0 * PANGO_SCALE);
|
||||
font_attr = new Pango::AttrFontDesc (Pango::Attribute::create_attr_font_desc (font));
|
||||
audio_font_attributes.change (*font_attr);
|
||||
delete font_attr;
|
||||
|
||||
font.set_weight (Pango::WEIGHT_ULTRALIGHT);
|
||||
font.set_stretch (Pango::STRETCH_ULTRA_CONDENSED);
|
||||
font.set_size (7.5 * PANGO_SCALE);
|
||||
font_attr = new Pango::AttrFontDesc (Pango::Attribute::create_attr_font_desc (font));
|
||||
midi_font_attributes.change (*font_attr);
|
||||
delete font_attr;
|
||||
|
||||
|
||||
cairo_move_to (cr, 0, 0);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
|
|
@ -988,6 +1016,7 @@ GainMeter::render_metrics (Gtk::Widget& w, vector<DataType> types)
|
|||
|
||||
switch (*i) {
|
||||
case DataType::AUDIO:
|
||||
layout->set_attributes (audio_font_attributes);
|
||||
points.push_back (-50);
|
||||
points.push_back (-40);
|
||||
points.push_back (-30);
|
||||
|
|
@ -999,6 +1028,7 @@ GainMeter::render_metrics (Gtk::Widget& w, vector<DataType> types)
|
|||
break;
|
||||
|
||||
case DataType::MIDI:
|
||||
layout->set_attributes (midi_font_attributes);
|
||||
points.push_back (0);
|
||||
if (types.size() == 1) {
|
||||
points.push_back (32);
|
||||
|
|
@ -1030,23 +1060,23 @@ GainMeter::render_metrics (Gtk::Widget& w, vector<DataType> types)
|
|||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_move_to (cr, 0, pos);
|
||||
cairo_line_to (cr, 4, pos);
|
||||
cairo_line_to (cr, 3.5, pos);
|
||||
cairo_stroke (cr);
|
||||
|
||||
snprintf (buf, sizeof (buf), "%d", abs (*j));
|
||||
pango_layout_set_text (layout, buf, strlen (buf));
|
||||
snprintf (buf, sizeof (buf), "%2d", abs (*j));
|
||||
layout->set_text(buf);
|
||||
|
||||
/* we want logical extents, not ink extents here */
|
||||
|
||||
int tw, th;
|
||||
pango_layout_get_pixel_size (layout, &tw, &th);
|
||||
layout->get_pixel_size(tw, th);
|
||||
|
||||
int p = pos - (th / 2);
|
||||
p = min (p, height - th);
|
||||
p = max (p, 0);
|
||||
|
||||
cairo_move_to (cr, 6, p);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
cairo_move_to (cr, 5, p);
|
||||
pango_cairo_show_layout (cr, layout->gobj());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1061,7 +1091,6 @@ GainMeter::render_metrics (Gtk::Widget& w, vector<DataType> types)
|
|||
|
||||
cairo_destroy (cr);
|
||||
cairo_surface_destroy (surface);
|
||||
g_object_unref (layout);
|
||||
|
||||
return pattern;
|
||||
}
|
||||
|
|
@ -1124,11 +1153,43 @@ GainMeterBase::level_meter_button_press (GdkEventButton* ev)
|
|||
void
|
||||
GainMeter::meter_configuration_changed (ChanCount c)
|
||||
{
|
||||
int type = 0;
|
||||
_types.clear ();
|
||||
|
||||
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
|
||||
if (c.get (*i) > 0) {
|
||||
_types.push_back (*i);
|
||||
type |= 1 << (*i);
|
||||
}
|
||||
}
|
||||
|
||||
if (boost::dynamic_pointer_cast<AudioTrack>(_route) == 0
|
||||
&& boost::dynamic_pointer_cast<MidiTrack>(_route) == 0
|
||||
) {
|
||||
if (_route->active()) {
|
||||
set_meter_strip_name ("AudioBusMetrics");
|
||||
} else {
|
||||
set_meter_strip_name ("AudioBusMetricsInactive");
|
||||
}
|
||||
}
|
||||
else if (type == (1 << DataType::AUDIO)) {
|
||||
if (_route->active()) {
|
||||
set_meter_strip_name ("AudioTrackMetrics");
|
||||
} else {
|
||||
set_meter_strip_name ("AudioTrackMetricsInactive");
|
||||
}
|
||||
}
|
||||
else if (type == (1 << DataType::MIDI)) {
|
||||
if (_route->active()) {
|
||||
set_meter_strip_name ("MidiTrackMetrics");
|
||||
} else {
|
||||
set_meter_strip_name ("MidiTrackMetricsInactive");
|
||||
}
|
||||
} else {
|
||||
if (_route->active()) {
|
||||
set_meter_strip_name ("AudioMidiTrackMetrics");
|
||||
} else {
|
||||
set_meter_strip_name ("AudioMidiTrackMetricsInactive");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,10 @@ GenericPluginUI::build ()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (plugin->describe_parameter (Evoral::Parameter(PluginAutomation, 0, i)) == X_("hidden")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ControlUI* cui;
|
||||
|
||||
boost::shared_ptr<ARDOUR::AutomationControl> c
|
||||
|
|
|
|||
0
gtk2_ardour/icons/grabber_note.png
Executable file → Normal file
|
Before Width: | Height: | Size: 793 B After Width: | Height: | Size: 793 B |
0
gtk2_ardour/icons/join_tools.png
Executable file → Normal file
|
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
BIN
gtk2_ardour/icons/tav_exp.png
Executable file → Normal file
|
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 404 B |
BIN
gtk2_ardour/icons/tav_shrink.png
Executable file → Normal file
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 625 B |
0
gtk2_ardour/icons/trim_left_cursor_right_only.png
Executable file → Normal file
|
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 578 B |
0
gtk2_ardour/icons/trim_right_cursor_left_only.png
Executable file → Normal file
|
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 564 B |
|
|
@ -1,190 +0,0 @@
|
|||
// Generated by gtkmmproc -- DO NOT MODIFY!
|
||||
|
||||
#include "imageframe.h"
|
||||
#include "imageframe_p.h"
|
||||
#include <libgnomecanvasmm/private/shape_p.h>
|
||||
|
||||
|
||||
/* rect.c
|
||||
*
|
||||
* Copyright (C) 1998 EMC Capital Management Inc.
|
||||
* Developed by Havoc Pennington <hp@pobox.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
namespace Gnome
|
||||
{
|
||||
|
||||
namespace Canvas
|
||||
{
|
||||
|
||||
ImageFrame::ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk::AnchorType anchor, double w, double h)
|
||||
: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
|
||||
{
|
||||
item_construct(parentx);
|
||||
set("pixbuf", pbuf, "x", x,"y", y,"width", w,"height", h, 0);
|
||||
}
|
||||
|
||||
ImageFrame::ImageFrame(Group& parentx)
|
||||
: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
|
||||
{
|
||||
item_construct(parentx);
|
||||
}
|
||||
|
||||
} /* namespace Canvas */
|
||||
} /* namespace Gnome */
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
Gnome::Canvas::ImageFrame* wrap(GnomeCanvasImageFrame* object, bool take_copy)
|
||||
{
|
||||
return dynamic_cast<Gnome::Canvas::ImageFrame *> (Glib::wrap_auto ((GObject*)(object), take_copy));
|
||||
}
|
||||
|
||||
} /* namespace Glib */
|
||||
|
||||
namespace Gnome
|
||||
{
|
||||
|
||||
namespace Canvas
|
||||
{
|
||||
|
||||
|
||||
/* The *_Class implementation: */
|
||||
|
||||
const Glib::Class& ImageFrame_Class::init()
|
||||
{
|
||||
if(!gtype_) // create the GType if necessary
|
||||
{
|
||||
// Glib::Class has to know the class init function to clone custom types.
|
||||
class_init_func_ = &ImageFrame_Class::class_init_function;
|
||||
|
||||
// This is actually just optimized away, apparently with no harm.
|
||||
// Make sure that the parent type has been created.
|
||||
//CppClassParent::CppObjectType::get_type();
|
||||
|
||||
// Create the wrapper type, with the same class/instance size as the base type.
|
||||
register_derived_type(gnome_canvas_imageframe_get_type());
|
||||
|
||||
// Add derived versions of interfaces, if the C type implements any interfaces:
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ImageFrame_Class::class_init_function(void* g_class, void* class_data)
|
||||
{
|
||||
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
|
||||
CppClassParent::class_init_function(klass, class_data);
|
||||
|
||||
}
|
||||
|
||||
Glib::ObjectBase* ImageFrame_Class::wrap_new(GObject* o)
|
||||
{
|
||||
return manage(new ImageFrame((GnomeCanvasImageFrame*)(o)));
|
||||
|
||||
}
|
||||
|
||||
/* The implementation: */
|
||||
|
||||
ImageFrame::ImageFrame(const Glib::ConstructParams& construct_params)
|
||||
: Item(construct_params)
|
||||
{
|
||||
}
|
||||
|
||||
ImageFrame::ImageFrame(GnomeCanvasImageFrame* castitem)
|
||||
: Item ((GnomeCanvasItem*)(castitem))
|
||||
{
|
||||
}
|
||||
|
||||
ImageFrame::~ImageFrame()
|
||||
{
|
||||
destroy_();
|
||||
}
|
||||
|
||||
ImageFrame::CppClassType ImageFrame::rect_class_; // initialize static member
|
||||
|
||||
GType ImageFrame::get_type()
|
||||
{
|
||||
return rect_class_.init().get_type();
|
||||
}
|
||||
|
||||
GType ImageFrame::get_base_type()
|
||||
{
|
||||
return gnome_canvas_imageframe_get_type();
|
||||
}
|
||||
|
||||
Glib::PropertyProxy<double> ImageFrame::property_x()
|
||||
{
|
||||
return Glib::PropertyProxy<double> (this, "x");
|
||||
}
|
||||
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_x() const
|
||||
{
|
||||
return Glib::PropertyProxy_ReadOnly<double> (this, "x");
|
||||
}
|
||||
Glib::PropertyProxy<double> ImageFrame::property_y()
|
||||
{
|
||||
return Glib::PropertyProxy<double> (this, "y");
|
||||
}
|
||||
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_y() const
|
||||
{
|
||||
return Glib::PropertyProxy_ReadOnly<double> (this, "y");
|
||||
}
|
||||
Glib::PropertyProxy<double> ImageFrame::property_width()
|
||||
{
|
||||
return Glib::PropertyProxy<double> (this, "width");
|
||||
}
|
||||
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_width() const
|
||||
{
|
||||
return Glib::PropertyProxy_ReadOnly<double> (this, "width");
|
||||
}
|
||||
Glib::PropertyProxy<double> ImageFrame::property_drawwidth()
|
||||
{
|
||||
return Glib::PropertyProxy<double> (this, "drawwidth");
|
||||
}
|
||||
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_drawwidth() const
|
||||
{
|
||||
return Glib::PropertyProxy_ReadOnly<double> (this, "drawwidth");
|
||||
}
|
||||
Glib::PropertyProxy<double> ImageFrame::property_height()
|
||||
{
|
||||
return Glib::PropertyProxy<double> (this, "height");
|
||||
}
|
||||
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_height() const
|
||||
{
|
||||
return Glib::PropertyProxy_ReadOnly<double> (this, "height");
|
||||
}
|
||||
Glib::PropertyProxy<Gtk::AnchorType> ImageFrame::property_anchor()
|
||||
{
|
||||
return Glib::PropertyProxy<Gtk::AnchorType>(this, "anchor");
|
||||
}
|
||||
Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> ImageFrame::property_anchor() const
|
||||
{
|
||||
return Glib::PropertyProxy_ReadOnly<Gtk::AnchorType>(this, "anchor");
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace Canvas
|
||||
|
||||
} // namespace Gnome
|
||||
|
|
@ -1,143 +0,0 @@
|
|||
// -*- c++ -*-
|
||||
#ifndef _LIBGNOMECANVASMM_IMAGEFRAME_H
|
||||
#define _LIBGNOMECANVASMM_IMAGEFRAME_H
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
|
||||
/* rect.h
|
||||
*
|
||||
* Copyright (C) 1998 EMC Capital Management Inc.
|
||||
* Developed by Havoc Pennington <hp@pobox.com>
|
||||
*
|
||||
* Copyright (C) 1999 The Gtk-- Development Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <libgnomecanvasmm/item.h>
|
||||
#include <libgnomecanvasmm/group.h>
|
||||
#include <libgnomecanvasmm/shape.h>
|
||||
#include "canvas-imageframe.h"
|
||||
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame;
|
||||
typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
|
||||
namespace Gnome
|
||||
{
|
||||
|
||||
namespace Canvas
|
||||
{ class ImageFrame_Class; } // namespace Canvas
|
||||
|
||||
} // namespace Gnome
|
||||
namespace Gnome
|
||||
{
|
||||
|
||||
namespace Canvas
|
||||
{
|
||||
|
||||
//class Group;
|
||||
|
||||
|
||||
class ImageFrame : public Item
|
||||
{
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef ImageFrame CppObjectType;
|
||||
typedef ImageFrame_Class CppClassType;
|
||||
typedef GnomeCanvasImageFrame BaseObjectType;
|
||||
typedef GnomeCanvasImageFrameClass BaseClassType;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
virtual ~ImageFrame();
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
private:
|
||||
friend class ImageFrame_Class;
|
||||
static CppClassType rect_class_;
|
||||
|
||||
// noncopyable
|
||||
ImageFrame(const ImageFrame&);
|
||||
ImageFrame& operator=(const ImageFrame&);
|
||||
|
||||
protected:
|
||||
explicit ImageFrame(const Glib::ConstructParams& construct_params);
|
||||
explicit ImageFrame(GnomeCanvasImageFrame* castitem);
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
static GType get_type() G_GNUC_CONST;
|
||||
static GType get_base_type() G_GNUC_CONST;
|
||||
#endif
|
||||
|
||||
///Provides access to the underlying C GtkObject.
|
||||
GnomeCanvasImageFrame* gobj() { return reinterpret_cast<GnomeCanvasImageFrame*>(gobject_); }
|
||||
|
||||
///Provides access to the underlying C GtkObject.
|
||||
const GnomeCanvasImageFrame* gobj() const { return reinterpret_cast<GnomeCanvasImageFrame*>(gobject_); }
|
||||
|
||||
|
||||
public:
|
||||
//C++ methods used to invoke GTK+ virtual functions:
|
||||
|
||||
protected:
|
||||
//GTK+ Virtual Functions (override these to change behaviour):
|
||||
|
||||
//Default Signal Handlers::
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
public:
|
||||
ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk::AnchorType anchor, double w, double h);
|
||||
explicit ImageFrame(Group& parent);
|
||||
|
||||
Glib::PropertyProxy<double> property_x();
|
||||
Glib::PropertyProxy_ReadOnly<double> property_x() const;
|
||||
Glib::PropertyProxy<double> property_y();
|
||||
Glib::PropertyProxy_ReadOnly<double> property_y() const;
|
||||
Glib::PropertyProxy<double> property_width();
|
||||
Glib::PropertyProxy_ReadOnly<double> property_width() const;
|
||||
Glib::PropertyProxy<double> property_drawwidth();
|
||||
Glib::PropertyProxy_ReadOnly<double> property_drawwidth() const;
|
||||
Glib::PropertyProxy<double> property_height();
|
||||
Glib::PropertyProxy_ReadOnly<double> property_height() const;
|
||||
Glib::PropertyProxy<Gtk::AnchorType> property_anchor() ;
|
||||
Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> property_anchor() const;
|
||||
|
||||
};
|
||||
|
||||
} /* namespace Canvas */
|
||||
} /* namespace Gnome */
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
/** @relates Gnome::Canvas::ImageFrame
|
||||
* @param object The C instance
|
||||
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*/
|
||||
Gnome::Canvas::ImageFrame* wrap(GnomeCanvasImageFrame* object, bool take_copy = false);
|
||||
}
|
||||
#endif /* _LIBGNOMECANVASMM_IMAGEFRAME_H */
|
||||
|
||||
|
|
@ -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 */
|
||||
|
||||
|
|
@ -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__ */
|
||||
|
|
@ -1,422 +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 "simplerect.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 "canvas_impl.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 samples per unit that are used.
|
||||
* This is used to determine the siezes of items upon this time axis
|
||||
*
|
||||
* @param spu the number of samples per unit
|
||||
*/
|
||||
void
|
||||
ImageFrameTimeAxis::set_samples_per_unit(double spu)
|
||||
{
|
||||
TimeAxisView::set_samples_per_unit (editor.get_current_zoom());
|
||||
|
||||
if(view) {
|
||||
view->set_samples_per_unit(spu) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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) ;
|
||||
}
|
||||
|
|
@ -1,203 +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 <libgnomecanvas.h>
|
||||
|
||||
#include "ardour_dialog.h"
|
||||
#include "enums.h"
|
||||
#include "time_axis_view.h"
|
||||
#include "canvas.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) ;
|
||||
|
||||
/**
|
||||
* Sets the number of samples per unit that are used.
|
||||
* This is used to determine the siezes of items upon this time axis
|
||||
*
|
||||
* @param spu the number of samples per unit
|
||||
*/
|
||||
virtual void set_samples_per_unit(double spu) ;
|
||||
|
||||
/**
|
||||
* 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__ */
|
||||
|
||||
|
|
@ -1,461 +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 "canvas-simplerect.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_units(gdouble spp)
|
||||
{
|
||||
if(spp < 1.0)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
for(ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); ++citer)
|
||||
{
|
||||
(*citer)->set_samples_per_unit(spp);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -1,300 +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 <libgnomecanvas/libgnomecanvas.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) ;
|
||||
|
||||
/**
|
||||
* 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 set_item_samples_per_units(gdouble spu) ;
|
||||
|
||||
/**
|
||||
* 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_unit() ;
|
||||
|
||||
/**
|
||||
* 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__ */
|
||||
|
|
@ -1,437 +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 "canvas-simplerect.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()->canvasvar_ImageTrack.get() ;
|
||||
|
||||
canvas_rect.property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ImageTrack.get();
|
||||
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_unit = _trackview.editor.get_current_zoom() ;
|
||||
|
||||
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &ImageFrameTimeAxisView::reset_samples_per_unit)) ;
|
||||
|
||||
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_unit (gdouble spp)
|
||||
{
|
||||
if (spp < 1.0) {
|
||||
return(-1) ;
|
||||
}
|
||||
|
||||
_samples_per_unit = spp;
|
||||
|
||||
for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer)
|
||||
{
|
||||
(*citer)->set_item_samples_per_units(spp) ;
|
||||
}
|
||||
|
||||
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_unit ()
|
||||
{
|
||||
set_samples_per_unit (_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) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,275 +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>
|
||||
|
||||
#include <libgnomecanvasmm.h>
|
||||
#include "canvas.h"
|
||||
#include "simplerect.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) ;
|
||||
|
||||
/**
|
||||
* 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 set_samples_per_unit(gdouble spu) ;
|
||||
|
||||
/**
|
||||
* 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_unit() { return _samples_per_unit; }
|
||||
|
||||
/**
|
||||
* 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_unit() ;
|
||||
|
||||
/**
|
||||
* 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::SimpleRect canvas_rect; /* frame around the whole thing */
|
||||
|
||||
/** the current samples per unit */
|
||||
double _samples_per_unit ;
|
||||
|
||||
/* XXX why are these different? */
|
||||
Gdk::Color region_color ;
|
||||
uint32_t stream_base_color ;
|
||||
|
||||
} ; /* class ImageFrameTimeAxisView */
|
||||
|
||||
#endif /* __ardour_imageframe_time_axis_view_h__ */
|
||||
|
|
@ -1,371 +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 "canvas_impl.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.frame_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_pixbuf->raise_to_top();
|
||||
frame_handle_start->raise_to_top();
|
||||
frame_handle_end->raise_to_top();
|
||||
|
||||
name_pixbuf->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);
|
||||
}
|
||||
|
|
@ -1,212 +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 <libgnomecanvas/libgnomecanvas.h>
|
||||
#include <sigc++/signal.h>
|
||||
#include <list>
|
||||
|
||||
#include "canvas.h"
|
||||
#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__ */
|
||||
|
|
@ -224,8 +224,6 @@ IOSelectorWindow::IOSelectorWindow (ARDOUR::Session* session, boost::shared_ptr<
|
|||
|
||||
add (_selector);
|
||||
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
io_name_changed (this);
|
||||
|
||||
show_all ();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
0
gtk2_ardour/lxvst_plugin_ui.h
Executable file → Normal file
|
|
@ -184,6 +184,8 @@ fixup_bundle_environment (int, char* [])
|
|||
export_search_path (bundle_dir, "SUIL_MODULE_DIR", "/lib");
|
||||
export_search_path (bundle_dir, "GTK_PATH", "/lib/gtkengines");
|
||||
|
||||
setenv ("PATH", (bundle_dir + "/MacOS:" + std::string(getenv ("PATH"))).c_str(), 1);
|
||||
|
||||
/* unset GTK_RC_FILES so that we only load the RC files that we define
|
||||
*/
|
||||
|
||||
|
|
@ -296,6 +298,8 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
|
|||
export_search_path (dir_path, "SUIL_MODULE_DIR", "/lib");
|
||||
export_search_path (dir_path, "GTK_PATH", "/lib/gtkengines");
|
||||
|
||||
setenv ("PATH", (dir_path + "/bin:" + std::string(getenv ("PATH"))).c_str(), 1);
|
||||
|
||||
/* unset GTK_RC_FILES so that we only load the RC files that we define
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -1,281 +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 "canvas_impl.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 samples per unit that are used.
|
||||
* This is used to determine the sizes of items upon this time axis
|
||||
*
|
||||
* @param spu the number of samples per unit
|
||||
*/
|
||||
void
|
||||
MarkerTimeAxis::set_samples_per_unit(double spu)
|
||||
{
|
||||
TimeAxisView::set_samples_per_unit (editor.get_current_zoom());
|
||||
|
||||
if (view) {
|
||||
view->set_samples_per_unit(spu) ;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,156 +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 <libgnomecanvas/libgnomecanvas.h>
|
||||
|
||||
#include "ardour_dialog.h"
|
||||
#include "route_ui.h"
|
||||
#include "enums.h"
|
||||
#include "time_axis_view.h"
|
||||
#include "canvas.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) ;
|
||||
|
||||
/**
|
||||
* Sets the number of samples per unit that are used.
|
||||
* This is used to determine the sizes of items upon this time axis
|
||||
*
|
||||
* @param spu the number of samples per unit
|
||||
*/
|
||||
virtual void set_samples_per_unit(double spu) ;
|
||||
|
||||
|
||||
/**
|
||||
* 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__ */
|
||||
|
||||
|
|
@ -1,389 +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 "canvas-simplerect.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()->canvasvar_MarkerTrack.get();
|
||||
|
||||
canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display);
|
||||
|
||||
canvas_rect = new ArdourCanvas::SimpleRect (*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()->canvasvar_MarkerTrack.get();
|
||||
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_unit = _trackview.editor.get_current_zoom() ;
|
||||
|
||||
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_unit));
|
||||
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 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
|
||||
MarkerTimeAxisView::set_samples_per_unit(gdouble spp)
|
||||
{
|
||||
if(spp < 1.0) {
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
_samples_per_unit = spp ;
|
||||
|
||||
for(MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i)
|
||||
{
|
||||
(*i)->set_samples_per_unit(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_unit ()
|
||||
{
|
||||
set_samples_per_unit(_trackview.editor.get_current_zoom()) ;
|
||||
}
|
||||
|
|
@ -1,239 +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 <libgnomecanvasmm/group.h>
|
||||
|
||||
#include "ardour/location.h"
|
||||
#include "simplerect.h"
|
||||
#include "canvas.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) ;
|
||||
|
||||
/**
|
||||
* 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 set_samples_per_unit(gdouble spu) ;
|
||||
|
||||
/**
|
||||
* 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_unit() { return _samples_per_unit; }
|
||||
|
||||
/**
|
||||
* 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_unit() ;
|
||||
|
||||
/** 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::SimpleRect *canvas_rect ; /* frame around the whole thing */
|
||||
|
||||
/** the current samples per unit */
|
||||
double _samples_per_unit;
|
||||
|
||||
/* XXX why are these different? */
|
||||
Gdk::Color region_color;
|
||||
uint32_t stream_base_color;
|
||||
|
||||
}; /* class MarkerTimeAxisView */
|
||||
|
||||
#endif /* __ardour_marker_time_axis_view_h__ */
|
||||
|
|
@ -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.
|
||||
|
||||
*/
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "imageframe_time_axis.h"
|
||||
#include "imageframe_view.h"
|
||||
#include "canvas-simplerect.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) ;
|
||||
}
|
||||
|
|
@ -1,136 +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"
|
||||
|
||||
#include "canvas.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__ */
|
||||
0
gtk2_ardour/midi_automation_line.cc
Executable file → Normal file
0
gtk2_ardour/midi_automation_line.h
Executable file → Normal file
|
|
@ -42,7 +42,6 @@ MidiPortDialog::MidiPortDialog ()
|
|||
set_modal (true);
|
||||
set_skip_taskbar_hint (true);
|
||||
set_resizable (false);
|
||||
set_position (Gtk::WIN_POS_MOUSE);
|
||||
set_name (N_("MidiPortDialog"));
|
||||
|
||||
vector<string> str = internationalize (PACKAGE, mode_strings);
|
||||
|
|
|
|||
|
|
@ -3740,8 +3740,6 @@ MidiRegionView::edit_patch_change (ArdourCanvas::CanvasPatchChange* pc)
|
|||
{
|
||||
PatchChangeDialog d (&_source_relative_time_converter, trackview.session(), *pc->patch (), instrument_info(), Gtk::Stock::APPLY, true);
|
||||
|
||||
d.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
int response = d.run();
|
||||
|
||||
switch (response) {
|
||||
|
|
|
|||
|
|
@ -517,7 +517,6 @@ MidiTimeAxisView::toggle_channel_selector ()
|
|||
_channel_selector->set_default_channel_color ();
|
||||
}
|
||||
|
||||
_channel_selector->set_position (WIN_POS_MOUSE);
|
||||
_channel_selector->show_all ();
|
||||
} else {
|
||||
_channel_selector->cycle_visibility ();
|
||||
|
|
@ -1486,13 +1485,13 @@ MidiTimeAxisView::playback_channel_mode_changed ()
|
|||
{
|
||||
switch (midi_track()->get_playback_channel_mode()) {
|
||||
case AllChannels:
|
||||
_playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Play"), ("all")));
|
||||
_playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Play"), _("all")));
|
||||
break;
|
||||
case FilterChannels:
|
||||
_playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Play"), ("some")));
|
||||
_playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Play"), _("some")));
|
||||
break;
|
||||
case ForceChannel:
|
||||
_playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Play"), ("all"), ffs (midi_track()->get_playback_channel_mask())));
|
||||
_playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Play"), _("all"), ffs (midi_track()->get_playback_channel_mask())));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1502,13 +1501,13 @@ MidiTimeAxisView::capture_channel_mode_changed ()
|
|||
{
|
||||
switch (midi_track()->get_capture_channel_mode()) {
|
||||
case AllChannels:
|
||||
_capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Rec"), ("all")));
|
||||
_capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Rec"), _("all")));
|
||||
break;
|
||||
case FilterChannels:
|
||||
_capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Rec"), ("some")));
|
||||
_capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Rec"), _("some")));
|
||||
break;
|
||||
case ForceChannel:
|
||||
_capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Rec"), ("all"), ffs (midi_track()->get_capture_channel_mask())));
|
||||
_capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Rec"), _("all"), ffs (midi_track()->get_capture_channel_mask())));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
gtk2_ardour/missing_plugin_dialog.cc
Executable file → Normal file
0
gtk2_ardour/missing_plugin_dialog.h
Executable file → Normal file
|
|
@ -1358,7 +1358,6 @@ void
|
|||
MixerStrip::setup_comment_editor ()
|
||||
{
|
||||
comment_window = new ArdourWindow (""); // title will be reset to show route
|
||||
comment_window->set_position (Gtk::WIN_POS_MOUSE);
|
||||
comment_window->set_skip_taskbar_hint (true);
|
||||
comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing));
|
||||
comment_window->set_default_size (400, 200);
|
||||
|
|
@ -1666,28 +1665,22 @@ MixerStrip::reset_strip_style ()
|
|||
if (is_midi_track()) {
|
||||
if (_route->active()) {
|
||||
set_name ("MidiTrackStripBase");
|
||||
gpm.set_meter_strip_name ("MidiTrackMetrics");
|
||||
} else {
|
||||
set_name ("MidiTrackStripBaseInactive");
|
||||
gpm.set_meter_strip_name ("MidiTrackMetricsInactive");
|
||||
}
|
||||
gpm.set_fader_name ("MidiTrackFader");
|
||||
} else if (is_audio_track()) {
|
||||
if (_route->active()) {
|
||||
set_name ("AudioTrackStripBase");
|
||||
gpm.set_meter_strip_name ("AudioTrackMetrics");
|
||||
} else {
|
||||
set_name ("AudioTrackStripBaseInactive");
|
||||
gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
|
||||
}
|
||||
gpm.set_fader_name ("AudioTrackFader");
|
||||
} else {
|
||||
if (_route->active()) {
|
||||
set_name ("AudioBusStripBase");
|
||||
gpm.set_meter_strip_name ("AudioBusMetrics");
|
||||
} else {
|
||||
set_name ("AudioBusStripBaseInactive");
|
||||
gpm.set_meter_strip_name ("AudioBusMetricsInactive");
|
||||
}
|
||||
gpm.set_fader_name ("AudioBusFader");
|
||||
|
||||
|
|
|
|||
|
|
@ -158,13 +158,13 @@ This mode provides many different operations on both regions and control points,
|
|||
@mmode|MouseMode/set-mouse-mode-object|o|object mode
|
||||
@sess|Main/Open|<@PRIMARY@>o|open an existing session
|
||||
@sess|Main/Recent|<@PRIMARY@><@TERTIARY@>o|open a recent session
|
||||
@wvis|Common/ToggleOptionsEditor|<@WINDOW@>o|toggle preferences dialog
|
||||
@wvis|Window/toggle-session-options-editor|<@WINDOW@>o|toggle preferences dialog
|
||||
@rop|Region/naturalize-region|<@SECONDARY@>o|move to original position
|
||||
@trans|Editor/set-playhead|p|set playhead position
|
||||
@select|Editor/select-all-before-playhead|<@PRIMARY@>p|all before playhead
|
||||
@wvis|Common/ToggleRCOptionsEditor|<@PRIMARY@><@TERTIARY@>p|toggle preferences dialog
|
||||
@wvis|Common/toggle-audio-connection-manager|<@WINDOW@>p|toggle global audio patchbay
|
||||
@wvis|Common/toggle-midi-connection-manager|<@WINDOW@><@TERTIARY@>p|toggle global midi patchbay
|
||||
@wvis|Window/toggle-rc-options-editor|<@PRIMARY@><@TERTIARY@>p|toggle preferences dialog
|
||||
@wvis|Window/toggle-audio-connection-manager|<@WINDOW@>p|toggle global audio patchbay
|
||||
@wvis|Window/toggle-midi-connection-manager|<@WINDOW@><@TERTIARY@>p|toggle global midi patchbay
|
||||
@midi|MIDI/panic|<@PRIMARY@><@SECONDARY@>p|MIDI panic (stop all notes etc)
|
||||
@select|Editor/select-all-after-playhead|<@TERTIARY@><@PRIMARY@>p|all after playhead
|
||||
|
||||
|
|
@ -194,10 +194,10 @@ This mode provides many different operations on both regions and control points,
|
|||
@epp|Region/play-selected-regions|h|play selected region(s)
|
||||
@eep|Region/trim-front|j|trim front
|
||||
@eep|Region/trim-back|k|trim back
|
||||
@wvis|Common/ToggleKeyEditor|<@WINDOW@>k|toggle key bindings editor
|
||||
@wvis|Window/toggle-key-editor|<@WINDOW@>k|toggle key bindings editor
|
||||
@trans|Transport/Loop|l|loop play (the loop range)
|
||||
@select|Editor/select-all-in-loop-range|<@PRIMARY@>l|select all in loop range
|
||||
@wvis|Common/ToggleLocations|<@WINDOW@>l| toggle locations dialog
|
||||
@wvis|Window/toggle-locations|<@WINDOW@>l| toggle locations dialog
|
||||
|
||||
;; BOTTOM ROW
|
||||
|
||||
|
|
@ -209,12 +209,12 @@ This mode provides many different operations on both regions and control points,
|
|||
@edit|Editor/editor-cut|<@PRIMARY@>x|cut
|
||||
@-group|Editor/crop|c|some text
|
||||
@edit|Editor/editor-copy|<@PRIMARY@>c|copy
|
||||
@wvis|Common/ToggleColorManager|<@WINDOW@>c|toggle color manager
|
||||
@wvis|Window/toggle-theme-manager|<@WINDOW@>c|toggle color manager
|
||||
@rop|Region/set-region-sync-position|v|set region sync point
|
||||
@edit|Editor/editor-paste|<@PRIMARY@>v|paste
|
||||
@-group|Editor/brush-at-mouse|<@PRIMARY@>b|some text
|
||||
@trans|Editor/track-record-enable-toggle|<@TERTIARY@>b|toggle track rec-enable
|
||||
@wvis|Common/ToggleBigClock|<@WINDOW@>b|toggle big clock
|
||||
@wvis|Window/toggle-big-clock|<@WINDOW@>b|toggle big clock
|
||||
@rop|Region/normalize-region|n|normalize
|
||||
@sess|Main/AddTrackBus|<@PRIMARY@><@TERTIARY@>n|add track(s) or bus(ses)
|
||||
@sess|Main/New|<@PRIMARY@>n|open a new session
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ NSM_Client::command_save(char **out_msg)
|
|||
|
||||
int
|
||||
NSM_Client::command_open(const char* name,
|
||||
const char *display_name,
|
||||
const char* /*display_name*/,
|
||||
const char* client_id,
|
||||
char **out_msg)
|
||||
char** /*out_msg*/)
|
||||
{
|
||||
int r = ERR_OK;
|
||||
|
||||
|
|
|
|||